@activepieces/piece-sendpulse 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -12
- package/src/index.js +13 -56
- package/src/index.d.ts +0 -5
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-subscriber.d.ts +0 -13
- package/src/lib/actions/add-subscriber.d.ts.map +0 -1
- package/src/lib/actions/add-subscriber.js +0 -84
- package/src/lib/actions/add-subscriber.js.map +0 -1
- package/src/lib/actions/change-variable-for-subscriber.d.ts +0 -16
- package/src/lib/actions/change-variable-for-subscriber.d.ts.map +0 -1
- package/src/lib/actions/change-variable-for-subscriber.js +0 -146
- package/src/lib/actions/change-variable-for-subscriber.js.map +0 -1
- package/src/lib/actions/delete-contact.d.ts +0 -7
- package/src/lib/actions/delete-contact.d.ts.map +0 -1
- package/src/lib/actions/delete-contact.js +0 -51
- package/src/lib/actions/delete-contact.js.map +0 -1
- package/src/lib/actions/unsubscribe-user.d.ts +0 -11
- package/src/lib/actions/unsubscribe-user.d.ts.map +0 -1
- package/src/lib/actions/unsubscribe-user.js +0 -66
- package/src/lib/actions/unsubscribe-user.js.map +0 -1
- package/src/lib/actions/update-subscriber.d.ts +0 -13
- package/src/lib/actions/update-subscriber.d.ts.map +0 -1
- package/src/lib/actions/update-subscriber.js +0 -102
- package/src/lib/actions/update-subscriber.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -5
- package/src/lib/common/auth.d.ts.map +0 -1
- package/src/lib/common/auth.js +0 -38
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -14
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -63
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/props.d.ts +0 -5
- package/src/lib/common/props.d.ts.map +0 -1
- package/src/lib/common/props.js +0 -54
- package/src/lib/common/props.js.map +0 -1
- package/src/lib/triggers/new-subscriber.d.ts +0 -35
- package/src/lib/triggers/new-subscriber.d.ts.map +0 -1
- package/src/lib/triggers/new-subscriber.js +0 -120
- package/src/lib/triggers/new-subscriber.js.map +0 -1
- package/src/lib/triggers/new-unsubscriber.d.ts +0 -35
- package/src/lib/triggers/new-unsubscriber.d.ts.map +0 -1
- package/src/lib/triggers/new-unsubscriber.js +0 -124
- package/src/lib/triggers/new-unsubscriber.js.map +0 -1
- package/src/lib/triggers/updated-subscriber.d.ts +0 -35
- package/src/lib/triggers/updated-subscriber.d.ts.map +0 -1
- package/src/lib/triggers/updated-subscriber.js +0 -145
- package/src/lib/triggers/updated-subscriber.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-sendpulse",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
-
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
-
}
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"files": [
|
|
8
|
+
"src/index.js",
|
|
9
|
+
"package.json",
|
|
10
|
+
"src/i18n"
|
|
11
|
+
]
|
|
17
12
|
}
|
package/src/index.js
CHANGED
|
@@ -1,56 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendpulse = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const delete_contact_1 = require("./lib/actions/delete-contact");
|
|
15
|
-
const unsubscribe_user_1 = require("./lib/actions/unsubscribe-user");
|
|
16
|
-
const update_subscriber_1 = require("./lib/actions/update-subscriber");
|
|
17
|
-
exports.sendpulse = (0, pieces_framework_1.createPiece)({
|
|
18
|
-
displayName: 'SendPulse',
|
|
19
|
-
auth: auth_1.sendpulseAuth,
|
|
20
|
-
minimumSupportedRelease: '0.36.1',
|
|
21
|
-
logoUrl: 'https://cdn.activepieces.com/pieces/sendpulse.png',
|
|
22
|
-
authors: ['aryel780', 'onyedikachi-david'],
|
|
23
|
-
actions: [
|
|
24
|
-
add_subscriber_1.addSubscriberAction,
|
|
25
|
-
change_variable_for_subscriber_1.changeVariableForSubscriberAction,
|
|
26
|
-
delete_contact_1.deleteContactAction,
|
|
27
|
-
unsubscribe_user_1.unsubscribeUserAction,
|
|
28
|
-
update_subscriber_1.updateSubscriberAction,
|
|
29
|
-
(0, pieces_common_1.createCustomApiCallAction)({
|
|
30
|
-
auth: auth_1.sendpulseAuth,
|
|
31
|
-
baseUrl: () => 'https://api.sendpulse.com',
|
|
32
|
-
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const typedAuth = auth.props;
|
|
34
|
-
const token = yield (0, client_1.sendpulseApiCall)({
|
|
35
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
36
|
-
auth: typedAuth,
|
|
37
|
-
resourceUri: '/oauth/access_token',
|
|
38
|
-
body: {
|
|
39
|
-
grant_type: 'client_credentials',
|
|
40
|
-
client_id: typedAuth.clientId,
|
|
41
|
-
client_secret: typedAuth.clientSecret,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
Authorization: `Bearer ${token.access_token}`,
|
|
46
|
-
};
|
|
47
|
-
}),
|
|
48
|
-
}),
|
|
49
|
-
],
|
|
50
|
-
triggers: [
|
|
51
|
-
new_subscriber_1.newSubscriberTrigger,
|
|
52
|
-
new_unsubscriber_1.newUnsubscriberTrigger,
|
|
53
|
-
updated_subscriber_1.updatedSubscriberTrigger
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var ou=Object.create;var Xe=Object.defineProperty;var iu=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var su=Object.getPrototypeOf,uu=Object.prototype.hasOwnProperty;var i=(e,t)=>Xe(e,"name",{value:t,configurable:!0});var E=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},hn=(e,t)=>{for(var r in t)Xe(e,r,{get:t[r],enumerable:!0})},vn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of au(t))!uu.call(e,o)&&o!==r&&Xe(e,o,{get:()=>t[o],enumerable:!(n=iu(t,o))||n.enumerable});return e};var Ce=(e,t,r)=>(r=e!=null?ou(su(e)):{},vn(t||!e||!e.__esModule?Xe(r,"default",{value:e,enumerable:!0}):r,e)),cu=e=>vn(Xe({},"__esModule",{value:!0}),e);var Bo=E((Fo,Wt)=>{(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"),s="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function f(u,d){if(u.indexOf("::")!==u.lastIndexOf("::"))return null;let y=0,m=-1,v=(u.match(l.zoneIndex)||[])[0],P,L;for(v&&(v=v.substring(1),u=u.replace(/%.+$/,""));(m=u.indexOf(":",m+1))>=0;)y++;if(u.substr(0,2)==="::"&&y--,u.substr(-2,2)==="::"&&y--,y>d)return null;for(L=d-y,P=":";L--;)P+="0:";return u=u.replace("::",P),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),d=(function(){let re=u.split(":"),ue=[];for(let Je=0;Je<re.length;Je++)ue.push(parseInt(re[Je],16));return ue})(),{parts:d,zoneId:v}}i(f,"expandIPv6");function g(u,d,y,m){if(u.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let v=0,P;for(;m>0;){if(P=y-m,P<0&&(P=0),u[v]>>P!==d[v]>>P)return!1;m-=y,v+=1}return!0}i(g,"matchCIDR");function x(u){if(o.test(u))return parseInt(u,16);if(u[0]==="0"&&!isNaN(parseInt(u[1],10))){if(n.test(u))return parseInt(u,8);throw new Error(`ipaddr: cannot parse ${u} as octal`)}return parseInt(u,10)}i(x,"parseIntAuto");function T(u,d){for(;u.length<d;)u=`0${u}`;return u}i(T,"padPart");let _={};_.IPv4=(function(){function u(d){if(d.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let y,m;for(y=0;y<d.length;y++)if(m=d[y],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=d}return i(u,"IPv4"),u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,18,0,0]),15],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]],as112:[[new u([192,175,48,0]),24],[new u([192,31,196,0]),24]],amt:[[new u([192,52,193,0]),24]]},u.prototype.kind=function(){return"ipv4"},u.prototype.match=function(d,y){let m;if(y===void 0&&(m=d,d=m[0],y=m[1]),d.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return g(this.octets,d.octets,8,y)},u.prototype.prefixLengthFromSubnetMask=function(){let d=0,y=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},v,P,L;for(v=3;v>=0;v-=1)if(P=this.octets[v],P in m){if(L=m[P],y&&L!==0)return null;L!==8&&(y=!0),d+=L}else return null;return 32-d},u.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){return this.octets.slice(0)},u.prototype.toIPv4MappedAddress=function(){return _.IPv6.parse(`::ffff:${this.toString()}`)},u.prototype.toNormalizedString=function(){return this.toString()},u.prototype.toString=function(){return this.octets.join(".")},u})(),_.IPv4.broadcastAddressFromCIDR=function(u){try{let d=this.parseCIDR(u),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],P=0;for(;P<4;)v.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.isIPv4=function(u){return this.parser(u)!==null},_.IPv4.isValid=function(u){try{return new this(this.parser(u)),!0}catch{return!1}},_.IPv4.isValidCIDR=function(u){try{return this.parseCIDR(u),!0}catch{return!1}},_.IPv4.isValidFourPartDecimal=function(u){return!!(_.IPv4.isValid(u)&&u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},_.IPv4.isValidCIDRFourPartDecimal=function(u){let d=u.match(/^(.+)\/(\d+)$/);return!_.IPv4.isValidCIDR(u)||!d?!1:_.IPv4.isValidFourPartDecimal(d[1])},_.IPv4.networkAddressFromCIDR=function(u){let d,y,m,v,P;try{for(d=this.parseCIDR(u),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],y=0;y<4;)v.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.parse=function(u){let d=this.parser(u);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},_.IPv4.parseCIDR=function(u){let d;if(d=u.match(/^(.+)\/(\d+)$/)){let y=parseInt(d[2]);if(y>=0&&y<=32){let m=[this.parse(d[1]),y];return Object.defineProperty(m,"toString",{value:i(function(){return this.join("/")},"value")}),m}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},_.IPv4.parser=function(u){let d,y,m;if(d=u.match(r.fourOctet))return(function(){let v=d.slice(1,6),P=[];for(let L=0;L<v.length;L++)y=v[L],P.push(x(y));return P})();if(d=u.match(r.longValue)){if(m=x(d[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return(function(){let v=[],P;for(P=0;P<=24;P+=8)v.push(m>>P&255);return v})().reverse()}else return(d=u.match(r.twoOctet))?(function(){let v=d.slice(1,4),P=[];if(m=x(v[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return P.push(x(v[0])),P.push(m>>16&255),P.push(m>>8&255),P.push(m&255),P})():(d=u.match(r.threeOctet))?(function(){let v=d.slice(1,5),P=[];if(m=x(v[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return P.push(x(v[0])),P.push(x(v[1])),P.push(m>>8&255),P.push(m&255),P})():null},_.IPv4.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>32)throw new Error("ipaddr: invalid IPv4 prefix length");let d=[0,0,0,0],y=0,m=Math.floor(u/8);for(;y<m;)d[y]=255,y++;return m<4&&(d[m]=Math.pow(2,u%8)-1<<8-u%8),new this(d)},_.IPv6=(function(){function u(d,y){let m,v;if(d.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(d[m]<<8|d[m+1]);else if(d.length===8)this.parts=d;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(v=this.parts[m],!(0<=v&&v<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return i(u,"IPv6"),u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],discard:[new u([256,0,0,0,0,0,0,0]),64],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],benchmarking:[new u([8193,2,0,0,0,0,0,0]),48],amt:[new u([8193,3,0,0,0,0,0,0]),32],as112v6:[[new u([8193,4,274,0,0,0,0,0]),48],[new u([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new u([8193,16,0,0,0,0,0,0]),28],orchid2:[new u([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new u([8193,48,0,0,0,0,0,0]),28],reserved:[[new u([8193,0,0,0,0,0,0,0]),23],[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.kind=function(){return"ipv6"},u.prototype.match=function(d,y){let m;if(y===void 0&&(m=d,d=m[0],y=m[1]),d.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return g(this.parts,d.parts,16,y)},u.prototype.prefixLengthFromSubnetMask=function(){let d=0,y=!1,m={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,P;for(let L=7;L>=0;L-=1)if(v=this.parts[L],v in m){if(P=m[v],y&&P!==0)return null;P!==16&&(y=!0),d+=P}else return null;return 128-d},u.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){let d,y=[],m=this.parts;for(let v=0;v<m.length;v++)d=m[v],y.push(d>>8),y.push(d&255);return y},u.prototype.toFixedLengthString=function(){let d=(function(){let m=[];for(let v=0;v<this.parts.length;v++)m.push(T(this.parts[v].toString(16),4));return m}).call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},u.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let d=this.parts.slice(-2),y=d[0],m=d[1];return new _.IPv4([y>>8,y&255,m>>8,m&255])},u.prototype.toNormalizedString=function(){let d=(function(){let m=[];for(let v=0;v<this.parts.length;v++)m.push(this.parts[v].toString(16));return m}).call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},u.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),m=0,v=-1,P;for(;P=d.exec(y);)P[0].length>v&&(m=P.index,v=P[0].length);return v<0?y:`${y.substring(0,m)}::${y.substring(m+v)}`},u.prototype.toString=function(){return this.toRFC5952String()},u})(),_.IPv6.broadcastAddressFromCIDR=function(u){try{let d=this.parseCIDR(u),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],P=0;for(;P<16;)v.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(v)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},_.IPv6.isIPv6=function(u){return this.parser(u)!==null},_.IPv6.isValid=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{let d=this.parser(u);return new this(d.parts,d.zoneId),!0}catch{return!1}},_.IPv6.isValidCIDR=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{return this.parseCIDR(u),!0}catch{return!1}},_.IPv6.networkAddressFromCIDR=function(u){let d,y,m,v,P;try{for(d=this.parseCIDR(u),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],y=0;y<16;)v.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(v)}catch(L){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${L})`)}},_.IPv6.parse=function(u){let d=this.parser(u);if(d.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(d.parts,d.zoneId)},_.IPv6.parseCIDR=function(u){let d,y,m;if((y=u.match(/^(.+)\/(\d+)$/))&&(d=parseInt(y[2]),d>=0&&d<=128))return m=[this.parse(y[1]),d],Object.defineProperty(m,"toString",{value:i(function(){return this.join("/")},"value")}),m;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},_.IPv6.parser=function(u){let d,y,m,v,P,L;if(m=u.match(l.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(l.native.test(u))return f(u,8);if((m=u.match(l.transitional))&&(L=m[6]||"",d=m[1],m[1].endsWith("::")||(d=d.slice(0,-1)),d=f(d+L,6),d.parts)){for(P=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],y=0;y<P.length;y++)if(v=P[y],!(0<=v&&v<=255))return null;return d.parts.push(P[0]<<8|P[1]),d.parts.push(P[2]<<8|P[3]),{parts:d.parts,zoneId:d.zoneId}}return null},_.IPv6.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>128)throw new Error("ipaddr: invalid IPv6 prefix length");let d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=0,m=Math.floor(u/8);for(;y<m;)d[y]=255,y++;return m<16&&(d[m]=Math.pow(2,u%8)-1<<8-u%8),new this(d)},_.fromByteArray=function(u){let d=u.length;if(d===4)return new _.IPv4(u);if(d===16)return new _.IPv6(u);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},_.isValid=function(u){return _.IPv6.isValid(u)||_.IPv4.isValid(u)},_.isValidCIDR=function(u){return _.IPv6.isValidCIDR(u)||_.IPv4.isValidCIDR(u)},_.parse=function(u){if(_.IPv6.isValid(u))return _.IPv6.parse(u);if(_.IPv4.isValid(u))return _.IPv4.parse(u);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},_.parseCIDR=function(u){try{return _.IPv6.parseCIDR(u)}catch{try{return _.IPv4.parseCIDR(u)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},_.process=function(u){let d=this.parse(u);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},_.subnetMatch=function(u,d,y){let m,v,P,L;y==null&&(y="unicast");for(v in d)if(Object.prototype.hasOwnProperty.call(d,v)){for(P=d[v],P[0]&&!(P[0]instanceof Array)&&(P=[P]),m=0;m<P.length;m++)if(L=P[m],u.kind()===L[0].kind()&&u.match.apply(u,L))return v}return y},typeof Wt<"u"&&Wt.exports?Wt.exports=_:e.ipaddr=_})(Fo)});var Zi=E((IA,Bi)=>{var Fi=require("stream").Stream,Hl=require("util");Bi.exports=le;function le(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}i(le,"DelayedStream");Hl.inherits(le,Fi);le.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(le.prototype,"readable",{configurable:!0,enumerable:!0,get:i(function(){return this.source.readable},"get")});le.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};le.prototype.resume=function(){this._released||this.release(),this.source.resume()};le.prototype.pause=function(){this.source.pause()};le.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};le.prototype.pipe=function(){var e=Fi.prototype.pipe.apply(this,arguments);return this.resume(),e};le.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)};le.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 Wi=E((EA,Gi)=>{var Gl=require("util"),Hi=require("stream").Stream,Vi=Zi();Gi.exports=q;function q(){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(q,"CombinedStream");Gl.inherits(q,Hi);q.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};q.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};q.prototype.append=function(e){var t=q.isStreamLike(e);if(t){if(!(e instanceof Vi)){var r=Vi.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};q.prototype.pipe=function(e,t){return Hi.prototype.pipe.call(this,e,t),this.resume(),e};q.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}};q.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=q.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};q.prototype._pipeNext=function(e){this._currentStream=e;var t=q.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()};q.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};q.prototype.write=function(e){this.emit("data",e)};q.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};q.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")};q.prototype.end=function(){this._reset(),this.emit("end")};q.prototype.destroy=function(){this._reset(),this.emit("close")};q.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};q.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};q.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)};q.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var Ki=E(($A,qi)=>{"use strict";qi.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 Yi=E(ee=>{"use strict";var Yt=Ki(),Wl=require("path").extname,Ji=/^\s*([^;\s]*)(?:;|\s|$)/,ql=/^text\//i;ee.charset=Xi;ee.charsets={lookup:Xi};ee.contentType=Kl;ee.extension=Jl;ee.extensions=Object.create(null);ee.lookup=Xl;ee.types=Object.create(null);Yl(ee.extensions,ee.types);function Xi(e){if(!e||typeof e!="string")return!1;var t=Ji.exec(e),r=t&&Yt[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&ql.test(t[1])?"UTF-8":!1}i(Xi,"charset");function Kl(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?ee.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=ee.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}i(Kl,"contentType");function Jl(e){if(!e||typeof e!="string")return!1;var t=Ji.exec(e),r=t&&ee.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}i(Jl,"extension");function Xl(e){if(!e||typeof e!="string")return!1;var t=Wl("x."+e).toLowerCase().substr(1);return t&&ee.types[t]||!1}i(Xl,"lookup");function Yl(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Yt).forEach(i(function(o){var s=Yt[o],c=s.extensions;if(!(!c||!c.length)){e[o]=c;for(var l=0;l<c.length;l++){var f=c[l];if(t[f]){var g=r.indexOf(Yt[t[f]].source),x=r.indexOf(s.source);if(t[f]!=="application/octet-stream"&&(g>x||g===x&&t[f].substr(0,12)==="application/"))continue}t[f]=o}}},"forEachMimeType"))}i(Yl,"populateMaps")});var ea=E((OA,Qi)=>{Qi.exports=Ql;function Ql(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}i(Ql,"defer")});var Wr=E((kA,ra)=>{var ta=ea();ra.exports=ep;function ep(e){var t=!1;return ta(function(){t=!0}),i(function(n,o){t?e(n,o):ta(i(function(){e(n,o)},"nextTick_callback"))},"async_callback")}i(ep,"async")});var qr=E((NA,na)=>{na.exports=tp;function tp(e){Object.keys(e.jobs).forEach(rp.bind(e)),e.jobs={}}i(tp,"abort");function rp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}i(rp,"clean")});var Kr=E((CA,ia)=>{var oa=Wr(),np=qr();ia.exports=op;function op(e,t,r,n){var o=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[o]=ip(t,o,e[o],function(s,c){o in r.jobs&&(delete r.jobs[o],s?np(r):r.results[o]=c,n(s,r.results))})}i(op,"iterate");function ip(e,t,r,n){var o;return e.length==2?o=e(r,oa(n)):o=e(r,t,oa(n)),o}i(ip,"runJob")});var Jr=E((MA,aa)=>{aa.exports=ap;function ap(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,s){return t(e[o],e[s])}),n}i(ap,"state")});var Xr=E((jA,sa)=>{var sp=qr(),up=Wr();sa.exports=cp;function cp(e){Object.keys(this.jobs).length&&(this.index=this.size,sp(this),up(e)(null,this.results))}i(cp,"terminator")});var ca=E((BA,ua)=>{var lp=Kr(),pp=Jr(),dp=Xr();ua.exports=mp;function mp(e,t,r){for(var n=pp(e);n.index<(n.keyedList||e).length;)lp(e,t,n,function(o,s){if(o){r(o,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return dp.bind(n,r)}i(mp,"parallel")});var Yr=E((VA,Qt)=>{var la=Kr(),fp=Jr(),gp=Xr();Qt.exports=yp;Qt.exports.ascending=pa;Qt.exports.descending=hp;function yp(e,t,r,n){var o=fp(e,r);return la(e,t,o,i(function s(c,l){if(c){n(c,l);return}if(o.index++,o.index<(o.keyedList||e).length){la(e,t,o,s);return}n(null,o.results)},"iteratorHandler")),gp.bind(o,n)}i(yp,"serialOrdered");function pa(e,t){return e<t?-1:e>t?1:0}i(pa,"ascending");function hp(e,t){return-1*pa(e,t)}i(hp,"descending")});var ma=E((GA,da)=>{var vp=Yr();da.exports=xp;function xp(e,t,r){return vp(e,t,null,r)}i(xp,"serial")});var ga=E((qA,fa)=>{fa.exports={parallel:ca(),serial:ma(),serialOrdered:Yr()}});var Qr=E((KA,ya)=>{"use strict";ya.exports=Object});var va=E((JA,ha)=>{"use strict";ha.exports=Error});var _a=E((XA,xa)=>{"use strict";xa.exports=EvalError});var ba=E((YA,Pa)=>{"use strict";Pa.exports=RangeError});var Ta=E((QA,Ia)=>{"use strict";Ia.exports=ReferenceError});var Sa=E((ez,Ea)=>{"use strict";Ea.exports=SyntaxError});var er=E((tz,$a)=>{"use strict";$a.exports=TypeError});var za=E((rz,Aa)=>{"use strict";Aa.exports=URIError});var wa=E((nz,Oa)=>{"use strict";Oa.exports=Math.abs});var Ra=E((oz,ka)=>{"use strict";ka.exports=Math.floor});var Da=E((iz,Na)=>{"use strict";Na.exports=Math.max});var Ua=E((az,Ca)=>{"use strict";Ca.exports=Math.min});var La=E((sz,Ma)=>{"use strict";Ma.exports=Math.pow});var Fa=E((uz,ja)=>{"use strict";ja.exports=Math.round});var Za=E((cz,Ba)=>{"use strict";Ba.exports=Number.isNaN||i(function(t){return t!==t},"isNaN")});var Ha=E((pz,Va)=>{"use strict";var _p=Za();Va.exports=i(function(t){return _p(t)||t===0?t:t<0?-1:1},"sign")});var Wa=E((mz,Ga)=>{"use strict";Ga.exports=Object.getOwnPropertyDescriptor});var en=E((fz,qa)=>{"use strict";var tr=Wa();if(tr)try{tr([],"length")}catch{tr=null}qa.exports=tr});var Ja=E((gz,Ka)=>{"use strict";var rr=Object.defineProperty||!1;if(rr)try{rr({},"a",{value:1})}catch{rr=!1}Ka.exports=rr});var tn=E((yz,Xa)=>{"use strict";Xa.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 s 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 c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(t,r);if(l.value!==o||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var es=E((vz,Qa)=>{"use strict";var Ya=typeof Symbol<"u"&&Symbol,Pp=tn();Qa.exports=i(function(){return typeof Ya!="function"||typeof Symbol!="function"||typeof Ya("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Pp()},"hasNativeSymbols")});var rn=E((_z,ts)=>{"use strict";ts.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var nn=E((Pz,rs)=>{"use strict";var bp=Qr();rs.exports=bp.getPrototypeOf||null});var is=E((bz,os)=>{"use strict";var Ip="Function.prototype.bind called on incompatible ",Tp=Object.prototype.toString,Ep=Math.max,Sp="[object Function]",ns=i(function(t,r){for(var n=[],o=0;o<t.length;o+=1)n[o]=t[o];for(var s=0;s<r.length;s+=1)n[s+t.length]=r[s];return n},"concatty"),$p=i(function(t,r){for(var n=[],o=r||0,s=0;o<t.length;o+=1,s+=1)n[s]=t[o];return n},"slicy"),Ap=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");os.exports=i(function(t){var r=this;if(typeof r!="function"||Tp.apply(r)!==Sp)throw new TypeError(Ip+r);for(var n=$p(arguments,1),o,s=i(function(){if(this instanceof o){var x=r.apply(this,ns(n,arguments));return Object(x)===x?x:this}return r.apply(t,ns(n,arguments))},"binder"),c=Ep(0,r.length-n.length),l=[],f=0;f<c;f++)l[f]="$"+f;if(o=Function("binder","return function ("+Ap(l,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var g=i(function(){},"Empty");g.prototype=r.prototype,o.prototype=new g,g.prototype=null}return o},"bind")});var He=E((Tz,as)=>{"use strict";var zp=is();as.exports=Function.prototype.bind||zp});var nr=E((Ez,ss)=>{"use strict";ss.exports=Function.prototype.call});var on=E((Sz,us)=>{"use strict";us.exports=Function.prototype.apply});var ls=E(($z,cs)=>{"use strict";cs.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var ds=E((Az,ps)=>{"use strict";var Op=He(),wp=on(),kp=nr(),Rp=ls();ps.exports=Rp||Op.call(kp,wp)});var fs=E((zz,ms)=>{"use strict";var Np=He(),Dp=er(),Cp=nr(),Up=ds();ms.exports=i(function(t){if(t.length<1||typeof t[0]!="function")throw new Dp("a function is required");return Up(Np,Cp,t)},"callBindBasic")});var _s=E((wz,xs)=>{"use strict";var Mp=fs(),gs=en(),hs;try{hs=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var an=!!hs&&gs&&gs(Object.prototype,"__proto__"),vs=Object,ys=vs.getPrototypeOf;xs.exports=an&&typeof an.get=="function"?Mp([an.get]):typeof ys=="function"?i(function(t){return ys(t==null?t:vs(t))},"getDunder"):!1});var Es=E((Rz,Ts)=>{"use strict";var Ps=rn(),bs=nn(),Is=_s();Ts.exports=Ps?i(function(t){return Ps(t)},"getProto"):bs?i(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return bs(t)},"getProto"):Is?i(function(t){return Is(t)},"getProto"):null});var sn=E((Dz,Ss)=>{"use strict";var Lp=Function.prototype.call,jp=Object.prototype.hasOwnProperty,Fp=He();Ss.exports=Fp.call(Lp,jp)});var Rs=E((Cz,ks)=>{"use strict";var M,Bp=Qr(),Zp=va(),Vp=_a(),Hp=ba(),Gp=Ta(),Ke=Sa(),qe=er(),Wp=za(),qp=wa(),Kp=Ra(),Jp=Da(),Xp=Ua(),Yp=La(),Qp=Fa(),ed=Ha(),Os=Function,un=i(function(e){try{return Os('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),It=en(),td=Ja(),cn=i(function(){throw new qe},"throwTypeError"),rd=It?(function(){try{return arguments.callee,cn}catch{try{return It(arguments,"callee").get}catch{return cn}}})():cn,Ge=es()(),Y=Es(),nd=nn(),od=rn(),ws=on(),Tt=nr(),We={},id=typeof Uint8Array>"u"||!Y?M:Y(Uint8Array),De={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?M:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?M:ArrayBuffer,"%ArrayIteratorPrototype%":Ge&&Y?Y([][Symbol.iterator]()):M,"%AsyncFromSyncIteratorPrototype%":M,"%AsyncFunction%":We,"%AsyncGenerator%":We,"%AsyncGeneratorFunction%":We,"%AsyncIteratorPrototype%":We,"%Atomics%":typeof Atomics>"u"?M:Atomics,"%BigInt%":typeof BigInt>"u"?M:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?M:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?M:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?M:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Zp,"%eval%":eval,"%EvalError%":Vp,"%Float16Array%":typeof Float16Array>"u"?M:Float16Array,"%Float32Array%":typeof Float32Array>"u"?M:Float32Array,"%Float64Array%":typeof Float64Array>"u"?M:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?M:FinalizationRegistry,"%Function%":Os,"%GeneratorFunction%":We,"%Int8Array%":typeof Int8Array>"u"?M:Int8Array,"%Int16Array%":typeof Int16Array>"u"?M:Int16Array,"%Int32Array%":typeof Int32Array>"u"?M:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ge&&Y?Y(Y([][Symbol.iterator]())):M,"%JSON%":typeof JSON=="object"?JSON:M,"%Map%":typeof Map>"u"?M:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ge||!Y?M:Y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Bp,"%Object.getOwnPropertyDescriptor%":It,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?M:Promise,"%Proxy%":typeof Proxy>"u"?M:Proxy,"%RangeError%":Hp,"%ReferenceError%":Gp,"%Reflect%":typeof Reflect>"u"?M:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?M:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ge||!Y?M:Y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?M:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ge&&Y?Y(""[Symbol.iterator]()):M,"%Symbol%":Ge?Symbol:M,"%SyntaxError%":Ke,"%ThrowTypeError%":rd,"%TypedArray%":id,"%TypeError%":qe,"%Uint8Array%":typeof Uint8Array>"u"?M:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?M:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?M:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?M:Uint32Array,"%URIError%":Wp,"%WeakMap%":typeof WeakMap>"u"?M:WeakMap,"%WeakRef%":typeof WeakRef>"u"?M:WeakRef,"%WeakSet%":typeof WeakSet>"u"?M:WeakSet,"%Function.prototype.call%":Tt,"%Function.prototype.apply%":ws,"%Object.defineProperty%":td,"%Object.getPrototypeOf%":nd,"%Math.abs%":qp,"%Math.floor%":Kp,"%Math.max%":Jp,"%Math.min%":Xp,"%Math.pow%":Yp,"%Math.round%":Qp,"%Math.sign%":ed,"%Reflect.getPrototypeOf%":od};if(Y)try{null.error}catch(e){$s=Y(Y(e)),De["%Error.prototype%"]=$s}var $s,ad=i(function e(t){var r;if(t==="%AsyncFunction%")r=un("async function () {}");else if(t==="%GeneratorFunction%")r=un("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=un("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&Y&&(r=Y(o.prototype))}return De[t]=r,r},"doEval"),As={__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"]},Et=He(),or=sn(),sd=Et.call(Tt,Array.prototype.concat),ud=Et.call(ws,Array.prototype.splice),zs=Et.call(Tt,String.prototype.replace),ir=Et.call(Tt,String.prototype.slice),cd=Et.call(Tt,RegExp.prototype.exec),ld=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pd=/\\(\\)?/g,dd=i(function(t){var r=ir(t,0,1),n=ir(t,-1);if(r==="%"&&n!=="%")throw new Ke("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ke("invalid intrinsic syntax, expected opening `%`");var o=[];return zs(t,ld,function(s,c,l,f){o[o.length]=l?zs(f,pd,"$1"):c||s}),o},"stringToPath"),md=i(function(t,r){var n=t,o;if(or(As,n)&&(o=As[n],n="%"+o[0]+"%"),or(De,n)){var s=De[n];if(s===We&&(s=ad(n)),typeof s>"u"&&!r)throw new qe("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:s}}throw new Ke("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");ks.exports=i(function(t,r){if(typeof t!="string"||t.length===0)throw new qe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new qe('"allowMissing" argument must be a boolean');if(cd(/^%?[^%]*%?$/,t)===null)throw new Ke("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dd(t),o=n.length>0?n[0]:"",s=md("%"+o+"%",r),c=s.name,l=s.value,f=!1,g=s.alias;g&&(o=g[0],ud(n,sd([0,1],g)));for(var x=1,T=!0;x<n.length;x+=1){var _=n[x],u=ir(_,0,1),d=ir(_,-1);if((u==='"'||u==="'"||u==="`"||d==='"'||d==="'"||d==="`")&&u!==d)throw new Ke("property names with quotes must have matching quotes");if((_==="constructor"||!T)&&(f=!0),o+="."+_,c="%"+o+"%",or(De,c))l=De[c];else if(l!=null){if(!(_ in l)){if(!r)throw new qe("base intrinsic for "+t+" exists, but the property is not available.");return}if(It&&x+1>=n.length){var y=It(l,_);T=!!y,T&&"get"in y&&!("originalValue"in y.get)?l=y.get:l=l[_]}else T=or(l,_),l=l[_];T&&!f&&(De[c]=l)}}return l},"GetIntrinsic")});var Ds=E((Mz,Ns)=>{"use strict";var fd=tn();Ns.exports=i(function(){return fd()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Ms=E((jz,Us)=>{"use strict";var gd=Rs(),Cs=gd("%Object.defineProperty%",!0),yd=Ds()(),hd=sn(),vd=er(),ar=yd?Symbol.toStringTag:null;Us.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 vd("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");ar&&(n||!hd(t,ar))&&(Cs?Cs(t,ar,{configurable:!o,enumerable:!1,value:r,writable:!1}):t[ar]=r)},"setToStringTag")});var js=E((Bz,Ls)=>{"use strict";var xd=Function.prototype.call,_d=Object.prototype.hasOwnProperty,Pd=He();Ls.exports=Pd.call(xd,_d)});var Bs=E((Zz,Fs)=>{"use strict";Fs.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var Hs=E((Vz,Vs)=>{"use strict";var mn=Wi(),bd=require("util"),ln=require("path"),Id=require("http"),Td=require("https"),Ed=require("url").parse,Sd=require("fs"),$d=require("stream").Stream,Ad=require("crypto"),pn=Yi(),zd=ga(),Od=Ms(),we=js(),dn=Bs();function Zs(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}i(Zs,"escapeHeaderParam");function j(e){if(!(this instanceof j))return new j(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],mn.call(this),e=e||{};for(var t in e)this[t]=e[t]}i(j,"FormData");bd.inherits(j,mn);j.LINE_BREAK=`\r
|
|
2
|
+
`;j.DEFAULT_CONTENT_TYPE="application/octet-stream";j.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=mn.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),s=this._multiPartFooter();n(o),n(t),n(s),this._trackLength(o,t,r)};j.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)+j.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&we(t,"httpVersion"))&&!(t instanceof $d))&&(r.knownLength||this._valuesToMeasure.push(t))};j.prototype._lengthRetriever=function(e,t){we(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):Sd.stat(e.path,function(r,n){if(r){t(r);return}var o=n.size-(e.start?e.start:0);t(null,o)}):we(e,"httpVersion")?t(null,Number(e.headers["content-length"])):we(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};j.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),s="",c={"Content-Disposition":["form-data",'name="'+Zs(e)+'"'].concat(n||[]),"Content-Type":[].concat(o||[])};typeof r.header=="object"&&dn(c,r.header);var l;for(var f in c)if(we(c,f)){if(l=c[f],l==null)continue;Array.isArray(l)||(l=[l]),l.length&&(s+=f+": "+l.join("; ")+j.LINE_BREAK)}return"--"+this.getBoundary()+j.LINE_BREAK+s+j.LINE_BREAK};j.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=ln.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=ln.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&we(e,"httpVersion")&&(r=ln.basename(e.client._httpMessage.path||"")),r)return'filename="'+Zs(r)+'"'};j.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=pn.lookup(e.name)),!r&&e&&e.path&&(r=pn.lookup(e.path)),!r&&e&&e.readable&&we(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=pn.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=j.DEFAULT_CONTENT_TYPE),r};j.prototype._multiPartFooter=function(){return function(e){var t=j.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};j.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+j.LINE_BREAK};j.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)we(e,t)&&(r[t.toLowerCase()]=e[t]);return r};j.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};j.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};j.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(j.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};j.prototype._generateBoundary=function(){this._boundary="--------------------------"+Ad.randomBytes(12).toString("hex")};j.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};j.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};j.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}zd.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(o){t+=o}),e(null,t)})};j.prototype.submit=function(e,t){var r,n,o={method:"post"};return typeof e=="string"?(e=Ed(e),n=dn({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o)):(n=dn(e,o),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=Td.request(n):r=Id.request(n),this.getLength(function(s,c){if(s&&s!=="Unknown stream"){this._error(s);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),t){var l,f=i(function(g,x){return r.removeListener("error",f),r.removeListener("response",l),t.call(this,g,x)},"callback");l=f.bind(this,null),r.on("error",f),r.on("response",l)}}.bind(this)),r};j.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};j.prototype.toString=function(){return"[object FormData]"};Od(j.prototype,"FormData");Vs.exports=j});var Bd={};hn(Bd,{sendpulse:()=>Fd});module.exports=cu(Bd);var lu=Object.freeze({status:"aborted"});function b(e,t,r){function n(l,f){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:f,constr:c,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,f);let g=c.prototype,x=Object.keys(g);for(let T=0;T<x.length;T++){let _=x[T];_ in l||(l[_]=g[_].bind(l))}}i(n,"init");let o=r?.Parent??Object;class s extends o{static{i(this,"Definition")}}Object.defineProperty(s,"name",{value:e});function c(l){var f;let g=r?.Parent?new s:this;n(g,l),(f=g._zod).deferred??(f.deferred=[]);for(let x of g._zod.deferred)x();return g}return i(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:i(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e),"value")}),Object.defineProperty(c,"name",{value:e}),c}i(b,"$constructor");var pe=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},$t=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},cr={};function ye(e){return e&&Object.assign(cr,e),cr}i(ye,"config");function pr(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(pr,"getEnumValues");function _n(e,t){return typeof t=="bigint"?t.toString():t}i(_n,"jsonStringifyReplacer");function zt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(zt,"cached");function Pn(e){return e==null}i(Pn,"nullish");function Ot(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(Ot,"cleanRegex");var xn=Symbol("evaluating");function J(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==xn)return n===void 0&&(n=xn,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}i(J,"defineLazy");var dr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(Ye,"isObject");var pu=zt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function bn(e){if(Ye(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ye(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(bn,"isPlainObject");var In=new Set(["string","number","symbol"]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(Ue,"escapeRegex");function wt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}i(wt,"clone");function V(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(V,"normalizeParams");function Tn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(Tn,"optionalKeys");var En={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 Me(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(Me,"aborted");function Ie(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}i(Ie,"prefixIssues");function At(e){return typeof e=="string"?e:e?.message}i(At,"unwrapMessage");function Te(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=At(e.inst?._zod.def?.error?.(e))??At(t?.error?.(e))??At(r.customError?.(e))??At(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}i(Te,"finalizeIssue");function Sn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(Sn,"getLengthableOrigin");function mr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}i(mr,"issue");var $n=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,_n,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),An=b("$ZodError",$n),Qe=b("$ZodError",$n,{Parent:Error});var mu=i(e=>(t,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new pe;if(c.issues.length){let l=new(o?.Err??e)(c.issues.map(f=>Te(f,s,ye())));throw dr(l,o?.callee),l}return c.value},"_parse"),kt=mu(Qe),fu=i(e=>async(t,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let l=new(o?.Err??e)(c.issues.map(f=>Te(f,s,ye())));throw dr(l,o?.callee),l}return c.value},"_parseAsync"),Rt=fu(Qe),gu=i(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new pe;return s.issues.length?{success:!1,error:new(e??An)(s.issues.map(c=>Te(c,o,ye())))}:{success:!0,data:s.value}},"_safeParse"),et=gu(Qe),yu=i(e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>Te(c,o,ye())))}:{success:!0,data:s.value}},"_safeParseAsync"),tt=yu(Qe);var hu="(?:(?:\\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])))",vu=new RegExp(`^${hu}$`);var zn=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),On=/^-?\d+n?$/,wn=/^-?\d+$/,fr=/^-?\d+(?:\.\d+)?$/,kn=/^(?:true|false)$/i;var Ee=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),xu={number:"number",bigint:"bigint",object:"date"};var Rn=b("$ZodCheckGreaterThan",(e,t)=>{Ee.init(e,t);let r=xu[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(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 Nn=b("$ZodCheckNumberFormat",(e,t)=>{Ee.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=En[t.format];e._zod.onattach.push(c=>{let l=c._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,r&&(l.pattern=wn)}),e._zod.check=c=>{let l=c.value;if(r){if(!Number.isInteger(l)){c.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?c.issues.push({input:l,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}):c.issues.push({input:l,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}}l<o&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Dn=b("$ZodCheckMinLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Pn(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 c=Sn(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}});var gr=b("$ZodCheckStringFormat",(e,t)=>{var r,n;Ee.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.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=()=>{})}),Cn=b("$ZodCheckRegex",(e,t)=>{gr.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 Mn={major:4,minor:3,patch:6};var G=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mn;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(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((c,l,f)=>{let g=Me(c),x;for(let T of l){if(T._zod.def.when){if(!T._zod.def.when(c))continue}else if(g)continue;let _=c.issues.length,u=T._zod.check(c);if(u instanceof Promise&&f?.async===!1)throw new pe;if(x||u instanceof Promise)x=(x??Promise.resolve()).then(async()=>{await u,c.issues.length!==_&&(g||(g=Me(c,_)))});else{if(c.issues.length===_)continue;g||(g=Me(c,_))}}return x?x.then(()=>c):c},"runChecks"),s=i((c,l,f)=>{if(Me(c))return c.aborted=!0,c;let g=o(l,n,f);if(g instanceof Promise){if(f.async===!1)throw new pe;return g.then(x=>e._zod.parse(x,f))}return e._zod.parse(g,f)},"handleCanaryResult");e._zod.run=(c,l)=>{if(l.skipChecks)return e._zod.parse(c,l);if(l.direction==="backward"){let g=e._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return g instanceof Promise?g.then(x=>s(x,c,l)):s(g,c,l)}let f=e._zod.parse(c,l);if(f instanceof Promise){if(l.async===!1)throw new pe;return f.then(g=>o(g,n,l))}return o(f,n,l)}}J(e,"~standard",()=>({validate:i(o=>{try{let s=et(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return tt(e,o).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Ct=b("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zn(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}}),yr=b("$ZodStringFormat",(e,t)=>{gr.init(e,t),Ct.init(e,t)});var Zn=b("$ZodURL",(e,t)=>{yr.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 hr=b("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??fr,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 s=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,...s?{received:s}:{}}),r}}),Vn=b("$ZodNumberFormat",(e,t)=>{Nn.init(e,t),hr.init(e,t)}),vr=b("$ZodBoolean",(e,t)=>{G.init(e,t),e._zod.pattern=kn,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}}),Hn=b("$ZodBigInt",(e,t)=>{G.init(e,t),e._zod.pattern=On,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 Gn=b("$ZodAny",(e,t)=>{G.init(e,t),e._zod.parse=r=>r}),Wn=b("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=r=>r});var qn=b("$ZodVoid",(e,t)=>{G.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}}),Kn=b("$ZodDate",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Ln(e,t,r){e.issues.length&&t.issues.push(...Ie(r,e.issues)),t.value[r]=e.value}i(Ln,"handleArrayResult");var Jn=b("$ZodArray",(e,t)=>{G.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 s=[];for(let c=0;c<o.length;c++){let l=o[c],f=t.element._zod.run({value:l,issues:[]},n);f instanceof Promise?s.push(f.then(g=>Ln(g,r,c))):Ln(f,r,c)}return s.length?Promise.all(s).then(()=>r):r}});function Dt(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ie(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}i(Dt,"handlePropertyResult");function _u(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=Tn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(_u,"normalizeDef");function Pu(e,t,r,n,o,s){let c=[],l=o.keySet,f=o.catchall._zod,g=f.def.type,x=f.optout==="optional";for(let T in t){if(l.has(T))continue;if(g==="never"){c.push(T);continue}let _=f.run({value:t[T],issues:[]},n);_ instanceof Promise?e.push(_.then(u=>Dt(u,r,T,t,x))):Dt(_,r,T,t,x)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}i(Pu,"handleCatchall");var Xn=b("$ZodObject",(e,t)=>{if(G.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let f={...l};return Object.defineProperty(t,"shape",{value:f}),f},"get")})}let n=zt(()=>_u(t));J(e._zod,"propValues",()=>{let l=t.shape,f={};for(let g in l){let x=l[g]._zod;if(x.values){f[g]??(f[g]=new Set);for(let T of x.values)f[g].add(T)}}return f});let o=Ye,s=t.catchall,c;e._zod.parse=(l,f)=>{c??(c=n.value);let g=l.value;if(!o(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),l;l.value={};let x=[],T=c.shape;for(let _ of c.keys){let u=T[_],d=u._zod.optout==="optional",y=u._zod.run({value:g[_],issues:[]},f);y instanceof Promise?x.push(y.then(m=>Dt(m,l,_,g,d))):Dt(y,l,_,g,d)}return s?Pu(x,g,l,f,n.value,e):x.length?Promise.all(x).then(()=>l):l}});function jn(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!Me(s));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(s=>s.issues.map(c=>Te(c,n,ye())))}),t)}i(jn,"handleUnionResults");var xr=b("$ZodUnion",(e,t)=>{G.init(e,t),J(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),J(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Ot(s.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let c=!1,l=[];for(let f of t.options){let g=f._zod.run({value:o.value,issues:[]},s);if(g instanceof Promise)l.push(g),c=!0;else{if(g.issues.length===0)return g;l.push(g)}}return c?Promise.all(l).then(f=>jn(f,o,e,s)):jn(l,o,e,s)}});var Yn=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,xr.init(e,t);let r=e._zod.parse;J(e._zod,"propValues",()=>{let o={};for(let s of t.options){let c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[l,f]of Object.entries(c)){o[l]||(o[l]=new Set);for(let g of f)o[l].add(g)}}return o});let n=zt(()=>{let o=t.options,s=new Map;for(let c of o){let l=c._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(let f of l){if(s.has(f))throw new Error(`Duplicate discriminator value "${String(f)}"`);s.set(f,c)}}return s});e._zod.parse=(o,s)=>{let c=o.value;if(!Ye(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;let l=n.value.get(c?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),o)}});var Qn=b("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!bn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],c=t.keyType._zod.values;if(c){r.value={};let l=new Set;for(let g of c)if(typeof g=="string"||typeof g=="number"||typeof g=="symbol"){l.add(typeof g=="number"?g.toString():g);let x=t.valueType._zod.run({value:o[g],issues:[]},n);x instanceof Promise?s.push(x.then(T=>{T.issues.length&&r.issues.push(...Ie(g,T.issues)),r.value[g]=T.value})):(x.issues.length&&r.issues.push(...Ie(g,x.issues)),r.value[g]=x.value)}let f;for(let g in o)l.has(g)||(f=f??[],f.push(g));f&&f.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:f})}else{r.value={};for(let l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},n);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&fr.test(l)&&f.issues.length){let T=t.keyType._zod.run({value:Number(l),issues:[]},n);if(T instanceof Promise)throw new Error("Async schemas not supported in object keys currently");T.issues.length===0&&(f=T)}if(f.issues.length){t.mode==="loose"?r.value[l]=o[l]:r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(T=>Te(T,n,ye())),input:l,path:[l],inst:e});continue}let x=t.valueType._zod.run({value:o[l],issues:[]},n);x instanceof Promise?s.push(x.then(T=>{T.issues.length&&r.issues.push(...Ie(l,T.issues)),r.value[f.value]=T.value})):(x.issues.length&&r.issues.push(...Ie(l,x.issues)),r.value[f.value]=x.value)}}return s.length?Promise.all(s).then(()=>r):r}});var eo=b("$ZodEnum",(e,t)=>{G.init(e,t);let r=pr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>In.has(typeof o)).map(o=>typeof o=="string"?Ue(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),to=b("$ZodLiteral",(e,t)=>{if(G.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"?Ue(n):n?Ue(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var ro=b("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $t(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(r.value=c,r));if(o instanceof Promise)throw new pe;return r.value=o,r}});function Fn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(Fn,"handleOptionalResult");var no=b("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ot(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(s=>Fn(s,r.value)):Fn(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var oo=b("$ZodNullable",(e,t)=>{G.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ot(r.source)}|null)$`):void 0}),J(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 io=b("$ZodPipe",(e,t)=>{G.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(c=>Nt(c,t.in,n)):Nt(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Nt(s,t.out,n)):Nt(o,t.out,n)}});function Nt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(Nt,"handlePipeResult");var ao=b("$ZodCustom",(e,t)=>{Ee.init(e,t),G.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(s=>Bn(s,r,n,e));Bn(o,r,n,e)}});function Bn(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(mr(o))}}i(Bn,"handleRefineResult");var uo;var _r=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 co(){return new _r}i(co,"registry");(uo=globalThis).__zod_globalRegistry??(uo.__zod_globalRegistry=co());var Pr=globalThis.__zod_globalRegistry;function lo(e,t){return new e({type:"string",...V(t)})}i(lo,"_string");function po(e,t){return new e({type:"string",coerce:!0,...V(t)})}i(po,"_coercedString");function mo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...V(t)})}i(mo,"_url");function fo(e,t){return new e({type:"number",checks:[],...V(t)})}i(fo,"_number");function go(e,t){return new e({type:"number",coerce:!0,checks:[],...V(t)})}i(go,"_coercedNumber");function yo(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...V(t)})}i(yo,"_int");function ho(e,t){return new e({type:"boolean",...V(t)})}i(ho,"_boolean");function vo(e,t){return new e({type:"boolean",coerce:!0,...V(t)})}i(vo,"_coercedBoolean");function xo(e,t){return new e({type:"bigint",coerce:!0,...V(t)})}i(xo,"_coercedBigint");function _o(e){return new e({type:"any"})}i(_o,"_any");function Po(e){return new e({type:"unknown"})}i(Po,"_unknown");function bo(e,t){return new e({type:"void",...V(t)})}i(bo,"_void");function Io(e,t){return new e({type:"date",coerce:!0,...V(t)})}i(Io,"_coercedDate");function Ut(e,t){return new Rn({check:"greater_than",...V(t),value:e,inclusive:!0})}i(Ut,"_gte");function ce(e,t){return new Dn({check:"min_length",...V(t),minimum:e})}i(ce,"_minLength");function Se(e,t){return new Cn({check:"string_format",format:"regex",...V(t),pattern:e})}i(Se,"_regex");function To(e,t,r){let n=V(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}i(To,"_custom");var X=b("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");G.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>kt(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>et(e,r,n),e.parseAsync=async(r,n)=>Rt(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>tt(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)=>wt(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Lt=b("ZodMiniString",(e,t)=>{Ct.init(e,t),X.init(e,t)});function a(e){return lo(Lt,e)}i(a,"string");var Eo=b("ZodMiniStringFormat",(e,t)=>{yr.init(e,t),Lt.init(e,t)});var Nu=b("ZodMiniURL",(e,t)=>{Zn.init(e,t),Eo.init(e,t)});function So(e){return mo(Nu,e)}i(So,"url");var jt=b("ZodMiniNumber",(e,t)=>{hr.init(e,t),X.init(e,t)});function Q(e){return fo(jt,e)}i(Q,"number");var Du=b("ZodMiniNumberFormat",(e,t)=>{Vn.init(e,t),jt.init(e,t)});function $o(e){return yo(Du,e)}i($o,"int");var br=b("ZodMiniBoolean",(e,t)=>{vr.init(e,t),X.init(e,t)});function B(e){return ho(br,e)}i(B,"boolean");var Ao=b("ZodMiniBigInt",(e,t)=>{Hn.init(e,t),X.init(e,t)});var Cu=b("ZodMiniAny",(e,t)=>{Gn.init(e,t),X.init(e,t)});function nt(){return _o(Cu)}i(nt,"any");var Uu=b("ZodMiniUnknown",(e,t)=>{Wn.init(e,t),X.init(e,t)});function O(){return Po(Uu)}i(O,"unknown");var Mu=b("ZodMiniVoid",(e,t)=>{qn.init(e,t),X.init(e,t)});function zo(e){return bo(Mu,e)}i(zo,"_void");var Oo=b("ZodMiniDate",(e,t)=>{Kn.init(e,t),X.init(e,t)});var Lu=b("ZodMiniArray",(e,t)=>{Jn.init(e,t),X.init(e,t)});function R(e,t){return new Lu({type:"array",element:e,...V(t)})}i(R,"array");var ju=b("ZodMiniObject",(e,t)=>{Xn.init(e,t),X.init(e,t),J(e,"shape",()=>t.shape)});function p(e,t){let r={type:"object",shape:e??{},...V(t)};return new ju(r)}i(p,"object");var Fu=b("ZodMiniUnion",(e,t)=>{xr.init(e,t),X.init(e,t)});function N(e,t){return new Fu({type:"union",options:e,...V(t)})}i(N,"union");var Bu=b("ZodMiniDiscriminatedUnion",(e,t)=>{Yn.init(e,t),X.init(e,t)});function $e(e,t,r){return new Bu({type:"union",options:t,discriminator:e,...V(r)})}i($e,"discriminatedUnion");var Zu=b("ZodMiniRecord",(e,t)=>{Qn.init(e,t),X.init(e,t)});function w(e,t,r){return new Zu({type:"record",keyType:e,valueType:t,...V(r)})}i(w,"record");var Vu=b("ZodMiniEnum",(e,t)=>{eo.init(e,t),X.init(e,t),e.options=Object.values(t.entries)});function C(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Vu({type:"enum",entries:r,...V(t)})}i(C,"_enum");var Hu=b("ZodMiniLiteral",(e,t)=>{to.init(e,t),X.init(e,t)});function S(e,t){return new Hu({type:"literal",values:Array.isArray(e)?e:[e],...V(t)})}i(S,"literal");var Gu=b("ZodMiniTransform",(e,t)=>{ro.init(e,t),X.init(e,t)});function Ae(e){return new Gu({type:"transform",transform:e})}i(Ae,"transform");var Wu=b("ZodMiniOptional",(e,t)=>{no.init(e,t),X.init(e,t)});function h(e){return new Wu({type:"optional",innerType:e})}i(h,"optional");var qu=b("ZodMiniNullable",(e,t)=>{oo.init(e,t),X.init(e,t)});function ot(e){return new qu({type:"nullable",innerType:e})}i(ot,"nullable");var Ku=b("ZodMiniPipe",(e,t)=>{io.init(e,t),X.init(e,t)});function ze(e,t){return new Ku({type:"pipe",in:e,out:t})}i(ze,"pipe");var Ju=b("ZodMiniCustom",(e,t)=>{ao.init(e,t),X.init(e,t)});function Ft(e,t){return To(Ju,e??(()=>!0),t)}i(Ft,"custom");var it={};hn(it,{bigint:()=>rc,boolean:()=>tc,date:()=>nc,number:()=>ec,string:()=>Qu});function Qu(e){return po(Lt,e)}i(Qu,"string");function ec(e){return go(jt,e)}i(ec,"number");function tc(e){return vo(br,e)}i(tc,"boolean");function rc(e){return xo(Ao,e)}i(rc,"bigint");function nc(e){return Io(Oo,e)}i(nc,"date");var Tr=p({retryOnFailure:p({defaultValue:h(B()),hide:h(B())}),continueOnFailure:p({defaultValue:h(B()),hide:h(B())})}),Ir=class{constructor(t,r,n,o,s,c,l,f,g,x,T){this.name=t;this.displayName=r;this.description=n;this.props=o;this.run=s;this.test=c;this.requireAuth=l;this.errorHandlingOptions=f;this.outputSchema=g;this.audience=x;this.aiMetadata=T}static{i(this,"IAction")}},ae=i(e=>new Ir(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 F=p({displayName:a(),description:h(a())}),D=i((e,t)=>p({type:S(t),required:B(),defaultValue:h(nt())}),"TPropertyValue");var ne=p({...F.shape,...D(a(),"SHORT_TEXT").shape}),he=p({...F.shape,...D(a(),"LONG_TEXT").shape});var ko=p({label:a(),value:O()}),Bt=p({disabled:h(B()),placeholder:h(a()),options:R(ko)});var oe=p({...F.shape,options:Bt,...D(O(),"STATIC_DROPDOWN").shape}),ve=p({...F.shape,options:Bt,...D(R(O()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Er=p({...F.shape,...D(O(),"DROPDOWN").shape,refreshers:R(a())}),at=p({...F.shape,...D(R(O()),"MULTI_SELECT_DROPDOWN").shape,refreshers:R(a())});var xe=p({...F.shape,...D(B(),"CHECKBOX").shape});var _e=p({...F.shape,...D(Q(),"NUMBER").shape});var st=p({...F.shape,streaming:h(B()),...D(O(),"FILE").shape});var ut=p({...F.shape,...D(a(),"DATE_TIME").shape});var Ro=w(a(),N([ne,he,oe,at,ve,xe,_e,st,ut])),ct=p({...F.shape,properties:Ro,...D(R(O()),"ARRAY").shape});var lt=p({...F.shape,...D(N([w(a(),O())]),"JSON").shape});var No=N([ne,oe,lt,ct,ve]),ic=w(a(),No),Sr=p({refreshers:R(a()),...F.shape,...D(O(),"DYNAMIC").shape});var Zt=p({...F.shape,...D(zo(),"MARKDOWN").shape});var pt=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(pt||{}),Le=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Le||{}),dt=(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))(dt||{});var mt=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(mt||{}),$r="both_client_credentials_and_authorization_code";var de=(o=>(o.POLLING="POLLING",o.WEBHOOK="WEBHOOK",o.APP_WEBHOOK="APP_WEBHOOK",o.MANUAL="MANUAL",o))(de||{}),ft=(s=>(s.NONE="NONE",s.HEADER_PRESENT="HEADER_PRESENT",s.QUERY_PRESENT="QUERY_PRESENT",s.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",s.HEAD_REQUEST="HEAD_REQUEST",s))(ft||{}),ac=p({strategy:C(ft),paramName:h(a())}),gt=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(gt||{});var Vt=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(Vt||{}),Do=p({status:h(Q()),body:h(O()),headers:h(w(a(),a()))}),Co=p({type:S("DELAY"),resumeDateTime:a(),requestIdToReply:h(a()),handlerId:h(a()),streamStepProgress:h(C(Vt))}),Uo=p({type:S("WEBHOOK"),requestId:a(),requestIdToReply:h(a()),response:Do,handlerId:h(a()),streamStepProgress:h(C(Vt))}),sc=N([Co,Uo]);var uc=p({body:O(),rawBody:h(O()),headers:w(a(),a()),queryParams:w(a(),a())});function ie(e){return e==null}i(ie,"isNil");function yt(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}i(yt,"isEmpty");function Ht(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}i(Ht,"assertNotNullOrUndefined");var Ar=Ce(require("crypto"),1);var cc=128,ke,je,lc=i(e=>{!ke||ke.length<e?(ke=Buffer.allocUnsafe(e*cc),Ar.default.randomFillSync(ke),je=0):je+e>ke.length&&(Ar.default.randomFillSync(ke),je=0),je+=e},"fillPool"),pc=i(e=>(lc(e|=0),ke.subarray(je-e,je)),"random"),dc=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(s=t)=>{let c="";for(;;){let l=r(o),f=o;for(;f--;)if(c+=e[l[f]&n]||"",c.length===s)return c}}},"customRandom"),Lo=i((e,t=21)=>dc(e,t,pc),"customAlphabet");var mc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jo=21,Ib=a().check(Se(new RegExp(`^[0-9a-zA-Z]{${jo}}$`))),fc=Lo(mc,jo);var Oe=ze(Ae(e=>e instanceof Date?e.toISOString():e),a()),se={id:a(),created:Oe,updated:Oe},H=i(e=>h(ot(e)),"Nullable");function zr(e){return h(ot(C(e)))}i(zr,"NullableEnum");var Sb=ze(Ae(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),h(B())),Gt=i(e=>ze(Ae(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),h(R(e))),"OptionalArrayFromQuery");var zb=w(a(),O());var ht=(x=>(x.OPENAI="openai",x.OPENROUTER="openrouter",x.ANTHROPIC="anthropic",x.AZURE="azure",x.GOOGLE="google",x.ACTIVEPIECES="activepieces",x.CLOUDFLARE_GATEWAY="cloudflare-gateway",x.CUSTOM="custom",x.BEDROCK="bedrock",x.MISTRAL="mistral",x))(ht||{});var Fb=a().check(Se(/^#[0-9A-Fa-f]{6}$/));var Zb=p({filename:a(),data:O(),type:S("file"),mimetype:h(a())});var gc=Ce(Bo());var Jb=p({...se,name:a(),permissions:R(a()),platformId:H(a()),type:a(),userCount:h(Q())});var Zo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Zo||{}),Or=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Or||{}),wr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(wr||{});var kr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(kr||{});var Rr=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Rr||{});var yc=p({mode:C(Zo),value:O()}),hc=p({auth:h(a()),fields:w(a(),yc)}),vc=p({pieceName:a(),pieceVersion:a(),actionName:a(),predefinedInput:h(hc)}),xc=p({type:S("PIECE"),toolName:a().check(ce(1)),pieceMetadata:vc}),_c=p({type:S("none")}),Pc=p({type:S("access_token"),accessToken:a()}),bc=p({type:S("api_key"),apiKey:a(),apiKeyHeader:a()}),Ic=p({type:S("headers"),headers:w(a(),a())}),Tc=$e("type",[_c,Pc,bc,Ic]),Vo=p({type:S("FLOW"),toolName:a().check(ce(1)),externalFlowId:a(),flowDisplayName:h(a())}),Ho=p({type:S("MCP"),toolName:a().check(ce(1)),serverUrl:So(),protocol:C(wr),auth:Tc}),Go=p({type:S("KNOWLEDGE_BASE"),toolName:a().check(ce(1)),sourceType:C(Or),sourceId:a(),sourceName:a()}),Ec=$e("type",[xc,Vo,Ho,Go]),Sc=p({displayName:a(),description:h(a()),type:C(kr)}),Wo=p({type:S("MARKDOWN"),markdown:a()}),Fe={type:S("TOOL_CALL"),input:H(w(a(),O())),output:h(O()),toolName:a(),status:C(Rr),toolCallId:a(),startTime:a(),endTime:h(a())},$I=p(Fe),qo=$e("toolCallType",[p({...Fe,toolCallType:S("PIECE"),pieceName:a(),pieceVersion:a(),actionName:a()}),p({...Fe,toolCallType:S("FLOW"),displayName:a(),externalFlowId:a()}),p({...Fe,toolCallType:S("MCP"),displayName:a(),serverUrl:a()}),p({...Fe,toolCallType:S("KNOWLEDGE_BASE"),displayName:a(),sourceType:a()}),p({...Fe,toolCallType:S("UNKNOWN"),displayName:a()})]),$c=N([Wo,qo]);var Nr=(r=>(r.IMAGE="image",r.TEXT="text",r))(Nr||{}),Pe=p({apiKey:a()}),Ac=Pe,zc=p({apiKey:a(),apiKeyHash:a()}),Oc=Pe,wc=Pe,kc=Pe,Rc=Pe,Nc=Pe,Dc=Pe,Cc=Pe,Qo=p({accessKeyId:a().check(ce(1)),secretAccessKey:a().check(ce(1))}),Uc=p({}),Mc=p({}),Lc=p({}),jc=p({}),Fc=p({}),Bc=p({}),ei=p({modelId:a(),modelName:a(),modelType:C(Nr)}),ti=p({apiKeyHeader:a(),baseUrl:a(),models:R(ei),defaultHeaders:h(w(a(),a()))}),ri=p({accountId:a(),gatewayId:a(),models:R(ei),vertexProject:h(a()),vertexRegion:h(a())}),ni=p({resourceName:a(),apiVersion:ze(Ae(e=>typeof e=="string"&&e.trim().length===0?void 0:e),h(a()))}),oi=p({region:a().check(ce(1))}),Zc=N([Ac,kc,Rc,Nc,Dc,wc,Oc,zc,Qo,Cc]),ii=N([ti,ri,ni,oi,Uc,Lc,jc,Fc,Mc,Bc]),Vc=p({id:a(),name:a(),type:C(Nr)}),Hc=p({id:a(),name:a(),provider:C(ht),config:ii,enabledForChat:B()}),Gc=p({provider:C(ht),config:ii,auth:Zc,platformId:a()});var wI={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Ko=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Wc=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],qc=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Jo=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Kc=["grok-4.20","grok-4.1-fast"],Jc={openai:Ko,anthropic:Wc,google:Jo,activepieces:[...qc.map(e=>`anthropic/${e}`),...Ko.map(e=>`openai/${e}`),...Jo.map(e=>`google/${e}`),...Kc.map(e=>`x-ai/${e}`)]};var Xo=128e3,Xc={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Yc({provider:e}){return e?Xc[e]??Xo:Xo}i(Yc,"getMaxContextTokens");var Yo={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"},Qc={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},el=new Set(["anthropic","mistral"]);function me(e){return{chatModels:Jc[e],maxContextTokens:Yc({provider:e}),defaultEmbeddingModel:Yo[e],supportsEmbedding:Yo[e]!==void 0,supportsImageGeneration:!el.has(e),webSearch:Qc[e]}}i(me,"buildProviderCapabilities");var tl={openai:me("openai"),anthropic:me("anthropic"),openrouter:me("openrouter"),azure:me("azure"),google:me("google"),"cloudflare-gateway":me("cloudflare-gateway"),custom:me("custom"),bedrock:me("bedrock"),mistral:me("mistral"),activepieces:me("activepieces")};var rl=p({base64Url:a(),fileName:a(),extension:h(a())}),nl=p({mimeType:a(),url:a(),fileName:h(a())}),Dr=N([rl,nl]);var ol=N([p({type:S("file"),value:Dr}),p({type:S("markdown"),value:a(),files:h(R(Dr))})]),il=p({sessionId:a(),message:a(),files:h(R(a()))});var si=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(si||{}),ui=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(ui||{}),Cr=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Cr||{});var al=N([p({...se,name:a(),externalId:a(),type:S("STATIC_DROPDOWN"),tableId:a(),projectId:a(),data:p({options:R(p({value:a()}))})}),p({...se,name:a(),externalId:a(),type:N([S("TEXT"),S("NUMBER"),S("DATE")]),tableId:a(),projectId:a()})]),sl=p({...se,name:a(),folderId:H(a()),projectId:a(),externalId:a(),status:zr(ui),trigger:zr(si)}),ul=p({...se,tableId:a(),projectId:a(),cells:w(a(),p({updated:a(),created:a(),value:O(),fieldName:a()}))}),cl=p({events:R(C(Cr)),webhookUrl:a(),flowId:a()}),ll=p({fields:R(p({id:a(),name:a()})),rows:R(w(a(),a())),name:a()}),pl=p({projectId:a(),limit:h(it.number()),cursor:h(a()),name:h(a()),externalIds:Gt(a()),folderId:h(a()),folderIds:Gt(a())}),dl=p({records:R(R(p({fieldId:a(),value:li()}))),tableId:a()}),ml=p({cells:h(R(p({fieldId:a(),value:li()}))),tableId:a(),agentUpdate:h(B())}),ci=$e("operator",[Re("eq"),Re("neq"),Re("gt"),Re("gte"),Re("lt"),Re("lte"),Re("co"),ai("exists"),ai("not_exists")]),fl=p({tableId:a(),limit:h(it.number()),cursor:h(a()),filters:Gt(ci)});function li(){return ze(Ae(e=>e==null?e:String(e)),ot(a()))}i(li,"coerceToString");function Re(e){return p({fieldId:a(),operator:S(e),value:a()})}i(Re,"valueFilter");function ai(e){return p({fieldId:a(),operator:S(e)})}i(ai,"existenceFilter");var gl=p({status:h(Q()),body:h(O()),headers:h(w(a(),a()))}),yl=p({...se,deleted:H(Oe),ownerId:a(),displayName:a(),platformId:a(),externalId:H(a())});var pi=p({name:a(),description:h(a()),type:a(),required:B()}),hl=p({pieceName:a(),triggerName:a(),input:p({toolName:a(),toolDescription:a(),inputSchema:R(pi),returnsResponse:B()})});var di="^[0-9]+\\.[0-9]+\\.[0-9]+$",JI=new RegExp(di),xl="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",XI=a().check(Se(new RegExp(di))),YI=a().check(Se(new RegExp(xl))),_l=p({packageType:S("ARCHIVE"),pieceType:C(Le),pieceName:a(),pieceVersion:a(),archiveId:a(),platformId:a()}),mi=p({packageType:S("REGISTRY"),pieceType:S("OFFICIAL"),pieceName:a(),pieceVersion:a()}),fi=p({packageType:S("REGISTRY"),pieceType:S("CUSTOM"),pieceName:a(),pieceVersion:a(),platformId:a()}),QI=N([mi,fi]),eT=N([_l,mi,fi]);var Pl=$e("type",[p({type:S("CRON_EXPRESSION"),cronExpression:a(),timezone:a()}),p({type:S("INTERVAL"),intervalMs:$o().check(Ut(6e4))})]),tT=p({...se,type:C(de),projectId:a(),flowId:a(),triggerName:a(),schedule:H(Pl),flowVersionId:a(),pieceName:a(),pieceVersion:a(),deleted:H(a()),simulate:B()}),gi=(m=>(m.UNKNOWN="UNKNOWN",m.FLOW_RUN_LOG="FLOW_RUN_LOG",m.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",m.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",m.FLOW_STEP_FILE="FLOW_STEP_FILE",m.SAMPLE_DATA="SAMPLE_DATA",m.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",m.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",m.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",m.PROJECT_RELEASE="PROJECT_RELEASE",m.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",m.PLATFORM_ASSET="PLATFORM_ASSET",m.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",m.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",m.KNOWLEDGE_BASE="KNOWLEDGE_BASE",m.FLOW_BUNDLE="FLOW_BUNDLE",m))(gi||{}),yi=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(yi||{}),hi=(r=>(r.S3="S3",r.DB="DB",r))(hi||{}),rT=p({...se,projectId:H(a()),platformId:H(a()),type:C(gi),compression:C(yi),data:h(O()),location:C(hi),size:H(Q()),fileName:H(a()),s3Key:H(a()),metadata:H(w(a(),a()))}),vi=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(vi||{}),xi=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(xi||{}),nT=p({id:a(),email:a(),firstName:a(),status:C(xi),externalId:H(a()),platformId:H(a()),platformRole:C(vi),lastName:a(),created:Oe,updated:Oe,lastActiveDate:H(Oe),imageUrl:H(a())});var Ur=p({...F.shape,...D(w(a(),O()),"OBJECT").shape});var Ii=p({...F.shape,...D(a(),"COLOR").shape});var Mr=N([ne,he,Zt,xe,oe,ve,Er,at,Sr,_e,ct,Ur,lt,ut,st,Ii]),U={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 fe=p({displayName:a(),description:h(a())});var Ti=p({username:a(),password:a()}),Lr=p({...fe.shape,username:p({displayName:a(),description:h(a())}),password:p({displayName:a(),description:h(a())}),...D(Ti,"BASIC_AUTH").shape});var El=w(a(),N([ne,he,_e,xe,oe])),jr=p({...fe.shape,props:El,...D(O(),"CUSTOM_AUTH").shape});var Ne=p({...fe.shape,...D(p({auth:a()}),"SECRET_TEXT").shape});var Sl=w(a(),N([ne,he,Ne,_e,xe,oe,ve,Zt])),Ei=p({...fe.shape,props:Sl,...D(O(),"OIDC").shape});var Fr=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Fr||{}),Si=N([ne,Ne,oe]),$i=w(a(),Si),$l=p({props:h(w(a(),Si)),authUrl:a(),tokenUrl:a(),scope:R(a()),prompt:h(N([S("none"),S("consent"),S("login"),S("omit")])),pkce:h(B()),pkceMethod:h(N([S("plain"),S("S256")])),authorizationMethod:h(C(Fr)),grantType:h(N([C(mt),S($r)])),extra:h(w(a(),a()))}),Ai=p({access_token:a(),props:h($i),data:w(a(),nt())}),Br=p({...fe.shape,...$l.shape,...D(Ai,"OAUTH2").shape});var Be=N([Lr,jr,Ei,Br,Ne]),vt="Connection",xt={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||vt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||vt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||vt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||vt}},None(){}};var DE={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var Al=p({...F.shape,...D(O(),"CUSTOM").shape,code:a()});var zl=N([Mr,Be]),Zr=w(a(),zl),tS=w(a(),Mr);var zi=N([p({strategy:S("CRON"),cronExpression:a()}),p({strategy:S("NONE")})]),Ze=class{constructor(t,r,n,o,s,c,l,f,g,x,T,_,u,d,y,m,v,P,L){this.name=t;this.displayName=r;this.description=n;this.requireAuth=o;this.props=s;this.type=c;this.handshakeConfiguration=l;this.onHandshake=f;this.renewConfiguration=g;this.onRenew=x;this.onEnable=T;this.onDisable=_;this.onStart=u;this.run=d;this.test=y;this.sampleData=m;this.testStrategy=v;this.outputSchema=P;this.aiMetadata=L}static{i(this,"ITrigger")}},Ve=i(e=>{switch(e.type){case"WEBHOOK":return new Ze(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 Ze(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 Ze(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 Ze(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,ie(e.sampleData)&&ie(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Oi="2",qt="0.82.0";var Vr=class{constructor(t,r,n,o,s,c,l,f,g=qt,x,T="",_){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=o;this.categories=l;this.auth=f;this.minimumSupportedRelease=g;this.maximumSupportedRelease=x;this.description=T;this.deprecated=_;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:Oi}),"getContextInfo");(!Ol(g)||wl(g,qt))&&(this.minimumSupportedRelease=qt),s.forEach(u=>this._actions[u.name]=u),c.forEach(u=>this._triggers[u.name]=u)}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: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}},wi=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,o)=>n===o.findIndex(s=>s.type===r.type)))throw new Error("Auth properties must be unique by type");return new Vr(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 Ol(e){return/^\d+\.\d+\.\d+$/.test(e)}i(Ol,"isValidSimpleSemver");function wl(e,t){let[r,n,o]=e.split(".").map(Number),[s,c,l]=t.split(".").map(Number);return r!==s?r<s:n!==c?n<c:o<l}i(wl,"isSemverLessThan");var kl=h(w(a(),w(a(),a()))),ki=p({id:h(a()),name:a(),displayName:a(),logoUrl:a(),description:a(),authors:R(a()),platformId:h(a()),directoryPath:h(a()),auth:h(N([Be,R(Be)])),version:a(),categories:h(R(C(dt))),minimumSupportedRelease:h(a()),maximumSupportedRelease:h(a()),deprecated:h(B()),i18n:kl}),Rl=C(["human","ai","both"]),Ri=p({description:h(a()),idempotent:h(B())}),Ni=p({name:a(),displayName:a(),description:a(),props:Zr,requireAuth:B(),errorHandlingOptions:h(Tr),outputSchema:h(Ft()),audience:h(Rl),aiMetadata:h(Ri)}),Di=p({name:a(),displayName:a(),description:a(),props:Zr,errorHandlingOptions:h(Tr),type:C(de),sampleData:O(),handshakeConfiguration:h(Ft()),renewConfiguration:h(zi),testStrategy:C(gt),outputSchema:h(Ft()),aiMetadata:h(Ri)}),Nl=p({...ki.shape,actions:w(a(),Ni),triggers:w(a(),Di)}),Dl=p({...ki.shape,actions:Q(),triggers:Q(),suggestedActions:h(R(Ni)),suggestedTriggers:h(R(Di))}),Ci=p({projectUsage:Q(),pieceType:C(Le),packageType:C(pt),platformId:h(a()),archiveId:h(a())}),t$=p({...Nl.shape,...Ci.shape}),r$=p({...Dl.shape,...Ci.shape}),n$=p({name:a(),version:a()});var Cl=Ce(require("path")),Ul=Ce(require("fs/promises"));var ji=require("node:stream");var Kt=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((s,c)=>{o.append(c,s)}),{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 Jt=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new Hr,r=new Gr){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Hr=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Gr=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 _t=class extends Error{constructor(r,n){let o=n.status||500,s=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:o,body:s},request:{body:r}}));this.requestBody=r;this.status=o,this.responseBody=s}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 Ui({error:e,requestBody:t}){return e instanceof _t?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}i(Ui,"toFailsafeOutput");var Pt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(Pt||{});var Xt=class extends Kt{static{i(this,"FetchHttpClient")}constructor(t="",r=new Jt){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:o}=this.getUrl(t),s=this.getHeaders(t),c=t.queryParams??{};for(let[L,re]of Object.entries(c))o.append(L,re);let l=o.toString(),f=l?`${n}?${l}`:n,g=t.responseType??"json",x=t.followRedirects??!0,T=t.retries??0,{body:_,extraHeaders:u,isStream:d}=Ml(t.method)?Ll(t.body,s):{body:void 0,extraHeaders:{},isStream:!1},y=Fl({...s,...u}),m=await jl(async()=>{let L=new AbortController,re=t.timeout&&t.timeout>0?setTimeout(()=>L.abort(),t.timeout):void 0;try{let ue={method:t.method.toString(),headers:y,body:_,redirect:x?"follow":"manual",signal:L.signal};return d&&(ue.duplex="half"),r?.dispatcher!==void 0&&(ue.dispatcher=r.dispatcher),await fetch(f,ue)}finally{re!==void 0&&clearTimeout(re)}},T),v=x?300:400;if(m.status<200||m.status>=v){let L=await Mi(m,g),re=new _t(t.body,{status:m.status,responseBody:L});throw console.error("[HttpClient#(sanitized error message)] Request failed:",re),re}let P=await Mi(m,g);return{status:m.status,headers:Bl(m.headers),body:P}}};function Ml(e){return e!=="GET"&&e!=="HEAD"}i(Ml,"acceptsRequestBody");function Ll(e,t){if(Vl(e))return{body:void 0,extraHeaders:{},isStream:!1};if(Zl(e)){let n=new ji.PassThrough;return e.on("error",o=>n.destroy(o)),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}}i(Ll,"serializeBody");async function Mi(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}}}}i(Mi,"parseResponseBody");async function jl(e,t){let r;for(let n=0;n<=t;n++)try{let o=await e();if(o.status>=500&&n<t){await Li(n);continue}return o}catch(o){if(r=o,n<t){await Li(n);continue}throw o}throw r}i(jl,"sendWithRetries");function Li(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(Li,"backoff");function Fl(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(Fl,"normalizeHeaders");function Bl(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}i(Bl,"toHttpHeaders");function Zl(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}i(Zl,"isNodeFormData");function Vl(e){return e==null}i(Vl,"isNil");var bt=new Xt;var wd=Ce(require("fs")),Gs=Ce(Hs());var kd={"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 Rd(e){let t=e.split(";")[0].trim().toLowerCase();return kd[t]??""}i(Rd,"contentTypeToExtension");var Nd=i(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Dd=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 Ws({auth:e,baseUrl:t,authMapping:r,description:n,displayName:o,name:s,props:c,extraProps:l,authLocation:f="headers"}){return ae({audience:"human",name:s||"custom_api_call",displayName:o||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:U.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:i(async({auth:g})=>({url:U.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
+
i.e ${Dd(t,g)}/resource or /resource`,required:!0,defaultValue:g?t(g):"",...c?.url??{}})}),"props")}),method:U.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Pt).map(g=>({label:g,value:g}))},...c?.method??{}}),headers:U.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:U.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:U.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:U.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:i(async({body_type:g})=>{if(!g)return{};let x=g,T={};switch(x){case"none":break;case"json":T.data=U.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":T.data=U.LongText({displayName:"Raw Body",required:!0});break;case"form_data":T.data=U.Array({displayName:"Form Data",required:!0,properties:{fieldName:U.ShortText({displayName:"Field Name",required:!0}),fieldType:U.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:U.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:U.File({displayName:"File Field Value",required:!1})}});break}return T},"props")}),response_is_binary:U.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:U.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:U.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:U.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...l},run:i(async g=>{let{method:x,url:T,headers:_,queryParams:u,body:d,body_type:y,failsafe:m,timeout:v,response_is_binary:P,followRedirects:L}=g.propsValue;Ht(x,"Method"),Ht(T,"URL");let re=ie(r)?{}:await r(g.auth,g.propsValue),ue=T.url,Je=ue.startsWith("http://")||ue.startsWith("https://")?ue:Nd({baseUrl:t(g.auth),relativePath:ue}),be={method:x,url:Je,headers:{..._??{},...f==="headers"||!ie(f)?re:{}},queryParams:{...f==="queryParams"?re:{},...u??{}},timeout:v?v*1e3:0,followRedirects:L};if(P&&(be.responseType="arraybuffer"),d)if(y&&y!=="none"){let ge=d.data;if(y==="form_data"){let nu=ge,St=new Gs.default;for(let{fieldName:fn,fieldType:gn,textFieldValue:yn,fileFieldValue:ur}of nu)gn==="text"&&!yt(yn)?St.append(fn,yn):gn==="file"&&!yt(ur)&&St.append(fn,ur.data,{filename:ur?.filename});be.body=St,be.headers={...be.headers,...St.getHeaders()}}else be.body=ge}else y||(be.body=d);try{let ge=await bt.sendRequest(be);return await Cd(g.files,ge.body,ge.status,ge.headers,P)}catch(ge){if(m)return Ui({error:ge,requestBody:be.body});throw ge}},"run")})}i(Ws,"createCustomApiCallAction");var Cd=i(async(e,t,r,n,o)=>{let s;if(o&&Ud(t)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],l=Rd(c??"")||"txt",f;t instanceof ArrayBuffer?f=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?f=t:f=Buffer.from(t),s=await e.write({fileName:`output.${l}`,data:f})}else s=t;return{status:r,headers:n,body:s}},"handleBinaryResponse"),Ud=i(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var sr=null,qs=0;async function Md(e){if(sr&&Date.now()<qs)return sr;let t=await bt.sendRequest({method:"POST",url:"https://api.sendpulse.com/oauth/access_token",headers:{"Content-Type":"application/json"},body:{grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret}});return sr=t.body.access_token,qs=Date.now()+t.body.expires_in*1e3-30*1e3,sr}i(Md,"getAccessToken");async function Z({method:e,resourceUri:t,query:r,body:n,auth:o}){let s=await Md(o),c={};if(r)for(let[f,g]of Object.entries(r))g!=null&&(c[f]=String(g));let l={method:e,url:`https://api.sendpulse.com${t}`,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},queryParams:c,body:n};try{return(await bt.sendRequest(l)).body}catch(f){let g=f.response?.status,x=f.response?.data?.message||f.message||"Unknown error";throw new Error(`SendPulse API Error (${g||"Unknown"}): ${x}`)}}i(Z,"sendpulseApiCall");var K=xt.CustomAuth({description:"Enter your SendPulse client credentials",props:{clientId:xt.SecretText({displayName:"Client ID",required:!0}),clientSecret:xt.SecretText({displayName:"Client Secret",required:!0})},validate:i(async({auth:e})=>{try{return await Z({method:"GET",resourceUri:"/addressbooks",auth:e}),{valid:!0}}catch{return{valid:!1,error:"Invalid Client ID or Client Secret"}}},"validate"),required:!0});var te=U.Dropdown({auth:K,displayName:"Mailing List",description:"Select one of your SendPulse mailing lists",required:!0,refreshers:[],options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your SendPulse account."};let t=e.props;try{let r=await Z({auth:e.props,method:"GET",resourceUri:"/addressbooks?limit=100&offset=0"});return r.length?{disabled:!1,options:r.map(n=>({label:`${n.name} (${n.status_explain})`,value:n.id}))}:{disabled:!0,options:[],placeholder:"No mailing lists found in your account."}}catch(r){return{disabled:!0,options:[],placeholder:`Failed to load mailing lists: ${r.message}`}}},"options")});var Ks=Ve({auth:K,name:"new_subscriber",displayName:"New Subscriber",description:"Fires when new subscriber is added",aiMetadata:{description:"Fires when a new email contact is added to the selected SendPulse mailing list (address book), via any source such as a subscription form or import. Each event represents one newly added subscriber and includes their email, source, and variables."},type:"WEBHOOK",props:{mailingListId:te},async onEnable(e){let{mailingListId:t}=e.propsValue;try{let r=await Z({method:"POST",auth:e.auth.props,resourceUri:"/v2/email-service/webhook",body:{url:e.webhookUrl,actions:["new_emails"]}});if(r.success&&r.data?.length>0){let n=r.data.find(o=>o.action==="new_emails");n&&(await e.store.put("webhook_id",n.id),await e.store.put("mailing_list_id",t))}else throw new Error("Failed to create webhook")}catch(r){throw new Error(`Failed to enable new subscriber trigger: ${r.message}`)}},async onDisable(e){try{let t=await e.store.get("webhook_id");t&&(await Z({method:"DELETE",auth:e.auth.props,resourceUri:`/v2/email-service/webhook/${t}`}),await e.store.delete("webhook_id"),await e.store.delete("mailing_list_id"))}catch(t){console.warn("Failed to delete webhook during disable:",t)}},async run(e){let t=await e.store.get("mailing_list_id"),r=e.payload.body,n=Array.isArray(r)?r:[r],o=[];for(let s of n)s.event==="new_emails"&&s.book_id===t&&o.push({id:`${s.email}_${s.timestamp}`,email:s.email,mailingListId:s.book_id,source:s.source,variables:s.variables||{},addedAt:new Date(parseInt(s.timestamp)*1e3).toISOString(),timestamp:s.timestamp});return o},async test(){return[{id:"demo@example.com_1496827625",email:"demo@example.com",mailingListId:"123456",source:"address book",variables:{},addedAt:new Date().toISOString(),timestamp:"1496827625"}]},sampleData:{id:"subscriber@example.com_1496827625",email:"subscriber@example.com",mailingListId:"123456",source:"subscription form",variables:{name:"John Doe"},addedAt:"2023-06-01T12:00:00.000Z",timestamp:"1496827625"}});var Js=Ve({auth:K,name:"new_unsubscriber",displayName:"New Unsubscriber",description:"Fires when subscriber unsubscribes",aiMetadata:{description:"Fires when a contact unsubscribes from the selected SendPulse mailing list (address book). Each event represents one unsubscribe and includes the email, the reason if provided, and whether they opted out of all lists."},type:"WEBHOOK",props:{mailingListId:te},async onEnable(e){let{mailingListId:t}=e.propsValue;try{let r=await Z({method:"POST",auth:e.auth.props,resourceUri:"/v2/email-service/webhook",body:{url:e.webhookUrl,actions:["unsubscribe"]}});if(r.success&&r.data?.length>0){let n=r.data.find(o=>o.action==="unsubscribe");n&&(await e.store.put("webhook_id",n.id),await e.store.put("mailing_list_id",t))}else throw new Error("Failed to create webhook")}catch(r){throw new Error(`Failed to enable unsubscriber trigger: ${r.message}`)}},async onDisable(e){try{let t=await e.store.get("webhook_id");t&&(await Z({method:"DELETE",auth:e.auth.props,resourceUri:`/v2/email-service/webhook/${t}`}),await e.store.delete("webhook_id"),await e.store.delete("mailing_list_id"))}catch(t){console.warn("Failed to delete webhook during disable:",t)}},async run(e){let t=await e.store.get("mailing_list_id"),r=e.payload.body,n=Array.isArray(r)?r:[r],o=[];for(let s of n)s.event==="unsubscribe"&&s.book_id===t&&o.push({id:`${s.email}_${s.timestamp}`,email:s.email,mailingListId:s.book_id,taskId:s.task_id,fromAll:s.from_all==="1",reason:s.reason||"No reason provided",categories:s.categories||"",unsubscribedAt:new Date(parseInt(s.timestamp)*1e3).toISOString(),timestamp:s.timestamp});return o},async test(){return[{id:"test-unsubscribe@example.com_1496827872",email:"test-unsubscribe@example.com",mailingListId:"123456",taskId:"3668141",fromAll:!0,reason:"User clicked unsubscribe link",categories:"",unsubscribedAt:new Date().toISOString(),timestamp:"1496827872"}]},sampleData:{id:"unsub@example.com_1496827872",email:"unsub@example.com",mailingListId:"123456",taskId:"3668141",fromAll:!1,reason:"Manual unsubscribe",categories:"newsletter",unsubscribedAt:"2023-06-01T12:30:00.000Z",timestamp:"1496827872"}});function Ld(e,t){let r={},n=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of n)JSON.stringify(e[o])!==JSON.stringify(t[o])&&(r[o]={from:e[o],to:t[o]});return r}i(Ld,"detectChanges");var Xs=Ve({auth:K,name:"updated_subscriber",displayName:"Updated Subscriber",description:"Fires when subscriber details change (polling)",aiMetadata:{description:"Polls the selected SendPulse mailing list (address book) and fires when an existing subscriber's details or variables change between checks. Each event represents one changed contact and includes the previous data, current data, and a diff of the changed fields."},type:"POLLING",props:{mailingListId:te},async onEnable(e){await e.store.put("mailing_list_id",String(e.propsValue.mailingListId)),await e.store.put("last_check",Date.now().toString())},async onDisable(e){await e.store.delete("mailing_list_id"),await e.store.delete("last_check"),await e.store.delete("subscribers_cache")},async run(e){let t=await e.store.get("mailing_list_id");if(!t)return[];try{let r=await Z({method:"GET",auth:e.auth.props,resourceUri:`/addressbooks/${t}/emails`}),n=await e.store.get("subscribers_cache");if(!n)return await e.store.put("subscribers_cache",JSON.stringify(r)),[];let o=JSON.parse(n),s=[];for(let c of r){let l=o.find(f=>f.email===c.email);l&&JSON.stringify(c)!==JSON.stringify(l)&&s.push({id:`${c.email}_${Date.now()}`,email:c.email,mailingListId:t,previousData:l,currentData:c,updatedAt:new Date().toISOString(),changes:Ld(l,c)})}return await e.store.put("subscribers_cache",JSON.stringify(r)),await e.store.put("last_check",Date.now().toString()),s}catch(r){return console.error("Error checking for subscriber updates:",r),[]}},async test(){return[{id:"test-updated@example.com_1234567890",email:"test-updated@example.com",mailingListId:"123456",previousData:{email:"test-updated@example.com",variables:{name:"Old Name"}},currentData:{email:"test-updated@example.com",variables:{name:"New Name"}},updatedAt:new Date().toISOString(),changes:{"variables.name":{from:"Old Name",to:"New Name"}}}]},sampleData:{id:"updated-user@example.com_1234567890",email:"updated-user@example.com",mailingListId:"123456",previousData:{email:"updated-user@example.com",variables:{phone:"+1234567890",name:"John"}},currentData:{email:"updated-user@example.com",variables:{phone:"+0987654321",name:"John Updated"}},updatedAt:"2023-06-01T12:30:00.000Z",changes:{"variables.phone":{from:"+1234567890",to:"+0987654321"},"variables.name":{from:"John",to:"John Updated"}}}});var Ys=ae({auth:K,name:"add-subscriber",displayName:"Add Subscriber",description:"Add subscriber to mailing list",audience:"both",aiMetadata:{description:"Adds an email contact to a specific SendPulse mailing list (address book), optionally attaching subscriber variables (e.g. name, phone) and numeric tag IDs. Use to enroll a new contact into a list; requires the target mailing list ID and a valid email. Not idempotent \u2014 each call re-submits the contact to the list.",idempotent:!1},props:{mailingListId:te,email:U.ShortText({displayName:"Email Address",description:"Subscriber email address",required:!0}),variables:U.Object({displayName:"Variables",description:"Optional subscriber variables (e.g., name, phone)",required:!1}),tags:U.Array({displayName:"Tag IDs",description:"Optional tag IDs to assign",required:!1})},async run(e){let{mailingListId:t,email:r,variables:n,tags:o}=e.propsValue;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))throw new Error(`Invalid email format: ${r}`);let c={email:r};n&&Object.keys(n).length>0&&(c.variables=n);let l={emails:[c]};if(o&&o.length>0){let f=o.map(g=>{let x=Number(g);if(isNaN(x))throw new Error(`Invalid tag ID: ${g}. Tag IDs must be numbers.`);return x});l.tags=f}try{if((await Z({method:"POST",auth:e.auth.props,resourceUri:`/addressbooks/${t}/emails`,body:l})).result===!0)return{success:!0,message:"Subscriber added successfully",email:r,variables:n||{},mailingListId:t,tags:l.tags||[]};throw new Error("SendPulse API returned failure")}catch(f){throw new Error(`Failed to add subscriber: ${f.message||"Unknown error"}`)}}});var jd=U.Dropdown({auth:K,displayName:"Variable Name",description:"Select variable to update",required:!0,refreshers:["mailingListId"],options:i(async({auth:e,mailingListId:t})=>{if(!e||!t)return{disabled:!0,options:[],placeholder:"Please select a mailing list first"};try{let r=await Z({auth:e,method:"GET",resourceUri:`/addressbooks/${t}/variables`});return r.length?{disabled:!1,options:r.filter(n=>n.name!=="email").map(n=>({label:`${n.name} (${n.type})`,value:n.name}))}:{disabled:!0,options:[],placeholder:"No variables found in this mailing list"}}catch(r){return{disabled:!0,options:[],placeholder:`Failed to load variables: ${r.message}`}}},"options")}),Qs=ae({auth:K,name:"change-variable-for-subscriber",displayName:"Change Variable for Subscriber",description:"Update subscriber variable",audience:"both",aiMetadata:{description:"Sets a single named variable (custom field) to a given value for one subscriber, identified by email, within a specific SendPulse mailing list. Use to overwrite a single field value; the variable must already exist on the list and its type (number/date) is validated against the value. Idempotent \u2014 repeating with the same value leaves the field unchanged.",idempotent:!0},props:{mailingListId:te,email:U.ShortText({displayName:"Email Address",description:"Subscriber email address",required:!0}),variableName:jd,variableValue:U.ShortText({displayName:"Variable Value",description:"New value for the variable",required:!0})},async run(e){let{mailingListId:t,email:r,variableName:n,variableValue:o}=e.propsValue;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))throw new Error(`Invalid email format: ${r}`);let c=null;try{let g=(await Z({auth:e.auth.props,method:"GET",resourceUri:`/addressbooks/${t}/variables`})).find(x=>x.name===n);g&&(c=g.type)}catch{}if(c){if(c==="number"&&isNaN(Number(o)))throw new Error(`Variable "${n}" expects a number, but got: ${o}`);if(c==="date"&&!/^\d{4}-\d{2}-\d{2}$/.test(o)&&!Date.parse(o))throw new Error(`Variable "${n}" expects a date format (YYYY-MM-DD), but got: ${o}`)}let l={email:r,variables:[{name:n,value:o}]};try{if((await Z({method:"POST",auth:e.auth.props,resourceUri:`/addressbooks/${t}/emails/variable`,body:l})).result)return{success:!0,message:`Variable "${n}" updated for ${r}`,email:r,variableName:n,variableValue:o,variableType:c};throw new Error("SendPulse API returned failure")}catch(f){throw new Error(`Failed to update variable: ${f.message||"Unknown error"}`)}}});var eu=ae({auth:K,name:"delete-contact",displayName:"Delete Contact",description:"Permanently delete contact from all mailing lists",audience:"both",aiMetadata:{description:"Permanently removes a contact, identified by email, from every SendPulse mailing list (address book) in the account at once. Use to fully purge a contact rather than unsubscribe from a single list. Destructive but idempotent \u2014 once deleted, repeating the call leaves the contact absent.",idempotent:!0},props:{email:U.ShortText({displayName:"Email Address",description:"Email address to delete from all mailing lists",required:!0})},async run(e){let{email:t}=e.propsValue;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))throw new Error(`Invalid email format: ${t}`);try{if((await Z({method:"DELETE",auth:e.auth.props,resourceUri:`/emails/${encodeURIComponent(t)}`})).result)return{success:!0,message:`Contact ${t} deleted from all mailing lists`,email:t};throw new Error("SendPulse API returned failure")}catch(n){throw new Error(`Failed to delete contact: ${n.message||"Unknown error"}`)}}});var tu=ae({auth:K,name:"unsubscribe-user",displayName:"Unsubscribe User",description:"Remove subscribers from mailing list",audience:"both",aiMetadata:{description:"Unsubscribes one or more email addresses (up to 100 per call) from a single specified SendPulse mailing list, leaving them in other lists. Use to opt contacts out of one list rather than purge them account-wide. Idempotent \u2014 repeating leaves the same contacts unsubscribed from that list.",idempotent:!0},props:{mailingListId:te,emails:U.Array({displayName:"Email Addresses",description:"Email addresses to unsubscribe (max 100)",required:!0})},async run(e){let{mailingListId:t,emails:r}=e.propsValue;if(r.length===0)throw new Error("At least one email address is required");if(r.length>100)throw new Error("Maximum 100 email addresses allowed per request");let n=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,o=r.filter(c=>!n.test(c));if(o.length>0)throw new Error(`Invalid email format(s): ${o.join(", ")}`);let s={emails:r};try{if((await Z({method:"DELETE",auth:e.auth.props,resourceUri:`/addressbooks/${t}/emails`,body:s})).result)return{success:!0,message:`${r.length} subscriber(s) unsubscribed successfully`,unsubscribed:r,mailingListId:t,count:r.length};throw new Error("Unsubscription failed - API returned failure")}catch(c){throw new Error(`Failed to unsubscribe users: ${c.message||"Unknown error"}`)}}});var ru=ae({auth:K,name:"update-subscriber",displayName:"Update Subscriber",description:"Update subscriber details and variables",audience:"both",aiMetadata:{description:"Updates an existing subscriber, identified by email, within a specific SendPulse mailing list by setting their phone number and/or one or more variables (custom fields) to new values. Use to overwrite a contact's details; at least one of phone or variables must be supplied. Idempotent \u2014 repeating with the same values leaves the contact unchanged.",idempotent:!0},props:{mailingListId:te,email:U.ShortText({displayName:"Email Address",description:"Email address of the subscriber to update",required:!0}),phone:U.ShortText({displayName:"Phone Number",description:"New phone number (optional)",required:!1}),variables:U.Object({displayName:"Variables",description:"Subscriber variables to update (e.g., name, custom fields)",required:!1})},async run(e){let{mailingListId:t,email:r,phone:n,variables:o}=e.propsValue,s=[],c=!1;if(n)try{(await Z({method:"PUT",auth:e.auth.props,resourceUri:`/addressbooks/${t}/phone`,body:{email:r,phone:n}})).result?(s.push({type:"phone",success:!0,value:n}),c=!0):s.push({type:"phone",success:!1,error:"API returned failure"})}catch(g){s.push({type:"phone",success:!1,error:g.message})}if(o&&Object.keys(o).length>0){let g=Object.entries(o).map(([x,T])=>({name:x,value:String(T)}));try{(await Z({method:"POST",auth:e.auth.props,resourceUri:`/addressbooks/${t}/emails/variable`,body:{email:r,variables:g}})).result?(s.push({type:"variables",success:!0,count:g.length}),c=!0):s.push({type:"variables",success:!1,error:"API returned failure"})}catch(x){s.push({type:"variables",success:!1,error:x.message})}}if(!c&&!n&&(!o||Object.keys(o).length===0))throw new Error("No updates provided. Please specify phone number or variables to update.");let l=s.filter(g=>g.success),f=s.filter(g=>!g.success);if(l.length===0)throw new Error(`All updates failed: ${f.map(g=>g.error).join(", ")}`);return{success:!0,message:`Subscriber ${r} updated successfully`,email:r,updates:s,hasFailures:f.length>0}}});var Fd=wi({displayName:"SendPulse",auth:K,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/sendpulse.png",authors:["aryel780","onyedikachi-david"],actions:[Ys,Qs,eu,tu,ru,Ws({auth:K,baseUrl:i(()=>"https://api.sendpulse.com","baseUrl"),authMapping:i(async e=>{let t=e.props;return{Authorization:`Bearer ${(await Z({method:"POST",auth:t,resourceUri:"/oauth/access_token",body:{grant_type:"client_credentials",client_id:t.clientId,client_secret:t.clientSecret}})).access_token}`}},"authMapping")})],triggers:[Ks,Js,Xs]});0&&(module.exports={sendpulse});
|
|
4
|
+
/*! Bundled license information:
|
|
5
|
+
|
|
6
|
+
mime-types/index.js:
|
|
7
|
+
(*!
|
|
8
|
+
* mime-types
|
|
9
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
10
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
11
|
+
* MIT Licensed
|
|
12
|
+
*)
|
|
13
|
+
*/
|
package/src/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const sendpulse: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>>;
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,SAAS;;;GAuCpB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAGqC;AACrC,qEAA6D;AAC7D,4CAAkD;AAClD,gDAAuD;AACvD,kEAAqE;AACrE,sEAAyE;AACzE,0EAA6E;AAC7E,iEAAmE;AACnE,iGAAiG;AACjG,iEAAmE;AACnE,qEAAuE;AACvE,uEAAyE;AAE5D,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,OAAO,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC;IAC1C,OAAO,EAAE;QACP,oCAAmB;QACnB,kEAAiC;QACjC,oCAAmB;QACnB,wCAAqB;QACrB,0CAAsB;QACtB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,oBAAa;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B;YAC1C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC7B,MAAM,KAAK,GAAG,MAAM,IAAA,yBAAgB,EAA2B;oBAC7D,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qBAAqB;oBAClC,IAAI,EAAE;wBACJ,UAAU,EAAE,oBAAoB;wBAChC,SAAS,EAAE,SAAS,CAAC,QAAQ;wBAC7B,aAAa,EAAE,SAAS,CAAC,YAAY;qBACtC;iBACF,CAAC,CAAC;gBAEH,OAAO;oBACL,aAAa,EAAE,UAAU,KAAK,CAAC,YAAY,EAAE;iBAC9C,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE;QACR,qCAAoB;QACpB,yCAAsB;QACtB,6CAAwB;KACzB;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const addSubscriberAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
mailingListId: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>>;
|
|
9
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
variables: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
11
|
-
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=add-subscriber.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-subscriber.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-subscriber.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB;;;;;;;;;;;EA8E9B,CAAC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addSubscriberAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.addSubscriberAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.sendpulseAuth,
|
|
12
|
-
name: 'add-subscriber',
|
|
13
|
-
displayName: 'Add Subscriber',
|
|
14
|
-
description: 'Add subscriber to mailing list',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Adds an email contact to a specific SendPulse mailing list (address book), optionally attaching subscriber variables (e.g. name, phone) and numeric tag IDs. Use to enroll a new contact into a list; requires the target mailing list ID and a valid email. Not idempotent — each call re-submits the contact to the list.', idempotent: false },
|
|
17
|
-
props: {
|
|
18
|
-
mailingListId: props_1.mailingListDropdown,
|
|
19
|
-
email: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Email Address',
|
|
21
|
-
description: 'Subscriber email address',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
variables: pieces_framework_1.Property.Object({
|
|
25
|
-
displayName: 'Variables',
|
|
26
|
-
description: 'Optional subscriber variables (e.g., name, phone)',
|
|
27
|
-
required: false,
|
|
28
|
-
}),
|
|
29
|
-
tags: pieces_framework_1.Property.Array({
|
|
30
|
-
displayName: 'Tag IDs',
|
|
31
|
-
description: 'Optional tag IDs to assign',
|
|
32
|
-
required: false,
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
run(context) {
|
|
36
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const { mailingListId, email, variables, tags } = context.propsValue;
|
|
38
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
39
|
-
if (!emailRegex.test(email)) {
|
|
40
|
-
throw new Error(`Invalid email format: ${email}`);
|
|
41
|
-
}
|
|
42
|
-
const emailObject = { email };
|
|
43
|
-
if (variables && Object.keys(variables).length > 0) {
|
|
44
|
-
emailObject.variables = variables;
|
|
45
|
-
}
|
|
46
|
-
const requestBody = {
|
|
47
|
-
emails: [emailObject],
|
|
48
|
-
};
|
|
49
|
-
if (tags && tags.length > 0) {
|
|
50
|
-
const tagNumbers = tags.map((tag) => {
|
|
51
|
-
const num = Number(tag);
|
|
52
|
-
if (isNaN(num)) {
|
|
53
|
-
throw new Error(`Invalid tag ID: ${tag}. Tag IDs must be numbers.`);
|
|
54
|
-
}
|
|
55
|
-
return num;
|
|
56
|
-
});
|
|
57
|
-
requestBody.tags = tagNumbers;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const result = yield (0, client_1.sendpulseApiCall)({
|
|
61
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
62
|
-
auth: context.auth.props,
|
|
63
|
-
resourceUri: `/addressbooks/${mailingListId}/emails`,
|
|
64
|
-
body: requestBody,
|
|
65
|
-
});
|
|
66
|
-
if (result.result === true) {
|
|
67
|
-
return {
|
|
68
|
-
success: true,
|
|
69
|
-
message: 'Subscriber added successfully',
|
|
70
|
-
email,
|
|
71
|
-
variables: variables || {},
|
|
72
|
-
mailingListId,
|
|
73
|
-
tags: requestBody.tags || [],
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
throw new Error('SendPulse API returned failure');
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
throw new Error(`Failed to add subscriber: ${error.message || 'Unknown error'}`);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=add-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-subscriber.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-subscriber.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,6CAAoD;AACpD,yCAA+C;AAC/C,2CAAsD;AAEzC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gCAAgC;IAC7C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6TAA6T,EAAE,UAAU,EAAE,KAAK,EAAE;IAC7W,KAAK,EAAE;QACL,aAAa,EAAE,2BAAmB;QAClC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErE,MAAM,UAAU,GAAG,4BAA4B,CAAC;YAChD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC;YACpD,CAAC;YAED,MAAM,WAAW,GAAQ,EAAE,KAAK,EAAE,CAAC;YACnC,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnD,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC;YACpC,CAAC;YAED,MAAM,WAAW,GAAQ;gBACvB,MAAM,EAAE,CAAC,WAAW,CAAC;aACtB,CAAC;YAEF,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBAClC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;oBACxB,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,4BAA4B,CAAC,CAAC;oBACtE,CAAC;oBACD,OAAO,GAAG,CAAC;gBACb,CAAC,CAAC,CAAC;gBACH,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC;YAChC,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAgB,EAAsB;oBACzD,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;oBACxB,WAAW,EAAE,iBAAiB,aAAa,SAAS;oBACpD,IAAI,EAAE,WAAW;iBAClB,CAAC,CAAC;gBAEH,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBAC3B,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,+BAA+B;wBACxC,KAAK;wBACL,SAAS,EAAE,SAAS,IAAI,EAAE;wBAC1B,aAAa;wBACb,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,EAAE;qBAC7B,CAAC;gBACJ,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACnF,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const changeVariableForSubscriberAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
mailingListId: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>>;
|
|
9
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
variableName: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>>;
|
|
14
|
-
variableValue: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
}>;
|
|
16
|
-
//# sourceMappingURL=change-variable-for-subscriber.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"change-variable-for-subscriber.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/change-variable-for-subscriber.ts"],"names":[],"mappings":"AA4DA,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;EA6F5C,CAAC"}
|