@activepieces/piece-pipedrive 0.8.9 → 0.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +3 -3
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
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});
1
+ "use strict";var Xl=Object.create;var Gt=Object.defineProperty;var Yl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var ed=Object.getPrototypeOf,td=Object.prototype.hasOwnProperty;var i=(e,t)=>Gt(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}},$o=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0})},wo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ql(t))!td.call(e,o)&&o!==r&&Gt(e,o,{get:()=>t[o],enumerable:!(n=Yl(t,o))||n.enumerable});return e};var we=(e,t,r)=>(r=e!=null?Xl(ed(e)):{},wo(t||!e||!e.__esModule?Gt(r,"default",{value:e,enumerable:!0}):r,e)),rd=e=>wo(Gt({},"__esModule",{value:!0}),e);var ta=U((ea,Mr)=>{(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"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(l,m){if(l.indexOf("::")!==l.lastIndexOf("::"))return null;let h=0,p=-1,P=(l.match(c.zoneIndex)||[])[0],T,z;for(P&&(P=P.substring(1),l=l.replace(/%.+$/,""));(p=l.indexOf(":",p+1))>=0;)h++;if(l.substr(0,2)==="::"&&h--,l.substr(-2,2)==="::"&&h--,h>m)return null;for(z=m-h,T=":";z--;)T+="0:";return l=l.replace("::",T),l[0]===":"&&(l=l.slice(1)),l[l.length-1]===":"&&(l=l.slice(0,-1)),m=(function(){let ne=l.split(":"),ve=[];for(let De=0;De<ne.length;De++)ve.push(parseInt(ne[De],16));return ve})(),{parts:m,zoneId:P}}i(d,"expandIPv6");function g(l,m,h,p){if(l.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let P=0,T;for(;p>0;){if(T=h-p,T<0&&(T=0),l[P]>>T!==m[P]>>T)return!1;p-=h,P+=1}return!0}i(g,"matchCIDR");function _(l){if(o.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)}i(_,"parseIntAuto");function I(l,m){for(;l.length<m;)l=`0${l}`;return l}i(I,"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,p;for(h=0;h<m.length;h++)if(p=m[h],!(0<=p&&p<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return i(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 p;if(h===void 0&&(p=m,m=p[0],h=p[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return g(this.octets,m.octets,8,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,p={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},P,T,z;for(P=3;P>=0;P-=1)if(T=this.octets[P],T in p){if(z=p[T],h&&z!==0)return null;z!==8&&(h=!0),m+=z}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(),p=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],T=0;for(;T<4;)P.push(parseInt(h[T],10)|parseInt(p[T],10)^255),T++;return new this(P)}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,p,P,T;try{for(m=this.parseCIDR(l),p=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],h=0;h<4;)P.push(parseInt(p[h],10)&parseInt(T[h],10)),h++;return new this(P)}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 p=[this.parse(m[1]),h];return Object.defineProperty(p,"toString",{value:i(function(){return this.join("/")},"value")}),p}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(l){let m,h,p;if(m=l.match(r.fourOctet))return(function(){let P=m.slice(1,6),T=[];for(let z=0;z<P.length;z++)h=P[z],T.push(_(h));return T})();if(m=l.match(r.longValue)){if(p=_(m[1]),p>4294967295||p<0)throw new Error("ipaddr: address outside defined range");return(function(){let P=[],T;for(T=0;T<=24;T+=8)P.push(p>>T&255);return P})().reverse()}else return(m=l.match(r.twoOctet))?(function(){let P=m.slice(1,4),T=[];if(p=_(P[1]),p>16777215||p<0)throw new Error("ipaddr: address outside defined range");return T.push(_(P[0])),T.push(p>>16&255),T.push(p>>8&255),T.push(p&255),T})():(m=l.match(r.threeOctet))?(function(){let P=m.slice(1,5),T=[];if(p=_(P[2]),p>65535||p<0)throw new Error("ipaddr: address outside defined range");return T.push(_(P[0])),T.push(_(P[1])),T.push(p>>8&255),T.push(p&255),T})():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,p=Math.floor(l/8);for(;h<p;)m[h]=255,h++;return p<4&&(m[p]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},b.IPv6=(function(){function l(m,h){let p,P;if(m.length===16)for(this.parts=[],p=0;p<=14;p+=2)this.parts.push(m[p]<<8|m[p+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(p=0;p<this.parts.length;p++)if(P=this.parts[p],!(0<=P&&P<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return i(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 p;if(h===void 0&&(p=m,m=p[0],h=p[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return g(this.parts,m.parts,16,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,p={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},P,T;for(let z=7;z>=0;z-=1)if(P=this.parts[z],P in p){if(T=p[P],h&&T!==0)return null;T!==16&&(h=!0),m+=T}else return null;return 128-m},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){let m,h=[],p=this.parts;for(let P=0;P<p.length;P++)m=p[P],h.push(m>>8),h.push(m&255);return h},l.prototype.toFixedLengthString=function(){let m=(function(){let p=[];for(let P=0;P<this.parts.length;P++)p.push(I(this.parts[P].toString(16),4));return p}).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],p=m[1];return new b.IPv4([h>>8,h&255,p>>8,p&255])},l.prototype.toNormalizedString=function(){let m=(function(){let p=[];for(let P=0;P<this.parts.length;P++)p.push(this.parts[P].toString(16));return p}).call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toRFC5952String=function(){let m=/((^|:)(0(:|$)){2,})/g,h=this.toNormalizedString(),p=0,P=-1,T;for(;T=m.exec(h);)T[0].length>P&&(p=T.index,P=T[0].length);return P<0?h:`${h.substring(0,p)}::${h.substring(p+P)}`},l.prototype.toString=function(){return this.toRFC5952String()},l})(),b.IPv6.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),p=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],T=0;for(;T<16;)P.push(parseInt(h[T],10)|parseInt(p[T],10)^255),T++;return new this(P)}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,p,P,T;try{for(m=this.parseCIDR(l),p=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],h=0;h<16;)P.push(parseInt(p[h],10)&parseInt(T[h],10)),h++;return new this(P)}catch(z){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${z})`)}},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,p;if((h=l.match(/^(.+)\/(\d+)$/))&&(m=parseInt(h[2]),m>=0&&m<=128))return p=[this.parse(h[1]),m],Object.defineProperty(p,"toString",{value:i(function(){return this.join("/")},"value")}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(l){let m,h,p,P,T,z;if(p=l.match(c.deprecatedTransitional))return this.parser(`::ffff:${p[1]}`);if(c.native.test(l))return d(l,8);if((p=l.match(c.transitional))&&(z=p[6]||"",m=p[1],p[1].endsWith("::")||(m=m.slice(0,-1)),m=d(m+z,6),m.parts)){for(T=[parseInt(p[2]),parseInt(p[3]),parseInt(p[4]),parseInt(p[5])],h=0;h<T.length;h++)if(P=T[h],!(0<=P&&P<=255))return null;return m.parts.push(T[0]<<8|T[1]),m.parts.push(T[2]<<8|T[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,p=Math.floor(l/8);for(;h<p;)m[h]=255,h++;return p<16&&(m[p]=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 p,P,T,z;h==null&&(h="unicast");for(P in m)if(Object.prototype.hasOwnProperty.call(m,P)){for(T=m[P],T[0]&&!(T[0]instanceof Array)&&(T=[T]),p=0;p<T.length;p++)if(z=T[p],l.kind()===z[0].kind()&&l.match.apply(l,z))return P}return h},typeof Mr<"u"&&Mr.exports?Mr.exports=b:e.ipaddr=b})(ea)});var as=U((Jz,is)=>{var os=require("stream").Stream,Vm=require("util");is.exports=je;function je(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}i(je,"DelayedStream");Vm.inherits(je,os);je.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var o=e.emit;return e.emit=function(){return r._handleEmit(arguments),o.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(je.prototype,"readable",{configurable:!0,enumerable:!0,get:i(function(){return this.source.readable},"get")});je.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};je.prototype.resume=function(){this._released||this.release(),this.source.resume()};je.prototype.pause=function(){this.source.pause()};je.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};je.prototype.pipe=function(){var e=os.prototype.pipe.apply(this,arguments);return this.resume(),e};je.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)};je.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 ls=U((Yz,cs)=>{var Bm=require("util"),us=require("stream").Stream,ss=as();cs.exports=pe;function pe(){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}i(pe,"CombinedStream");Bm.inherits(pe,us);pe.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};pe.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};pe.prototype.append=function(e){var t=pe.isStreamLike(e);if(t){if(!(e instanceof ss)){var r=ss.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};pe.prototype.pipe=function(e,t){return us.prototype.pipe.call(this,e,t),this.resume(),e};pe.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}};pe.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=pe.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};pe.prototype._pipeNext=function(e){this._currentStream=e;var t=pe.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()};pe.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};pe.prototype.write=function(e){this.emit("data",e)};pe.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};pe.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")};pe.prototype.end=function(){this._reset(),this.emit("end")};pe.prototype.destroy=function(){this._reset(),this.emit("close")};pe.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};pe.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};pe.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)};pe.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var ps=U((eO,ds)=>{"use strict";ds.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 gs=U(Oe=>{"use strict";var Br=ps(),Zm=require("path").extname,ms=/^\s*([^;\s]*)(?:;|\s|$)/,Gm=/^text\//i;Oe.charset=fs;Oe.charsets={lookup:fs};Oe.contentType=Hm;Oe.extension=qm;Oe.extensions=Object.create(null);Oe.lookup=Wm;Oe.types=Object.create(null);Km(Oe.extensions,Oe.types);function fs(e){if(!e||typeof e!="string")return!1;var t=ms.exec(e),r=t&&Br[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&Gm.test(t[1])?"UTF-8":!1}i(fs,"charset");function Hm(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?Oe.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=Oe.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}i(Hm,"contentType");function qm(e){if(!e||typeof e!="string")return!1;var t=ms.exec(e),r=t&&Oe.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}i(qm,"extension");function Wm(e){if(!e||typeof e!="string")return!1;var t=Zm("x."+e).toLowerCase().substr(1);return t&&Oe.types[t]||!1}i(Wm,"lookup");function Km(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Br).forEach(i(function(o){var a=Br[o],u=a.extensions;if(!(!u||!u.length)){e[o]=u;for(var c=0;c<u.length;c++){var d=u[c];if(t[d]){var g=r.indexOf(Br[t[d]].source),_=r.indexOf(a.source);if(t[d]!=="application/octet-stream"&&(g>_||g===_&&t[d].substr(0,12)==="application/"))continue}t[d]=o}}},"forEachMimeType"))}i(Km,"populateMaps")});var hs=U((nO,ys)=>{ys.exports=Jm;function Jm(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}i(Jm,"defer")});var Xn=U((iO,vs)=>{var _s=hs();vs.exports=Xm;function Xm(e){var t=!1;return _s(function(){t=!0}),i(function(n,o){t?e(n,o):_s(i(function(){e(n,o)},"nextTick_callback"))},"async_callback")}i(Xm,"async")});var Yn=U((sO,bs)=>{bs.exports=Ym;function Ym(e){Object.keys(e.jobs).forEach(Qm.bind(e)),e.jobs={}}i(Ym,"abort");function Qm(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}i(Qm,"clean")});var Qn=U((cO,xs)=>{var Ps=Xn(),ef=Yn();xs.exports=tf;function tf(e,t,r,n){var o=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[o]=rf(t,o,e[o],function(a,u){o in r.jobs&&(delete r.jobs[o],a?ef(r):r.results[o]=u,n(a,r.results))})}i(tf,"iterate");function rf(e,t,r,n){var o;return e.length==2?o=e(r,Ps(n)):o=e(r,t,Ps(n)),o}i(rf,"runJob")});var eo=U((dO,Ts)=>{Ts.exports=nf;function nf(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(o,a){return t(e[o],e[a])}),n}i(nf,"state")});var to=U((mO,Is)=>{var of=Yn(),af=Xn();Is.exports=sf;function sf(e){Object.keys(this.jobs).length&&(this.index=this.size,of(this),af(e)(null,this.results))}i(sf,"terminator")});var As=U((gO,Es)=>{var uf=Qn(),cf=eo(),lf=to();Es.exports=df;function df(e,t,r){for(var n=cf(e);n.index<(n.keyedList||e).length;)uf(e,t,n,function(o,a){if(o){r(o,a);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return lf.bind(n,r)}i(df,"parallel")});var ro=U((hO,Zr)=>{var Ss=Qn(),pf=eo(),mf=to();Zr.exports=ff;Zr.exports.ascending=ks;Zr.exports.descending=gf;function ff(e,t,r,n){var o=pf(e,r);return Ss(e,t,o,i(function a(u,c){if(u){n(u,c);return}if(o.index++,o.index<(o.keyedList||e).length){Ss(e,t,o,a);return}n(null,o.results)},"iteratorHandler")),mf.bind(o,n)}i(ff,"serialOrdered");function ks(e,t){return e<t?-1:e>t?1:0}i(ks,"ascending");function gf(e,t){return-1*ks(e,t)}i(gf,"descending")});var ws=U((vO,$s)=>{var yf=ro();$s.exports=hf;function hf(e,t,r){return yf(e,t,null,r)}i(hf,"serial")});var Os=U((PO,zs)=>{zs.exports={parallel:As(),serial:ws(),serialOrdered:ro()}});var no=U((xO,Ds)=>{"use strict";Ds.exports=Object});var Ns=U((TO,Rs)=>{"use strict";Rs.exports=Error});var Us=U((IO,Cs)=>{"use strict";Cs.exports=EvalError});var Ls=U((EO,Ms)=>{"use strict";Ms.exports=RangeError});var js=U((AO,Fs)=>{"use strict";Fs.exports=ReferenceError});var Bs=U((SO,Vs)=>{"use strict";Vs.exports=SyntaxError});var Gr=U((kO,Zs)=>{"use strict";Zs.exports=TypeError});var Hs=U(($O,Gs)=>{"use strict";Gs.exports=URIError});var Ws=U((wO,qs)=>{"use strict";qs.exports=Math.abs});var Js=U((zO,Ks)=>{"use strict";Ks.exports=Math.floor});var Ys=U((OO,Xs)=>{"use strict";Xs.exports=Math.max});var eu=U((DO,Qs)=>{"use strict";Qs.exports=Math.min});var ru=U((RO,tu)=>{"use strict";tu.exports=Math.pow});var ou=U((NO,nu)=>{"use strict";nu.exports=Math.round});var au=U((CO,iu)=>{"use strict";iu.exports=Number.isNaN||i(function(t){return t!==t},"isNaN")});var uu=U((MO,su)=>{"use strict";var _f=au();su.exports=i(function(t){return _f(t)||t===0?t:t<0?-1:1},"sign")});var lu=U((FO,cu)=>{"use strict";cu.exports=Object.getOwnPropertyDescriptor});var oo=U((jO,du)=>{"use strict";var Hr=lu();if(Hr)try{Hr([],"length")}catch{Hr=null}du.exports=Hr});var mu=U((VO,pu)=>{"use strict";var qr=Object.defineProperty||!1;if(qr)try{qr({},"a",{value:1})}catch{qr=!1}pu.exports=qr});var io=U((BO,fu)=>{"use strict";fu.exports=i(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 o=42;t[r]=o;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 u=Object.getOwnPropertySymbols(t);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,r);if(c.value!==o||c.enumerable!==!0)return!1}return!0},"hasSymbols")});var hu=U((GO,yu)=>{"use strict";var gu=typeof Symbol<"u"&&Symbol,vf=io();yu.exports=i(function(){return typeof gu!="function"||typeof Symbol!="function"||typeof gu("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:vf()},"hasNativeSymbols")});var ao=U((qO,_u)=>{"use strict";_u.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var so=U((WO,vu)=>{"use strict";var bf=no();vu.exports=bf.getPrototypeOf||null});var xu=U((KO,Pu)=>{"use strict";var Pf="Function.prototype.bind called on incompatible ",xf=Object.prototype.toString,Tf=Math.max,If="[object Function]",bu=i(function(t,r){for(var n=[],o=0;o<t.length;o+=1)n[o]=t[o];for(var a=0;a<r.length;a+=1)n[a+t.length]=r[a];return n},"concatty"),Ef=i(function(t,r){for(var n=[],o=r||0,a=0;o<t.length;o+=1,a+=1)n[a]=t[o];return n},"slicy"),Af=i(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");Pu.exports=i(function(t){var r=this;if(typeof r!="function"||xf.apply(r)!==If)throw new TypeError(Pf+r);for(var n=Ef(arguments,1),o,a=i(function(){if(this instanceof o){var _=r.apply(this,bu(n,arguments));return Object(_)===_?_:this}return r.apply(t,bu(n,arguments))},"binder"),u=Tf(0,r.length-n.length),c=[],d=0;d<u;d++)c[d]="$"+d;if(o=Function("binder","return function ("+Af(c,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var g=i(function(){},"Empty");g.prototype=r.prototype,o.prototype=new g,g.prototype=null}return o},"bind")});var Nt=U((XO,Tu)=>{"use strict";var Sf=xu();Tu.exports=Function.prototype.bind||Sf});var Wr=U((YO,Iu)=>{"use strict";Iu.exports=Function.prototype.call});var uo=U((QO,Eu)=>{"use strict";Eu.exports=Function.prototype.apply});var Su=U((eD,Au)=>{"use strict";Au.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var $u=U((tD,ku)=>{"use strict";var kf=Nt(),$f=uo(),wf=Wr(),zf=Su();ku.exports=zf||kf.call(wf,$f)});var zu=U((rD,wu)=>{"use strict";var Of=Nt(),Df=Gr(),Rf=Wr(),Nf=$u();wu.exports=i(function(t){if(t.length<1||typeof t[0]!="function")throw new Df("a function is required");return Nf(Of,Rf,t)},"callBindBasic")});var Uu=U((oD,Cu)=>{"use strict";var Cf=zu(),Ou=oo(),Ru;try{Ru=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var co=!!Ru&&Ou&&Ou(Object.prototype,"__proto__"),Nu=Object,Du=Nu.getPrototypeOf;Cu.exports=co&&typeof co.get=="function"?Cf([co.get]):typeof Du=="function"?i(function(t){return Du(t==null?t:Nu(t))},"getDunder"):!1});var Vu=U((aD,ju)=>{"use strict";var Mu=ao(),Lu=so(),Fu=Uu();ju.exports=Mu?i(function(t){return Mu(t)},"getProto"):Lu?i(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Lu(t)},"getProto"):Fu?i(function(t){return Fu(t)},"getProto"):null});var lo=U((uD,Bu)=>{"use strict";var Uf=Function.prototype.call,Mf=Object.prototype.hasOwnProperty,Lf=Nt();Bu.exports=Lf.call(Uf,Mf)});var Ju=U((cD,Ku)=>{"use strict";var Q,Ff=no(),jf=Ns(),Vf=Us(),Bf=Ls(),Zf=js(),Lt=Bs(),Mt=Gr(),Gf=Hs(),Hf=Ws(),qf=Js(),Wf=Ys(),Kf=eu(),Jf=ru(),Xf=ou(),Yf=uu(),qu=Function,po=i(function(e){try{return qu('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),lr=oo(),Qf=mu(),mo=i(function(){throw new Mt},"throwTypeError"),eg=lr?(function(){try{return arguments.callee,mo}catch{try{return lr(arguments,"callee").get}catch{return mo}}})():mo,Ct=hu()(),xe=Vu(),tg=so(),rg=ao(),Wu=uo(),dr=Wr(),Ut={},ng=typeof Uint8Array>"u"||!xe?Q:xe(Uint8Array),xt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":Ct&&xe?xe([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Ut,"%AsyncGenerator%":Ut,"%AsyncGeneratorFunction%":Ut,"%AsyncIteratorPrototype%":Ut,"%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%":jf,"%eval%":eval,"%EvalError%":Vf,"%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%":qu,"%GeneratorFunction%":Ut,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ct&&xe?xe(xe([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ct||!xe?Q:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ff,"%Object.getOwnPropertyDescriptor%":lr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":Bf,"%ReferenceError%":Zf,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ct||!xe?Q:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ct&&xe?xe(""[Symbol.iterator]()):Q,"%Symbol%":Ct?Symbol:Q,"%SyntaxError%":Lt,"%ThrowTypeError%":eg,"%TypedArray%":ng,"%TypeError%":Mt,"%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%":Gf,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":dr,"%Function.prototype.apply%":Wu,"%Object.defineProperty%":Qf,"%Object.getPrototypeOf%":tg,"%Math.abs%":Hf,"%Math.floor%":qf,"%Math.max%":Wf,"%Math.min%":Kf,"%Math.pow%":Jf,"%Math.round%":Xf,"%Math.sign%":Yf,"%Reflect.getPrototypeOf%":rg};if(xe)try{null.error}catch(e){Zu=xe(xe(e)),xt["%Error.prototype%"]=Zu}var Zu,og=i(function e(t){var r;if(t==="%AsyncFunction%")r=po("async function () {}");else if(t==="%GeneratorFunction%")r=po("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=po("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&xe&&(r=xe(o.prototype))}return xt[t]=r,r},"doEval"),Gu={__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"]},pr=Nt(),Kr=lo(),ig=pr.call(dr,Array.prototype.concat),ag=pr.call(Wu,Array.prototype.splice),Hu=pr.call(dr,String.prototype.replace),Jr=pr.call(dr,String.prototype.slice),sg=pr.call(dr,RegExp.prototype.exec),ug=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,cg=/\\(\\)?/g,lg=i(function(t){var r=Jr(t,0,1),n=Jr(t,-1);if(r==="%"&&n!=="%")throw new Lt("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Lt("invalid intrinsic syntax, expected opening `%`");var o=[];return Hu(t,ug,function(a,u,c,d){o[o.length]=c?Hu(d,cg,"$1"):u||a}),o},"stringToPath"),dg=i(function(t,r){var n=t,o;if(Kr(Gu,n)&&(o=Gu[n],n="%"+o[0]+"%"),Kr(xt,n)){var a=xt[n];if(a===Ut&&(a=og(n)),typeof a>"u"&&!r)throw new Mt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:a}}throw new Lt("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Ku.exports=i(function(t,r){if(typeof t!="string"||t.length===0)throw new Mt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Mt('"allowMissing" argument must be a boolean');if(sg(/^%?[^%]*%?$/,t)===null)throw new Lt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=lg(t),o=n.length>0?n[0]:"",a=dg("%"+o+"%",r),u=a.name,c=a.value,d=!1,g=a.alias;g&&(o=g[0],ag(n,ig([0,1],g)));for(var _=1,I=!0;_<n.length;_+=1){var b=n[_],l=Jr(b,0,1),m=Jr(b,-1);if((l==='"'||l==="'"||l==="`"||m==='"'||m==="'"||m==="`")&&l!==m)throw new Lt("property names with quotes must have matching quotes");if((b==="constructor"||!I)&&(d=!0),o+="."+b,u="%"+o+"%",Kr(xt,u))c=xt[u];else if(c!=null){if(!(b in c)){if(!r)throw new Mt("base intrinsic for "+t+" exists, but the property is not available.");return}if(lr&&_+1>=n.length){var h=lr(c,b);I=!!h,I&&"get"in h&&!("originalValue"in h.get)?c=h.get:c=c[b]}else I=Kr(c,b),c=c[b];I&&!d&&(xt[u]=c)}}return c},"GetIntrinsic")});var Yu=U((dD,Xu)=>{"use strict";var pg=io();Xu.exports=i(function(){return pg()&&!!Symbol.toStringTag},"hasToStringTagShams")});var tc=U((mD,ec)=>{"use strict";var mg=Ju(),Qu=mg("%Object.defineProperty%",!0),fg=Yu()(),gg=lo(),yg=Gr(),Xr=fg?Symbol.toStringTag:null;ec.exports=i(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof o<"u"&&typeof o!="boolean")throw new yg("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Xr&&(n||!gg(t,Xr))&&(Qu?Qu(t,Xr,{configurable:!o,enumerable:!1,value:r,writable:!1}):t[Xr]=r)},"setToStringTag")});var nc=U((gD,rc)=>{"use strict";var hg=Function.prototype.call,_g=Object.prototype.hasOwnProperty,vg=Nt();rc.exports=vg.call(hg,_g)});var ic=U((yD,oc)=>{"use strict";oc.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var _o=U((hD,sc)=>{"use strict";var ho=ls(),bg=require("util"),fo=require("path"),Pg=require("http"),xg=require("https"),Tg=require("url").parse,Ig=require("fs"),Eg=require("stream").Stream,Ag=require("crypto"),go=gs(),Sg=Os(),kg=tc(),pt=nc(),yo=ic();function ac(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}i(ac,"escapeHeaderParam");function re(e){if(!(this instanceof re))return new re(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],ho.call(this),e=e||{};for(var t in e)this[t]=e[t]}i(re,"FormData");bg.inherits(re,ho);re.LINE_BREAK=`\r
2
+ `;re.DEFAULT_CONTENT_TYPE="application/octet-stream";re.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=ho.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 o=this._multiPartHeader(e,t,r),a=this._multiPartFooter();n(o),n(t),n(a),this._trackLength(o,t,r)};re.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)+re.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&pt(t,"httpVersion"))&&!(t instanceof Eg))&&(r.knownLength||this._valuesToMeasure.push(t))};re.prototype._lengthRetriever=function(e,t){pt(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):Ig.stat(e.path,function(r,n){if(r){t(r);return}var o=n.size-(e.start?e.start:0);t(null,o)}):pt(e,"httpVersion")?t(null,Number(e.headers["content-length"])):pt(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};re.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),o=this._getContentType(t,r),a="",u={"Content-Disposition":["form-data",'name="'+ac(e)+'"'].concat(n||[]),"Content-Type":[].concat(o||[])};typeof r.header=="object"&&yo(u,r.header);var c;for(var d in u)if(pt(u,d)){if(c=u[d],c==null)continue;Array.isArray(c)||(c=[c]),c.length&&(a+=d+": "+c.join("; ")+re.LINE_BREAK)}return"--"+this.getBoundary()+re.LINE_BREAK+a+re.LINE_BREAK};re.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=fo.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=fo.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&pt(e,"httpVersion")&&(r=fo.basename(e.client._httpMessage.path||"")),r)return'filename="'+ac(r)+'"'};re.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=go.lookup(e.name)),!r&&e&&e.path&&(r=go.lookup(e.path)),!r&&e&&e.readable&&pt(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=go.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=re.DEFAULT_CONTENT_TYPE),r};re.prototype._multiPartFooter=function(){return function(e){var t=re.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};re.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+re.LINE_BREAK};re.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)pt(e,t)&&(r[t.toLowerCase()]=e[t]);return r};re.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};re.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};re.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(re.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};re.prototype._generateBoundary=function(){this._boundary="--------------------------"+Ag.randomBytes(12).toString("hex")};re.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};re.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};re.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}Sg.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(o){t+=o}),e(null,t)})};re.prototype.submit=function(e,t){var r,n,o={method:"post"};return typeof e=="string"?(e=Tg(e),n=yo({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o)):(n=yo(e,o),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=xg.request(n):r=Pg.request(n),this.getLength(function(a,u){if(a&&a!=="Unknown stream"){this._error(a);return}if(u&&r.setHeader("Content-Length",u),this.pipe(r),t){var c,d=i(function(g,_){return r.removeListener("error",d),r.removeListener("response",c),t.call(this,g,_)},"callback");c=d.bind(this,null),r.on("error",d),r.on("response",c)}}.bind(this)),r};re.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};re.prototype.toString=function(){return"[object FormData]"};kg(re.prototype,"FormData");sc.exports=re});var mt=U((vo,bo)=>{(function(e,t){typeof vo=="object"&&typeof bo<"u"?bo.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(vo,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",u="hour",c="day",d="week",g="month",_="quarter",I="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,p={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:i(function(V){var w=["th","st","nd","rd"],S=V%100;return"["+V+(w[(S-20)%10]||w[S]||w[0])+"]"},"ordinal")},P=i(function(V,w,S){var N=String(V);return!N||N.length>=w?V:""+Array(w+1-N.length).join(S)+V},"m"),T={s:P,z:i(function(V){var w=-V.utcOffset(),S=Math.abs(w),N=Math.floor(S/60),$=S%60;return(w<=0?"+":"-")+P(N,2,"0")+":"+P($,2,"0")},"z"),m:i(function V(w,S){if(w.date()<S.date())return-V(S,w);var N=12*(S.year()-w.year())+(S.month()-w.month()),$=w.clone().add(N,g),J=S-$<0,X=w.clone().add(N+(J?-1:1),g);return+(-(N+(S-$)/(J?$-X:X-$))||0)},"t"),a:i(function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},"a"),p:i(function(V){return{M:g,y:I,w:d,d:c,D:b,h:u,m:a,s:o,ms:n,Q:_}[V]||String(V||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(V){return V===void 0},"u")},z="en",ne={};ne[z]=p;var ve=i(function(V){return V instanceof ke},"p"),De=i(function V(w,S,N){var $;if(!w)return z;if(typeof w=="string"){var J=w.toLowerCase();ne[J]&&($=J),S&&(ne[J]=S,$=J);var X=w.split("-");if(!$&&X.length>1)return V(X[0])}else{var ie=w.name;ne[ie]=w,$=ie}return!N&&$&&(z=$),$||!N&&z},"t"),ye=i(function(V,w){if(ve(V))return V.clone();var S=typeof w=="object"?w:{};return S.date=V,S.args=arguments,new ke(S)},"w"),Y=T;Y.l=De,Y.i=ve,Y.w=function(V,w){return ye(V,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var ke=(function(){function V(S){this.$L=De(S.locale,null,!0),this.parse(S)}i(V,"M");var w=V.prototype;return w.parse=function(S){this.$d=(function(N){var $=N.date,J=N.utc;if($===null)return new Date(NaN);if(Y.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var X=$.match(m);if(X){var ie=X[2]-1||0,me=(X[7]||"0").substring(0,3);return J?new Date(Date.UTC(X[1],ie,X[3]||1,X[4]||0,X[5]||0,X[6]||0,me)):new Date(X[1],ie,X[3]||1,X[4]||0,X[5]||0,X[6]||0,me)}}return new Date($)})(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 $=ye(S);return this.startOf(N)<=$&&$<=this.endOf(N)},w.isAfter=function(S,N){return ye(S)<this.startOf(N)},w.isBefore=function(S,N){return this.endOf(N)<ye(S)},w.$g=function(S,N,$){return Y.u(S)?this[N]:this.set($,S)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(S,N){var $=this,J=!!Y.u(N)||N,X=Y.p(S),ie=i(function(ht,$e){var rt=Y.w($.$u?Date.UTC($.$y,$e,ht):new Date($.$y,$e,ht),$);return J?rt:rt.endOf(c)},"l"),me=i(function(ht,$e){return Y.w($.toDate()[ht].apply($.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice($e)),$)},"$"),be=this.$W,Ie=this.$M,Me=this.$D,It="set"+(this.$u?"UTC":"");switch(X){case I:return J?ie(1,0):ie(31,11);case g:return J?ie(1,Ie):ie(0,Ie+1);case d:var yt=this.$locale().weekStart||0,Bt=(be<yt?be+7:be)-yt;return ie(J?Me-Bt:Me+(6-Bt),Ie);case c:case b:return me(It+"Hours",0);case u:return me(It+"Minutes",1);case a:return me(It+"Seconds",2);case o:return me(It+"Milliseconds",3);default:return this.clone()}},w.endOf=function(S){return this.startOf(S,!1)},w.$set=function(S,N){var $,J=Y.p(S),X="set"+(this.$u?"UTC":""),ie=($={},$[c]=X+"Date",$[b]=X+"Date",$[g]=X+"Month",$[I]=X+"FullYear",$[u]=X+"Hours",$[a]=X+"Minutes",$[o]=X+"Seconds",$[n]=X+"Milliseconds",$)[J],me=J===c?this.$D+(N-this.$W):N;if(J===g||J===I){var be=this.clone().set(b,1);be.$d[ie](me),be.init(),this.$d=be.set(b,Math.min(this.$D,be.daysInMonth())).$d}else ie&&this.$d[ie](me);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 $,J=this;S=Number(S);var X=Y.p(N),ie=i(function(Ie){var Me=ye(J);return Y.w(Me.date(Me.date()+Math.round(Ie*S)),J)},"y");if(X===g)return this.set(g,this.$M+S);if(X===I)return this.set(I,this.$y+S);if(X===c)return ie(1);if(X===d)return ie(7);var me=($={},$[a]=t,$[u]=r,$[o]=e,$)[X]||1,be=this.$d.getTime()+S*me;return Y.w(be,this)},w.subtract=function(S,N){return this.add(-1*S,N)},w.format=function(S){var N=this,$=this.$locale();if(!this.isValid())return $.invalidDate||l;var J=S||"YYYY-MM-DDTHH:mm:ssZ",X=Y.z(this),ie=this.$H,me=this.$m,be=this.$M,Ie=$.weekdays,Me=$.months,It=$.meridiem,yt=i(function($e,rt,Zt,hr){return $e&&($e[rt]||$e(N,J))||Zt[rt].slice(0,hr)},"h"),Bt=i(function($e){return Y.s(ie%12||12,$e,"0")},"d"),ht=It||function($e,rt,Zt){var hr=$e<12?"AM":"PM";return Zt?hr.toLowerCase():hr};return J.replace(h,(function($e,rt){return rt||(function(Zt){switch(Zt){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 yt($.monthsShort,be,Me,3);case"MMMM":return yt(Me,be);case"D":return N.$D;case"DD":return Y.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return yt($.weekdaysMin,N.$W,Ie,2);case"ddd":return yt($.weekdaysShort,N.$W,Ie,3);case"dddd":return Ie[N.$W];case"H":return String(ie);case"HH":return Y.s(ie,2,"0");case"h":return Bt(1);case"hh":return Bt(2);case"a":return ht(ie,me,!0);case"A":return ht(ie,me,!1);case"m":return String(me);case"mm":return Y.s(me,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 X}return null})($e)||X.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(S,N,$){var J,X=this,ie=Y.p(N),me=ye(S),be=(me.utcOffset()-this.utcOffset())*t,Ie=this-me,Me=i(function(){return Y.m(X,me)},"D");switch(ie){case I:J=Me()/12;break;case g:J=Me();break;case _:J=Me()/3;break;case d:J=(Ie-be)/6048e5;break;case c:J=(Ie-be)/864e5;break;case u:J=Ie/r;break;case a:J=Ie/t;break;case o:J=Ie/e;break;default:J=Ie}return $?J:Y.a(J)},w.daysInMonth=function(){return this.endOf(g).$D},w.$locale=function(){return ne[this.$L]},w.locale=function(S,N){if(!S)return this.$L;var $=this.clone(),J=De(S,N,!0);return J&&($.$L=J),$},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()},V})(),yr=ke.prototype;return ye.prototype=yr,[["$ms",n],["$s",o],["$m",a],["$H",u],["$W",c],["$M",g],["$y",I],["$D",b]].forEach((function(V){yr[V[1]]=function(w){return this.$g(w,V[0],V[1])}})),ye.extend=function(V,w){return V.$i||(V(w,ke,ye),V.$i=!0),ye},ye.locale=De,ye.isDayjs=ve,ye.unix=function(V){return ye(1e3*V)},ye.en=ne[z],ye.Ls=ne,ye.p={},ye}))});var ty={};$o(ty,{pipedrive:()=>ey});module.exports=rd(ty);var nd=Object.freeze({status:"aborted"});function O(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:u,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let g=u.prototype,_=Object.keys(g);for(let I=0;I<_.length;I++){let b=_[I];b in c||(c[b]=g[b].bind(c))}}i(n,"init");let o=r?.Parent??Object;class a extends o{static{i(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function u(c){var d;let g=r?.Parent?new a:this;n(g,c),(d=g._zod).deferred??(d.deferred=[]);for(let _ of g._zod.deferred)_();return g}return i(u,"_"),Object.defineProperty(u,"init",{value:n}),Object.defineProperty(u,Symbol.hasInstance,{value:i(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(u,"name",{value:e}),u}i(O,"$constructor");var Ge=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_r=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ln={};function Ke(e){return e&&Object.assign(ln,e),ln}i(Ke,"config");function pn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}i(pn,"getEnumValues");function Oo(e,t){return typeof t=="bigint"?t.toString():t}i(Oo,"jsonStringifyReplacer");function br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(br,"cached");function Do(e){return e==null}i(Do,"nullish");function Pr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(Pr,"cleanRegex");var zo=Symbol("evaluating");function he(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zo)return n===void 0&&(n=zo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}i(he,"defineLazy");var mn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(Ht,"isObject");var od=br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ro(e){if(Ht(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ht(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(Ro,"isPlainObject");var No=new Set(["string","number","symbol"]);function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(Et,"escapeRegex");function xr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}i(xr,"clone");function ae(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:i(()=>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:i(()=>t.error,"error")}:t}i(ae,"normalizeParams");function Co(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(Co,"optionalKeys");var Uo={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 At(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}i(At,"aborted");function nt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}i(nt,"prefixIssues");function vr(e){return typeof e=="string"?e:e?.message}i(vr,"unwrapMessage");function ot(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=vr(e.inst?._zod.def?.error?.(e))??vr(t?.error?.(e))??vr(r.customError?.(e))??vr(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}i(ot,"finalizeIssue");function Mo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(Mo,"getLengthableOrigin");function fn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}i(fn,"issue");var Lo=i((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,Oo,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),Fo=O("$ZodError",Lo),qt=O("$ZodError",Lo,{Parent:Error});var ad=i(e=>(t,r,n,o)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise)throw new Ge;if(u.issues.length){let c=new(o?.Err??e)(u.issues.map(d=>ot(d,a,Ke())));throw mn(c,o?.callee),c}return u.value},"_parse"),Tr=ad(qt),sd=i(e=>async(t,r,n,o)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise&&(u=await u),u.issues.length){let c=new(o?.Err??e)(u.issues.map(d=>ot(d,a,Ke())));throw mn(c,o?.callee),c}return u.value},"_parseAsync"),Ir=sd(qt),ud=i(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new Ge;return a.issues.length?{success:!1,error:new(e??Fo)(a.issues.map(u=>ot(u,o,Ke())))}:{success:!0,data:a.value}},"_safeParse"),Wt=ud(qt),cd=i(e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(u=>ot(u,o,Ke())))}:{success:!0,data:a.value}},"_safeParseAsync"),Kt=cd(qt);var ld="(?:(?:\\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])))",dd=new RegExp(`^${ld}$`);var jo=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Vo=/^-?\d+n?$/,Bo=/^-?\d+$/,gn=/^-?\d+(?:\.\d+)?$/,Zo=/^(?:true|false)$/i;var it=O("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pd={number:"number",bigint:"bigint",object:"date"};var Go=O("$ZodCheckGreaterThan",(e,t)=>{it.init(e,t);let r=pd[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.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 Ho=O("$ZodCheckNumberFormat",(e,t)=>{it.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,a]=Uo[t.format];e._zod.onattach.push(u=>{let c=u._zod.bag;c.format=t.format,c.minimum=o,c.maximum=a,r&&(c.pattern=Bo)}),e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.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}):u.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<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>a&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}});var qo=O("$ZodCheckMinLength",(e,t)=>{var r;it.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Do(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let u=Mo(o);n.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}});var yn=O("$ZodCheckStringFormat",(e,t)=>{var r,n;it.init(e,t),e._zod.onattach.push(o=>{let a=o._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=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Wo=O("$ZodCheckRegex",(e,t)=>{yn.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 Jo={major:4,minor:3,patch:6};var de=O("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let a of o._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 o=i((u,c,d)=>{let g=At(u),_;for(let I of c){if(I._zod.def.when){if(!I._zod.def.when(u))continue}else if(g)continue;let b=u.issues.length,l=I._zod.check(u);if(l instanceof Promise&&d?.async===!1)throw new Ge;if(_||l instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await l,u.issues.length!==b&&(g||(g=At(u,b)))});else{if(u.issues.length===b)continue;g||(g=At(u,b))}}return _?_.then(()=>u):u},"runChecks"),a=i((u,c,d)=>{if(At(u))return u.aborted=!0,u;let g=o(c,n,d);if(g instanceof Promise){if(d.async===!1)throw new Ge;return g.then(_=>e._zod.parse(_,d))}return e._zod.parse(g,d)},"handleCanaryResult");e._zod.run=(u,c)=>{if(c.skipChecks)return e._zod.parse(u,c);if(c.direction==="backward"){let g=e._zod.parse({value:u.value,issues:[]},{...c,skipChecks:!0});return g instanceof Promise?g.then(_=>a(_,u,c)):a(g,u,c)}let d=e._zod.parse(u,c);if(d instanceof Promise){if(c.async===!1)throw new Ge;return d.then(g=>o(g,n,c))}return o(d,n,c)}}he(e,"~standard",()=>({validate:i(o=>{try{let a=Wt(e,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Kt(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Sr=O("$ZodString",(e,t)=>{de.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??jo(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}}),hn=O("$ZodStringFormat",(e,t)=>{yn.init(e,t),Sr.init(e,t)});var ti=O("$ZodURL",(e,t)=>{hn.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.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(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.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=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var _n=O("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??gn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...a?{received:a}:{}}),r}}),ri=O("$ZodNumberFormat",(e,t)=>{Ho.init(e,t),_n.init(e,t)}),vn=O("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=Zo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ni=O("$ZodBigInt",(e,t)=>{de.init(e,t),e._zod.pattern=Vo,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 oi=O("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=r=>r}),ii=O("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=r=>r});var ai=O("$ZodVoid",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),si=O("$ZodDate",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,a=o instanceof Date;return a&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...a?{received:"Invalid Date"}:{},inst:e}),r}});function Xo(e,t,r){e.issues.length&&t.issues.push(...nt(r,e.issues)),t.value[r]=e.value}i(Xo,"handleArrayResult");var ui=O("$ZodArray",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let a=[];for(let u=0;u<o.length;u++){let c=o[u],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?a.push(d.then(g=>Xo(g,r,u))):Xo(d,r,u)}return a.length?Promise.all(a).then(()=>r):r}});function Ar(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...nt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}i(Ar,"handlePropertyResult");function md(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=Co(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(md,"normalizeDef");function fd(e,t,r,n,o,a){let u=[],c=o.keySet,d=o.catchall._zod,g=d.def.type,_=d.optout==="optional";for(let I in t){if(c.has(I))continue;if(g==="never"){u.push(I);continue}let b=d.run({value:t[I],issues:[]},n);b instanceof Promise?e.push(b.then(l=>Ar(l,r,I,t,_))):Ar(b,r,I,t,_)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}i(fd,"handleCatchall");var ci=O("$ZodObject",(e,t)=>{if(de.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d},"get")})}let n=br(()=>md(t));he(e._zod,"propValues",()=>{let c=t.shape,d={};for(let g in c){let _=c[g]._zod;if(_.values){d[g]??(d[g]=new Set);for(let I of _.values)d[g].add(I)}}return d});let o=Ht,a=t.catchall,u;e._zod.parse=(c,d)=>{u??(u=n.value);let g=c.value;if(!o(g))return c.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),c;c.value={};let _=[],I=u.shape;for(let b of u.keys){let l=I[b],m=l._zod.optout==="optional",h=l._zod.run({value:g[b],issues:[]},d);h instanceof Promise?_.push(h.then(p=>Ar(p,c,b,g,m))):Ar(h,c,b,g,m)}return a?fd(_,g,c,d,n.value,e):_.length?Promise.all(_).then(()=>c):c}});function Yo(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let o=e.filter(a=>!At(a));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(u=>ot(u,n,Ke())))}),t)}i(Yo,"handleUnionResults");var bn=O("$ZodUnion",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${o.map(a=>Pr(a.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,a)=>{if(r)return n(o,a);let u=!1,c=[];for(let d of t.options){let g=d._zod.run({value:o.value,issues:[]},a);if(g instanceof Promise)c.push(g),u=!0;else{if(g.issues.length===0)return g;c.push(g)}}return u?Promise.all(c).then(d=>Yo(d,o,e,a)):Yo(c,o,e,a)}});var li=O("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,bn.init(e,t);let r=e._zod.parse;he(e._zod,"propValues",()=>{let o={};for(let a of t.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[c,d]of Object.entries(u)){o[c]||(o[c]=new Set);for(let g of d)o[c].add(g)}}return o});let n=br(()=>{let o=t.options,a=new Map;for(let u of o){let c=u._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(let d of c){if(a.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);a.set(d,u)}}return a});e._zod.parse=(o,a)=>{let u=o.value;if(!Ht(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=n.value.get(u?.[t.discriminator]);return c?c._zod.run(o,a):t.unionFallback?r(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),o)}});var di=O("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Ro(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let a=[],u=t.keyType._zod.values;if(u){r.value={};let c=new Set;for(let g of u)if(typeof g=="string"||typeof g=="number"||typeof g=="symbol"){c.add(typeof g=="number"?g.toString():g);let _=t.valueType._zod.run({value:o[g],issues:[]},n);_ instanceof Promise?a.push(_.then(I=>{I.issues.length&&r.issues.push(...nt(g,I.issues)),r.value[g]=I.value})):(_.issues.length&&r.issues.push(...nt(g,_.issues)),r.value[g]=_.value)}let d;for(let g in o)c.has(g)||(d=d??[],d.push(g));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{r.value={};for(let c of Reflect.ownKeys(o)){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"&&gn.test(c)&&d.issues.length){let I=t.keyType._zod.run({value:Number(c),issues:[]},n);if(I instanceof Promise)throw new Error("Async schemas not supported in object keys currently");I.issues.length===0&&(d=I)}if(d.issues.length){t.mode==="loose"?r.value[c]=o[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(I=>ot(I,n,Ke())),input:c,path:[c],inst:e});continue}let _=t.valueType._zod.run({value:o[c],issues:[]},n);_ instanceof Promise?a.push(_.then(I=>{I.issues.length&&r.issues.push(...nt(c,I.issues)),r.value[d.value]=I.value})):(_.issues.length&&r.issues.push(...nt(c,_.issues)),r.value[d.value]=_.value)}}return a.length?Promise.all(a).then(()=>r):r}});var pi=O("$ZodEnum",(e,t)=>{de.init(e,t);let r=pn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>No.has(typeof o)).map(o=>typeof o=="string"?Et(o):o.toString()).join("|")})$`),e._zod.parse=(o,a)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),mi=O("$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"?Et(n):n?Et(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}});var fi=O("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _r(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new Ge;return r.value=o,r}});function Qo(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(Qo,"handleOptionalResult");var gi=O("$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(`^(${Pr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Qo(a,r.value)):Qo(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var yi=O("$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(`^(${Pr(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 hi=O("$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(u=>Er(u,t.in,n)):Er(a,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>Er(a,t.out,n)):Er(o,t.out,n)}});function Er(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(Er,"handlePipeResult");var _i=O("$ZodCustom",(e,t)=>{it.init(e,t),de.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(a=>ei(a,r,n,e));ei(o,r,n,e)}});function ei(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(fn(o))}}i(ei,"handleRefineResult");var bi;var Pn=class{static{i(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 o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Pi(){return new Pn}i(Pi,"registry");(bi=globalThis).__zod_globalRegistry??(bi.__zod_globalRegistry=Pi());var xn=globalThis.__zod_globalRegistry;function xi(e,t){return new e({type:"string",...ae(t)})}i(xi,"_string");function Ti(e,t){return new e({type:"string",coerce:!0,...ae(t)})}i(Ti,"_coercedString");function Ii(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}i(Ii,"_url");function Ei(e,t){return new e({type:"number",checks:[],...ae(t)})}i(Ei,"_number");function Ai(e,t){return new e({type:"number",coerce:!0,checks:[],...ae(t)})}i(Ai,"_coercedNumber");function Si(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(t)})}i(Si,"_int");function ki(e,t){return new e({type:"boolean",...ae(t)})}i(ki,"_boolean");function $i(e,t){return new e({type:"boolean",coerce:!0,...ae(t)})}i($i,"_coercedBoolean");function wi(e,t){return new e({type:"bigint",coerce:!0,...ae(t)})}i(wi,"_coercedBigint");function zi(e){return new e({type:"any"})}i(zi,"_any");function Oi(e){return new e({type:"unknown"})}i(Oi,"_unknown");function Di(e,t){return new e({type:"void",...ae(t)})}i(Di,"_void");function Ri(e,t){return new e({type:"date",coerce:!0,...ae(t)})}i(Ri,"_coercedDate");function kr(e,t){return new Go({check:"greater_than",...ae(t),value:e,inclusive:!0})}i(kr,"_gte");function Fe(e,t){return new qo({check:"min_length",...ae(t),minimum:e})}i(Fe,"_minLength");function at(e,t){return new Wo({check:"string_format",format:"regex",...ae(t),pattern:e})}i(at,"_regex");function Ni(e,t,r){let n=ae(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}i(Ni,"_custom");var _e=O("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)=>Tr(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Wt(e,r,n),e.parseAsync=async(r,n)=>Ir(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Kt(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)=>xr(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),wr=O("ZodMiniString",(e,t)=>{Sr.init(e,t),_e.init(e,t)});function s(e){return xi(wr,e)}i(s,"string");var Ci=O("ZodMiniStringFormat",(e,t)=>{hn.init(e,t),wr.init(e,t)});var Sd=O("ZodMiniURL",(e,t)=>{ti.init(e,t),Ci.init(e,t)});function Ui(e){return Ii(Sd,e)}i(Ui,"url");var zr=O("ZodMiniNumber",(e,t)=>{_n.init(e,t),_e.init(e,t)});function Pe(e){return Ei(zr,e)}i(Pe,"number");var kd=O("ZodMiniNumberFormat",(e,t)=>{ri.init(e,t),zr.init(e,t)});function Mi(e){return Si(kd,e)}i(Mi,"int");var Tn=O("ZodMiniBoolean",(e,t)=>{vn.init(e,t),_e.init(e,t)});function te(e){return ki(Tn,e)}i(te,"boolean");var Li=O("ZodMiniBigInt",(e,t)=>{ni.init(e,t),_e.init(e,t)});var $d=O("ZodMiniAny",(e,t)=>{oi.init(e,t),_e.init(e,t)});function Xt(){return zi($d)}i(Xt,"any");var wd=O("ZodMiniUnknown",(e,t)=>{ii.init(e,t),_e.init(e,t)});function H(){return Oi(wd)}i(H,"unknown");var zd=O("ZodMiniVoid",(e,t)=>{ai.init(e,t),_e.init(e,t)});function Fi(e){return Di(zd,e)}i(Fi,"_void");var ji=O("ZodMiniDate",(e,t)=>{si.init(e,t),_e.init(e,t)});var Od=O("ZodMiniArray",(e,t)=>{ui.init(e,t),_e.init(e,t)});function F(e,t){return new Od({type:"array",element:e,...ae(t)})}i(F,"array");var Dd=O("ZodMiniObject",(e,t)=>{ci.init(e,t),_e.init(e,t),he(e,"shape",()=>t.shape)});function f(e,t){let r={type:"object",shape:e??{},...ae(t)};return new Dd(r)}i(f,"object");var Rd=O("ZodMiniUnion",(e,t)=>{bn.init(e,t),_e.init(e,t)});function K(e,t){return new Rd({type:"union",options:e,...ae(t)})}i(K,"union");var Nd=O("ZodMiniDiscriminatedUnion",(e,t)=>{li.init(e,t),_e.init(e,t)});function st(e,t,r){return new Nd({type:"union",options:t,discriminator:e,...ae(r)})}i(st,"discriminatedUnion");var Cd=O("ZodMiniRecord",(e,t)=>{di.init(e,t),_e.init(e,t)});function q(e,t,r){return new Cd({type:"record",keyType:e,valueType:t,...ae(r)})}i(q,"record");var Ud=O("ZodMiniEnum",(e,t)=>{pi.init(e,t),_e.init(e,t),e.options=Object.values(t.entries)});function L(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ud({type:"enum",entries:r,...ae(t)})}i(L,"_enum");var Md=O("ZodMiniLiteral",(e,t)=>{mi.init(e,t),_e.init(e,t)});function M(e,t){return new Md({type:"literal",values:Array.isArray(e)?e:[e],...ae(t)})}i(M,"literal");var Ld=O("ZodMiniTransform",(e,t)=>{fi.init(e,t),_e.init(e,t)});function ut(e){return new Ld({type:"transform",transform:e})}i(ut,"transform");var Fd=O("ZodMiniOptional",(e,t)=>{gi.init(e,t),_e.init(e,t)});function v(e){return new Fd({type:"optional",innerType:e})}i(v,"optional");var jd=O("ZodMiniNullable",(e,t)=>{yi.init(e,t),_e.init(e,t)});function Yt(e){return new jd({type:"nullable",innerType:e})}i(Yt,"nullable");var Vd=O("ZodMiniPipe",(e,t)=>{hi.init(e,t),_e.init(e,t)});function ct(e,t){return new Vd({type:"pipe",in:e,out:t})}i(ct,"pipe");var Bd=O("ZodMiniCustom",(e,t)=>{_i.init(e,t),_e.init(e,t)});function Or(e,t){return Ni(Bd,e??(()=>!0),t)}i(Or,"custom");var Qt={};$o(Qt,{bigint:()=>Kd,boolean:()=>Wd,date:()=>Jd,number:()=>qd,string:()=>Hd});function Hd(e){return Ti(wr,e)}i(Hd,"string");function qd(e){return Ai(zr,e)}i(qd,"number");function Wd(e){return $i(Tn,e)}i(Wd,"boolean");function Kd(e){return wi(Li,e)}i(Kd,"bigint");function Jd(e){return Ri(ji,e)}i(Jd,"date");var En=f({retryOnFailure:f({defaultValue:v(te()),hide:v(te())}),continueOnFailure:f({defaultValue:v(te()),hide:v(te())})}),In=class{constructor(t,r,n,o,a,u,c,d,g,_,I,b,l){this.name=t;this.displayName=r;this.description=n;this.props=o;this.propertyGroups=a;this.run=u;this.test=c;this.requireAuth=d;this.errorHandlingOptions=g;this.outputSchema=_;this.audience=I;this.aiMetadata=b;this.classification=l}static{i(this,"IAction")}},D=i(e=>new In(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),"createAction");var ee=f({displayName:s(),description:v(s()),advanced:v(te()),width:v(L(["half","full"])),icon:v(s()),placeholder:v(s())}),W=i((e,t)=>f({type:M(t),required:te(),defaultValue:v(Xt())}),"TPropertyValue");var Re=f({...ee.shape,...W(s(),"SHORT_TEXT").shape}),Je=f({...ee.shape,...W(s(),"LONG_TEXT").shape});var Bi=f({label:s(),value:H(),description:v(s()),icon:v(s())}),Dr=f({disabled:v(te()),placeholder:v(s()),options:F(Bi)});var Yd=L(["cards"]),Ne=f({...ee.shape,options:Dr,display:v(Yd),...W(H(),"STATIC_DROPDOWN").shape}),Xe=f({...ee.shape,options:Dr,...W(F(H()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var An=f({...ee.shape,...W(H(),"DROPDOWN").shape,refreshers:F(s())}),er=f({...ee.shape,...W(F(H()),"MULTI_SELECT_DROPDOWN").shape,refreshers:F(s())});var Ye=f({...ee.shape,reveals:v(F(s())),...W(te(),"CHECKBOX").shape});var Qe=f({...ee.shape,display:v(L(["stepper"])),min:v(Pe()),max:v(Pe()),step:v(Pe()),...W(Pe(),"NUMBER").shape});var tr=f({...ee.shape,streaming:v(te()),...W(H(),"FILE").shape});var rr=f({...ee.shape,...W(s(),"DATE_TIME").shape});var Zi=q(s(),K([Re,Je,Ne,er,Xe,Ye,Qe,tr,rr])),nr=f({...ee.shape,properties:Zi,...W(F(H()),"ARRAY").shape});var Gi=L(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),Hi=f({preset:v(Gi),after:v(s()),before:v(s())}),Sn=f({...ee.shape,display:v(L(["dropdown"])),...W(Hi,"DATE_RANGE").shape});var or=f({...ee.shape,...W(K([q(s(),H())]),"JSON").shape});var qi=K([Re,Ne,or,nr,Xe]),Qd=q(s(),qi),kn=f({refreshers:F(s()),...ee.shape,...W(H(),"DYNAMIC").shape});var Rr=f({...ee.shape,...W(Fi(),"MARKDOWN").shape});var ir=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(ir||{}),St=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(St||{}),kt=(P=>(P.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",P.COMMUNICATION="COMMUNICATION",P.COMMERCE="COMMERCE",P.CORE="CORE",P.UNIVERSAL_AI="UNIVERSAL_AI",P.FLOW_CONTROL="FLOW_CONTROL",P.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",P.ACCOUNTING="ACCOUNTING",P.PRODUCTIVITY="PRODUCTIVITY",P.CONTENT_AND_FILES="CONTENT_AND_FILES",P.DEVELOPER_TOOLS="DEVELOPER_TOOLS",P.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",P.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",P.HUMAN_RESOURCES="HUMAN_RESOURCES",P.PAYMENT_PROCESSING="PAYMENT_PROCESSING",P.MARKETING="MARKETING",P.SALES_AND_CRM="SALES_AND_CRM",P))(kt||{});var ar=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(ar||{}),$n="both_client_credentials_and_authorization_code";var fe=(o=>(o.POLLING="POLLING",o.WEBHOOK="WEBHOOK",o.APP_WEBHOOK="APP_WEBHOOK",o.MANUAL="MANUAL",o))(fe||{}),sr=(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))(sr||{}),ep=f({strategy:L(sr),paramName:v(s())}),ur=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(ur||{});var Nr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(Nr||{}),Wi=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),Ki=f({type:M("DELAY"),resumeDateTime:s(),requestIdToReply:v(s()),handlerId:v(s()),streamStepProgress:v(L(Nr))}),Ji=f({type:M("WEBHOOK"),requestId:s(),requestIdToReply:v(s()),response:Wi,handlerId:v(s()),streamStepProgress:v(L(Nr))}),tp=K([Ki,Ji]);var rp=f({body:H(),rawBody:v(H()),headers:q(s(),s()),queryParams:q(s(),s())});function A(e){return e==null}i(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}i(ce,"isEmpty");function Cr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}i(Cr,"assertNotNullOrUndefined");var wn=we(require("crypto"),1);var np=128,lt,$t,op=i(e=>{if(e<0)throw new RangeError("Wrong ID size");try{!lt||lt.length<e?(lt=Buffer.allocUnsafe(e*np),wn.default.randomFillSync(lt),$t=0):$t+e>lt.length&&(wn.default.randomFillSync(lt),$t=0)}catch(t){throw lt=void 0,t}$t+=e},"fillPool"),ip=i(e=>(op(e|=0),lt.subarray($t-e,$t)),"random"),ap=i((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,o=Math.ceil(1.6*n*t/e.length);return(a=t)=>{if(a<=0)return"";let u="";for(;;){let c=r(o),d=o;for(;d--;)if(u+=e[c[d]&n]||"",u.length===a)return u}}},"customRandom"),Yi=i((e,t=21)=>ap(e,t,ip),"customAlphabet");var sp="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Qi=21,LE=s().check(at(new RegExp(`^[0-9a-zA-Z]{${Qi}}$`))),up=Yi(sp,Qi);var dt=ct(ut(e=>e instanceof Date?e.toISOString():e),s()),Le={id:s(),created:dt,updated:dt},le=i(e=>v(Yt(e)),"Nullable");function zn(e){return v(Yt(L(e)))}i(zn,"NullableEnum");var VE=ct(ut(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),v(te())),Ur=i(e=>ct(ut(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),v(F(e))),"OptionalArrayFromQuery");var GE=q(s(),H());var wt=(p=>(p.OPENAI="openai",p.OPENROUTER="openrouter",p.ANTHROPIC="anthropic",p.AZURE="azure",p.GOOGLE="google",p.ACTIVEPIECES="activepieces",p.CLOUDFLARE_GATEWAY="cloudflare-gateway",p.CUSTOM="custom",p.BEDROCK="bedrock",p.MISTRAL="mistral",p.XAI="xai",p.DEEPSEEK="deepseek",p.ZAI="zai",p.QWEN="qwen",p.MINIMAX="minimax",p.MOONSHOT="moonshot",p))(wt||{});var nA=s().check(at(/^#[0-9A-Fa-f]{6}$/));var iA=f({filename:s(),data:H(),type:M("file"),mimetype:v(s())});var cp=we(ta());var pA=f({...Le,name:s(),permissions:F(s()),platformId:le(s()),type:s(),userCount:v(Pe())});var ra=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(ra||{}),On=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(On||{}),Dn=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(Dn||{});var Rn=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Rn||{});var Nn=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Nn||{});var lp=f({mode:L(ra),value:H()}),dp=f({auth:v(s()),fields:q(s(),lp)}),pp=f({pieceName:s(),pieceVersion:s(),actionName:s(),predefinedInput:v(dp)}),mp=f({type:M("PIECE"),toolName:s().check(Fe(1)),pieceMetadata:pp}),fp=f({type:M("none")}),gp=f({type:M("access_token"),accessToken:s()}),yp=f({type:M("api_key"),apiKey:s(),apiKeyHeader:s()}),hp=f({type:M("headers"),headers:q(s(),s())}),_p=st("type",[fp,gp,yp,hp]),na=f({type:M("FLOW"),toolName:s().check(Fe(1)),externalFlowId:s(),flowDisplayName:v(s())}),oa=f({type:M("MCP"),toolName:s().check(Fe(1)),serverUrl:Ui(),protocol:L(Dn),auth:_p}),ia=f({type:M("KNOWLEDGE_BASE"),toolName:s().check(Fe(1)),sourceType:L(On),sourceId:s(),sourceName:s()}),vp=st("type",[mp,na,oa,ia]),bp=f({displayName:s(),description:v(s()),type:L(Rn)}),aa=f({type:M("MARKDOWN"),markdown:s()}),zt={type:M("TOOL_CALL"),input:le(q(s(),H())),output:v(H()),toolName:s(),status:L(Nn),toolCallId:s(),startTime:s(),endTime:v(s())},BA=f(zt),sa=st("toolCallType",[f({...zt,toolCallType:M("PIECE"),pieceName:s(),pieceVersion:s(),actionName:s()}),f({...zt,toolCallType:M("FLOW"),displayName:s(),externalFlowId:s()}),f({...zt,toolCallType:M("MCP"),displayName:s(),serverUrl:s()}),f({...zt,toolCallType:M("KNOWLEDGE_BASE"),displayName:s(),sourceType:s()}),f({...zt,toolCallType:M("UNKNOWN"),displayName:s()})]),Pp=K([aa,sa]);var Cn=(r=>(r.IMAGE="image",r.TEXT="text",r))(Cn||{}),et=f({apiKey:s()}),xp=et,Tp=f({apiKey:s(),apiKeyHash:s()}),Ip=et,Ep=et,Ap=et,Sp=et,kp=et,$p=et,wp=et,pa=f({accessKeyId:s().check(Fe(1)),secretAccessKey:s().check(Fe(1))}),zp=f({}),Op=f({}),Dp=f({}),Rp=f({}),Np=f({}),Cp=f({}),ma=f({modelId:s(),modelName:s(),modelType:L(Cn)}),fa=f({apiKeyHeader:s(),baseUrl:s(),models:F(ma),defaultHeaders:v(q(s(),s()))}),ga=f({accountId:s(),gatewayId:s(),models:F(ma),vertexProject:v(s()),vertexRegion:v(s())}),ya=f({resourceName:s(),apiVersion:ct(ut(e=>typeof e=="string"&&e.trim().length===0?void 0:e),v(s()))}),ha=f({region:s().check(Fe(1))}),_a=f({}),Up=K([xp,Ap,Sp,kp,$p,Ep,Ip,Tp,pa,wp]),va=K([fa,ga,ya,ha,zp,Dp,Rp,Np,Op,Cp,_a]),Mp=f({id:s(),name:s(),type:L(Cn)}),Lp=f({id:s(),name:s(),provider:L(wt),config:va,enabledForChat:te()}),Fp=f({provider:L(wt),name:s(),enabledForChat:te(),keys:F(f({id:s(),name:s()}))}),jp=f({provider:L(wt),configId:s(),config:va,auth:Up,platformId:s()});var qA={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},ua=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Vp=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],Bp=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],ca=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Zp=["grok-4.20","grok-4.1-fast"],Gp={openai:ua,anthropic:Vp,google:ca,activepieces:[...Bp.map(e=>`anthropic/${e}`),...ua.map(e=>`openai/${e}`),...ca.map(e=>`google/${e}`),...Zp.map(e=>`x-ai/${e}`)]};var la=128e3,Hp={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function qp({provider:e}){return e?Hp[e]??la:la}i(qp,"getMaxContextTokens");var da={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"},Wp={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Kp=new Set(["anthropic","mistral","xai","deepseek","zai","qwen","minimax","moonshot"]),Jp={xai:"https://api.x.ai/v1",deepseek:"https://api.deepseek.com/v1",zai:"https://api.z.ai/api/paas/v4",qwen:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",minimax:"https://api.minimax.io/v1",moonshot:"https://api.moonshot.ai/v1"};function Ee(e){return{chatModels:Gp[e],maxContextTokens:qp({provider:e}),defaultEmbeddingModel:da[e],supportsEmbedding:da[e]!==void 0,supportsImageGeneration:!Kp.has(e),webSearch:Wp[e]}}i(Ee,"buildProviderCapabilities");var Xp={openai:Ee("openai"),anthropic:Ee("anthropic"),openrouter:Ee("openrouter"),azure:Ee("azure"),google:Ee("google"),"cloudflare-gateway":Ee("cloudflare-gateway"),custom:Ee("custom"),bedrock:Ee("bedrock"),mistral:Ee("mistral"),activepieces:Ee("activepieces"),xai:Ee("xai"),deepseek:Ee("deepseek"),zai:Ee("zai"),qwen:Ee("qwen"),minimax:Ee("minimax"),moonshot:Ee("moonshot")};var Yp=f({base64Url:s(),fileName:s(),extension:v(s())}),Qp=f({mimeType:s(),url:s(),fileName:v(s())}),Un=K([Yp,Qp]);var em=K([f({type:M("file"),value:Un}),f({type:M("markdown"),value:s(),files:v(F(Un))})]),tm=f({sessionId:s(),message:s(),files:v(F(s()))});var Pa=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Pa||{}),xa=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(xa||{}),Mn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Mn||{});var rm=K([f({...Le,name:s(),externalId:s(),type:M("STATIC_DROPDOWN"),tableId:s(),projectId:s(),data:f({options:F(f({value:s()}))})}),f({...Le,name:s(),externalId:s(),type:K([M("TEXT"),M("NUMBER"),M("DATE"),M("DATETIME")]),tableId:s(),projectId:s()})]),nm=f({...Le,name:s(),folderId:le(s()),projectId:s(),externalId:s(),status:zn(xa),trigger:zn(Pa)}),om=f({...Le,tableId:s(),projectId:s(),cells:q(s(),f({updated:s(),created:s(),value:H(),fieldName:s()}))}),im=f({events:F(L(Mn)),webhookUrl:s(),flowId:s()}),am=f({fields:F(f({id:s(),name:s()})),rows:F(q(s(),s())),name:s()}),sm=f({projectId:s(),limit:v(Qt.number()),cursor:v(s()),name:v(s()),externalIds:Ur(s()),folderId:v(s()),folderIds:Ur(s())}),um=f({records:F(F(f({fieldId:s(),value:Ia()}))),tableId:s()}),cm=f({cells:v(F(f({fieldId:s(),value:Ia()}))),tableId:s(),agentUpdate:v(te())}),Ta=st("operator",[_t("eq"),_t("neq"),_t("gt"),_t("gte"),_t("lt"),_t("lte"),_t("co"),ba("exists"),ba("not_exists")]),lm=f({tableId:s(),limit:v(Qt.number()),cursor:v(s()),filters:Ur(Ta)});function Ia(){return ct(ut(e=>e==null?e:String(e)),Yt(s()))}i(Ia,"coerceToString");function _t(e){return f({fieldId:s(),operator:M(e),value:s()})}i(_t,"valueFilter");function ba(e){return f({fieldId:s(),operator:M(e)})}i(ba,"existenceFilter");var dm=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),pm=f({...Le,deleted:le(dt),ownerId:s(),displayName:s(),platformId:s(),externalId:le(s())});var Ea=f({name:s(),description:v(s()),type:s(),required:te()}),mm=f({pieceName:s(),triggerName:s(),input:f({toolName:s(),toolDescription:s(),inputSchema:F(Ea),returnsResponse:te()})});var Aa="^[0-9]+\\.[0-9]+\\.[0-9]+$",pS=new RegExp(Aa),gm="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",mS=s().check(at(new RegExp(Aa))),fS=s().check(at(new RegExp(gm))),ym=f({packageType:M("ARCHIVE"),pieceType:L(St),pieceName:s(),pieceVersion:s(),archiveId:s(),platformId:s()}),Sa=f({packageType:M("REGISTRY"),pieceType:M("OFFICIAL"),pieceName:s(),pieceVersion:s()}),ka=f({packageType:M("REGISTRY"),pieceType:M("CUSTOM"),pieceName:s(),pieceVersion:s(),platformId:s()}),gS=K([Sa,ka]),yS=K([ym,Sa,ka]);var hm=st("type",[f({type:M("CRON_EXPRESSION"),cronExpression:s(),timezone:s()}),f({type:M("INTERVAL"),intervalMs:Mi().check(kr(6e4))})]),hS=f({...Le,type:L(fe),projectId:s(),flowId:s(),triggerName:s(),schedule:le(hm),flowVersionId:s(),pieceName:s(),pieceVersion:s(),deleted:le(s()),simulate:te()}),$a=(p=>(p.UNKNOWN="UNKNOWN",p.FLOW_RUN_LOG="FLOW_RUN_LOG",p.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",p.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",p.FLOW_STEP_FILE="FLOW_STEP_FILE",p.SAMPLE_DATA="SAMPLE_DATA",p.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",p.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",p.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",p.PROJECT_RELEASE="PROJECT_RELEASE",p.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",p.PLATFORM_ASSET="PLATFORM_ASSET",p.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",p.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",p.KNOWLEDGE_BASE="KNOWLEDGE_BASE",p.FLOW_BUNDLE="FLOW_BUNDLE",p))($a||{}),wa=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(wa||{}),za=(r=>(r.S3="S3",r.DB="DB",r))(za||{}),_S=f({...Le,projectId:le(s()),platformId:le(s()),type:L($a),compression:L(wa),data:v(H()),location:L(za),size:le(Pe()),fileName:le(s()),s3Key:le(s()),metadata:le(q(s(),s()))}),Oa=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Oa||{}),Da=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Da||{}),vS=f({id:s(),email:s(),firstName:s(),status:L(Da),externalId:le(s()),platformId:le(s()),platformRole:L(Oa),lastName:s(),created:dt,updated:dt,lastActiveDate:le(dt),imageUrl:le(s())});var Ln=f({...ee.shape,...W(q(s(),H()),"OBJECT").shape});var Fn=f({...ee.shape,formatProperty:v(s()),...W(s(),"RICH_TEXT").shape});var Ua=f({...ee.shape,...W(s(),"COLOR").shape});var jn=K([Re,Je,Fn,Rr,Ye,Ne,Xe,An,er,kn,Qe,nr,Ln,or,rr,Sn,tr,Ua]),y={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},RichText(e){return{...e,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},DateRange(e){return{...e,valueSchema:void 0,type:"DATE_RANGE"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var He=f({displayName:s(),description:v(s()),hasConnectionIdentifier:v(te())});var Ma=f({username:s(),password:s()}),Vn=f({...He.shape,username:f({displayName:s(),description:v(s())}),password:f({displayName:s(),description:v(s())}),...W(Ma,"BASIC_AUTH").shape});var Pm=q(s(),K([Re,Je,Qe,Ye,Ne])),Bn=f({...He.shape,props:Pm,...W(H(),"CUSTOM_AUTH").shape});var vt=f({...He.shape,...W(f({auth:s()}),"SECRET_TEXT").shape});var xm=q(s(),K([Re,Je,vt,Qe,Ye,Ne,Xe,Rr])),La=f({...He.shape,props:xm,...W(H(),"OIDC").shape});var Zn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Zn||{}),Fa=K([Re,vt,Ne]),ja=q(s(),Fa),Tm=f({props:v(q(s(),Fa)),authUrl:s(),tokenUrl:s(),scope:F(s()),prompt:v(K([M("none"),M("consent"),M("login"),M("omit")])),pkce:v(te()),pkceMethod:v(K([M("plain"),M("S256")])),authorizationMethod:v(L(Zn)),grantType:v(K([L(ar),M($n)])),extra:v(q(s(),s()))}),Va=f({access_token:s(),props:v(ja),data:q(s(),Xt())}),Gn=f({...He.shape,...Tm.shape,...W(Va,"OAUTH2").shape});var Ot=K([Vn,Bn,La,Gn,vt]),cr="Connection",Hn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||cr}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||cr,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||cr}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||cr}},None(){}};var r$={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 Im=f({...ee.shape,...W(H(),"CUSTOM").shape,code:s()});var Em=K([jn,Ot]),qn=q(s(),Em),T$=q(s(),jn);var Ba=K([f({strategy:M("CRON"),cronExpression:s()}),f({strategy:M("NONE")})]),Dt=class{constructor(t,r,n,o,a,u,c,d,g,_,I,b,l,m,h,p,P,T,z,ne,ve){this.name=t;this.displayName=r;this.description=n;this.requireAuth=o;this.props=a;this.type=u;this.handshakeConfiguration=c;this.onHandshake=d;this.renewConfiguration=g;this.onRenew=_;this.onEnable=I;this.onDisable=b;this.onStart=l;this.run=m;this.test=h;this.sampleData=p;this.testStrategy=P;this.outputSchema=T;this.aiMetadata=z;this.classification=ne;this.propertyGroups=ve}static{i(this,"ITrigger")}},oe=i(e=>{switch(e.type){case"WEBHOOK":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"POLLING":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"MANUAL":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"APP_WEBHOOK":return new Dt(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,e.classification,e.propertyGroups)}},"createTrigger");var Za="2",Lr="0.82.0";var Wn=class{constructor(t,r,n,o,a,u,c,d,g=Lr,_,I="",b){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=o;this.categories=c;this.auth=d;this.minimumSupportedRelease=g;this.maximumSupportedRelease=_;this.description=I;this.deprecated=b;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:Za}),"getContextInfo");(!Sm(g)||km(g,Lr))&&(this.minimumSupportedRelease=Lr),a.forEach(l=>this._actions[l.name]=l),u.forEach(l=>this._triggers[l.name]=l)}static{i(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:Am(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}},Ha=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,o)=>n===o.findIndex(a=>a.type===r.type)))throw new Error("Auth properties must be unique by type");return new Wn(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 Am(e){if(e!==void 0)return Array.isArray(e)?e.map(Ga):Ga(e)}i(Am,"withConnectionIdentifierFlag");function Ga(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}i(Ga,"flagConnectionIdentifier");function Sm(e){return/^\d+\.\d+\.\d+$/.test(e)}i(Sm,"isValidSimpleSemver");function km(e,t){let[r,n,o]=e.split(".").map(Number),[a,u,c]=t.split(".").map(Number);return r!==a?r<a:n!==u?n<u:o<c}i(km,"isSemverLessThan");var $m=v(q(s(),q(s(),s()))),qa=f({id:v(s()),name:s(),displayName:s(),logoUrl:s(),description:s(),authors:F(s()),platformId:v(s()),directoryPath:v(s()),auth:v(K([Ot,F(Ot)])),version:s(),categories:v(F(L(kt))),minimumSupportedRelease:v(s()),maximumSupportedRelease:v(s()),deprecated:v(te()),i18n:$m}),wm=L(["human","ai","both"]),Wa=f({description:v(s()),idempotent:v(te())}),Ka=L(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var zm=L(["tabs","section","summary","builder","footer"]),Ja=f({key:s(),display:zm,label:v(s()),description:v(s()),icon:v(s()),props:F(s())}),Xa=f({name:s(),displayName:s(),description:s(),props:qn,propertyGroups:v(F(Ja)),requireAuth:te(),errorHandlingOptions:v(En),outputSchema:v(Or()),audience:v(wm),aiMetadata:v(Wa),classification:v(Ka)}),Ya=f({name:s(),displayName:s(),description:s(),props:qn,propertyGroups:v(F(Ja)),errorHandlingOptions:v(En),type:L(fe),sampleData:H(),handshakeConfiguration:v(Or()),renewConfiguration:v(Ba),testStrategy:L(ur),outputSchema:v(Or()),aiMetadata:v(Wa),classification:v(Ka)}),Om=f({...qa.shape,actions:q(s(),Xa),triggers:q(s(),Ya)}),Dm=f({...qa.shape,actions:Pe(),triggers:Pe(),suggestedActions:v(F(Xa)),suggestedTriggers:v(F(Ya))}),Qa=f({projectUsage:Pe(),pieceType:L(St),packageType:L(ir),platformId:v(s()),archiveId:v(s())}),Ew=f({...Om.shape,...Qa.shape}),Aw=f({...Dm.shape,...Qa.shape}),Sw=f({name:s(),version:s()});var Rm=we(require("path")),Nm=we(require("fs/promises"));var Rt=require("node:stream");var Fr=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{i(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,o=new URLSearchParams;return r.searchParams.forEach((a,u)=>{o.append(u,a)}),{urlWithoutQueryParams:n,queryParams:o}}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 jr=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new Kn,r=new Jn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Kn=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Jn=class{static{i(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,o=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${o}`,r}};var bt=class extends Error{constructor(r,n){let o=n.status||500,a=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:o,body:a},request:{body:r}}));this.requestBody=r;this.status=o,this.responseBody=a}static{i(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 es({error:e,requestBody:t}){return e instanceof bt?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}i(es,"toFailsafeOutput");var Pt=(u=>(u.GET="GET",u.POST="POST",u.PATCH="PATCH",u.PUT="PUT",u.DELETE="DELETE",u.HEAD="HEAD",u))(Pt||{});var Vr=class extends Fr{static{i(this,"FetchHttpClient")}constructor(t="",r=new jr){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:o}=this.getUrl(t),a=this.getHeaders(t),u=t.queryParams??{};for(let[z,ne]of Object.entries(u))o.append(z,ne);let c=o.toString(),d=c?`${n}?${c}`:n,g=t.responseType??"json",_=t.followRedirects??!0,I=t.retries??0,{body:b,extraHeaders:l,isStream:m}=Cm(t.method)?Um(t.body,a):{body:void 0,extraHeaders:{},isStream:!1},h=Lm({...a,...l}),p=await Mm(async()=>{let z=new AbortController,ne=t.timeout&&t.timeout>0?setTimeout(()=>z.abort(),t.timeout):void 0;try{let ve={method:t.method.toString(),headers:h,body:b,redirect:_?"follow":"manual",signal:z.signal};return m&&(ve.duplex="half"),r?.dispatcher!==void 0&&(ve.dispatcher=r.dispatcher),await fetch(d,ve)}finally{ne!==void 0&&clearTimeout(ne)}},m?0:I),P=_?300:400;if(p.status<200||p.status>=P){let z=await ts(p,g==="stream"?"text":g),ne=new bt(t.body,{status:p.status,responseBody:z});throw console.error("[HttpClient#(sanitized error message)] Request failed:",ne),ne}let T=await ts(p,g);return{status:p.status,headers:Fm(p.headers),body:T}}};function Cm(e){return e!=="GET"&&e!=="HEAD"}i(Cm,"acceptsRequestBody");function Um(e,t){if(ns(e))return{body:void 0,extraHeaders:{},isStream:!1};if(jm(e)){let n=new Rt.PassThrough;return e.on("error",o=>n.destroy(o)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return e instanceof Rt.Readable?{body:e,extraHeaders:{},isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}i(Um,"serializeBody");async function ts(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"stream":return ns(e.body)?Rt.Readable.from([]):Rt.Readable.fromWeb(e.body);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}}}}i(ts,"parseResponseBody");async function Mm(e,t){let r;for(let n=0;n<=t;n++)try{let o=await e();if(o.status>=500&&n<t){await rs(n);continue}return o}catch(o){if(r=o,n<t){await rs(n);continue}throw o}throw r}i(Mm,"sendWithRetries");function rs(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(rs,"backoff");function Lm(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}i(Lm,"normalizeHeaders");function Fm(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}i(Fm,"toHttpHeaders");function jm(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}i(jm,"isNodeFormData");function ns(e){return e==null}i(ns,"isNil");var ze=new Vr;var $g=we(require("fs")),uc=we(_o());var wg={"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 zg(e){let t=e.split(";")[0].trim().toLowerCase();return wg[t]??""}i(zg,"contentTypeToExtension");var Og=i(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Dg=i((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 cc({auth:e,baseUrl:t,authMapping:r,description:n,displayName:o,name:a,props:u,extraProps:c,authLocation:d="headers",classification:g="WRITE"}){return D({audience:"human",name:a||"custom_api_call",classification:g,displayName:o||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:y.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:i(async({auth:_})=>({url:y.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
+ i.e ${Dg(t,_)}/resource or /resource`,required:!0,defaultValue:_?t(_):"",...u?.url??{}})}),"props")}),method:y.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Pt).map(_=>({label:_,value:_}))},...u?.method??{}}),headers:y.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...u?.headers??{}}),queryParams:y.Object({displayName:"Query Parameters",required:!0,...u?.queryParams??{}}),body_type:y.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:y.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:i(async({body_type:_})=>{if(!_)return{};let I=_,b={};switch(I){case"none":break;case"json":b.data=y.Json({displayName:"JSON Body",required:!0,...u?.body??{}});break;case"raw":b.data=y.LongText({displayName:"Raw Body",required:!0});break;case"form_data":b.data=y.Array({displayName:"Form Data",required:!0,properties:{fieldName:y.ShortText({displayName:"Field Name",required:!0}),fieldType:y.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:y.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:y.File({displayName:"File Field Value",required:!1})}});break}return b},"props")}),response_is_binary:y.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:y.Checkbox({displayName:"No Error on Failure",required:!1,...u?.failsafe??{}}),timeout:y.Number({displayName:"Timeout (in seconds)",required:!1,...u?.timeout??{}}),followRedirects:y.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...c},run:i(async _=>{let{method:I,url:b,headers:l,queryParams:m,body:h,body_type:p,failsafe:P,timeout:T,response_is_binary:z,followRedirects:ne}=_.propsValue;Cr(I,"Method"),Cr(b,"URL");let ve=A(r)?{}:await r(_.auth,_.propsValue),De=b.url,ye=De.startsWith("http://")||De.startsWith("https://")?De:Og({baseUrl:t(_.auth),relativePath:De}),Y={method:I,url:ye,headers:{...l??{},...d==="headers"||!A(d)?ve:{}},queryParams:{...d==="queryParams"?ve:{},...m??{}},timeout:T?T*1e3:0,followRedirects:ne};if(z&&(Y.responseType="arraybuffer"),h)if(p&&p!=="none"){let ke=h.data;if(p==="form_data"){let yr=ke,V=new uc.default;for(let{fieldName:w,fieldType:S,textFieldValue:N,fileFieldValue:$}of yr)S==="text"&&!ce(N)?V.append(w,N):S==="file"&&!ce($)&&V.append(w,$.data,{filename:$?.filename});Y.body=V,Y.headers={...Y.headers,...V.getHeaders()}}else Y.body=ke}else p||(Y.body=h);try{let ke=await ze.sendRequest(Y);return await Rg(_.files,ke.body,ke.status,ke.headers,z)}catch(ke){if(P)return es({error:ke,requestBody:Y.body});throw ke}},"run")})}i(cc,"createCustomApiCallAction");var Rg=i(async(e,t,r,n,o)=>{let a;if(o&&Ng(t)){let u=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],c=zg(u??"")||"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"),Ng=i(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var xo=we(mt());var ue={subscribeWebhook:i(async(e,t,r,n,o)=>{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:o},queryParams:{}},{body:u}=await ze.sendRequest(a);return u},"subscribeWebhook"),unsubscribeWebhook:i(async(e,t,r)=>{let n={method:"DELETE",url:`${t}/api/v1/webhooks/${e}`,authentication:{type:"BEARER_TOKEN",token:r}};return await ze.sendRequest(n)},"unsubscribeWebhook")};async function x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=`${t}/api${n}`,c={};if(o)for(let[_,I]of Object.entries(o))I!=null&&(c[_]=Array.isArray(I)?I.map(String).join(","):String(I));let d;a&&(d=Object.entries(a).reduce((_,[I,b])=>(A(b)||(_[I]=b),_),{}));let g={method:r,url:u,authentication:{type:"BEARER_TOKEN",token:e},queryParams:c,body:d};try{return(await ze.sendRequest(g)).body}catch(_){throw _ instanceof bt&&_.response.status===403?new Error("Please reconnect your Pipedrive account."):_}}i(x,"pipedriveApiCall");async function k({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=o||{};u.start=0,u.limit=500;let c=[],d=!0;do{let g=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:u,body:a});if(A(g.data))break;c.push(...g.data),u.start=g.additional_data.pagination.next_start,d=g.additional_data.pagination.more_items_in_collection}while(d);return c}i(k,"pipedrivePaginatedV1ApiCall");async function ge({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=o?{...o}:{},c,d=[],g=!0;do{let _={...u};c&&(_.cursor=c),_.limit=500;let I=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:_,body:a});if(A(I.data))break;Array.isArray(I.data)?d.push(...I.data):d.push(I.data),g=I.additional_data?.next_cursor!=null,c=I.additional_data?.next_cursor}while(g&&c);return d}i(ge,"pipedrivePaginatedV2ApiCall");function Po(e){return(0,xo.default)(e).isValid()?(0,xo.default)(e).format("YYYY-MM-DD"):e}i(Po,"formatDateIfValid");function Ae(e,t){let r=e.reduce((o,a)=>(o[a.key]=a,o),{}),n={};for(let[o,a]of Object.entries(t)){if(ce(a))continue;let u=r[o];if(u){if(u.is_subfield){let c=o.split("_")[0];n[c]={...n[c],[u.id_suffix]:u.field_type==="date"?Po(a):a};continue}switch(u.field_type){case"monetary":n[o]={...n[o],value:Number(a)};break;case"address":case"daterange":case"timerange":case"time":n[o]={...n[o],value:Po(a)};break;case"date":n[o]=Po(a);break;default:n[o]=a;break}}}return n}i(Ae,"pipedriveParseCustomFields");function R(e,t){let r={...t},n=t.custom_fields||{};for(let o of e){if(!o.edit_flag)continue;let a=o.key,u=o.name,c=o.field_type;if(a in n){let d=n[a];A(d)?r[u]=null:c==="enum"?r[u]=o.options?.find(g=>g.id===d)?.label||null:c==="set"&&Array.isArray(d)?r[u]=d.map(g=>o.options?.find(_=>_.id===g)?.label||null):r[u]=d}}return delete r.custom_fields,r}i(R,"pipedriveTransformCustomFields");function Tt(e,t){let r={...t};for(let n of e){if(!n.edit_flag)continue;let o=n.key,a=n.name,u=n.field_type;if(o in t){if(t[o]===null||t[o]===void 0)r[a]=null;else if(u==="enum")r[a]=n.options?.find(c=>c.id.toString()===t[o])?.label||null;else if(u==="set"){let c=t[o].split(",");r[a]=c.map(d=>n.options?.find(g=>g.id.toString()===d)?.label||null)}else r[a]=t[o];delete r[o]}}return r}i(Tt,"pipedriveTransformV1CustomFields");var E=Hn.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 lc=[{key:"value",label:"Value"},{key:"label",label:"Label"},{key:"primary",label:"Primary",format:"boolean"}],Yr=[{key:"id",label:"Person ID",format:"number"},{key:"name",label:"Name"},{key:"first_name",label:"First Name"},{key:"last_name",label:"Last Name"},{key:"emails",label:"Emails",labelKey:"value",listItems:lc},{key:"phones",label:"Phones",labelKey:"value",listItems:lc},{key:"org_id",label:"Organization ID",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"visible_to",label:"Visible To"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Cg=[{key:"open_deals_count",label:"Open Deals",format:"number"},{key:"won_deals_count",label:"Won Deals",format:"number"},{key:"lost_deals_count",label:"Lost Deals",format:"number"},{key:"closed_deals_count",label:"Closed Deals",format:"number"},{key:"activities_count",label:"Activities",format:"number"},{key:"done_activities_count",label:"Done Activities",format:"number"},{key:"undone_activities_count",label:"Undone Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"last_incoming_mail_time",label:"Last Incoming Mail",format:"datetime"},{key:"last_outgoing_mail_time",label:"Last Outgoing Mail",format:"datetime"}],Qr=[...Yr,...Cg],Io=[{key:"id",label:"Deal ID",format:"number"},{key:"title",label:"Title"},{key:"value",label:"Value",format:"number"},{key:"currency",label:"Currency"},{key:"status",label:"Status"},{key:"probability",label:"Probability",format:"number"},{key:"stage_id",label:"Stage ID",format:"number"},{key:"pipeline_id",label:"Pipeline ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_user_id",label:"Creator User ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"expected_close_date",label:"Expected Close Date",format:"date"},{key:"close_time",label:"Closed At",format:"datetime"},{key:"won_time",label:"Won At",format:"datetime"},{key:"lost_time",label:"Lost At",format:"datetime"},{key:"lost_reason",label:"Lost Reason"},{key:"stage_change_time",label:"Stage Changed At",format:"datetime"},{key:"mrr",label:"MRR",format:"number"},{key:"arr",label:"ARR",format:"number"},{key:"acv",label:"ACV",format:"number"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Ug=[{key:"activities_count",label:"Activities",format:"number"},{key:"done_activities_count",label:"Done Activities",format:"number"},{key:"undone_activities_count",label:"Undone Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"participants_count",label:"Participants",format:"number"},{key:"products_count",label:"Products",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"smart_bcc_email",label:"Smart BCC Email",format:"email"}],Ft=[...Io,...Ug],Eo=[{key:"id",label:"Organization ID",format:"number"},{key:"name",label:"Name"},{key:"address",label:"Address"},{key:"website",label:"Website",format:"url"},{key:"linkedin",label:"LinkedIn",format:"url"},{key:"industry",label:"Industry"},{key:"employee_count",label:"Employees",format:"number"},{key:"annual_revenue",label:"Annual Revenue",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"visible_to",label:"Visible To"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Mg=[{key:"people_count",label:"People",format:"number"},{key:"open_deals_count",label:"Open Deals",format:"number"},{key:"won_deals_count",label:"Won Deals",format:"number"},{key:"lost_deals_count",label:"Lost Deals",format:"number"},{key:"closed_deals_count",label:"Closed Deals",format:"number"},{key:"activities_count",label:"Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"}],en=[...Eo,...Mg],mr=[{key:"id",label:"Activity ID",format:"number"},{key:"subject",label:"Subject"},{key:"type",label:"Type"},{key:"done",label:"Done",format:"boolean"},{key:"due_date",label:"Due Date",format:"date"},{key:"due_time",label:"Due Time"},{key:"duration",label:"Duration",format:"duration"},{key:"priority",label:"Priority"},{key:"note",label:"Note",format:"html"},{key:"public_description",label:"Public Description"},{key:"location",label:"Location"},{key:"outcome",label:"Outcome"},{key:"busy",label:"Busy",format:"boolean"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"lead_id",label:"Lead ID"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_user_id",label:"Creator User ID",format:"number"},{key:"participants",label:"Participants"},{key:"conference_meeting_url",label:"Meeting URL",format:"url"},{key:"marked_as_done_time",label:"Marked Done At",format:"datetime"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Lg=[{key:"price",label:"Price",format:"number"},{key:"currency",label:"Currency"},{key:"cost",label:"Cost",format:"number"},{key:"direct_cost",label:"Direct Cost",format:"number"},{key:"notes",label:"Notes"}],tn=[{key:"id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"code",label:"Code"},{key:"description",label:"Description"},{key:"unit",label:"Unit"},{key:"tax",label:"Tax",format:"number"},{key:"category",label:"Category"},{key:"prices",label:"Prices",labelKey:"currency",listItems:Lg},{key:"billing_frequency",label:"Billing Frequency"},{key:"billing_frequency_cycles",label:"Billing Cycles",format:"number"},{key:"is_linkable",label:"Linkable",format:"boolean"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Fg=[{key:"id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"code",label:"Code"},{key:"tax",label:"Tax",format:"number"},{key:"type",label:"Type"},{key:"owner",label:"Owner"},{key:"visible_to",label:"Visible To"},{key:"custom_fields",label:"Custom Fields",dynamicKey:!0}],rn=[{key:"id",label:"Note ID",format:"number"},{key:"content",label:"Content",format:"html"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"lead_id",label:"Lead ID"},{key:"deal",label:"Deal",children:[{key:"title",label:"Title"}]},{key:"user",label:"Author",children:[{key:"name",label:"Name"},{key:"email",label:"Email",format:"email"}]},{key:"user_id",label:"Author ID",format:"number"},{key:"last_update_user_id",label:"Last Updated By",format:"number"},{key:"pinned_to_deal_flag",label:"Pinned to Deal",format:"boolean"},{key:"pinned_to_person_flag",label:"Pinned to Person",format:"boolean"},{key:"pinned_to_organization_flag",label:"Pinned to Organization",format:"boolean"},{key:"active_flag",label:"Active",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Ao=[{key:"id",label:"Lead ID"},{key:"title",label:"Title"},{key:"value",label:"Value"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_id",label:"Creator ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"organization_id",label:"Organization ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"expected_close_date",label:"Expected Close Date",format:"date"},{key:"source_name",label:"Source"},{key:"channel",label:"Channel"},{key:"cc_email",label:"CC Email",format:"email"},{key:"was_seen",label:"Seen",format:"boolean"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],jg=[{key:"id",label:"Lead ID"},{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"value",label:"Value",format:"number"},{key:"currency",label:"Currency"},{key:"person",label:"Person"},{key:"organization",label:"Organization"},{key:"owner",label:"Owner"},{key:"emails",label:"Emails"},{key:"phones",label:"Phones"},{key:"notes",label:"Notes"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"visible_to",label:"Visible To"},{key:"custom_fields",label:"Custom Fields",dynamicKey:!0}],Vg=[{key:"id",label:"User ID",format:"number"},{key:"name",label:"Name"},{key:"email",label:"Email",format:"email"}],Bg=[{key:"id",label:"Deal Product ID",format:"number"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"product_id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"item_price",label:"Item Price",format:"number"},{key:"quantity",label:"Quantity",format:"number"},{key:"sum",label:"Sum",format:"number"},{key:"currency",label:"Currency"},{key:"discount",label:"Discount",format:"number"},{key:"discount_type",label:"Discount Type"},{key:"tax",label:"Tax",format:"number"},{key:"tax_method",label:"Tax Method"},{key:"comments",label:"Comments"},{key:"order_nr",label:"Order Number",format:"number"},{key:"is_enabled",label:"Enabled",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Zg=[{key:"user_id",label:"User ID",format:"number"},{key:"add_time",label:"Followed At",format:"datetime"}],Gg=[{key:"id",label:"File ID",format:"number"},{key:"name",label:"Name"},{key:"file_name",label:"Stored File Name"},{key:"file_type",label:"File Type"},{key:"file_size",label:"File Size",format:"number"},{key:"url",label:"Download URL",format:"url"},{key:"description",label:"Description"},{key:"user_id",label:"User ID",format:"number"},{key:"active_flag",label:"Active",format:"boolean"},{key:"inline_flag",label:"Inline",format:"boolean"},{key:"remote_location",label:"Remote Location"},{key:"remote_id",label:"Remote ID"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"deal_name",label:"Deal Name"},{key:"lead_id",label:"Lead ID"},{key:"lead_name",label:"Lead Name"},{key:"person_id",label:"Person ID",format:"number"},{key:"person_name",label:"Person Name"},{key:"org_id",label:"Organization ID",format:"number"},{key:"org_name",label:"Organization Name"},{key:"product_id",label:"Product ID",format:"number"},{key:"product_name",label:"Product Name"},{key:"activity_id",label:"Activity ID",format:"number"},{key:"log_id",label:"Log ID",format:"number"},{key:"mail_message_id",label:"Mail Message ID",format:"number"},{key:"mail_template_id",label:"Mail Template ID",format:"number"},{key:"cid",label:"Content ID"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}];function Te(e,t){return{fields:[{key:"success",label:"Success",format:"boolean"},{key:"data",label:e,children:t}]}}i(Te,"envelope");function Ve({label:e,fields:t,labelKey:r}){return{fields:[{key:"found",label:"Found",format:"boolean"},{key:"data",label:e,labelKey:r,listItems:t}]}}i(Ve,"search");var dc=Te("Person",Yr),pc=Te("Person",Yr),mc=Te("Person",Yr),fc=Te("Deal",Io),gc=Te("Deal",Io),yc=Te("Organization",Eo),hc=Te("Organization",Eo),_c=Te("Activity",mr),vc=Te("Activity",mr),bc=Te("Product",tn),Pc=Te("Product",tn),xc=Te("Deal Product",Bg),Tc=Te("Note",rn),Ic=Te("Note",rn),Ec=Te("Lead",Ao),Ac=Te("Lead",Ao),Sc=Ve({label:"People",fields:Qr,labelKey:"name"}),kc=Ve({label:"Deals",fields:Ft,labelKey:"title"}),$c=Ve({label:"Deals",fields:Ft,labelKey:"title"}),wc=Ve({label:"Organizations",fields:en,labelKey:"name"}),zc=Ve({label:"Activities",fields:mr,labelKey:"subject"}),Oc=Ve({label:"Notes",fields:rn,labelKey:"content"}),Dc=Ve({label:"Leads",fields:jg,labelKey:"title"}),Rc=Ve({label:"Users",fields:Vg,labelKey:"name"}),Nc=Ve({label:"Products",fields:tn,labelKey:"name"}),Cc=Ve({label:"Products",fields:tn,labelKey:"name"}),Uc=Ve({label:"Products",fields:Fg,labelKey:"name"}),Mc=Te("Follower",Zg),Lc=Te("File",Gg),Fc={fields:Qr},jc={fields:Qr},Vc={fields:Ft},Bc={fields:Ft},Zc={fields:Ft},Gc={fields:en},Hc={fields:en},qc={fields:mr},Wc={fields:rn},Kc={fields:Ao},Jc={fields:Qr},Xc={fields:Ft},Yc={fields:en},Qc={fields:mr};var el=oe({auth:E,name:"new_activity",outputSchema:qc,classification:"READ",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 x({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 x({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 Be=["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"],Se=["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"],Ze=["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 tl=oe({auth:E,name:"new_deal",outputSchema:Vc,classification:"READ",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 x({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:Se.join(",")}}),r=await k({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 o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${t.data.id}`,query:{include_fields:Se.join(",")}}),n=await k({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 rl=oe({auth:E,name:"new_person",outputSchema:Fc,classification:"READ",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 x({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:Be.join(",")}}),r=await k({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 o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Be.join(",")}}),n=await k({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 ol=oe({auth:E,name:"updated_deal",outputSchema:Bc,classification:"READ",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:y.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:y.DynamicProperties({auth:E,displayName:"Field Values",required:!1,refreshers:["filter_by"],props:i(async({auth:e,filter_by:t})=>{if(!e||!t)return{};let r={},n=e,o=t;if(o==="status"&&(r.field_value=y.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"}]}})),o==="stage_id"){let a=await ze.sendRequest({method:"GET",url:`${n.data.api_domain}/api/v2/stages`,authentication:{type:"BEARER_TOKEN",token:n.access_token}});r.field_value=y.StaticDropdown({displayName:"Stage in Pipeline",required:!0,options:{disabled:!1,options:a.body.data.map(u=>({label:u.name,value:u.id}))}})}return r},"props")}),field_to_watch:y.Dropdown({auth:E,displayName:"Field to watch for Changes On",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{placeholder:"Connect your account",disabled:!0,options:[]};let t=e,r=await ze.sendRequest({method:"GET",url:`${t.data.api_domain}/api/v1/dealFields`,authentication:{type:"BEARER_TOKEN",token:t.access_token}}),n=[];for(let o of r.body.data)n.push({label:o.name,value:o.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:Se.join(",")};t&&r&&(n[t]=r);let o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:n});if(A(o.data))return[];let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),u=[];for(let c of o.data){let d=R(a,c);u.push(d)}return u},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,o=e.payload.body,a=nl(o.data),u=nl(o.previous),c=!t&&!n,d=n&&n in u&&a[n]!==u[n],g=t&&a[t]===r;if(c||!t&&d||g&&(!n||d)){let _=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${o.data.id}`,query:{include_fields:Se.join(",")}}),I=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(I,_.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 nl(e){let{custom_fields:t,...r}=e;if(!t)return r;let n={};for(let[o,a]of Object.entries(t)){if(A(a)){n[o]=a;continue}switch(a.type){case"varchar":case"text":case"varchar_auto":case"double":case"phone":case"date":n[o]=a?.value;break;case"set":n[o]=a?.values?.length?a.values.map(c=>c.id).join(","):"";break;case"enum":case"user":case"org":case"people":n[o]=a?.id;break;case"monetary":n[o]=a?.value,n[`${o}_currency`]=a?.currency;break;case"time":n[o]=a?.value,n[`${o}_timezone_id`]=a?.timezone_id;break;case"timerange":n[o]=a?.from,n[`${o}_timezone_id`]=a?.timezone_id,n[`${o}_until`]=a?.until;break;case"daterange":n[o]=a?.from,n[`${o}_until`]=a?.until;break;case"address":n[o]=a?.value,n[`${o}_subpremise`]=a?.subpremise,n[`${o}_street_number`]=a?.street_number,n[`${o}_route`]=a?.route,n[`${o}_sublocality`]=a?.sublocality,n[`${o}_locality`]=a?.locality,n[`${o}_admin_area_level_1`]=a?.admin_area_level_1,n[`${o}_admin_area_level_2`]=a?.admin_area_level_2,n[`${o}_country`]=a?.country,n[`${o}_postal_code`]=a?.postal_code,n[`${o}_formatted_address`]=a?.formatted_address;break}}return{...r,...n}}i(nl,"flattenCustomFields");var il=oe({auth:E,name:"updated_person",outputSchema:jc,classification:"READ",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 x({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:Be.join(",")}}),r=await k({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 o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Be.join(",")}}),n=await k({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 al=oe({auth:E,name:"new-lead",outputSchema:Kc,classification:"READ",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 ze.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 ze.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 x({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 k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),n=[];for(let o of t.data){let a=Tt(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/leads/${t.data.id}`}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[Tt(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 sl=oe({auth:E,name:"new-organization",outputSchema:Gc,classification:"READ",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 x({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:Ze.join(",")}});if(A(t.data))return[];let r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Ze.join(",")}}),n=await k({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 ul=oe({auth:E,name:"updated-organization",outputSchema:Hc,classification:"READ",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 x({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:Ze.join(",")}});if(A(t.data))return[];let r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Ze.join(",")}}),n=await k({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 cl=oe({auth:E,name:"updated-deal-stage",outputSchema:Zc,classification:"READ",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:y.Dropdown({auth:E,displayName:"Stage in Pipeline",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{placeholder:"please connect your account.",disabled:!0,options:[]};let t=e,r=await ge({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),n=[];for(let o of r)n.push({label:`${o.name}`,value:o.id});return{disabled:!1,options:n}},"options")})},async onEnable(e){let t=await x({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 x({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:Se.join(",")};t&&(r.stage_id=t.toString());let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:r});if(A(n.data))return[];let o=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),a=[];for(let u of n.data){let c=R(o,u),d=await x({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,o=r.previous;if(!o||A(o.stage_id))return[];if(n.stage_id!==o.stage_id){if(t&&n.stage_id!==t)return[];let a=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${r.data.id}`,query:{include_fields:Se.join(",")}}),u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=R(u,a.data),d=await x({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 Hg(e,t){let r=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/filters",query:{type:t}}),n=[];for(let o of r.data)n.push({label:o.name,value:o.id});return n}i(Hg,"fetchFiltersOptions");async function qg(e){let t=await x({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}i(qg,"fetchActivityTypesOptions");async function Wg(e){let t=await ge({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}i(Wg,"fetchPipelinesOptions");async function Kg(e){let t=await x({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}i(Kg,"fetchOwnersOptions");function ll(e){switch(e.field_type){case"varchar":case"varchar_auto":case"phone":return y.ShortText({displayName:e.name,required:!1});case"text":case"address":return y.LongText({displayName:e.name,required:!1});case"enum":return y.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 y.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 y.Number({displayName:e.name,required:!1});case"time":case"timerange":return y.ShortText({displayName:e.name,description:"Please enter time in HH:mm:ss format.",required:!1});case"int":return y.Number({displayName:e.name,required:!1});case"date":case"daterange":return y.DateTime({displayName:e.name,description:"Please enter date in YYYY-MM-DD format.",required:!1});default:return null}}i(ll,"createPropertyDefinition");async function Jg(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 k({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:r}),o={};for(let a of n){if(!a.edit_flag)continue;let u=ll(a);u&&(o[a.key]=u)}return o}i(Jg,"retrieveObjectCustomProperties");var jt=i(e=>y.Dropdown({auth:E,displayName:"Field to search by",required:!0,refreshers:[],options:i(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 o=await k({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:n}),a=[];for(let u of o)A(u.id)||a.push({label:u.name,value:u.id.toString()});return{disabled:!1,options:a}},"options")}),"searchFieldProp"),Vt=i(e=>y.DynamicProperties({auth:E,displayName:"Field Value",required:!0,refreshers:["searchField"],props:i(async({auth:t,searchField:r})=>{if(!t||!r)return{};let n=t,o={},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 u=await x({accessToken:n.access_token,apiDomain:n.data.api_domain,method:"GET",resourceUri:`${a}/${r}`}),c=u.data.field_type==="set"?y.StaticDropdown({displayName:u.data.name,required:!1,options:{disabled:!1,options:u.data.options?u.data.options.map(d=>({label:d.label,value:d.id.toString()})):[]}}):ll(u.data);return c?o.field_value=c:o.field_value=y.ShortText({displayName:u.data.name,required:!1}),o},"props")}),"searchFieldValueProp"),Ce=i((e,t=!1)=>y.Dropdown({auth:E,displayName:e,refreshers:[],required:t,options:i(async({auth:r})=>r?{disabled:!1,options:await Kg(r)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"ownerIdProp"),qe=i((e,t=!1)=>y.Dropdown({auth:E,displayName:"Filter",refreshers:[],required:t,options:i(async({auth:r})=>r?{disabled:!1,options:await Hg(r,e)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"filterIdProp"),We=i((e=!1)=>y.Number({displayName:"Organization ID",description:"You can use Find Organization action to retrieve org ID.",required:e}),"organizationIdProp"),Xg=i((e=!1)=>y.Dropdown({auth:E,displayName:"Pipeline",refreshers:[],required:e,options:i(async({auth:t})=>t?{disabled:!1,options:await Wg(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"dealPipelineIdProp"),Yg=i((e=!1)=>y.Dropdown({auth:E,displayName:"Stage",description:"If a stage is chosen above, the pipeline field will be ignored.",required:e,refreshers:[],options:i(async({auth:t})=>{if(!t)return{placeholder:"Please connect your account.",disabled:!0,options:[]};let r=t,n=await ge({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),o=[];for(let a of n)o.push({label:`${a.name}`,value:a.id});return{disabled:!1,options:o}},"options")}),"dealStageIdProp"),Ue=i((e=!1)=>y.Number({displayName:"Person ID",description:"You can use Find Person action to retrieve person ID.",required:e}),"personIdProp"),fr=i((e,t,r=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:r,refreshers:[],options:i(async({auth:n})=>{if(!n)return{disabled:!0,options:[],placeholder:"Please connect your account."};let o=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 k({accessToken:o.access_token,apiDomain:o.data.api_domain,method:"GET",resourceUri:a})).find(g=>g.key===t),d=[];if(c&&c.options)for(let g of c.options)d.push({label:g.label,value:g.id});return{disabled:!1,options:d}},"options")}),"labelIdsProp"),Qg=i((e=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:e,refreshers:[],options:i(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n=await x({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v1/leadLabels"}),o=[];for(let a of n.data)o.push({label:`${a.name} (${a.color})`,value:a.id});return{disabled:!1,options:o}},"options")}),"leadLabelIdsProp"),nn=i((e=!1)=>y.Number({displayName:"Product ID",description:"You can use Find Product action to retrieve product ID.",required:e}),"productIdProp"),ft=y.StaticDropdown({displayName:"Visible To",required:!1,options:{disabled:!1,options:[{label:"Owner & followers",value:1},{label:"Entire company",value:3}]}}),gr=i((e=!1)=>y.ShortText({displayName:"Lead ID",required:e}),"leadIdProp"),So=i((e=!1)=>y.Dropdown({auth:E,displayName:"Activity Type",refreshers:[],required:e,options:i(async({auth:t})=>t?{disabled:!1,options:await qg(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"activityTypeIdProp"),tt=i((e=!1)=>y.Number({displayName:"Deal ID",description:"You can use Find Deal action to retrieve deal ID.",required:e}),"dealIdProp"),on={creationTime:y.DateTime({displayName:"Creation Time",required:!1}),status:y.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:Yg(!1),pipelineId:Xg(!1),ownerId:Ce("Owner",!1),organizationId:We(!1),personId:Ue(!1),labelIds:fr("deal","label",!1),probability:y.Number({displayName:"Probability",required:!1}),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dealValue:y.Number({displayName:"Value",required:!1}),dealValueCurrency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),visibleTo:ft,customfields:gt("deal")},an={ownerId:Ce("Owner",!1),organizationId:We(!1),personId:Ue(!1),labelIds:Qg(!1),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),visibleTo:ft,channel:y.Dropdown({auth:E,displayName:"Channel",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your account."};let t=e,n=(await k({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v1/dealFields:(key,name,options)"})).find(a=>a.key==="channel"),o=[];if(n)for(let a of n.options??[])o.push({label:a.label,value:a.id});return{disabled:!1,options:o}},"options")}),leadValue:y.Number({displayName:"Lead Value Amount",required:!1}),leadValueCurrency:y.ShortText({displayName:"Lead Value Currency",required:!1,description:'The currency of the lead value (e.g., "USD", "EUR").'}),customfields:gt("lead")},sn={ownerId:Ce("Owner",!1),visibleTo:ft,labelIds:fr("organization","label_ids",!1),address:y.LongText({displayName:"Address",required:!1}),customfields:gt("organization")},un={ownerId:Ce("Owner",!1),organizationId:We(!1),email:y.Array({displayName:"Email",required:!1}),phone:y.Array({displayName:"Phone",required:!1}),labelIds:fr("person","label_ids",!1),firstName:y.ShortText({displayName:"First Name",required:!1}),lastName:y.ShortText({displayName:"Last Name",required:!1}),visibleTo:ft,marketing_status:y.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:gt("person")},cn={organizationId:We(!1),personId:Ue(!1),dealId:tt(!1),leadId:gr(!1),assignTo:Ce("Assign To",!1),type:So(!1),dueDate:y.DateTime({displayName:"Due Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dueTime:y.ShortText({displayName:"Due Time",required:!1,description:"Please enter time in HH:MM format."}),duration:y.ShortText({displayName:"Duration",required:!1,description:'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).'}),isDone:y.Checkbox({displayName:"Mark as Done?",required:!1,defaultValue:!1}),busy:y.StaticDropdown({displayName:"Free or Busy",required:!1,options:{disabled:!1,options:[{label:"Free",value:"free"},{label:"Busy",value:"busy"}]}}),note:y.LongText({displayName:"Note",required:!1}),publicDescription:y.LongText({displayName:"Public Description",required:!1})};function gt(e){return y.DynamicProperties({auth:E,displayName:"Custom Fields",required:!1,refreshers:[],props:i(async({auth:t})=>t?await Jg(t,e):{},"props")})}i(gt,"customFieldsProp");var dl=D({auth:E,name:"create-person",outputSchema:dc,classification:"WRITE",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:y.ShortText({displayName:"Name",required:!1}),...un},async run(e){let{name:t,ownerId:r,organizationId:n,marketing_status:o,visibleTo:a,firstName:u,lastName:c}=e.propsValue,d=e.propsValue.phone??[],g=e.propsValue.email??[],_=e.propsValue.labelIds??[],I=e.propsValue.customfields??{};if(t&&(u||c))throw new Error("Provide either Name OR First Name/Last Name, not both.");if(!t&&!u&&!c)throw new Error("Provide Name or at least one of First Name / Last Name.");if(!t&&(u&&!c||!u&&c))throw new Error("If First Name is provided, Last Name must be provided as well.");let b=d.map((z,ne)=>({value:z,label:"work",primary:ne===0})),l=g.map((z,ne)=>({value:z,label:"work",primary:ne===0})),m={name:t,owner_id:r,org_id:n,visible_to:a,first_name:u,last_name:c,marketing_status:o};b.length&&(m.phones=b),l.length&&(m.emails=l),_.length&&(m.label_ids=_);let h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),p=Ae(h,I);ce(p)||(m.custom_fields=p);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/persons",body:m}),T=R(h,P.data);return{...P,data:T}}});var pl=D({auth:E,name:"update-person",outputSchema:pc,classification:"WRITE",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:Ue(!0),name:y.ShortText({displayName:"Name",required:!1}),...un},async run(e){let{name:t,ownerId:r,personId:n,organizationId:o,marketing_status:a,visibleTo:u,firstName:c,lastName:d}=e.propsValue,g=e.propsValue.phone??[],_=e.propsValue.email??[],I=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=g.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),m=_.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),h={name:t,owner_id:r,org_id:o,marketing_status:a,visible_to:u,first_name:c,last_name:d};l.length&&(h.phones=l),m.length&&(h.emails=m),I.length&&(h.label_ids=I);let p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),P=Ae(p,b);ce(P)||(h.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${n}`,body:h}),z=R(p,T.data);return{...T,data:z}}});var ml=D({auth:E,name:"create-organization",outputSchema:yc,classification:"WRITE",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:y.ShortText({displayName:"Name",required:!0}),...sn},async run(e){let{name:t,ownerId:r,address:n,visibleTo:o}=e.propsValue,a=e.propsValue.labelIds??[],u=e.propsValue.customfields??{},c={name:t,owner_id:r,visible_to:o};n&&typeof n=="string"&&(c.address={value:n}),a.length>0&&(c.label_ids=a);let d=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),g=Ae(d,u);ce(g)||(c.custom_fields=g);let _=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/organizations",body:c}),I=R(d,_.data);return{..._,data:I}}});var fl=D({auth:E,name:"update-organization",outputSchema:hc,classification:"WRITE",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:We(!0),name:y.ShortText({displayName:"Name",required:!1}),...sn},async run(e){let{name:t,ownerId:r,address:n,visibleTo:o,organizationId:a}=e.propsValue,u=e.propsValue.labelIds??[],c=e.propsValue.customfields??{},d={name:t,owner_id:r,visible_to:o};n&&typeof n=="string"&&(d.address={value:n}),u.length>0&&(d.label_ids=u);let g=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),_=Ae(g,c);ce(_)||(d.custom_fields=_);let I=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/organizations/${a}`,body:d}),b=R(g,I.data);return{...I,data:b}}});var gl=we(mt());var yl=D({auth:E,name:"create-lead",outputSchema:Ec,classification:"WRITE",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:y.ShortText({displayName:"Title",required:!0}),...an},async run(e){let{title:t,leadValue:r,leadValueCurrency:n,expectedCloseDate:o,visibleTo:a,ownerId:u,organizationId:c,personId:d,channel:g}=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??[],I=e.propsValue.customfields??{},b={title:t,owner_id:u,organization_id:c,person_id:d,channel:g,visible_to:a};if(_.length>0&&(b.label_ids=_),o&&(b.expected_close_date=(0,gl.default)(o).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(I).forEach(([P,T])=>{l[P]=Array.isArray(T)?T.join(","):T});let m=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/leads",body:{...b,...l}}),h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),p=Tt(h,m.data);return{...m,data:p}}});var hl=we(mt());var _l=D({auth:E,name:"update-lead",outputSchema:Ac,classification:"WRITE",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:gr(!0),title:y.ShortText({displayName:"Title",required:!1}),...an},async run(e){let{title:t,ownerId:r,leadId:n,channel:o,organizationId:a,personId:u,expectedCloseDate:c,visibleTo:d,leadValue:g,leadValueCurrency:_}=e.propsValue,I=e.propsValue.labelIds??[],b=e.propsValue.customfields??{},l={title:t,owner_id:r,organization_id:a,person_id:u,channel:o,visible_to:d};if(I.length>0&&(l.label_ids=I),c&&(l.expected_close_date=(0,hl.default)(c).format("YYYY-MM-DD")),g){if(!_)throw new Error("lead Value Currency is required when lead Value is provided");l.value={amount:g,currency:_}}let m={};Object.entries(b).forEach(([T,z])=>{m[T]=Array.isArray(z)&&z.length>0?z.join(","):z});let h=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v1/leads/${n}`,body:{...l,...m}}),p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),P=Tt(p,h.data);return{...h,data:P}}});var ko=we(mt());var vl=D({auth:E,name:"create-deal",outputSchema:fc,classification:"WRITE",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:y.ShortText({displayName:"Title",required:!0}),...on},async run(e){let{title:t,dealValue:r,dealValueCurrency:n,expectedCloseDate:o,visibleTo:a,probability:u,stageId:c,status:d,pipelineId:g,ownerId:_,organizationId:I,personId:b,creationTime:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},p={title:t,pipeline_id:g,stage_id:c,status:d,add_time:l?(0,ko.default)(l).format("YYYY-MM-DDTHH:mm:ss[Z]"):void 0,probability:u,visible_to:a,owner_id:_,org_id:I,person_id:b,value:r,currency:n};m.length>0&&(p.label_ids=m),o&&(p.expected_close_date=(0,ko.default)(o).format("YYYY-MM-DD"));let P=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ae(P,h);ce(T)||(p.custom_fields=T);let z=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/deals",body:p}),ne=R(P,z.data);return{...z,data:ne}}});var bl=we(mt());var Pl=D({auth:E,name:"update-deal",outputSchema:gc,classification:"WRITE",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:tt(!0),title:y.ShortText({displayName:"Title",required:!1}),...on},async run(e){let{dealId:t,title:r,dealValue:n,dealValueCurrency:o,expectedCloseDate:a,visibleTo:u,probability:c,stageId:d,status:g,pipelineId:_,ownerId:I,organizationId:b,personId:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},p={title:r,pipeline_id:_,stage_id:d,status:g,probability:c,visible_to:u,owner_id:I,org_id:b,person_id:l,value:n,currency:o};m.length>0&&(p.label_ids=m),a&&(p.expected_close_date=(0,bl.default)(a).format("YYYY-MM-DD"));let P=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ae(P,h);ce(T)||(p.custom_fields=T);let z=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/deals/${t}`,body:p}),ne=R(P,z.data);return{...z,data:ne}}});var xl=D({auth:E,name:"create-product",outputSchema:bc,classification:"WRITE",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:y.ShortText({displayName:"Name",required:!0}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Ce("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:ft,customfields:gt("product")},async run(e){let{name:t,code:r,description:n,unit:o,tax:a,isActive:u,ownerId:c,currency:d,price:g,cost:_,overheadCost:I,visibleTo:b}=e.propsValue,l=e.propsValue.customfields??{},m={name:t,code:r,description:n,unit:o,tax:a,is_deleted:!u,prices:[{price:g??0,currency:d??"USD",cost:_??0,direct_cost:I??0}],visible_to:b};c&&(m.owner_id=c);let h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),p=Ae(h,l);ce(p)||(m.custom_fields=p);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/products",body:m}),T=R(h,P.data);return{...P,data:T}}});var Tl=D({auth:E,name:"add-product-to-deal",outputSchema:xc,classification:"WRITE",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:tt(!0),productId:nn(!0),price:y.Number({displayName:"Price",required:!0}),quantity:y.Number({displayName:"Quantity",required:!0}),discount:y.Number({displayName:"Discount",required:!1}),discountType:y.StaticDropdown({displayName:"Discount Type",required:!1,options:{disabled:!1,options:[{label:"Percentage",value:"percentage"},{label:"Amount",value:"amount"}]}}),comments:y.LongText({displayName:"Comments",required:!1}),enableProduct:y.Checkbox({displayName:"Enable Product?",required:!1,defaultValue:!0}),taxMethod:y.StaticDropdown({displayName:"Tax Method",required:!1,options:{disabled:!1,options:[{label:"Exclusive",value:"exclusive"},{label:"Inclusive",value:"inclusive"},{label:"None",value:"none"}]}}),taxPercentage:y.Number({displayName:"Tax Percentage",required:!1})},async run(e){let{productId:t,dealId:r,price:n,quantity:o,discountType:a,discount:u,comments:c,enableProduct:d,taxPercentage:g,taxMethod:_}=e.propsValue;return await x({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:o,discount_type:a,discount:u,comments:c??"",is_enabled:d,tax:g,tax_method:_}})}});var Il=D({auth:E,name:"add-labels-to-person",outputSchema:mc,classification:"WRITE",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:Ue(!0),labelIds:fr("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 o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${t}`,body:{...n}}),a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),u=R(a,o.data);return{...o,data:u}}});var El=we(mt());var Al=D({auth:E,name:"create-activity",outputSchema:_c,classification:"WRITE",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:y.ShortText({displayName:"Subject",required:!0}),...cn},async run(e){let{subject:t,organizationId:r,personId:n,dealId:o,leadId:a,assignTo:u,type:c,dueDate:d,dueTime:g,duration:_,isDone:I,busy:b,note:l,publicDescription:m}=e.propsValue,h={subject:t,org_id:r,deal_id:o,lead_id:a,public_description:m,type:c,owner_id:u,due_time:g,duration:_,done:I,note:l};return n&&(h.participants=[{person_id:n,primary:!0}]),b&&(h.busy=b==="busy"),d&&(h.due_date=(0,El.default)(d).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/activities",body:h})}});var Sl=we(mt());var kl=D({auth:E,name:"update-activity",outputSchema:vc,classification:"WRITE",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:y.Number({displayName:"Activity ID",required:!0}),subject:y.ShortText({displayName:"Subject",required:!1}),...cn},async run(e){let{activityId:t,subject:r,organizationId:n,personId:o,dealId:a,leadId:u,assignTo:c,type:d,dueDate:g,dueTime:_,duration:I,isDone:b,busy:l,note:m,publicDescription:h}=e.propsValue,p={subject:r,org_id:n,deal_id:a,lead_id:u,note:m,public_description:h,type:d,owner_id:c,due_time:_,duration:I,done:b};return o&&(p.participants=[{person_id:o,primary:!0}]),l&&(p.busy=l==="busy"),g&&(p.due_date=(0,Sl.default)(g).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/activities/${t}`,body:p})}});var $l=we(_o());var wl=D({auth:E,name:"attach-file",outputSchema:Lc,classification:"WRITE",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:y.File({displayName:"File",required:!0}),fileName:y.ShortText({displayName:"File Name",required:!0}),dealId:tt(!1),personId:Ue(!1),organizationId:We(!1),productId:nn(!1),activityId:y.Number({displayName:"Activity ID",required:!1})},async run(e){let{file:t,fileName:r,dealId:n,personId:o,organizationId:a,productId:u,activityId:c}=e.propsValue,d=new $l.default;return d.append("file",t.data,r),n&&d.append("deal_id",n),o&&d.append("person_id",o),a&&d.append("org_id",a),u&&d.append("product_id",u),c&&d.append("activity_id",c),(await ze.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 zl=D({auth:E,name:"add-follower",outputSchema:Mc,classification:"WRITE",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:Ce("Follower",!0),entity:y.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:y.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,o="";switch(r){case"deal":o=`/deals/${n}/followers`;break;case"organization":o=`/organizations/${n}/followers`;break;case"person":o=`/persons/${n}/followers`;break;case"product":o=`/products/${n}/followers`;break}if(!o)throw new Error(`Invalid object type: ${r}`);return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2${o}`,body:{user_id:t}})}});var Ol=D({auth:E,name:"create-note",outputSchema:Tc,classification:"WRITE",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:y.LongText({displayName:"Content",required:!0}),dealId:tt(!1),pinnedToDeal:y.Checkbox({displayName:"Pin note to deal?",required:!1,defaultValue:!1}),personId:Ue(!1),pinnedToPerson:y.Checkbox({displayName:"Pin note to person?",required:!1,defaultValue:!1}),organizationId:We(!1),pinnedToOrganization:y.Checkbox({displayName:"Pin note to organization?",required:!1,defaultValue:!1}),leadId:gr(!1),pinnedToLead:y.Checkbox({displayName:"Pin note to lead?",required:!1,defaultValue:!1})},async run(e){let{content:t,dealId:r,personId:n,organizationId:o,leadId:a,pinnedToDeal:u,pinnedToPerson:c,pinnedToOrganization:d,pinnedToLead:g}=e.propsValue;if(!r&&!n&&!o&&!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:u?1:0,pinned_to_person_flag:c?1:0,pinned_to_organization_flag:d?1:0,pinned_to_lead_flag:g?1:0,lead_id:a,person_id:n,org_id:o,deal_id:r};return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/notes",body:_})}});var Dl=D({auth:E,name:"get-note",outputSchema:Ic,classification:"READ",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:y.Number({displayName:"Note ID",required:!0})},async run(e){try{return await x({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 Rl=D({auth:E,name:"find-user",outputSchema:Rc,classification:"SEARCH",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:y.StaticDropdown({displayName:"Field to search by",required:!0,options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Email",value:"email"}]}}),fieldValue:y.ShortText({displayName:"Field Value",required:!0})},async run(e){let{field:t,fieldValue:r}=e.propsValue,n=await x({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 Nl=D({auth:E,name:"find-product",outputSchema:Cc,classification:"SEARCH",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:y.ShortText({displayName:"Search Term",required:!0})},async run(e){let{searchTerm:t}=e.propsValue,r=await x({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 x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${r.data.items[0].item.id}`}),o=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(o,n.data)]}}});var Cl=oe({auth:E,name:"organization-matching-filter",outputSchema:Yc,classification:"READ",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:qe("org",!0)},async onEnable(e){let t=[],r=await ge({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 x({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:Ze.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("organizations")??"[]",r=JSON.parse(t),n=await ge({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:Ze.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("organizations",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}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 Ul=oe({auth:E,name:"person-matching-filter",outputSchema:Jc,classification:"READ",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:qe("people",!0)},async onEnable(e){let t=[],r=await ge({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 x({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:Be.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("persons")??"[]",r=JSON.parse(t),n=await ge({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:Be.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("persons",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}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 Ml=oe({auth:E,name:"activity-matching-filter",outputSchema:Qc,classification:"READ",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:qe("activity",!0)},async onEnable(e){let t=[],r=await ge({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 x({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 ge({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 o=n.filter(u=>!r.includes(u.id)),a=o.map(u=>u.id);return a.length===0?[]:(await e.store.put("activities",JSON.stringify([...a,...r])),o)},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 Ll=oe({auth:E,name:"deal-matching-filter",outputSchema:Xc,classification:"READ",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:qe("deals",!0),status:y.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 ge({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 x({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:Se.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("deals")??"[]",r=JSON.parse(t),n=await ge({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:Se.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("deals",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}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 Fl=oe({auth:E,name:"new-note",outputSchema:Wc,classification:"READ",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 x({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 x({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 jl=D({auth:E,name:"find-deals-associated-with-person",outputSchema:$c,classification:"SEARCH",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:Ue(!0)},async run(e){let{personId:t}=e.propsValue,r=await ge({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:Se.join(",")}});if(A(r)||r.length===0)return{found:!1,data:[]};let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),o=[];for(let a of r){let u=R(n,a);o.push(u)}return{found:!0,data:o}}});var Vl=D({auth:E,name:"find-products",outputSchema:Uc,classification:"SEARCH",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:y.StaticDropdown({displayName:"Field to search by",required:!0,defaultValue:"name",options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Product Code",value:"code"}]}}),fieldValue:y.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,o=[];do{r&&(t.cursor=r);let a=await x({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 u of a.data.items)o.push(u.item);n=a.additional_data?.next_cursor!=null,r=a.additional_data?.next_cursor}while(n);return{found:o.length>0,data:o}}});var Bl=D({auth:E,name:"get-product",outputSchema:Nc,classification:"READ",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:y.Number({displayName:"Product ID",required:!0})},async run(e){try{let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${e.propsValue.productId}`}),r=await k({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 Zl=D({auth:E,name:"find-notes",outputSchema:Oc,classification:"SEARCH",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:y.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:y.ShortText({displayName:"ID",required:!0})},async run(e){let t=await k({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 Gl=D({auth:E,name:"find-organization",outputSchema:wc,classification:"SEARCH",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:jt("organization"),searchFieldValue:Vt("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 x({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}]}]}}}),o=await x({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:Ze.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return{found:!0,data:[R(a,o.data[0])]}}});var Hl=D({auth:E,name:"find-person",outputSchema:Sc,classification:"SEARCH",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:jt("person"),searchFieldValue:Vt("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 x({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}]}]}}}),o=await x({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:Be.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return{found:!0,data:[R(a,o.data[0])]}}});var ql=D({auth:E,name:"find-deal",outputSchema:kc,classification:"SEARCH",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:jt("deal"),searchFieldValue:Vt("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 x({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}]}]}}}),o=await x({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:Se.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return{found:!0,data:[R(a,o.data[0])]}}});var Wl=D({auth:E,name:"find-activity",outputSchema:zc,classification:"SEARCH",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:y.ShortText({displayName:"Subject",required:!0}),exactMatch:y.Checkbox({displayName:"Exact Match",required:!1,defaultValue:!0}),assignTo:Ce("Assign To",!1),type:So(!1),filterId:qe("activity",!1),status:y.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:o,status:a,exactMatch:u}=e.propsValue,c=await ge({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:o}});if(A(c)||c.length===0)return{found:!1,data:[]};let d=[];for(let g of c){let _=!1;g.subject&&(u&&g.subject===t||!u&&g.subject.toLowerCase().includes(t.toLowerCase()))&&(_=!0),n?_&&g.type===n&&d.push(g):_&&d.push(g)}return{found:d.length>0,data:d}}});var Kl=D({auth:E,name:"update-product",outputSchema:Pc,classification:"WRITE",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:y.ShortText({displayName:"Product ID",required:!0}),name:y.ShortText({displayName:"Name",required:!1}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Ce("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:ft,customfields:gt("product")},async run(e){let{id:t,name:r,code:n,description:o,unit:a,tax:u,isActive:c,ownerId:d,currency:g,price:_,cost:I,overheadCost:b,visibleTo:l}=e.propsValue,m=e.propsValue.customfields??{},h={name:r,code:n,description:o,unit:a,tax:u,is_deleted:!c,prices:[{price:_??0,currency:g??"USD",cost:I??0,direct_cost:b??0}],visible_to:l};d&&(h.owner_id=d);let p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),P=Ae(p,m);ce(P)||(h.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:"/v2/products/"+t,body:h}),z=R(p,T.data);return{...T,data:z}}});var Jl=D({auth:E,name:"find-lead",outputSchema:Dc,classification:"SEARCH",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:y.ShortText({displayName:"Title",description:"The title to search for.",required:!0}),exact_match:y.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,o=!0,a=[];do{let u={term:t,fields:"title",limit:"100"};r&&(u.exact_match=!0),n&&(u.cursor=n);let c=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/leads/search",query:u});if(A(c.data?.items))break;for(let d of c.data.items)a.push(d.item);o=c.additional_data?.next_cursor!=null,n=c.additional_data?.next_cursor}while(o);return{found:a.length>0,data:a}}});var ey=Ha({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:[zl,Dl,Ol,Il,Tl,wl,Al,kl,vl,Pl,yl,_l,ml,fl,dl,pl,xl,Kl,jl,Nl,Vl,Zl,Bl,Gl,Hl,ql,Wl,Rl,Jl,cc({baseUrl:i(()=>"https://api.pipedrive.com/api/v2","baseUrl"),auth:E,authMapping:i(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],authors:["ashrafsamhouri","kishanprmr","MoShizzle","khaledmashaly","abuaboud","leocottaz","Anmol-Gup"],triggers:[rl,tl,el,Fl,il,ol,cl,al,sl,ul,Ml,Ll,Ul,Cl]});0&&(module.exports={pipedrive});
4
4
  /*! Bundled license information:
5
5
 
6
6
  mime-types/index.js: