@activepieces/piece-pipedrive 0.8.8 → 0.8.9
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 +2 -4
- package/src/index.js +3 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Ac=Object.create;var Lt=Object.defineProperty;var $c=Object.getOwnPropertyDescriptor;var Sc=Object.getOwnPropertyNames;var wc=Object.getPrototypeOf,zc=Object.prototype.hasOwnProperty;var o=(e,t)=>Lt(e,"name",{value:t,configurable:!0});var U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),li=(e,t)=>{for(var r in t)Lt(e,r,{get:t[r],enumerable:!0})},di=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Sc(t))!zc.call(e,i)&&i!==r&&Lt(e,i,{get:()=>t[i],enumerable:!(n=$c(t,i))||n.enumerable});return e};var $e=(e,t,r)=>(r=e!=null?Ac(wc(e)):{},di(t||!e||!e.__esModule?Lt(r,"default",{value:e,enumerable:!0}):r,e)),kc=e=>di(Lt({},"__esModule",{value:!0}),e);var wo=U((So,zr)=>{(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")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(l,m){if(l.indexOf("::")!==l.lastIndexOf("::"))return null;let h=0,f=-1,b=(l.match(c.zoneIndex)||[])[0],I,k;for(b&&(b=b.substring(1),l=l.replace(/%.+$/,""));(f=l.indexOf(":",f+1))>=0;)h++;if(l.substr(0,2)==="::"&&h--,l.substr(-2,2)==="::"&&h--,h>m)return null;for(k=m-h,I=":";k--;)I+="0:";return l=l.replace("::",I),l[0]===":"&&(l=l.slice(1)),l[l.length-1]===":"&&(l=l.slice(0,-1)),m=function(){let te=l.split(":"),ve=[];for(let Le=0;Le<te.length;Le++)ve.push(parseInt(te[Le],16));return ve}(),{parts:m,zoneId:b}}o(d,"expandIPv6");function p(l,m,h,f){if(l.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let b=0,I;for(;f>0;){if(I=h-f,I<0&&(I=0),l[b]>>I!==m[b]>>I)return!1;f-=h,b+=1}return!0}o(p,"matchCIDR");function _(l){if(i.test(l))return parseInt(l,16);if(l[0]==="0"&&!isNaN(parseInt(l[1],10))){if(n.test(l))return parseInt(l,8);throw new Error(`ipaddr: cannot parse ${l} as octal`)}return parseInt(l,10)}o(_,"parseIntAuto");function x(l,m){for(;l.length<m;)l=`0${l}`;return l}o(x,"padPart");let v={};v.IPv4=function(){function l(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let h,f;for(h=0;h<m.length;h++)if(f=m[h],!(0<=f&&f<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return o(l,"IPv4"),l.prototype.SpecialRanges={unspecified:[[new l([0,0,0,0]),8]],broadcast:[[new l([255,255,255,255]),32]],multicast:[[new l([224,0,0,0]),4]],linkLocal:[[new l([169,254,0,0]),16]],loopback:[[new l([127,0,0,0]),8]],carrierGradeNat:[[new l([100,64,0,0]),10]],private:[[new l([10,0,0,0]),8],[new l([172,16,0,0]),12],[new l([192,168,0,0]),16]],reserved:[[new l([192,0,0,0]),24],[new l([192,0,2,0]),24],[new l([192,88,99,0]),24],[new l([198,18,0,0]),15],[new l([198,51,100,0]),24],[new l([203,0,113,0]),24],[new l([240,0,0,0]),4]],as112:[[new l([192,175,48,0]),24],[new l([192,31,196,0]),24]],amt:[[new l([192,52,193,0]),24]]},l.prototype.kind=function(){return"ipv4"},l.prototype.match=function(m,h){let f;if(h===void 0&&(f=m,m=f[0],h=f[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return p(this.octets,m.octets,8,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,f={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},b,I,k;for(b=3;b>=0;b-=1)if(I=this.octets[b],I in f){if(k=f[I],h&&k!==0)return null;k!==8&&(h=!0),m+=k}else return null;return 32-m},l.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){return this.octets.slice(0)},l.prototype.toIPv4MappedAddress=function(){return v.IPv6.parse(`::ffff:${this.toString()}`)},l.prototype.toNormalizedString=function(){return this.toString()},l.prototype.toString=function(){return this.octets.join(".")},l}(),v.IPv4.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),f=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),b=[],I=0;for(;I<4;)b.push(parseInt(h[I],10)|parseInt(f[I],10)^255),I++;return new this(b)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},v.IPv4.isIPv4=function(l){return this.parser(l)!==null},v.IPv4.isValid=function(l){try{return new this(this.parser(l)),!0}catch{return!1}},v.IPv4.isValidCIDR=function(l){try{return this.parseCIDR(l),!0}catch{return!1}},v.IPv4.isValidFourPartDecimal=function(l){return!!(v.IPv4.isValid(l)&&l.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},v.IPv4.isValidCIDRFourPartDecimal=function(l){let m=l.match(/^(.+)\/(\d+)$/);return!v.IPv4.isValidCIDR(l)||!m?!1:v.IPv4.isValidFourPartDecimal(m[1])},v.IPv4.networkAddressFromCIDR=function(l){let m,h,f,b,I;try{for(m=this.parseCIDR(l),f=m[0].toByteArray(),I=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),b=[],h=0;h<4;)b.push(parseInt(f[h],10)&parseInt(I[h],10)),h++;return new this(b)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},v.IPv4.parse=function(l){let m=this.parser(l);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},v.IPv4.parseCIDR=function(l){let m;if(m=l.match(/^(.+)\/(\d+)$/)){let h=parseInt(m[2]);if(h>=0&&h<=32){let f=[this.parse(m[1]),h];return Object.defineProperty(f,"toString",{value:o(function(){return this.join("/")},"value")}),f}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},v.IPv4.parser=function(l){let m,h,f;if(m=l.match(r.fourOctet))return function(){let b=m.slice(1,6),I=[];for(let k=0;k<b.length;k++)h=b[k],I.push(_(h));return I}();if(m=l.match(r.longValue)){if(f=_(m[1]),f>4294967295||f<0)throw new Error("ipaddr: address outside defined range");return function(){let b=[],I;for(I=0;I<=24;I+=8)b.push(f>>I&255);return b}().reverse()}else return(m=l.match(r.twoOctet))?function(){let b=m.slice(1,4),I=[];if(f=_(b[1]),f>16777215||f<0)throw new Error("ipaddr: address outside defined range");return I.push(_(b[0])),I.push(f>>16&255),I.push(f>>8&255),I.push(f&255),I}():(m=l.match(r.threeOctet))?function(){let b=m.slice(1,5),I=[];if(f=_(b[2]),f>65535||f<0)throw new Error("ipaddr: address outside defined range");return I.push(_(b[0])),I.push(_(b[1])),I.push(f>>8&255),I.push(f&255),I}():null},v.IPv4.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>32)throw new Error("ipaddr: invalid IPv4 prefix length");let m=[0,0,0,0],h=0,f=Math.floor(l/8);for(;h<f;)m[h]=255,h++;return f<4&&(m[f]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},v.IPv6=function(){function l(m,h){let f,b;if(m.length===16)for(this.parts=[],f=0;f<=14;f+=2)this.parts.push(m[f]<<8|m[f+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(f=0;f<this.parts.length;f++)if(b=this.parts[f],!(0<=b&&b<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return o(l,"IPv6"),l.prototype.SpecialRanges={unspecified:[new l([0,0,0,0,0,0,0,0]),128],linkLocal:[new l([65152,0,0,0,0,0,0,0]),10],multicast:[new l([65280,0,0,0,0,0,0,0]),8],loopback:[new l([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new l([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new l([0,0,0,0,0,65535,0,0]),96],discard:[new l([256,0,0,0,0,0,0,0]),64],rfc6145:[new l([0,0,0,0,65535,0,0,0]),96],rfc6052:[new l([100,65435,0,0,0,0,0,0]),96],"6to4":[new l([8194,0,0,0,0,0,0,0]),16],teredo:[new l([8193,0,0,0,0,0,0,0]),32],benchmarking:[new l([8193,2,0,0,0,0,0,0]),48],amt:[new l([8193,3,0,0,0,0,0,0]),32],as112v6:[[new l([8193,4,274,0,0,0,0,0]),48],[new l([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new l([8193,16,0,0,0,0,0,0]),28],orchid2:[new l([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new l([8193,48,0,0,0,0,0,0]),28],reserved:[[new l([8193,0,0,0,0,0,0,0]),23],[new l([8193,3512,0,0,0,0,0,0]),32]]},l.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},l.prototype.kind=function(){return"ipv6"},l.prototype.match=function(m,h){let f;if(h===void 0&&(f=m,m=f[0],h=f[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return p(this.parts,m.parts,16,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,f={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},b,I;for(let k=7;k>=0;k-=1)if(b=this.parts[k],b in f){if(I=f[b],h&&I!==0)return null;I!==16&&(h=!0),m+=I}else return null;return 128-m},l.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){let m,h=[],f=this.parts;for(let b=0;b<f.length;b++)m=f[b],h.push(m>>8),h.push(m&255);return h},l.prototype.toFixedLengthString=function(){let m=function(){let f=[];for(let b=0;b<this.parts.length;b++)f.push(x(this.parts[b].toString(16),4));return f}.call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let m=this.parts.slice(-2),h=m[0],f=m[1];return new v.IPv4([h>>8,h&255,f>>8,f&255])},l.prototype.toNormalizedString=function(){let m=function(){let f=[];for(let b=0;b<this.parts.length;b++)f.push(this.parts[b].toString(16));return f}.call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toRFC5952String=function(){let m=/((^|:)(0(:|$)){2,})/g,h=this.toNormalizedString(),f=0,b=-1,I;for(;I=m.exec(h);)I[0].length>b&&(f=I.index,b=I[0].length);return b<0?h:`${h.substring(0,f)}::${h.substring(f+b)}`},l.prototype.toString=function(){return this.toRFC5952String()},l}(),v.IPv6.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),f=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),b=[],I=0;for(;I<16;)b.push(parseInt(h[I],10)|parseInt(f[I],10)^255),I++;return new this(b)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},v.IPv6.isIPv6=function(l){return this.parser(l)!==null},v.IPv6.isValid=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{let m=this.parser(l);return new this(m.parts,m.zoneId),!0}catch{return!1}},v.IPv6.isValidCIDR=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{return this.parseCIDR(l),!0}catch{return!1}},v.IPv6.networkAddressFromCIDR=function(l){let m,h,f,b,I;try{for(m=this.parseCIDR(l),f=m[0].toByteArray(),I=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),b=[],h=0;h<16;)b.push(parseInt(f[h],10)&parseInt(I[h],10)),h++;return new this(b)}catch(k){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${k})`)}},v.IPv6.parse=function(l){let m=this.parser(l);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},v.IPv6.parseCIDR=function(l){let m,h,f;if((h=l.match(/^(.+)\/(\d+)$/))&&(m=parseInt(h[2]),m>=0&&m<=128))return f=[this.parse(h[1]),m],Object.defineProperty(f,"toString",{value:o(function(){return this.join("/")},"value")}),f;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},v.IPv6.parser=function(l){let m,h,f,b,I,k;if(f=l.match(c.deprecatedTransitional))return this.parser(`::ffff:${f[1]}`);if(c.native.test(l))return d(l,8);if((f=l.match(c.transitional))&&(k=f[6]||"",m=f[1],f[1].endsWith("::")||(m=m.slice(0,-1)),m=d(m+k,6),m.parts)){for(I=[parseInt(f[2]),parseInt(f[3]),parseInt(f[4]),parseInt(f[5])],h=0;h<I.length;h++)if(b=I[h],!(0<=b&&b<=255))return null;return m.parts.push(I[0]<<8|I[1]),m.parts.push(I[2]<<8|I[3]),{parts:m.parts,zoneId:m.zoneId}}return null},v.IPv6.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>128)throw new Error("ipaddr: invalid IPv6 prefix length");let m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,f=Math.floor(l/8);for(;h<f;)m[h]=255,h++;return f<16&&(m[f]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},v.fromByteArray=function(l){let m=l.length;if(m===4)return new v.IPv4(l);if(m===16)return new v.IPv6(l);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},v.isValid=function(l){return v.IPv6.isValid(l)||v.IPv4.isValid(l)},v.isValidCIDR=function(l){return v.IPv6.isValidCIDR(l)||v.IPv4.isValidCIDR(l)},v.parse=function(l){if(v.IPv6.isValid(l))return v.IPv6.parse(l);if(v.IPv4.isValid(l))return v.IPv4.parse(l);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},v.parseCIDR=function(l){try{return v.IPv6.parseCIDR(l)}catch{try{return v.IPv4.parseCIDR(l)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},v.process=function(l){let m=this.parse(l);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},v.subnetMatch=function(l,m,h){let f,b,I,k;h==null&&(h="unicast");for(b in m)if(Object.prototype.hasOwnProperty.call(m,b)){for(I=m[b],I[0]&&!(I[0]instanceof Array)&&(I=[I]),f=0;f<I.length;f++)if(k=I[f],l.kind()===k[0].kind()&&l.match.apply(l,k))return b}return h},typeof zr<"u"&&zr.exports?zr.exports=v:e.ipaddr=v})(So)});var Ea=U((Fw,Ia)=>{var Ta=require("stream").Stream,ap=require("util");Ia.exports=Ue;function Ue(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(Ue,"DelayedStream");ap.inherits(Ue,Ta);Ue.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var i=e.emit;return e.emit=function(){return r._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Ue.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});Ue.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Ue.prototype.resume=function(){this._released||this.release(),this.source.resume()};Ue.prototype.pause=function(){this.source.pause()};Ue.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Ue.prototype.pipe=function(){var e=Ta.prototype.pipe.apply(this,arguments);return this.resume(),e};Ue.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};Ue.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var wa=U((jw,Sa)=>{var sp=require("util"),$a=require("stream").Stream,Aa=Ea();Sa.exports=me;function me(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(me,"CombinedStream");sp.inherits(me,$a);me.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};me.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};me.prototype.append=function(e){var t=me.isStreamLike(e);if(t){if(!(e instanceof Aa)){var r=Aa.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=r}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};me.prototype.pipe=function(e,t){return $a.prototype.pipe.call(this,e,t),this.resume(),e};me.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};me.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var t=e;t(function(r){var n=me.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};me.prototype._pipeNext=function(e){this._currentStream=e;var t=me.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var r=e;this.write(r),this._getNext()};me.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};me.prototype.write=function(e){this.emit("data",e)};me.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};me.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};me.prototype.end=function(){this._reset(),this.emit("end")};me.prototype.destroy=function(){this._reset(),this.emit("close")};me.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};me.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};me.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(t){t.dataSize&&(e.dataSize+=t.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};me.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var ka=U((Bw,za)=>{"use strict";za.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var Ra=U(we=>{"use strict";var Nr=ka(),up=require("path").extname,Oa=/^\s*([^;\s]*)(?:;|\s|$)/,cp=/^text\//i;we.charset=Da;we.charsets={lookup:Da};we.contentType=lp;we.extension=dp;we.extensions=Object.create(null);we.lookup=pp;we.types=Object.create(null);mp(we.extensions,we.types);function Da(e){if(!e||typeof e!="string")return!1;var t=Oa.exec(e),r=t&&Nr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&cp.test(t[1])?"UTF-8":!1}o(Da,"charset");function lp(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?we.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=we.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(lp,"contentType");function dp(e){if(!e||typeof e!="string")return!1;var t=Oa.exec(e),r=t&&we.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(dp,"extension");function pp(e){if(!e||typeof e!="string")return!1;var t=up("x."+e).toLowerCase().substr(1);return t&&we.types[t]||!1}o(pp,"lookup");function mp(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Nr).forEach(o(function(i){var a=Nr[i],s=a.extensions;if(!(!s||!s.length)){e[i]=s;for(var c=0;c<s.length;c++){var d=s[c];if(t[d]){var p=r.indexOf(Nr[t[d]].source),_=r.indexOf(a.source);if(t[d]!=="application/octet-stream"&&(p>_||p===_&&t[d].substr(0,12)==="application/"))continue}t[d]=i}}},"forEachMimeType"))}o(mp,"populateMaps")});var Ca=U((qw,Na)=>{Na.exports=fp;function fp(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(fp,"defer")});var Cn=U((Ww,Ma)=>{var Ua=Ca();Ma.exports=gp;function gp(e){var t=!1;return Ua(function(){t=!0}),o(function(n,i){t?e(n,i):Ua(o(function(){e(n,i)},"nextTick_callback"))},"async_callback")}o(gp,"async")});var Un=U((Jw,Fa)=>{Fa.exports=yp;function yp(e){Object.keys(e.jobs).forEach(hp.bind(e)),e.jobs={}}o(yp,"abort");function hp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(hp,"clean")});var Mn=U((Xw,ja)=>{var La=Cn(),_p=Un();ja.exports=vp;function vp(e,t,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=bp(t,i,e[i],function(a,s){i in r.jobs&&(delete r.jobs[i],a?_p(r):r.results[i]=s,n(a,r.results))})}o(vp,"iterate");function bp(e,t,r,n){var i;return e.length==2?i=e(r,La(n)):i=e(r,t,La(n)),i}o(bp,"runJob")});var Fn=U((ez,Va)=>{Va.exports=Pp;function Pp(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(i,a){return t(e[i],e[a])}),n}o(Pp,"state")});var Ln=U((rz,Ba)=>{var xp=Un(),Tp=Cn();Ba.exports=Ip;function Ip(e){Object.keys(this.jobs).length&&(this.index=this.size,xp(this),Tp(e)(null,this.results))}o(Ip,"terminator")});var Ga=U((iz,Za)=>{var Ep=Mn(),Ap=Fn(),$p=Ln();Za.exports=Sp;function Sp(e,t,r){for(var n=Ap(e);n.index<(n.keyedList||e).length;)Ep(e,t,n,function(i,a){if(i){r(i,a);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return $p.bind(n,r)}o(Sp,"parallel")});var jn=U((az,Cr)=>{var qa=Mn(),wp=Fn(),zp=Ln();Cr.exports=kp;Cr.exports.ascending=Ha;Cr.exports.descending=Op;function kp(e,t,r,n){var i=wp(e,r);return qa(e,t,i,o(function a(s,c){if(s){n(s,c);return}if(i.index++,i.index<(i.keyedList||e).length){qa(e,t,i,a);return}n(null,i.results)},"iteratorHandler")),zp.bind(i,n)}o(kp,"serialOrdered");function Ha(e,t){return e<t?-1:e>t?1:0}o(Ha,"ascending");function Op(e,t){return-1*Ha(e,t)}o(Op,"descending")});var Ka=U((uz,Wa)=>{var Dp=jn();Wa.exports=Rp;function Rp(e,t,r){return Dp(e,t,null,r)}o(Rp,"serial")});var Ya=U((lz,Ja)=>{Ja.exports={parallel:Ga(),serial:Ka(),serialOrdered:jn()}});var Vn=U((dz,Xa)=>{"use strict";Xa.exports=Object});var es=U((pz,Qa)=>{"use strict";Qa.exports=Error});var rs=U((mz,ts)=>{"use strict";ts.exports=EvalError});var is=U((fz,ns)=>{"use strict";ns.exports=RangeError});var as=U((gz,os)=>{"use strict";os.exports=ReferenceError});var us=U((yz,ss)=>{"use strict";ss.exports=SyntaxError});var Ur=U((hz,cs)=>{"use strict";cs.exports=TypeError});var ds=U((_z,ls)=>{"use strict";ls.exports=URIError});var ms=U((vz,ps)=>{"use strict";ps.exports=Math.abs});var gs=U((bz,fs)=>{"use strict";fs.exports=Math.floor});var hs=U((Pz,ys)=>{"use strict";ys.exports=Math.max});var vs=U((xz,_s)=>{"use strict";_s.exports=Math.min});var Ps=U((Tz,bs)=>{"use strict";bs.exports=Math.pow});var Ts=U((Iz,xs)=>{"use strict";xs.exports=Math.round});var Es=U((Ez,Is)=>{"use strict";Is.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var $s=U(($z,As)=>{"use strict";var Np=Es();As.exports=o(function(t){return Np(t)||t===0?t:t<0?-1:1},"sign")});var ws=U((wz,Ss)=>{"use strict";Ss.exports=Object.getOwnPropertyDescriptor});var Bn=U((zz,zs)=>{"use strict";var Mr=ws();if(Mr)try{Mr([],"length")}catch{Mr=null}zs.exports=Mr});var Os=U((kz,ks)=>{"use strict";var Fr=Object.defineProperty||!1;if(Fr)try{Fr({},"a",{value:1})}catch{Fr=!1}ks.exports=Fr});var Zn=U((Oz,Ds)=>{"use strict";Ds.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var a in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,r);if(c.value!==i||c.enumerable!==!0)return!1}return!0},"hasSymbols")});var Cs=U((Rz,Ns)=>{"use strict";var Rs=typeof Symbol<"u"&&Symbol,Cp=Zn();Ns.exports=o(function(){return typeof Rs!="function"||typeof Symbol!="function"||typeof Rs("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Cp()},"hasNativeSymbols")});var Gn=U((Cz,Us)=>{"use strict";Us.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var qn=U((Uz,Ms)=>{"use strict";var Up=Vn();Ms.exports=Up.getPrototypeOf||null});var js=U((Mz,Ls)=>{"use strict";var Mp="Function.prototype.bind called on incompatible ",Fp=Object.prototype.toString,Lp=Math.max,jp="[object Function]",Fs=o(function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var a=0;a<r.length;a+=1)n[a+t.length]=r[a];return n},"concatty"),Vp=o(function(t,r){for(var n=[],i=r||0,a=0;i<t.length;i+=1,a+=1)n[a]=t[i];return n},"slicy"),Bp=o(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");Ls.exports=o(function(t){var r=this;if(typeof r!="function"||Fp.apply(r)!==jp)throw new TypeError(Mp+r);for(var n=Vp(arguments,1),i,a=o(function(){if(this instanceof i){var _=r.apply(this,Fs(n,arguments));return Object(_)===_?_:this}return r.apply(t,Fs(n,arguments))},"binder"),s=Lp(0,r.length-n.length),c=[],d=0;d<s;d++)c[d]="$"+d;if(i=Function("binder","return function ("+Bp(c,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var p=o(function(){},"Empty");p.prototype=r.prototype,i.prototype=new p,p.prototype=null}return i},"bind")});var kt=U((Lz,Vs)=>{"use strict";var Zp=js();Vs.exports=Function.prototype.bind||Zp});var Lr=U((jz,Bs)=>{"use strict";Bs.exports=Function.prototype.call});var Hn=U((Vz,Zs)=>{"use strict";Zs.exports=Function.prototype.apply});var qs=U((Bz,Gs)=>{"use strict";Gs.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ws=U((Zz,Hs)=>{"use strict";var Gp=kt(),qp=Hn(),Hp=Lr(),Wp=qs();Hs.exports=Wp||Gp.call(Hp,qp)});var Js=U((Gz,Ks)=>{"use strict";var Kp=kt(),Jp=Ur(),Yp=Lr(),Xp=Ws();Ks.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new Jp("a function is required");return Xp(Kp,Yp,t)},"callBindBasic")});var ru=U((Hz,tu)=>{"use strict";var Qp=Js(),Ys=Bn(),Qs;try{Qs=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Wn=!!Qs&&Ys&&Ys(Object.prototype,"__proto__"),eu=Object,Xs=eu.getPrototypeOf;tu.exports=Wn&&typeof Wn.get=="function"?Qp([Wn.get]):typeof Xs=="function"?o(function(t){return Xs(t==null?t:eu(t))},"getDunder"):!1});var su=U((Kz,au)=>{"use strict";var nu=Gn(),iu=qn(),ou=ru();au.exports=nu?o(function(t){return nu(t)},"getProto"):iu?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return iu(t)},"getProto"):ou?o(function(t){return ou(t)},"getProto"):null});var Kn=U((Yz,uu)=>{"use strict";var em=Function.prototype.call,tm=Object.prototype.hasOwnProperty,rm=kt();uu.exports=rm.call(em,tm)});var gu=U((Xz,fu)=>{"use strict";var Q,nm=Vn(),im=es(),om=rs(),am=is(),sm=as(),Nt=us(),Rt=Ur(),um=ds(),cm=ms(),lm=gs(),dm=hs(),pm=vs(),mm=Ps(),fm=Ts(),gm=$s(),pu=Function,Jn=o(function(e){try{return pu('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),ar=Bn(),ym=Os(),Yn=o(function(){throw new Rt},"throwTypeError"),hm=ar?function(){try{return arguments.callee,Yn}catch{try{return ar(arguments,"callee").get}catch{return Yn}}}():Yn,Ot=Cs()(),Pe=su(),_m=qn(),vm=Gn(),mu=Hn(),sr=Lr(),Dt={},bm=typeof Uint8Array>"u"||!Pe?Q:Pe(Uint8Array),yt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":Ot&&Pe?Pe([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Dt,"%AsyncGenerator%":Dt,"%AsyncGeneratorFunction%":Dt,"%AsyncIteratorPrototype%":Dt,"%Atomics%":typeof Atomics>"u"?Q:Atomics,"%BigInt%":typeof BigInt>"u"?Q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":im,"%eval%":eval,"%EvalError%":om,"%Float16Array%":typeof Float16Array>"u"?Q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Q:FinalizationRegistry,"%Function%":pu,"%GeneratorFunction%":Dt,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ot&&Pe?Pe(Pe([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ot||!Pe?Q:Pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":nm,"%Object.getOwnPropertyDescriptor%":ar,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":am,"%ReferenceError%":sm,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ot||!Pe?Q:Pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ot&&Pe?Pe(""[Symbol.iterator]()):Q,"%Symbol%":Ot?Symbol:Q,"%SyntaxError%":Nt,"%ThrowTypeError%":hm,"%TypedArray%":bm,"%TypeError%":Rt,"%Uint8Array%":typeof Uint8Array>"u"?Q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Q:Uint32Array,"%URIError%":um,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":sr,"%Function.prototype.apply%":mu,"%Object.defineProperty%":ym,"%Object.getPrototypeOf%":_m,"%Math.abs%":cm,"%Math.floor%":lm,"%Math.max%":dm,"%Math.min%":pm,"%Math.pow%":mm,"%Math.round%":fm,"%Math.sign%":gm,"%Reflect.getPrototypeOf%":vm};if(Pe)try{null.error}catch(e){cu=Pe(Pe(e)),yt["%Error.prototype%"]=cu}var cu,Pm=o(function e(t){var r;if(t==="%AsyncFunction%")r=Jn("async function () {}");else if(t==="%GeneratorFunction%")r=Jn("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Jn("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Pe&&(r=Pe(i.prototype))}return yt[t]=r,r},"doEval"),lu={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ur=kt(),jr=Kn(),xm=ur.call(sr,Array.prototype.concat),Tm=ur.call(mu,Array.prototype.splice),du=ur.call(sr,String.prototype.replace),Vr=ur.call(sr,String.prototype.slice),Im=ur.call(sr,RegExp.prototype.exec),Em=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Am=/\\(\\)?/g,$m=o(function(t){var r=Vr(t,0,1),n=Vr(t,-1);if(r==="%"&&n!=="%")throw new Nt("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Nt("invalid intrinsic syntax, expected opening `%`");var i=[];return du(t,Em,function(a,s,c,d){i[i.length]=c?du(d,Am,"$1"):s||a}),i},"stringToPath"),Sm=o(function(t,r){var n=t,i;if(jr(lu,n)&&(i=lu[n],n="%"+i[0]+"%"),jr(yt,n)){var a=yt[n];if(a===Dt&&(a=Pm(n)),typeof a>"u"&&!r)throw new Rt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Nt("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");fu.exports=o(function(t,r){if(typeof t!="string"||t.length===0)throw new Rt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Rt('"allowMissing" argument must be a boolean');if(Im(/^%?[^%]*%?$/,t)===null)throw new Nt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=$m(t),i=n.length>0?n[0]:"",a=Sm("%"+i+"%",r),s=a.name,c=a.value,d=!1,p=a.alias;p&&(i=p[0],Tm(n,xm([0,1],p)));for(var _=1,x=!0;_<n.length;_+=1){var v=n[_],l=Vr(v,0,1),m=Vr(v,-1);if((l==='"'||l==="'"||l==="`"||m==='"'||m==="'"||m==="`")&&l!==m)throw new Nt("property names with quotes must have matching quotes");if((v==="constructor"||!x)&&(d=!0),i+="."+v,s="%"+i+"%",jr(yt,s))c=yt[s];else if(c!=null){if(!(v in c)){if(!r)throw new Rt("base intrinsic for "+t+" exists, but the property is not available.");return}if(ar&&_+1>=n.length){var h=ar(c,v);x=!!h,x&&"get"in h&&!("originalValue"in h.get)?c=h.get:c=c[v]}else x=jr(c,v),c=c[v];x&&!d&&(yt[s]=c)}}return c},"GetIntrinsic")});var hu=U((ek,yu)=>{"use strict";var wm=Zn();yu.exports=o(function(){return wm()&&!!Symbol.toStringTag},"hasToStringTagShams")});var bu=U((rk,vu)=>{"use strict";var zm=gu(),_u=zm("%Object.defineProperty%",!0),km=hu()(),Om=Kn(),Dm=Ur(),Br=km?Symbol.toStringTag:null;vu.exports=o(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Dm("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Br&&(n||!Om(t,Br))&&(_u?_u(t,Br,{configurable:!i,enumerable:!1,value:r,writable:!1}):t[Br]=r)},"setToStringTag")});var xu=U((ik,Pu)=>{"use strict";var Rm=Function.prototype.call,Nm=Object.prototype.hasOwnProperty,Cm=kt();Pu.exports=Cm.call(Rm,Nm)});var Iu=U((ok,Tu)=>{"use strict";Tu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var ri=U((ak,Au)=>{"use strict";var ti=wa(),Um=require("util"),Xn=require("path"),Mm=require("http"),Fm=require("https"),Lm=require("url").parse,jm=require("fs"),Vm=require("stream").Stream,Bm=require("crypto"),Qn=Ra(),Zm=Ya(),Gm=bu(),ot=xu(),ei=Iu();function Eu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(Eu,"escapeHeaderParam");function ee(e){if(!(this instanceof ee))return new ee(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],ti.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(ee,"FormData");Um.inherits(ee,ti);ee.LINE_BREAK=`\r
|
|
2
|
-
`;ee.DEFAULT_CONTENT_TYPE="application/octet-stream";ee.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=ti.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,t,r),a=this._multiPartFooter();n(i),n(t),n(a),this._trackLength(i,t,r)};ee.prototype._trackLength=function(e,t,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(t)?n=t.length:typeof t=="string"&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+ee.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&ot(t,"httpVersion"))&&!(t instanceof Vm))&&(r.knownLength||this._valuesToMeasure.push(t))};ee.prototype._lengthRetriever=function(e,t){ot(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):jm.stat(e.path,function(r,n){if(r){t(r);return}var i=n.size-(e.start?e.start:0);t(null,i)}):ot(e,"httpVersion")?t(null,Number(e.headers["content-length"])):ot(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};ee.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),i=this._getContentType(t,r),a="",s={"Content-Disposition":["form-data",'name="'+Eu(e)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&ei(s,r.header);var c;for(var d in s)if(ot(s,d)){if(c=s[d],c==null)continue;Array.isArray(c)||(c=[c]),c.length&&(a+=d+": "+c.join("; ")+ee.LINE_BREAK)}return"--"+this.getBoundary()+ee.LINE_BREAK+a+ee.LINE_BREAK};ee.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=Xn.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=Xn.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&ot(e,"httpVersion")&&(r=Xn.basename(e.client._httpMessage.path||"")),r)return'filename="'+Eu(r)+'"'};ee.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=Qn.lookup(e.name)),!r&&e&&e.path&&(r=Qn.lookup(e.path)),!r&&e&&e.readable&&ot(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=Qn.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=ee.DEFAULT_CONTENT_TYPE),r};ee.prototype._multiPartFooter=function(){return function(e){var t=ee.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};ee.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+ee.LINE_BREAK};ee.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)ot(e,t)&&(r[t.toLowerCase()]=e[t]);return r};ee.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};ee.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};ee.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?e=Buffer.concat([e,this._streams[r]]):e=Buffer.concat([e,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,t.length+2)!==t)&&(e=Buffer.concat([e,Buffer.from(ee.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};ee.prototype._generateBoundary=function(){this._boundary="--------------------------"+Bm.randomBytes(12).toString("hex")};ee.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};ee.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};ee.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length&&(t+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}Zm.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(i){t+=i}),e(null,t)})};ee.prototype.submit=function(e,t){var r,n,i={method:"post"};return typeof e=="string"?(e=Lm(e),n=ei({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(n=ei(e,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=Fm.request(n):r=Mm.request(n),this.getLength(function(a,s){if(a&&a!=="Unknown stream"){this._error(a);return}if(s&&r.setHeader("Content-Length",s),this.pipe(r),t){var c,d=o(function(p,_){return r.removeListener("error",d),r.removeListener("response",c),t.call(this,p,_)},"callback");c=d.bind(this,null),r.on("error",d),r.on("response",c)}}.bind(this)),r};ee.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};ee.prototype.toString=function(){return"[object FormData]"};Gm(ee.prototype,"FormData");Au.exports=ee});var at=U((ni,ii)=>{(function(e,t){typeof ni=="object"&&typeof ii<"u"?ii.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(ni,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",c="day",d="week",p="month",_="quarter",x="year",v="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(G){var w=["th","st","nd","rd"],$=G%100;return"["+G+(w[($-20)%10]||w[$]||w[0])+"]"},"ordinal")},b=o(function(G,w,$){var R=String(G);return!R||R.length>=w?G:""+Array(w+1-R.length).join($)+G},"m"),I={s:b,z:o(function(G){var w=-G.utcOffset(),$=Math.abs(w),R=Math.floor($/60),z=$%60;return(w<=0?"+":"-")+b(R,2,"0")+":"+b(z,2,"0")},"z"),m:o(function G(w,$){if(w.date()<$.date())return-G($,w);var R=12*($.year()-w.year())+($.month()-w.month()),z=w.clone().add(R,p),W=$-z<0,K=w.clone().add(R+(W?-1:1),p);return+(-(R+($-z)/(W?z-K:K-z))||0)},"t"),a:o(function(G){return G<0?Math.ceil(G)||0:Math.floor(G)},"a"),p:o(function(G){return{M:p,y:x,w:d,d:c,D:v,h:s,m:a,s:i,ms:n,Q:_}[G]||String(G||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(G){return G===void 0},"u")},k="en",te={};te[k]=f;var ve=o(function(G){return G instanceof _t},"p"),Le=o(function G(w,$,R){var z;if(!w)return k;if(typeof w=="string"){var W=w.toLowerCase();te[W]&&(z=W),$&&(te[W]=$,z=W);var K=w.split("-");if(!z&&K.length>1)return G(K[0])}else{var ae=w.name;te[ae]=w,z=ae}return!R&&z&&(k=z),z||!R&&k},"t"),oe=o(function(G,w){if(ve(G))return G.clone();var $=typeof w=="object"?w:{};return $.date=G,$.args=arguments,new _t($)},"w"),X=I;X.l=Le,X.i=ve,X.w=function(G,w){return oe(G,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var _t=function(){function G($){this.$L=Le($.locale,null,!0),this.parse($)}o(G,"M");var w=G.prototype;return w.parse=function($){this.$d=function(R){var z=R.date,W=R.utc;if(z===null)return new Date(NaN);if(X.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var K=z.match(m);if(K){var ae=K[2]-1||0,fe=(K[7]||"0").substring(0,3);return W?new Date(Date.UTC(K[1],ae,K[3]||1,K[4]||0,K[5]||0,K[6]||0,fe)):new Date(K[1],ae,K[3]||1,K[4]||0,K[5]||0,K[6]||0,fe)}}return new Date(z)}($),this.$x=$.x||{},this.init()},w.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},w.$utils=function(){return X},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function($,R){var z=oe($);return this.startOf(R)<=z&&z<=this.endOf(R)},w.isAfter=function($,R){return oe($)<this.startOf(R)},w.isBefore=function($,R){return this.endOf(R)<oe($)},w.$g=function($,R,z){return X.u($)?this[R]:this.set(z,$)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function($,R){var z=this,W=!!X.u(R)||R,K=X.p($),ae=o(function(dt,Ae){var Xe=X.w(z.$u?Date.UTC(z.$y,Ae,dt):new Date(z.$y,Ae,dt),z);return W?Xe:Xe.endOf(c)},"l"),fe=o(function(dt,Ae){return X.w(z.toDate()[dt].apply(z.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Ae)),z)},"$"),be=this.$W,xe=this.$M,Re=this.$D,vt="set"+(this.$u?"UTC":"");switch(K){case x:return W?ae(1,0):ae(31,11);case p:return W?ae(1,xe):ae(0,xe+1);case d:var lt=this.$locale().weekStart||0,Mt=(be<lt?be+7:be)-lt;return ae(W?Re-Mt:Re+(6-Mt),xe);case c:case v:return fe(vt+"Hours",0);case s:return fe(vt+"Minutes",1);case a:return fe(vt+"Seconds",2);case i:return fe(vt+"Milliseconds",3);default:return this.clone()}},w.endOf=function($){return this.startOf($,!1)},w.$set=function($,R){var z,W=X.p($),K="set"+(this.$u?"UTC":""),ae=(z={},z[c]=K+"Date",z[v]=K+"Date",z[p]=K+"Month",z[x]=K+"FullYear",z[s]=K+"Hours",z[a]=K+"Minutes",z[i]=K+"Seconds",z[n]=K+"Milliseconds",z)[W],fe=W===c?this.$D+(R-this.$W):R;if(W===p||W===x){var be=this.clone().set(v,1);be.$d[ae](fe),be.init(),this.$d=be.set(v,Math.min(this.$D,be.daysInMonth())).$d}else ae&&this.$d[ae](fe);return this.init(),this},w.set=function($,R){return this.clone().$set($,R)},w.get=function($){return this[X.p($)]()},w.add=function($,R){var z,W=this;$=Number($);var K=X.p(R),ae=o(function(xe){var Re=oe(W);return X.w(Re.date(Re.date()+Math.round(xe*$)),W)},"y");if(K===p)return this.set(p,this.$M+$);if(K===x)return this.set(x,this.$y+$);if(K===c)return ae(1);if(K===d)return ae(7);var fe=(z={},z[a]=t,z[s]=r,z[i]=e,z)[K]||1,be=this.$d.getTime()+$*fe;return X.w(be,this)},w.subtract=function($,R){return this.add(-1*$,R)},w.format=function($){var R=this,z=this.$locale();if(!this.isValid())return z.invalidDate||l;var W=$||"YYYY-MM-DDTHH:mm:ssZ",K=X.z(this),ae=this.$H,fe=this.$m,be=this.$M,xe=z.weekdays,Re=z.months,vt=z.meridiem,lt=o(function(Ae,Xe,Ft,dr){return Ae&&(Ae[Xe]||Ae(R,W))||Ft[Xe].slice(0,dr)},"h"),Mt=o(function(Ae){return X.s(ae%12||12,Ae,"0")},"d"),dt=vt||function(Ae,Xe,Ft){var dr=Ae<12?"AM":"PM";return Ft?dr.toLowerCase():dr};return W.replace(h,function(Ae,Xe){return Xe||function(Ft){switch(Ft){case"YY":return String(R.$y).slice(-2);case"YYYY":return X.s(R.$y,4,"0");case"M":return be+1;case"MM":return X.s(be+1,2,"0");case"MMM":return lt(z.monthsShort,be,Re,3);case"MMMM":return lt(Re,be);case"D":return R.$D;case"DD":return X.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return lt(z.weekdaysMin,R.$W,xe,2);case"ddd":return lt(z.weekdaysShort,R.$W,xe,3);case"dddd":return xe[R.$W];case"H":return String(ae);case"HH":return X.s(ae,2,"0");case"h":return Mt(1);case"hh":return Mt(2);case"a":return dt(ae,fe,!0);case"A":return dt(ae,fe,!1);case"m":return String(fe);case"mm":return X.s(fe,2,"0");case"s":return String(R.$s);case"ss":return X.s(R.$s,2,"0");case"SSS":return X.s(R.$ms,3,"0");case"Z":return K}return null}(Ae)||K.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function($,R,z){var W,K=this,ae=X.p(R),fe=oe($),be=(fe.utcOffset()-this.utcOffset())*t,xe=this-fe,Re=o(function(){return X.m(K,fe)},"D");switch(ae){case x:W=Re()/12;break;case p:W=Re();break;case _:W=Re()/3;break;case d:W=(xe-be)/6048e5;break;case c:W=(xe-be)/864e5;break;case s:W=xe/r;break;case a:W=xe/t;break;case i:W=xe/e;break;default:W=xe}return z?W:X.a(W)},w.daysInMonth=function(){return this.endOf(p).$D},w.$locale=function(){return te[this.$L]},w.locale=function($,R){if(!$)return this.$L;var z=this.clone(),W=Le($,R,!0);return W&&(z.$L=W),z},w.clone=function(){return X.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},G}(),ct=_t.prototype;return oe.prototype=ct,[["$ms",n],["$s",i],["$m",a],["$H",s],["$W",c],["$M",p],["$y",x],["$D",v]].forEach(function(G){ct[G[1]]=function(w){return this.$g(w,G[0],G[1])}}),oe.extend=function(G,w){return G.$i||(G(w,_t,oe),G.$i=!0),oe},oe.locale=Le,oe.isDayjs=ve,oe.unix=function(G){return oe(1e3*G)},oe.en=te[k],oe.Ls=te,oe.p={},oe})});var cf={};li(cf,{pipedrive:()=>uf});module.exports=kc(cf);var Oc=Object.freeze({status:"aborted"});function N(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let p=s.prototype,_=Object.keys(p);for(let x=0;x<_.length;x++){let v=_[x];v in c||(c[v]=p[v].bind(c))}}o(n,"init");let i=r?.Parent??Object;class a extends i{static{o(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function s(c){var d;let p=r?.Parent?new a:this;n(p,c),(d=p._zod).deferred??(d.deferred=[]);for(let _ of p._zod.deferred)_();return p}return o(s,"_"),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:o(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(s,"name",{value:e}),s}o(N,"$constructor");var Dc=Symbol("zod_brand"),je=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},pr=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Jr={};function Ge(e){return e&&Object.assign(Jr,e),Jr}o(Ge,"config");function Xr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}o(Xr,"getEnumValues");function mi(e,t){return typeof t=="bigint"?t.toString():t}o(mi,"jsonStringifyReplacer");function fr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(fr,"cached");function fi(e){return e==null}o(fi,"nullish");function gr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(gr,"cleanRegex");var pi=Symbol("evaluating");function he(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pi)return n===void 0&&(n=pi,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(he,"defineLazy");var Qr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(jt,"isObject");var Rc=fr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function gi(e){if(jt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(jt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(gi,"isPlainObject");var yi=new Set(["string","number","symbol"]);function bt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(bt,"escapeRegex");function yr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(yr,"clone");function le(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(le,"normalizeParams");function hi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(hi,"optionalKeys");var Nc={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 Pt(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(Pt,"aborted");function Qe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(Qe,"prefixIssues");function mr(e){return typeof e=="string"?e:e?.message}o(mr,"unwrapMessage");function et(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=mr(e.inst?._zod.def?.error?.(e))??mr(t?.error?.(e))??mr(r.customError?.(e))??mr(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(et,"finalizeIssue");function _i(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(_i,"getLengthableOrigin");function en(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(en,"issue");var vi=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,mi,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),bi=N("$ZodError",vi),Vt=N("$ZodError",vi,{Parent:Error});var Uc=o(e=>(t,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new je;if(s.issues.length){let c=new(i?.Err??e)(s.issues.map(d=>et(d,a,Ge())));throw Qr(c,i?.callee),c}return s.value},"_parse"),hr=Uc(Vt),Mc=o(e=>async(t,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(i?.Err??e)(s.issues.map(d=>et(d,a,Ge())));throw Qr(c,i?.callee),c}return s.value},"_parseAsync"),_r=Mc(Vt),Fc=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new je;return a.issues.length?{success:!1,error:new(e??bi)(a.issues.map(s=>et(s,i,Ge())))}:{success:!0,data:a.value}},"_safeParse"),Bt=Fc(Vt),Lc=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(s=>et(s,i,Ge())))}:{success:!0,data:a.value}},"_safeParseAsync"),Zt=Lc(Vt);var jc="(?:(?:\\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])))",Vc=new RegExp(`^${jc}$`);var Pi=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),xi=/^-?\d+n?$/;var tn=/^-?\d+(?:\.\d+)?$/,Ti=/^(?:true|false)$/i;var xt=N("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ii=N("$ZodCheckMinLength",(e,t)=>{var r;xt.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!fi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let s=_i(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var rn=N("$ZodCheckStringFormat",(e,t)=>{var r,n;xt.init(e,t),e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ei=N("$ZodCheckRegex",(e,t)=>{rn.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 $i={major:4,minor:3,patch:6};var de=N("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$i;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let a of i._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((s,c,d)=>{let p=Pt(s),_;for(let x of c){if(x._zod.def.when){if(!x._zod.def.when(s))continue}else if(p)continue;let v=s.issues.length,l=x._zod.check(s);if(l instanceof Promise&&d?.async===!1)throw new je;if(_||l instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await l,s.issues.length!==v&&(p||(p=Pt(s,v)))});else{if(s.issues.length===v)continue;p||(p=Pt(s,v))}}return _?_.then(()=>s):s},"runChecks"),a=o((s,c,d)=>{if(Pt(s))return s.aborted=!0,s;let p=i(c,n,d);if(p instanceof Promise){if(d.async===!1)throw new je;return p.then(_=>e._zod.parse(_,d))}return e._zod.parse(p,d)},"handleCanaryResult");e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let p=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return p instanceof Promise?p.then(_=>a(_,s,c)):a(p,s,c)}let d=e._zod.parse(s,c);if(d instanceof Promise){if(c.async===!1)throw new je;return d.then(p=>i(p,n,c))}return i(d,n,c)}}he(e,"~standard",()=>({validate:o(i=>{try{let a=Bt(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Zt(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Pr=N("$ZodString",(e,t)=>{de.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Pi(e._zod.bag),e._zod.parse=(r,n)=>{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}}),nn=N("$ZodStringFormat",(e,t)=>{rn.init(e,t),Pr.init(e,t)});var Oi=N("$ZodURL",(e,t)=>{nn.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Di=N("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??tn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}});var on=N("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=Ti,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Ri=N("$ZodBigInt",(e,t)=>{de.init(e,t),e._zod.pattern=xi,e._zod.parse=(r,n)=>{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 Ni=N("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=r=>r}),Ci=N("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=r=>r});var Ui=N("$ZodVoid",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Mi=N("$ZodDate",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function Si(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues)),t.value[r]=e.value}o(Si,"handleArrayResult");var Fi=N("$ZodArray",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let s=0;s<i.length;s++){let c=i[s],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?a.push(d.then(p=>Si(p,r,s))):Si(d,r,s)}return a.length?Promise.all(a).then(()=>r):r}});function br(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...Qe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(br,"handlePropertyResult");function Bc(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=hi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Bc,"normalizeDef");function Zc(e,t,r,n,i,a){let s=[],c=i.keySet,d=i.catchall._zod,p=d.def.type,_=d.optout==="optional";for(let x in t){if(c.has(x))continue;if(p==="never"){s.push(x);continue}let v=d.run({value:t[x],issues:[]},n);v instanceof Promise?e.push(v.then(l=>br(l,r,x,t,_))):br(v,r,x,t,_)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}o(Zc,"handleCatchall");var Li=N("$ZodObject",(e,t)=>{if(de.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d},"get")})}let n=fr(()=>Bc(t));he(e._zod,"propValues",()=>{let c=t.shape,d={};for(let p in c){let _=c[p]._zod;if(_.values){d[p]??(d[p]=new Set);for(let x of _.values)d[p].add(x)}}return d});let i=jt,a=t.catchall,s;e._zod.parse=(c,d)=>{s??(s=n.value);let p=c.value;if(!i(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value={};let _=[],x=s.shape;for(let v of s.keys){let l=x[v],m=l._zod.optout==="optional",h=l._zod.run({value:p[v],issues:[]},d);h instanceof Promise?_.push(h.then(f=>br(f,c,v,p,m))):br(h,c,v,p,m)}return a?Zc(_,p,c,d,n.value,e):_.length?Promise.all(_).then(()=>c):c}});function wi(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let i=e.filter(a=>!Pt(a));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(s=>et(s,n,Ge())))}),t)}o(wi,"handleUnionResults");var an=N("$ZodUnion",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>gr(a.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return n(i,a);let s=!1,c=[];for(let d of t.options){let p=d._zod.run({value:i.value,issues:[]},a);if(p instanceof Promise)c.push(p),s=!0;else{if(p.issues.length===0)return p;c.push(p)}}return s?Promise.all(c).then(d=>wi(d,i,e,a)):wi(c,i,e,a)}});var ji=N("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,an.init(e,t);let r=e._zod.parse;he(e._zod,"propValues",()=>{let i={};for(let a of t.options){let s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[c,d]of Object.entries(s)){i[c]||(i[c]=new Set);for(let p of d)i[c].add(p)}}return i});let n=fr(()=>{let i=t.options,a=new Map;for(let s of i){let c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let d of c){if(a.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);a.set(d,s)}}return a});e._zod.parse=(i,a)=>{let s=i.value;if(!jt(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;let c=n.value.get(s?.[t.discriminator]);return c?c._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),i)}});var Vi=N("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!gi(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],s=t.keyType._zod.values;if(s){r.value={};let c=new Set;for(let p of s)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){c.add(typeof p=="number"?p.toString():p);let _=t.valueType._zod.run({value:i[p],issues:[]},n);_ instanceof Promise?a.push(_.then(x=>{x.issues.length&&r.issues.push(...Qe(p,x.issues)),r.value[p]=x.value})):(_.issues.length&&r.issues.push(...Qe(p,_.issues)),r.value[p]=_.value)}let d;for(let p in i)c.has(p)||(d=d??[],d.push(p));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:d})}else{r.value={};for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;let d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&tn.test(c)&&d.issues.length){let x=t.keyType._zod.run({value:Number(c),issues:[]},n);if(x instanceof Promise)throw new Error("Async schemas not supported in object keys currently");x.issues.length===0&&(d=x)}if(d.issues.length){t.mode==="loose"?r.value[c]=i[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(x=>et(x,n,Ge())),input:c,path:[c],inst:e});continue}let _=t.valueType._zod.run({value:i[c],issues:[]},n);_ instanceof Promise?a.push(_.then(x=>{x.issues.length&&r.issues.push(...Qe(c,x.issues)),r.value[d.value]=x.value})):(_.issues.length&&r.issues.push(...Qe(c,_.issues)),r.value[d.value]=_.value)}}return a.length?Promise.all(a).then(()=>r):r}});var Bi=N("$ZodEnum",(e,t)=>{de.init(e,t);let r=Xr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>yi.has(typeof i)).map(i=>typeof i=="string"?bt(i):i.toString()).join("|")})$`),e._zod.parse=(i,a)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:e}),i}}),Zi=N("$ZodLiteral",(e,t)=>{if(de.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(n=>typeof n=="string"?bt(n):n?bt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}});var Gi=N("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new je;return r.value=i,r}});function zi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(zi,"handleOptionalResult");var qi=N("$ZodOptional",(e,t)=>{de.init(e,t),e._zod.optin="optional",e._zod.optout="optional",he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>zi(a,r.value)):zi(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Hi=N("$ZodNullable",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)}|null)$`):void 0}),he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var Wi=N("$ZodPipe",(e,t)=>{de.init(e,t),he(e._zod,"values",()=>t.in._zod.values),he(e._zod,"optin",()=>t.in._zod.optin),he(e._zod,"optout",()=>t.out._zod.optout),he(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(s=>vr(s,t.in,n)):vr(a,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>vr(a,t.out,n)):vr(i,t.out,n)}});function vr(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(vr,"handlePipeResult");var Ki=N("$ZodCustom",(e,t)=>{xt.init(e,t),de.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(a=>ki(a,r,n,e));ki(i,r,n,e)}});function ki(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(en(i))}}o(ki,"handleRefineResult");var Yi,Wc=Symbol("ZodOutput"),Kc=Symbol("ZodInput"),sn=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Xi(){return new sn}o(Xi,"registry");(Yi=globalThis).__zod_globalRegistry??(Yi.__zod_globalRegistry=Xi());var un=globalThis.__zod_globalRegistry;function Qi(e,t){return new e({type:"string",...le(t)})}o(Qi,"_string");function eo(e,t){return new e({type:"string",coerce:!0,...le(t)})}o(eo,"_coercedString");function to(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...le(t)})}o(to,"_url");function ro(e,t){return new e({type:"number",checks:[],...le(t)})}o(ro,"_number");function no(e,t){return new e({type:"number",coerce:!0,checks:[],...le(t)})}o(no,"_coercedNumber");function io(e,t){return new e({type:"boolean",...le(t)})}o(io,"_boolean");function oo(e,t){return new e({type:"boolean",coerce:!0,...le(t)})}o(oo,"_coercedBoolean");function ao(e,t){return new e({type:"bigint",coerce:!0,...le(t)})}o(ao,"_coercedBigint");function so(e){return new e({type:"any"})}o(so,"_any");function uo(e){return new e({type:"unknown"})}o(uo,"_unknown");function co(e,t){return new e({type:"void",...le(t)})}o(co,"_void");function lo(e,t){return new e({type:"date",coerce:!0,...le(t)})}o(lo,"_coercedDate");function Ce(e,t){return new Ii({check:"min_length",...le(t),minimum:e})}o(Ce,"_minLength");function tt(e,t){return new Ei({check:"string_format",format:"regex",...le(t),pattern:e})}o(tt,"_regex");function po(e,t,r){let n=le(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(po,"_custom");var _e=N("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");de.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>hr(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Bt(e,r,n),e.parseAsync=async(r,n)=>_r(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Zt(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>yr(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.apply=r=>r(e)}),Tr=N("ZodMiniString",(e,t)=>{Pr.init(e,t),_e.init(e,t)});function u(e){return Qi(Tr,e)}o(u,"string");var mo=N("ZodMiniStringFormat",(e,t)=>{nn.init(e,t),Tr.init(e,t)});var ol=N("ZodMiniURL",(e,t)=>{Oi.init(e,t),mo.init(e,t)});function fo(e){return to(ol,e)}o(fo,"url");var cn=N("ZodMiniNumber",(e,t)=>{Di.init(e,t),_e.init(e,t)});function Ee(e){return ro(cn,e)}o(Ee,"number");var ln=N("ZodMiniBoolean",(e,t)=>{on.init(e,t),_e.init(e,t)});function ne(e){return io(ln,e)}o(ne,"boolean");var go=N("ZodMiniBigInt",(e,t)=>{Ri.init(e,t),_e.init(e,t)});var al=N("ZodMiniAny",(e,t)=>{Ni.init(e,t),_e.init(e,t)});function qt(){return so(al)}o(qt,"any");var sl=N("ZodMiniUnknown",(e,t)=>{Ci.init(e,t),_e.init(e,t)});function V(){return uo(sl)}o(V,"unknown");var ul=N("ZodMiniVoid",(e,t)=>{Ui.init(e,t),_e.init(e,t)});function yo(e){return co(ul,e)}o(yo,"_void");var ho=N("ZodMiniDate",(e,t)=>{Mi.init(e,t),_e.init(e,t)});var cl=N("ZodMiniArray",(e,t)=>{Fi.init(e,t),_e.init(e,t)});function q(e,t){return new cl({type:"array",element:e,...le(t)})}o(q,"array");var ll=N("ZodMiniObject",(e,t)=>{Li.init(e,t),_e.init(e,t),he(e,"shape",()=>t.shape)});function y(e,t){let r={type:"object",shape:e??{},...le(t)};return new ll(r)}o(y,"object");var dl=N("ZodMiniUnion",(e,t)=>{an.init(e,t),_e.init(e,t)});function H(e,t){return new dl({type:"union",options:e,...le(t)})}o(H,"union");var pl=N("ZodMiniDiscriminatedUnion",(e,t)=>{ji.init(e,t),_e.init(e,t)});function Tt(e,t,r){return new pl({type:"union",options:t,discriminator:e,...le(r)})}o(Tt,"discriminatedUnion");var ml=N("ZodMiniRecord",(e,t)=>{Vi.init(e,t),_e.init(e,t)});function B(e,t,r){return new ml({type:"record",keyType:e,valueType:t,...le(r)})}o(B,"record");var fl=N("ZodMiniEnum",(e,t)=>{Bi.init(e,t),_e.init(e,t),e.options=Object.values(t.entries)});function Y(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fl({type:"enum",entries:r,...le(t)})}o(Y,"_enum");var gl=N("ZodMiniLiteral",(e,t)=>{Zi.init(e,t),_e.init(e,t)});function M(e,t){return new gl({type:"literal",values:Array.isArray(e)?e:[e],...le(t)})}o(M,"literal");var yl=N("ZodMiniTransform",(e,t)=>{Gi.init(e,t),_e.init(e,t)});function rt(e){return new yl({type:"transform",transform:e})}o(rt,"transform");var hl=N("ZodMiniOptional",(e,t)=>{qi.init(e,t),_e.init(e,t)});function P(e){return new hl({type:"optional",innerType:e})}o(P,"optional");var _l=N("ZodMiniNullable",(e,t)=>{Hi.init(e,t),_e.init(e,t)});function Ht(e){return new _l({type:"nullable",innerType:e})}o(Ht,"nullable");var vl=N("ZodMiniPipe",(e,t)=>{Wi.init(e,t),_e.init(e,t)});function nt(e,t){return new vl({type:"pipe",in:e,out:t})}o(nt,"pipe");var bl=N("ZodMiniCustom",(e,t)=>{Ki.init(e,t),_e.init(e,t)});function Ir(e,t){return po(bl,e??(()=>!0),t)}o(Ir,"custom");var Wt={};li(Wt,{bigint:()=>$l,boolean:()=>Al,date:()=>Sl,number:()=>El,string:()=>Il});function Il(e){return eo(Tr,e)}o(Il,"string");function El(e){return no(cn,e)}o(El,"number");function Al(e){return oo(ln,e)}o(Al,"boolean");function $l(e){return ao(go,e)}o($l,"bigint");function Sl(e){return lo(ho,e)}o(Sl,"date");var pn=y({retryOnFailure:y({defaultValue:P(ne()),hide:P(ne())}),continueOnFailure:y({defaultValue:P(ne()),hide:P(ne())})}),dn=class{constructor(t,r,n,i,a,s,c,d,p,_,x){this.name=t;this.displayName=r;this.description=n;this.props=i;this.run=a;this.test=s;this.requireAuth=c;this.errorHandlingOptions=d;this.outputSchema=p;this.audience=_;this.aiMetadata=x}static{o(this,"IAction")}},O=o(e=>new dn(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 re=y({displayName:u(),description:P(u())}),J=o((e,t)=>y({type:M(t),required:ne(),defaultValue:P(qt())}),"TPropertyValue");var ze=y({...re.shape,...J(u(),"SHORT_TEXT").shape}),qe=y({...re.shape,...J(u(),"LONG_TEXT").shape});var vo=y({label:u(),value:V()}),Er=y({disabled:P(ne()),placeholder:P(u()),options:q(vo)});var ke=y({...re.shape,options:Er,...J(V(),"STATIC_DROPDOWN").shape}),He=y({...re.shape,options:Er,...J(q(V()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var mn=y({...re.shape,...J(V(),"DROPDOWN").shape,refreshers:q(u())}),Kt=y({...re.shape,...J(q(V()),"MULTI_SELECT_DROPDOWN").shape,refreshers:q(u())});var We=y({...re.shape,...J(ne(),"CHECKBOX").shape});var Ke=y({...re.shape,...J(Ee(),"NUMBER").shape});var Jt=y({...re.shape,...J(V(),"FILE").shape});var Yt=y({...re.shape,...J(u(),"DATE_TIME").shape});var bo=B(u(),H([ze,qe,ke,Kt,He,We,Ke,Jt,Yt])),Xt=y({...re.shape,properties:bo,...J(q(V()),"ARRAY").shape});var Qt=y({...re.shape,...J(H([B(u(),V())]),"JSON").shape});var Po=H([ze,ke,Qt,Xt,He]),zl=B(u(),Po),fn=y({refreshers:q(u()),...re.shape,...J(V(),"DYNAMIC").shape});var Ar=y({...re.shape,...J(yo(),"MARKDOWN").shape});var er=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(er||{}),It=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(It||{}),Et=(b=>(b.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",b.COMMUNICATION="COMMUNICATION",b.COMMERCE="COMMERCE",b.CORE="CORE",b.UNIVERSAL_AI="UNIVERSAL_AI",b.FLOW_CONTROL="FLOW_CONTROL",b.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",b.ACCOUNTING="ACCOUNTING",b.PRODUCTIVITY="PRODUCTIVITY",b.CONTENT_AND_FILES="CONTENT_AND_FILES",b.DEVELOPER_TOOLS="DEVELOPER_TOOLS",b.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",b.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",b.HUMAN_RESOURCES="HUMAN_RESOURCES",b.PAYMENT_PROCESSING="PAYMENT_PROCESSING",b.MARKETING="MARKETING",b.SALES_AND_CRM="SALES_AND_CRM",b))(Et||{});var tr=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(tr||{}),gn="both_client_credentials_and_authorization_code";var ge=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(ge||{}),rr=(a=>(a.NONE="NONE",a.HEADER_PRESENT="HEADER_PRESENT",a.QUERY_PRESENT="QUERY_PRESENT",a.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",a.HEAD_REQUEST="HEAD_REQUEST",a))(rr||{}),kl=y({strategy:Y(rr),paramName:P(u())}),nr=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(nr||{});var $r=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))($r||{}),xo=y({status:P(Ee()),body:P(V()),headers:P(B(u(),u()))}),To=y({type:M("DELAY"),resumeDateTime:u(),requestIdToReply:P(u()),handlerId:P(u()),streamStepProgress:P(Y($r))}),Io=y({type:M("WEBHOOK"),requestId:u(),requestIdToReply:P(u()),response:xo,handlerId:P(u()),streamStepProgress:P(Y($r))}),Ol=H([To,Io]);var Dl=y({body:V(),rawBody:P(V()),headers:B(u(),u()),queryParams:B(u(),u())});function A(e){return e==null}o(A,"isNil");function ue(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(ue,"isEmpty");function Sr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(Sr,"assertNotNullOrUndefined");var yn=$e(require("crypto"),1);var Rl=128,pt,At,Nl=o(e=>{!pt||pt.length<e?(pt=Buffer.allocUnsafe(e*Rl),yn.default.randomFillSync(pt),At=0):At+e>pt.length&&(yn.default.randomFillSync(pt),At=0),At+=e},"fillPool"),Cl=o(e=>(Nl(e|=0),pt.subarray(At-e,At)),"random"),Ul=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*n*t/e.length);return(a=t)=>{let s="";for(;;){let c=r(i),d=i;for(;d--;)if(s+=e[c[d]&n]||"",s.length===a)return s}}},"customRandom"),Ao=o((e,t=21)=>Ul(e,t,Cl),"customAlphabet");var Ml="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$o=21,GT=u().check(tt(new RegExp(`^[0-9a-zA-Z]{${$o}}$`))),Fl=Ao(Ml,$o);var it=nt(rt(e=>e instanceof Date?e.toISOString():e),u()),Ne={id:u(),created:it,updated:it},ce=o(e=>P(Ht(e)),"Nullable");function hn(e){return P(Ht(Y(e)))}o(hn,"NullableEnum");var WT=nt(rt(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),P(ne())),wr=o(e=>nt(rt(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),P(q(e))),"OptionalArrayFromQuery");var YT=B(u(),V());var ir=(_=>(_.OPENAI="openai",_.OPENROUTER="openrouter",_.ANTHROPIC="anthropic",_.AZURE="azure",_.GOOGLE="google",_.ACTIVEPIECES="activepieces",_.CLOUDFLARE_GATEWAY="cloudflare-gateway",_.CUSTOM="custom",_.BEDROCK="bedrock",_.MISTRAL="mistral",_))(ir||{});var cI=u().check(tt(/^#[0-9A-Fa-f]{6}$/));var dI=y({filename:u(),data:V(),type:M("file"),mimetype:P(u())});var Ll=$e(wo());var _I=y({...Ne,name:u(),permissions:q(u()),platformId:ce(u()),type:u(),userCount:P(Ee())});var zo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(zo||{}),_n=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(_n||{}),vn=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(vn||{});var bn=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(bn||{});var Pn=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Pn||{});var jl=y({mode:Y(zo),value:V()}),Vl=y({auth:P(u()),fields:B(u(),jl)}),Bl=y({pieceName:u(),pieceVersion:u(),actionName:u(),predefinedInput:P(Vl)}),Zl=y({type:M("PIECE"),toolName:u().check(Ce(1)),pieceMetadata:Bl}),Gl=y({type:M("none")}),ql=y({type:M("access_token"),accessToken:u()}),Hl=y({type:M("api_key"),apiKey:u(),apiKeyHeader:u()}),Wl=y({type:M("headers"),headers:B(u(),u())}),Kl=Tt("type",[Gl,ql,Hl,Wl]),ko=y({type:M("FLOW"),toolName:u().check(Ce(1)),externalFlowId:u(),flowDisplayName:P(u())}),Oo=y({type:M("MCP"),toolName:u().check(Ce(1)),serverUrl:fo(),protocol:Y(vn),auth:Kl}),Do=y({type:M("KNOWLEDGE_BASE"),toolName:u().check(Ce(1)),sourceType:Y(_n),sourceId:u(),sourceName:u()}),Jl=Tt("type",[Zl,ko,Oo,Do]),Yl=y({displayName:u(),description:P(u()),type:Y(bn)}),Ro=y({type:M("MARKDOWN"),markdown:u()}),$t={type:M("TOOL_CALL"),input:ce(B(u(),V())),output:P(V()),toolName:u(),status:Y(Pn),toolCallId:u(),startTime:u(),endTime:P(u())},GI=y($t),No=Tt("toolCallType",[y({...$t,toolCallType:M("PIECE"),pieceName:u(),pieceVersion:u(),actionName:u()}),y({...$t,toolCallType:M("FLOW"),displayName:u(),externalFlowId:u()}),y({...$t,toolCallType:M("MCP"),displayName:u(),serverUrl:u()}),y({...$t,toolCallType:M("KNOWLEDGE_BASE"),displayName:u(),sourceType:u()}),y({...$t,toolCallType:M("UNKNOWN"),displayName:u()})]),Xl=H([Ro,No]);var xn=(r=>(r.IMAGE="image",r.TEXT="text",r))(xn||{}),Je=y({apiKey:u()}),Ql=Je,ed=y({apiKey:u(),apiKeyHash:u()}),td=Je,rd=Je,nd=Je,id=Je,od=Je,ad=Je,sd=Je,Co=y({accessKeyId:u().check(Ce(1)),secretAccessKey:u().check(Ce(1))}),ud=y({}),cd=y({}),ld=y({}),dd=y({}),pd=y({}),md=y({}),Uo=y({modelId:u(),modelName:u(),modelType:Y(xn)}),Mo=y({apiKeyHeader:u(),baseUrl:u(),models:q(Uo),defaultHeaders:P(B(u(),u()))}),Fo=y({accountId:u(),gatewayId:u(),models:q(Uo),vertexProject:P(u()),vertexRegion:P(u())}),Lo=y({resourceName:u(),apiVersion:nt(rt(e=>typeof e=="string"&&e.trim().length===0?void 0:e),P(u()))}),jo=y({region:u().check(Ce(1))}),fd=H([Ql,nd,id,od,ad,rd,td,ed,Co,sd]),Vo=H([Mo,Fo,Lo,jo,ud,ld,dd,pd,cd,md]),gd=y({id:u(),name:u(),type:Y(xn)}),yd=y({id:u(),name:u(),provider:Y(ir),config:Vo,enabledForChat:ne()}),hd=y({provider:Y(ir),config:Vo,auth:fd,platformId:u()});var KI={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var _d=y({base64Url:u(),fileName:u(),extension:P(u())}),vd=y({mimeType:u(),url:u(),fileName:P(u())}),Tn=H([_d,vd]);var bd=H([y({type:M("file"),value:Tn}),y({type:M("markdown"),value:u(),files:P(q(Tn))})]),Pd=y({sessionId:u(),message:u(),files:P(q(u()))});var Zo=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Zo||{}),Go=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Go||{}),In=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(In||{});var xd=H([y({...Ne,name:u(),externalId:u(),type:M("STATIC_DROPDOWN"),tableId:u(),projectId:u(),data:y({options:q(y({value:u()}))})}),y({...Ne,name:u(),externalId:u(),type:H([M("TEXT"),M("NUMBER"),M("DATE")]),tableId:u(),projectId:u()})]),Td=y({...Ne,name:u(),folderId:ce(u()),projectId:u(),externalId:u(),status:hn(Go),trigger:hn(Zo)}),Id=y({...Ne,tableId:u(),projectId:u(),cells:B(u(),y({updated:u(),created:u(),value:V(),fieldName:u()}))}),Ed=y({events:q(Y(In)),webhookUrl:u(),flowId:u()}),Ad=y({fields:q(y({id:u(),name:u()})),rows:q(B(u(),u())),name:u()}),$d=y({projectId:u(),limit:P(Wt.number()),cursor:P(u()),name:P(u()),externalIds:wr(u()),folderId:P(u()),folderIds:wr(u())}),Sd=y({records:q(q(y({fieldId:u(),value:Ho()}))),tableId:u()}),wd=y({cells:P(q(y({fieldId:u(),value:Ho()}))),tableId:u(),agentUpdate:P(ne())}),qo=Tt("operator",[mt("eq"),mt("neq"),mt("gt"),mt("gte"),mt("lt"),mt("lte"),mt("co"),Bo("exists"),Bo("not_exists")]),zd=y({tableId:u(),limit:P(Wt.number()),cursor:P(u()),filters:wr(qo)});function Ho(){return nt(rt(e=>e==null?e:String(e)),Ht(u()))}o(Ho,"coerceToString");function mt(e){return y({fieldId:u(),operator:M(e),value:u()})}o(mt,"valueFilter");function Bo(e){return y({fieldId:u(),operator:M(e)})}o(Bo,"existenceFilter");var kd=y({status:P(Ee()),body:P(V()),headers:P(B(u(),u()))}),Od=y({...Ne,deleted:ce(it),ownerId:u(),displayName:u(),platformId:u(),externalId:ce(u())});var Wo=y({name:u(),description:P(u()),type:u(),required:ne()}),Dd=y({pieceName:u(),triggerName:u(),input:y({toolName:u(),toolDescription:u(),inputSchema:q(Wo),returnsResponse:ne()})});var Ko="^[0-9]+\\.[0-9]+\\.[0-9]+$",fE=new RegExp(Ko),Nd="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",gE=u().check(tt(new RegExp(Ko))),yE=u().check(tt(new RegExp(Nd))),Cd=y({packageType:M("ARCHIVE"),pieceType:Y(It),pieceName:u(),pieceVersion:u(),archiveId:u(),platformId:u()}),Jo=y({packageType:M("REGISTRY"),pieceType:M("OFFICIAL"),pieceName:u(),pieceVersion:u()}),Yo=y({packageType:M("REGISTRY"),pieceType:M("CUSTOM"),pieceName:u(),pieceVersion:u(),platformId:u()}),hE=H([Jo,Yo]),_E=H([Cd,Jo,Yo]),Xo=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(Xo||{}),Ud=y({type:Y(Xo),cronExpression:u(),timezone:u()}),vE=y({...Ne,type:Y(ge),projectId:u(),flowId:u(),triggerName:u(),schedule:ce(Ud),flowVersionId:u(),pieceName:u(),pieceVersion:u(),deleted:ce(u()),simulate:ne()}),Qo=(f=>(f.UNKNOWN="UNKNOWN",f.FLOW_RUN_LOG="FLOW_RUN_LOG",f.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",f.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",f.FLOW_STEP_FILE="FLOW_STEP_FILE",f.SAMPLE_DATA="SAMPLE_DATA",f.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",f.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",f.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",f.PROJECT_RELEASE="PROJECT_RELEASE",f.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",f.PLATFORM_ASSET="PLATFORM_ASSET",f.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",f.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",f.KNOWLEDGE_BASE="KNOWLEDGE_BASE",f.FLOW_BUNDLE="FLOW_BUNDLE",f))(Qo||{}),ea=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(ea||{}),ta=(r=>(r.S3="S3",r.DB="DB",r))(ta||{}),bE=y({...Ne,projectId:ce(u()),platformId:ce(u()),type:Y(Qo),compression:Y(ea),data:P(V()),location:Y(ta),size:ce(Ee()),fileName:ce(u()),s3Key:ce(u()),metadata:ce(B(u(),u()))}),ra=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(ra||{}),na=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(na||{}),PE=y({id:u(),email:u(),firstName:u(),status:Y(na),externalId:ce(u()),platformId:ce(u()),platformRole:Y(ra),lastName:u(),created:it,updated:it,lastActiveDate:ce(it),imageUrl:ce(u())});var En=y({...re.shape,...J(B(u(),V()),"OBJECT").shape});var sa=y({...re.shape,...J(u(),"COLOR").shape});var An=H([ze,qe,Ar,We,ke,He,mn,Kt,fn,Ke,Xt,En,Qt,Yt,Jt,sa]),g={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 Ve=y({displayName:u(),description:P(u())});var ua=y({username:u(),password:u()}),$n=y({...Ve.shape,username:y({displayName:u(),description:P(u())}),password:y({displayName:u(),description:P(u())}),...J(ua,"BASIC_AUTH").shape});var jd=B(u(),H([ze,qe,Ke,We,ke])),Sn=y({...Ve.shape,props:jd,...J(V(),"CUSTOM_AUTH").shape});var ft=y({...Ve.shape,...J(y({auth:u()}),"SECRET_TEXT").shape});var Vd=B(u(),H([ze,qe,ft,Ke,We,ke,He,Ar])),ca=y({...Ve.shape,props:Vd,...J(V(),"OIDC").shape});var wn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(wn||{}),la=H([ze,ft,ke]),da=B(u(),la),Bd=y({props:P(B(u(),la)),authUrl:u(),tokenUrl:u(),scope:q(u()),prompt:P(H([M("none"),M("consent"),M("login"),M("omit")])),pkce:P(ne()),pkceMethod:P(H([M("plain"),M("S256")])),authorizationMethod:P(Y(wn)),grantType:P(H([Y(tr),M(gn)])),extra:P(B(u(),u()))}),pa=y({access_token:u(),props:P(da),data:B(u(),qt())}),zn=y({...Ve.shape,...Bd.shape,...J(pa,"OAUTH2").shape});var St=H([$n,Sn,ca,zn,ft]),or="Connection",kn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||or}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||or,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||or}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||or}},None(){}};var QA={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 Zd=y({...re.shape,...J(V(),"CUSTOM").shape,code:u()});var Gd=H([An,St]),On=B(u(),Gd),v$=B(u(),An);var ma=H([y({strategy:M("CRON"),cronExpression:u()}),y({strategy:M("NONE")})]),wt=class{constructor(t,r,n,i,a,s,c,d,p,_,x,v,l,m,h,f,b,I,k){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=a;this.type=s;this.handshakeConfiguration=c;this.onHandshake=d;this.renewConfiguration=p;this.onRenew=_;this.onEnable=x;this.onDisable=v;this.onStart=l;this.run=m;this.test=h;this.sampleData=f;this.testStrategy=b;this.outputSchema=I;this.aiMetadata=k}static{o(this,"ITrigger")}},ie=o(e=>{switch(e.type){case"WEBHOOK":return new wt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata);case"POLLING":return new wt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"MANUAL":return new wt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"APP_WEBHOOK":return new wt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,A(e.sampleData)&&A(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var fa="2",kr="0.82.0";var Dn=class{constructor(t,r,n,i,a,s,c,d,p=kr,_,x=""){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=c;this.auth=d;this.minimumSupportedRelease=p;this.maximumSupportedRelease=_;this.description=x;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:fa}),"getContextInfo");(!qd(p)||Hd(p,kr))&&(this.minimumSupportedRelease=kr),a.forEach(v=>this._actions[v.name]=v),s.forEach(v=>this._triggers[v.name]=v)}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}},ga=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(a=>a.type===r.type)))throw new Error("Auth properties must be unique by type");return new Dn(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function qd(e){return/^\d+\.\d+\.\d+$/.test(e)}o(qd,"isValidSimpleSemver");function Hd(e,t){let[r,n,i]=e.split(".").map(Number),[a,s,c]=t.split(".").map(Number);return r!==a?r<a:n!==s?n<s:i<c}o(Hd,"isSemverLessThan");var Wd=P(B(u(),B(u(),u()))),ya=y({id:P(u()),name:u(),displayName:u(),logoUrl:u(),description:u(),authors:q(u()),platformId:P(u()),directoryPath:P(u()),auth:P(H([St,q(St)])),version:u(),categories:P(q(Y(Et))),minimumSupportedRelease:P(u()),maximumSupportedRelease:P(u()),i18n:Wd}),Kd=Y(["human","ai","both"]),ha=y({description:P(u()),idempotent:P(ne())}),_a=y({name:u(),displayName:u(),description:u(),props:On,requireAuth:ne(),errorHandlingOptions:P(pn),outputSchema:P(Ir()),audience:P(Kd),aiMetadata:P(ha)}),va=y({name:u(),displayName:u(),description:u(),props:On,errorHandlingOptions:P(pn),type:Y(ge),sampleData:V(),handshakeConfiguration:P(Ir()),renewConfiguration:P(ma),testStrategy:Y(nr),outputSchema:P(Ir()),aiMetadata:P(ha)}),Jd=y({...ya.shape,actions:B(u(),_a),triggers:B(u(),va)}),Yd=y({...ya.shape,actions:Ee(),triggers:Ee(),suggestedActions:P(q(va)),suggestedTriggers:P(q(_a))}),ba=y({projectUsage:Ee(),tags:P(q(u())),pieceType:Y(It),packageType:Y(er),platformId:P(u()),archiveId:P(u())}),vS=y({...Jd.shape,...ba.shape}),bS=y({...Yd.shape,...ba.shape}),PS=y({name:u(),version:u()});var Xd=$e(require("path")),Qd=$e(require("fs/promises"));var Or=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((a,s)=>{i.append(s,a)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(t){let r={Accept:"application/json"};if(t.authentication&&this.populateAuthentication(t.authentication,r),t.body)switch(t.headers?.["Content-Type"]){case"text/csv":r["Content-Type"]="text/csv";break;default:r["Content-Type"]="application/json";break}return t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var Dr=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new Rn,r=new Nn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Rn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Nn=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var zt=class extends Error{constructor(r,n){let i=n.status||500,a=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:a},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=a}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var Rr=class extends Or{static{o(this,"FetchHttpClient")}constructor(t="",r=new Dr){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),a=this.getHeaders(t),s=t.queryParams??{};for(let[k,te]of Object.entries(s))i.append(k,te);let c=i.toString(),d=c?`${n}?${c}`:n,p=t.responseType??"json",_=t.followRedirects??!0,x=t.retries??0,{body:v,extraHeaders:l,isStream:m}=ep(t.body,a),h=rp({...a,...l}),f=await tp(async()=>{let k=new AbortController,te=t.timeout&&t.timeout>0?setTimeout(()=>k.abort(),t.timeout):void 0;try{let ve={method:t.method.toString(),headers:h,body:v,redirect:_?"follow":"manual",signal:k.signal};return m&&(ve.duplex="half"),r?.dispatcher!==void 0&&(ve.dispatcher=r.dispatcher),await fetch(d,ve)}finally{te!==void 0&&clearTimeout(te)}},x),b=_?300:400;if(f.status<200||f.status>=b){let k=await Pa(f,p),te=new zt(t.body,{status:f.status,responseBody:k});throw console.error("[HttpClient#(sanitized error message)] Request failed:",te),te}let I=await Pa(f,p);return{status:f.status,headers:np(f.headers),body:I}}};function ep(e,t){return op(e)?{body:void 0,extraHeaders:{},isStream:!1}:ip(e)?{body:e,extraHeaders:e.getHeaders(),isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(ep,"serializeBody");async function Pa(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();case"json":default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(Pa,"parseResponseBody");async function tp(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await xa(n);continue}return i}catch(i){if(r=i,n<t){await xa(n);continue}throw i}throw r}o(tp,"sendWithRetries");function xa(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(xa,"backoff");function rp(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]=Array.isArray(n)?n.join(", "):n);return t}o(rp,"normalizeHeaders");function np(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(np,"toHttpHeaders");function ip(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}o(ip,"isNodeFormData");function op(e){return e==null}o(op,"isNil");var Se=new Rr;var gt=(s=>(s.GET="GET",s.POST="POST",s.PATCH="PATCH",s.PUT="PUT",s.DELETE="DELETE",s.HEAD="HEAD",s))(gt||{});var qm=$e(require("fs")),$u=$e(ri());var Hm={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function Wm(e){let t=e.split(";")[0].trim().toLowerCase();return Hm[t]??""}o(Wm,"contentTypeToExtension");var Km=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Jm=o((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function Su({auth:e,baseUrl:t,authMapping:r,description:n,displayName:i,name:a,props:s,extraProps:c,authLocation:d="headers"}){return O({audience:"human",name:a||"custom_api_call",displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:g.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:p})=>({url:g.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
-
i.e ${Jm(t,p)}/resource or /resource`,required:!0,defaultValue:p?t(p):"",...s?.url??{}})}),"props")}),method:g.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(gt).map(p=>({label:p,value:p}))},...s?.method??{}}),headers:g.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...s?.headers??{}}),queryParams:g.Object({displayName:"Query Parameters",required:!0,...s?.queryParams??{}}),body_type:g.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:g.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:p})=>{if(!p)return{};let _=p,x={};switch(_){case"none":break;case"json":x.data=g.Json({displayName:"JSON Body",required:!0,...s?.body??{}});break;case"raw":x.data=g.LongText({displayName:"Raw Body",required:!0});break;case"form_data":x.data=g.Array({displayName:"Form Data",required:!0,properties:{fieldName:g.ShortText({displayName:"Field Name",required:!0}),fieldType:g.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:g.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:g.File({displayName:"File Field Value",required:!1})}});break}return x},"props")}),response_is_binary:g.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:g.Checkbox({displayName:"No Error on Failure",required:!1,...s?.failsafe??{}}),timeout:g.Number({displayName:"Timeout (in seconds)",required:!1,...s?.timeout??{}}),followRedirects:g.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...c},run:o(async p=>{let{method:_,url:x,headers:v,queryParams:l,body:m,body_type:h,failsafe:f,timeout:b,response_is_binary:I,followRedirects:k}=p.propsValue;Sr(_,"Method"),Sr(x,"URL");let te=A(r)?{}:await r(p.auth,p.propsValue),ve=x.url,Le=ve.startsWith("http://")||ve.startsWith("https://")?ve:Km({baseUrl:t(p.auth),relativePath:ve}),oe={method:_,url:Le,headers:{...v??{},...d==="headers"||!A(d)?te:{}},queryParams:{...d==="queryParams"?te:{},...l??{}},timeout:b?b*1e3:0,followRedirects:k};if(I&&(oe.responseType="arraybuffer"),m)if(h&&h!=="none"){let X=m.data;if(h==="form_data"){let _t=X,ct=new $u.default;for(let{fieldName:G,fieldType:w,textFieldValue:$,fileFieldValue:R}of _t)w==="text"&&!ue($)?ct.append(G,$):w==="file"&&!ue(R)&&ct.append(G,R.data,{filename:R?.filename});oe.body=ct,oe.headers={...oe.headers,...ct.getHeaders()}}else oe.body=X}else h||(oe.body=m);try{let X=await Se.sendRequest(oe);return await Ym(p.files,X.body,X.status,X.headers,I)}catch(X){if(f)return X.errorMessage();throw X}},"run")})}o(Su,"createCustomApiCallAction");var Ym=o(async(e,t,r,n,i)=>{let a;if(i&&Xm(t)){let s=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],c=Wm(s??"")||"txt",d;t instanceof ArrayBuffer?d=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?d=t:d=Buffer.from(t),a=await e.write({fileName:`output.${c}`,data:d})}else a=t;return{status:r,headers:n,body:a}},"handleBinaryResponse"),Xm=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var ai=$e(at());var se={subscribeWebhook:o(async(e,t,r,n,i)=>{let a={method:"POST",url:`${n}/api/v1/webhooks`,body:{event_object:e,event_action:t,subscription_url:r,version:"2.0"},authentication:{type:"BEARER_TOKEN",token:i},queryParams:{}},{body:s}=await Se.sendRequest(a);return s},"subscribeWebhook"),unsubscribeWebhook:o(async(e,t,r)=>{let n={method:"DELETE",url:`${t}/api/v1/webhooks/${e}`,authentication:{type:"BEARER_TOKEN",token:r}};return await Se.sendRequest(n)},"unsubscribeWebhook")};async function T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=`${t}/api${n}`,c={};if(i)for(let[_,x]of Object.entries(i))x!=null&&(c[_]=Array.isArray(x)?x.map(String).join(","):String(x));let d;a&&(d=Object.entries(a).reduce((_,[x,v])=>(A(v)||(_[x]=v),_),{}));let p={method:r,url:s,authentication:{type:"BEARER_TOKEN",token:e},queryParams:c,body:d};try{return(await Se.sendRequest(p)).body}catch(_){throw _ instanceof zt&&_.response.status===403?new Error("Please reconnect your Pipedrive account."):_}}o(T,"pipedriveApiCall");async function S({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=i||{};s.start=0,s.limit=500;let c=[],d=!0;do{let p=await T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:s,body:a});if(A(p.data))break;c.push(...p.data),s.start=p.additional_data.pagination.next_start,d=p.additional_data.pagination.more_items_in_collection}while(d);return c}o(S,"pipedrivePaginatedV1ApiCall");async function ye({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=i?{...i}:{},c,d=[],p=!0;do{let _={...s};c&&(_.cursor=c),_.limit=500;let x=await T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:_,body:a});if(A(x.data))break;Array.isArray(x.data)?d.push(...x.data):d.push(x.data),p=x.additional_data?.next_cursor!=null,c=x.additional_data?.next_cursor}while(p&&c);return d}o(ye,"pipedrivePaginatedV2ApiCall");function oi(e){return(0,ai.default)(e).isValid()?(0,ai.default)(e).format("YYYY-MM-DD"):e}o(oi,"formatDateIfValid");function Te(e,t){let r=e.reduce((i,a)=>(i[a.key]=a,i),{}),n={};for(let[i,a]of Object.entries(t)){if(ue(a))continue;let s=r[i];if(s){if(s.is_subfield){let c=i.split("_")[0];n[c]={...n[c],[s.id_suffix]:s.field_type==="date"?oi(a):a};continue}switch(s.field_type){case"monetary":n[i]={...n[i],value:Number(a)};break;case"address":case"daterange":case"timerange":case"time":n[i]={...n[i],value:oi(a)};break;case"date":n[i]=oi(a);break;default:n[i]=a;break}}}return n}o(Te,"pipedriveParseCustomFields");function D(e,t){let r={...t},n=t.custom_fields||{};for(let i of e){if(!i.edit_flag)continue;let a=i.key,s=i.name,c=i.field_type;if(a in n){let d=n[a];A(d)?r[s]=null:c==="enum"?r[s]=i.options?.find(p=>p.id===d)?.label||null:c==="set"&&Array.isArray(d)?r[s]=d.map(p=>i.options?.find(_=>_.id===p)?.label||null):r[s]=d}}return delete r.custom_fields,r}o(D,"pipedriveTransformCustomFields");function ht(e,t){let r={...t};for(let n of e){if(!n.edit_flag)continue;let i=n.key,a=n.name,s=n.field_type;if(i in t){if(t[i]===null||t[i]===void 0)r[a]=null;else if(s==="enum")r[a]=n.options?.find(c=>c.id.toString()===t[i])?.label||null;else if(s==="set"){let c=t[i].split(",");r[a]=c.map(d=>n.options?.find(p=>p.id.toString()===d)?.label||null)}else r[a]=t[i];delete r[i]}}return r}o(ht,"pipedriveTransformV1CustomFields");var E=kn.OAuth2({description:"",authUrl:"https://oauth.pipedrive.com/oauth/authorize",tokenUrl:"https://oauth.pipedrive.com/oauth/token",required:!0,scope:["base","admin","contacts:full","users:read","deals:full","activities:full","leads:full","products:full","webhooks:full"]});var wu=ie({auth:E,name:"new_activity",displayName:"New Activity",description:"Triggers when a new activity is added",aiMetadata:{description:"Fires when a new activity is added in Pipedrive. An activity is a scheduled task or event (call, meeting, deadline, email, etc.) with a subject, type, due date/time, and optional links to a deal, person, organization, or lead. Use to react when work or appointments are scheduled in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("activity","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_activity_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_activity_trigger");t!=null&&await se.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=e.payload.body;return[(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/activities/${t.data.id}`,query:{include_fields:"attendees"}})).data]},sampleData:{id:8,owner_id:1234,done:!1,type:"deadline",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy:!0,add_time:"2020-06-08T12:37:56Z",marked_as_done_time:"2020-08-08T08:08:38Z",subject:"Deadline",public_description:"This is a description",location:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",is_deleted:!1,update_time:"2020-08-08T12:37:56Z",note:"A note for the activity",creator_user_id:1234,attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary:!1},{person_id:1101,primary:!0}]}});var Me=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","participant_open_deals_count","participant_closed_deals_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","related_won_deals_count","lost_deals_count","related_lost_deals_count","last_incoming_mail_time","last_outgoing_mail_time","won_deals_count"],Ie=["next_activity_id","last_activity_id","first_won_time","products_count","files_count","notes_count","followers_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","participants_count","last_incoming_mail_time","last_outgoing_mail_time","smart_bcc_email"],Fe=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","email_messages_count","people_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","won_deals_count","related_won_deals_count","lost_deals_count","related_lost_deals_count"];var zu=ie({auth:E,name:"new_deal",displayName:"New Deal",description:"Triggers when a new deal is created.",aiMetadata:{description:"Fires the moment a new deal record is created in Pipedrive, representing a sales opportunity (with its title, value, currency, owner, associated person/organization, pipeline and stage). Use to start automations whenever a deal enters the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("deal","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_deal_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_deal_trigger");t!=null&&await se.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}}),r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=D(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${t.data.id}`,query:{include_fields:Ie.join(",")}}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[D(n,r.data)]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",custom_fields:{d4de1c1518b4531717c676029a45911c340390a6:{value:2300,currency:"EUR"}}}});var ku=ie({auth:E,name:"new_person",displayName:"New Person",description:"Triggers when a new person is created",aiMetadata:{description:"Fires the moment a new person (contact) record is created in Pipedrive, with their name, emails, phones, owner, associated organization, labels, and custom fields. Use to start automations whenever a contact is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("person","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_person_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_person_trigger");t!=null&&await se.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}}),r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=D(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Me.join(",")}}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[D(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Du=ie({auth:E,name:"updated_deal",displayName:"Updated Deal",description:"Triggers when a deal is updated.",aiMetadata:{description:"Fires when any field of an existing deal changes in Pipedrive, such as its value, status, owner, stage, or custom fields. Can optionally be scoped to changes on a specific deal, pipeline, or stage. Use to react to edits on sales opportunities in the CRM."},props:{filter_by:g.StaticDropdown({displayName:"Filter by",required:!1,options:{disabled:!1,options:[{label:"Deal Status",value:"status"},{label:"Stage in Pipeline",value:"stage_id"}]}}),filter_by_field_value:g.DynamicProperties({auth:E,displayName:"Field Values",required:!1,refreshers:["filter_by"],props:o(async({auth:e,filter_by:t})=>{if(!e||!t)return{};let r={},n=e,i=t;if(i==="status"&&(r.field_value=g.StaticDropdown({displayName:"Deal Status",required:!0,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}})),i==="stage_id"){let a=await Se.sendRequest({method:"GET",url:`${n.data.api_domain}/api/v2/stages`,authentication:{type:"BEARER_TOKEN",token:n.access_token}});r.field_value=g.StaticDropdown({displayName:"Stage in Pipeline",required:!0,options:{disabled:!1,options:a.body.data.map(s=>({label:s.name,value:s.id}))}})}return r},"props")}),field_to_watch:g.Dropdown({auth:E,displayName:"Field to watch for Changes On",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"Connect your account",disabled:!0,options:[]};let t=e,r=await Se.sendRequest({method:"GET",url:`${t.data.api_domain}/api/v1/dealFields`,authentication:{type:"BEARER_TOKEN",token:t.access_token}}),n=[];for(let i of r.body.data)n.push({label:i.name,value:i.key});return{disabled:!1,options:n}},"options")})},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("deal","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_deal_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_deal_trigger");t&&await se.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")};t&&r&&(n[t]=r);let i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:n});if(A(i.data))return[];let a=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),s=[];for(let c of i.data){let d=D(a,c);s.push(d)}return s},async run(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n=e.propsValue.field_to_watch==="label"?"label_ids":e.propsValue.field_to_watch,i=e.payload.body,a=Ou(i.data),s=Ou(i.previous),c=!t&&!n,d=n&&n in s&&a[n]!==s[n],p=t&&a[t]===r;if(c||!t&&d||p&&(!n||d)){let _=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${i.data.id}`,query:{include_fields:Ie.join(",")}}),x=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[D(x,_.data)]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com"}});function Ou(e){let{custom_fields:t,...r}=e;if(!t)return r;let n={};for(let[i,a]of Object.entries(t)){if(A(a)){n[i]=a;continue}switch(a.type){case"varchar":case"text":case"varchar_auto":case"double":case"phone":case"date":n[i]=a?.value;break;case"set":n[i]=a?.values?.length?a.values.map(c=>c.id).join(","):"";break;case"enum":case"user":case"org":case"people":n[i]=a?.id;break;case"monetary":n[i]=a?.value,n[`${i}_currency`]=a?.currency;break;case"time":n[i]=a?.value,n[`${i}_timezone_id`]=a?.timezone_id;break;case"timerange":n[i]=a?.from,n[`${i}_timezone_id`]=a?.timezone_id,n[`${i}_until`]=a?.until;break;case"daterange":n[i]=a?.from,n[`${i}_until`]=a?.until;break;case"address":n[i]=a?.value,n[`${i}_subpremise`]=a?.subpremise,n[`${i}_street_number`]=a?.street_number,n[`${i}_route`]=a?.route,n[`${i}_sublocality`]=a?.sublocality,n[`${i}_locality`]=a?.locality,n[`${i}_admin_area_level_1`]=a?.admin_area_level_1,n[`${i}_admin_area_level_2`]=a?.admin_area_level_2,n[`${i}_country`]=a?.country,n[`${i}_postal_code`]=a?.postal_code,n[`${i}_formatted_address`]=a?.formatted_address;break}}return{...r,...n}}o(Ou,"flattenCustomFields");var Ru=ie({auth:E,name:"updated_person",displayName:"Updated Person",description:"Triggers when a person is updated.",aiMetadata:{description:"Fires when any field of an existing person (contact) record changes in Pipedrive, such as their name, emails, phones, owner, associated organization, labels, or custom fields. Use to react to edits on contact records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("person","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_person_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_person_trigger");t!=null&&await se.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}}),r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=D(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Me.join(",")}}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[D(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Nu=ie({auth:E,name:"new-lead",displayName:"New Lead",description:"Triggers when a new lead is created.",aiMetadata:{description:"Fires when a new lead is created in Pipedrive. A lead is an early, unqualified sales opportunity (with a title, optional value, source, and links to a person or organization) that has not yet been converted into a deal. Use to act on inbound prospects as they enter the leads inbox."},props:{},type:"WEBHOOK",async onEnable(e){let t=await Se.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},body:{event_object:"lead",event_action:"create",subscription_url:e.webhookUrl,version:"2.0"}});await e.store?.put("_new_lead_trigger",{webhookId:t.body.data.id})},async onDisable(e){let t=await e.store?.get("_new_lead_trigger");t!==null&&!A(t.webhookId)&&await Se.sendRequest({method:"DELETE",url:`${e.auth.data.api_domain}/api/v1/webhooks/${t.webhookId}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}})},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/leads",query:{limit:10,sort:"update_time DESC"}});if(A(t.data))return[];let r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),n=[];for(let i of t.data){let a=ht(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/leads/${t.data.id}`}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[ht(n,r.data)]},sampleData:{id:"f3c23480-c9b1-11ef-bc83-2b8218e028ef",title:"Test lead",owner_id:22701301,creator_id:22701301,label_ids:["a0e5f330-d2a7-4181-a6e3-a44d634b7bf7","8a0e6918-1eee-4e56-a615-c81d712a6a77"],value:null,expected_close_date:null,person_id:2,organization_id:1,is_archived:!1,source_name:"Manually created",origin:"ManuallyCreated",origin_id:null,channel:1,channel_id:null,was_seen:!0,next_activity_id:null,add_time:"2025-01-03T09:06:00.776Z",update_time:"2025-01-03T09:06:00.776Z",visible_to:3}});var Cu=ie({auth:E,name:"new-organization",displayName:"New Organization",description:"Triggers when a new organization is created.",aiMetadata:{description:"Fires the moment a new organization (company) record is created in Pipedrive, with its name, owner, address, labels, and custom fields. Use to start automations whenever a company is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("organization","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_organization_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_organization_trigger");t!=null&&await se.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}});if(A(t.data))return[];let r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=D(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Fe.join(",")}}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[D(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var Uu=ie({auth:E,name:"updated-organization",displayName:"Updated Organization",description:"Triggers when an existing organization is updated.",aiMetadata:{description:"Fires when any field of an existing organization (company) record changes in Pipedrive, such as its name, owner, address, labels, or custom fields. Use to react to edits on company records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("organization","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_organization_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_organization_trigger");t!=null&&await se.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}});if(A(t.data))return[];let r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=D(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Fe.join(",")}}),n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[D(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var Mu=ie({auth:E,name:"updated-deal-stage",displayName:"Updated Deal Stage",description:"Triggers when a deal's stage is updated.",aiMetadata:{description:"Fires when an existing deal moves from one pipeline stage to another (its stage_id changes). Represents progress of a deal through the sales pipeline; can optionally be limited to a specific stage. Use to react when deals advance, regress, or reach a particular stage."},type:"WEBHOOK",props:{stage_id:g.Dropdown({auth:E,displayName:"Stage in Pipeline",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"please connect your account.",disabled:!0,options:[]};let t=e,r=await ye({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),n=[];for(let i of r)n.push({label:`${i.name}`,value:i.id});return{disabled:!1,options:n}},"options")})},async onEnable(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/webhooks",body:{subscription_url:e.webhookUrl,event_object:"deal",event_action:"change",version:"2.0"}});await e.store.put("updated-deal-stage-trigger",t.data.id)},async onDisable(e){let t=await e.store.get("updated-deal-stage-trigger");t&&await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/webhooks/${t}`})},async test(e){let t=e.propsValue.stage_id,r={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")};t&&(r.stage_id=t.toString());let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:r});if(A(n.data))return[];let i=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),a=[];for(let s of n.data){let c=D(i,s),d=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${c.stage_id}`});c.stage=d.data,a.push(c)}return a},async run(e){let t=e.propsValue.stage_id,r=e.payload.body,n=r.data,i=r.previous;if(!i||A(i.stage_id))return[];if(n.stage_id!==i.stage_id){if(t&&n.stage_id!==t)return[];let a=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${r.data.id}`,query:{include_fields:Ie.join(",")}}),s=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=D(s,a.data),d=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${n.stage_id}`});return c.stage=d.data,[c]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",stage:{id:2,order_nr:1,name:"Qualification",is_deleted:!1,deal_probability:!1,pipeline_id:1,is_deal_rot_enabled:!1,days_to_rotten:null,add_time:"2018-09-04T06:24:59Z",update_time:null}}});async function Qm(e,t){let r=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/filters",query:{type:t}}),n=[];for(let i of r.data)n.push({label:i.name,value:i.id});return n}o(Qm,"fetchFiltersOptions");async function ef(e){let t=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/activityTypes"}),r=[];for(let n of t.data)r.push({label:n.name,value:n.key_string});return r}o(ef,"fetchActivityTypesOptions");async function tf(e){let t=await ye({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v2/pipelines"}),r=[];for(let n of t)r.push({label:n.name,value:n.id});return r}o(tf,"fetchPipelinesOptions");async function rf(e){let t=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/users:(id,email)"}),r=[];for(let n of t.data)r.push({label:n.email,value:n.id});return r}o(rf,"fetchOwnersOptions");function Fu(e){switch(e.field_type){case"varchar":case"varchar_auto":case"phone":return g.ShortText({displayName:e.name,required:!1});case"text":case"address":return g.LongText({displayName:e.name,required:!1});case"enum":return g.StaticDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"set":return g.StaticMultiSelectDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"double":case"monetary":return g.Number({displayName:e.name,required:!1});case"time":case"timerange":return g.ShortText({displayName:e.name,description:"Please enter time in HH:mm:ss format.",required:!1});case"int":return g.Number({displayName:e.name,required:!1});case"date":case"daterange":return g.DateTime({displayName:e.name,description:"Please enter date in YYYY-MM-DD format.",required:!1});default:return null}}o(Fu,"createPropertyDefinition");async function nf(e,t){let r="";switch(t){case"person":r="/v1/personFields";break;case"deal":case"lead":r="/v1/dealFields";break;case"organization":r="/v1/organizationFields";break;case"product":r="/v1/productFields";break}let n=await S({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:r}),i={};for(let a of n){if(!a.edit_flag)continue;let s=Fu(a);s&&(i[a.key]=s)}return i}o(nf,"retrieveObjectCustomProperties");var Ct=o(e=>g.Dropdown({auth:E,displayName:"Field to search by",required:!0,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n="";switch(e){case"person":n="/v1/personFields";break;case"deal":case"lead":n="/v1/dealFields";break;case"organization":n="/v1/organizationFields";break;case"product":n="/v1/productFields";break}let i=await S({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:n}),a=[];for(let s of i)A(s.id)||a.push({label:s.name,value:s.id.toString()});return{disabled:!1,options:a}},"options")}),"searchFieldProp"),Ut=o(e=>g.DynamicProperties({auth:E,displayName:"Field Value",required:!0,refreshers:["searchField"],props:o(async({auth:t,searchField:r})=>{if(!t||!r)return{};let n=t,i={},a="";switch(e){case"person":a="/v1/personFields";break;case"deal":case"lead":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break;case"product":a="/v1/productFields";break}let s=await T({accessToken:n.access_token,apiDomain:n.data.api_domain,method:"GET",resourceUri:`${a}/${r}`}),c=s.data.field_type==="set"?g.StaticDropdown({displayName:s.data.name,required:!1,options:{disabled:!1,options:s.data.options?s.data.options.map(d=>({label:d.label,value:d.id.toString()})):[]}}):Fu(s.data);return c?i.field_value=c:i.field_value=g.ShortText({displayName:s.data.name,required:!1}),i},"props")}),"searchFieldValueProp"),Oe=o((e,t=!1)=>g.Dropdown({auth:E,displayName:e,refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await rf(r)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"ownerIdProp"),Be=o((e,t=!1)=>g.Dropdown({auth:E,displayName:"Filter",refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await Qm(r,e)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"filterIdProp"),Ze=o((e=!1)=>g.Number({displayName:"Organization ID",description:"You can use Find Organization action to retrieve org ID.",required:e}),"organizationIdProp"),of=o((e=!1)=>g.Dropdown({auth:E,displayName:"Pipeline",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await tf(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"dealPipelineIdProp"),af=o((e=!1)=>g.Dropdown({auth:E,displayName:"Stage",description:"If a stage is chosen above, the pipeline field will be ignored.",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{placeholder:"Please connect your account.",disabled:!0,options:[]};let r=t,n=await ye({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),i=[];for(let a of n)i.push({label:`${a.name}`,value:a.id});return{disabled:!1,options:i}},"options")}),"dealStageIdProp"),De=o((e=!1)=>g.Number({displayName:"Person ID",description:"You can use Find Person action to retrieve person ID.",required:e}),"personIdProp"),cr=o((e,t,r=!1)=>g.MultiSelectDropdown({auth:E,displayName:"Label",required:r,refreshers:[],options:o(async({auth:n})=>{if(!n)return{disabled:!0,options:[],placeholder:"Please connect your account."};let i=n,a="";switch(e){case"person":a="/v1/personFields";break;case"deal":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break}let c=(await S({accessToken:i.access_token,apiDomain:i.data.api_domain,method:"GET",resourceUri:a})).find(p=>p.key===t),d=[];if(c&&c.options)for(let p of c.options)d.push({label:p.label,value:p.id});return{disabled:!1,options:d}},"options")}),"labelIdsProp"),sf=o((e=!1)=>g.MultiSelectDropdown({auth:E,displayName:"Label",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n=await T({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v1/leadLabels"}),i=[];for(let a of n.data)i.push({label:`${a.name} (${a.color})`,value:a.id});return{disabled:!1,options:i}},"options")}),"leadLabelIdsProp"),Zr=o((e=!1)=>g.Number({displayName:"Product ID",description:"You can use Find Product action to retrieve product ID.",required:e}),"productIdProp"),st=g.StaticDropdown({displayName:"Visible To",required:!1,options:{disabled:!1,options:[{label:"Owner & followers",value:1},{label:"Entire company",value:3}]}}),lr=o((e=!1)=>g.ShortText({displayName:"Lead ID",required:e}),"leadIdProp"),ui=o((e=!1)=>g.Dropdown({auth:E,displayName:"Activity Type",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await ef(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"activityTypeIdProp"),Ye=o((e=!1)=>g.Number({displayName:"Deal ID",description:"You can use Find Deal action to retrieve deal ID.",required:e}),"dealIdProp"),Gr={creationTime:g.DateTime({displayName:"Creation Time",required:!1}),status:g.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}}),stageId:af(!1),pipelineId:of(!1),ownerId:Oe("Owner",!1),organizationId:Ze(!1),personId:De(!1),labelIds:cr("deal","label",!1),probability:g.Number({displayName:"Probability",required:!1}),expectedCloseDate:g.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dealValue:g.Number({displayName:"Value",required:!1}),dealValueCurrency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),visibleTo:st,customfields:ut("deal")},qr={ownerId:Oe("Owner",!1),organizationId:Ze(!1),personId:De(!1),labelIds:sf(!1),expectedCloseDate:g.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),visibleTo:st,channel:g.Dropdown({auth:E,displayName:"Channel",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your account."};let t=e,n=(await S({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v1/dealFields:(key,name,options)"})).find(a=>a.key==="channel"),i=[];if(n)for(let a of n.options??[])i.push({label:a.label,value:a.id});return{disabled:!1,options:i}},"options")}),leadValue:g.Number({displayName:"Lead Value Amount",required:!1}),leadValueCurrency:g.ShortText({displayName:"Lead Value Currency",required:!1,description:'The currency of the lead value (e.g., "USD", "EUR").'}),customfields:ut("lead")},Hr={ownerId:Oe("Owner",!1),visibleTo:st,labelIds:cr("organization","label_ids",!1),address:g.LongText({displayName:"Address",required:!1}),customfields:ut("organization")},Wr={ownerId:Oe("Owner",!1),organizationId:Ze(!1),email:g.Array({displayName:"Email",required:!1}),phone:g.Array({displayName:"Phone",required:!1}),labelIds:cr("person","label_ids",!1),firstName:g.ShortText({displayName:"First Name",required:!1}),lastName:g.ShortText({displayName:"Last Name",required:!1}),visibleTo:st,marketing_status:g.StaticDropdown({displayName:"Marketing Status",description:"Marketing opt-in status",required:!1,options:{disabled:!1,options:[{label:"No Consent",value:"no_consent"},{label:"Unsubscribed",value:"unsubscribed"},{label:"Subscribed",value:"subscribed"},{label:"Archived",value:"archived"}]}}),customfields:ut("person")},Kr={organizationId:Ze(!1),personId:De(!1),dealId:Ye(!1),leadId:lr(!1),assignTo:Oe("Assign To",!1),type:ui(!1),dueDate:g.DateTime({displayName:"Due Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dueTime:g.ShortText({displayName:"Due Time",required:!1,description:"Please enter time in HH:MM format."}),duration:g.ShortText({displayName:"Duration",required:!1,description:'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).'}),isDone:g.Checkbox({displayName:"Mark as Done?",required:!1,defaultValue:!1}),busy:g.StaticDropdown({displayName:"Free or Busy",required:!1,options:{disabled:!1,options:[{label:"Free",value:"free"},{label:"Busy",value:"busy"}]}}),note:g.LongText({displayName:"Note",required:!1}),publicDescription:g.LongText({displayName:"Public Description",required:!1})};function ut(e){return g.DynamicProperties({auth:E,displayName:"Custom Fields",required:!1,refreshers:[],props:o(async({auth:t})=>t?await nf(t,e):{},"props")})}o(ut,"customFieldsProp");var Lu=O({auth:E,name:"create-person",displayName:"Create Person",description:"Creates a new person.",audience:"both",aiMetadata:{description:"Creates a new person (contact) with a name, optional emails/phones, owner, organization, and custom fields. Provide either a single Name or First/Last Name, not both. Use to add a contact (use Update Person to edit an existing one, or Find Person to check for one first). Not idempotent: each call creates a separate person, so guard against duplicates.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!1}),...Wr},async run(e){let{name:t,ownerId:r,organizationId:n,marketing_status:i,visibleTo:a,firstName:s,lastName:c}=e.propsValue,d=e.propsValue.phone??[],p=e.propsValue.email??[],_=e.propsValue.labelIds??[],x=e.propsValue.customfields??{};if(t&&(s||c))throw new Error("Provide either Name OR First Name/Last Name, not both.");if(!t&&!s&&!c)throw new Error("Provide Name or at least one of First Name / Last Name.");if(!t&&(s&&!c||!s&&c))throw new Error("If First Name is provided, Last Name must be provided as well.");let v=d.map((k,te)=>({value:k,label:"work",primary:te===0})),l=p.map((k,te)=>({value:k,label:"work",primary:te===0})),m={name:t,owner_id:r,org_id:n,visible_to:a,first_name:s,last_name:c,marketing_status:i};v.length&&(m.phones=v),l.length&&(m.emails=l),_.length&&(m.label_ids=_);let h=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),f=Te(h,x);ue(f)||(m.custom_fields=f);let b=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/persons",body:m}),I=D(h,b.data);return{...b,data:I}}});var ju=O({auth:E,name:"update-person",displayName:"Update Person",description:"Updates an existing person.",audience:"both",aiMetadata:{description:"Updates fields on an existing person identified by their person ID, such as name, emails, phones, owner, organization, and custom fields; only supplied fields change. Use to edit a contact you have the ID for (use Create Person to add one, or Find Person to locate it). Idempotent: repeating the same update converges to the same person state.",idempotent:!0},props:{personId:De(!0),name:g.ShortText({displayName:"Name",required:!1}),...Wr},async run(e){let{name:t,ownerId:r,personId:n,organizationId:i,marketing_status:a,visibleTo:s,firstName:c,lastName:d}=e.propsValue,p=e.propsValue.phone??[],_=e.propsValue.email??[],x=e.propsValue.labelIds??[],v=e.propsValue.customfields??{};if(c&&!d||!c&&d)throw new Error("If First Name is provided, Last Name must be provided as well.");let l=p.map((te,ve)=>({value:te,label:"work",primary:ve===0})),m=_.map((te,ve)=>({value:te,label:"work",primary:ve===0})),h={name:t,owner_id:r,org_id:i,marketing_status:a,visible_to:s,first_name:c,last_name:d};l.length&&(h.phones=l),m.length&&(h.emails=m),x.length&&(h.label_ids=x);let f=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),b=Te(f,v);ue(b)||(h.custom_fields=b);let I=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${n}`,body:h}),k=D(f,I.data);return{...I,data:k}}});var Vu=O({auth:E,name:"create-organization",displayName:"Create Organization",description:"Creates a new organization.",audience:"both",aiMetadata:{description:"Creates a new organization (company) with a required name and optional owner, address, visibility, labels, and custom fields. Use to add a company record (use Update Organization to edit one, or Find Organization to check for an existing match). Not idempotent: each call creates a separate organization, so guard against duplicates.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!0}),...Hr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i}=e.propsValue,a=e.propsValue.labelIds??[],s=e.propsValue.customfields??{},c={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(c.address={value:n}),a.length>0&&(c.label_ids=a);let d=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),p=Te(d,s);ue(p)||(c.custom_fields=p);let _=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/organizations",body:c}),x=D(d,_.data);return{..._,data:x}}});var Bu=O({auth:E,name:"update-organization",displayName:"Update Organization",description:"Updates an existing organization.",audience:"both",aiMetadata:{description:"Update fields on an existing organization identified by ID (name, owner, address, visibility, labels, and custom fields). Pick this to modify a known organization; only supplied fields are changed. Re-running with the same inputs yields the same final state.",idempotent:!0},props:{organizationId:Ze(!0),name:g.ShortText({displayName:"Name",required:!1}),...Hr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i,organizationId:a}=e.propsValue,s=e.propsValue.labelIds??[],c=e.propsValue.customfields??{},d={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(d.address={value:n}),s.length>0&&(d.label_ids=s);let p=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),_=Te(p,c);ue(_)||(d.custom_fields=_);let x=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/organizations/${a}`,body:d}),v=D(p,x.data);return{...x,data:v}}});var Zu=$e(at()),Gu=O({auth:E,name:"create-lead",displayName:"Create Lead",description:"Creates a new lead.",audience:"both",aiMetadata:{description:"Creates a new lead with a required title and optional value, owner, channel, and custom fields. At least one of a linked person or organization must be supplied. Use to capture an unqualified opportunity (use Create Deal once it advances to your pipeline, or Update Lead to edit one). Not idempotent: each call creates a separate lead.",idempotent:!1},props:{title:g.ShortText({displayName:"Title",required:!0}),...qr},async run(e){let{title:t,leadValue:r,leadValueCurrency:n,expectedCloseDate:i,visibleTo:a,ownerId:s,organizationId:c,personId:d,channel:p}=e.propsValue;if(!d&&!c)throw new Error("Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.");let _=e.propsValue.labelIds??[],x=e.propsValue.customfields??{},v={title:t,owner_id:s,organization_id:c,person_id:d,channel:p,visible_to:a};if(_.length>0&&(v.label_ids=_),i&&(v.expected_close_date=(0,Zu.default)(i).format("YYYY-MM-DD")),r){if(!n)throw new Error("lead Value Currency is required when lead Value is provided");v.value={amount:r,currency:n}}let l={};Object.entries(x).forEach(([b,I])=>{l[b]=Array.isArray(I)?I.join(","):I});let m=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/leads",body:{...v,...l}}),h=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),f=ht(h,m.data);return{...m,data:f}}});var qu=$e(at()),Hu=O({auth:E,name:"update-lead",displayName:"Update Lead",description:"Updates an existing lead.",audience:"both",aiMetadata:{description:"Updates fields on an existing lead identified by its lead ID, such as title, owner, value, channel, or linked person/organization; only supplied fields change. Use to modify a lead you have the ID for (use Create Lead to add one, or Find Lead to locate it). Idempotent: repeating the same update converges to the same lead state.",idempotent:!0},props:{leadId:lr(!0),title:g.ShortText({displayName:"Title",required:!1}),...qr},async run(e){let{title:t,ownerId:r,leadId:n,channel:i,organizationId:a,personId:s,expectedCloseDate:c,visibleTo:d,leadValue:p,leadValueCurrency:_}=e.propsValue,x=e.propsValue.labelIds??[],v=e.propsValue.customfields??{},l={title:t,owner_id:r,organization_id:a,person_id:s,channel:i,visible_to:d};if(x.length>0&&(l.label_ids=x),c&&(l.expected_close_date=(0,qu.default)(c).format("YYYY-MM-DD")),p){if(!_)throw new Error("lead Value Currency is required when lead Value is provided");l.value={amount:p,currency:_}}let m={};Object.entries(v).forEach(([I,k])=>{m[I]=Array.isArray(k)&&k.length>0?k.join(","):k});let h=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v1/leads/${n}`,body:{...l,...m}}),f=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),b=ht(f,h.data);return{...h,data:b}}});var ci=$e(at());var Wu=O({auth:E,name:"create-deal",displayName:"Create Deal",description:"Creates a new deal.",audience:"both",aiMetadata:{description:"Creates a new deal with a required title and optional value, currency, pipeline/stage, status, owner, and linked person/organization. Use to add a sales opportunity to a pipeline (use Update Deal to edit one, or Add Product to Deal to attach line items). Not idempotent: each call creates a separate deal, so guard against duplicates.",idempotent:!1},props:{title:g.ShortText({displayName:"Title",required:!0}),...Gr},async run(e){let{title:t,dealValue:r,dealValueCurrency:n,expectedCloseDate:i,visibleTo:a,probability:s,stageId:c,status:d,pipelineId:p,ownerId:_,organizationId:x,personId:v,creationTime:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},f={title:t,pipeline_id:p,stage_id:c,status:d,add_time:l?(0,ci.default)(l).format("YYYY-MM-DDTHH:mm:ss[Z]"):void 0,probability:s,visible_to:a,owner_id:_,org_id:x,person_id:v,value:r,currency:n};m.length>0&&(f.label_ids=m),i&&(f.expected_close_date=(0,ci.default)(i).format("YYYY-MM-DD"));let b=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),I=Te(b,h);ue(I)||(f.custom_fields=I);let k=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/deals",body:f}),te=D(b,k.data);return{...k,data:te}}});var Ku=$e(at());var Ju=O({auth:E,name:"update-deal",displayName:"Update Deal",description:"Updates an existing deal.",audience:"both",aiMetadata:{description:"Updates fields on an existing deal identified by its deal ID, such as title, value, stage, status, owner, or linked person/organization; only supplied fields are changed. Use to modify a deal you already know the ID of (use Create Deal to add a new one, or Find Deal to locate one first). Idempotent: repeating the same update converges to the same deal state.",idempotent:!0},props:{dealId:Ye(!0),title:g.ShortText({displayName:"Title",required:!1}),...Gr},async run(e){let{dealId:t,title:r,dealValue:n,dealValueCurrency:i,expectedCloseDate:a,visibleTo:s,probability:c,stageId:d,status:p,pipelineId:_,ownerId:x,organizationId:v,personId:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},f={title:r,pipeline_id:_,stage_id:d,status:p,probability:c,visible_to:s,owner_id:x,org_id:v,person_id:l,value:n,currency:i};m.length>0&&(f.label_ids=m),a&&(f.expected_close_date=(0,Ku.default)(a).format("YYYY-MM-DD"));let b=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),I=Te(b,h);ue(I)||(f.custom_fields=I);let k=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/deals/${t}`,body:f}),te=D(b,k.data);return{...k,data:te}}});var Yu=O({auth:E,name:"create-product",displayName:"Create Product",description:"Creates a new product.",audience:"both",aiMetadata:{description:"Create a new product in the catalog with name, code, pricing (price/cost/overhead/currency/tax), unit, owner, visibility, and custom fields. Pick this to add a product; each call creates a separate record, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!0}),code:g.ShortText({displayName:"Code",required:!1}),description:g.LongText({displayName:"Description",required:!1}),unit:g.ShortText({displayName:"Unit",required:!1}),tax:g.Number({displayName:"Tax percentage",required:!1}),isActive:g.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Oe("Owner",!1),currency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:g.Number({displayName:"Price",required:!1}),cost:g.Number({displayName:"Cost",required:!1}),overheadCost:g.Number({displayName:"Overhead Cost",required:!1}),visibleTo:st,customfields:ut("product")},async run(e){let{name:t,code:r,description:n,unit:i,tax:a,isActive:s,ownerId:c,currency:d,price:p,cost:_,overheadCost:x,visibleTo:v}=e.propsValue,l=e.propsValue.customfields??{},m={name:t,code:r,description:n,unit:i,tax:a,is_deleted:!s,prices:[{price:p??0,currency:d??"USD",cost:_??0,direct_cost:x??0}],visible_to:v};c&&(m.owner_id=c);let h=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),f=Te(h,l);ue(f)||(m.custom_fields=f);let b=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/products",body:m}),I=D(h,b.data);return{...b,data:I}}});var Xu=O({auth:E,name:"add-product-to-deal",displayName:"Add Product to Deal",description:"Adds a product to a deal.",audience:"both",aiMetadata:{description:"Attaches an existing product (by product ID) as a line item on a deal (by deal ID), setting its unit price, quantity, and optional discount and tax. Use when building out the products on a deal; requires both IDs and a price and quantity. Not idempotent: each call adds another line item, so calling it twice attaches the product twice.",idempotent:!1},props:{dealId:Ye(!0),productId:Zr(!0),price:g.Number({displayName:"Price",required:!0}),quantity:g.Number({displayName:"Quantity",required:!0}),discount:g.Number({displayName:"Discount",required:!1}),discountType:g.StaticDropdown({displayName:"Discount Type",required:!1,options:{disabled:!1,options:[{label:"Percentage",value:"percentage"},{label:"Amount",value:"amount"}]}}),comments:g.LongText({displayName:"Comments",required:!1}),enableProduct:g.Checkbox({displayName:"Enable Product?",required:!1,defaultValue:!0}),taxMethod:g.StaticDropdown({displayName:"Tax Method",required:!1,options:{disabled:!1,options:[{label:"Exclusive",value:"exclusive"},{label:"Inclusive",value:"inclusive"},{label:"None",value:"none"}]}}),taxPercentage:g.Number({displayName:"Tax Percentage",required:!1})},async run(e){let{productId:t,dealId:r,price:n,quantity:i,discountType:a,discount:s,comments:c,enableProduct:d,taxPercentage:p,taxMethod:_}=e.propsValue;return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2/deals/${r}/products`,body:{product_id:t,item_price:n,quantity:i,discount_type:a,discount:s,comments:c??"",is_enabled:d,tax:p,tax_method:_}})}});var Qu=O({auth:E,name:"add-labels-to-person",displayName:"Add Labels to Person",description:"Adds existing labels to an existing person.",audience:"both",aiMetadata:{description:"Set the label(s) on an existing person by ID using pre-existing label definitions. Pick this to tag/categorize a known person; it replaces the person's label_ids with the supplied set rather than merging, so include all labels that should remain. Mutates the person record.",idempotent:!1},props:{personId:De(!0),labelIds:cr("person","label_ids",!0)},async run(e){let{personId:t}=e.propsValue,r=e.propsValue.labelIds??[],n={};r.length>0&&(n.label_ids=r);let i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${t}`,body:{...n}}),a=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),s=D(a,i.data);return{...i,data:s}}});var ec=$e(at()),tc=O({auth:E,name:"create-activity",displayName:"Create Activity",description:"Creates a new activity.",audience:"both",aiMetadata:{description:"Creates an activity (call, meeting, task, etc.) with a subject and optional type, due date/time, owner, and links to a deal, lead, person, or organization. Use to schedule or log work against CRM records (use Update Activity to change one that exists). Not idempotent: each call creates a separate activity.",idempotent:!1},props:{subject:g.ShortText({displayName:"Subject",required:!0}),...Kr},async run(e){let{subject:t,organizationId:r,personId:n,dealId:i,leadId:a,assignTo:s,type:c,dueDate:d,dueTime:p,duration:_,isDone:x,busy:v,note:l,publicDescription:m}=e.propsValue,h={subject:t,org_id:r,deal_id:i,lead_id:a,public_description:m,type:c,owner_id:s,due_time:p,duration:_,done:x,note:l};return n&&(h.participants=[{person_id:n,primary:!0}]),v&&(h.busy=v==="busy"),d&&(h.due_date=(0,ec.default)(d).format("YYYY-MM-DD")),await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/activities",body:h})}});var rc=$e(at()),nc=O({auth:E,name:"update-activity",displayName:"Update Activity",description:"Updates an existing activity.",audience:"both",aiMetadata:{description:"Updates fields on an existing activity identified by its activity ID, such as subject, type, due date/time, owner, done state, and linked records; only supplied fields change. Use to reschedule or mark an activity done (use Create Activity to add a new one). Idempotent: repeating the same update converges to the same activity state.",idempotent:!0},props:{activityId:g.Number({displayName:"Activity ID",required:!0}),subject:g.ShortText({displayName:"Subject",required:!1}),...Kr},async run(e){let{activityId:t,subject:r,organizationId:n,personId:i,dealId:a,leadId:s,assignTo:c,type:d,dueDate:p,dueTime:_,duration:x,isDone:v,busy:l,note:m,publicDescription:h}=e.propsValue,f={subject:r,org_id:n,deal_id:a,lead_id:s,note:m,public_description:h,type:d,owner_id:c,due_time:_,duration:x,done:v};return i&&(f.participants=[{person_id:i,primary:!0}]),l&&(f.busy=l==="busy"),p&&(f.due_date=(0,rc.default)(p).format("YYYY-MM-DD")),await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/activities/${t}`,body:f})}});var ic=$e(ri());var oc=O({auth:E,name:"attach-file",displayName:"Attach File",description:"Uploads a file and attaches it to a deal,person,organization,activity or product.",audience:"both",aiMetadata:{description:"Uploads a file and attaches it to one or more CRM records by supplying any of the optional deal, person, organization, product, or activity IDs. Use to add documents or images to existing records; requires the file content and a file name. Not idempotent: each call uploads and creates a separate file attachment.",idempotent:!1},props:{file:g.File({displayName:"File",required:!0}),fileName:g.ShortText({displayName:"File Name",required:!0}),dealId:Ye(!1),personId:De(!1),organizationId:Ze(!1),productId:Zr(!1),activityId:g.Number({displayName:"Activity ID",required:!1})},async run(e){let{file:t,fileName:r,dealId:n,personId:i,organizationId:a,productId:s,activityId:c}=e.propsValue,d=new ic.default;return d.append("file",t.data,r),n&&d.append("deal_id",n),i&&d.append("person_id",i),a&&d.append("org_id",a),s&&d.append("product_id",s),c&&d.append("activity_id",c),(await Se.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/files`,body:d,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{...d.getHeaders()}})).body}});var ac=O({auth:E,name:"add-follower",displayName:"Add Follower",description:"Adds a follower to a deal, person, organization or product.",audience:"both",aiMetadata:{description:"Adds a user as a follower of a single record, with the Target Object dropdown selecting the type (deal, person, organization, or product) and the Target Object ID identifying it. Use to subscribe a user to updates on a record; requires the follower user ID. Not idempotent: each call creates a follower association.",idempotent:!1},props:{followerId:Oe("Follower",!0),entity:g.StaticDropdown({displayName:"Target Object",description:"Type of object to add the follower to.",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal"},{label:"Person",value:"person"},{label:"Organization",value:"organization"},{label:"Product",value:"product"}]}}),entityId:g.ShortText({displayName:"Target Object ID",description:"ID of the object to add the follower to.",required:!0})},async run(e){let{followerId:t,entity:r,entityId:n}=e.propsValue,i="";switch(r){case"deal":i=`/deals/${n}/followers`;break;case"organization":i=`/organizations/${n}/followers`;break;case"person":i=`/persons/${n}/followers`;break;case"product":i=`/products/${n}/followers`;break}if(!i)throw new Error(`Invalid object type: ${r}`);return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2${i}`,body:{user_id:t}})}});var sc=O({auth:E,name:"create-note",displayName:"Create Note",description:"Creates a new note.",audience:"both",aiMetadata:{description:"Create a note with the given content and attach it to at least one deal, person, organization, or lead (at least one association is required, with optional pinning). Pick this to record a comment or log against a CRM record; each call creates a new note, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{content:g.LongText({displayName:"Content",required:!0}),dealId:Ye(!1),pinnedToDeal:g.Checkbox({displayName:"Pin note to deal?",required:!1,defaultValue:!1}),personId:De(!1),pinnedToPerson:g.Checkbox({displayName:"Pin note to person?",required:!1,defaultValue:!1}),organizationId:Ze(!1),pinnedToOrganization:g.Checkbox({displayName:"Pin note to organization?",required:!1,defaultValue:!1}),leadId:lr(!1),pinnedToLead:g.Checkbox({displayName:"Pin note to lead?",required:!1,defaultValue:!1})},async run(e){let{content:t,dealId:r,personId:n,organizationId:i,leadId:a,pinnedToDeal:s,pinnedToPerson:c,pinnedToOrganization:d,pinnedToLead:p}=e.propsValue;if(!r&&!n&&!i&&!a)throw new Error("Note must be associated with at least one organization, person, deal, lead or project.");let _={content:t,pinned_to_deal_flag:s?1:0,pinned_to_person_flag:c?1:0,pinned_to_organization_flag:d?1:0,pinned_to_lead_flag:p?1:0,lead_id:a,person_id:n,org_id:i,deal_id:r};return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/notes",body:_})}});var uc=O({auth:E,name:"get-note",displayName:"Retrieve a Note",description:"Finds a note by ID.",audience:"both",aiMetadata:{description:"Retrieves a single note by its numeric note ID. Use when you already have the note ID; to list the notes attached to a deal, lead, person, or organization, use Find Notes instead. Read-only and idempotent.",idempotent:!0},props:{noteId:g.Number({displayName:"Note ID",required:!0})},async run(e){try{return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${e.propsValue.noteId}`})}catch{return{success:!1,data:{}}}}});var cc=O({auth:E,name:"find-user",displayName:"Find User",description:"Finds a user by name or email.",audience:"both",aiMetadata:{description:"Search Pipedrive account users (team members, not CRM persons) by name or by email address. Pick this to resolve an owner or assignee to a user ID; choose the search-by field to match either a name or an email term. Read-only and may return multiple matches.",idempotent:!0},props:{field:g.StaticDropdown({displayName:"Field to search by",required:!0,options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Email",value:"email"}]}}),fieldValue:g.ShortText({displayName:"Field Value",required:!0})},async run(e){let{field:t,fieldValue:r}=e.propsValue,n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/users/find",query:{term:r,search_by_email:t=="email"?1:0}});return{found:n.data&&n.data.length>0,data:n.data}}});var lc=O({auth:E,name:"find-product",displayName:"Find Product",description:"Finds a product by name ",audience:"both",aiMetadata:{description:"Search the product catalog by name and return the single best-matching product with its full details and custom fields. Pick this when you have a product name or keyword rather than an ID; use Retrieve a Product when you already know the exact product ID. Read-only and returns at most one match (found:false when nothing matches).",idempotent:!0},props:{searchTerm:g.ShortText({displayName:"Search Term",required:!0})},async run(e){let{searchTerm:t}=e.propsValue,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:t,fields:"name",limit:1,include_fields:"product.price"}});if(A(r.data)||A(r.data.items)||r.data.items.length===0)return{found:!1,data:[]};let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${r.data.items[0].item.id}`}),i=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[D(i,n.data)]}}});var dc=ie({auth:E,name:"organization-matching-filter",displayName:"Organization Matching Filter",description:"Triggers when an organization newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an organization (company) record first becomes a member of a selected Pipedrive filter \u2014 that is, the organization newly satisfies the filter conditions. Polls the filter and emits each organization the first time it appears; does not re-fire for organizations already in the filter."},type:"POLLING",props:{filterId:Be("org",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("organizations",JSON.stringify(t))},async onDisable(e){await e.store.delete("organizations")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Fe.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),i=[];for(let a of t){let s=D(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("organizations")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Fe.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("organizations",JSON.stringify([...a,...r]));let s=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),c=[];for(let d of i){let p=D(s,d);c.push(p)}return c},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},custom_fields:{your_custom_field_key:"your_custom_field_value"}}});var pc=ie({auth:E,name:"person-matching-filter",displayName:"Person Matching Filter",description:"Triggers when a person newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a person (contact) record first becomes a member of a selected Pipedrive filter \u2014 that is, the person newly satisfies the filter conditions. Polls the filter and emits each person the first time it appears; does not re-fire for people already in the filter."},type:"POLLING",props:{filterId:Be("people",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("persons",JSON.stringify(t))},async onDisable(e){await e.store.delete("persons")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Me.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),i=[];for(let a of t){let s=D(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("persons")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Me.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("persons",JSON.stringify([...a,...r]));let s=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),c=[];for(let d of i){let p=D(s,d);c.push(p)}return c},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var mc=ie({auth:E,name:"activity-matching-filter",displayName:"Activity Matching Filter",description:"Trigges when an activity newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an activity (scheduled task or event) first becomes a member of a selected Pipedrive filter \u2014 that is, the activity newly satisfies the filter conditions. Polls the filter and emits each activity the first time it appears; does not re-fire for activities already in the filter."},type:"POLLING",props:{filterId:Be("activity",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("activities",JSON.stringify(t))},async onDisable(e){await e.store.delete("activities")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,filter_id:e.propsValue.filterId,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=await e.store.get("activities")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId,include_fields:"attendees"}});if(A(n)||n.length===0)return[];let i=n.filter(s=>!r.includes(s.id)),a=i.map(s=>s.id);return a.length===0?[]:(await e.store.put("activities",JSON.stringify([...a,...r])),i)},sampleData:{id:8,company_id:22122,user_id:1234,done:!1,type:"deadline",reference_type:"scheduler-service",reference_id:7,conference_meeting_client:"871b8bc88d3a1202",conference_meeting_url:"https://pipedrive.zoom.us/link",conference_meeting_id:"01758746701",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy_flag:!0,add_time:"2020-06-08 12:37:56",marked_as_done_time:"2020-08-08 08:08:38",last_notification_time:"2020-08-08 12:37:56",last_notification_user_id:7655,notification_language_id:1,subject:"Deadline",public_description:"This is a description",calendar_sync_include_context:"",location:"Mustam\xE4e tee 3, Tallinn, Estonia",org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",active_flag:!0,update_time:"2020-08-08 12:37:56",update_user_id:5596,gcal_event_id:"",google_calendar_id:"",google_calendar_etag:"",source_timezone:"",rec_rule:"RRULE:FREQ=WEEKLY;BYDAY=WE",rec_rule_extension:"",rec_master_activity_id:1,series:[],note:"A note for the activity",created_by_user_id:1234,location_subpremise:"",location_street_number:"3",location_route:"Mustam\xE4e tee",location_sublocality:"Kristiine",location_locality:"Tallinn",location_admin_area_level_1:"Harju maakond",location_admin_area_level_2:"",location_country:"Estonia",location_postal_code:"10616",location_formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia",attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary_flag:!1},{person_id:1101,primary_flag:!0}],org_name:"Organization",person_name:"Person",deal_title:"Deal",owner_name:"Creator",person_dropbox_bcc:"company@pipedrivemail.com",deal_dropbox_bcc:"company+deal300@pipedrivemail.com",assigned_to_user_id:1235,file:{id:"376892,",clean_name:"Audio 10:55:07.m4a",url:"https://pipedrive-files.s3-eu-west-1.amazonaws.com/Audio-recording.m4a"}}});var fc=ie({auth:E,name:"deal-matching-filter",displayName:"Deal Matching Filter",description:"Trigges when a deal newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a deal first becomes a member of a selected Pipedrive filter \u2014 that is, the deal newly satisfies the filter conditions. Polls the filter and emits each deal the first time it appears; does not re-fire for deals already in the filter."},type:"POLLING",props:{filterId:Be("deals",!0),status:g.StaticDropdown({displayName:"Status",required:!1,defaultValue:"all_not_deleted",options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"},{label:"All(Not Deleted)",value:"all_not_deleted"}]}})},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("deals",JSON.stringify(t))},async onDisable(e){await e.store.delete("deals")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:10,filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ie.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of t){let s=D(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("deals")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ie.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("deals",JSON.stringify([...a,...r]));let s=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=[];for(let d of i){let p=D(s,d);c.push(p)}return c},sampleData:{id:1,creator_user_id:22701301,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29 04:21:51",update_time:"2019-11-28 16:19:50",stage_change_time:"2019-11-28 15:41:22",active:!0,deleted:!1,status:"open",probability:null,next_activity_date:"2019-11-29",next_activity_time:"11:30:00",next_activity_id:128,last_activity_id:null,last_activity_date:null,lost_reason:null,visible_to:"1",close_time:null,pipeline_id:1,won_time:"2019-11-27 11:40:36",first_won_time:"2019-11-27 11:40:36",lost_time:"",products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29 18:21:42",last_outgoing_mail_time:"2019-05-30 03:45:35",label:11,stage_order_nr:2,person_name:"Person",org_name:"Organization",next_activity_subject:"Call",next_activity_type:"call",next_activity_duration:"00:30:00",next_activity_note:"Note content",formatted_value:"\u20AC5,000",weighted_value:5e3,formatted_weighted_value:"\u20AC5,000",weighted_value_currency:"EUR",rotten_time:null,owner_name:"Creator",cc_email:"company+deal1@pipedrivemail.com",org_hidden:!1,person_hidden:!1,average_time_to_won:{y:0,m:0,d:0,h:0,i:20,s:49,total_seconds:1249},average_stage_progress:4.99,age:{y:0,m:6,d:14,h:8,i:57,s:26,total_seconds:17139446},stay_in_pipeline_stages:{times_in_stages:{1:15721267,2:1288449,3:4368,4:3315,5:26460},order_of_stages:[1,2,3,4,5]},last_activity:null,next_activity:null}});var gc=ie({auth:E,name:"new-note",displayName:"New Note",description:"Triggers when a new note is created.",aiMetadata:{description:"Fires when a new note is created in Pipedrive. A note carries free-text content and may be linked to a deal, person, organization, or lead. Use to react whenever someone records a comment or annotation in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await se.subscribeWebhook("note","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_note_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_note_trigger");t!=null&&await se.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{limit:10,sort:"update_time DESC"}});return A(t.data)?[]:t.data},async run(e){let t=e.payload.body;return[(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${t.data.id}`})).data]},sampleData:{id:1,user_id:22701301,deal_id:null,person_id:1,org_id:1,lead_id:null,content:"Note content for v2 API.",add_time:"2024-12-04T06:48:26Z",update_time:"2024-12-04T06:48:26Z",is_deleted:!1}});var yc=O({auth:E,name:"find-deals-associated-with-person",displayName:"Find Deals Associated With Person",description:"Finds multiple deals related to a specific person.",audience:"both",aiMetadata:{description:"Lists all deals linked to a given person, identified by their numeric person ID, sorted by most recently updated. Use when you already have a person and need their associated deals; to look up a deal by a field value instead, use Find Deal. Read-only and idempotent.",idempotent:!0},props:{personId:De(!0)},async run(e){let{personId:t}=e.propsValue,r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{person_id:t,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}});if(A(r)||r.length===0)return{found:!1,data:[]};let n=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of r){let s=D(n,a);i.push(s)}return{found:!0,data:i}}});var hc=O({auth:E,name:"find-products",displayName:"Find Products",description:"Finds a product or products by name or product code.",audience:"both",aiMetadata:{description:"Searches products by exact match on either name or product code (selected via the Field dropdown) and returns all matches, paging through every result. Use to locate products before adding them to a deal or updating them. Read-only and idempotent.",idempotent:!0},props:{field:g.StaticDropdown({displayName:"Field to search by",required:!0,defaultValue:"name",options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Product Code",value:"code"}]}}),fieldValue:g.ShortText({displayName:"Field Value",required:!0})},async run(e){let t={term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true",limit:"100"},r,n=!0,i=[];do{r&&(t.cursor=r);let a=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true"}});if(A(a.data.items))break;for(let s of a.data.items)i.push(s.item);n=a.additional_data?.next_cursor!=null,r=a.additional_data?.next_cursor}while(n);return{found:i.length>0,data:i}}});var _c=O({auth:E,name:"get-product",displayName:"Retrieve a Product",description:"Finds a product by ID.",audience:"both",aiMetadata:{description:"Retrieve a single product by its exact numeric ID, returning full details and resolved custom fields. Pick this when you already know the product ID; use Find Product to search by name instead. Read-only and returns found:false rather than erroring when the ID does not exist.",idempotent:!0},props:{productId:g.Number({displayName:"Product ID",required:!0})},async run(e){try{let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${e.propsValue.productId}`}),r=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[D(r,t.data)]}}catch{return{found:!1,data:[]}}}});var vc=O({auth:E,name:"find-notes",displayName:"Find Notes",description:"Finds notes by Deal, Lead, Person, or Organization ID.",audience:"both",aiMetadata:{description:"Lists notes attached to a single parent record, chosen via the Search By dropdown (Deal, Lead, Person, or Organization) plus that record's ID, sorted newest-updated first. Use to retrieve the notes on a known object; to fetch one specific note by its own ID, use Retrieve a Note. Read-only and idempotent.",idempotent:!0},props:{objectType:g.StaticDropdown({displayName:"Search By",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal_id"},{label:"Lead",value:"lead_id"},{label:"Person",value:"person_id"},{label:"Organization",value:"org_id"}]}}),objectId:g.ShortText({displayName:"ID",required:!0})},async run(e){let t=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{sort:"update_time DESC",[e.propsValue.objectType]:e.propsValue.objectId}});return A(t)||t.length===0?{found:!1,data:[]}:{found:t.length>0,data:t}}});var bc=O({auth:E,name:"find-organization",displayName:"Find Organization",description:"Finds an organization.",audience:"both",aiMetadata:{description:"Finds a single organization by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate an organization before reading or updating it; pick the field via Search Field and supply its value. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ct("organization"),searchFieldValue:Ut("organization")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Organization Filter",type:"org",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"organization",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"organization",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return{found:!0,data:[D(a,i.data[0])]}}});var Pc=O({auth:E,name:"find-person",displayName:"Find Person",description:"Finds a person.",audience:"both",aiMetadata:{description:"Look up a single person by an exact value in a chosen field (e.g. email, phone, name, or a custom field). Pick this when you need to resolve a person record to its ID or details before acting on it. Effectively read-only (it creates and removes a temporary search filter) and returns the most recently updated match.",idempotent:!0},props:{searchField:Ct("person"),searchFieldValue:Ut("person")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Person Filter",type:"people",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"person",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"person",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return{found:!0,data:[D(a,i.data[0])]}}});var xc=O({auth:E,name:"find-deal",displayName:"Find Deal",description:"Finds a deal by any field.",audience:"both",aiMetadata:{description:"Finds a single deal by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate a deal before reading or updating it; pick the field via Search Field and supply its value. To list deals tied to a specific person, use Find Deals Associated With Person instead. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ct("deal"),searchFieldValue:Ut("deal")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Deal Filter",type:"deals",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"deal",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"deal",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return{found:!0,data:[D(a,i.data[0])]}}});var Tc=O({auth:E,name:"find-activity",displayName:"Find Activity",description:"Finds an activity by subject.",audience:"both",aiMetadata:{description:"Search activities by subject text, optionally narrowed by owner, type, done/not-done status, or a saved filter. Pick this to locate existing activities; matching is case-insensitive substring by default but can be made exact-match. Read-only and may return multiple matches.",idempotent:!0},props:{subject:g.ShortText({displayName:"Subject",required:!0}),exactMatch:g.Checkbox({displayName:"Exact Match",required:!1,defaultValue:!0}),assignTo:Oe("Assign To",!1),type:ui(!1),filterId:Be("activity",!1),status:g.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Done",value:1},{label:"Not Done",value:0}]}})},async run(e){let{subject:t,assignTo:r,type:n,filterId:i,status:a,exactMatch:s}=e.propsValue,c=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{owner_id:r,done:a!=null?a===1:void 0,sort_by:"update_time",sort_direction:"desc",filter_id:i}});if(A(c)||c.length===0)return{found:!1,data:[]};let d=[];for(let p of c){let _=!1;p.subject&&(s&&p.subject===t||!s&&p.subject.toLowerCase().includes(t.toLowerCase()))&&(_=!0),n?_&&p.type===n&&d.push(p):_&&d.push(p)}return{found:d.length>0,data:d}}});var Ic=O({auth:E,name:"update-product",displayName:"Update Product",description:"Updates an existing product.",audience:"both",aiMetadata:{description:"Updates fields on an existing product identified by its product ID, such as name, code, pricing, tax, owner, active state, and custom fields; only supplied fields change. Use to edit a product you have the ID for (use Find Products to locate it first). Idempotent: repeating the same update converges to the same product state.",idempotent:!0},props:{id:g.ShortText({displayName:"Product ID",required:!0}),name:g.ShortText({displayName:"Name",required:!1}),code:g.ShortText({displayName:"Code",required:!1}),description:g.LongText({displayName:"Description",required:!1}),unit:g.ShortText({displayName:"Unit",required:!1}),tax:g.Number({displayName:"Tax percentage",required:!1}),isActive:g.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Oe("Owner",!1),currency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:g.Number({displayName:"Price",required:!1}),cost:g.Number({displayName:"Cost",required:!1}),overheadCost:g.Number({displayName:"Overhead Cost",required:!1}),visibleTo:st,customfields:ut("product")},async run(e){let{id:t,name:r,code:n,description:i,unit:a,tax:s,isActive:c,ownerId:d,currency:p,price:_,cost:x,overheadCost:v,visibleTo:l}=e.propsValue,m=e.propsValue.customfields??{},h={name:r,code:n,description:i,unit:a,tax:s,is_deleted:!c,prices:[{price:_??0,currency:p??"USD",cost:x??0,direct_cost:v??0}],visible_to:l};d&&(h.owner_id=d);let f=await S({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),b=Te(f,m);ue(b)||(h.custom_fields=b);let I=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:"/v2/products/"+t,body:h}),k=D(f,I.data);return{...I,data:k}}});var Ec=O({auth:E,name:"find-lead",displayName:"Find Lead",description:"Finds leads by title.",audience:"both",aiMetadata:{description:"Searches leads by title text and returns all matches, paging through every result. By default it matches titles containing the term; enable Exact Match for full case-insensitive title equality only. Use to locate leads before reading or updating them. Read-only and idempotent.",idempotent:!0},props:{term:g.ShortText({displayName:"Title",description:"The title to search for.",required:!0}),exact_match:g.Checkbox({displayName:"Exact Match",description:"When enabled, only full exact matches against the given title are returned. It is not case sensitive.",required:!1})},async run(e){let{term:t,exact_match:r}=e.propsValue,n,i=!0,a=[];do{let s={term:t,fields:"title",limit:"100"};r&&(s.exact_match=!0),n&&(s.cursor=n);let c=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/leads/search",query:s});if(A(c.data?.items))break;for(let d of c.data.items)a.push(d.item);i=c.additional_data?.next_cursor!=null,n=c.additional_data?.next_cursor}while(i);return{found:a.length>0,data:a}}});var uf=ga({displayName:"Pipedrive",description:"Sales CRM and pipeline management software",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/pipedrive.png",categories:["SALES_AND_CRM"],auth:E,actions:[ac,uc,sc,Qu,Xu,oc,tc,nc,Wu,Ju,Gu,Hu,Vu,Bu,Lu,ju,Yu,Ic,yc,lc,hc,vc,_c,bc,Pc,xc,Tc,cc,Ec,Su({baseUrl:o(()=>"https://api.pipedrive.com/api/v2","baseUrl"),auth:E,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],authors:["ashrafsamhouri","kishanprmr","MoShizzle","khaledmashaly","abuaboud","leocottaz","Anmol-Gup"],triggers:[ku,zu,wu,gc,Ru,Du,Mu,Nu,Cu,Uu,mc,fc,pc,dc]});0&&(module.exports={pipedrive});
|
|
1
|
+
"use strict";var Fc=Object.create;var jt=Object.defineProperty;var jc=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Bc=Object.getPrototypeOf,Zc=Object.prototype.hasOwnProperty;var o=(e,t)=>jt(e,"name",{value:t,configurable:!0});var U=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},mi=(e,t)=>{for(var r in t)jt(e,r,{get:t[r],enumerable:!0})},fi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vc(t))!Zc.call(e,i)&&i!==r&&jt(e,i,{get:()=>t[i],enumerable:!(n=jc(t,i))||n.enumerable});return e};var Se=(e,t,r)=>(r=e!=null?Fc(Bc(e)):{},fi(t||!e||!e.__esModule?jt(r,"default",{value:e,enumerable:!0}):r,e)),Gc=e=>fi(jt({},"__esModule",{value:!0}),e);var Mo=U((Uo,Dr)=>{(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")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(l,m){if(l.indexOf("::")!==l.lastIndexOf("::"))return null;let h=0,f=-1,v=(l.match(c.zoneIndex)||[])[0],I,O;for(v&&(v=v.substring(1),l=l.replace(/%.+$/,""));(f=l.indexOf(":",f+1))>=0;)h++;if(l.substr(0,2)==="::"&&h--,l.substr(-2,2)==="::"&&h--,h>m)return null;for(O=m-h,I=":";O--;)I+="0:";return l=l.replace("::",I),l[0]===":"&&(l=l.slice(1)),l[l.length-1]===":"&&(l=l.slice(0,-1)),m=(function(){let te=l.split(":"),ve=[];for(let Fe=0;Fe<te.length;Fe++)ve.push(parseInt(te[Fe],16));return ve})(),{parts:m,zoneId:v}}o(d,"expandIPv6");function p(l,m,h,f){if(l.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let v=0,I;for(;f>0;){if(I=h-f,I<0&&(I=0),l[v]>>I!==m[v]>>I)return!1;f-=h,v+=1}return!0}o(p,"matchCIDR");function _(l){if(i.test(l))return parseInt(l,16);if(l[0]==="0"&&!isNaN(parseInt(l[1],10))){if(n.test(l))return parseInt(l,8);throw new Error(`ipaddr: cannot parse ${l} as octal`)}return parseInt(l,10)}o(_,"parseIntAuto");function x(l,m){for(;l.length<m;)l=`0${l}`;return l}o(x,"padPart");let b={};b.IPv4=(function(){function l(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let h,f;for(h=0;h<m.length;h++)if(f=m[h],!(0<=f&&f<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return o(l,"IPv4"),l.prototype.SpecialRanges={unspecified:[[new l([0,0,0,0]),8]],broadcast:[[new l([255,255,255,255]),32]],multicast:[[new l([224,0,0,0]),4]],linkLocal:[[new l([169,254,0,0]),16]],loopback:[[new l([127,0,0,0]),8]],carrierGradeNat:[[new l([100,64,0,0]),10]],private:[[new l([10,0,0,0]),8],[new l([172,16,0,0]),12],[new l([192,168,0,0]),16]],reserved:[[new l([192,0,0,0]),24],[new l([192,0,2,0]),24],[new l([192,88,99,0]),24],[new l([198,18,0,0]),15],[new l([198,51,100,0]),24],[new l([203,0,113,0]),24],[new l([240,0,0,0]),4]],as112:[[new l([192,175,48,0]),24],[new l([192,31,196,0]),24]],amt:[[new l([192,52,193,0]),24]]},l.prototype.kind=function(){return"ipv4"},l.prototype.match=function(m,h){let f;if(h===void 0&&(f=m,m=f[0],h=f[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return p(this.octets,m.octets,8,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,f={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},v,I,O;for(v=3;v>=0;v-=1)if(I=this.octets[v],I in f){if(O=f[I],h&&O!==0)return null;O!==8&&(h=!0),m+=O}else return null;return 32-m},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){return this.octets.slice(0)},l.prototype.toIPv4MappedAddress=function(){return b.IPv6.parse(`::ffff:${this.toString()}`)},l.prototype.toNormalizedString=function(){return this.toString()},l.prototype.toString=function(){return this.octets.join(".")},l})(),b.IPv4.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),f=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),v=[],I=0;for(;I<4;)v.push(parseInt(h[I],10)|parseInt(f[I],10)^255),I++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.isIPv4=function(l){return this.parser(l)!==null},b.IPv4.isValid=function(l){try{return new this(this.parser(l)),!0}catch{return!1}},b.IPv4.isValidCIDR=function(l){try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv4.isValidFourPartDecimal=function(l){return!!(b.IPv4.isValid(l)&&l.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},b.IPv4.isValidCIDRFourPartDecimal=function(l){let m=l.match(/^(.+)\/(\d+)$/);return!b.IPv4.isValidCIDR(l)||!m?!1:b.IPv4.isValidFourPartDecimal(m[1])},b.IPv4.networkAddressFromCIDR=function(l){let m,h,f,v,I;try{for(m=this.parseCIDR(l),f=m[0].toByteArray(),I=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),v=[],h=0;h<4;)v.push(parseInt(f[h],10)&parseInt(I[h],10)),h++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.parse=function(l){let m=this.parser(l);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},b.IPv4.parseCIDR=function(l){let m;if(m=l.match(/^(.+)\/(\d+)$/)){let h=parseInt(m[2]);if(h>=0&&h<=32){let f=[this.parse(m[1]),h];return Object.defineProperty(f,"toString",{value:o(function(){return this.join("/")},"value")}),f}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(l){let m,h,f;if(m=l.match(r.fourOctet))return(function(){let v=m.slice(1,6),I=[];for(let O=0;O<v.length;O++)h=v[O],I.push(_(h));return I})();if(m=l.match(r.longValue)){if(f=_(m[1]),f>4294967295||f<0)throw new Error("ipaddr: address outside defined range");return(function(){let v=[],I;for(I=0;I<=24;I+=8)v.push(f>>I&255);return v})().reverse()}else return(m=l.match(r.twoOctet))?(function(){let v=m.slice(1,4),I=[];if(f=_(v[1]),f>16777215||f<0)throw new Error("ipaddr: address outside defined range");return I.push(_(v[0])),I.push(f>>16&255),I.push(f>>8&255),I.push(f&255),I})():(m=l.match(r.threeOctet))?(function(){let v=m.slice(1,5),I=[];if(f=_(v[2]),f>65535||f<0)throw new Error("ipaddr: address outside defined range");return I.push(_(v[0])),I.push(_(v[1])),I.push(f>>8&255),I.push(f&255),I})():null},b.IPv4.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>32)throw new Error("ipaddr: invalid IPv4 prefix length");let m=[0,0,0,0],h=0,f=Math.floor(l/8);for(;h<f;)m[h]=255,h++;return f<4&&(m[f]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},b.IPv6=(function(){function l(m,h){let f,v;if(m.length===16)for(this.parts=[],f=0;f<=14;f+=2)this.parts.push(m[f]<<8|m[f+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(f=0;f<this.parts.length;f++)if(v=this.parts[f],!(0<=v&&v<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return o(l,"IPv6"),l.prototype.SpecialRanges={unspecified:[new l([0,0,0,0,0,0,0,0]),128],linkLocal:[new l([65152,0,0,0,0,0,0,0]),10],multicast:[new l([65280,0,0,0,0,0,0,0]),8],loopback:[new l([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new l([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new l([0,0,0,0,0,65535,0,0]),96],discard:[new l([256,0,0,0,0,0,0,0]),64],rfc6145:[new l([0,0,0,0,65535,0,0,0]),96],rfc6052:[new l([100,65435,0,0,0,0,0,0]),96],"6to4":[new l([8194,0,0,0,0,0,0,0]),16],teredo:[new l([8193,0,0,0,0,0,0,0]),32],benchmarking:[new l([8193,2,0,0,0,0,0,0]),48],amt:[new l([8193,3,0,0,0,0,0,0]),32],as112v6:[[new l([8193,4,274,0,0,0,0,0]),48],[new l([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new l([8193,16,0,0,0,0,0,0]),28],orchid2:[new l([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new l([8193,48,0,0,0,0,0,0]),28],reserved:[[new l([8193,0,0,0,0,0,0,0]),23],[new l([8193,3512,0,0,0,0,0,0]),32]]},l.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},l.prototype.kind=function(){return"ipv6"},l.prototype.match=function(m,h){let f;if(h===void 0&&(f=m,m=f[0],h=f[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return p(this.parts,m.parts,16,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,f={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},v,I;for(let O=7;O>=0;O-=1)if(v=this.parts[O],v in f){if(I=f[v],h&&I!==0)return null;I!==16&&(h=!0),m+=I}else return null;return 128-m},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){let m,h=[],f=this.parts;for(let v=0;v<f.length;v++)m=f[v],h.push(m>>8),h.push(m&255);return h},l.prototype.toFixedLengthString=function(){let m=(function(){let f=[];for(let v=0;v<this.parts.length;v++)f.push(x(this.parts[v].toString(16),4));return f}).call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let m=this.parts.slice(-2),h=m[0],f=m[1];return new b.IPv4([h>>8,h&255,f>>8,f&255])},l.prototype.toNormalizedString=function(){let m=(function(){let f=[];for(let v=0;v<this.parts.length;v++)f.push(this.parts[v].toString(16));return f}).call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toRFC5952String=function(){let m=/((^|:)(0(:|$)){2,})/g,h=this.toNormalizedString(),f=0,v=-1,I;for(;I=m.exec(h);)I[0].length>v&&(f=I.index,v=I[0].length);return v<0?h:`${h.substring(0,f)}::${h.substring(f+v)}`},l.prototype.toString=function(){return this.toRFC5952String()},l})(),b.IPv6.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),f=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),v=[],I=0;for(;I<16;)v.push(parseInt(h[I],10)|parseInt(f[I],10)^255),I++;return new this(v)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},b.IPv6.isIPv6=function(l){return this.parser(l)!==null},b.IPv6.isValid=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{let m=this.parser(l);return new this(m.parts,m.zoneId),!0}catch{return!1}},b.IPv6.isValidCIDR=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv6.networkAddressFromCIDR=function(l){let m,h,f,v,I;try{for(m=this.parseCIDR(l),f=m[0].toByteArray(),I=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),v=[],h=0;h<16;)v.push(parseInt(f[h],10)&parseInt(I[h],10)),h++;return new this(v)}catch(O){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${O})`)}},b.IPv6.parse=function(l){let m=this.parser(l);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},b.IPv6.parseCIDR=function(l){let m,h,f;if((h=l.match(/^(.+)\/(\d+)$/))&&(m=parseInt(h[2]),m>=0&&m<=128))return f=[this.parse(h[1]),m],Object.defineProperty(f,"toString",{value:o(function(){return this.join("/")},"value")}),f;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(l){let m,h,f,v,I,O;if(f=l.match(c.deprecatedTransitional))return this.parser(`::ffff:${f[1]}`);if(c.native.test(l))return d(l,8);if((f=l.match(c.transitional))&&(O=f[6]||"",m=f[1],f[1].endsWith("::")||(m=m.slice(0,-1)),m=d(m+O,6),m.parts)){for(I=[parseInt(f[2]),parseInt(f[3]),parseInt(f[4]),parseInt(f[5])],h=0;h<I.length;h++)if(v=I[h],!(0<=v&&v<=255))return null;return m.parts.push(I[0]<<8|I[1]),m.parts.push(I[2]<<8|I[3]),{parts:m.parts,zoneId:m.zoneId}}return null},b.IPv6.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>128)throw new Error("ipaddr: invalid IPv6 prefix length");let m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,f=Math.floor(l/8);for(;h<f;)m[h]=255,h++;return f<16&&(m[f]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},b.fromByteArray=function(l){let m=l.length;if(m===4)return new b.IPv4(l);if(m===16)return new b.IPv6(l);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},b.isValid=function(l){return b.IPv6.isValid(l)||b.IPv4.isValid(l)},b.isValidCIDR=function(l){return b.IPv6.isValidCIDR(l)||b.IPv4.isValidCIDR(l)},b.parse=function(l){if(b.IPv6.isValid(l))return b.IPv6.parse(l);if(b.IPv4.isValid(l))return b.IPv4.parse(l);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},b.parseCIDR=function(l){try{return b.IPv6.parseCIDR(l)}catch{try{return b.IPv4.parseCIDR(l)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},b.process=function(l){let m=this.parse(l);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},b.subnetMatch=function(l,m,h){let f,v,I,O;h==null&&(h="unicast");for(v in m)if(Object.prototype.hasOwnProperty.call(m,v)){for(I=m[v],I[0]&&!(I[0]instanceof Array)&&(I=[I]),f=0;f<I.length;f++)if(O=I[f],l.kind()===O[0].kind()&&l.match.apply(l,O))return v}return h},typeof Dr<"u"&&Dr.exports?Dr.exports=b:e.ipaddr=b})(Uo)});var La=U((lz,Ma)=>{var Ua=require("stream").Stream,Sp=require("util");Ma.exports=Ue;function Ue(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(Ue,"DelayedStream");Sp.inherits(Ue,Ua);Ue.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var i=e.emit;return e.emit=function(){return r._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Ue.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});Ue.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Ue.prototype.resume=function(){this._released||this.release(),this.source.resume()};Ue.prototype.pause=function(){this.source.pause()};Ue.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Ue.prototype.pipe=function(){var e=Ua.prototype.pipe.apply(this,arguments);return this.resume(),e};Ue.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};Ue.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var Ba=U((pz,Va)=>{var $p=require("util"),ja=require("stream").Stream,Fa=La();Va.exports=me;function me(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(me,"CombinedStream");$p.inherits(me,ja);me.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};me.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};me.prototype.append=function(e){var t=me.isStreamLike(e);if(t){if(!(e instanceof Fa)){var r=Fa.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=r}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};me.prototype.pipe=function(e,t){return ja.prototype.pipe.call(this,e,t),this.resume(),e};me.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};me.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var t=e;t(function(r){var n=me.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};me.prototype._pipeNext=function(e){this._currentStream=e;var t=me.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var r=e;this.write(r),this._getNext()};me.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};me.prototype.write=function(e){this.emit("data",e)};me.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};me.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};me.prototype.end=function(){this._reset(),this.emit("end")};me.prototype.destroy=function(){this._reset(),this.emit("close")};me.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};me.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};me.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(t){t.dataSize&&(e.dataSize+=t.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};me.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var Ga=U((fz,Za)=>{"use strict";Za.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var Wa=U(we=>{"use strict";var Mr=Ga(),wp=require("path").extname,Ha=/^\s*([^;\s]*)(?:;|\s|$)/,zp=/^text\//i;we.charset=qa;we.charsets={lookup:qa};we.contentType=kp;we.extension=Op;we.extensions=Object.create(null);we.lookup=Dp;we.types=Object.create(null);Rp(we.extensions,we.types);function qa(e){if(!e||typeof e!="string")return!1;var t=Ha.exec(e),r=t&&Mr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&zp.test(t[1])?"UTF-8":!1}o(qa,"charset");function kp(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?we.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=we.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(kp,"contentType");function Op(e){if(!e||typeof e!="string")return!1;var t=Ha.exec(e),r=t&&we.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(Op,"extension");function Dp(e){if(!e||typeof e!="string")return!1;var t=wp("x."+e).toLowerCase().substr(1);return t&&we.types[t]||!1}o(Dp,"lookup");function Rp(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Mr).forEach(o(function(i){var a=Mr[i],s=a.extensions;if(!(!s||!s.length)){e[i]=s;for(var c=0;c<s.length;c++){var d=s[c];if(t[d]){var p=r.indexOf(Mr[t[d]].source),_=r.indexOf(a.source);if(t[d]!=="application/octet-stream"&&(p>_||p===_&&t[d].substr(0,12)==="application/"))continue}t[d]=i}}},"forEachMimeType"))}o(Rp,"populateMaps")});var Ja=U((hz,Ka)=>{Ka.exports=Np;function Np(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(Np,"defer")});var Ln=U((vz,Xa)=>{var Ya=Ja();Xa.exports=Cp;function Cp(e){var t=!1;return Ya(function(){t=!0}),o(function(n,i){t?e(n,i):Ya(o(function(){e(n,i)},"nextTick_callback"))},"async_callback")}o(Cp,"async")});var Fn=U((Pz,Qa)=>{Qa.exports=Up;function Up(e){Object.keys(e.jobs).forEach(Mp.bind(e)),e.jobs={}}o(Up,"abort");function Mp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(Mp,"clean")});var jn=U((Tz,ts)=>{var es=Ln(),Lp=Fn();ts.exports=Fp;function Fp(e,t,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=jp(t,i,e[i],function(a,s){i in r.jobs&&(delete r.jobs[i],a?Lp(r):r.results[i]=s,n(a,r.results))})}o(Fp,"iterate");function jp(e,t,r,n){var i;return e.length==2?i=e(r,es(n)):i=e(r,t,es(n)),i}o(jp,"runJob")});var Vn=U((Ez,rs)=>{rs.exports=Vp;function Vp(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(i,a){return t(e[i],e[a])}),n}o(Vp,"state")});var Bn=U((Sz,ns)=>{var Bp=Fn(),Zp=Ln();ns.exports=Gp;function Gp(e){Object.keys(this.jobs).length&&(this.index=this.size,Bp(this),Zp(e)(null,this.results))}o(Gp,"terminator")});var os=U((wz,is)=>{var Hp=jn(),qp=Vn(),Wp=Bn();is.exports=Kp;function Kp(e,t,r){for(var n=qp(e);n.index<(n.keyedList||e).length;)Hp(e,t,n,function(i,a){if(i){r(i,a);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return Wp.bind(n,r)}o(Kp,"parallel")});var Zn=U((kz,Lr)=>{var as=jn(),Jp=Vn(),Yp=Bn();Lr.exports=Xp;Lr.exports.ascending=ss;Lr.exports.descending=Qp;function Xp(e,t,r,n){var i=Jp(e,r);return as(e,t,i,o(function a(s,c){if(s){n(s,c);return}if(i.index++,i.index<(i.keyedList||e).length){as(e,t,i,a);return}n(null,i.results)},"iteratorHandler")),Yp.bind(i,n)}o(Xp,"serialOrdered");function ss(e,t){return e<t?-1:e>t?1:0}o(ss,"ascending");function Qp(e,t){return-1*ss(e,t)}o(Qp,"descending")});var cs=U((Dz,us)=>{var em=Zn();us.exports=tm;function tm(e,t,r){return em(e,t,null,r)}o(tm,"serial")});var ds=U((Nz,ls)=>{ls.exports={parallel:os(),serial:cs(),serialOrdered:Zn()}});var Gn=U((Cz,ps)=>{"use strict";ps.exports=Object});var fs=U((Uz,ms)=>{"use strict";ms.exports=Error});var ys=U((Mz,gs)=>{"use strict";gs.exports=EvalError});var _s=U((Lz,hs)=>{"use strict";hs.exports=RangeError});var bs=U((Fz,vs)=>{"use strict";vs.exports=ReferenceError});var xs=U((jz,Ps)=>{"use strict";Ps.exports=SyntaxError});var Fr=U((Vz,Ts)=>{"use strict";Ts.exports=TypeError});var Es=U((Bz,Is)=>{"use strict";Is.exports=URIError});var Ss=U((Zz,As)=>{"use strict";As.exports=Math.abs});var ws=U((Gz,$s)=>{"use strict";$s.exports=Math.floor});var ks=U((Hz,zs)=>{"use strict";zs.exports=Math.max});var Ds=U((qz,Os)=>{"use strict";Os.exports=Math.min});var Ns=U((Wz,Rs)=>{"use strict";Rs.exports=Math.pow});var Us=U((Kz,Cs)=>{"use strict";Cs.exports=Math.round});var Ls=U((Jz,Ms)=>{"use strict";Ms.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var js=U((Xz,Fs)=>{"use strict";var rm=Ls();Fs.exports=o(function(t){return rm(t)||t===0?t:t<0?-1:1},"sign")});var Bs=U((ek,Vs)=>{"use strict";Vs.exports=Object.getOwnPropertyDescriptor});var Hn=U((tk,Zs)=>{"use strict";var jr=Bs();if(jr)try{jr([],"length")}catch{jr=null}Zs.exports=jr});var Hs=U((rk,Gs)=>{"use strict";var Vr=Object.defineProperty||!1;if(Vr)try{Vr({},"a",{value:1})}catch{Vr=!1}Gs.exports=Vr});var qn=U((nk,qs)=>{"use strict";qs.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var a in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,r);if(c.value!==i||c.enumerable!==!0)return!1}return!0},"hasSymbols")});var Js=U((ok,Ks)=>{"use strict";var Ws=typeof Symbol<"u"&&Symbol,nm=qn();Ks.exports=o(function(){return typeof Ws!="function"||typeof Symbol!="function"||typeof Ws("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:nm()},"hasNativeSymbols")});var Wn=U((sk,Ys)=>{"use strict";Ys.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Kn=U((uk,Xs)=>{"use strict";var im=Gn();Xs.exports=im.getPrototypeOf||null});var tu=U((ck,eu)=>{"use strict";var om="Function.prototype.bind called on incompatible ",am=Object.prototype.toString,sm=Math.max,um="[object Function]",Qs=o(function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var a=0;a<r.length;a+=1)n[a+t.length]=r[a];return n},"concatty"),cm=o(function(t,r){for(var n=[],i=r||0,a=0;i<t.length;i+=1,a+=1)n[a]=t[i];return n},"slicy"),lm=o(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");eu.exports=o(function(t){var r=this;if(typeof r!="function"||am.apply(r)!==um)throw new TypeError(om+r);for(var n=cm(arguments,1),i,a=o(function(){if(this instanceof i){var _=r.apply(this,Qs(n,arguments));return Object(_)===_?_:this}return r.apply(t,Qs(n,arguments))},"binder"),s=sm(0,r.length-n.length),c=[],d=0;d<s;d++)c[d]="$"+d;if(i=Function("binder","return function ("+lm(c,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var p=o(function(){},"Empty");p.prototype=r.prototype,i.prototype=new p,p.prototype=null}return i},"bind")});var Ot=U((dk,ru)=>{"use strict";var dm=tu();ru.exports=Function.prototype.bind||dm});var Br=U((pk,nu)=>{"use strict";nu.exports=Function.prototype.call});var Jn=U((mk,iu)=>{"use strict";iu.exports=Function.prototype.apply});var au=U((fk,ou)=>{"use strict";ou.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var uu=U((gk,su)=>{"use strict";var pm=Ot(),mm=Jn(),fm=Br(),gm=au();su.exports=gm||pm.call(fm,mm)});var lu=U((yk,cu)=>{"use strict";var ym=Ot(),hm=Fr(),_m=Br(),vm=uu();cu.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new hm("a function is required");return vm(ym,_m,t)},"callBindBasic")});var yu=U((_k,gu)=>{"use strict";var bm=lu(),du=Hn(),mu;try{mu=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Yn=!!mu&&du&&du(Object.prototype,"__proto__"),fu=Object,pu=fu.getPrototypeOf;gu.exports=Yn&&typeof Yn.get=="function"?bm([Yn.get]):typeof pu=="function"?o(function(t){return pu(t==null?t:fu(t))},"getDunder"):!1});var Pu=U((bk,bu)=>{"use strict";var hu=Wn(),_u=Kn(),vu=yu();bu.exports=hu?o(function(t){return hu(t)},"getProto"):_u?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return _u(t)},"getProto"):vu?o(function(t){return vu(t)},"getProto"):null});var Xn=U((xk,xu)=>{"use strict";var Pm=Function.prototype.call,xm=Object.prototype.hasOwnProperty,Tm=Ot();xu.exports=Tm.call(Pm,xm)});var wu=U((Tk,$u)=>{"use strict";var Q,Im=Gn(),Em=fs(),Am=ys(),Sm=_s(),$m=bs(),Ct=xs(),Nt=Fr(),wm=Es(),zm=Ss(),km=ws(),Om=ks(),Dm=Ds(),Rm=Ns(),Nm=Us(),Cm=js(),Au=Function,Qn=o(function(e){try{return Au('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),sr=Hn(),Um=Hs(),ei=o(function(){throw new Nt},"throwTypeError"),Mm=sr?(function(){try{return arguments.callee,ei}catch{try{return sr(arguments,"callee").get}catch{return ei}}})():ei,Dt=Js()(),Pe=Pu(),Lm=Kn(),Fm=Wn(),Su=Jn(),ur=Br(),Rt={},jm=typeof Uint8Array>"u"||!Pe?Q:Pe(Uint8Array),bt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":Dt&&Pe?Pe([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Rt,"%AsyncGenerator%":Rt,"%AsyncGeneratorFunction%":Rt,"%AsyncIteratorPrototype%":Rt,"%Atomics%":typeof Atomics>"u"?Q:Atomics,"%BigInt%":typeof BigInt>"u"?Q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Em,"%eval%":eval,"%EvalError%":Am,"%Float16Array%":typeof Float16Array>"u"?Q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Q:FinalizationRegistry,"%Function%":Au,"%GeneratorFunction%":Rt,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Dt&&Pe?Pe(Pe([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Dt||!Pe?Q:Pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Im,"%Object.getOwnPropertyDescriptor%":sr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":Sm,"%ReferenceError%":$m,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Dt||!Pe?Q:Pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Dt&&Pe?Pe(""[Symbol.iterator]()):Q,"%Symbol%":Dt?Symbol:Q,"%SyntaxError%":Ct,"%ThrowTypeError%":Mm,"%TypedArray%":jm,"%TypeError%":Nt,"%Uint8Array%":typeof Uint8Array>"u"?Q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Q:Uint32Array,"%URIError%":wm,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":ur,"%Function.prototype.apply%":Su,"%Object.defineProperty%":Um,"%Object.getPrototypeOf%":Lm,"%Math.abs%":zm,"%Math.floor%":km,"%Math.max%":Om,"%Math.min%":Dm,"%Math.pow%":Rm,"%Math.round%":Nm,"%Math.sign%":Cm,"%Reflect.getPrototypeOf%":Fm};if(Pe)try{null.error}catch(e){Tu=Pe(Pe(e)),bt["%Error.prototype%"]=Tu}var Tu,Vm=o(function e(t){var r;if(t==="%AsyncFunction%")r=Qn("async function () {}");else if(t==="%GeneratorFunction%")r=Qn("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Qn("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Pe&&(r=Pe(i.prototype))}return bt[t]=r,r},"doEval"),Iu={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},cr=Ot(),Zr=Xn(),Bm=cr.call(ur,Array.prototype.concat),Zm=cr.call(Su,Array.prototype.splice),Eu=cr.call(ur,String.prototype.replace),Gr=cr.call(ur,String.prototype.slice),Gm=cr.call(ur,RegExp.prototype.exec),Hm=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qm=/\\(\\)?/g,Wm=o(function(t){var r=Gr(t,0,1),n=Gr(t,-1);if(r==="%"&&n!=="%")throw new Ct("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ct("invalid intrinsic syntax, expected opening `%`");var i=[];return Eu(t,Hm,function(a,s,c,d){i[i.length]=c?Eu(d,qm,"$1"):s||a}),i},"stringToPath"),Km=o(function(t,r){var n=t,i;if(Zr(Iu,n)&&(i=Iu[n],n="%"+i[0]+"%"),Zr(bt,n)){var a=bt[n];if(a===Rt&&(a=Vm(n)),typeof a>"u"&&!r)throw new Nt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Ct("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");$u.exports=o(function(t,r){if(typeof t!="string"||t.length===0)throw new Nt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Nt('"allowMissing" argument must be a boolean');if(Gm(/^%?[^%]*%?$/,t)===null)throw new Ct("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Wm(t),i=n.length>0?n[0]:"",a=Km("%"+i+"%",r),s=a.name,c=a.value,d=!1,p=a.alias;p&&(i=p[0],Zm(n,Bm([0,1],p)));for(var _=1,x=!0;_<n.length;_+=1){var b=n[_],l=Gr(b,0,1),m=Gr(b,-1);if((l==='"'||l==="'"||l==="`"||m==='"'||m==="'"||m==="`")&&l!==m)throw new Ct("property names with quotes must have matching quotes");if((b==="constructor"||!x)&&(d=!0),i+="."+b,s="%"+i+"%",Zr(bt,s))c=bt[s];else if(c!=null){if(!(b in c)){if(!r)throw new Nt("base intrinsic for "+t+" exists, but the property is not available.");return}if(sr&&_+1>=n.length){var h=sr(c,b);x=!!h,x&&"get"in h&&!("originalValue"in h.get)?c=h.get:c=c[b]}else x=Zr(c,b),c=c[b];x&&!d&&(bt[s]=c)}}return c},"GetIntrinsic")});var ku=U((Ek,zu)=>{"use strict";var Jm=qn();zu.exports=o(function(){return Jm()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Ru=U((Sk,Du)=>{"use strict";var Ym=wu(),Ou=Ym("%Object.defineProperty%",!0),Xm=ku()(),Qm=Xn(),ef=Fr(),Hr=Xm?Symbol.toStringTag:null;Du.exports=o(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new ef("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Hr&&(n||!Qm(t,Hr))&&(Ou?Ou(t,Hr,{configurable:!i,enumerable:!1,value:r,writable:!1}):t[Hr]=r)},"setToStringTag")});var Cu=U((wk,Nu)=>{"use strict";var tf=Function.prototype.call,rf=Object.prototype.hasOwnProperty,nf=Ot();Nu.exports=nf.call(tf,rf)});var Mu=U((zk,Uu)=>{"use strict";Uu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var oi=U((kk,Fu)=>{"use strict";var ii=Ba(),of=require("util"),ti=require("path"),af=require("http"),sf=require("https"),uf=require("url").parse,cf=require("fs"),lf=require("stream").Stream,df=require("crypto"),ri=Wa(),pf=ds(),mf=Ru(),ut=Cu(),ni=Mu();function Lu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(Lu,"escapeHeaderParam");function ee(e){if(!(this instanceof ee))return new ee(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],ii.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(ee,"FormData");of.inherits(ee,ii);ee.LINE_BREAK=`\r
|
|
2
|
+
`;ee.DEFAULT_CONTENT_TYPE="application/octet-stream";ee.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=ii.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,t,r),a=this._multiPartFooter();n(i),n(t),n(a),this._trackLength(i,t,r)};ee.prototype._trackLength=function(e,t,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(t)?n=t.length:typeof t=="string"&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+ee.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&ut(t,"httpVersion"))&&!(t instanceof lf))&&(r.knownLength||this._valuesToMeasure.push(t))};ee.prototype._lengthRetriever=function(e,t){ut(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):cf.stat(e.path,function(r,n){if(r){t(r);return}var i=n.size-(e.start?e.start:0);t(null,i)}):ut(e,"httpVersion")?t(null,Number(e.headers["content-length"])):ut(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};ee.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),i=this._getContentType(t,r),a="",s={"Content-Disposition":["form-data",'name="'+Lu(e)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&ni(s,r.header);var c;for(var d in s)if(ut(s,d)){if(c=s[d],c==null)continue;Array.isArray(c)||(c=[c]),c.length&&(a+=d+": "+c.join("; ")+ee.LINE_BREAK)}return"--"+this.getBoundary()+ee.LINE_BREAK+a+ee.LINE_BREAK};ee.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=ti.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=ti.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&ut(e,"httpVersion")&&(r=ti.basename(e.client._httpMessage.path||"")),r)return'filename="'+Lu(r)+'"'};ee.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=ri.lookup(e.name)),!r&&e&&e.path&&(r=ri.lookup(e.path)),!r&&e&&e.readable&&ut(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=ri.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=ee.DEFAULT_CONTENT_TYPE),r};ee.prototype._multiPartFooter=function(){return function(e){var t=ee.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};ee.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+ee.LINE_BREAK};ee.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)ut(e,t)&&(r[t.toLowerCase()]=e[t]);return r};ee.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};ee.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};ee.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?e=Buffer.concat([e,this._streams[r]]):e=Buffer.concat([e,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,t.length+2)!==t)&&(e=Buffer.concat([e,Buffer.from(ee.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};ee.prototype._generateBoundary=function(){this._boundary="--------------------------"+df.randomBytes(12).toString("hex")};ee.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};ee.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};ee.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length&&(t+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}pf.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(i){t+=i}),e(null,t)})};ee.prototype.submit=function(e,t){var r,n,i={method:"post"};return typeof e=="string"?(e=uf(e),n=ni({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(n=ni(e,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=sf.request(n):r=af.request(n),this.getLength(function(a,s){if(a&&a!=="Unknown stream"){this._error(a);return}if(s&&r.setHeader("Content-Length",s),this.pipe(r),t){var c,d=o(function(p,_){return r.removeListener("error",d),r.removeListener("response",c),t.call(this,p,_)},"callback");c=d.bind(this,null),r.on("error",d),r.on("response",c)}}.bind(this)),r};ee.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};ee.prototype.toString=function(){return"[object FormData]"};mf(ee.prototype,"FormData");Fu.exports=ee});var ct=U((ai,si)=>{(function(e,t){typeof ai=="object"&&typeof si<"u"?si.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(ai,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",c="day",d="week",p="month",_="quarter",x="year",b="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(G){var w=["th","st","nd","rd"],S=G%100;return"["+G+(w[(S-20)%10]||w[S]||w[0])+"]"},"ordinal")},v=o(function(G,w,S){var N=String(G);return!N||N.length>=w?G:""+Array(w+1-N.length).join(S)+G},"m"),I={s:v,z:o(function(G){var w=-G.utcOffset(),S=Math.abs(w),N=Math.floor(S/60),z=S%60;return(w<=0?"+":"-")+v(N,2,"0")+":"+v(z,2,"0")},"z"),m:o(function G(w,S){if(w.date()<S.date())return-G(S,w);var N=12*(S.year()-w.year())+(S.month()-w.month()),z=w.clone().add(N,p),W=S-z<0,K=w.clone().add(N+(W?-1:1),p);return+(-(N+(S-z)/(W?z-K:K-z))||0)},"t"),a:o(function(G){return G<0?Math.ceil(G)||0:Math.floor(G)},"a"),p:o(function(G){return{M:p,y:x,w:d,d:c,D:b,h:s,m:a,s:i,ms:n,Q:_}[G]||String(G||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(G){return G===void 0},"u")},O="en",te={};te[O]=f;var ve=o(function(G){return G instanceof xt},"p"),Fe=o(function G(w,S,N){var z;if(!w)return O;if(typeof w=="string"){var W=w.toLowerCase();te[W]&&(z=W),S&&(te[W]=S,z=W);var K=w.split("-");if(!z&&K.length>1)return G(K[0])}else{var ae=w.name;te[ae]=w,z=ae}return!N&&z&&(O=z),z||!N&&O},"t"),oe=o(function(G,w){if(ve(G))return G.clone();var S=typeof w=="object"?w:{};return S.date=G,S.args=arguments,new xt(S)},"w"),Y=I;Y.l=Fe,Y.i=ve,Y.w=function(G,w){return oe(G,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var xt=(function(){function G(S){this.$L=Fe(S.locale,null,!0),this.parse(S)}o(G,"M");var w=G.prototype;return w.parse=function(S){this.$d=(function(N){var z=N.date,W=N.utc;if(z===null)return new Date(NaN);if(Y.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var K=z.match(m);if(K){var ae=K[2]-1||0,fe=(K[7]||"0").substring(0,3);return W?new Date(Date.UTC(K[1],ae,K[3]||1,K[4]||0,K[5]||0,K[6]||0,fe)):new Date(K[1],ae,K[3]||1,K[4]||0,K[5]||0,K[6]||0,fe)}}return new Date(z)})(S),this.$x=S.x||{},this.init()},w.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},w.$utils=function(){return Y},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(S,N){var z=oe(S);return this.startOf(N)<=z&&z<=this.endOf(N)},w.isAfter=function(S,N){return oe(S)<this.startOf(N)},w.isBefore=function(S,N){return this.endOf(N)<oe(S)},w.$g=function(S,N,z){return Y.u(S)?this[N]:this.set(z,S)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(S,N){var z=this,W=!!Y.u(N)||N,K=Y.p(S),ae=o(function(ft,Ae){var Qe=Y.w(z.$u?Date.UTC(z.$y,Ae,ft):new Date(z.$y,Ae,ft),z);return W?Qe:Qe.endOf(c)},"l"),fe=o(function(ft,Ae){return Y.w(z.toDate()[ft].apply(z.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Ae)),z)},"$"),be=this.$W,xe=this.$M,Re=this.$D,Tt="set"+(this.$u?"UTC":"");switch(K){case x:return W?ae(1,0):ae(31,11);case p:return W?ae(1,xe):ae(0,xe+1);case d:var mt=this.$locale().weekStart||0,Lt=(be<mt?be+7:be)-mt;return ae(W?Re-Lt:Re+(6-Lt),xe);case c:case b:return fe(Tt+"Hours",0);case s:return fe(Tt+"Minutes",1);case a:return fe(Tt+"Seconds",2);case i:return fe(Tt+"Milliseconds",3);default:return this.clone()}},w.endOf=function(S){return this.startOf(S,!1)},w.$set=function(S,N){var z,W=Y.p(S),K="set"+(this.$u?"UTC":""),ae=(z={},z[c]=K+"Date",z[b]=K+"Date",z[p]=K+"Month",z[x]=K+"FullYear",z[s]=K+"Hours",z[a]=K+"Minutes",z[i]=K+"Seconds",z[n]=K+"Milliseconds",z)[W],fe=W===c?this.$D+(N-this.$W):N;if(W===p||W===x){var be=this.clone().set(b,1);be.$d[ae](fe),be.init(),this.$d=be.set(b,Math.min(this.$D,be.daysInMonth())).$d}else ae&&this.$d[ae](fe);return this.init(),this},w.set=function(S,N){return this.clone().$set(S,N)},w.get=function(S){return this[Y.p(S)]()},w.add=function(S,N){var z,W=this;S=Number(S);var K=Y.p(N),ae=o(function(xe){var Re=oe(W);return Y.w(Re.date(Re.date()+Math.round(xe*S)),W)},"y");if(K===p)return this.set(p,this.$M+S);if(K===x)return this.set(x,this.$y+S);if(K===c)return ae(1);if(K===d)return ae(7);var fe=(z={},z[a]=t,z[s]=r,z[i]=e,z)[K]||1,be=this.$d.getTime()+S*fe;return Y.w(be,this)},w.subtract=function(S,N){return this.add(-1*S,N)},w.format=function(S){var N=this,z=this.$locale();if(!this.isValid())return z.invalidDate||l;var W=S||"YYYY-MM-DDTHH:mm:ssZ",K=Y.z(this),ae=this.$H,fe=this.$m,be=this.$M,xe=z.weekdays,Re=z.months,Tt=z.meridiem,mt=o(function(Ae,Qe,Ft,pr){return Ae&&(Ae[Qe]||Ae(N,W))||Ft[Qe].slice(0,pr)},"h"),Lt=o(function(Ae){return Y.s(ae%12||12,Ae,"0")},"d"),ft=Tt||function(Ae,Qe,Ft){var pr=Ae<12?"AM":"PM";return Ft?pr.toLowerCase():pr};return W.replace(h,(function(Ae,Qe){return Qe||(function(Ft){switch(Ft){case"YY":return String(N.$y).slice(-2);case"YYYY":return Y.s(N.$y,4,"0");case"M":return be+1;case"MM":return Y.s(be+1,2,"0");case"MMM":return mt(z.monthsShort,be,Re,3);case"MMMM":return mt(Re,be);case"D":return N.$D;case"DD":return Y.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return mt(z.weekdaysMin,N.$W,xe,2);case"ddd":return mt(z.weekdaysShort,N.$W,xe,3);case"dddd":return xe[N.$W];case"H":return String(ae);case"HH":return Y.s(ae,2,"0");case"h":return Lt(1);case"hh":return Lt(2);case"a":return ft(ae,fe,!0);case"A":return ft(ae,fe,!1);case"m":return String(fe);case"mm":return Y.s(fe,2,"0");case"s":return String(N.$s);case"ss":return Y.s(N.$s,2,"0");case"SSS":return Y.s(N.$ms,3,"0");case"Z":return K}return null})(Ae)||K.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(S,N,z){var W,K=this,ae=Y.p(N),fe=oe(S),be=(fe.utcOffset()-this.utcOffset())*t,xe=this-fe,Re=o(function(){return Y.m(K,fe)},"D");switch(ae){case x:W=Re()/12;break;case p:W=Re();break;case _:W=Re()/3;break;case d:W=(xe-be)/6048e5;break;case c:W=(xe-be)/864e5;break;case s:W=xe/r;break;case a:W=xe/t;break;case i:W=xe/e;break;default:W=xe}return z?W:Y.a(W)},w.daysInMonth=function(){return this.endOf(p).$D},w.$locale=function(){return te[this.$L]},w.locale=function(S,N){if(!S)return this.$L;var z=this.clone(),W=Fe(S,N,!0);return W&&(z.$L=W),z},w.clone=function(){return Y.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},G})(),pt=xt.prototype;return oe.prototype=pt,[["$ms",n],["$s",i],["$m",a],["$H",s],["$W",c],["$M",p],["$y",x],["$D",b]].forEach((function(G){pt[G[1]]=function(w){return this.$g(w,G[0],G[1])}})),oe.extend=function(G,w){return G.$i||(G(w,xt,oe),G.$i=!0),oe},oe.locale=Fe,oe.isDayjs=ve,oe.unix=function(G){return oe(1e3*G)},oe.en=te[O],oe.Ls=te,oe.p={},oe}))});var zf={};mi(zf,{pipedrive:()=>wf});module.exports=Gc(zf);var Hc=Object.freeze({status:"aborted"});function k(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let p=s.prototype,_=Object.keys(p);for(let x=0;x<_.length;x++){let b=_[x];b in c||(c[b]=p[b].bind(c))}}o(n,"init");let i=r?.Parent??Object;class a extends i{static{o(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function s(c){var d;let p=r?.Parent?new a:this;n(p,c),(d=p._zod).deferred??(d.deferred=[]);for(let _ of p._zod.deferred)_();return p}return o(s,"_"),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:o(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(s,"name",{value:e}),s}o(k,"$constructor");var je=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Qr={};function He(e){return e&&Object.assign(Qr,e),Qr}o(He,"config");function tn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}o(tn,"getEnumValues");function yi(e,t){return typeof t=="bigint"?t.toString():t}o(yi,"jsonStringifyReplacer");function gr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(gr,"cached");function hi(e){return e==null}o(hi,"nullish");function yr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(yr,"cleanRegex");var gi=Symbol("evaluating");function he(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==gi)return n===void 0&&(n=gi,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(he,"defineLazy");var rn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Vt,"isObject");var qc=gr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function _i(e){if(Vt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Vt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(_i,"isPlainObject");var vi=new Set(["string","number","symbol"]);function It(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(It,"escapeRegex");function hr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(hr,"clone");function se(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(se,"normalizeParams");function bi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(bi,"optionalKeys");var Pi={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 Et(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(Et,"aborted");function et(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(et,"prefixIssues");function fr(e){return typeof e=="string"?e:e?.message}o(fr,"unwrapMessage");function tt(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=fr(e.inst?._zod.def?.error?.(e))??fr(t?.error?.(e))??fr(r.customError?.(e))??fr(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(tt,"finalizeIssue");function xi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(xi,"getLengthableOrigin");function nn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(nn,"issue");var Ti=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,yi,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Ii=k("$ZodError",Ti),Bt=k("$ZodError",Ti,{Parent:Error});var Kc=o(e=>(t,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new je;if(s.issues.length){let c=new(i?.Err??e)(s.issues.map(d=>tt(d,a,He())));throw rn(c,i?.callee),c}return s.value},"_parse"),_r=Kc(Bt),Jc=o(e=>async(t,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(i?.Err??e)(s.issues.map(d=>tt(d,a,He())));throw rn(c,i?.callee),c}return s.value},"_parseAsync"),vr=Jc(Bt),Yc=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new je;return a.issues.length?{success:!1,error:new(e??Ii)(a.issues.map(s=>tt(s,i,He())))}:{success:!0,data:a.value}},"_safeParse"),Zt=Yc(Bt),Xc=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(s=>tt(s,i,He())))}:{success:!0,data:a.value}},"_safeParseAsync"),Gt=Xc(Bt);var Qc="(?:(?:\\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])))",el=new RegExp(`^${Qc}$`);var Ei=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Ai=/^-?\d+n?$/,Si=/^-?\d+$/,on=/^-?\d+(?:\.\d+)?$/,$i=/^(?:true|false)$/i;var rt=k("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tl={number:"number",bigint:"bigint",object:"date"};var wi=k("$ZodCheckGreaterThan",(e,t)=>{rt.init(e,t);let r=tl[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,a=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var zi=k("$ZodCheckNumberFormat",(e,t)=>{rt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=Pi[t.format];e._zod.onattach.push(s=>{let c=s._zod.bag;c.format=t.format,c.minimum=i,c.maximum=a,r&&(c.pattern=Si)}),e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<i&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),c>a&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}});var ki=k("$ZodCheckMinLength",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!hi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let s=xi(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var an=k("$ZodCheckStringFormat",(e,t)=>{var r,n;rt.init(e,t),e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Oi=k("$ZodCheckRegex",(e,t)=>{an.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 Ri={major:4,minor:3,patch:6};var de=k("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ri;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let a of i._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((s,c,d)=>{let p=Et(s),_;for(let x of c){if(x._zod.def.when){if(!x._zod.def.when(s))continue}else if(p)continue;let b=s.issues.length,l=x._zod.check(s);if(l instanceof Promise&&d?.async===!1)throw new je;if(_||l instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await l,s.issues.length!==b&&(p||(p=Et(s,b)))});else{if(s.issues.length===b)continue;p||(p=Et(s,b))}}return _?_.then(()=>s):s},"runChecks"),a=o((s,c,d)=>{if(Et(s))return s.aborted=!0,s;let p=i(c,n,d);if(p instanceof Promise){if(d.async===!1)throw new je;return p.then(_=>e._zod.parse(_,d))}return e._zod.parse(p,d)},"handleCanaryResult");e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let p=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return p instanceof Promise?p.then(_=>a(_,s,c)):a(p,s,c)}let d=e._zod.parse(s,c);if(d instanceof Promise){if(c.async===!1)throw new je;return d.then(p=>i(p,n,c))}return i(d,n,c)}}he(e,"~standard",()=>({validate:o(i=>{try{let a=Zt(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Gt(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},"validate"),vendor:"zod",version:1}))}),xr=k("$ZodString",(e,t)=>{de.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ei(e._zod.bag),e._zod.parse=(r,n)=>{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}}),sn=k("$ZodStringFormat",(e,t)=>{an.init(e,t),xr.init(e,t)});var Li=k("$ZodURL",(e,t)=>{sn.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var un=k("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??on,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),Fi=k("$ZodNumberFormat",(e,t)=>{zi.init(e,t),un.init(e,t)}),cn=k("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=$i,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),ji=k("$ZodBigInt",(e,t)=>{de.init(e,t),e._zod.pattern=Ai,e._zod.parse=(r,n)=>{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 Vi=k("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=r=>r}),Bi=k("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=r=>r});var Zi=k("$ZodVoid",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Gi=k("$ZodDate",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function Ni(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}o(Ni,"handleArrayResult");var Hi=k("$ZodArray",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let s=0;s<i.length;s++){let c=i[s],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?a.push(d.then(p=>Ni(p,r,s))):Ni(d,r,s)}return a.length?Promise.all(a).then(()=>r):r}});function Pr(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...et(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(Pr,"handlePropertyResult");function rl(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=bi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(rl,"normalizeDef");function nl(e,t,r,n,i,a){let s=[],c=i.keySet,d=i.catchall._zod,p=d.def.type,_=d.optout==="optional";for(let x in t){if(c.has(x))continue;if(p==="never"){s.push(x);continue}let b=d.run({value:t[x],issues:[]},n);b instanceof Promise?e.push(b.then(l=>Pr(l,r,x,t,_))):Pr(b,r,x,t,_)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}o(nl,"handleCatchall");var qi=k("$ZodObject",(e,t)=>{if(de.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d},"get")})}let n=gr(()=>rl(t));he(e._zod,"propValues",()=>{let c=t.shape,d={};for(let p in c){let _=c[p]._zod;if(_.values){d[p]??(d[p]=new Set);for(let x of _.values)d[p].add(x)}}return d});let i=Vt,a=t.catchall,s;e._zod.parse=(c,d)=>{s??(s=n.value);let p=c.value;if(!i(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value={};let _=[],x=s.shape;for(let b of s.keys){let l=x[b],m=l._zod.optout==="optional",h=l._zod.run({value:p[b],issues:[]},d);h instanceof Promise?_.push(h.then(f=>Pr(f,c,b,p,m))):Pr(h,c,b,p,m)}return a?nl(_,p,c,d,n.value,e):_.length?Promise.all(_).then(()=>c):c}});function Ci(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let i=e.filter(a=>!Et(a));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(s=>tt(s,n,He())))}),t)}o(Ci,"handleUnionResults");var ln=k("$ZodUnion",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>yr(a.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return n(i,a);let s=!1,c=[];for(let d of t.options){let p=d._zod.run({value:i.value,issues:[]},a);if(p instanceof Promise)c.push(p),s=!0;else{if(p.issues.length===0)return p;c.push(p)}}return s?Promise.all(c).then(d=>Ci(d,i,e,a)):Ci(c,i,e,a)}});var Wi=k("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ln.init(e,t);let r=e._zod.parse;he(e._zod,"propValues",()=>{let i={};for(let a of t.options){let s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[c,d]of Object.entries(s)){i[c]||(i[c]=new Set);for(let p of d)i[c].add(p)}}return i});let n=gr(()=>{let i=t.options,a=new Map;for(let s of i){let c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let d of c){if(a.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);a.set(d,s)}}return a});e._zod.parse=(i,a)=>{let s=i.value;if(!Vt(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;let c=n.value.get(s?.[t.discriminator]);return c?c._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),i)}});var Ki=k("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!_i(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],s=t.keyType._zod.values;if(s){r.value={};let c=new Set;for(let p of s)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){c.add(typeof p=="number"?p.toString():p);let _=t.valueType._zod.run({value:i[p],issues:[]},n);_ instanceof Promise?a.push(_.then(x=>{x.issues.length&&r.issues.push(...et(p,x.issues)),r.value[p]=x.value})):(_.issues.length&&r.issues.push(...et(p,_.issues)),r.value[p]=_.value)}let d;for(let p in i)c.has(p)||(d=d??[],d.push(p));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:d})}else{r.value={};for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;let d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&on.test(c)&&d.issues.length){let x=t.keyType._zod.run({value:Number(c),issues:[]},n);if(x instanceof Promise)throw new Error("Async schemas not supported in object keys currently");x.issues.length===0&&(d=x)}if(d.issues.length){t.mode==="loose"?r.value[c]=i[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(x=>tt(x,n,He())),input:c,path:[c],inst:e});continue}let _=t.valueType._zod.run({value:i[c],issues:[]},n);_ instanceof Promise?a.push(_.then(x=>{x.issues.length&&r.issues.push(...et(c,x.issues)),r.value[d.value]=x.value})):(_.issues.length&&r.issues.push(...et(c,_.issues)),r.value[d.value]=_.value)}}return a.length?Promise.all(a).then(()=>r):r}});var Ji=k("$ZodEnum",(e,t)=>{de.init(e,t);let r=tn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>vi.has(typeof i)).map(i=>typeof i=="string"?It(i):i.toString()).join("|")})$`),e._zod.parse=(i,a)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:e}),i}}),Yi=k("$ZodLiteral",(e,t)=>{if(de.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(n=>typeof n=="string"?It(n):n?It(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}});var Xi=k("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new je;return r.value=i,r}});function Ui(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(Ui,"handleOptionalResult");var Qi=k("$ZodOptional",(e,t)=>{de.init(e,t),e._zod.optin="optional",e._zod.optout="optional",he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>Ui(a,r.value)):Ui(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var eo=k("$ZodNullable",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yr(r.source)}|null)$`):void 0}),he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var to=k("$ZodPipe",(e,t)=>{de.init(e,t),he(e._zod,"values",()=>t.in._zod.values),he(e._zod,"optin",()=>t.in._zod.optin),he(e._zod,"optout",()=>t.out._zod.optout),he(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(s=>br(s,t.in,n)):br(a,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>br(a,t.out,n)):br(i,t.out,n)}});function br(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(br,"handlePipeResult");var ro=k("$ZodCustom",(e,t)=>{rt.init(e,t),de.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(a=>Mi(a,r,n,e));Mi(i,r,n,e)}});function Mi(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(nn(i))}}o(Mi,"handleRefineResult");var io;var dn=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function oo(){return new dn}o(oo,"registry");(io=globalThis).__zod_globalRegistry??(io.__zod_globalRegistry=oo());var pn=globalThis.__zod_globalRegistry;function ao(e,t){return new e({type:"string",...se(t)})}o(ao,"_string");function so(e,t){return new e({type:"string",coerce:!0,...se(t)})}o(so,"_coercedString");function uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...se(t)})}o(uo,"_url");function co(e,t){return new e({type:"number",checks:[],...se(t)})}o(co,"_number");function lo(e,t){return new e({type:"number",coerce:!0,checks:[],...se(t)})}o(lo,"_coercedNumber");function po(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...se(t)})}o(po,"_int");function mo(e,t){return new e({type:"boolean",...se(t)})}o(mo,"_boolean");function fo(e,t){return new e({type:"boolean",coerce:!0,...se(t)})}o(fo,"_coercedBoolean");function go(e,t){return new e({type:"bigint",coerce:!0,...se(t)})}o(go,"_coercedBigint");function yo(e){return new e({type:"any"})}o(yo,"_any");function ho(e){return new e({type:"unknown"})}o(ho,"_unknown");function _o(e,t){return new e({type:"void",...se(t)})}o(_o,"_void");function vo(e,t){return new e({type:"date",coerce:!0,...se(t)})}o(vo,"_coercedDate");function Tr(e,t){return new wi({check:"greater_than",...se(t),value:e,inclusive:!0})}o(Tr,"_gte");function Ce(e,t){return new ki({check:"min_length",...se(t),minimum:e})}o(Ce,"_minLength");function nt(e,t){return new Oi({check:"string_format",format:"regex",...se(t),pattern:e})}o(nt,"_regex");function bo(e,t,r){let n=se(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(bo,"_custom");var _e=k("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");de.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>_r(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Zt(e,r,n),e.parseAsync=async(r,n)=>vr(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Gt(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>hr(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Er=k("ZodMiniString",(e,t)=>{xr.init(e,t),_e.init(e,t)});function u(e){return ao(Er,e)}o(u,"string");var Po=k("ZodMiniStringFormat",(e,t)=>{sn.init(e,t),Er.init(e,t)});var yl=k("ZodMiniURL",(e,t)=>{Li.init(e,t),Po.init(e,t)});function xo(e){return uo(yl,e)}o(xo,"url");var Ar=k("ZodMiniNumber",(e,t)=>{un.init(e,t),_e.init(e,t)});function Ee(e){return co(Ar,e)}o(Ee,"number");var hl=k("ZodMiniNumberFormat",(e,t)=>{Fi.init(e,t),Ar.init(e,t)});function To(e){return po(hl,e)}o(To,"int");var mn=k("ZodMiniBoolean",(e,t)=>{cn.init(e,t),_e.init(e,t)});function ne(e){return mo(mn,e)}o(ne,"boolean");var Io=k("ZodMiniBigInt",(e,t)=>{ji.init(e,t),_e.init(e,t)});var _l=k("ZodMiniAny",(e,t)=>{Vi.init(e,t),_e.init(e,t)});function qt(){return yo(_l)}o(qt,"any");var vl=k("ZodMiniUnknown",(e,t)=>{Bi.init(e,t),_e.init(e,t)});function V(){return ho(vl)}o(V,"unknown");var bl=k("ZodMiniVoid",(e,t)=>{Zi.init(e,t),_e.init(e,t)});function Eo(e){return _o(bl,e)}o(Eo,"_void");var Ao=k("ZodMiniDate",(e,t)=>{Gi.init(e,t),_e.init(e,t)});var Pl=k("ZodMiniArray",(e,t)=>{Hi.init(e,t),_e.init(e,t)});function H(e,t){return new Pl({type:"array",element:e,...se(t)})}o(H,"array");var xl=k("ZodMiniObject",(e,t)=>{qi.init(e,t),_e.init(e,t),he(e,"shape",()=>t.shape)});function y(e,t){let r={type:"object",shape:e??{},...se(t)};return new xl(r)}o(y,"object");var Tl=k("ZodMiniUnion",(e,t)=>{ln.init(e,t),_e.init(e,t)});function q(e,t){return new Tl({type:"union",options:e,...se(t)})}o(q,"union");var Il=k("ZodMiniDiscriminatedUnion",(e,t)=>{Wi.init(e,t),_e.init(e,t)});function it(e,t,r){return new Il({type:"union",options:t,discriminator:e,...se(r)})}o(it,"discriminatedUnion");var El=k("ZodMiniRecord",(e,t)=>{Ki.init(e,t),_e.init(e,t)});function B(e,t,r){return new El({type:"record",keyType:e,valueType:t,...se(r)})}o(B,"record");var Al=k("ZodMiniEnum",(e,t)=>{Ji.init(e,t),_e.init(e,t),e.options=Object.values(t.entries)});function X(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Al({type:"enum",entries:r,...se(t)})}o(X,"_enum");var Sl=k("ZodMiniLiteral",(e,t)=>{Yi.init(e,t),_e.init(e,t)});function M(e,t){return new Sl({type:"literal",values:Array.isArray(e)?e:[e],...se(t)})}o(M,"literal");var $l=k("ZodMiniTransform",(e,t)=>{Xi.init(e,t),_e.init(e,t)});function ot(e){return new $l({type:"transform",transform:e})}o(ot,"transform");var wl=k("ZodMiniOptional",(e,t)=>{Qi.init(e,t),_e.init(e,t)});function P(e){return new wl({type:"optional",innerType:e})}o(P,"optional");var zl=k("ZodMiniNullable",(e,t)=>{eo.init(e,t),_e.init(e,t)});function Wt(e){return new zl({type:"nullable",innerType:e})}o(Wt,"nullable");var kl=k("ZodMiniPipe",(e,t)=>{to.init(e,t),_e.init(e,t)});function at(e,t){return new kl({type:"pipe",in:e,out:t})}o(at,"pipe");var Ol=k("ZodMiniCustom",(e,t)=>{ro.init(e,t),_e.init(e,t)});function Sr(e,t){return bo(Ol,e??(()=>!0),t)}o(Sr,"custom");var Kt={};mi(Kt,{bigint:()=>Ml,boolean:()=>Ul,date:()=>Ll,number:()=>Cl,string:()=>Nl});function Nl(e){return so(Er,e)}o(Nl,"string");function Cl(e){return lo(Ar,e)}o(Cl,"number");function Ul(e){return fo(mn,e)}o(Ul,"boolean");function Ml(e){return go(Io,e)}o(Ml,"bigint");function Ll(e){return vo(Ao,e)}o(Ll,"date");var gn=y({retryOnFailure:y({defaultValue:P(ne()),hide:P(ne())}),continueOnFailure:y({defaultValue:P(ne()),hide:P(ne())})}),fn=class{constructor(t,r,n,i,a,s,c,d,p,_,x){this.name=t;this.displayName=r;this.description=n;this.props=i;this.run=a;this.test=s;this.requireAuth=c;this.errorHandlingOptions=d;this.outputSchema=p;this.audience=_;this.aiMetadata=x}static{o(this,"IAction")}},D=o(e=>new fn(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 re=y({displayName:u(),description:P(u())}),J=o((e,t)=>y({type:M(t),required:ne(),defaultValue:P(qt())}),"TPropertyValue");var ze=y({...re.shape,...J(u(),"SHORT_TEXT").shape}),qe=y({...re.shape,...J(u(),"LONG_TEXT").shape});var $o=y({label:u(),value:V()}),$r=y({disabled:P(ne()),placeholder:P(u()),options:H($o)});var ke=y({...re.shape,options:$r,...J(V(),"STATIC_DROPDOWN").shape}),We=y({...re.shape,options:$r,...J(H(V()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var yn=y({...re.shape,...J(V(),"DROPDOWN").shape,refreshers:H(u())}),Jt=y({...re.shape,...J(H(V()),"MULTI_SELECT_DROPDOWN").shape,refreshers:H(u())});var Ke=y({...re.shape,...J(ne(),"CHECKBOX").shape});var Je=y({...re.shape,...J(Ee(),"NUMBER").shape});var Yt=y({...re.shape,streaming:P(ne()),...J(V(),"FILE").shape});var Xt=y({...re.shape,...J(u(),"DATE_TIME").shape});var wo=B(u(),q([ze,qe,ke,Jt,We,Ke,Je,Yt,Xt])),Qt=y({...re.shape,properties:wo,...J(H(V()),"ARRAY").shape});var er=y({...re.shape,...J(q([B(u(),V())]),"JSON").shape});var zo=q([ze,ke,er,Qt,We]),jl=B(u(),zo),hn=y({refreshers:H(u()),...re.shape,...J(V(),"DYNAMIC").shape});var wr=y({...re.shape,...J(Eo(),"MARKDOWN").shape});var tr=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(tr||{}),At=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(At||{}),St=(v=>(v.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",v.COMMUNICATION="COMMUNICATION",v.COMMERCE="COMMERCE",v.CORE="CORE",v.UNIVERSAL_AI="UNIVERSAL_AI",v.FLOW_CONTROL="FLOW_CONTROL",v.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",v.ACCOUNTING="ACCOUNTING",v.PRODUCTIVITY="PRODUCTIVITY",v.CONTENT_AND_FILES="CONTENT_AND_FILES",v.DEVELOPER_TOOLS="DEVELOPER_TOOLS",v.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",v.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",v.HUMAN_RESOURCES="HUMAN_RESOURCES",v.PAYMENT_PROCESSING="PAYMENT_PROCESSING",v.MARKETING="MARKETING",v.SALES_AND_CRM="SALES_AND_CRM",v))(St||{});var rr=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(rr||{}),_n="both_client_credentials_and_authorization_code";var ge=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(ge||{}),nr=(a=>(a.NONE="NONE",a.HEADER_PRESENT="HEADER_PRESENT",a.QUERY_PRESENT="QUERY_PRESENT",a.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",a.HEAD_REQUEST="HEAD_REQUEST",a))(nr||{}),Vl=y({strategy:X(nr),paramName:P(u())}),ir=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(ir||{});var zr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(zr||{}),ko=y({status:P(Ee()),body:P(V()),headers:P(B(u(),u()))}),Oo=y({type:M("DELAY"),resumeDateTime:u(),requestIdToReply:P(u()),handlerId:P(u()),streamStepProgress:P(X(zr))}),Do=y({type:M("WEBHOOK"),requestId:u(),requestIdToReply:P(u()),response:ko,handlerId:P(u()),streamStepProgress:P(X(zr))}),Bl=q([Oo,Do]);var Zl=y({body:V(),rawBody:P(V()),headers:B(u(),u()),queryParams:B(u(),u())});function A(e){return e==null}o(A,"isNil");function ce(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(ce,"isEmpty");function kr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(kr,"assertNotNullOrUndefined");var vn=Se(require("crypto"),1);var Gl=128,gt,$t,Hl=o(e=>{!gt||gt.length<e?(gt=Buffer.allocUnsafe(e*Gl),vn.default.randomFillSync(gt),$t=0):$t+e>gt.length&&(vn.default.randomFillSync(gt),$t=0),$t+=e},"fillPool"),ql=o(e=>(Hl(e|=0),gt.subarray($t-e,$t)),"random"),Wl=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*n*t/e.length);return(a=t)=>{let s="";for(;;){let c=r(i),d=i;for(;d--;)if(s+=e[c[d]&n]||"",s.length===a)return s}}},"customRandom"),No=o((e,t=21)=>Wl(e,t,ql),"customAlphabet");var Kl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Co=21,lI=u().check(nt(new RegExp(`^[0-9a-zA-Z]{${Co}}$`))),Jl=No(Kl,Co);var st=at(ot(e=>e instanceof Date?e.toISOString():e),u()),Ne={id:u(),created:st,updated:st},le=o(e=>P(Wt(e)),"Nullable");function bn(e){return P(Wt(X(e)))}o(bn,"NullableEnum");var mI=at(ot(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),P(ne())),Or=o(e=>at(ot(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),P(H(e))),"OptionalArrayFromQuery");var yI=B(u(),V());var or=(_=>(_.OPENAI="openai",_.OPENROUTER="openrouter",_.ANTHROPIC="anthropic",_.AZURE="azure",_.GOOGLE="google",_.ACTIVEPIECES="activepieces",_.CLOUDFLARE_GATEWAY="cloudflare-gateway",_.CUSTOM="custom",_.BEDROCK="bedrock",_.MISTRAL="mistral",_))(or||{});var $I=u().check(nt(/^#[0-9A-Fa-f]{6}$/));var zI=y({filename:u(),data:V(),type:M("file"),mimetype:P(u())});var Yl=Se(Mo());var UI=y({...Ne,name:u(),permissions:H(u()),platformId:le(u()),type:u(),userCount:P(Ee())});var Lo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Lo||{}),Pn=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Pn||{}),xn=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(xn||{});var Tn=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Tn||{});var In=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(In||{});var Xl=y({mode:X(Lo),value:V()}),Ql=y({auth:P(u()),fields:B(u(),Xl)}),ed=y({pieceName:u(),pieceVersion:u(),actionName:u(),predefinedInput:P(Ql)}),td=y({type:M("PIECE"),toolName:u().check(Ce(1)),pieceMetadata:ed}),rd=y({type:M("none")}),nd=y({type:M("access_token"),accessToken:u()}),id=y({type:M("api_key"),apiKey:u(),apiKeyHeader:u()}),od=y({type:M("headers"),headers:B(u(),u())}),ad=it("type",[rd,nd,id,od]),Fo=y({type:M("FLOW"),toolName:u().check(Ce(1)),externalFlowId:u(),flowDisplayName:P(u())}),jo=y({type:M("MCP"),toolName:u().check(Ce(1)),serverUrl:xo(),protocol:X(xn),auth:ad}),Vo=y({type:M("KNOWLEDGE_BASE"),toolName:u().check(Ce(1)),sourceType:X(Pn),sourceId:u(),sourceName:u()}),sd=it("type",[td,Fo,jo,Vo]),ud=y({displayName:u(),description:P(u()),type:X(Tn)}),Bo=y({type:M("MARKDOWN"),markdown:u()}),wt={type:M("TOOL_CALL"),input:le(B(u(),V())),output:P(V()),toolName:u(),status:X(In),toolCallId:u(),startTime:u(),endTime:P(u())},fE=y(wt),Zo=it("toolCallType",[y({...wt,toolCallType:M("PIECE"),pieceName:u(),pieceVersion:u(),actionName:u()}),y({...wt,toolCallType:M("FLOW"),displayName:u(),externalFlowId:u()}),y({...wt,toolCallType:M("MCP"),displayName:u(),serverUrl:u()}),y({...wt,toolCallType:M("KNOWLEDGE_BASE"),displayName:u(),sourceType:u()}),y({...wt,toolCallType:M("UNKNOWN"),displayName:u()})]),cd=q([Bo,Zo]);var En=(r=>(r.IMAGE="image",r.TEXT="text",r))(En||{}),Ye=y({apiKey:u()}),ld=Ye,dd=y({apiKey:u(),apiKeyHash:u()}),pd=Ye,md=Ye,fd=Ye,gd=Ye,yd=Ye,hd=Ye,_d=Ye,Ko=y({accessKeyId:u().check(Ce(1)),secretAccessKey:u().check(Ce(1))}),vd=y({}),bd=y({}),Pd=y({}),xd=y({}),Td=y({}),Id=y({}),Jo=y({modelId:u(),modelName:u(),modelType:X(En)}),Yo=y({apiKeyHeader:u(),baseUrl:u(),models:H(Jo),defaultHeaders:P(B(u(),u()))}),Xo=y({accountId:u(),gatewayId:u(),models:H(Jo),vertexProject:P(u()),vertexRegion:P(u())}),Qo=y({resourceName:u(),apiVersion:at(ot(e=>typeof e=="string"&&e.trim().length===0?void 0:e),P(u()))}),ea=y({region:u().check(Ce(1))}),Ed=q([ld,fd,gd,yd,hd,md,pd,dd,Ko,_d]),ta=q([Yo,Xo,Qo,ea,vd,Pd,xd,Td,bd,Id]),Ad=y({id:u(),name:u(),type:X(En)}),Sd=y({id:u(),name:u(),provider:X(or),config:ta,enabledForChat:ne()}),$d=y({provider:X(or),config:ta,auth:Ed,platformId:u()});var _E={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Go=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],wd=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],zd=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Ho=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],kd=["grok-4.20","grok-4.1-fast"],Od={openai:Go,anthropic:wd,google:Ho,activepieces:[...zd.map(e=>`anthropic/${e}`),...Go.map(e=>`openai/${e}`),...Ho.map(e=>`google/${e}`),...kd.map(e=>`x-ai/${e}`)]};var qo=128e3,Dd={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Rd({provider:e}){return e?Dd[e]??qo:qo}o(Rd,"getMaxContextTokens");var Wo={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"},Nd={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Cd=new Set(["anthropic","mistral"]);function Ve(e){return{chatModels:Od[e],maxContextTokens:Rd({provider:e}),defaultEmbeddingModel:Wo[e],supportsEmbedding:Wo[e]!==void 0,supportsImageGeneration:!Cd.has(e),webSearch:Nd[e]}}o(Ve,"buildProviderCapabilities");var Ud={openai:Ve("openai"),anthropic:Ve("anthropic"),openrouter:Ve("openrouter"),azure:Ve("azure"),google:Ve("google"),"cloudflare-gateway":Ve("cloudflare-gateway"),custom:Ve("custom"),bedrock:Ve("bedrock"),mistral:Ve("mistral"),activepieces:Ve("activepieces")};var Md=y({base64Url:u(),fileName:u(),extension:P(u())}),Ld=y({mimeType:u(),url:u(),fileName:P(u())}),An=q([Md,Ld]);var Fd=q([y({type:M("file"),value:An}),y({type:M("markdown"),value:u(),files:P(H(An))})]),jd=y({sessionId:u(),message:u(),files:P(H(u()))});var na=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(na||{}),ia=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(ia||{}),Sn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Sn||{});var Vd=q([y({...Ne,name:u(),externalId:u(),type:M("STATIC_DROPDOWN"),tableId:u(),projectId:u(),data:y({options:H(y({value:u()}))})}),y({...Ne,name:u(),externalId:u(),type:q([M("TEXT"),M("NUMBER"),M("DATE")]),tableId:u(),projectId:u()})]),Bd=y({...Ne,name:u(),folderId:le(u()),projectId:u(),externalId:u(),status:bn(ia),trigger:bn(na)}),Zd=y({...Ne,tableId:u(),projectId:u(),cells:B(u(),y({updated:u(),created:u(),value:V(),fieldName:u()}))}),Gd=y({events:H(X(Sn)),webhookUrl:u(),flowId:u()}),Hd=y({fields:H(y({id:u(),name:u()})),rows:H(B(u(),u())),name:u()}),qd=y({projectId:u(),limit:P(Kt.number()),cursor:P(u()),name:P(u()),externalIds:Or(u()),folderId:P(u()),folderIds:Or(u())}),Wd=y({records:H(H(y({fieldId:u(),value:aa()}))),tableId:u()}),Kd=y({cells:P(H(y({fieldId:u(),value:aa()}))),tableId:u(),agentUpdate:P(ne())}),oa=it("operator",[yt("eq"),yt("neq"),yt("gt"),yt("gte"),yt("lt"),yt("lte"),yt("co"),ra("exists"),ra("not_exists")]),Jd=y({tableId:u(),limit:P(Kt.number()),cursor:P(u()),filters:Or(oa)});function aa(){return at(ot(e=>e==null?e:String(e)),Wt(u()))}o(aa,"coerceToString");function yt(e){return y({fieldId:u(),operator:M(e),value:u()})}o(yt,"valueFilter");function ra(e){return y({fieldId:u(),operator:M(e)})}o(ra,"existenceFilter");var Yd=y({status:P(Ee()),body:P(V()),headers:P(B(u(),u()))}),Xd=y({...Ne,deleted:le(st),ownerId:u(),displayName:u(),platformId:u(),externalId:le(u())});var sa=y({name:u(),description:P(u()),type:u(),required:ne()}),Qd=y({pieceName:u(),triggerName:u(),input:y({toolName:u(),toolDescription:u(),inputSchema:H(sa),returnsResponse:ne()})});var ua="^[0-9]+\\.[0-9]+\\.[0-9]+$",UE=new RegExp(ua),tp="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",ME=u().check(nt(new RegExp(ua))),LE=u().check(nt(new RegExp(tp))),rp=y({packageType:M("ARCHIVE"),pieceType:X(At),pieceName:u(),pieceVersion:u(),archiveId:u(),platformId:u()}),ca=y({packageType:M("REGISTRY"),pieceType:M("OFFICIAL"),pieceName:u(),pieceVersion:u()}),la=y({packageType:M("REGISTRY"),pieceType:M("CUSTOM"),pieceName:u(),pieceVersion:u(),platformId:u()}),FE=q([ca,la]),jE=q([rp,ca,la]);var np=it("type",[y({type:M("CRON_EXPRESSION"),cronExpression:u(),timezone:u()}),y({type:M("INTERVAL"),intervalMs:To().check(Tr(6e4))})]),VE=y({...Ne,type:X(ge),projectId:u(),flowId:u(),triggerName:u(),schedule:le(np),flowVersionId:u(),pieceName:u(),pieceVersion:u(),deleted:le(u()),simulate:ne()}),da=(f=>(f.UNKNOWN="UNKNOWN",f.FLOW_RUN_LOG="FLOW_RUN_LOG",f.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",f.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",f.FLOW_STEP_FILE="FLOW_STEP_FILE",f.SAMPLE_DATA="SAMPLE_DATA",f.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",f.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",f.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",f.PROJECT_RELEASE="PROJECT_RELEASE",f.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",f.PLATFORM_ASSET="PLATFORM_ASSET",f.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",f.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",f.KNOWLEDGE_BASE="KNOWLEDGE_BASE",f.FLOW_BUNDLE="FLOW_BUNDLE",f))(da||{}),pa=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(pa||{}),ma=(r=>(r.S3="S3",r.DB="DB",r))(ma||{}),BE=y({...Ne,projectId:le(u()),platformId:le(u()),type:X(da),compression:X(pa),data:P(V()),location:X(ma),size:le(Ee()),fileName:le(u()),s3Key:le(u()),metadata:le(B(u(),u()))}),fa=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(fa||{}),ga=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(ga||{}),ZE=y({id:u(),email:u(),firstName:u(),status:X(ga),externalId:le(u()),platformId:le(u()),platformRole:X(fa),lastName:u(),created:st,updated:st,lastActiveDate:le(st),imageUrl:le(u())});var $n=y({...re.shape,...J(B(u(),V()),"OBJECT").shape});var va=y({...re.shape,...J(u(),"COLOR").shape});var wn=q([ze,qe,wr,Ke,ke,We,yn,Jt,hn,Je,Qt,$n,er,Xt,Yt,va]),g={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 Be=y({displayName:u(),description:P(u())});var ba=y({username:u(),password:u()}),zn=y({...Be.shape,username:y({displayName:u(),description:P(u())}),password:y({displayName:u(),description:P(u())}),...J(ba,"BASIC_AUTH").shape});var sp=B(u(),q([ze,qe,Je,Ke,ke])),kn=y({...Be.shape,props:sp,...J(V(),"CUSTOM_AUTH").shape});var ht=y({...Be.shape,...J(y({auth:u()}),"SECRET_TEXT").shape});var up=B(u(),q([ze,qe,ht,Je,Ke,ke,We,wr])),Pa=y({...Be.shape,props:up,...J(V(),"OIDC").shape});var On=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(On||{}),xa=q([ze,ht,ke]),Ta=B(u(),xa),cp=y({props:P(B(u(),xa)),authUrl:u(),tokenUrl:u(),scope:H(u()),prompt:P(q([M("none"),M("consent"),M("login"),M("omit")])),pkce:P(ne()),pkceMethod:P(q([M("plain"),M("S256")])),authorizationMethod:P(X(On)),grantType:P(q([X(rr),M(_n)])),extra:P(B(u(),u()))}),Ia=y({access_token:u(),props:P(Ta),data:B(u(),qt())}),Dn=y({...Be.shape,...cp.shape,...J(Ia,"OAUTH2").shape});var zt=q([zn,kn,Pa,Dn,ht]),ar="Connection",Rn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||ar}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||ar,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||ar}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||ar}},None(){}};var xS={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 lp=y({...re.shape,...J(V(),"CUSTOM").shape,code:u()});var dp=q([wn,zt]),Nn=B(u(),dp),VS=B(u(),wn);var Ea=q([y({strategy:M("CRON"),cronExpression:u()}),y({strategy:M("NONE")})]),kt=class{constructor(t,r,n,i,a,s,c,d,p,_,x,b,l,m,h,f,v,I,O){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=a;this.type=s;this.handshakeConfiguration=c;this.onHandshake=d;this.renewConfiguration=p;this.onRenew=_;this.onEnable=x;this.onDisable=b;this.onStart=l;this.run=m;this.test=h;this.sampleData=f;this.testStrategy=v;this.outputSchema=I;this.aiMetadata=O}static{o(this,"ITrigger")}},ie=o(e=>{switch(e.type){case"WEBHOOK":return new kt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata);case"POLLING":return new kt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"MANUAL":return new kt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"APP_WEBHOOK":return new kt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,A(e.sampleData)&&A(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Aa="2",Rr="0.82.0";var Cn=class{constructor(t,r,n,i,a,s,c,d,p=Rr,_,x="",b){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=c;this.auth=d;this.minimumSupportedRelease=p;this.maximumSupportedRelease=_;this.description=x;this.deprecated=b;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:Aa}),"getContextInfo");(!pp(p)||mp(p,Rr))&&(this.minimumSupportedRelease=Rr),a.forEach(l=>this._actions[l.name]=l),s.forEach(l=>this._triggers[l.name]=l)}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}},Sa=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(a=>a.type===r.type)))throw new Error("Auth properties must be unique by type");return new Cn(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 pp(e){return/^\d+\.\d+\.\d+$/.test(e)}o(pp,"isValidSimpleSemver");function mp(e,t){let[r,n,i]=e.split(".").map(Number),[a,s,c]=t.split(".").map(Number);return r!==a?r<a:n!==s?n<s:i<c}o(mp,"isSemverLessThan");var fp=P(B(u(),B(u(),u()))),$a=y({id:P(u()),name:u(),displayName:u(),logoUrl:u(),description:u(),authors:H(u()),platformId:P(u()),directoryPath:P(u()),auth:P(q([zt,H(zt)])),version:u(),categories:P(H(X(St))),minimumSupportedRelease:P(u()),maximumSupportedRelease:P(u()),deprecated:P(ne()),i18n:fp}),gp=X(["human","ai","both"]),wa=y({description:P(u()),idempotent:P(ne())}),za=y({name:u(),displayName:u(),description:u(),props:Nn,requireAuth:ne(),errorHandlingOptions:P(gn),outputSchema:P(Sr()),audience:P(gp),aiMetadata:P(wa)}),ka=y({name:u(),displayName:u(),description:u(),props:Nn,errorHandlingOptions:P(gn),type:X(ge),sampleData:V(),handshakeConfiguration:P(Sr()),renewConfiguration:P(Ea),testStrategy:X(ir),outputSchema:P(Sr()),aiMetadata:P(wa)}),yp=y({...$a.shape,actions:B(u(),za),triggers:B(u(),ka)}),hp=y({...$a.shape,actions:Ee(),triggers:Ee(),suggestedActions:P(H(za)),suggestedTriggers:P(H(ka))}),Oa=y({projectUsage:Ee(),pieceType:X(At),packageType:X(tr),platformId:P(u()),archiveId:P(u())}),V$=y({...yp.shape,...Oa.shape}),B$=y({...hp.shape,...Oa.shape}),Z$=y({name:u(),version:u()});var _p=Se(require("path")),vp=Se(require("fs/promises"));var Ca=require("node:stream");var Nr=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((a,s)=>{i.append(s,a)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(t){let r={Accept:"application/json"};return t.authentication&&this.populateAuthentication(t.authentication,r),t.body&&(t.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var Cr=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new Un,r=new Mn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Un=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Mn=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var _t=class extends Error{constructor(r,n){let i=n.status||500,a=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:a},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=a}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function Da({error:e,requestBody:t}){return e instanceof _t?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}o(Da,"toFailsafeOutput");var vt=(s=>(s.GET="GET",s.POST="POST",s.PATCH="PATCH",s.PUT="PUT",s.DELETE="DELETE",s.HEAD="HEAD",s))(vt||{});var Ur=class extends Nr{static{o(this,"FetchHttpClient")}constructor(t="",r=new Cr){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),a=this.getHeaders(t),s=t.queryParams??{};for(let[O,te]of Object.entries(s))i.append(O,te);let c=i.toString(),d=c?`${n}?${c}`:n,p=t.responseType??"json",_=t.followRedirects??!0,x=t.retries??0,{body:b,extraHeaders:l,isStream:m}=bp(t.method)?Pp(t.body,a):{body:void 0,extraHeaders:{},isStream:!1},h=Tp({...a,...l}),f=await xp(async()=>{let O=new AbortController,te=t.timeout&&t.timeout>0?setTimeout(()=>O.abort(),t.timeout):void 0;try{let ve={method:t.method.toString(),headers:h,body:b,redirect:_?"follow":"manual",signal:O.signal};return m&&(ve.duplex="half"),r?.dispatcher!==void 0&&(ve.dispatcher=r.dispatcher),await fetch(d,ve)}finally{te!==void 0&&clearTimeout(te)}},x),v=_?300:400;if(f.status<200||f.status>=v){let O=await Ra(f,p),te=new _t(t.body,{status:f.status,responseBody:O});throw console.error("[HttpClient#(sanitized error message)] Request failed:",te),te}let I=await Ra(f,p);return{status:f.status,headers:Ip(f.headers),body:I}}};function bp(e){return e!=="GET"&&e!=="HEAD"}o(bp,"acceptsRequestBody");function Pp(e,t){if(Ap(e))return{body:void 0,extraHeaders:{},isStream:!1};if(Ep(e)){let n=new Ca.PassThrough;return e.on("error",i=>n.destroy(i)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(Pp,"serializeBody");async function Ra(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(Ra,"parseResponseBody");async function xp(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await Na(n);continue}return i}catch(i){if(r=i,n<t){await Na(n);continue}throw i}throw r}o(xp,"sendWithRetries");function Na(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(Na,"backoff");function Tp(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return t}o(Tp,"normalizeHeaders");function Ip(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(Ip,"toHttpHeaders");function Ep(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}o(Ep,"isNodeFormData");function Ap(e){return e==null}o(Ap,"isNil");var $e=new Ur;var ff=Se(require("fs")),ju=Se(oi());var gf={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function yf(e){let t=e.split(";")[0].trim().toLowerCase();return gf[t]??""}o(yf,"contentTypeToExtension");var hf=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),_f=o((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function Vu({auth:e,baseUrl:t,authMapping:r,description:n,displayName:i,name:a,props:s,extraProps:c,authLocation:d="headers"}){return D({audience:"human",name:a||"custom_api_call",displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:g.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:p})=>({url:g.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
+
i.e ${_f(t,p)}/resource or /resource`,required:!0,defaultValue:p?t(p):"",...s?.url??{}})}),"props")}),method:g.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(vt).map(p=>({label:p,value:p}))},...s?.method??{}}),headers:g.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...s?.headers??{}}),queryParams:g.Object({displayName:"Query Parameters",required:!0,...s?.queryParams??{}}),body_type:g.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:g.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:p})=>{if(!p)return{};let _=p,x={};switch(_){case"none":break;case"json":x.data=g.Json({displayName:"JSON Body",required:!0,...s?.body??{}});break;case"raw":x.data=g.LongText({displayName:"Raw Body",required:!0});break;case"form_data":x.data=g.Array({displayName:"Form Data",required:!0,properties:{fieldName:g.ShortText({displayName:"Field Name",required:!0}),fieldType:g.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:g.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:g.File({displayName:"File Field Value",required:!1})}});break}return x},"props")}),response_is_binary:g.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:g.Checkbox({displayName:"No Error on Failure",required:!1,...s?.failsafe??{}}),timeout:g.Number({displayName:"Timeout (in seconds)",required:!1,...s?.timeout??{}}),followRedirects:g.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...c},run:o(async p=>{let{method:_,url:x,headers:b,queryParams:l,body:m,body_type:h,failsafe:f,timeout:v,response_is_binary:I,followRedirects:O}=p.propsValue;kr(_,"Method"),kr(x,"URL");let te=A(r)?{}:await r(p.auth,p.propsValue),ve=x.url,Fe=ve.startsWith("http://")||ve.startsWith("https://")?ve:hf({baseUrl:t(p.auth),relativePath:ve}),oe={method:_,url:Fe,headers:{...b??{},...d==="headers"||!A(d)?te:{}},queryParams:{...d==="queryParams"?te:{},...l??{}},timeout:v?v*1e3:0,followRedirects:O};if(I&&(oe.responseType="arraybuffer"),m)if(h&&h!=="none"){let Y=m.data;if(h==="form_data"){let xt=Y,pt=new ju.default;for(let{fieldName:G,fieldType:w,textFieldValue:S,fileFieldValue:N}of xt)w==="text"&&!ce(S)?pt.append(G,S):w==="file"&&!ce(N)&&pt.append(G,N.data,{filename:N?.filename});oe.body=pt,oe.headers={...oe.headers,...pt.getHeaders()}}else oe.body=Y}else h||(oe.body=m);try{let Y=await $e.sendRequest(oe);return await vf(p.files,Y.body,Y.status,Y.headers,I)}catch(Y){if(f)return Da({error:Y,requestBody:oe.body});throw Y}},"run")})}o(Vu,"createCustomApiCallAction");var vf=o(async(e,t,r,n,i)=>{let a;if(i&&bf(t)){let s=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],c=yf(s??"")||"txt",d;t instanceof ArrayBuffer?d=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?d=t:d=Buffer.from(t),a=await e.write({fileName:`output.${c}`,data:d})}else a=t;return{status:r,headers:n,body:a}},"handleBinaryResponse"),bf=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var ci=Se(ct());var ue={subscribeWebhook:o(async(e,t,r,n,i)=>{let a={method:"POST",url:`${n}/api/v1/webhooks`,body:{event_object:e,event_action:t,subscription_url:r,version:"2.0"},authentication:{type:"BEARER_TOKEN",token:i},queryParams:{}},{body:s}=await $e.sendRequest(a);return s},"subscribeWebhook"),unsubscribeWebhook:o(async(e,t,r)=>{let n={method:"DELETE",url:`${t}/api/v1/webhooks/${e}`,authentication:{type:"BEARER_TOKEN",token:r}};return await $e.sendRequest(n)},"unsubscribeWebhook")};async function T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=`${t}/api${n}`,c={};if(i)for(let[_,x]of Object.entries(i))x!=null&&(c[_]=Array.isArray(x)?x.map(String).join(","):String(x));let d;a&&(d=Object.entries(a).reduce((_,[x,b])=>(A(b)||(_[x]=b),_),{}));let p={method:r,url:s,authentication:{type:"BEARER_TOKEN",token:e},queryParams:c,body:d};try{return(await $e.sendRequest(p)).body}catch(_){throw _ instanceof _t&&_.response.status===403?new Error("Please reconnect your Pipedrive account."):_}}o(T,"pipedriveApiCall");async function $({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=i||{};s.start=0,s.limit=500;let c=[],d=!0;do{let p=await T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:s,body:a});if(A(p.data))break;c.push(...p.data),s.start=p.additional_data.pagination.next_start,d=p.additional_data.pagination.more_items_in_collection}while(d);return c}o($,"pipedrivePaginatedV1ApiCall");async function ye({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let s=i?{...i}:{},c,d=[],p=!0;do{let _={...s};c&&(_.cursor=c),_.limit=500;let x=await T({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:_,body:a});if(A(x.data))break;Array.isArray(x.data)?d.push(...x.data):d.push(x.data),p=x.additional_data?.next_cursor!=null,c=x.additional_data?.next_cursor}while(p&&c);return d}o(ye,"pipedrivePaginatedV2ApiCall");function ui(e){return(0,ci.default)(e).isValid()?(0,ci.default)(e).format("YYYY-MM-DD"):e}o(ui,"formatDateIfValid");function Te(e,t){let r=e.reduce((i,a)=>(i[a.key]=a,i),{}),n={};for(let[i,a]of Object.entries(t)){if(ce(a))continue;let s=r[i];if(s){if(s.is_subfield){let c=i.split("_")[0];n[c]={...n[c],[s.id_suffix]:s.field_type==="date"?ui(a):a};continue}switch(s.field_type){case"monetary":n[i]={...n[i],value:Number(a)};break;case"address":case"daterange":case"timerange":case"time":n[i]={...n[i],value:ui(a)};break;case"date":n[i]=ui(a);break;default:n[i]=a;break}}}return n}o(Te,"pipedriveParseCustomFields");function R(e,t){let r={...t},n=t.custom_fields||{};for(let i of e){if(!i.edit_flag)continue;let a=i.key,s=i.name,c=i.field_type;if(a in n){let d=n[a];A(d)?r[s]=null:c==="enum"?r[s]=i.options?.find(p=>p.id===d)?.label||null:c==="set"&&Array.isArray(d)?r[s]=d.map(p=>i.options?.find(_=>_.id===p)?.label||null):r[s]=d}}return delete r.custom_fields,r}o(R,"pipedriveTransformCustomFields");function Pt(e,t){let r={...t};for(let n of e){if(!n.edit_flag)continue;let i=n.key,a=n.name,s=n.field_type;if(i in t){if(t[i]===null||t[i]===void 0)r[a]=null;else if(s==="enum")r[a]=n.options?.find(c=>c.id.toString()===t[i])?.label||null;else if(s==="set"){let c=t[i].split(",");r[a]=c.map(d=>n.options?.find(p=>p.id.toString()===d)?.label||null)}else r[a]=t[i];delete r[i]}}return r}o(Pt,"pipedriveTransformV1CustomFields");var E=Rn.OAuth2({description:"",authUrl:"https://oauth.pipedrive.com/oauth/authorize",tokenUrl:"https://oauth.pipedrive.com/oauth/token",required:!0,scope:["base","admin","contacts:full","users:read","deals:full","activities:full","leads:full","products:full","webhooks:full"]});var Bu=ie({auth:E,name:"new_activity",displayName:"New Activity",description:"Triggers when a new activity is added",aiMetadata:{description:"Fires when a new activity is added in Pipedrive. An activity is a scheduled task or event (call, meeting, deadline, email, etc.) with a subject, type, due date/time, and optional links to a deal, person, organization, or lead. Use to react when work or appointments are scheduled in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("activity","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_activity_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_activity_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=e.payload.body;return[(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/activities/${t.data.id}`,query:{include_fields:"attendees"}})).data]},sampleData:{id:8,owner_id:1234,done:!1,type:"deadline",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy:!0,add_time:"2020-06-08T12:37:56Z",marked_as_done_time:"2020-08-08T08:08:38Z",subject:"Deadline",public_description:"This is a description",location:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",is_deleted:!1,update_time:"2020-08-08T12:37:56Z",note:"A note for the activity",creator_user_id:1234,attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary:!1},{person_id:1101,primary:!0}]}});var Me=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","participant_open_deals_count","participant_closed_deals_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","related_won_deals_count","lost_deals_count","related_lost_deals_count","last_incoming_mail_time","last_outgoing_mail_time","won_deals_count"],Ie=["next_activity_id","last_activity_id","first_won_time","products_count","files_count","notes_count","followers_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","participants_count","last_incoming_mail_time","last_outgoing_mail_time","smart_bcc_email"],Le=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","email_messages_count","people_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","won_deals_count","related_won_deals_count","lost_deals_count","related_lost_deals_count"];var Zu=ie({auth:E,name:"new_deal",displayName:"New Deal",description:"Triggers when a new deal is created.",aiMetadata:{description:"Fires the moment a new deal record is created in Pipedrive, representing a sales opportunity (with its title, value, currency, owner, associated person/organization, pipeline and stage). Use to start automations whenever a deal enters the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_deal_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_deal_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${t.data.id}`,query:{include_fields:Ie.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(n,r.data)]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",custom_fields:{d4de1c1518b4531717c676029a45911c340390a6:{value:2300,currency:"EUR"}}}});var Gu=ie({auth:E,name:"new_person",displayName:"New Person",description:"Triggers when a new person is created",aiMetadata:{description:"Fires the moment a new person (contact) record is created in Pipedrive, with their name, emails, phones, owner, associated organization, labels, and custom fields. Use to start automations whenever a contact is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_person_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_person_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Me.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var qu=ie({auth:E,name:"updated_deal",displayName:"Updated Deal",description:"Triggers when a deal is updated.",aiMetadata:{description:"Fires when any field of an existing deal changes in Pipedrive, such as its value, status, owner, stage, or custom fields. Can optionally be scoped to changes on a specific deal, pipeline, or stage. Use to react to edits on sales opportunities in the CRM."},props:{filter_by:g.StaticDropdown({displayName:"Filter by",required:!1,options:{disabled:!1,options:[{label:"Deal Status",value:"status"},{label:"Stage in Pipeline",value:"stage_id"}]}}),filter_by_field_value:g.DynamicProperties({auth:E,displayName:"Field Values",required:!1,refreshers:["filter_by"],props:o(async({auth:e,filter_by:t})=>{if(!e||!t)return{};let r={},n=e,i=t;if(i==="status"&&(r.field_value=g.StaticDropdown({displayName:"Deal Status",required:!0,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}})),i==="stage_id"){let a=await $e.sendRequest({method:"GET",url:`${n.data.api_domain}/api/v2/stages`,authentication:{type:"BEARER_TOKEN",token:n.access_token}});r.field_value=g.StaticDropdown({displayName:"Stage in Pipeline",required:!0,options:{disabled:!1,options:a.body.data.map(s=>({label:s.name,value:s.id}))}})}return r},"props")}),field_to_watch:g.Dropdown({auth:E,displayName:"Field to watch for Changes On",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"Connect your account",disabled:!0,options:[]};let t=e,r=await $e.sendRequest({method:"GET",url:`${t.data.api_domain}/api/v1/dealFields`,authentication:{type:"BEARER_TOKEN",token:t.access_token}}),n=[];for(let i of r.body.data)n.push({label:i.name,value:i.key});return{disabled:!1,options:n}},"options")})},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_deal_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_deal_trigger");t&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")};t&&r&&(n[t]=r);let i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:n});if(A(i.data))return[];let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),s=[];for(let c of i.data){let d=R(a,c);s.push(d)}return s},async run(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n=e.propsValue.field_to_watch==="label"?"label_ids":e.propsValue.field_to_watch,i=e.payload.body,a=Hu(i.data),s=Hu(i.previous),c=!t&&!n,d=n&&n in s&&a[n]!==s[n],p=t&&a[t]===r;if(c||!t&&d||p&&(!n||d)){let _=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${i.data.id}`,query:{include_fields:Ie.join(",")}}),x=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(x,_.data)]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com"}});function Hu(e){let{custom_fields:t,...r}=e;if(!t)return r;let n={};for(let[i,a]of Object.entries(t)){if(A(a)){n[i]=a;continue}switch(a.type){case"varchar":case"text":case"varchar_auto":case"double":case"phone":case"date":n[i]=a?.value;break;case"set":n[i]=a?.values?.length?a.values.map(c=>c.id).join(","):"";break;case"enum":case"user":case"org":case"people":n[i]=a?.id;break;case"monetary":n[i]=a?.value,n[`${i}_currency`]=a?.currency;break;case"time":n[i]=a?.value,n[`${i}_timezone_id`]=a?.timezone_id;break;case"timerange":n[i]=a?.from,n[`${i}_timezone_id`]=a?.timezone_id,n[`${i}_until`]=a?.until;break;case"daterange":n[i]=a?.from,n[`${i}_until`]=a?.until;break;case"address":n[i]=a?.value,n[`${i}_subpremise`]=a?.subpremise,n[`${i}_street_number`]=a?.street_number,n[`${i}_route`]=a?.route,n[`${i}_sublocality`]=a?.sublocality,n[`${i}_locality`]=a?.locality,n[`${i}_admin_area_level_1`]=a?.admin_area_level_1,n[`${i}_admin_area_level_2`]=a?.admin_area_level_2,n[`${i}_country`]=a?.country,n[`${i}_postal_code`]=a?.postal_code,n[`${i}_formatted_address`]=a?.formatted_address;break}}return{...r,...n}}o(Hu,"flattenCustomFields");var Wu=ie({auth:E,name:"updated_person",displayName:"Updated Person",description:"Triggers when a person is updated.",aiMetadata:{description:"Fires when any field of an existing person (contact) record changes in Pipedrive, such as their name, emails, phones, owner, associated organization, labels, or custom fields. Use to react to edits on contact records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_person_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_person_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Me.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Ku=ie({auth:E,name:"new-lead",displayName:"New Lead",description:"Triggers when a new lead is created.",aiMetadata:{description:"Fires when a new lead is created in Pipedrive. A lead is an early, unqualified sales opportunity (with a title, optional value, source, and links to a person or organization) that has not yet been converted into a deal. Use to act on inbound prospects as they enter the leads inbox."},props:{},type:"WEBHOOK",async onEnable(e){let t=await $e.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},body:{event_object:"lead",event_action:"create",subscription_url:e.webhookUrl,version:"2.0"}});await e.store?.put("_new_lead_trigger",{webhookId:t.body.data.id})},async onDisable(e){let t=await e.store?.get("_new_lead_trigger");t!==null&&!A(t.webhookId)&&await $e.sendRequest({method:"DELETE",url:`${e.auth.data.api_domain}/api/v1/webhooks/${t.webhookId}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}})},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/leads",query:{limit:10,sort:"update_time DESC"}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),n=[];for(let i of t.data){let a=Pt(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/leads/${t.data.id}`}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[Pt(n,r.data)]},sampleData:{id:"f3c23480-c9b1-11ef-bc83-2b8218e028ef",title:"Test lead",owner_id:22701301,creator_id:22701301,label_ids:["a0e5f330-d2a7-4181-a6e3-a44d634b7bf7","8a0e6918-1eee-4e56-a615-c81d712a6a77"],value:null,expected_close_date:null,person_id:2,organization_id:1,is_archived:!1,source_name:"Manually created",origin:"ManuallyCreated",origin_id:null,channel:1,channel_id:null,was_seen:!0,next_activity_id:null,add_time:"2025-01-03T09:06:00.776Z",update_time:"2025-01-03T09:06:00.776Z",visible_to:3}});var Ju=ie({auth:E,name:"new-organization",displayName:"New Organization",description:"Triggers when a new organization is created.",aiMetadata:{description:"Fires the moment a new organization (company) record is created in Pipedrive, with its name, owner, address, labels, and custom fields. Use to start automations whenever a company is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_organization_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Le.join(",")}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Le.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var Yu=ie({auth:E,name:"updated-organization",displayName:"Updated Organization",description:"Triggers when an existing organization is updated.",aiMetadata:{description:"Fires when any field of an existing organization (company) record changes in Pipedrive, such as its name, owner, address, labels, or custom fields. Use to react to edits on company records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_organization_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Le.join(",")}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Le.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var Xu=ie({auth:E,name:"updated-deal-stage",displayName:"Updated Deal Stage",description:"Triggers when a deal's stage is updated.",aiMetadata:{description:"Fires when an existing deal moves from one pipeline stage to another (its stage_id changes). Represents progress of a deal through the sales pipeline; can optionally be limited to a specific stage. Use to react when deals advance, regress, or reach a particular stage."},type:"WEBHOOK",props:{stage_id:g.Dropdown({auth:E,displayName:"Stage in Pipeline",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"please connect your account.",disabled:!0,options:[]};let t=e,r=await ye({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),n=[];for(let i of r)n.push({label:`${i.name}`,value:i.id});return{disabled:!1,options:n}},"options")})},async onEnable(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/webhooks",body:{subscription_url:e.webhookUrl,event_object:"deal",event_action:"change",version:"2.0"}});await e.store.put("updated-deal-stage-trigger",t.data.id)},async onDisable(e){let t=await e.store.get("updated-deal-stage-trigger");t&&await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/webhooks/${t}`})},async test(e){let t=e.propsValue.stage_id,r={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")};t&&(r.stage_id=t.toString());let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:r});if(A(n.data))return[];let i=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),a=[];for(let s of n.data){let c=R(i,s),d=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${c.stage_id}`});c.stage=d.data,a.push(c)}return a},async run(e){let t=e.propsValue.stage_id,r=e.payload.body,n=r.data,i=r.previous;if(!i||A(i.stage_id))return[];if(n.stage_id!==i.stage_id){if(t&&n.stage_id!==t)return[];let a=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${r.data.id}`,query:{include_fields:Ie.join(",")}}),s=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=R(s,a.data),d=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${n.stage_id}`});return c.stage=d.data,[c]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",stage:{id:2,order_nr:1,name:"Qualification",is_deleted:!1,deal_probability:!1,pipeline_id:1,is_deal_rot_enabled:!1,days_to_rotten:null,add_time:"2018-09-04T06:24:59Z",update_time:null}}});async function Pf(e,t){let r=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/filters",query:{type:t}}),n=[];for(let i of r.data)n.push({label:i.name,value:i.id});return n}o(Pf,"fetchFiltersOptions");async function xf(e){let t=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/activityTypes"}),r=[];for(let n of t.data)r.push({label:n.name,value:n.key_string});return r}o(xf,"fetchActivityTypesOptions");async function Tf(e){let t=await ye({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v2/pipelines"}),r=[];for(let n of t)r.push({label:n.name,value:n.id});return r}o(Tf,"fetchPipelinesOptions");async function If(e){let t=await T({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/users:(id,email)"}),r=[];for(let n of t.data)r.push({label:n.email,value:n.id});return r}o(If,"fetchOwnersOptions");function Qu(e){switch(e.field_type){case"varchar":case"varchar_auto":case"phone":return g.ShortText({displayName:e.name,required:!1});case"text":case"address":return g.LongText({displayName:e.name,required:!1});case"enum":return g.StaticDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"set":return g.StaticMultiSelectDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"double":case"monetary":return g.Number({displayName:e.name,required:!1});case"time":case"timerange":return g.ShortText({displayName:e.name,description:"Please enter time in HH:mm:ss format.",required:!1});case"int":return g.Number({displayName:e.name,required:!1});case"date":case"daterange":return g.DateTime({displayName:e.name,description:"Please enter date in YYYY-MM-DD format.",required:!1});default:return null}}o(Qu,"createPropertyDefinition");async function Ef(e,t){let r="";switch(t){case"person":r="/v1/personFields";break;case"deal":case"lead":r="/v1/dealFields";break;case"organization":r="/v1/organizationFields";break;case"product":r="/v1/productFields";break}let n=await $({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:r}),i={};for(let a of n){if(!a.edit_flag)continue;let s=Qu(a);s&&(i[a.key]=s)}return i}o(Ef,"retrieveObjectCustomProperties");var Ut=o(e=>g.Dropdown({auth:E,displayName:"Field to search by",required:!0,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n="";switch(e){case"person":n="/v1/personFields";break;case"deal":case"lead":n="/v1/dealFields";break;case"organization":n="/v1/organizationFields";break;case"product":n="/v1/productFields";break}let i=await $({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:n}),a=[];for(let s of i)A(s.id)||a.push({label:s.name,value:s.id.toString()});return{disabled:!1,options:a}},"options")}),"searchFieldProp"),Mt=o(e=>g.DynamicProperties({auth:E,displayName:"Field Value",required:!0,refreshers:["searchField"],props:o(async({auth:t,searchField:r})=>{if(!t||!r)return{};let n=t,i={},a="";switch(e){case"person":a="/v1/personFields";break;case"deal":case"lead":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break;case"product":a="/v1/productFields";break}let s=await T({accessToken:n.access_token,apiDomain:n.data.api_domain,method:"GET",resourceUri:`${a}/${r}`}),c=s.data.field_type==="set"?g.StaticDropdown({displayName:s.data.name,required:!1,options:{disabled:!1,options:s.data.options?s.data.options.map(d=>({label:d.label,value:d.id.toString()})):[]}}):Qu(s.data);return c?i.field_value=c:i.field_value=g.ShortText({displayName:s.data.name,required:!1}),i},"props")}),"searchFieldValueProp"),Oe=o((e,t=!1)=>g.Dropdown({auth:E,displayName:e,refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await If(r)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"ownerIdProp"),Ze=o((e,t=!1)=>g.Dropdown({auth:E,displayName:"Filter",refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await Pf(r,e)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"filterIdProp"),Ge=o((e=!1)=>g.Number({displayName:"Organization ID",description:"You can use Find Organization action to retrieve org ID.",required:e}),"organizationIdProp"),Af=o((e=!1)=>g.Dropdown({auth:E,displayName:"Pipeline",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await Tf(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"dealPipelineIdProp"),Sf=o((e=!1)=>g.Dropdown({auth:E,displayName:"Stage",description:"If a stage is chosen above, the pipeline field will be ignored.",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{placeholder:"Please connect your account.",disabled:!0,options:[]};let r=t,n=await ye({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),i=[];for(let a of n)i.push({label:`${a.name}`,value:a.id});return{disabled:!1,options:i}},"options")}),"dealStageIdProp"),De=o((e=!1)=>g.Number({displayName:"Person ID",description:"You can use Find Person action to retrieve person ID.",required:e}),"personIdProp"),lr=o((e,t,r=!1)=>g.MultiSelectDropdown({auth:E,displayName:"Label",required:r,refreshers:[],options:o(async({auth:n})=>{if(!n)return{disabled:!0,options:[],placeholder:"Please connect your account."};let i=n,a="";switch(e){case"person":a="/v1/personFields";break;case"deal":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break}let c=(await $({accessToken:i.access_token,apiDomain:i.data.api_domain,method:"GET",resourceUri:a})).find(p=>p.key===t),d=[];if(c&&c.options)for(let p of c.options)d.push({label:p.label,value:p.id});return{disabled:!1,options:d}},"options")}),"labelIdsProp"),$f=o((e=!1)=>g.MultiSelectDropdown({auth:E,displayName:"Label",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n=await T({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v1/leadLabels"}),i=[];for(let a of n.data)i.push({label:`${a.name} (${a.color})`,value:a.id});return{disabled:!1,options:i}},"options")}),"leadLabelIdsProp"),qr=o((e=!1)=>g.Number({displayName:"Product ID",description:"You can use Find Product action to retrieve product ID.",required:e}),"productIdProp"),lt=g.StaticDropdown({displayName:"Visible To",required:!1,options:{disabled:!1,options:[{label:"Owner & followers",value:1},{label:"Entire company",value:3}]}}),dr=o((e=!1)=>g.ShortText({displayName:"Lead ID",required:e}),"leadIdProp"),di=o((e=!1)=>g.Dropdown({auth:E,displayName:"Activity Type",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await xf(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"activityTypeIdProp"),Xe=o((e=!1)=>g.Number({displayName:"Deal ID",description:"You can use Find Deal action to retrieve deal ID.",required:e}),"dealIdProp"),Wr={creationTime:g.DateTime({displayName:"Creation Time",required:!1}),status:g.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}}),stageId:Sf(!1),pipelineId:Af(!1),ownerId:Oe("Owner",!1),organizationId:Ge(!1),personId:De(!1),labelIds:lr("deal","label",!1),probability:g.Number({displayName:"Probability",required:!1}),expectedCloseDate:g.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dealValue:g.Number({displayName:"Value",required:!1}),dealValueCurrency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),visibleTo:lt,customfields:dt("deal")},Kr={ownerId:Oe("Owner",!1),organizationId:Ge(!1),personId:De(!1),labelIds:$f(!1),expectedCloseDate:g.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),visibleTo:lt,channel:g.Dropdown({auth:E,displayName:"Channel",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your account."};let t=e,n=(await $({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v1/dealFields:(key,name,options)"})).find(a=>a.key==="channel"),i=[];if(n)for(let a of n.options??[])i.push({label:a.label,value:a.id});return{disabled:!1,options:i}},"options")}),leadValue:g.Number({displayName:"Lead Value Amount",required:!1}),leadValueCurrency:g.ShortText({displayName:"Lead Value Currency",required:!1,description:'The currency of the lead value (e.g., "USD", "EUR").'}),customfields:dt("lead")},Jr={ownerId:Oe("Owner",!1),visibleTo:lt,labelIds:lr("organization","label_ids",!1),address:g.LongText({displayName:"Address",required:!1}),customfields:dt("organization")},Yr={ownerId:Oe("Owner",!1),organizationId:Ge(!1),email:g.Array({displayName:"Email",required:!1}),phone:g.Array({displayName:"Phone",required:!1}),labelIds:lr("person","label_ids",!1),firstName:g.ShortText({displayName:"First Name",required:!1}),lastName:g.ShortText({displayName:"Last Name",required:!1}),visibleTo:lt,marketing_status:g.StaticDropdown({displayName:"Marketing Status",description:"Marketing opt-in status",required:!1,options:{disabled:!1,options:[{label:"No Consent",value:"no_consent"},{label:"Unsubscribed",value:"unsubscribed"},{label:"Subscribed",value:"subscribed"},{label:"Archived",value:"archived"}]}}),customfields:dt("person")},Xr={organizationId:Ge(!1),personId:De(!1),dealId:Xe(!1),leadId:dr(!1),assignTo:Oe("Assign To",!1),type:di(!1),dueDate:g.DateTime({displayName:"Due Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dueTime:g.ShortText({displayName:"Due Time",required:!1,description:"Please enter time in HH:MM format."}),duration:g.ShortText({displayName:"Duration",required:!1,description:'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).'}),isDone:g.Checkbox({displayName:"Mark as Done?",required:!1,defaultValue:!1}),busy:g.StaticDropdown({displayName:"Free or Busy",required:!1,options:{disabled:!1,options:[{label:"Free",value:"free"},{label:"Busy",value:"busy"}]}}),note:g.LongText({displayName:"Note",required:!1}),publicDescription:g.LongText({displayName:"Public Description",required:!1})};function dt(e){return g.DynamicProperties({auth:E,displayName:"Custom Fields",required:!1,refreshers:[],props:o(async({auth:t})=>t?await Ef(t,e):{},"props")})}o(dt,"customFieldsProp");var ec=D({auth:E,name:"create-person",displayName:"Create Person",description:"Creates a new person.",audience:"both",aiMetadata:{description:"Creates a new person (contact) with a name, optional emails/phones, owner, organization, and custom fields. Provide either a single Name or First/Last Name, not both. Use to add a contact (use Update Person to edit an existing one, or Find Person to check for one first). Not idempotent: each call creates a separate person, so guard against duplicates.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!1}),...Yr},async run(e){let{name:t,ownerId:r,organizationId:n,marketing_status:i,visibleTo:a,firstName:s,lastName:c}=e.propsValue,d=e.propsValue.phone??[],p=e.propsValue.email??[],_=e.propsValue.labelIds??[],x=e.propsValue.customfields??{};if(t&&(s||c))throw new Error("Provide either Name OR First Name/Last Name, not both.");if(!t&&!s&&!c)throw new Error("Provide Name or at least one of First Name / Last Name.");if(!t&&(s&&!c||!s&&c))throw new Error("If First Name is provided, Last Name must be provided as well.");let b=d.map((O,te)=>({value:O,label:"work",primary:te===0})),l=p.map((O,te)=>({value:O,label:"work",primary:te===0})),m={name:t,owner_id:r,org_id:n,visible_to:a,first_name:s,last_name:c,marketing_status:i};b.length&&(m.phones=b),l.length&&(m.emails=l),_.length&&(m.label_ids=_);let h=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),f=Te(h,x);ce(f)||(m.custom_fields=f);let v=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/persons",body:m}),I=R(h,v.data);return{...v,data:I}}});var tc=D({auth:E,name:"update-person",displayName:"Update Person",description:"Updates an existing person.",audience:"both",aiMetadata:{description:"Updates fields on an existing person identified by their person ID, such as name, emails, phones, owner, organization, and custom fields; only supplied fields change. Use to edit a contact you have the ID for (use Create Person to add one, or Find Person to locate it). Idempotent: repeating the same update converges to the same person state.",idempotent:!0},props:{personId:De(!0),name:g.ShortText({displayName:"Name",required:!1}),...Yr},async run(e){let{name:t,ownerId:r,personId:n,organizationId:i,marketing_status:a,visibleTo:s,firstName:c,lastName:d}=e.propsValue,p=e.propsValue.phone??[],_=e.propsValue.email??[],x=e.propsValue.labelIds??[],b=e.propsValue.customfields??{};if(c&&!d||!c&&d)throw new Error("If First Name is provided, Last Name must be provided as well.");let l=p.map((te,ve)=>({value:te,label:"work",primary:ve===0})),m=_.map((te,ve)=>({value:te,label:"work",primary:ve===0})),h={name:t,owner_id:r,org_id:i,marketing_status:a,visible_to:s,first_name:c,last_name:d};l.length&&(h.phones=l),m.length&&(h.emails=m),x.length&&(h.label_ids=x);let f=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),v=Te(f,b);ce(v)||(h.custom_fields=v);let I=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${n}`,body:h}),O=R(f,I.data);return{...I,data:O}}});var rc=D({auth:E,name:"create-organization",displayName:"Create Organization",description:"Creates a new organization.",audience:"both",aiMetadata:{description:"Creates a new organization (company) with a required name and optional owner, address, visibility, labels, and custom fields. Use to add a company record (use Update Organization to edit one, or Find Organization to check for an existing match). Not idempotent: each call creates a separate organization, so guard against duplicates.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!0}),...Jr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i}=e.propsValue,a=e.propsValue.labelIds??[],s=e.propsValue.customfields??{},c={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(c.address={value:n}),a.length>0&&(c.label_ids=a);let d=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),p=Te(d,s);ce(p)||(c.custom_fields=p);let _=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/organizations",body:c}),x=R(d,_.data);return{..._,data:x}}});var nc=D({auth:E,name:"update-organization",displayName:"Update Organization",description:"Updates an existing organization.",audience:"both",aiMetadata:{description:"Update fields on an existing organization identified by ID (name, owner, address, visibility, labels, and custom fields). Pick this to modify a known organization; only supplied fields are changed. Re-running with the same inputs yields the same final state.",idempotent:!0},props:{organizationId:Ge(!0),name:g.ShortText({displayName:"Name",required:!1}),...Jr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i,organizationId:a}=e.propsValue,s=e.propsValue.labelIds??[],c=e.propsValue.customfields??{},d={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(d.address={value:n}),s.length>0&&(d.label_ids=s);let p=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),_=Te(p,c);ce(_)||(d.custom_fields=_);let x=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/organizations/${a}`,body:d}),b=R(p,x.data);return{...x,data:b}}});var ic=Se(ct()),oc=D({auth:E,name:"create-lead",displayName:"Create Lead",description:"Creates a new lead.",audience:"both",aiMetadata:{description:"Creates a new lead with a required title and optional value, owner, channel, and custom fields. At least one of a linked person or organization must be supplied. Use to capture an unqualified opportunity (use Create Deal once it advances to your pipeline, or Update Lead to edit one). Not idempotent: each call creates a separate lead.",idempotent:!1},props:{title:g.ShortText({displayName:"Title",required:!0}),...Kr},async run(e){let{title:t,leadValue:r,leadValueCurrency:n,expectedCloseDate:i,visibleTo:a,ownerId:s,organizationId:c,personId:d,channel:p}=e.propsValue;if(!d&&!c)throw new Error("Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.");let _=e.propsValue.labelIds??[],x=e.propsValue.customfields??{},b={title:t,owner_id:s,organization_id:c,person_id:d,channel:p,visible_to:a};if(_.length>0&&(b.label_ids=_),i&&(b.expected_close_date=(0,ic.default)(i).format("YYYY-MM-DD")),r){if(!n)throw new Error("lead Value Currency is required when lead Value is provided");b.value={amount:r,currency:n}}let l={};Object.entries(x).forEach(([v,I])=>{l[v]=Array.isArray(I)?I.join(","):I});let m=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/leads",body:{...b,...l}}),h=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),f=Pt(h,m.data);return{...m,data:f}}});var ac=Se(ct()),sc=D({auth:E,name:"update-lead",displayName:"Update Lead",description:"Updates an existing lead.",audience:"both",aiMetadata:{description:"Updates fields on an existing lead identified by its lead ID, such as title, owner, value, channel, or linked person/organization; only supplied fields change. Use to modify a lead you have the ID for (use Create Lead to add one, or Find Lead to locate it). Idempotent: repeating the same update converges to the same lead state.",idempotent:!0},props:{leadId:dr(!0),title:g.ShortText({displayName:"Title",required:!1}),...Kr},async run(e){let{title:t,ownerId:r,leadId:n,channel:i,organizationId:a,personId:s,expectedCloseDate:c,visibleTo:d,leadValue:p,leadValueCurrency:_}=e.propsValue,x=e.propsValue.labelIds??[],b=e.propsValue.customfields??{},l={title:t,owner_id:r,organization_id:a,person_id:s,channel:i,visible_to:d};if(x.length>0&&(l.label_ids=x),c&&(l.expected_close_date=(0,ac.default)(c).format("YYYY-MM-DD")),p){if(!_)throw new Error("lead Value Currency is required when lead Value is provided");l.value={amount:p,currency:_}}let m={};Object.entries(b).forEach(([I,O])=>{m[I]=Array.isArray(O)&&O.length>0?O.join(","):O});let h=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v1/leads/${n}`,body:{...l,...m}}),f=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),v=Pt(f,h.data);return{...h,data:v}}});var pi=Se(ct());var uc=D({auth:E,name:"create-deal",displayName:"Create Deal",description:"Creates a new deal.",audience:"both",aiMetadata:{description:"Creates a new deal with a required title and optional value, currency, pipeline/stage, status, owner, and linked person/organization. Use to add a sales opportunity to a pipeline (use Update Deal to edit one, or Add Product to Deal to attach line items). Not idempotent: each call creates a separate deal, so guard against duplicates.",idempotent:!1},props:{title:g.ShortText({displayName:"Title",required:!0}),...Wr},async run(e){let{title:t,dealValue:r,dealValueCurrency:n,expectedCloseDate:i,visibleTo:a,probability:s,stageId:c,status:d,pipelineId:p,ownerId:_,organizationId:x,personId:b,creationTime:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},f={title:t,pipeline_id:p,stage_id:c,status:d,add_time:l?(0,pi.default)(l).format("YYYY-MM-DDTHH:mm:ss[Z]"):void 0,probability:s,visible_to:a,owner_id:_,org_id:x,person_id:b,value:r,currency:n};m.length>0&&(f.label_ids=m),i&&(f.expected_close_date=(0,pi.default)(i).format("YYYY-MM-DD"));let v=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),I=Te(v,h);ce(I)||(f.custom_fields=I);let O=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/deals",body:f}),te=R(v,O.data);return{...O,data:te}}});var cc=Se(ct());var lc=D({auth:E,name:"update-deal",displayName:"Update Deal",description:"Updates an existing deal.",audience:"both",aiMetadata:{description:"Updates fields on an existing deal identified by its deal ID, such as title, value, stage, status, owner, or linked person/organization; only supplied fields are changed. Use to modify a deal you already know the ID of (use Create Deal to add a new one, or Find Deal to locate one first). Idempotent: repeating the same update converges to the same deal state.",idempotent:!0},props:{dealId:Xe(!0),title:g.ShortText({displayName:"Title",required:!1}),...Wr},async run(e){let{dealId:t,title:r,dealValue:n,dealValueCurrency:i,expectedCloseDate:a,visibleTo:s,probability:c,stageId:d,status:p,pipelineId:_,ownerId:x,organizationId:b,personId:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},f={title:r,pipeline_id:_,stage_id:d,status:p,probability:c,visible_to:s,owner_id:x,org_id:b,person_id:l,value:n,currency:i};m.length>0&&(f.label_ids=m),a&&(f.expected_close_date=(0,cc.default)(a).format("YYYY-MM-DD"));let v=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),I=Te(v,h);ce(I)||(f.custom_fields=I);let O=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/deals/${t}`,body:f}),te=R(v,O.data);return{...O,data:te}}});var dc=D({auth:E,name:"create-product",displayName:"Create Product",description:"Creates a new product.",audience:"both",aiMetadata:{description:"Create a new product in the catalog with name, code, pricing (price/cost/overhead/currency/tax), unit, owner, visibility, and custom fields. Pick this to add a product; each call creates a separate record, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{name:g.ShortText({displayName:"Name",required:!0}),code:g.ShortText({displayName:"Code",required:!1}),description:g.LongText({displayName:"Description",required:!1}),unit:g.ShortText({displayName:"Unit",required:!1}),tax:g.Number({displayName:"Tax percentage",required:!1}),isActive:g.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Oe("Owner",!1),currency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:g.Number({displayName:"Price",required:!1}),cost:g.Number({displayName:"Cost",required:!1}),overheadCost:g.Number({displayName:"Overhead Cost",required:!1}),visibleTo:lt,customfields:dt("product")},async run(e){let{name:t,code:r,description:n,unit:i,tax:a,isActive:s,ownerId:c,currency:d,price:p,cost:_,overheadCost:x,visibleTo:b}=e.propsValue,l=e.propsValue.customfields??{},m={name:t,code:r,description:n,unit:i,tax:a,is_deleted:!s,prices:[{price:p??0,currency:d??"USD",cost:_??0,direct_cost:x??0}],visible_to:b};c&&(m.owner_id=c);let h=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),f=Te(h,l);ce(f)||(m.custom_fields=f);let v=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/products",body:m}),I=R(h,v.data);return{...v,data:I}}});var pc=D({auth:E,name:"add-product-to-deal",displayName:"Add Product to Deal",description:"Adds a product to a deal.",audience:"both",aiMetadata:{description:"Attaches an existing product (by product ID) as a line item on a deal (by deal ID), setting its unit price, quantity, and optional discount and tax. Use when building out the products on a deal; requires both IDs and a price and quantity. Not idempotent: each call adds another line item, so calling it twice attaches the product twice.",idempotent:!1},props:{dealId:Xe(!0),productId:qr(!0),price:g.Number({displayName:"Price",required:!0}),quantity:g.Number({displayName:"Quantity",required:!0}),discount:g.Number({displayName:"Discount",required:!1}),discountType:g.StaticDropdown({displayName:"Discount Type",required:!1,options:{disabled:!1,options:[{label:"Percentage",value:"percentage"},{label:"Amount",value:"amount"}]}}),comments:g.LongText({displayName:"Comments",required:!1}),enableProduct:g.Checkbox({displayName:"Enable Product?",required:!1,defaultValue:!0}),taxMethod:g.StaticDropdown({displayName:"Tax Method",required:!1,options:{disabled:!1,options:[{label:"Exclusive",value:"exclusive"},{label:"Inclusive",value:"inclusive"},{label:"None",value:"none"}]}}),taxPercentage:g.Number({displayName:"Tax Percentage",required:!1})},async run(e){let{productId:t,dealId:r,price:n,quantity:i,discountType:a,discount:s,comments:c,enableProduct:d,taxPercentage:p,taxMethod:_}=e.propsValue;return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2/deals/${r}/products`,body:{product_id:t,item_price:n,quantity:i,discount_type:a,discount:s,comments:c??"",is_enabled:d,tax:p,tax_method:_}})}});var mc=D({auth:E,name:"add-labels-to-person",displayName:"Add Labels to Person",description:"Adds existing labels to an existing person.",audience:"both",aiMetadata:{description:"Set the label(s) on an existing person by ID using pre-existing label definitions. Pick this to tag/categorize a known person; it replaces the person's label_ids with the supplied set rather than merging, so include all labels that should remain. Mutates the person record.",idempotent:!1},props:{personId:De(!0),labelIds:lr("person","label_ids",!0)},async run(e){let{personId:t}=e.propsValue,r=e.propsValue.labelIds??[],n={};r.length>0&&(n.label_ids=r);let i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${t}`,body:{...n}}),a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),s=R(a,i.data);return{...i,data:s}}});var fc=Se(ct()),gc=D({auth:E,name:"create-activity",displayName:"Create Activity",description:"Creates a new activity.",audience:"both",aiMetadata:{description:"Creates an activity (call, meeting, task, etc.) with a subject and optional type, due date/time, owner, and links to a deal, lead, person, or organization. Use to schedule or log work against CRM records (use Update Activity to change one that exists). Not idempotent: each call creates a separate activity.",idempotent:!1},props:{subject:g.ShortText({displayName:"Subject",required:!0}),...Xr},async run(e){let{subject:t,organizationId:r,personId:n,dealId:i,leadId:a,assignTo:s,type:c,dueDate:d,dueTime:p,duration:_,isDone:x,busy:b,note:l,publicDescription:m}=e.propsValue,h={subject:t,org_id:r,deal_id:i,lead_id:a,public_description:m,type:c,owner_id:s,due_time:p,duration:_,done:x,note:l};return n&&(h.participants=[{person_id:n,primary:!0}]),b&&(h.busy=b==="busy"),d&&(h.due_date=(0,fc.default)(d).format("YYYY-MM-DD")),await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/activities",body:h})}});var yc=Se(ct()),hc=D({auth:E,name:"update-activity",displayName:"Update Activity",description:"Updates an existing activity.",audience:"both",aiMetadata:{description:"Updates fields on an existing activity identified by its activity ID, such as subject, type, due date/time, owner, done state, and linked records; only supplied fields change. Use to reschedule or mark an activity done (use Create Activity to add a new one). Idempotent: repeating the same update converges to the same activity state.",idempotent:!0},props:{activityId:g.Number({displayName:"Activity ID",required:!0}),subject:g.ShortText({displayName:"Subject",required:!1}),...Xr},async run(e){let{activityId:t,subject:r,organizationId:n,personId:i,dealId:a,leadId:s,assignTo:c,type:d,dueDate:p,dueTime:_,duration:x,isDone:b,busy:l,note:m,publicDescription:h}=e.propsValue,f={subject:r,org_id:n,deal_id:a,lead_id:s,note:m,public_description:h,type:d,owner_id:c,due_time:_,duration:x,done:b};return i&&(f.participants=[{person_id:i,primary:!0}]),l&&(f.busy=l==="busy"),p&&(f.due_date=(0,yc.default)(p).format("YYYY-MM-DD")),await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/activities/${t}`,body:f})}});var _c=Se(oi());var vc=D({auth:E,name:"attach-file",displayName:"Attach File",description:"Uploads a file and attaches it to a deal,person,organization,activity or product.",audience:"both",aiMetadata:{description:"Uploads a file and attaches it to one or more CRM records by supplying any of the optional deal, person, organization, product, or activity IDs. Use to add documents or images to existing records; requires the file content and a file name. Not idempotent: each call uploads and creates a separate file attachment.",idempotent:!1},props:{file:g.File({displayName:"File",required:!0}),fileName:g.ShortText({displayName:"File Name",required:!0}),dealId:Xe(!1),personId:De(!1),organizationId:Ge(!1),productId:qr(!1),activityId:g.Number({displayName:"Activity ID",required:!1})},async run(e){let{file:t,fileName:r,dealId:n,personId:i,organizationId:a,productId:s,activityId:c}=e.propsValue,d=new _c.default;return d.append("file",t.data,r),n&&d.append("deal_id",n),i&&d.append("person_id",i),a&&d.append("org_id",a),s&&d.append("product_id",s),c&&d.append("activity_id",c),(await $e.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/files`,body:d,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{...d.getHeaders()}})).body}});var bc=D({auth:E,name:"add-follower",displayName:"Add Follower",description:"Adds a follower to a deal, person, organization or product.",audience:"both",aiMetadata:{description:"Adds a user as a follower of a single record, with the Target Object dropdown selecting the type (deal, person, organization, or product) and the Target Object ID identifying it. Use to subscribe a user to updates on a record; requires the follower user ID. Not idempotent: each call creates a follower association.",idempotent:!1},props:{followerId:Oe("Follower",!0),entity:g.StaticDropdown({displayName:"Target Object",description:"Type of object to add the follower to.",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal"},{label:"Person",value:"person"},{label:"Organization",value:"organization"},{label:"Product",value:"product"}]}}),entityId:g.ShortText({displayName:"Target Object ID",description:"ID of the object to add the follower to.",required:!0})},async run(e){let{followerId:t,entity:r,entityId:n}=e.propsValue,i="";switch(r){case"deal":i=`/deals/${n}/followers`;break;case"organization":i=`/organizations/${n}/followers`;break;case"person":i=`/persons/${n}/followers`;break;case"product":i=`/products/${n}/followers`;break}if(!i)throw new Error(`Invalid object type: ${r}`);return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2${i}`,body:{user_id:t}})}});var Pc=D({auth:E,name:"create-note",displayName:"Create Note",description:"Creates a new note.",audience:"both",aiMetadata:{description:"Create a note with the given content and attach it to at least one deal, person, organization, or lead (at least one association is required, with optional pinning). Pick this to record a comment or log against a CRM record; each call creates a new note, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{content:g.LongText({displayName:"Content",required:!0}),dealId:Xe(!1),pinnedToDeal:g.Checkbox({displayName:"Pin note to deal?",required:!1,defaultValue:!1}),personId:De(!1),pinnedToPerson:g.Checkbox({displayName:"Pin note to person?",required:!1,defaultValue:!1}),organizationId:Ge(!1),pinnedToOrganization:g.Checkbox({displayName:"Pin note to organization?",required:!1,defaultValue:!1}),leadId:dr(!1),pinnedToLead:g.Checkbox({displayName:"Pin note to lead?",required:!1,defaultValue:!1})},async run(e){let{content:t,dealId:r,personId:n,organizationId:i,leadId:a,pinnedToDeal:s,pinnedToPerson:c,pinnedToOrganization:d,pinnedToLead:p}=e.propsValue;if(!r&&!n&&!i&&!a)throw new Error("Note must be associated with at least one organization, person, deal, lead or project.");let _={content:t,pinned_to_deal_flag:s?1:0,pinned_to_person_flag:c?1:0,pinned_to_organization_flag:d?1:0,pinned_to_lead_flag:p?1:0,lead_id:a,person_id:n,org_id:i,deal_id:r};return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/notes",body:_})}});var xc=D({auth:E,name:"get-note",displayName:"Retrieve a Note",description:"Finds a note by ID.",audience:"both",aiMetadata:{description:"Retrieves a single note by its numeric note ID. Use when you already have the note ID; to list the notes attached to a deal, lead, person, or organization, use Find Notes instead. Read-only and idempotent.",idempotent:!0},props:{noteId:g.Number({displayName:"Note ID",required:!0})},async run(e){try{return await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${e.propsValue.noteId}`})}catch{return{success:!1,data:{}}}}});var Tc=D({auth:E,name:"find-user",displayName:"Find User",description:"Finds a user by name or email.",audience:"both",aiMetadata:{description:"Search Pipedrive account users (team members, not CRM persons) by name or by email address. Pick this to resolve an owner or assignee to a user ID; choose the search-by field to match either a name or an email term. Read-only and may return multiple matches.",idempotent:!0},props:{field:g.StaticDropdown({displayName:"Field to search by",required:!0,options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Email",value:"email"}]}}),fieldValue:g.ShortText({displayName:"Field Value",required:!0})},async run(e){let{field:t,fieldValue:r}=e.propsValue,n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/users/find",query:{term:r,search_by_email:t=="email"?1:0}});return{found:n.data&&n.data.length>0,data:n.data}}});var Ic=D({auth:E,name:"find-product",displayName:"Find Product",description:"Finds a product by name ",audience:"both",aiMetadata:{description:"Search the product catalog by name and return the single best-matching product with its full details and custom fields. Pick this when you have a product name or keyword rather than an ID; use Retrieve a Product when you already know the exact product ID. Read-only and returns at most one match (found:false when nothing matches).",idempotent:!0},props:{searchTerm:g.ShortText({displayName:"Search Term",required:!0})},async run(e){let{searchTerm:t}=e.propsValue,r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:t,fields:"name",limit:1,include_fields:"product.price"}});if(A(r.data)||A(r.data.items)||r.data.items.length===0)return{found:!1,data:[]};let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${r.data.items[0].item.id}`}),i=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(i,n.data)]}}});var Ec=ie({auth:E,name:"organization-matching-filter",displayName:"Organization Matching Filter",description:"Triggers when an organization newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an organization (company) record first becomes a member of a selected Pipedrive filter \u2014 that is, the organization newly satisfies the filter conditions. Polls the filter and emits each organization the first time it appears; does not re-fire for organizations already in the filter."},type:"POLLING",props:{filterId:Ze("org",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("organizations",JSON.stringify(t))},async onDisable(e){await e.store.delete("organizations")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Le.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),i=[];for(let a of t){let s=R(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("organizations")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Le.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("organizations",JSON.stringify([...a,...r]));let s=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),c=[];for(let d of i){let p=R(s,d);c.push(p)}return c},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},custom_fields:{your_custom_field_key:"your_custom_field_value"}}});var Ac=ie({auth:E,name:"person-matching-filter",displayName:"Person Matching Filter",description:"Triggers when a person newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a person (contact) record first becomes a member of a selected Pipedrive filter \u2014 that is, the person newly satisfies the filter conditions. Polls the filter and emits each person the first time it appears; does not re-fire for people already in the filter."},type:"POLLING",props:{filterId:Ze("people",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("persons",JSON.stringify(t))},async onDisable(e){await e.store.delete("persons")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Me.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),i=[];for(let a of t){let s=R(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("persons")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Me.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("persons",JSON.stringify([...a,...r]));let s=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),c=[];for(let d of i){let p=R(s,d);c.push(p)}return c},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Sc=ie({auth:E,name:"activity-matching-filter",displayName:"Activity Matching Filter",description:"Trigges when an activity newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an activity (scheduled task or event) first becomes a member of a selected Pipedrive filter \u2014 that is, the activity newly satisfies the filter conditions. Polls the filter and emits each activity the first time it appears; does not re-fire for activities already in the filter."},type:"POLLING",props:{filterId:Ze("activity",!0)},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("activities",JSON.stringify(t))},async onDisable(e){await e.store.delete("activities")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,filter_id:e.propsValue.filterId,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=await e.store.get("activities")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId,include_fields:"attendees"}});if(A(n)||n.length===0)return[];let i=n.filter(s=>!r.includes(s.id)),a=i.map(s=>s.id);return a.length===0?[]:(await e.store.put("activities",JSON.stringify([...a,...r])),i)},sampleData:{id:8,company_id:22122,user_id:1234,done:!1,type:"deadline",reference_type:"scheduler-service",reference_id:7,conference_meeting_client:"871b8bc88d3a1202",conference_meeting_url:"https://pipedrive.zoom.us/link",conference_meeting_id:"01758746701",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy_flag:!0,add_time:"2020-06-08 12:37:56",marked_as_done_time:"2020-08-08 08:08:38",last_notification_time:"2020-08-08 12:37:56",last_notification_user_id:7655,notification_language_id:1,subject:"Deadline",public_description:"This is a description",calendar_sync_include_context:"",location:"Mustam\xE4e tee 3, Tallinn, Estonia",org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",active_flag:!0,update_time:"2020-08-08 12:37:56",update_user_id:5596,gcal_event_id:"",google_calendar_id:"",google_calendar_etag:"",source_timezone:"",rec_rule:"RRULE:FREQ=WEEKLY;BYDAY=WE",rec_rule_extension:"",rec_master_activity_id:1,series:[],note:"A note for the activity",created_by_user_id:1234,location_subpremise:"",location_street_number:"3",location_route:"Mustam\xE4e tee",location_sublocality:"Kristiine",location_locality:"Tallinn",location_admin_area_level_1:"Harju maakond",location_admin_area_level_2:"",location_country:"Estonia",location_postal_code:"10616",location_formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia",attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary_flag:!1},{person_id:1101,primary_flag:!0}],org_name:"Organization",person_name:"Person",deal_title:"Deal",owner_name:"Creator",person_dropbox_bcc:"company@pipedrivemail.com",deal_dropbox_bcc:"company+deal300@pipedrivemail.com",assigned_to_user_id:1235,file:{id:"376892,",clean_name:"Audio 10:55:07.m4a",url:"https://pipedrive-files.s3-eu-west-1.amazonaws.com/Audio-recording.m4a"}}});var $c=ie({auth:E,name:"deal-matching-filter",displayName:"Deal Matching Filter",description:"Trigges when a deal newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a deal first becomes a member of a selected Pipedrive filter \u2014 that is, the deal newly satisfies the filter conditions. Polls the filter and emits each deal the first time it appears; does not re-fire for deals already in the filter."},type:"POLLING",props:{filterId:Ze("deals",!0),status:g.StaticDropdown({displayName:"Status",required:!1,defaultValue:"all_not_deleted",options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"},{label:"All(Not Deleted)",value:"all_not_deleted"}]}})},async onEnable(e){let t=[],r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("deals",JSON.stringify(t))},async onDisable(e){await e.store.delete("deals")},async test(e){let t=[],r=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:10,filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ie.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of t){let s=R(n,a);i.push(s)}return i},async run(e){let t=await e.store.get("deals")??"[]",r=JSON.parse(t),n=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ie.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("deals",JSON.stringify([...a,...r]));let s=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=[];for(let d of i){let p=R(s,d);c.push(p)}return c},sampleData:{id:1,creator_user_id:22701301,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29 04:21:51",update_time:"2019-11-28 16:19:50",stage_change_time:"2019-11-28 15:41:22",active:!0,deleted:!1,status:"open",probability:null,next_activity_date:"2019-11-29",next_activity_time:"11:30:00",next_activity_id:128,last_activity_id:null,last_activity_date:null,lost_reason:null,visible_to:"1",close_time:null,pipeline_id:1,won_time:"2019-11-27 11:40:36",first_won_time:"2019-11-27 11:40:36",lost_time:"",products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29 18:21:42",last_outgoing_mail_time:"2019-05-30 03:45:35",label:11,stage_order_nr:2,person_name:"Person",org_name:"Organization",next_activity_subject:"Call",next_activity_type:"call",next_activity_duration:"00:30:00",next_activity_note:"Note content",formatted_value:"\u20AC5,000",weighted_value:5e3,formatted_weighted_value:"\u20AC5,000",weighted_value_currency:"EUR",rotten_time:null,owner_name:"Creator",cc_email:"company+deal1@pipedrivemail.com",org_hidden:!1,person_hidden:!1,average_time_to_won:{y:0,m:0,d:0,h:0,i:20,s:49,total_seconds:1249},average_stage_progress:4.99,age:{y:0,m:6,d:14,h:8,i:57,s:26,total_seconds:17139446},stay_in_pipeline_stages:{times_in_stages:{1:15721267,2:1288449,3:4368,4:3315,5:26460},order_of_stages:[1,2,3,4,5]},last_activity:null,next_activity:null}});var wc=ie({auth:E,name:"new-note",displayName:"New Note",description:"Triggers when a new note is created.",aiMetadata:{description:"Fires when a new note is created in Pipedrive. A note carries free-text content and may be linked to a deal, person, organization, or lead. Use to react whenever someone records a comment or annotation in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("note","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_note_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_note_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{limit:10,sort:"update_time DESC"}});return A(t.data)?[]:t.data},async run(e){let t=e.payload.body;return[(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${t.data.id}`})).data]},sampleData:{id:1,user_id:22701301,deal_id:null,person_id:1,org_id:1,lead_id:null,content:"Note content for v2 API.",add_time:"2024-12-04T06:48:26Z",update_time:"2024-12-04T06:48:26Z",is_deleted:!1}});var zc=D({auth:E,name:"find-deals-associated-with-person",displayName:"Find Deals Associated With Person",description:"Finds multiple deals related to a specific person.",audience:"both",aiMetadata:{description:"Lists all deals linked to a given person, identified by their numeric person ID, sorted by most recently updated. Use when you already have a person and need their associated deals; to look up a deal by a field value instead, use Find Deal. Read-only and idempotent.",idempotent:!0},props:{personId:De(!0)},async run(e){let{personId:t}=e.propsValue,r=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{person_id:t,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}});if(A(r)||r.length===0)return{found:!1,data:[]};let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of r){let s=R(n,a);i.push(s)}return{found:!0,data:i}}});var kc=D({auth:E,name:"find-products",displayName:"Find Products",description:"Finds a product or products by name or product code.",audience:"both",aiMetadata:{description:"Searches products by exact match on either name or product code (selected via the Field dropdown) and returns all matches, paging through every result. Use to locate products before adding them to a deal or updating them. Read-only and idempotent.",idempotent:!0},props:{field:g.StaticDropdown({displayName:"Field to search by",required:!0,defaultValue:"name",options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Product Code",value:"code"}]}}),fieldValue:g.ShortText({displayName:"Field Value",required:!0})},async run(e){let t={term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true",limit:"100"},r,n=!0,i=[];do{r&&(t.cursor=r);let a=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true"}});if(A(a.data.items))break;for(let s of a.data.items)i.push(s.item);n=a.additional_data?.next_cursor!=null,r=a.additional_data?.next_cursor}while(n);return{found:i.length>0,data:i}}});var Oc=D({auth:E,name:"get-product",displayName:"Retrieve a Product",description:"Finds a product by ID.",audience:"both",aiMetadata:{description:"Retrieve a single product by its exact numeric ID, returning full details and resolved custom fields. Pick this when you already know the product ID; use Find Product to search by name instead. Read-only and returns found:false rather than erroring when the ID does not exist.",idempotent:!0},props:{productId:g.Number({displayName:"Product ID",required:!0})},async run(e){try{let t=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${e.propsValue.productId}`}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(r,t.data)]}}catch{return{found:!1,data:[]}}}});var Dc=D({auth:E,name:"find-notes",displayName:"Find Notes",description:"Finds notes by Deal, Lead, Person, or Organization ID.",audience:"both",aiMetadata:{description:"Lists notes attached to a single parent record, chosen via the Search By dropdown (Deal, Lead, Person, or Organization) plus that record's ID, sorted newest-updated first. Use to retrieve the notes on a known object; to fetch one specific note by its own ID, use Retrieve a Note. Read-only and idempotent.",idempotent:!0},props:{objectType:g.StaticDropdown({displayName:"Search By",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal_id"},{label:"Lead",value:"lead_id"},{label:"Person",value:"person_id"},{label:"Organization",value:"org_id"}]}}),objectId:g.ShortText({displayName:"ID",required:!0})},async run(e){let t=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{sort:"update_time DESC",[e.propsValue.objectType]:e.propsValue.objectId}});return A(t)||t.length===0?{found:!1,data:[]}:{found:t.length>0,data:t}}});var Rc=D({auth:E,name:"find-organization",displayName:"Find Organization",description:"Finds an organization.",audience:"both",aiMetadata:{description:"Finds a single organization by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate an organization before reading or updating it; pick the field via Search Field and supply its value. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ut("organization"),searchFieldValue:Mt("organization")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Organization Filter",type:"org",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"organization",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"organization",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Le.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Nc=D({auth:E,name:"find-person",displayName:"Find Person",description:"Finds a person.",audience:"both",aiMetadata:{description:"Look up a single person by an exact value in a chosen field (e.g. email, phone, name, or a custom field). Pick this when you need to resolve a person record to its ID or details before acting on it. Effectively read-only (it creates and removes a temporary search filter) and returns the most recently updated match.",idempotent:!0},props:{searchField:Ut("person"),searchFieldValue:Mt("person")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Person Filter",type:"people",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"person",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"person",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Me.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Cc=D({auth:E,name:"find-deal",displayName:"Find Deal",description:"Finds a deal by any field.",audience:"both",aiMetadata:{description:"Finds a single deal by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate a deal before reading or updating it; pick the field via Search Field and supply its value. To list deals tied to a specific person, use Find Deals Associated With Person instead. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ut("deal"),searchFieldValue:Mt("deal")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Deal Filter",type:"deals",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"deal",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"deal",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Ie.join(",")}});if(await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Uc=D({auth:E,name:"find-activity",displayName:"Find Activity",description:"Finds an activity by subject.",audience:"both",aiMetadata:{description:"Search activities by subject text, optionally narrowed by owner, type, done/not-done status, or a saved filter. Pick this to locate existing activities; matching is case-insensitive substring by default but can be made exact-match. Read-only and may return multiple matches.",idempotent:!0},props:{subject:g.ShortText({displayName:"Subject",required:!0}),exactMatch:g.Checkbox({displayName:"Exact Match",required:!1,defaultValue:!0}),assignTo:Oe("Assign To",!1),type:di(!1),filterId:Ze("activity",!1),status:g.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Done",value:1},{label:"Not Done",value:0}]}})},async run(e){let{subject:t,assignTo:r,type:n,filterId:i,status:a,exactMatch:s}=e.propsValue,c=await ye({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{owner_id:r,done:a!=null?a===1:void 0,sort_by:"update_time",sort_direction:"desc",filter_id:i}});if(A(c)||c.length===0)return{found:!1,data:[]};let d=[];for(let p of c){let _=!1;p.subject&&(s&&p.subject===t||!s&&p.subject.toLowerCase().includes(t.toLowerCase()))&&(_=!0),n?_&&p.type===n&&d.push(p):_&&d.push(p)}return{found:d.length>0,data:d}}});var Mc=D({auth:E,name:"update-product",displayName:"Update Product",description:"Updates an existing product.",audience:"both",aiMetadata:{description:"Updates fields on an existing product identified by its product ID, such as name, code, pricing, tax, owner, active state, and custom fields; only supplied fields change. Use to edit a product you have the ID for (use Find Products to locate it first). Idempotent: repeating the same update converges to the same product state.",idempotent:!0},props:{id:g.ShortText({displayName:"Product ID",required:!0}),name:g.ShortText({displayName:"Name",required:!1}),code:g.ShortText({displayName:"Code",required:!1}),description:g.LongText({displayName:"Description",required:!1}),unit:g.ShortText({displayName:"Unit",required:!1}),tax:g.Number({displayName:"Tax percentage",required:!1}),isActive:g.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Oe("Owner",!1),currency:g.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:g.Number({displayName:"Price",required:!1}),cost:g.Number({displayName:"Cost",required:!1}),overheadCost:g.Number({displayName:"Overhead Cost",required:!1}),visibleTo:lt,customfields:dt("product")},async run(e){let{id:t,name:r,code:n,description:i,unit:a,tax:s,isActive:c,ownerId:d,currency:p,price:_,cost:x,overheadCost:b,visibleTo:l}=e.propsValue,m=e.propsValue.customfields??{},h={name:r,code:n,description:i,unit:a,tax:s,is_deleted:!c,prices:[{price:_??0,currency:p??"USD",cost:x??0,direct_cost:b??0}],visible_to:l};d&&(h.owner_id=d);let f=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),v=Te(f,m);ce(v)||(h.custom_fields=v);let I=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:"/v2/products/"+t,body:h}),O=R(f,I.data);return{...I,data:O}}});var Lc=D({auth:E,name:"find-lead",displayName:"Find Lead",description:"Finds leads by title.",audience:"both",aiMetadata:{description:"Searches leads by title text and returns all matches, paging through every result. By default it matches titles containing the term; enable Exact Match for full case-insensitive title equality only. Use to locate leads before reading or updating them. Read-only and idempotent.",idempotent:!0},props:{term:g.ShortText({displayName:"Title",description:"The title to search for.",required:!0}),exact_match:g.Checkbox({displayName:"Exact Match",description:"When enabled, only full exact matches against the given title are returned. It is not case sensitive.",required:!1})},async run(e){let{term:t,exact_match:r}=e.propsValue,n,i=!0,a=[];do{let s={term:t,fields:"title",limit:"100"};r&&(s.exact_match=!0),n&&(s.cursor=n);let c=await T({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/leads/search",query:s});if(A(c.data?.items))break;for(let d of c.data.items)a.push(d.item);i=c.additional_data?.next_cursor!=null,n=c.additional_data?.next_cursor}while(i);return{found:a.length>0,data:a}}});var wf=Sa({displayName:"Pipedrive",description:"Sales CRM and pipeline management software",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/pipedrive.png",categories:["SALES_AND_CRM"],auth:E,actions:[bc,xc,Pc,mc,pc,vc,gc,hc,uc,lc,oc,sc,rc,nc,ec,tc,dc,Mc,zc,Ic,kc,Dc,Oc,Rc,Nc,Cc,Uc,Tc,Lc,Vu({baseUrl:o(()=>"https://api.pipedrive.com/api/v2","baseUrl"),auth:E,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],authors:["ashrafsamhouri","kishanprmr","MoShizzle","khaledmashaly","abuaboud","leocottaz","Anmol-Gup"],triggers:[Gu,Zu,Bu,wc,Wu,qu,Xu,Ku,Ju,Yu,Sc,$c,Ac,Ec]});0&&(module.exports={pipedrive});
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
mime-types/index.js:
|