@activepieces/piece-chatling 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 CHANGED
@@ -1,18 +1,12 @@
1
1
  {
2
2
  "name": "@activepieces/piece-chatling",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
7
- "dependencies": {
8
- "@activepieces/pieces-common": "0.12.3",
9
- "@activepieces/pieces-framework": "0.30.0",
10
- "@activepieces/shared": "0.87.1",
11
- "dayjs": "1.11.9",
12
- "tslib": "2.3.0"
13
- },
14
- "scripts": {
15
- "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
16
- "lint": "eslint 'src/**/*.ts'"
17
- }
6
+ "dependencies": {},
7
+ "files": [
8
+ "src/index.js",
9
+ "package.json",
10
+ "src/i18n"
11
+ ]
18
12
  }
package/src/index.js CHANGED
@@ -1,16 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chatling = 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 shared_1 = require("@activepieces/shared");
8
- const send_message_1 = require("./lib/actions/send-message");
9
- const create_chatbot_1 = require("./lib/actions/create-chatbot");
10
- const new_conversation_1 = require("./lib/triggers/new-conversation");
11
- const new_contact_1 = require("./lib/triggers/new-contact");
12
- const auth_1 = require("./lib/auth");
13
- const markdownDescription = `
1
+ "use strict";var Su=Object.create;var xt=Object.defineProperty;var Au=Object.getOwnPropertyDescriptor;var zu=Object.getOwnPropertyNames;var Ou=Object.getPrototypeOf,wu=Object.prototype.hasOwnProperty;var o=(e,t)=>xt(e,"name",{value:t,configurable:!0});var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Fn=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},Bn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zu(t))!wu.call(e,i)&&i!==r&&xt(e,i,{get:()=>t[i],enumerable:!(n=Au(t,i))||n.enumerable});return e};var Ue=(e,t,r)=>(r=e!=null?Su(Ou(e)):{},Bn(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),ku=e=>Bn(xt({},"__esModule",{value:!0}),e);var di=z((pi,dr)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),u="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(u,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${u})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${u})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${u})?$`,"i")};function f(s,d){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let y=0,m=-1,x=(s.match(l.zoneIndex)||[])[0],P,j;for(x&&(x=x.substring(1),s=s.replace(/%.+$/,""));(m=s.indexOf(":",m+1))>=0;)y++;if(s.substr(0,2)==="::"&&y--,s.substr(-2,2)==="::"&&y--,y>d)return null;for(j=d-y,P=":";j--;)P+="0:";return s=s.replace("::",P),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),d=(function(){let oe=s.split(":"),fe=[];for(let Te=0;Te<oe.length;Te++)fe.push(parseInt(oe[Te],16));return fe})(),{parts:d,zoneId:x}}o(f,"expandIPv6");function g(s,d,y,m){if(s.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;m>0;){if(P=y-m,P<0&&(P=0),s[x]>>P!==d[x]>>P)return!1;m-=y,x+=1}return!0}o(g,"matchCIDR");function v(s){if(i.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(n.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}o(v,"parseIntAuto");function I(s,d){for(;s.length<d;)s=`0${s}`;return s}o(I,"padPart");let _={};_.IPv4=(function(){function s(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 o(s,"IPv4"),s.prototype.SpecialRanges={unspecified:[[new s([0,0,0,0]),8]],broadcast:[[new s([255,255,255,255]),32]],multicast:[[new s([224,0,0,0]),4]],linkLocal:[[new s([169,254,0,0]),16]],loopback:[[new s([127,0,0,0]),8]],carrierGradeNat:[[new s([100,64,0,0]),10]],private:[[new s([10,0,0,0]),8],[new s([172,16,0,0]),12],[new s([192,168,0,0]),16]],reserved:[[new s([192,0,0,0]),24],[new s([192,0,2,0]),24],[new s([192,88,99,0]),24],[new s([198,18,0,0]),15],[new s([198,51,100,0]),24],[new s([203,0,113,0]),24],[new s([240,0,0,0]),4]],as112:[[new s([192,175,48,0]),24],[new s([192,31,196,0]),24]],amt:[[new s([192,52,193,0]),24]]},s.prototype.kind=function(){return"ipv4"},s.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)},s.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},x,P,j;for(x=3;x>=0;x-=1)if(P=this.octets[x],P in m){if(j=m[P],y&&j!==0)return null;j!==8&&(y=!0),d+=j}else return null;return 32-d},s.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return _.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s})(),_.IPv4.broadcastAddressFromCIDR=function(s){try{let d=this.parseCIDR(s),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.isIPv4=function(s){return this.parser(s)!==null},_.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},_.IPv4.isValidCIDR=function(s){try{return this.parseCIDR(s),!0}catch{return!1}},_.IPv4.isValidFourPartDecimal=function(s){return!!(_.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},_.IPv4.isValidCIDRFourPartDecimal=function(s){let d=s.match(/^(.+)\/(\d+)$/);return!_.IPv4.isValidCIDR(s)||!d?!1:_.IPv4.isValidFourPartDecimal(d[1])},_.IPv4.networkAddressFromCIDR=function(s){let d,y,m,x,P;try{for(d=this.parseCIDR(s),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),x=[],y=0;y<4;)x.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.parse=function(s){let d=this.parser(s);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},_.IPv4.parseCIDR=function(s){let d;if(d=s.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:o(function(){return this.join("/")},"value")}),m}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},_.IPv4.parser=function(s){let d,y,m;if(d=s.match(r.fourOctet))return(function(){let x=d.slice(1,6),P=[];for(let j=0;j<x.length;j++)y=x[j],P.push(v(y));return P})();if(d=s.match(r.longValue)){if(m=v(d[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return(function(){let x=[],P;for(P=0;P<=24;P+=8)x.push(m>>P&255);return x})().reverse()}else return(d=s.match(r.twoOctet))?(function(){let x=d.slice(1,4),P=[];if(m=v(x[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return P.push(v(x[0])),P.push(m>>16&255),P.push(m>>8&255),P.push(m&255),P})():(d=s.match(r.threeOctet))?(function(){let x=d.slice(1,5),P=[];if(m=v(x[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return P.push(v(x[0])),P.push(v(x[1])),P.push(m>>8&255),P.push(m&255),P})():null},_.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let d=[0,0,0,0],y=0,m=Math.floor(s/8);for(;y<m;)d[y]=255,y++;return m<4&&(d[m]=Math.pow(2,s%8)-1<<8-s%8),new this(d)},_.IPv6=(function(){function s(d,y){let m,x;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(x=this.parts[m],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return o(s,"IPv6"),s.prototype.SpecialRanges={unspecified:[new s([0,0,0,0,0,0,0,0]),128],linkLocal:[new s([65152,0,0,0,0,0,0,0]),10],multicast:[new s([65280,0,0,0,0,0,0,0]),8],loopback:[new s([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new s([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new s([0,0,0,0,0,65535,0,0]),96],discard:[new s([256,0,0,0,0,0,0,0]),64],rfc6145:[new s([0,0,0,0,65535,0,0,0]),96],rfc6052:[new s([100,65435,0,0,0,0,0,0]),96],"6to4":[new s([8194,0,0,0,0,0,0,0]),16],teredo:[new s([8193,0,0,0,0,0,0,0]),32],benchmarking:[new s([8193,2,0,0,0,0,0,0]),48],amt:[new s([8193,3,0,0,0,0,0,0]),32],as112v6:[[new s([8193,4,274,0,0,0,0,0]),48],[new s([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new s([8193,16,0,0,0,0,0,0]),28],orchid2:[new s([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new s([8193,48,0,0,0,0,0,0]),28],reserved:[[new s([8193,0,0,0,0,0,0,0]),23],[new s([8193,3512,0,0,0,0,0,0]),32]]},s.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},s.prototype.kind=function(){return"ipv6"},s.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)},s.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},x,P;for(let j=7;j>=0;j-=1)if(x=this.parts[j],x in m){if(P=m[x],y&&P!==0)return null;P!==16&&(y=!0),d+=P}else return null;return 128-d},s.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let d,y=[],m=this.parts;for(let x=0;x<m.length;x++)d=m[x],y.push(d>>8),y.push(d&255);return y},s.prototype.toFixedLengthString=function(){let d=(function(){let m=[];for(let x=0;x<this.parts.length;x++)m.push(I(this.parts[x].toString(16),4));return m}).call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},s.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])},s.prototype.toNormalizedString=function(){let d=(function(){let m=[];for(let x=0;x<this.parts.length;x++)m.push(this.parts[x].toString(16));return m}).call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},s.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),m=0,x=-1,P;for(;P=d.exec(y);)P[0].length>x&&(m=P.index,x=P[0].length);return x<0?y:`${y.substring(0,m)}::${y.substring(m+x)}`},s.prototype.toString=function(){return this.toRFC5952String()},s})(),_.IPv6.broadcastAddressFromCIDR=function(s){try{let d=this.parseCIDR(s),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(x)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},_.IPv6.isIPv6=function(s){return this.parser(s)!==null},_.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let d=this.parser(s);return new this(d.parts,d.zoneId),!0}catch{return!1}},_.IPv6.isValidCIDR=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{return this.parseCIDR(s),!0}catch{return!1}},_.IPv6.networkAddressFromCIDR=function(s){let d,y,m,x,P;try{for(d=this.parseCIDR(s),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),x=[],y=0;y<16;)x.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(x)}catch(j){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${j})`)}},_.IPv6.parse=function(s){let d=this.parser(s);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(s){let d,y,m;if((y=s.match(/^(.+)\/(\d+)$/))&&(d=parseInt(y[2]),d>=0&&d<=128))return m=[this.parse(y[1]),d],Object.defineProperty(m,"toString",{value:o(function(){return this.join("/")},"value")}),m;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},_.IPv6.parser=function(s){let d,y,m,x,P,j;if(m=s.match(l.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(l.native.test(s))return f(s,8);if((m=s.match(l.transitional))&&(j=m[6]||"",d=m[1],m[1].endsWith("::")||(d=d.slice(0,-1)),d=f(d+j,6),d.parts)){for(P=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],y=0;y<P.length;y++)if(x=P[y],!(0<=x&&x<=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(s){if(s=parseInt(s),s<0||s>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(s/8);for(;y<m;)d[y]=255,y++;return m<16&&(d[m]=Math.pow(2,s%8)-1<<8-s%8),new this(d)},_.fromByteArray=function(s){let d=s.length;if(d===4)return new _.IPv4(s);if(d===16)return new _.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},_.isValid=function(s){return _.IPv6.isValid(s)||_.IPv4.isValid(s)},_.isValidCIDR=function(s){return _.IPv6.isValidCIDR(s)||_.IPv4.isValidCIDR(s)},_.parse=function(s){if(_.IPv6.isValid(s))return _.IPv6.parse(s);if(_.IPv4.isValid(s))return _.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},_.parseCIDR=function(s){try{return _.IPv6.parseCIDR(s)}catch{try{return _.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},_.process=function(s){let d=this.parse(s);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},_.subnetMatch=function(s,d,y){let m,x,P,j;y==null&&(y="unicast");for(x in d)if(Object.prototype.hasOwnProperty.call(d,x)){for(P=d[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),m=0;m<P.length;m++)if(j=P[m],s.kind()===j[0].kind()&&s.match.apply(s,j))return x}return y},typeof dr<"u"&&dr.exports?dr.exports=_:e.ipaddr=_})(pi)});var ma=z((WA,da)=>{var pa=require("stream").Stream,fp=require("util");da.exports=Ie;function Ie(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(Ie,"DelayedStream");fp.inherits(Ie,pa);Ie.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var i=e.emit;return e.emit=function(){return r._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Ie.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});Ie.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Ie.prototype.resume=function(){this._released||this.release(),this.source.resume()};Ie.prototype.pause=function(){this.source.pause()};Ie.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Ie.prototype.pipe=function(){var e=pa.prototype.pipe.apply(this,arguments);return this.resume(),e};Ie.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)};Ie.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 ha=z((KA,ya)=>{var gp=require("util"),ga=require("stream").Stream,fa=ma();ya.exports=ne;function ne(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(ne,"CombinedStream");gp.inherits(ne,ga);ne.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};ne.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};ne.prototype.append=function(e){var t=ne.isStreamLike(e);if(t){if(!(e instanceof fa)){var r=fa.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=r}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};ne.prototype.pipe=function(e,t){return ga.prototype.pipe.call(this,e,t),this.resume(),e};ne.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}};ne.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=ne.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};ne.prototype._pipeNext=function(e){this._currentStream=e;var t=ne.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()};ne.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};ne.prototype.write=function(e){this.emit("data",e)};ne.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};ne.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")};ne.prototype.end=function(){this._reset(),this.emit("end")};ne.prototype.destroy=function(){this._reset(),this.emit("close")};ne.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};ne.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};ne.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)};ne.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var xa=z((XA,va)=>{"use strict";va.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 ba=z(he=>{"use strict";var xr=xa(),yp=require("path").extname,_a=/^\s*([^;\s]*)(?:;|\s|$)/,hp=/^text\//i;he.charset=Pa;he.charsets={lookup:Pa};he.contentType=vp;he.extension=xp;he.extensions=Object.create(null);he.lookup=_p;he.types=Object.create(null);Pp(he.extensions,he.types);function Pa(e){if(!e||typeof e!="string")return!1;var t=_a.exec(e),r=t&&xr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&hp.test(t[1])?"UTF-8":!1}o(Pa,"charset");function vp(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?he.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=he.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(vp,"contentType");function xp(e){if(!e||typeof e!="string")return!1;var t=_a.exec(e),r=t&&he.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(xp,"extension");function _p(e){if(!e||typeof e!="string")return!1;var t=yp("x."+e).toLowerCase().substr(1);return t&&he.types[t]||!1}o(_p,"lookup");function Pp(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(xr).forEach(o(function(i){var u=xr[i],c=u.extensions;if(!(!c||!c.length)){e[i]=c;for(var l=0;l<c.length;l++){var f=c[l];if(t[f]){var g=r.indexOf(xr[t[f]].source),v=r.indexOf(u.source);if(t[f]!=="application/octet-stream"&&(g>v||g===v&&t[f].substr(0,12)==="application/"))continue}t[f]=i}}},"forEachMimeType"))}o(Pp,"populateMaps")});var Ta=z((ez,Ia)=>{Ia.exports=bp;function bp(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(bp,"defer")});var yn=z((rz,$a)=>{var Ea=Ta();$a.exports=Ip;function Ip(e){var t=!1;return Ea(function(){t=!0}),o(function(n,i){t?e(n,i):Ea(o(function(){e(n,i)},"nextTick_callback"))},"async_callback")}o(Ip,"async")});var hn=z((oz,Sa)=>{Sa.exports=Tp;function Tp(e){Object.keys(e.jobs).forEach(Ep.bind(e)),e.jobs={}}o(Tp,"abort");function Ep(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(Ep,"clean")});var vn=z((az,za)=>{var Aa=yn(),$p=hn();za.exports=Sp;function Sp(e,t,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=Ap(t,i,e[i],function(u,c){i in r.jobs&&(delete r.jobs[i],u?$p(r):r.results[i]=c,n(u,r.results))})}o(Sp,"iterate");function Ap(e,t,r,n){var i;return e.length==2?i=e(r,Aa(n)):i=e(r,t,Aa(n)),i}o(Ap,"runJob")});var xn=z((uz,Oa)=>{Oa.exports=zp;function zp(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(i,u){return t(e[i],e[u])}),n}o(zp,"state")});var _n=z((lz,wa)=>{var Op=hn(),wp=yn();wa.exports=kp;function kp(e){Object.keys(this.jobs).length&&(this.index=this.size,Op(this),wp(e)(null,this.results))}o(kp,"terminator")});var Ra=z((dz,ka)=>{var Rp=vn(),Dp=xn(),Np=_n();ka.exports=Cp;function Cp(e,t,r){for(var n=Dp(e);n.index<(n.keyedList||e).length;)Rp(e,t,n,function(i,u){if(i){r(i,u);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return Np.bind(n,r)}o(Cp,"parallel")});var Pn=z((fz,_r)=>{var Da=vn(),Up=xn(),Mp=_n();_r.exports=Lp;_r.exports.ascending=Na;_r.exports.descending=jp;function Lp(e,t,r,n){var i=Up(e,r);return Da(e,t,i,o(function u(c,l){if(c){n(c,l);return}if(i.index++,i.index<(i.keyedList||e).length){Da(e,t,i,u);return}n(null,i.results)},"iteratorHandler")),Mp.bind(i,n)}o(Lp,"serialOrdered");function Na(e,t){return e<t?-1:e>t?1:0}o(Na,"ascending");function jp(e,t){return-1*Na(e,t)}o(jp,"descending")});var Ua=z((yz,Ca)=>{var Fp=Pn();Ca.exports=Bp;function Bp(e,t,r){return Fp(e,t,null,r)}o(Bp,"serial")});var La=z((vz,Ma)=>{Ma.exports={parallel:Ra(),serial:Ua(),serialOrdered:Pn()}});var bn=z((xz,ja)=>{"use strict";ja.exports=Object});var Ba=z((_z,Fa)=>{"use strict";Fa.exports=Error});var Za=z((Pz,Va)=>{"use strict";Va.exports=EvalError});var Ga=z((bz,Ha)=>{"use strict";Ha.exports=RangeError});var qa=z((Iz,Wa)=>{"use strict";Wa.exports=ReferenceError});var Ja=z((Tz,Ka)=>{"use strict";Ka.exports=SyntaxError});var Pr=z((Ez,Xa)=>{"use strict";Xa.exports=TypeError});var Qa=z(($z,Ya)=>{"use strict";Ya.exports=URIError});var ts=z((Sz,es)=>{"use strict";es.exports=Math.abs});var ns=z((Az,rs)=>{"use strict";rs.exports=Math.floor});var is=z((zz,os)=>{"use strict";os.exports=Math.max});var ss=z((Oz,as)=>{"use strict";as.exports=Math.min});var cs=z((wz,us)=>{"use strict";us.exports=Math.pow});var ps=z((kz,ls)=>{"use strict";ls.exports=Math.round});var ms=z((Rz,ds)=>{"use strict";ds.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var gs=z((Nz,fs)=>{"use strict";var Vp=ms();fs.exports=o(function(t){return Vp(t)||t===0?t:t<0?-1:1},"sign")});var hs=z((Uz,ys)=>{"use strict";ys.exports=Object.getOwnPropertyDescriptor});var In=z((Mz,vs)=>{"use strict";var br=hs();if(br)try{br([],"length")}catch{br=null}vs.exports=br});var _s=z((Lz,xs)=>{"use strict";var Ir=Object.defineProperty||!1;if(Ir)try{Ir({},"a",{value:1})}catch{Ir=!1}xs.exports=Ir});var Tn=z((jz,Ps)=>{"use strict";Ps.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var u 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!==i||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var Ts=z((Bz,Is)=>{"use strict";var bs=typeof Symbol<"u"&&Symbol,Zp=Tn();Is.exports=o(function(){return typeof bs!="function"||typeof Symbol!="function"||typeof bs("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Zp()},"hasNativeSymbols")});var En=z((Zz,Es)=>{"use strict";Es.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var $n=z((Hz,$s)=>{"use strict";var Hp=bn();$s.exports=Hp.getPrototypeOf||null});var zs=z((Gz,As)=>{"use strict";var Gp="Function.prototype.bind called on incompatible ",Wp=Object.prototype.toString,qp=Math.max,Kp="[object Function]",Ss=o(function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var u=0;u<r.length;u+=1)n[u+t.length]=r[u];return n},"concatty"),Jp=o(function(t,r){for(var n=[],i=r||0,u=0;i<t.length;i+=1,u+=1)n[u]=t[i];return n},"slicy"),Xp=o(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");As.exports=o(function(t){var r=this;if(typeof r!="function"||Wp.apply(r)!==Kp)throw new TypeError(Gp+r);for(var n=Jp(arguments,1),i,u=o(function(){if(this instanceof i){var v=r.apply(this,Ss(n,arguments));return Object(v)===v?v:this}return r.apply(t,Ss(n,arguments))},"binder"),c=qp(0,r.length-n.length),l=[],f=0;f<c;f++)l[f]="$"+f;if(i=Function("binder","return function ("+Xp(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var g=o(function(){},"Empty");g.prototype=r.prototype,i.prototype=new g,g.prototype=null}return i},"bind")});var pt=z((qz,Os)=>{"use strict";var Yp=zs();Os.exports=Function.prototype.bind||Yp});var Tr=z((Kz,ws)=>{"use strict";ws.exports=Function.prototype.call});var Sn=z((Jz,ks)=>{"use strict";ks.exports=Function.prototype.apply});var Ds=z((Xz,Rs)=>{"use strict";Rs.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Cs=z((Yz,Ns)=>{"use strict";var Qp=pt(),ed=Sn(),td=Tr(),rd=Ds();Ns.exports=rd||Qp.call(td,ed)});var Ms=z((Qz,Us)=>{"use strict";var nd=pt(),od=Pr(),id=Tr(),ad=Cs();Us.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new od("a function is required");return ad(nd,id,t)},"callBindBasic")});var Zs=z((tO,Vs)=>{"use strict";var sd=Ms(),Ls=In(),Fs;try{Fs=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var An=!!Fs&&Ls&&Ls(Object.prototype,"__proto__"),Bs=Object,js=Bs.getPrototypeOf;Vs.exports=An&&typeof An.get=="function"?sd([An.get]):typeof js=="function"?o(function(t){return js(t==null?t:Bs(t))},"getDunder"):!1});var Ks=z((nO,qs)=>{"use strict";var Hs=En(),Gs=$n(),Ws=Zs();qs.exports=Hs?o(function(t){return Hs(t)},"getProto"):Gs?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Gs(t)},"getProto"):Ws?o(function(t){return Ws(t)},"getProto"):null});var zn=z((iO,Js)=>{"use strict";var ud=Function.prototype.call,cd=Object.prototype.hasOwnProperty,ld=pt();Js.exports=ld.call(ud,cd)});var nu=z((aO,ru)=>{"use strict";var G,pd=bn(),dd=Ba(),md=Za(),fd=Ga(),gd=qa(),gt=Ja(),ft=Pr(),yd=Qa(),hd=ts(),vd=ns(),xd=is(),_d=ss(),Pd=cs(),bd=ps(),Id=gs(),eu=Function,On=o(function(e){try{return eu('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),Bt=In(),Td=_s(),wn=o(function(){throw new ft},"throwTypeError"),Ed=Bt?(function(){try{return arguments.callee,wn}catch{try{return Bt(arguments,"callee").get}catch{return wn}}})():wn,dt=Ts()(),le=Ks(),$d=$n(),Sd=En(),tu=Sn(),Vt=Tr(),mt={},Ad=typeof Uint8Array>"u"||!le?G:le(Uint8Array),Qe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":dt&&le?le([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":mt,"%AsyncGenerator%":mt,"%AsyncGeneratorFunction%":mt,"%AsyncIteratorPrototype%":mt,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":dd,"%eval%":eval,"%EvalError%":md,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":eu,"%GeneratorFunction%":mt,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dt&&le?le(le([][Symbol.iterator]())):G,"%JSON%":typeof JSON=="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dt||!le?G:le(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":pd,"%Object.getOwnPropertyDescriptor%":Bt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":fd,"%ReferenceError%":gd,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dt||!le?G:le(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dt&&le?le(""[Symbol.iterator]()):G,"%Symbol%":dt?Symbol:G,"%SyntaxError%":gt,"%ThrowTypeError%":Ed,"%TypedArray%":Ad,"%TypeError%":ft,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":yd,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":Vt,"%Function.prototype.apply%":tu,"%Object.defineProperty%":Td,"%Object.getPrototypeOf%":$d,"%Math.abs%":hd,"%Math.floor%":vd,"%Math.max%":xd,"%Math.min%":_d,"%Math.pow%":Pd,"%Math.round%":bd,"%Math.sign%":Id,"%Reflect.getPrototypeOf%":Sd};if(le)try{null.error}catch(e){Xs=le(le(e)),Qe["%Error.prototype%"]=Xs}var Xs,zd=o(function e(t){var r;if(t==="%AsyncFunction%")r=On("async function () {}");else if(t==="%GeneratorFunction%")r=On("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=On("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&le&&(r=le(i.prototype))}return Qe[t]=r,r},"doEval"),Ys={__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"]},Zt=pt(),Er=zn(),Od=Zt.call(Vt,Array.prototype.concat),wd=Zt.call(tu,Array.prototype.splice),Qs=Zt.call(Vt,String.prototype.replace),$r=Zt.call(Vt,String.prototype.slice),kd=Zt.call(Vt,RegExp.prototype.exec),Rd=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Dd=/\\(\\)?/g,Nd=o(function(t){var r=$r(t,0,1),n=$r(t,-1);if(r==="%"&&n!=="%")throw new gt("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new gt("invalid intrinsic syntax, expected opening `%`");var i=[];return Qs(t,Rd,function(u,c,l,f){i[i.length]=l?Qs(f,Dd,"$1"):c||u}),i},"stringToPath"),Cd=o(function(t,r){var n=t,i;if(Er(Ys,n)&&(i=Ys[n],n="%"+i[0]+"%"),Er(Qe,n)){var u=Qe[n];if(u===mt&&(u=zd(n)),typeof u>"u"&&!r)throw new ft("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:u}}throw new gt("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");ru.exports=o(function(t,r){if(typeof t!="string"||t.length===0)throw new ft("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ft('"allowMissing" argument must be a boolean');if(kd(/^%?[^%]*%?$/,t)===null)throw new gt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Nd(t),i=n.length>0?n[0]:"",u=Cd("%"+i+"%",r),c=u.name,l=u.value,f=!1,g=u.alias;g&&(i=g[0],wd(n,Od([0,1],g)));for(var v=1,I=!0;v<n.length;v+=1){var _=n[v],s=$r(_,0,1),d=$r(_,-1);if((s==='"'||s==="'"||s==="`"||d==='"'||d==="'"||d==="`")&&s!==d)throw new gt("property names with quotes must have matching quotes");if((_==="constructor"||!I)&&(f=!0),i+="."+_,c="%"+i+"%",Er(Qe,c))l=Qe[c];else if(l!=null){if(!(_ in l)){if(!r)throw new ft("base intrinsic for "+t+" exists, but the property is not available.");return}if(Bt&&v+1>=n.length){var y=Bt(l,_);I=!!y,I&&"get"in y&&!("originalValue"in y.get)?l=y.get:l=l[_]}else I=Er(l,_),l=l[_];I&&!f&&(Qe[c]=l)}}return l},"GetIntrinsic")});var iu=z((uO,ou)=>{"use strict";var Ud=Tn();ou.exports=o(function(){return Ud()&&!!Symbol.toStringTag},"hasToStringTagShams")});var uu=z((lO,su)=>{"use strict";var Md=nu(),au=Md("%Object.defineProperty%",!0),Ld=iu()(),jd=zn(),Fd=Pr(),Sr=Ld?Symbol.toStringTag:null;su.exports=o(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Fd("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Sr&&(n||!jd(t,Sr))&&(au?au(t,Sr,{configurable:!i,enumerable:!1,value:r,writable:!1}):t[Sr]=r)},"setToStringTag")});var lu=z((dO,cu)=>{"use strict";var Bd=Function.prototype.call,Vd=Object.prototype.hasOwnProperty,Zd=pt();cu.exports=Zd.call(Bd,Vd)});var du=z((mO,pu)=>{"use strict";pu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var gu=z((fO,fu)=>{"use strict";var Nn=ha(),Hd=require("util"),kn=require("path"),Gd=require("http"),Wd=require("https"),qd=require("url").parse,Kd=require("fs"),Jd=require("stream").Stream,Xd=require("crypto"),Rn=ba(),Yd=La(),Qd=uu(),Ge=lu(),Dn=du();function mu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(mu,"escapeHeaderParam");function W(e){if(!(this instanceof W))return new W(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Nn.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(W,"FormData");Hd.inherits(W,Nn);W.LINE_BREAK=`\r
2
+ `;W.DEFAULT_CONTENT_TYPE="application/octet-stream";W.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=Nn.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,t,r),u=this._multiPartFooter();n(i),n(t),n(u),this._trackLength(i,t,r)};W.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)+W.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&Ge(t,"httpVersion"))&&!(t instanceof Jd))&&(r.knownLength||this._valuesToMeasure.push(t))};W.prototype._lengthRetriever=function(e,t){Ge(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):Kd.stat(e.path,function(r,n){if(r){t(r);return}var i=n.size-(e.start?e.start:0);t(null,i)}):Ge(e,"httpVersion")?t(null,Number(e.headers["content-length"])):Ge(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};W.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),i=this._getContentType(t,r),u="",c={"Content-Disposition":["form-data",'name="'+mu(e)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&Dn(c,r.header);var l;for(var f in c)if(Ge(c,f)){if(l=c[f],l==null)continue;Array.isArray(l)||(l=[l]),l.length&&(u+=f+": "+l.join("; ")+W.LINE_BREAK)}return"--"+this.getBoundary()+W.LINE_BREAK+u+W.LINE_BREAK};W.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=kn.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=kn.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&Ge(e,"httpVersion")&&(r=kn.basename(e.client._httpMessage.path||"")),r)return'filename="'+mu(r)+'"'};W.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=Rn.lookup(e.name)),!r&&e&&e.path&&(r=Rn.lookup(e.path)),!r&&e&&e.readable&&Ge(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=Rn.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=W.DEFAULT_CONTENT_TYPE),r};W.prototype._multiPartFooter=function(){return function(e){var t=W.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};W.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+W.LINE_BREAK};W.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)Ge(e,t)&&(r[t.toLowerCase()]=e[t]);return r};W.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};W.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};W.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(W.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};W.prototype._generateBoundary=function(){this._boundary="--------------------------"+Xd.randomBytes(12).toString("hex")};W.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};W.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};W.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}Yd.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(i){t+=i}),e(null,t)})};W.prototype.submit=function(e,t){var r,n,i={method:"post"};return typeof e=="string"?(e=qd(e),n=Dn({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(n=Dn(e,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=Wd.request(n):r=Gd.request(n),this.getLength(function(u,c){if(u&&u!=="Unknown stream"){this._error(u);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),t){var l,f=o(function(g,v){return r.removeListener("error",f),r.removeListener("response",l),t.call(this,g,v)},"callback");l=f.bind(this,null),r.on("error",f),r.on("response",l)}}.bind(this)),r};W.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};W.prototype.toString=function(){return"[object FormData]"};Qd(W.prototype,"FormData");fu.exports=W});var Mn=z((Cn,Un)=>{(function(e,t){typeof Cn=="object"&&typeof Un<"u"?Un.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(Cn,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",u="minute",c="hour",l="day",f="week",g="month",v="quarter",I="year",_="date",s="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(U){var T=["th","st","nd","rd"],b=U%100;return"["+U+(T[(b-20)%10]||T[b]||T[0])+"]"},"ordinal")},x=o(function(U,T,b){var S=String(U);return!S||S.length>=T?U:""+Array(T+1-S.length).join(b)+U},"m"),P={s:x,z:o(function(U){var T=-U.utcOffset(),b=Math.abs(T),S=Math.floor(b/60),E=b%60;return(T<=0?"+":"-")+x(S,2,"0")+":"+x(E,2,"0")},"z"),m:o(function U(T,b){if(T.date()<b.date())return-U(b,T);var S=12*(b.year()-T.year())+(b.month()-T.month()),E=T.clone().add(S,g),F=b-E<0,B=T.clone().add(S+(F?-1:1),g);return+(-(S+(b-E)/(F?E-B:B-E))||0)},"t"),a:o(function(U){return U<0?Math.ceil(U)||0:Math.floor(U)},"a"),p:o(function(U){return{M:g,y:I,w:f,d:l,D:_,h:c,m:u,s:i,ms:n,Q:v}[U]||String(U||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(U){return U===void 0},"u")},j="en",oe={};oe[j]=m;var fe=o(function(U){return U instanceof et},"p"),Te=o(function U(T,b,S){var E;if(!T)return j;if(typeof T=="string"){var F=T.toLowerCase();oe[F]&&(E=F),b&&(oe[F]=b,E=F);var B=T.split("-");if(!E&&B.length>1)return U(B[0])}else{var Y=T.name;oe[Y]=T,E=Y}return!S&&E&&(j=E),E||!S&&j},"t"),X=o(function(U,T){if(fe(U))return U.clone();var b=typeof T=="object"?T:{};return b.date=U,b.args=arguments,new et(b)},"w"),Z=P;Z.l=Te,Z.i=fe,Z.w=function(U,T){return X(U,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var et=(function(){function U(b){this.$L=Te(b.locale,null,!0),this.parse(b)}o(U,"M");var T=U.prototype;return T.parse=function(b){this.$d=(function(S){var E=S.date,F=S.utc;if(E===null)return new Date(NaN);if(Z.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var B=E.match(d);if(B){var Y=B[2]-1||0,ie=(B[7]||"0").substring(0,3);return F?new Date(Date.UTC(B[1],Y,B[3]||1,B[4]||0,B[5]||0,B[6]||0,ie)):new Date(B[1],Y,B[3]||1,B[4]||0,B[5]||0,B[6]||0,ie)}}return new Date(E)})(b),this.$x=b.x||{},this.init()},T.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},T.$utils=function(){return Z},T.isValid=function(){return this.$d.toString()!==s},T.isSame=function(b,S){var E=X(b);return this.startOf(S)<=E&&E<=this.endOf(S)},T.isAfter=function(b,S){return X(b)<this.startOf(S)},T.isBefore=function(b,S){return this.endOf(S)<X(b)},T.$g=function(b,S,E){return Z.u(b)?this[S]:this.set(E,b)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(b,S){var E=this,F=!!Z.u(S)||S,B=Z.p(b),Y=o(function(Ke,ye){var Ce=Z.w(E.$u?Date.UTC(E.$y,ye,Ke):new Date(E.$y,ye,Ke),E);return F?Ce:Ce.endOf(l)},"l"),ie=o(function(Ke,ye){return Z.w(E.toDate()[Ke].apply(E.toDate("s"),(F?[0,0,0,0]:[23,59,59,999]).slice(ye)),E)},"$"),ce=this.$W,me=this.$M,_e=this.$D,tt="set"+(this.$u?"UTC":"");switch(B){case I:return F?Y(1,0):Y(31,11);case g:return F?Y(1,me):Y(0,me+1);case f:var qe=this.$locale().weekStart||0,ht=(ce<qe?ce+7:ce)-qe;return Y(F?_e-ht:_e+(6-ht),me);case l:case _:return ie(tt+"Hours",0);case c:return ie(tt+"Minutes",1);case u:return ie(tt+"Seconds",2);case i:return ie(tt+"Milliseconds",3);default:return this.clone()}},T.endOf=function(b){return this.startOf(b,!1)},T.$set=function(b,S){var E,F=Z.p(b),B="set"+(this.$u?"UTC":""),Y=(E={},E[l]=B+"Date",E[_]=B+"Date",E[g]=B+"Month",E[I]=B+"FullYear",E[c]=B+"Hours",E[u]=B+"Minutes",E[i]=B+"Seconds",E[n]=B+"Milliseconds",E)[F],ie=F===l?this.$D+(S-this.$W):S;if(F===g||F===I){var ce=this.clone().set(_,1);ce.$d[Y](ie),ce.init(),this.$d=ce.set(_,Math.min(this.$D,ce.daysInMonth())).$d}else Y&&this.$d[Y](ie);return this.init(),this},T.set=function(b,S){return this.clone().$set(b,S)},T.get=function(b){return this[Z.p(b)]()},T.add=function(b,S){var E,F=this;b=Number(b);var B=Z.p(S),Y=o(function(me){var _e=X(F);return Z.w(_e.date(_e.date()+Math.round(me*b)),F)},"y");if(B===g)return this.set(g,this.$M+b);if(B===I)return this.set(I,this.$y+b);if(B===l)return Y(1);if(B===f)return Y(7);var ie=(E={},E[u]=t,E[c]=r,E[i]=e,E)[B]||1,ce=this.$d.getTime()+b*ie;return Z.w(ce,this)},T.subtract=function(b,S){return this.add(-1*b,S)},T.format=function(b){var S=this,E=this.$locale();if(!this.isValid())return E.invalidDate||s;var F=b||"YYYY-MM-DDTHH:mm:ssZ",B=Z.z(this),Y=this.$H,ie=this.$m,ce=this.$M,me=E.weekdays,_e=E.months,tt=E.meridiem,qe=o(function(ye,Ce,vt,Ht){return ye&&(ye[Ce]||ye(S,F))||vt[Ce].slice(0,Ht)},"h"),ht=o(function(ye){return Z.s(Y%12||12,ye,"0")},"d"),Ke=tt||function(ye,Ce,vt){var Ht=ye<12?"AM":"PM";return vt?Ht.toLowerCase():Ht};return F.replace(y,(function(ye,Ce){return Ce||(function(vt){switch(vt){case"YY":return String(S.$y).slice(-2);case"YYYY":return Z.s(S.$y,4,"0");case"M":return ce+1;case"MM":return Z.s(ce+1,2,"0");case"MMM":return qe(E.monthsShort,ce,_e,3);case"MMMM":return qe(_e,ce);case"D":return S.$D;case"DD":return Z.s(S.$D,2,"0");case"d":return String(S.$W);case"dd":return qe(E.weekdaysMin,S.$W,me,2);case"ddd":return qe(E.weekdaysShort,S.$W,me,3);case"dddd":return me[S.$W];case"H":return String(Y);case"HH":return Z.s(Y,2,"0");case"h":return ht(1);case"hh":return ht(2);case"a":return Ke(Y,ie,!0);case"A":return Ke(Y,ie,!1);case"m":return String(ie);case"mm":return Z.s(ie,2,"0");case"s":return String(S.$s);case"ss":return Z.s(S.$s,2,"0");case"SSS":return Z.s(S.$ms,3,"0");case"Z":return B}return null})(ye)||B.replace(":","")}))},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(b,S,E){var F,B=this,Y=Z.p(S),ie=X(b),ce=(ie.utcOffset()-this.utcOffset())*t,me=this-ie,_e=o(function(){return Z.m(B,ie)},"D");switch(Y){case I:F=_e()/12;break;case g:F=_e();break;case v:F=_e()/3;break;case f:F=(me-ce)/6048e5;break;case l:F=(me-ce)/864e5;break;case c:F=me/r;break;case u:F=me/t;break;case i:F=me/e;break;default:F=me}return E?F:Z.a(F)},T.daysInMonth=function(){return this.endOf(g).$D},T.$locale=function(){return oe[this.$L]},T.locale=function(b,S){if(!b)return this.$L;var E=this.clone(),F=Te(b,S,!0);return F&&(E.$L=F),E},T.clone=function(){return Z.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},U})(),We=et.prototype;return X.prototype=We,[["$ms",n],["$s",i],["$m",u],["$H",c],["$W",l],["$M",g],["$y",I],["$D",_]].forEach((function(U){We[U[1]]=function(T){return this.$g(T,U[0],U[1])}})),X.extend=function(U,T){return U.$i||(U(T,et,X),U.$i=!0),X},X.locale=Te,X.isDayjs=fe,X.unix=function(U){return X(1e3*U)},X.en=oe[j],X.Ls=oe,X.p={},X}))});var dm={};Fn(dm,{chatling:()=>pm});module.exports=ku(dm);var Ru=Object.freeze({status:"aborted"});function $(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,v=Object.keys(g);for(let I=0;I<v.length;I++){let _=v[I];_ in l||(l[_]=g[_].bind(l))}}o(n,"init");let i=r?.Parent??Object;class u extends i{static{o(this,"Definition")}}Object.defineProperty(u,"name",{value:e});function c(l){var f;let g=r?.Parent?new u:this;n(g,l),(f=g._zod).deferred??(f.deferred=[]);for(let v of g._zod.deferred)v();return g}return o(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:o(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e),"value")}),Object.defineProperty(c,"name",{value:e}),c}o($,"$constructor");var Ee=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gt=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Or={};function ze(e){return e&&Object.assign(Or,e),Or}o(ze,"config");function kr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}o(kr,"getEnumValues");function Zn(e,t){return typeof t=="bigint"?t.toString():t}o(Zn,"jsonStringifyReplacer");function qt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(qt,"cached");function Hn(e){return e==null}o(Hn,"nullish");function Kt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(Kt,"cleanRegex");var Vn=Symbol("evaluating");function ae(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Vn)return n===void 0&&(n=Vn,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(ae,"defineLazy");var Rr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(_t,"isObject");var Du=qt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gn(e){if(_t(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_t(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Gn,"isPlainObject");var Wn=new Set(["string","number","symbol"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(rt,"escapeRegex");function Jt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(Jt,"clone");function Q(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(Q,"normalizeParams");function qn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(qn,"optionalKeys");var Kn={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 nt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(nt,"aborted");function Me(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(Me,"prefixIssues");function Wt(e){return typeof e=="string"?e:e?.message}o(Wt,"unwrapMessage");function Le(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Wt(e.inst?._zod.def?.error?.(e))??Wt(t?.error?.(e))??Wt(r.customError?.(e))??Wt(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(Le,"finalizeIssue");function Jn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Jn,"getLengthableOrigin");function Dr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(Dr,"issue");var Xn=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zn,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Yn=$("$ZodError",Xn),Pt=$("$ZodError",Xn,{Parent:Error});var Cu=o(e=>(t,r,n,i)=>{let u=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},u);if(c instanceof Promise)throw new Ee;if(c.issues.length){let l=new(i?.Err??e)(c.issues.map(f=>Le(f,u,ze())));throw Rr(l,i?.callee),l}return c.value},"_parse"),Xt=Cu(Pt),Uu=o(e=>async(t,r,n,i)=>{let u=n?Object.assign(n,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let l=new(i?.Err??e)(c.issues.map(f=>Le(f,u,ze())));throw Rr(l,i?.callee),l}return c.value},"_parseAsync"),Yt=Uu(Pt),Mu=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},i);if(u instanceof Promise)throw new Ee;return u.issues.length?{success:!1,error:new(e??Yn)(u.issues.map(c=>Le(c,i,ze())))}:{success:!0,data:u.value}},"_safeParse"),bt=Mu(Pt),Lu=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},u=t._zod.run({value:r,issues:[]},i);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(c=>Le(c,i,ze())))}:{success:!0,data:u.value}},"_safeParseAsync"),It=Lu(Pt);var ju="(?:(?:\\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])))",Fu=new RegExp(`^${ju}$`);var Qn=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),eo=/^-?\d+n?$/,to=/^-?\d+$/,Nr=/^-?\d+(?:\.\d+)?$/,ro=/^(?:true|false)$/i;var je=$("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Bu={number:"number",bigint:"bigint",object:"date"};var no=$("$ZodCheckGreaterThan",(e,t)=>{je.init(e,t);let r=Bu[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,u=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>u&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var oo=$("$ZodCheckNumberFormat",(e,t)=>{je.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,u]=Kn[t.format];e._zod.onattach.push(c=>{let l=c._zod.bag;l.format=t.format,l.minimum=i,l.maximum=u,r&&(l.pattern=to)}),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<i&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),l>u&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!t.abort})}});var io=$("$ZodCheckMinLength",(e,t)=>{var r;je.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Hn(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let c=Jn(i);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var Cr=$("$ZodCheckStringFormat",(e,t)=>{var r,n;je.init(e,t),e._zod.onattach.push(i=>{let u=i._zod.bag;u.format=t.format,t.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ao=$("$ZodCheckRegex",(e,t)=>{Cr.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 uo={major:4,minor:3,patch:6};var te=$("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=uo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let u of i._zod.onattach)u(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((c,l,f)=>{let g=nt(c),v;for(let I of l){if(I._zod.def.when){if(!I._zod.def.when(c))continue}else if(g)continue;let _=c.issues.length,s=I._zod.check(c);if(s instanceof Promise&&f?.async===!1)throw new Ee;if(v||s instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await s,c.issues.length!==_&&(g||(g=nt(c,_)))});else{if(c.issues.length===_)continue;g||(g=nt(c,_))}}return v?v.then(()=>c):c},"runChecks"),u=o((c,l,f)=>{if(nt(c))return c.aborted=!0,c;let g=i(l,n,f);if(g instanceof Promise){if(f.async===!1)throw new Ee;return g.then(v=>e._zod.parse(v,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(v=>u(v,c,l)):u(g,c,l)}let f=e._zod.parse(c,l);if(f instanceof Promise){if(l.async===!1)throw new Ee;return f.then(g=>i(g,n,l))}return i(f,n,l)}}ae(e,"~standard",()=>({validate:o(i=>{try{let u=bt(e,i);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return It(e,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),tr=$("$ZodString",(e,t)=>{te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qn(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}}),Ur=$("$ZodStringFormat",(e,t)=>{Cr.init(e,t),tr.init(e,t)});var fo=$("$ZodURL",(e,t)=>{Ur.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Mr=$("$ZodNumber",(e,t)=>{te.init(e,t),e._zod.pattern=e._zod.bag.pattern??Nr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let u=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...u?{received:u}:{}}),r}}),go=$("$ZodNumberFormat",(e,t)=>{oo.init(e,t),Mr.init(e,t)}),Lr=$("$ZodBoolean",(e,t)=>{te.init(e,t),e._zod.pattern=ro,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),yo=$("$ZodBigInt",(e,t)=>{te.init(e,t),e._zod.pattern=eo,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 ho=$("$ZodAny",(e,t)=>{te.init(e,t),e._zod.parse=r=>r}),vo=$("$ZodUnknown",(e,t)=>{te.init(e,t),e._zod.parse=r=>r});var xo=$("$ZodVoid",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),_o=$("$ZodDate",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,u=i instanceof Date;return u&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...u?{received:"Invalid Date"}:{},inst:e}),r}});function co(e,t,r){e.issues.length&&t.issues.push(...Me(r,e.issues)),t.value[r]=e.value}o(co,"handleArrayResult");var Po=$("$ZodArray",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let u=[];for(let c=0;c<i.length;c++){let l=i[c],f=t.element._zod.run({value:l,issues:[]},n);f instanceof Promise?u.push(f.then(g=>co(g,r,c))):co(f,r,c)}return u.length?Promise.all(u).then(()=>r):r}});function er(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...Me(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(er,"handlePropertyResult");function Vu(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=qn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Vu,"normalizeDef");function Zu(e,t,r,n,i,u){let c=[],l=i.keySet,f=i.catchall._zod,g=f.def.type,v=f.optout==="optional";for(let I in t){if(l.has(I))continue;if(g==="never"){c.push(I);continue}let _=f.run({value:t[I],issues:[]},n);_ instanceof Promise?e.push(_.then(s=>er(s,r,I,t,v))):er(_,r,I,t,v)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:u}),e.length?Promise.all(e).then(()=>r):r}o(Zu,"handleCatchall");var bo=$("$ZodObject",(e,t)=>{if(te.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let f={...l};return Object.defineProperty(t,"shape",{value:f}),f},"get")})}let n=qt(()=>Vu(t));ae(e._zod,"propValues",()=>{let l=t.shape,f={};for(let g in l){let v=l[g]._zod;if(v.values){f[g]??(f[g]=new Set);for(let I of v.values)f[g].add(I)}}return f});let i=_t,u=t.catchall,c;e._zod.parse=(l,f)=>{c??(c=n.value);let g=l.value;if(!i(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),l;l.value={};let v=[],I=c.shape;for(let _ of c.keys){let s=I[_],d=s._zod.optout==="optional",y=s._zod.run({value:g[_],issues:[]},f);y instanceof Promise?v.push(y.then(m=>er(m,l,_,g,d))):er(y,l,_,g,d)}return u?Zu(v,g,l,f,n.value,e):v.length?Promise.all(v).then(()=>l):l}});function lo(e,t,r,n){for(let u of e)if(u.issues.length===0)return t.value=u.value,t;let i=e.filter(u=>!nt(u));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(u=>u.issues.map(c=>Le(c,n,ze())))}),t)}o(lo,"handleUnionResults");var jr=$("$ZodUnion",(e,t)=>{te.init(e,t),ae(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ae(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ae(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ae(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(u=>u._zod.pattern);return new RegExp(`^(${i.map(u=>Kt(u.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,u)=>{if(r)return n(i,u);let c=!1,l=[];for(let f of t.options){let g=f._zod.run({value:i.value,issues:[]},u);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=>lo(f,i,e,u)):lo(l,i,e,u)}});var Io=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,jr.init(e,t);let r=e._zod.parse;ae(e._zod,"propValues",()=>{let i={};for(let u of t.options){let c=u._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(let[l,f]of Object.entries(c)){i[l]||(i[l]=new Set);for(let g of f)i[l].add(g)}}return i});let n=qt(()=>{let i=t.options,u=new Map;for(let c of i){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(u.has(f))throw new Error(`Duplicate discriminator value "${String(f)}"`);u.set(f,c)}}return u});e._zod.parse=(i,u)=>{let c=i.value;if(!_t(c))return i.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),i;let l=n.value.get(c?.[t.discriminator]);return l?l._zod.run(i,u):t.unionFallback?r(i,u):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),i)}});var To=$("$ZodRecord",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Gn(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let u=[],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 v=t.valueType._zod.run({value:i[g],issues:[]},n);v instanceof Promise?u.push(v.then(I=>{I.issues.length&&r.issues.push(...Me(g,I.issues)),r.value[g]=I.value})):(v.issues.length&&r.issues.push(...Me(g,v.issues)),r.value[g]=v.value)}let f;for(let g in i)l.has(g)||(f=f??[],f.push(g));f&&f.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:f})}else{r.value={};for(let l of Reflect.ownKeys(i)){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"&&Nr.test(l)&&f.issues.length){let I=t.keyType._zod.run({value:Number(l),issues:[]},n);if(I instanceof Promise)throw new Error("Async schemas not supported in object keys currently");I.issues.length===0&&(f=I)}if(f.issues.length){t.mode==="loose"?r.value[l]=i[l]:r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(I=>Le(I,n,ze())),input:l,path:[l],inst:e});continue}let v=t.valueType._zod.run({value:i[l],issues:[]},n);v instanceof Promise?u.push(v.then(I=>{I.issues.length&&r.issues.push(...Me(l,I.issues)),r.value[f.value]=I.value})):(v.issues.length&&r.issues.push(...Me(l,v.issues)),r.value[f.value]=v.value)}}return u.length?Promise.all(u).then(()=>r):r}});var Eo=$("$ZodEnum",(e,t)=>{te.init(e,t);let r=kr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Wn.has(typeof i)).map(i=>typeof i=="string"?rt(i):i.toString()).join("|")})$`),e._zod.parse=(i,u)=>{let c=i.value;return n.has(c)||i.issues.push({code:"invalid_value",values:r,input:c,inst:e}),i}}),$o=$("$ZodLiteral",(e,t)=>{if(te.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"?rt(n):n?rt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let u=n.value;return r.has(u)||n.issues.push({code:"invalid_value",values:t.values,input:u,inst:e}),n}});var So=$("$ZodTransform",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gt(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(r.value=c,r));if(i instanceof Promise)throw new Ee;return r.value=i,r}});function po(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(po,"handleOptionalResult");var Ao=$("$ZodOptional",(e,t)=>{te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ae(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(u=>po(u,r.value)):po(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var zo=$("$ZodNullable",(e,t)=>{te.init(e,t),ae(e._zod,"optin",()=>t.innerType._zod.optin),ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kt(r.source)}|null)$`):void 0}),ae(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 Oo=$("$ZodPipe",(e,t)=>{te.init(e,t),ae(e._zod,"values",()=>t.in._zod.values),ae(e._zod,"optin",()=>t.in._zod.optin),ae(e._zod,"optout",()=>t.out._zod.optout),ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let u=t.out._zod.run(r,n);return u instanceof Promise?u.then(c=>Qt(c,t.in,n)):Qt(u,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(u=>Qt(u,t.out,n)):Qt(i,t.out,n)}});function Qt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(Qt,"handlePipeResult");var wo=$("$ZodCustom",(e,t)=>{je.init(e,t),te.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(u=>mo(u,r,n,e));mo(i,r,n,e)}});function mo(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Dr(i))}}o(mo,"handleRefineResult");var Ro;var Fr=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Do(){return new Fr}o(Do,"registry");(Ro=globalThis).__zod_globalRegistry??(Ro.__zod_globalRegistry=Do());var Br=globalThis.__zod_globalRegistry;function No(e,t){return new e({type:"string",...Q(t)})}o(No,"_string");function Co(e,t){return new e({type:"string",coerce:!0,...Q(t)})}o(Co,"_coercedString");function Uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Q(t)})}o(Uo,"_url");function Mo(e,t){return new e({type:"number",checks:[],...Q(t)})}o(Mo,"_number");function Lo(e,t){return new e({type:"number",coerce:!0,checks:[],...Q(t)})}o(Lo,"_coercedNumber");function jo(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Q(t)})}o(jo,"_int");function Fo(e,t){return new e({type:"boolean",...Q(t)})}o(Fo,"_boolean");function Bo(e,t){return new e({type:"boolean",coerce:!0,...Q(t)})}o(Bo,"_coercedBoolean");function Vo(e,t){return new e({type:"bigint",coerce:!0,...Q(t)})}o(Vo,"_coercedBigint");function Zo(e){return new e({type:"any"})}o(Zo,"_any");function Ho(e){return new e({type:"unknown"})}o(Ho,"_unknown");function Go(e,t){return new e({type:"void",...Q(t)})}o(Go,"_void");function Wo(e,t){return new e({type:"date",coerce:!0,...Q(t)})}o(Wo,"_coercedDate");function rr(e,t){return new no({check:"greater_than",...Q(t),value:e,inclusive:!0})}o(rr,"_gte");function be(e,t){return new io({check:"min_length",...Q(t),minimum:e})}o(be,"_minLength");function Fe(e,t){return new ao({check:"string_format",format:"regex",...Q(t),pattern:e})}o(Fe,"_regex");function qo(e,t,r){let n=Q(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(qo,"_custom");var se=$("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");te.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>Xt(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>bt(e,r,n),e.parseAsync=async(r,n)=>Yt(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>It(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)=>Jt(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),or=$("ZodMiniString",(e,t)=>{tr.init(e,t),se.init(e,t)});function a(e){return No(or,e)}o(a,"string");var Ko=$("ZodMiniStringFormat",(e,t)=>{Ur.init(e,t),or.init(e,t)});var nc=$("ZodMiniURL",(e,t)=>{fo.init(e,t),Ko.init(e,t)});function Jo(e){return Uo(nc,e)}o(Jo,"url");var ir=$("ZodMiniNumber",(e,t)=>{Mr.init(e,t),se.init(e,t)});function ge(e){return Mo(ir,e)}o(ge,"number");var oc=$("ZodMiniNumberFormat",(e,t)=>{go.init(e,t),ir.init(e,t)});function Xo(e){return jo(oc,e)}o(Xo,"int");var Vr=$("ZodMiniBoolean",(e,t)=>{Lr.init(e,t),se.init(e,t)});function J(e){return Fo(Vr,e)}o(J,"boolean");var Yo=$("ZodMiniBigInt",(e,t)=>{yo.init(e,t),se.init(e,t)});var ic=$("ZodMiniAny",(e,t)=>{ho.init(e,t),se.init(e,t)});function Et(){return Zo(ic)}o(Et,"any");var ac=$("ZodMiniUnknown",(e,t)=>{vo.init(e,t),se.init(e,t)});function D(){return Ho(ac)}o(D,"unknown");var sc=$("ZodMiniVoid",(e,t)=>{xo.init(e,t),se.init(e,t)});function Qo(e){return Go(sc,e)}o(Qo,"_void");var ei=$("ZodMiniDate",(e,t)=>{_o.init(e,t),se.init(e,t)});var uc=$("ZodMiniArray",(e,t)=>{Po.init(e,t),se.init(e,t)});function M(e,t){return new uc({type:"array",element:e,...Q(t)})}o(M,"array");var cc=$("ZodMiniObject",(e,t)=>{bo.init(e,t),se.init(e,t),ae(e,"shape",()=>t.shape)});function p(e,t){let r={type:"object",shape:e??{},...Q(t)};return new cc(r)}o(p,"object");var lc=$("ZodMiniUnion",(e,t)=>{jr.init(e,t),se.init(e,t)});function L(e,t){return new lc({type:"union",options:e,...Q(t)})}o(L,"union");var pc=$("ZodMiniDiscriminatedUnion",(e,t)=>{Io.init(e,t),se.init(e,t)});function Be(e,t,r){return new pc({type:"union",options:t,discriminator:e,...Q(r)})}o(Be,"discriminatedUnion");var dc=$("ZodMiniRecord",(e,t)=>{To.init(e,t),se.init(e,t)});function N(e,t,r){return new dc({type:"record",keyType:e,valueType:t,...Q(r)})}o(N,"record");var mc=$("ZodMiniEnum",(e,t)=>{Eo.init(e,t),se.init(e,t),e.options=Object.values(t.entries)});function H(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new mc({type:"enum",entries:r,...Q(t)})}o(H,"_enum");var fc=$("ZodMiniLiteral",(e,t)=>{$o.init(e,t),se.init(e,t)});function O(e,t){return new fc({type:"literal",values:Array.isArray(e)?e:[e],...Q(t)})}o(O,"literal");var gc=$("ZodMiniTransform",(e,t)=>{So.init(e,t),se.init(e,t)});function Ve(e){return new gc({type:"transform",transform:e})}o(Ve,"transform");var yc=$("ZodMiniOptional",(e,t)=>{Ao.init(e,t),se.init(e,t)});function h(e){return new yc({type:"optional",innerType:e})}o(h,"optional");var hc=$("ZodMiniNullable",(e,t)=>{zo.init(e,t),se.init(e,t)});function $t(e){return new hc({type:"nullable",innerType:e})}o($t,"nullable");var vc=$("ZodMiniPipe",(e,t)=>{Oo.init(e,t),se.init(e,t)});function Ze(e,t){return new vc({type:"pipe",in:e,out:t})}o(Ze,"pipe");var xc=$("ZodMiniCustom",(e,t)=>{wo.init(e,t),se.init(e,t)});function ar(e,t){return qo(xc,e??(()=>!0),t)}o(ar,"custom");var St={};Fn(St,{bigint:()=>Ec,boolean:()=>Tc,date:()=>$c,number:()=>Ic,string:()=>bc});function bc(e){return Co(or,e)}o(bc,"string");function Ic(e){return Lo(ir,e)}o(Ic,"number");function Tc(e){return Bo(Vr,e)}o(Tc,"boolean");function Ec(e){return Vo(Yo,e)}o(Ec,"bigint");function $c(e){return Wo(ei,e)}o($c,"date");var Hr=p({retryOnFailure:p({defaultValue:h(J()),hide:h(J())}),continueOnFailure:p({defaultValue:h(J()),hide:h(J())})}),Zr=class{constructor(t,r,n,i,u,c,l,f,g,v,I){this.name=t;this.displayName=r;this.description=n;this.props=i;this.run=u;this.test=c;this.requireAuth=l;this.errorHandlingOptions=f;this.outputSchema=g;this.audience=v;this.aiMetadata=I}static{o(this,"IAction")}},ot=o(e=>new Zr(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 K=p({displayName:a(),description:h(a())}),V=o((e,t)=>p({type:O(t),required:J(),defaultValue:h(Et())}),"TPropertyValue");var ve=p({...K.shape,...V(a(),"SHORT_TEXT").shape}),Oe=p({...K.shape,...V(a(),"LONG_TEXT").shape});var ri=p({label:a(),value:D()}),sr=p({disabled:h(J()),placeholder:h(a()),options:M(ri)});var xe=p({...K.shape,options:sr,...V(D(),"STATIC_DROPDOWN").shape}),we=p({...K.shape,options:sr,...V(M(D()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Gr=p({...K.shape,...V(D(),"DROPDOWN").shape,refreshers:M(a())}),At=p({...K.shape,...V(M(D()),"MULTI_SELECT_DROPDOWN").shape,refreshers:M(a())});var ke=p({...K.shape,...V(J(),"CHECKBOX").shape});var Re=p({...K.shape,...V(ge(),"NUMBER").shape});var zt=p({...K.shape,streaming:h(J()),...V(D(),"FILE").shape});var Ot=p({...K.shape,...V(a(),"DATE_TIME").shape});var ni=N(a(),L([ve,Oe,xe,At,we,ke,Re,zt,Ot])),wt=p({...K.shape,properties:ni,...V(M(D()),"ARRAY").shape});var kt=p({...K.shape,...V(L([N(a(),D())]),"JSON").shape});var oi=L([ve,xe,kt,wt,we]),Ac=N(a(),oi),Wr=p({refreshers:M(a()),...K.shape,...V(D(),"DYNAMIC").shape});var ur=p({...K.shape,...V(Qo(),"MARKDOWN").shape});var Rt=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Rt||{}),it=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(it||{}),at=(x=>(x.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",x.COMMUNICATION="COMMUNICATION",x.COMMERCE="COMMERCE",x.CORE="CORE",x.UNIVERSAL_AI="UNIVERSAL_AI",x.FLOW_CONTROL="FLOW_CONTROL",x.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",x.ACCOUNTING="ACCOUNTING",x.PRODUCTIVITY="PRODUCTIVITY",x.CONTENT_AND_FILES="CONTENT_AND_FILES",x.DEVELOPER_TOOLS="DEVELOPER_TOOLS",x.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",x.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",x.HUMAN_RESOURCES="HUMAN_RESOURCES",x.PAYMENT_PROCESSING="PAYMENT_PROCESSING",x.MARKETING="MARKETING",x.SALES_AND_CRM="SALES_AND_CRM",x))(at||{});var Dt=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Dt||{}),qr="both_client_credentials_and_authorization_code";var De=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(De||{}),Nt=(u=>(u.NONE="NONE",u.HEADER_PRESENT="HEADER_PRESENT",u.QUERY_PRESENT="QUERY_PRESENT",u.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",u.HEAD_REQUEST="HEAD_REQUEST",u))(Nt||{}),zc=p({strategy:H(Nt),paramName:h(a())}),Ct=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ct||{});var cr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(cr||{}),ii=p({status:h(ge()),body:h(D()),headers:h(N(a(),a()))}),ai=p({type:O("DELAY"),resumeDateTime:a(),requestIdToReply:h(a()),handlerId:h(a()),streamStepProgress:h(H(cr))}),si=p({type:O("WEBHOOK"),requestId:a(),requestIdToReply:h(a()),response:ii,handlerId:h(a()),streamStepProgress:h(H(cr))}),Oc=L([ai,si]);var wc=p({body:D(),rawBody:h(D()),headers:N(a(),a()),queryParams:N(a(),a())});function ue(e){return e==null}o(ue,"isNil");function Ut(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(Ut,"isEmpty");function lr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(lr,"assertNotNullOrUndefined");var Kr=Ue(require("crypto"),1);var kc=128,Je,st,Rc=o(e=>{!Je||Je.length<e?(Je=Buffer.allocUnsafe(e*kc),Kr.default.randomFillSync(Je),st=0):st+e>Je.length&&(Kr.default.randomFillSync(Je),st=0),st+=e},"fillPool"),Dc=o(e=>(Rc(e|=0),Je.subarray(st-e,st)),"random"),Nc=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*n*t/e.length);return(u=t)=>{let c="";for(;;){let l=r(i),f=i;for(;f--;)if(c+=e[l[f]&n]||"",c.length===u)return c}}},"customRandom"),ci=o((e,t=21)=>Nc(e,t,Dc),"customAlphabet");var Cc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",li=21,Wb=a().check(Fe(new RegExp(`^[0-9a-zA-Z]{${li}}$`))),Uc=ci(Cc,li);var He=Ze(Ve(e=>e instanceof Date?e.toISOString():e),a()),Pe={id:a(),created:He,updated:He},ee=o(e=>h($t(e)),"Nullable");function Jr(e){return h($t(H(e)))}o(Jr,"NullableEnum");var Jb=Ze(Ve(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),h(J())),pr=o(e=>Ze(Ve(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),h(M(e))),"OptionalArrayFromQuery");var Qb=N(a(),D());var Mt=(v=>(v.OPENAI="openai",v.OPENROUTER="openrouter",v.ANTHROPIC="anthropic",v.AZURE="azure",v.GOOGLE="google",v.ACTIVEPIECES="activepieces",v.CLOUDFLARE_GATEWAY="cloudflare-gateway",v.CUSTOM="custom",v.BEDROCK="bedrock",v.MISTRAL="mistral",v))(Mt||{});var pI=a().check(Fe(/^#[0-9A-Fa-f]{6}$/));var mI=p({filename:a(),data:D(),type:O("file"),mimetype:h(a())});var Mc=Ue(di());var _I=p({...Pe,name:a(),permissions:M(a()),platformId:ee(a()),type:a(),userCount:h(ge())});var mi=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(mi||{}),Xr=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Xr||{}),Yr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(Yr||{});var Qr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Qr||{});var en=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(en||{});var Lc=p({mode:H(mi),value:D()}),jc=p({auth:h(a()),fields:N(a(),Lc)}),Fc=p({pieceName:a(),pieceVersion:a(),actionName:a(),predefinedInput:h(jc)}),Bc=p({type:O("PIECE"),toolName:a().check(be(1)),pieceMetadata:Fc}),Vc=p({type:O("none")}),Zc=p({type:O("access_token"),accessToken:a()}),Hc=p({type:O("api_key"),apiKey:a(),apiKeyHeader:a()}),Gc=p({type:O("headers"),headers:N(a(),a())}),Wc=Be("type",[Vc,Zc,Hc,Gc]),fi=p({type:O("FLOW"),toolName:a().check(be(1)),externalFlowId:a(),flowDisplayName:h(a())}),gi=p({type:O("MCP"),toolName:a().check(be(1)),serverUrl:Jo(),protocol:H(Yr),auth:Wc}),yi=p({type:O("KNOWLEDGE_BASE"),toolName:a().check(be(1)),sourceType:H(Xr),sourceId:a(),sourceName:a()}),qc=Be("type",[Bc,fi,gi,yi]),Kc=p({displayName:a(),description:h(a()),type:H(Qr)}),hi=p({type:O("MARKDOWN"),markdown:a()}),ut={type:O("TOOL_CALL"),input:ee(N(a(),D())),output:h(D()),toolName:a(),status:H(en),toolCallId:a(),startTime:a(),endTime:h(a())},XI=p(ut),vi=Be("toolCallType",[p({...ut,toolCallType:O("PIECE"),pieceName:a(),pieceVersion:a(),actionName:a()}),p({...ut,toolCallType:O("FLOW"),displayName:a(),externalFlowId:a()}),p({...ut,toolCallType:O("MCP"),displayName:a(),serverUrl:a()}),p({...ut,toolCallType:O("KNOWLEDGE_BASE"),displayName:a(),sourceType:a()}),p({...ut,toolCallType:O("UNKNOWN"),displayName:a()})]),Jc=L([hi,vi]);var tn=(r=>(r.IMAGE="image",r.TEXT="text",r))(tn||{}),Ne=p({apiKey:a()}),Xc=Ne,Yc=p({apiKey:a(),apiKeyHash:a()}),Qc=Ne,el=Ne,tl=Ne,rl=Ne,nl=Ne,ol=Ne,il=Ne,Ii=p({accessKeyId:a().check(be(1)),secretAccessKey:a().check(be(1))}),al=p({}),sl=p({}),ul=p({}),cl=p({}),ll=p({}),pl=p({}),Ti=p({modelId:a(),modelName:a(),modelType:H(tn)}),Ei=p({apiKeyHeader:a(),baseUrl:a(),models:M(Ti),defaultHeaders:h(N(a(),a()))}),$i=p({accountId:a(),gatewayId:a(),models:M(Ti),vertexProject:h(a()),vertexRegion:h(a())}),Si=p({resourceName:a(),apiVersion:Ze(Ve(e=>typeof e=="string"&&e.trim().length===0?void 0:e),h(a()))}),Ai=p({region:a().check(be(1))}),dl=L([Xc,tl,rl,nl,ol,el,Qc,Yc,Ii,il]),zi=L([Ei,$i,Si,Ai,al,ul,cl,ll,sl,pl]),ml=p({id:a(),name:a(),type:H(tn)}),fl=p({id:a(),name:a(),provider:H(Mt),config:zi,enabledForChat:J()}),gl=p({provider:H(Mt),config:zi,auth:dl,platformId:a()});var tT={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},xi=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],yl=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],hl=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],_i=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],vl=["grok-4.20","grok-4.1-fast"],xl={openai:xi,anthropic:yl,google:_i,activepieces:[...hl.map(e=>`anthropic/${e}`),...xi.map(e=>`openai/${e}`),..._i.map(e=>`google/${e}`),...vl.map(e=>`x-ai/${e}`)]};var Pi=128e3,_l={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Pl({provider:e}){return e?_l[e]??Pi:Pi}o(Pl,"getMaxContextTokens");var bi={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"},bl={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Il=new Set(["anthropic","mistral"]);function $e(e){return{chatModels:xl[e],maxContextTokens:Pl({provider:e}),defaultEmbeddingModel:bi[e],supportsEmbedding:bi[e]!==void 0,supportsImageGeneration:!Il.has(e),webSearch:bl[e]}}o($e,"buildProviderCapabilities");var Tl={openai:$e("openai"),anthropic:$e("anthropic"),openrouter:$e("openrouter"),azure:$e("azure"),google:$e("google"),"cloudflare-gateway":$e("cloudflare-gateway"),custom:$e("custom"),bedrock:$e("bedrock"),mistral:$e("mistral"),activepieces:$e("activepieces")};var El=p({base64Url:a(),fileName:a(),extension:h(a())}),$l=p({mimeType:a(),url:a(),fileName:h(a())}),rn=L([El,$l]);var Sl=L([p({type:O("file"),value:rn}),p({type:O("markdown"),value:a(),files:h(M(rn))})]),Al=p({sessionId:a(),message:a(),files:h(M(a()))});var wi=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(wi||{}),ki=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(ki||{}),nn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(nn||{});var zl=L([p({...Pe,name:a(),externalId:a(),type:O("STATIC_DROPDOWN"),tableId:a(),projectId:a(),data:p({options:M(p({value:a()}))})}),p({...Pe,name:a(),externalId:a(),type:L([O("TEXT"),O("NUMBER"),O("DATE")]),tableId:a(),projectId:a()})]),Ol=p({...Pe,name:a(),folderId:ee(a()),projectId:a(),externalId:a(),status:Jr(ki),trigger:Jr(wi)}),wl=p({...Pe,tableId:a(),projectId:a(),cells:N(a(),p({updated:a(),created:a(),value:D(),fieldName:a()}))}),kl=p({events:M(H(nn)),webhookUrl:a(),flowId:a()}),Rl=p({fields:M(p({id:a(),name:a()})),rows:M(N(a(),a())),name:a()}),Dl=p({projectId:a(),limit:h(St.number()),cursor:h(a()),name:h(a()),externalIds:pr(a()),folderId:h(a()),folderIds:pr(a())}),Nl=p({records:M(M(p({fieldId:a(),value:Di()}))),tableId:a()}),Cl=p({cells:h(M(p({fieldId:a(),value:Di()}))),tableId:a(),agentUpdate:h(J())}),Ri=Be("operator",[Xe("eq"),Xe("neq"),Xe("gt"),Xe("gte"),Xe("lt"),Xe("lte"),Xe("co"),Oi("exists"),Oi("not_exists")]),Ul=p({tableId:a(),limit:h(St.number()),cursor:h(a()),filters:pr(Ri)});function Di(){return Ze(Ve(e=>e==null?e:String(e)),$t(a()))}o(Di,"coerceToString");function Xe(e){return p({fieldId:a(),operator:O(e),value:a()})}o(Xe,"valueFilter");function Oi(e){return p({fieldId:a(),operator:O(e)})}o(Oi,"existenceFilter");var Ml=p({status:h(ge()),body:h(D()),headers:h(N(a(),a()))}),Ll=p({...Pe,deleted:ee(He),ownerId:a(),displayName:a(),platformId:a(),externalId:ee(a())});var Ni=p({name:a(),description:h(a()),type:a(),required:J()}),jl=p({pieceName:a(),triggerName:a(),input:p({toolName:a(),toolDescription:a(),inputSchema:M(Ni),returnsResponse:J()})});var Ci="^[0-9]+\\.[0-9]+\\.[0-9]+$",_T=new RegExp(Ci),Bl="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",PT=a().check(Fe(new RegExp(Ci))),bT=a().check(Fe(new RegExp(Bl))),Vl=p({packageType:O("ARCHIVE"),pieceType:H(it),pieceName:a(),pieceVersion:a(),archiveId:a(),platformId:a()}),Ui=p({packageType:O("REGISTRY"),pieceType:O("OFFICIAL"),pieceName:a(),pieceVersion:a()}),Mi=p({packageType:O("REGISTRY"),pieceType:O("CUSTOM"),pieceName:a(),pieceVersion:a(),platformId:a()}),IT=L([Ui,Mi]),TT=L([Vl,Ui,Mi]);var Zl=Be("type",[p({type:O("CRON_EXPRESSION"),cronExpression:a(),timezone:a()}),p({type:O("INTERVAL"),intervalMs:Xo().check(rr(6e4))})]),ET=p({...Pe,type:H(De),projectId:a(),flowId:a(),triggerName:a(),schedule:ee(Zl),flowVersionId:a(),pieceName:a(),pieceVersion:a(),deleted:ee(a()),simulate:J()}),Li=(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))(Li||{}),ji=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(ji||{}),Fi=(r=>(r.S3="S3",r.DB="DB",r))(Fi||{}),$T=p({...Pe,projectId:ee(a()),platformId:ee(a()),type:H(Li),compression:H(ji),data:h(D()),location:H(Fi),size:ee(ge()),fileName:ee(a()),s3Key:ee(a()),metadata:ee(N(a(),a()))}),Bi=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Bi||{}),Vi=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Vi||{}),ST=p({id:a(),email:a(),firstName:a(),status:H(Vi),externalId:ee(a()),platformId:ee(a()),platformRole:H(Bi),lastName:a(),created:He,updated:He,lastActiveDate:ee(He),imageUrl:ee(a())});var on=p({...K.shape,...V(N(a(),D()),"OBJECT").shape});var Wi=p({...K.shape,...V(a(),"COLOR").shape});var an=L([ve,Oe,ur,ke,xe,we,Gr,At,Wr,Re,wt,on,kt,Ot,zt,Wi]),q={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 Se=p({displayName:a(),description:h(a())});var qi=p({username:a(),password:a()}),sn=p({...Se.shape,username:p({displayName:a(),description:h(a())}),password:p({displayName:a(),description:h(a())}),...V(qi,"BASIC_AUTH").shape});var ql=N(a(),L([ve,Oe,Re,ke,xe])),un=p({...Se.shape,props:ql,...V(D(),"CUSTOM_AUTH").shape});var Ye=p({...Se.shape,...V(p({auth:a()}),"SECRET_TEXT").shape});var Kl=N(a(),L([ve,Oe,Ye,Re,ke,xe,we,ur])),Ki=p({...Se.shape,props:Kl,...V(D(),"OIDC").shape});var cn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(cn||{}),Ji=L([ve,Ye,xe]),Xi=N(a(),Ji),Jl=p({props:h(N(a(),Ji)),authUrl:a(),tokenUrl:a(),scope:M(a()),prompt:h(L([O("none"),O("consent"),O("login"),O("omit")])),pkce:h(J()),pkceMethod:h(L([O("plain"),O("S256")])),authorizationMethod:h(H(cn)),grantType:h(L([H(Dt),O(qr)])),extra:h(N(a(),a()))}),Yi=p({access_token:a(),props:h(Xi),data:N(a(),Et())}),ln=p({...Se.shape,...Jl.shape,...V(Yi,"OAUTH2").shape});var ct=L([sn,un,Ki,ln,Ye]),Lt="Connection",pn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Lt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Lt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Lt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Lt}},None(){}};var i$={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 Xl=p({...K.shape,...V(D(),"CUSTOM").shape,code:a()});var Yl=L([an,ct]),dn=N(a(),Yl),E$=N(a(),an);var Qi=L([p({strategy:O("CRON"),cronExpression:a()}),p({strategy:O("NONE")})]),lt=class{constructor(t,r,n,i,u,c,l,f,g,v,I,_,s,d,y,m,x,P,j){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=u;this.type=c;this.handshakeConfiguration=l;this.onHandshake=f;this.renewConfiguration=g;this.onRenew=v;this.onEnable=I;this.onDisable=_;this.onStart=s;this.run=d;this.test=y;this.sampleData=m;this.testStrategy=x;this.outputSchema=P;this.aiMetadata=j}static{o(this,"ITrigger")}},mr=o(e=>{switch(e.type){case"WEBHOOK":return new lt(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 lt(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 lt(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 lt(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,ue(e.sampleData)&&ue(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var ea="2",fr="0.82.0";var mn=class{constructor(t,r,n,i,u,c,l,f,g=fr,v,I="",_){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=l;this.auth=f;this.minimumSupportedRelease=g;this.maximumSupportedRelease=v;this.description=I;this.deprecated=_;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:ea}),"getContextInfo");(!Ql(g)||ep(g,fr))&&(this.minimumSupportedRelease=fr),u.forEach(s=>this._actions[s.name]=s),c.forEach(s=>this._triggers[s.name]=s)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},ta=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(u=>u.type===r.type)))throw new Error("Auth properties must be unique by type");return new mn(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 Ql(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Ql,"isValidSimpleSemver");function ep(e,t){let[r,n,i]=e.split(".").map(Number),[u,c,l]=t.split(".").map(Number);return r!==u?r<u:n!==c?n<c:i<l}o(ep,"isSemverLessThan");var tp=h(N(a(),N(a(),a()))),ra=p({id:h(a()),name:a(),displayName:a(),logoUrl:a(),description:a(),authors:M(a()),platformId:h(a()),directoryPath:h(a()),auth:h(L([ct,M(ct)])),version:a(),categories:h(M(H(at))),minimumSupportedRelease:h(a()),maximumSupportedRelease:h(a()),deprecated:h(J()),i18n:tp}),rp=H(["human","ai","both"]),na=p({description:h(a()),idempotent:h(J())}),oa=p({name:a(),displayName:a(),description:a(),props:dn,requireAuth:J(),errorHandlingOptions:h(Hr),outputSchema:h(ar()),audience:h(rp),aiMetadata:h(na)}),ia=p({name:a(),displayName:a(),description:a(),props:dn,errorHandlingOptions:h(Hr),type:H(De),sampleData:D(),handshakeConfiguration:h(ar()),renewConfiguration:h(Qi),testStrategy:H(Ct),outputSchema:h(ar()),aiMetadata:h(na)}),np=p({...ra.shape,actions:N(a(),oa),triggers:N(a(),ia)}),op=p({...ra.shape,actions:ge(),triggers:ge(),suggestedActions:h(M(oa)),suggestedTriggers:h(M(ia))}),aa=p({projectUsage:ge(),pieceType:H(it),packageType:H(Rt),platformId:h(a()),archiveId:h(a())}),ES=p({...np.shape,...aa.shape}),$S=p({...op.shape,...aa.shape}),SS=p({name:a(),version:a()});var ip=Ue(require("path")),ap=Ue(require("fs/promises"));var la=require("node:stream");var gr=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((u,c)=>{i.append(c,u)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(t){let r={Accept:"application/json"};return t.authentication&&this.populateAuthentication(t.authentication,r),t.body&&(t.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var yr=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new fn,r=new gn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},fn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},gn=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var jt=class extends Error{constructor(r,n){let i=n.status||500,u=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:u},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=u}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function sa({error:e,requestBody:t}){return e instanceof jt?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}o(sa,"toFailsafeOutput");var Ft=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(Ft||{});var hr=class extends gr{static{o(this,"FetchHttpClient")}constructor(t="",r=new yr){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),u=this.getHeaders(t),c=t.queryParams??{};for(let[j,oe]of Object.entries(c))i.append(j,oe);let l=i.toString(),f=l?`${n}?${l}`:n,g=t.responseType??"json",v=t.followRedirects??!0,I=t.retries??0,{body:_,extraHeaders:s,isStream:d}=sp(t.method)?up(t.body,u):{body:void 0,extraHeaders:{},isStream:!1},y=lp({...u,...s}),m=await cp(async()=>{let j=new AbortController,oe=t.timeout&&t.timeout>0?setTimeout(()=>j.abort(),t.timeout):void 0;try{let fe={method:t.method.toString(),headers:y,body:_,redirect:v?"follow":"manual",signal:j.signal};return d&&(fe.duplex="half"),r?.dispatcher!==void 0&&(fe.dispatcher=r.dispatcher),await fetch(f,fe)}finally{oe!==void 0&&clearTimeout(oe)}},I),x=v?300:400;if(m.status<200||m.status>=x){let j=await ua(m,g),oe=new jt(t.body,{status:m.status,responseBody:j});throw console.error("[HttpClient#(sanitized error message)] Request failed:",oe),oe}let P=await ua(m,g);return{status:m.status,headers:pp(m.headers),body:P}}};function sp(e){return e!=="GET"&&e!=="HEAD"}o(sp,"acceptsRequestBody");function up(e,t){if(mp(e))return{body:void 0,extraHeaders:{},isStream:!1};if(dp(e)){let n=new la.PassThrough;return e.on("error",i=>n.destroy(i)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(up,"serializeBody");async function ua(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(ua,"parseResponseBody");async function cp(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await ca(n);continue}return i}catch(i){if(r=i,n<t){await ca(n);continue}throw i}throw r}o(cp,"sendWithRetries");function ca(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(ca,"backoff");function lp(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return t}o(lp,"normalizeHeaders");function pp(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(pp,"toHttpHeaders");function dp(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}o(dp,"isNodeFormData");function mp(e){return e==null}o(mp,"isNil");var vr=new hr;var em=Ue(require("fs")),yu=Ue(gu());var tm={"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 rm(e){let t=e.split(";")[0].trim().toLowerCase();return tm[t]??""}o(rm,"contentTypeToExtension");var nm=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),om=o((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function hu({auth:e,baseUrl:t,authMapping:r,description:n,displayName:i,name:u,props:c,extraProps:l,authLocation:f="headers"}){return ot({audience:"human",name:u||"custom_api_call",displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:q.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:g})=>({url:q.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
+ i.e ${om(t,g)}/resource or /resource`,required:!0,defaultValue:g?t(g):"",...c?.url??{}})}),"props")}),method:q.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Ft).map(g=>({label:g,value:g}))},...c?.method??{}}),headers:q.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:q.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:q.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:q.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:g})=>{if(!g)return{};let v=g,I={};switch(v){case"none":break;case"json":I.data=q.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":I.data=q.LongText({displayName:"Raw Body",required:!0});break;case"form_data":I.data=q.Array({displayName:"Form Data",required:!0,properties:{fieldName:q.ShortText({displayName:"Field Name",required:!0}),fieldType:q.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:q.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:q.File({displayName:"File Field Value",required:!1})}});break}return I},"props")}),response_is_binary:q.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:q.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:q.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:q.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...l},run:o(async g=>{let{method:v,url:I,headers:_,queryParams:s,body:d,body_type:y,failsafe:m,timeout:x,response_is_binary:P,followRedirects:j}=g.propsValue;lr(v,"Method"),lr(I,"URL");let oe=ue(r)?{}:await r(g.auth,g.propsValue),fe=I.url,Te=fe.startsWith("http://")||fe.startsWith("https://")?fe:nm({baseUrl:t(g.auth),relativePath:fe}),X={method:v,url:Te,headers:{..._??{},...f==="headers"||!ue(f)?oe:{}},queryParams:{...f==="queryParams"?oe:{},...s??{}},timeout:x?x*1e3:0,followRedirects:j};if(P&&(X.responseType="arraybuffer"),d)if(y&&y!=="none"){let Z=d.data;if(y==="form_data"){let et=Z,We=new yu.default;for(let{fieldName:U,fieldType:T,textFieldValue:b,fileFieldValue:S}of et)T==="text"&&!Ut(b)?We.append(U,b):T==="file"&&!Ut(S)&&We.append(U,S.data,{filename:S?.filename});X.body=We,X.headers={...X.headers,...We.getHeaders()}}else X.body=Z}else y||(X.body=d);try{let Z=await vr.sendRequest(X);return await im(g.files,Z.body,Z.status,Z.headers,P)}catch(Z){if(m)return sa({error:Z,requestBody:X.body});throw Z}},"run")})}o(hu,"createCustomApiCallAction");var im=o(async(e,t,r,n,i)=>{let u;if(i&&am(t)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],l=rm(c??"")||"txt",f;t instanceof ArrayBuffer?f=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?f=t:f=Buffer.from(t),u=await e.write({fileName:`output.${l}`,data:f})}else u=t;return{status:r,headers:n,body:u}},"handleBinaryResponse"),am=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var Ae={async poll(e,{store:t,auth:r,propsValue:n,maxItemsToPoll:i,files:u,server:c}){switch(e.strategy){case 0:{let l=await t.get("lastPoll");if(ue(l))throw new Error("lastPoll doesn't exist in the store.");let f=await e.items({store:t,auth:r,propsValue:n,lastFetchEpochMS:l,server:c}),g=f.reduce((v,I)=>Math.max(v,I.epochMilliSeconds),l);return await t.put("lastPoll",g),f.filter(v=>v.epochMilliSeconds>l).map(v=>v.data)}case 1:{let l=await t.get("lastItem"),f=await e.items({store:t,auth:r,propsValue:n,lastItemId:l,files:u,server:c}),g=f.findIndex(_=>_.id===l),v=[];ue(l)||g==-1?v=f??[]:v=f?.slice(0,g)??[],ue(i)||(v=v.slice(-i));let I=v?.[0]?.id;return ue(I)||await t.put("lastItem",I),v.map(_=>_.data)}}},async onEnable(e,{store:t,auth:r,propsValue:n,server:i}){switch(e.strategy){case 0:{await t.put("lastPoll",Date.now());break}case 1:{let c=(await e.items({store:t,auth:r,propsValue:n,lastItemId:null,server:i}))?.[0]?.id;ue(c)?await t.delete("lastItem"):await t.put("lastItem",c);break}}},async onDisable(e,t){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:t,propsValue:r,store:n,files:i,server:u}){let c=[];switch(e.strategy){case 0:{c=await e.items({store:n,auth:t,propsValue:r,lastFetchEpochMS:0,server:u});break}case 1:{c=await e.items({store:n,auth:t,propsValue:r,lastItemId:null,files:i,server:u});break}}return sm(c.map(l=>l.data))}};function sm(e){return e.length<=5?e:e.slice(0,5)}o(sm,"getFirstFiveOrAll");var um={baseUrl:"https://api.chatling.ai/v2"};async function de(e,t,r,n){return(await vr.sendRequest({method:t,url:`${um.baseUrl}${r}`,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:n})).body}o(de,"makeRequest");var cm=`
14
4
  To obtain your API key:
15
5
 
16
6
  1. Go to your [Chatling account](https://app.chatling.ai)
@@ -18,28 +8,14 @@ To obtain your API key:
18
8
  3. Click the **API Keys** tab
19
9
  4. Press **New API key** and generate a new key
20
10
  5. Copy the key (it's only shown once)
21
- `;
22
- exports.chatling = (0, pieces_framework_1.createPiece)({
23
- displayName: 'Chatling',
24
- description: 'Build AI chatbots trained on your data.',
25
- auth: auth_1.chatlingAuth,
26
- minimumSupportedRelease: '0.36.1',
27
- logoUrl: 'https://cdn.activepieces.com/pieces/chatling.png',
28
- categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
29
- authors: ['onyedikachi-david'],
30
- actions: [
31
- send_message_1.sendMessage,
32
- create_chatbot_1.createChatbot,
33
- (0, pieces_common_1.createCustomApiCallAction)({
34
- auth: auth_1.chatlingAuth,
35
- baseUrl: () => 'https://api.chatling.ai/v2',
36
- authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
- return ({
38
- Authorization: `Bearer ${auth.secret_text}`,
39
- });
40
- }),
41
- }),
42
- ],
43
- triggers: [new_conversation_1.newConversation, new_contact_1.newContact],
44
- });
45
- //# sourceMappingURL=index.js.map
11
+ `,pe=pn.SecretText({displayName:"API Key",description:cm,required:!0,validate:o(async({auth:e})=>{try{return await de(e,"GET","/project/settings"),{valid:!0}}catch{return{valid:!1,error:"Invalid API key"}}},"validate")});var yt=q.Dropdown({auth:pe,displayName:"Chatbot",description:"Select a chatbot",required:!0,refreshers:[],options:o(async({auth:e})=>e?{disabled:!1,options:(await de(e.secret_text,"GET","/chatbots")).data.chatbots.map(n=>({label:n.name,value:n.id}))}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")}),vu=q.Dropdown({auth:pe,displayName:"AI Model",description:"Select the AI model to use",required:!0,refreshers:["chatbotId"],options:o(async({auth:e,chatbotId:t})=>e?t?{disabled:!1,options:(await de(e.secret_text,"GET",`/chatbots/${t}/ai/kb/models`)).data.models.map(i=>({label:i.name,value:i.id}))}:{disabled:!0,placeholder:"Please select a chatbot first.",options:[]}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")}),xu=q.Dropdown({auth:pe,displayName:"Language",description:"Select the language for the AI response",required:!1,refreshers:["chatbotId"],options:o(async({auth:e,chatbotId:t})=>e?t?{disabled:!1,options:(await de(e.secret_text,"GET",`/chatbots/${t}/ai/kb/languages`)).data.languages.map(i=>({label:i.name,value:i.id}))}:{disabled:!0,placeholder:"Please select a chatbot first.",options:[]}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")}),_u=q.Dropdown({auth:pe,displayName:"Contact",description:"Associate the conversation with a contact",required:!1,refreshers:["chatbotId"],options:o(async({auth:e,chatbotId:t})=>e?t?{disabled:!1,options:(await de(e.secret_text,"GET",`/chatbots/${t}/contacts`)).data.contacts.map(i=>({label:i.name||i.email||i.id,value:i.id}))}:{disabled:!0,placeholder:"Please select a chatbot first.",options:[]}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")}),Pu=q.Dropdown({auth:pe,displayName:"Template",description:"Use a template to create the chatbot",required:!1,refreshers:[],options:o(async({auth:e})=>e?{disabled:!1,options:(await de(e.secret_text,"GET","/chatbot-templates")).data.templates.map(n=>({label:n.name,value:n.id}))}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")}),bu=q.Dropdown({auth:pe,displayName:"Conversation",description:"Continue an existing conversation",required:!1,refreshers:["chatbotId"],options:o(async({auth:e,chatbotId:t})=>e?t?{disabled:!1,options:(await de(e.secret_text,"GET",`/chatbots/${t}/conversations`)).data.conversations.map(i=>{let u=i.messages?.find(l=>l.role==="user");return{label:u?.text?u.text.substring(0,50)+(u.text.length>50?"...":""):i.created_at,value:i.id}})}:{disabled:!0,placeholder:"Please select a chatbot first.",options:[]}:{disabled:!0,placeholder:"Please connect your account first.",options:[]},"options")});var Iu=ot({auth:pe,name:"send_message",displayName:"Send Message",description:"Send a message to the chatbot and receive an AI response.",audience:"both",aiMetadata:{description:"Send a user message to a specific Chatling chatbot and get back the AI-generated reply, querying the bot's knowledge base. Use to converse with or test a deployed chatbot programmatically. Requires the chatbot ID and message; optionally pass a conversation_id to continue an existing thread (omit it to start a new one) and tune the AI model, language, temperature, or extra instructions. Not idempotent \u2014 each call generates a fresh response and appends to the conversation.",idempotent:!1},props:{chatbotId:yt,message:q.LongText({displayName:"Message",description:"The message to send to the AI",required:!0}),ai_model_id:vu,conversation_id:bu,contact_id:_u,language_id:xu,temperature:q.Number({displayName:"Temperature",description:"Controls randomness (0 = focused, 1 = creative). Default is 0.",required:!1,defaultValue:0}),instructions:q.Array({displayName:"Instructions",description:"Additional instructions to tailor the AI response",required:!1})},async run(e){let{chatbotId:t,message:r,ai_model_id:n,conversation_id:i,contact_id:u,language_id:c,temperature:l,instructions:f}=e.propsValue,g=e.auth.secret_text,v={message:r,ai_model_id:n};return i&&(v.conversation_id=i),u&&(v.contact_id=u),c&&(v.language_id=c),l!=null&&(v.temperature=l),f&&f.length>0&&(v.instructions=f),await de(g,"POST",`/chatbots/${t}/ai/kb/chat`,v)}});var Tu=ot({auth:pe,name:"create_chatbot",displayName:"Create Chatbot",description:"Create a new chatbot using a template or from scratch.",audience:"both",aiMetadata:{description:"Create a new Chatling chatbot in the account, either seeded from an existing template or built from scratch when no template is given. Use when an agent needs to provision a new bot. Requires a name; the template ID is optional. Not idempotent \u2014 each call creates a separate chatbot, even with identical input.",idempotent:!1},props:{name:q.ShortText({displayName:"Name",description:"The name of the chatbot",required:!0}),template_id:Pu},async run(e){let{name:t,template_id:r}=e.propsValue,n=e.auth.secret_text,i={name:t};return r&&(i.template_id=r),await de(n,"POST","/chatbots",i)}});var Ln=Ue(Mn());var Ar={strategy:0,items:o(async({auth:e,propsValue:t,lastFetchEpochMS:r})=>(await de(e.secret_text,"GET",`/chatbots/${t.chatbotId}/conversations?sort=date_desc`)).data.conversations.filter(c=>r===0?!0:(0,Ln.default)(c.created_at).valueOf()>r).map(c=>({epochMilliSeconds:(0,Ln.default)(c.created_at).valueOf(),data:c})),"items")},Eu=mr({auth:pe,name:"new_conversation",displayName:"New Conversation",description:"Triggers when a new conversation is started by a customer.",aiMetadata:{description:"Fires when a customer starts a new conversation with the selected Chatling chatbot. Each event represents one newly created conversation, including its contact and initial messages. Polls the chatbot's conversations on an interval, deduplicating by creation time."},props:{chatbotId:yt},type:"POLLING",async onEnable(e){await Ae.onEnable(Ar,{auth:e.auth,store:e.store,propsValue:e.propsValue})},async onDisable(e){await Ae.onDisable(Ar,{auth:e.auth,store:e.store,propsValue:e.propsValue})},async test(e){return await Ae.test(Ar,e)},async run(e){return await Ae.poll(Ar,e)},sampleData:{id:"conv_abc123",contact_id:"contact_xyz",archived:!1,important:!1,created_at:"2024-01-15T10:30:00.000Z",messages:[{id:"msg_1",text:"Hello, I need help with your product.",role:"user"}]}});var jn=Ue(Mn());var zr={strategy:0,items:o(async({auth:e,propsValue:t,lastFetchEpochMS:r})=>(await de(e.secret_text,"GET",`/chatbots/${t.chatbotId}/contacts?sort=date_desc`)).data.contacts.filter(c=>r===0?!0:(0,jn.default)(c.created_at).valueOf()>r).map(c=>({epochMilliSeconds:(0,jn.default)(c.created_at).valueOf(),data:c})),"items")},$u=mr({auth:pe,name:"new_contact",displayName:"New Contact/Lead",description:"Triggers when a new contact or lead is collected by the chatbot.",aiMetadata:{description:"Fires when the selected Chatling chatbot collects a new contact or lead. Each event represents one newly captured contact with its details (name, email, phone, company, and similar fields). Polls the chatbot's contacts on an interval, deduplicating by creation time."},props:{chatbotId:yt},type:"POLLING",async onEnable(e){await Ae.onEnable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},async onDisable(e){await Ae.onDisable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},async test(e){return await Ae.test(zr,e)},async run(e){return await Ae.poll(zr,e)},sampleData:{id:"contact_abc123",name:"John Doe",email:"john@example.com",phone:"+1234567890",job_title:"Product Manager",website:"https://example.com",company:"Acme Inc",created_at:"2024-01-15T10:30:00.000Z"}});var pm=ta({displayName:"Chatling",description:"Build AI chatbots trained on your data.",auth:pe,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/chatling.png",categories:["ARTIFICIAL_INTELLIGENCE"],authors:["onyedikachi-david"],actions:[Iu,Tu,hu({auth:pe,baseUrl:o(()=>"https://api.chatling.ai/v2","baseUrl"),authMapping:o(async e=>({Authorization:`Bearer ${e.secret_text}`}),"authMapping")})],triggers:[Eu,$u]});0&&(module.exports={chatling});
12
+ /*! Bundled license information:
13
+
14
+ mime-types/index.js:
15
+ (*!
16
+ * mime-types
17
+ * Copyright(c) 2014 Jonathan Ong
18
+ * Copyright(c) 2015 Douglas Christopher Wilson
19
+ * MIT Licensed
20
+ *)
21
+ */
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const chatling: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,QAAQ,mHAoBnB,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,qEAAwE;AACxE,iDAAqD;AAErD,6DAAyD;AACzD,iEAA6D;AAC7D,sEAAkE;AAClE,4DAAwD;AACxD,qCAA0C;AAE1C,MAAM,mBAAmB,GAAG;;;;;;;;CAQ3B,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,yCAAyC;IACtD,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,OAAO,EAAE;QACP,0BAAW;QACX,8BAAa;QACb,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,mBAAY;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,4BAA4B;YAC3C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAW,IAAgC,CAAC,WAAW,EAAE;iBACzE,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,kCAAe,EAAE,wBAAU,CAAC;CACxC,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare const createChatbot: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
- name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- template_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- }>;
5
- //# sourceMappingURL=create-chatbot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-chatbot.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-chatbot.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;EAqCxB,CAAC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createChatbot = 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 auth_1 = require("../auth");
8
- const common_1 = require("../common");
9
- const props_1 = require("../common/props");
10
- exports.createChatbot = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.chatlingAuth,
12
- name: 'create_chatbot',
13
- displayName: 'Create Chatbot',
14
- description: 'Create a new chatbot using a template or from scratch.',
15
- audience: 'both',
16
- aiMetadata: {
17
- description: 'Create a new Chatling chatbot in the account, either seeded from an existing template or built from scratch when no template is given. Use when an agent needs to provision a new bot. Requires a name; the template ID is optional. Not idempotent — each call creates a separate chatbot, even with identical input.',
18
- idempotent: false,
19
- },
20
- props: {
21
- name: pieces_framework_1.Property.ShortText({
22
- displayName: 'Name',
23
- description: 'The name of the chatbot',
24
- required: true,
25
- }),
26
- template_id: props_1.templateIdDropdown,
27
- },
28
- run(context) {
29
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
- const { name, template_id } = context.propsValue;
31
- const apiKey = context.auth.secret_text;
32
- const body = { name };
33
- if (template_id)
34
- body['template_id'] = template_id;
35
- const response = yield (0, common_1.makeRequest)(apiKey, pieces_common_1.HttpMethod.POST, '/chatbots', body);
36
- return response;
37
- });
38
- },
39
- });
40
- //# sourceMappingURL=create-chatbot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-chatbot.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-chatbot.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAuC;AACvC,sCAAwC;AACxC,2CAAqD;AAExC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,wTAAwT;QAC1T,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,0BAAkB;KAChC;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACjD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,CAAC;YAE/C,IAAI,WAAW;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;YAEnD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,MAAM,EACN,0BAAU,CAAC,IAAI,EACf,WAAW,EACX,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare const sendMessage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
- message: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
- ai_model_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
5
- conversation_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
- contact_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
7
- language_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
- temperature: import("@activepieces/pieces-framework").NumberProperty<false>;
9
- instructions: import("@activepieces/pieces-framework").ArrayProperty<false>;
10
- }>;
11
- //# sourceMappingURL=send-message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/send-message.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW;;;;;;;;;EAwEtB,CAAC"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendMessage = 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 auth_1 = require("../auth");
8
- const common_1 = require("../common");
9
- const props_1 = require("../common/props");
10
- exports.sendMessage = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.chatlingAuth,
12
- name: 'send_message',
13
- displayName: 'Send Message',
14
- description: 'Send a message to the chatbot and receive an AI response.',
15
- audience: 'both',
16
- aiMetadata: {
17
- description: 'Send a user message to a specific Chatling chatbot and get back the AI-generated reply, querying the bot\'s knowledge base. Use to converse with or test a deployed chatbot programmatically. Requires the chatbot ID and message; optionally pass a conversation_id to continue an existing thread (omit it to start a new one) and tune the AI model, language, temperature, or extra instructions. Not idempotent — each call generates a fresh response and appends to the conversation.',
18
- idempotent: false,
19
- },
20
- props: {
21
- chatbotId: props_1.chatbotIdDropdown,
22
- message: pieces_framework_1.Property.LongText({
23
- displayName: 'Message',
24
- description: 'The message to send to the AI',
25
- required: true,
26
- }),
27
- ai_model_id: props_1.aiModelIdDropdown,
28
- conversation_id: props_1.conversationIdDropdown,
29
- contact_id: props_1.contactIdDropdown,
30
- language_id: props_1.languageIdDropdown,
31
- temperature: pieces_framework_1.Property.Number({
32
- displayName: 'Temperature',
33
- description: 'Controls randomness (0 = focused, 1 = creative). Default is 0.',
34
- required: false,
35
- defaultValue: 0,
36
- }),
37
- instructions: pieces_framework_1.Property.Array({
38
- displayName: 'Instructions',
39
- description: 'Additional instructions to tailor the AI response',
40
- required: false,
41
- }),
42
- },
43
- run(context) {
44
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
- const { chatbotId, message, ai_model_id, conversation_id, contact_id, language_id, temperature, instructions, } = context.propsValue;
46
- const apiKey = context.auth.secret_text;
47
- const body = {
48
- message,
49
- ai_model_id,
50
- };
51
- if (conversation_id)
52
- body['conversation_id'] = conversation_id;
53
- if (contact_id)
54
- body['contact_id'] = contact_id;
55
- if (language_id)
56
- body['language_id'] = language_id;
57
- if (temperature !== undefined && temperature !== null)
58
- body['temperature'] = temperature;
59
- if (instructions && instructions.length > 0)
60
- body['instructions'] = instructions;
61
- const response = yield (0, common_1.makeRequest)(apiKey, pieces_common_1.HttpMethod.POST, `/chatbots/${chatbotId}/ai/kb/chat`, body);
62
- return response;
63
- });
64
- },
65
- });
66
- //# sourceMappingURL=send-message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-message.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAuC;AACvC,sCAAwC;AACxC,2CAMyB;AAEZ,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,8dAA8d;QAChe,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,yBAAiB;QAC5B,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,yBAAiB;QAC9B,eAAe,EAAE,8BAAsB;QACvC,UAAU,EAAE,yBAAiB;QAC7B,WAAW,EAAE,0BAAkB;QAC/B,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EACT,gEAAgE;YAClE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC3B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,EACJ,SAAS,EACT,OAAO,EACP,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,GACb,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,IAAI,GAA4B;gBACpC,OAAO;gBACP,WAAW;aACZ,CAAC;YAEF,IAAI,eAAe;gBAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,eAAe,CAAC;YAC/D,IAAI,UAAU;gBAAE,IAAI,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;YAChD,IAAI,WAAW;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;YACnD,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI;gBACnD,IAAI,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;YACpC,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;gBACzC,IAAI,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;YAEtC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,MAAM,EACN,0BAAU,CAAC,IAAI,EACf,aAAa,SAAS,aAAa,EACnC,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
package/src/lib/auth.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const chatlingAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
2
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,YAAY,mEAevB,CAAC"}
package/src/lib/auth.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chatlingAuth = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const common_1 = require("./common");
8
- const markdownDescription = `
9
- To obtain your API key:
10
-
11
- 1. Go to your [Chatling account](https://app.chatling.ai)
12
- 2. Open **Project Settings**
13
- 3. Click the **API Keys** tab
14
- 4. Press **New API key** and generate a new key
15
- 5. Copy the key (it's only shown once)
16
- `;
17
- exports.chatlingAuth = pieces_framework_1.PieceAuth.SecretText({
18
- displayName: 'API Key',
19
- description: markdownDescription,
20
- required: true,
21
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
22
- try {
23
- yield (0, common_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/project/settings');
24
- return { valid: true };
25
- }
26
- catch (e) {
27
- return {
28
- valid: false,
29
- error: 'Invalid API key',
30
- };
31
- }
32
- }),
33
- });
34
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAyD;AACzD,qCAAuC;AAEvC,MAAM,mBAAmB,GAAG;;;;;;;;CAQ3B,CAAC;AAEW,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,IAAA,oBAAW,EAAC,IAAI,EAAE,0BAAU,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;YAC7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,iBAAiB;aACzB,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { HttpMethod } from '@activepieces/pieces-common';
2
- export declare const chatlingCommon: {
3
- baseUrl: string;
4
- };
5
- export declare function makeRequest<T = unknown>(apiKey: string, method: HttpMethod, path: string, body?: unknown): Promise<T>;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,6BAA6B,CAAC;AAErE,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAEF,wBAAsB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chatlingCommon = void 0;
4
- exports.makeRequest = makeRequest;
5
- const tslib_1 = require("tslib");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- exports.chatlingCommon = {
8
- baseUrl: 'https://api.chatling.ai/v2',
9
- };
10
- function makeRequest(apiKey, method, path, body) {
11
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
- const response = yield pieces_common_1.httpClient.sendRequest({
13
- method,
14
- url: `${exports.chatlingCommon.baseUrl}${path}`,
15
- headers: {
16
- Authorization: `Bearer ${apiKey}`,
17
- 'Content-Type': 'application/json',
18
- },
19
- body,
20
- });
21
- return response.body;
22
- });
23
- }
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAMA,kCAiBC;;AAvBD,+DAAqE;AAExD,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,4BAA4B;CACtC,CAAC;AAEF,SAAsB,WAAW,CAC/B,MAAc,EACd,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAI;YAC/C,MAAM;YACN,GAAG,EAAE,GAAG,sBAAc,CAAC,OAAO,GAAG,IAAI,EAAE;YACvC,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,EAAE;gBACjC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI;SACL,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA"}
@@ -1,7 +0,0 @@
1
- export declare const chatbotIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
2
- export declare const aiModelIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
- export declare const languageIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- export declare const contactIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
5
- export declare const templateIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
- export declare const conversationIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
7
- //# sourceMappingURL=props.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,4IAiC5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,4IA6C5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,6IA6C7B,CAAC;AAEH,eAAO,MAAM,iBAAiB,6IA6C5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,6IAiC7B,CAAC;AAEH,eAAO,MAAM,sBAAsB,6IAwDjC,CAAC"}
@@ -1,195 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.conversationIdDropdown = exports.templateIdDropdown = exports.contactIdDropdown = exports.languageIdDropdown = exports.aiModelIdDropdown = exports.chatbotIdDropdown = 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 index_1 = require("./index");
8
- const auth_1 = require("../auth");
9
- exports.chatbotIdDropdown = pieces_framework_1.Property.Dropdown({
10
- auth: auth_1.chatlingAuth,
11
- displayName: 'Chatbot',
12
- description: 'Select a chatbot',
13
- required: true,
14
- refreshers: [],
15
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
16
- if (!auth) {
17
- return {
18
- disabled: true,
19
- placeholder: 'Please connect your account first.',
20
- options: [],
21
- };
22
- }
23
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/chatbots');
24
- const options = response.data.chatbots.map((chatbot) => ({
25
- label: chatbot.name,
26
- value: chatbot.id,
27
- }));
28
- return {
29
- disabled: false,
30
- options,
31
- };
32
- }),
33
- });
34
- exports.aiModelIdDropdown = pieces_framework_1.Property.Dropdown({
35
- auth: auth_1.chatlingAuth,
36
- displayName: 'AI Model',
37
- description: 'Select the AI model to use',
38
- required: true,
39
- refreshers: ['chatbotId'],
40
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, chatbotId }) {
41
- if (!auth) {
42
- return {
43
- disabled: true,
44
- placeholder: 'Please connect your account first.',
45
- options: [],
46
- };
47
- }
48
- if (!chatbotId) {
49
- return {
50
- disabled: true,
51
- placeholder: 'Please select a chatbot first.',
52
- options: [],
53
- };
54
- }
55
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${chatbotId}/ai/kb/models`);
56
- const options = response.data.models.map((model) => ({
57
- label: model.name,
58
- value: model.id,
59
- }));
60
- return {
61
- disabled: false,
62
- options,
63
- };
64
- }),
65
- });
66
- exports.languageIdDropdown = pieces_framework_1.Property.Dropdown({
67
- auth: auth_1.chatlingAuth,
68
- displayName: 'Language',
69
- description: 'Select the language for the AI response',
70
- required: false,
71
- refreshers: ['chatbotId'],
72
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, chatbotId }) {
73
- if (!auth) {
74
- return {
75
- disabled: true,
76
- placeholder: 'Please connect your account first.',
77
- options: [],
78
- };
79
- }
80
- if (!chatbotId) {
81
- return {
82
- disabled: true,
83
- placeholder: 'Please select a chatbot first.',
84
- options: [],
85
- };
86
- }
87
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${chatbotId}/ai/kb/languages`);
88
- const options = response.data.languages.map((language) => ({
89
- label: language.name,
90
- value: language.id,
91
- }));
92
- return {
93
- disabled: false,
94
- options,
95
- };
96
- }),
97
- });
98
- exports.contactIdDropdown = pieces_framework_1.Property.Dropdown({
99
- auth: auth_1.chatlingAuth,
100
- displayName: 'Contact',
101
- description: 'Associate the conversation with a contact',
102
- required: false,
103
- refreshers: ['chatbotId'],
104
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, chatbotId }) {
105
- if (!auth) {
106
- return {
107
- disabled: true,
108
- placeholder: 'Please connect your account first.',
109
- options: [],
110
- };
111
- }
112
- if (!chatbotId) {
113
- return {
114
- disabled: true,
115
- placeholder: 'Please select a chatbot first.',
116
- options: [],
117
- };
118
- }
119
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${chatbotId}/contacts`);
120
- const options = response.data.contacts.map((contact) => ({
121
- label: contact.name || contact.email || contact.id,
122
- value: contact.id,
123
- }));
124
- return {
125
- disabled: false,
126
- options,
127
- };
128
- }),
129
- });
130
- exports.templateIdDropdown = pieces_framework_1.Property.Dropdown({
131
- auth: auth_1.chatlingAuth,
132
- displayName: 'Template',
133
- description: 'Use a template to create the chatbot',
134
- required: false,
135
- refreshers: [],
136
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
137
- if (!auth) {
138
- return {
139
- disabled: true,
140
- placeholder: 'Please connect your account first.',
141
- options: [],
142
- };
143
- }
144
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/chatbot-templates');
145
- const options = response.data.templates.map((template) => ({
146
- label: template.name,
147
- value: template.id,
148
- }));
149
- return {
150
- disabled: false,
151
- options,
152
- };
153
- }),
154
- });
155
- exports.conversationIdDropdown = pieces_framework_1.Property.Dropdown({
156
- auth: auth_1.chatlingAuth,
157
- displayName: 'Conversation',
158
- description: 'Continue an existing conversation',
159
- required: false,
160
- refreshers: ['chatbotId'],
161
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, chatbotId }) {
162
- if (!auth) {
163
- return {
164
- disabled: true,
165
- placeholder: 'Please connect your account first.',
166
- options: [],
167
- };
168
- }
169
- if (!chatbotId) {
170
- return {
171
- disabled: true,
172
- placeholder: 'Please select a chatbot first.',
173
- options: [],
174
- };
175
- }
176
- const response = yield (0, index_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${chatbotId}/conversations`);
177
- const options = response.data.conversations.map((conv) => {
178
- var _a;
179
- const firstUserMsg = (_a = conv.messages) === null || _a === void 0 ? void 0 : _a.find((m) => m.role === 'user');
180
- const preview = (firstUserMsg === null || firstUserMsg === void 0 ? void 0 : firstUserMsg.text)
181
- ? firstUserMsg.text.substring(0, 50) +
182
- (firstUserMsg.text.length > 50 ? '...' : '')
183
- : conv.created_at;
184
- return {
185
- label: preview,
186
- value: conv.id,
187
- };
188
- });
189
- return {
190
- disabled: false,
191
- options,
192
- };
193
- }),
194
- });
195
- //# sourceMappingURL=props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA0E;AAC1E,mCAAsC;AACtC,kCAAuC;AAE1B,QAAA,iBAAiB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,kBAAkB;IAC/B,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAI/B,IAAI,CAAC,WAAW,EAAE,0BAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAElD,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAClE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,IAAI;YACnB,KAAK,EAAE,OAAO,CAAC,EAAE;SAClB,CAAC,CACH,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,4BAA4B;IACzC,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,KAA4B,EAAE,oDAAvB,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAKhC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,SAAS,eAAe,CACtC,CAAC;QAEF,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAChE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACV,KAAK,EAAE,KAAK,CAAC,IAAI;YACjB,KAAK,EAAE,KAAK,CAAC,EAAE;SAChB,CAAC,CACH,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAClD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,KAA4B,EAAE,oDAAvB,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAKhC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,SAAS,kBAAkB,CACzC,CAAC;QAEF,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,QAAQ,CAAC,IAAI;YACpB,KAAK,EAAE,QAAQ,CAAC,EAAE;SACnB,CAAC,CACH,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,KAA4B,EAAE,oDAAvB,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAKhC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,SAAS,WAAW,CAClC,CAAC;QAEF,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAClE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,EAAE;YAClD,KAAK,EAAE,OAAO,CAAC,EAAE;SAClB,CAAC,CACH,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAClD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,sCAAsC;IACnD,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAI/B,IAAI,CAAC,WAAW,EAAE,0BAAU,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;QAE3D,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CACnE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,QAAQ,CAAC,IAAI;YACpB,KAAK,EAAE,QAAQ,CAAC,EAAE;SACnB,CAAC,CACH,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACtD,IAAI,EAAE,mBAAY;IAClB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,KAA4B,EAAE,oDAAvB,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAShC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,SAAS,gBAAgB,CACvC,CAAC;QAEF,MAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CACvE,CAAC,IAAI,EAAE,EAAE;;YACP,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;YACnE,MAAM,OAAO,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI;gBAChC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;oBAClC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;YACpB,OAAO;gBACL,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,IAAI,CAAC,EAAE;aACf,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO;SACR,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newContact: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
- }>;
11
- //# sourceMappingURL=new-contact.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-contact.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAuDxC,eAAO,MAAM,UAAU;;;;;;;;EA2CrB,CAAC"}
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newContact = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- const props_1 = require("../common/props");
9
- const common_1 = require("../common");
10
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
- const polling = {
12
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
13
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
14
- const response = yield (0, common_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${propsValue.chatbotId}/contacts?sort=date_desc`);
15
- const contacts = response.data.contacts;
16
- const items = contacts
17
- .filter((contact) => {
18
- if (lastFetchEpochMS === 0)
19
- return true;
20
- return (0, dayjs_1.default)(contact.created_at).valueOf() > lastFetchEpochMS;
21
- })
22
- .map((contact) => ({
23
- epochMilliSeconds: (0, dayjs_1.default)(contact.created_at).valueOf(),
24
- data: contact,
25
- }));
26
- return items;
27
- }),
28
- };
29
- exports.newContact = (0, pieces_framework_1.createTrigger)({
30
- auth: auth_1.chatlingAuth,
31
- name: 'new_contact',
32
- displayName: 'New Contact/Lead',
33
- description: 'Triggers when a new contact or lead is collected by the chatbot.',
34
- aiMetadata: {
35
- description: 'Fires when the selected Chatling chatbot collects a new contact or lead. Each event represents one newly captured contact with its details (name, email, phone, company, and similar fields). Polls the chatbot\'s contacts on an interval, deduplicating by creation time.',
36
- },
37
- props: {
38
- chatbotId: props_1.chatbotIdDropdown,
39
- },
40
- type: pieces_framework_1.TriggerStrategy.POLLING,
41
- onEnable(context) {
42
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
- yield pieces_common_1.pollingHelper.onEnable(polling, {
44
- auth: context.auth,
45
- store: context.store,
46
- propsValue: context.propsValue,
47
- });
48
- });
49
- },
50
- onDisable(context) {
51
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
- yield pieces_common_1.pollingHelper.onDisable(polling, {
53
- auth: context.auth,
54
- store: context.store,
55
- propsValue: context.propsValue,
56
- });
57
- });
58
- },
59
- test(context) {
60
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
- return yield pieces_common_1.pollingHelper.test(polling, context);
62
- });
63
- },
64
- run(context) {
65
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
- return yield pieces_common_1.pollingHelper.poll(polling, context);
67
- });
68
- },
69
- sampleData: {
70
- id: 'contact_abc123',
71
- name: 'John Doe',
72
- email: 'john@example.com',
73
- phone: '+1234567890',
74
- job_title: 'Product Manager',
75
- website: 'https://example.com',
76
- company: 'Acme Inc',
77
- created_at: '2024-01-15T10:30:00.000Z',
78
- },
79
- });
80
- //# sourceMappingURL=new-contact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-contact.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,kCAAuC;AACvC,2CAAoD;AACpD,sCAAwC;AACxC,0DAA0B;AAa1B,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAKhC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,UAAU,CAAC,SAAS,0BAA0B,CAC5D,CAAC;QAEF,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;QAExC,MAAM,KAAK,GAAG,QAAQ;aACnB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;YAClB,IAAI,gBAAgB,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACxC,OAAO,IAAA,eAAK,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,GAAG,gBAAgB,CAAC;QAChE,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACjB,iBAAiB,EAAE,IAAA,eAAK,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;YACtD,IAAI,EAAE,OAAO;SACd,CAAC,CAAC,CAAC;QAEN,OAAO,KAAK,CAAC;IACf,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,UAAU,GAAG,IAAA,gCAAa,EAAC;IACtC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,kEAAkE;IAC/E,UAAU,EAAE;QACV,WAAW,EACT,6QAA6Q;KAChR;IACD,KAAK,EAAE;QACL,SAAS,EAAE,yBAAiB;KAC7B;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACD,UAAU,EAAE;QACV,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,aAAa;QACpB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,qBAAqB;QAC9B,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,0BAA0B;KACvC;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newConversation: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- chatbotId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
- }>;
11
- //# sourceMappingURL=new-conversation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-conversation.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAsDxC,eAAO,MAAM,eAAe;;;;;;;;EA+C1B,CAAC"}
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newConversation = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- const props_1 = require("../common/props");
9
- const common_1 = require("../common");
10
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
- const polling = {
12
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
13
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
14
- const response = yield (0, common_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, `/chatbots/${propsValue.chatbotId}/conversations?sort=date_desc`);
15
- const conversations = response.data.conversations;
16
- // Filter by lastFetchEpochMS if not first run
17
- const items = conversations
18
- .filter((conv) => {
19
- if (lastFetchEpochMS === 0)
20
- return true;
21
- return (0, dayjs_1.default)(conv.created_at).valueOf() > lastFetchEpochMS;
22
- })
23
- .map((conv) => ({
24
- epochMilliSeconds: (0, dayjs_1.default)(conv.created_at).valueOf(),
25
- data: conv,
26
- }));
27
- return items;
28
- }),
29
- };
30
- exports.newConversation = (0, pieces_framework_1.createTrigger)({
31
- auth: auth_1.chatlingAuth,
32
- name: 'new_conversation',
33
- displayName: 'New Conversation',
34
- description: 'Triggers when a new conversation is started by a customer.',
35
- aiMetadata: {
36
- description: 'Fires when a customer starts a new conversation with the selected Chatling chatbot. Each event represents one newly created conversation, including its contact and initial messages. Polls the chatbot\'s conversations on an interval, deduplicating by creation time.',
37
- },
38
- props: {
39
- chatbotId: props_1.chatbotIdDropdown,
40
- },
41
- type: pieces_framework_1.TriggerStrategy.POLLING,
42
- onEnable(context) {
43
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
- yield pieces_common_1.pollingHelper.onEnable(polling, {
45
- auth: context.auth,
46
- store: context.store,
47
- propsValue: context.propsValue,
48
- });
49
- });
50
- },
51
- onDisable(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- yield pieces_common_1.pollingHelper.onDisable(polling, {
54
- auth: context.auth,
55
- store: context.store,
56
- propsValue: context.propsValue,
57
- });
58
- });
59
- },
60
- test(context) {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- return yield pieces_common_1.pollingHelper.test(polling, context);
63
- });
64
- },
65
- run(context) {
66
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
- return yield pieces_common_1.pollingHelper.poll(polling, context);
68
- });
69
- },
70
- sampleData: {
71
- id: 'conv_abc123',
72
- contact_id: 'contact_xyz',
73
- archived: false,
74
- important: false,
75
- created_at: '2024-01-15T10:30:00.000Z',
76
- messages: [
77
- {
78
- id: 'msg_1',
79
- text: 'Hello, I need help with your product.',
80
- role: 'user',
81
- },
82
- ],
83
- },
84
- });
85
- //# sourceMappingURL=new-conversation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-conversation.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-conversation.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,kCAAuC;AACvC,2CAAoD;AACpD,sCAAwC;AACxC,0DAA0B;AAW1B,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAKhC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,aAAa,UAAU,CAAC,SAAS,+BAA+B,CACjE,CAAC;QAEF,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;QAElD,8CAA8C;QAC9C,MAAM,KAAK,GAAG,aAAa;aACxB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACf,IAAI,gBAAgB,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACxC,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,GAAG,gBAAgB,CAAC;QAC7D,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACd,iBAAiB,EAAE,IAAA,eAAK,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;YACnD,IAAI,EAAE,IAAI;SACX,CAAC,CAAC,CAAC;QAEN,OAAO,KAAK,CAAC;IACf,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,eAAe,GAAG,IAAA,gCAAa,EAAC;IAC3C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,4DAA4D;IACzE,UAAU,EAAE;QACV,WAAW,EACT,0QAA0Q;KAC7Q;IACD,KAAK,EAAE;QACL,SAAS,EAAE,yBAAiB;KAC7B;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACD,UAAU,EAAE;QACV,EAAE,EAAE,aAAa;QACjB,UAAU,EAAE,aAAa;QACzB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,0BAA0B;QACtC,QAAQ,EAAE;YACR;gBACE,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,uCAAuC;gBAC7C,IAAI,EAAE,MAAM;aACb;SACF;KACF;CACF,CAAC,CAAC"}