@activepieces/piece-cloudconvert 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +7 -22
  2. package/src/index.js +25 -45
  3. package/README.md +0 -7
  4. package/src/index.d.ts +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/archive-file.d.ts +0 -11
  7. package/src/lib/actions/archive-file.js +0 -251
  8. package/src/lib/actions/archive-file.js.map +0 -1
  9. package/src/lib/actions/capture-website.d.ts +0 -28
  10. package/src/lib/actions/capture-website.js +0 -347
  11. package/src/lib/actions/capture-website.js.map +0 -1
  12. package/src/lib/actions/convert-file.d.ts +0 -14
  13. package/src/lib/actions/convert-file.js +0 -228
  14. package/src/lib/actions/convert-file.js.map +0 -1
  15. package/src/lib/actions/download-file.d.ts +0 -5
  16. package/src/lib/actions/download-file.js +0 -168
  17. package/src/lib/actions/download-file.js.map +0 -1
  18. package/src/lib/actions/merge-pdf.d.ts +0 -10
  19. package/src/lib/actions/merge-pdf.js +0 -237
  20. package/src/lib/actions/merge-pdf.js.map +0 -1
  21. package/src/lib/actions/optimize-file.d.ts +0 -16
  22. package/src/lib/actions/optimize-file.js +0 -285
  23. package/src/lib/actions/optimize-file.js.map +0 -1
  24. package/src/lib/common/auth.d.ts +0 -1
  25. package/src/lib/common/auth.js +0 -29
  26. package/src/lib/common/auth.js.map +0 -1
  27. package/src/lib/common/client.d.ts +0 -99
  28. package/src/lib/common/client.js +0 -283
  29. package/src/lib/common/client.js.map +0 -1
  30. package/src/lib/common/index.d.ts +0 -9
  31. package/src/lib/common/index.js +0 -33
  32. package/src/lib/common/index.js.map +0 -1
  33. package/src/lib/common/properties.d.ts +0 -14
  34. package/src/lib/common/properties.js +0 -191
  35. package/src/lib/common/properties.js.map +0 -1
  36. package/src/lib/common/schemas.d.ts +0 -127
  37. package/src/lib/common/schemas.js +0 -178
  38. package/src/lib/common/schemas.js.map +0 -1
  39. package/src/lib/triggers/job-failed.d.ts +0 -2
  40. package/src/lib/triggers/job-failed.js +0 -113
  41. package/src/lib/triggers/job-failed.js.map +0 -1
  42. package/src/lib/triggers/job-finished.d.ts +0 -2
  43. package/src/lib/triggers/job-finished.js +0 -151
  44. package/src/lib/triggers/job-finished.js.map +0 -1
  45. package/src/lib/triggers/new-job.d.ts +0 -2
  46. package/src/lib/triggers/new-job.js +0 -125
  47. package/src/lib/triggers/new-job.js.map +0 -1
package/package.json CHANGED
@@ -1,27 +1,12 @@
1
1
  {
2
2
  "name": "@activepieces/piece-cloudconvert",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
7
- "dependencies": {
8
- "@sinclair/typebox": "0.34.11",
9
- "ai": "^6.0.0",
10
- "axios": "1.13.5",
11
- "axios-retry": "4.4.1",
12
- "deepmerge-ts": "7.1.0",
13
- "form-data": "4.0.4",
14
- "mime-types": "2.1.35",
15
- "nanoid": "3.3.8",
16
- "semver": "7.6.0",
17
- "socket.io-client": "4.8.1",
18
- "tslib": "^2.3.0",
19
- "zod": "4.1.13",
20
- "@activepieces/pieces-common": "0.11.6",
21
- "@activepieces/pieces-framework": "0.25.4",
22
- "@activepieces/shared": "0.37.0"
23
- },
24
- "resolutions": {
25
- "rollup": "npm:@rollup/wasm-node"
26
- }
6
+ "dependencies": {},
7
+ "files": [
8
+ "src/index.js",
9
+ "package.json",
10
+ "src/i18n"
11
+ ]
27
12
  }
package/src/index.js CHANGED
@@ -1,45 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cloudconvert = 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 auth_1 = require("./lib/common/auth");
9
- const new_job_1 = require("./lib/triggers/new-job");
10
- const job_finished_1 = require("./lib/triggers/job-finished");
11
- const job_failed_1 = require("./lib/triggers/job-failed");
12
- const convert_file_1 = require("./lib/actions/convert-file");
13
- const capture_website_1 = require("./lib/actions/capture-website");
14
- const merge_pdf_1 = require("./lib/actions/merge-pdf");
15
- const download_file_1 = require("./lib/actions/download-file");
16
- const archive_file_1 = require("./lib/actions/archive-file");
17
- const optimize_file_1 = require("./lib/actions/optimize-file");
18
- exports.cloudconvert = (0, pieces_framework_1.createPiece)({
19
- displayName: 'CloudConvert',
20
- description: 'File conversion and processing platform supporting 200+ formats',
21
- minimumSupportedRelease: '0.36.1',
22
- logoUrl: 'https://cdn.activepieces.com/pieces/cloudconvert.png',
23
- categories: [shared_1.PieceCategory.DEVELOPER_TOOLS, shared_1.PieceCategory.CONTENT_AND_FILES],
24
- authors: ['owuzo'],
25
- auth: auth_1.cloudconvertAuth,
26
- actions: [
27
- convert_file_1.convertFile,
28
- capture_website_1.captureWebsite,
29
- merge_pdf_1.mergePdf,
30
- download_file_1.downloadFile,
31
- archive_file_1.archiveFile,
32
- optimize_file_1.optimizeFile,
33
- (0, pieces_common_1.createCustomApiCallAction)({
34
- baseUrl: () => 'https://api.cloudconvert.com/v2',
35
- auth: auth_1.cloudconvertAuth,
36
- authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
- return ({
38
- Authorization: `Bearer ${auth.access_token}`,
39
- });
40
- }),
41
- }),
42
- ],
43
- triggers: [new_job_1.newJob, job_finished_1.jobFinished, job_failed_1.jobFailed],
44
- });
45
- //# sourceMappingURL=index.js.map
1
+ "use strict";var yu=Object.create;var ht=Object.defineProperty;var vu=Object.getOwnPropertyDescriptor;var _u=Object.getOwnPropertyNames;var xu=Object.getPrototypeOf,bu=Object.prototype.hasOwnProperty;var o=(e,t)=>ht(e,"name",{value:t,configurable:!0});var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jn=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},Ln=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _u(t))!bu.call(e,a)&&a!==r&&ht(e,a,{get:()=>t[a],enumerable:!(n=vu(t,a))||n.enumerable});return e};var Xe=(e,t,r)=>(r=e!=null?yu(xu(e)):{},Ln(t||!e||!e.__esModule?ht(r,"default",{value:e,enumerable:!0}):r,e)),Pu=e=>Ln(ht({},"__esModule",{value:!0}),e);var si=S((ai,nr)=>{(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"),a=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function v(u,l){if(u.indexOf("::")!==u.lastIndexOf("::"))return null;let g=0,m=-1,h=(u.match(p.zoneIndex)||[])[0],P,E;for(h&&(h=h.substring(1),u=u.replace(/%.+$/,""));(m=u.indexOf(":",m+1))>=0;)g++;if(u.substr(0,2)==="::"&&g--,u.substr(-2,2)==="::"&&g--,g>l)return null;for(E=l-g,P=":";E--;)P+="0:";return u=u.replace("::",P),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),l=function(){let j=u.split(":"),A=[];for(let L=0;L<j.length;L++)A.push(parseInt(j[L],16));return A}(),{parts:l,zoneId:h}}o(v,"expandIPv6");function y(u,l,g,m){if(u.length!==l.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let h=0,P;for(;m>0;){if(P=g-m,P<0&&(P=0),u[h]>>P!==l[h]>>P)return!1;m-=g,h+=1}return!0}o(y,"matchCIDR");function _(u){if(a.test(u))return parseInt(u,16);if(u[0]==="0"&&!isNaN(parseInt(u[1],10))){if(n.test(u))return parseInt(u,8);throw new Error(`ipaddr: cannot parse ${u} as octal`)}return parseInt(u,10)}o(_,"parseIntAuto");function T(u,l){for(;u.length<l;)u=`0${u}`;return u}o(T,"padPart");let x={};x.IPv4=function(){function u(l){if(l.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,m;for(g=0;g<l.length;g++)if(m=l[g],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=l}return o(u,"IPv4"),u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,18,0,0]),15],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]],as112:[[new u([192,175,48,0]),24],[new u([192,31,196,0]),24]],amt:[[new u([192,52,193,0]),24]]},u.prototype.kind=function(){return"ipv4"},u.prototype.match=function(l,g){let m;if(g===void 0&&(m=l,l=m[0],g=m[1]),l.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return y(this.octets,l.octets,8,g)},u.prototype.prefixLengthFromSubnetMask=function(){let l=0,g=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},h,P,E;for(h=3;h>=0;h-=1)if(P=this.octets[h],P in m){if(E=m[P],g&&E!==0)return null;E!==8&&(g=!0),l+=E}else return null;return 32-l},u.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){return this.octets.slice(0)},u.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},u.prototype.toNormalizedString=function(){return this.toString()},u.prototype.toString=function(){return this.octets.join(".")},u}(),x.IPv4.broadcastAddressFromCIDR=function(u){try{let l=this.parseCIDR(u),g=l[0].toByteArray(),m=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),h=[],P=0;for(;P<4;)h.push(parseInt(g[P],10)|parseInt(m[P],10)^255),P++;return new this(h)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(u){return this.parser(u)!==null},x.IPv4.isValid=function(u){try{return new this(this.parser(u)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(u){try{return this.parseCIDR(u),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(u){return!!(x.IPv4.isValid(u)&&u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.isValidCIDRFourPartDecimal=function(u){let l=u.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(u)||!l?!1:x.IPv4.isValidFourPartDecimal(l[1])},x.IPv4.networkAddressFromCIDR=function(u){let l,g,m,h,P;try{for(l=this.parseCIDR(u),m=l[0].toByteArray(),P=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),h=[],g=0;g<4;)h.push(parseInt(m[g],10)&parseInt(P[g],10)),g++;return new this(h)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(u){let l=this.parser(u);if(l===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(l)},x.IPv4.parseCIDR=function(u){let l;if(l=u.match(/^(.+)\/(\d+)$/)){let g=parseInt(l[2]);if(g>=0&&g<=32){let m=[this.parse(l[1]),g];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")},x.IPv4.parser=function(u){let l,g,m;if(l=u.match(r.fourOctet))return function(){let h=l.slice(1,6),P=[];for(let E=0;E<h.length;E++)g=h[E],P.push(_(g));return P}();if(l=u.match(r.longValue)){if(m=_(l[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return function(){let h=[],P;for(P=0;P<=24;P+=8)h.push(m>>P&255);return h}().reverse()}else return(l=u.match(r.twoOctet))?function(){let h=l.slice(1,4),P=[];if(m=_(h[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return P.push(_(h[0])),P.push(m>>16&255),P.push(m>>8&255),P.push(m&255),P}():(l=u.match(r.threeOctet))?function(){let h=l.slice(1,5),P=[];if(m=_(h[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return P.push(_(h[0])),P.push(_(h[1])),P.push(m>>8&255),P.push(m&255),P}():null},x.IPv4.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>32)throw new Error("ipaddr: invalid IPv4 prefix length");let l=[0,0,0,0],g=0,m=Math.floor(u/8);for(;g<m;)l[g]=255,g++;return m<4&&(l[m]=Math.pow(2,u%8)-1<<8-u%8),new this(l)},x.IPv6=function(){function u(l,g){let m,h;if(l.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(l[m]<<8|l[m+1]);else if(l.length===8)this.parts=l;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(h=this.parts[m],!(0<=h&&h<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return o(u,"IPv6"),u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],discard:[new u([256,0,0,0,0,0,0,0]),64],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],benchmarking:[new u([8193,2,0,0,0,0,0,0]),48],amt:[new u([8193,3,0,0,0,0,0,0]),32],as112v6:[[new u([8193,4,274,0,0,0,0,0]),48],[new u([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new u([8193,16,0,0,0,0,0,0]),28],orchid2:[new u([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new u([8193,48,0,0,0,0,0,0]),28],reserved:[[new u([8193,0,0,0,0,0,0,0]),23],[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.kind=function(){return"ipv6"},u.prototype.match=function(l,g){let m;if(g===void 0&&(m=l,l=m[0],g=m[1]),l.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return y(this.parts,l.parts,16,g)},u.prototype.prefixLengthFromSubnetMask=function(){let l=0,g=!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},h,P;for(let E=7;E>=0;E-=1)if(h=this.parts[E],h in m){if(P=m[h],g&&P!==0)return null;P!==16&&(g=!0),l+=P}else return null;return 128-l},u.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){let l,g=[],m=this.parts;for(let h=0;h<m.length;h++)l=m[h],g.push(l>>8),g.push(l&255);return g},u.prototype.toFixedLengthString=function(){let l=function(){let m=[];for(let h=0;h<this.parts.length;h++)m.push(T(this.parts[h].toString(16),4));return m}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),l+g},u.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let l=this.parts.slice(-2),g=l[0],m=l[1];return new x.IPv4([g>>8,g&255,m>>8,m&255])},u.prototype.toNormalizedString=function(){let l=function(){let m=[];for(let h=0;h<this.parts.length;h++)m.push(this.parts[h].toString(16));return m}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),l+g},u.prototype.toRFC5952String=function(){let l=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),m=0,h=-1,P;for(;P=l.exec(g);)P[0].length>h&&(m=P.index,h=P[0].length);return h<0?g:`${g.substring(0,m)}::${g.substring(m+h)}`},u.prototype.toString=function(){return this.toRFC5952String()},u}(),x.IPv6.broadcastAddressFromCIDR=function(u){try{let l=this.parseCIDR(u),g=l[0].toByteArray(),m=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),h=[],P=0;for(;P<16;)h.push(parseInt(g[P],10)|parseInt(m[P],10)^255),P++;return new this(h)}catch(l){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${l})`)}},x.IPv6.isIPv6=function(u){return this.parser(u)!==null},x.IPv6.isValid=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{let l=this.parser(u);return new this(l.parts,l.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{return this.parseCIDR(u),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(u){let l,g,m,h,P;try{for(l=this.parseCIDR(u),m=l[0].toByteArray(),P=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),h=[],g=0;g<16;)h.push(parseInt(m[g],10)&parseInt(P[g],10)),g++;return new this(h)}catch(E){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${E})`)}},x.IPv6.parse=function(u){let l=this.parser(u);if(l.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(l.parts,l.zoneId)},x.IPv6.parseCIDR=function(u){let l,g,m;if((g=u.match(/^(.+)\/(\d+)$/))&&(l=parseInt(g[2]),l>=0&&l<=128))return m=[this.parse(g[1]),l],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")},x.IPv6.parser=function(u){let l,g,m,h,P,E;if(m=u.match(p.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(p.native.test(u))return v(u,8);if((m=u.match(p.transitional))&&(E=m[6]||"",l=m[1],m[1].endsWith("::")||(l=l.slice(0,-1)),l=v(l+E,6),l.parts)){for(P=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],g=0;g<P.length;g++)if(h=P[g],!(0<=h&&h<=255))return null;return l.parts.push(P[0]<<8|P[1]),l.parts.push(P[2]<<8|P[3]),{parts:l.parts,zoneId:l.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>128)throw new Error("ipaddr: invalid IPv6 prefix length");let l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,m=Math.floor(u/8);for(;g<m;)l[g]=255,g++;return m<16&&(l[m]=Math.pow(2,u%8)-1<<8-u%8),new this(l)},x.fromByteArray=function(u){let l=u.length;if(l===4)return new x.IPv4(u);if(l===16)return new x.IPv6(u);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(u){return x.IPv6.isValid(u)||x.IPv4.isValid(u)},x.isValidCIDR=function(u){return x.IPv6.isValidCIDR(u)||x.IPv4.isValidCIDR(u)},x.parse=function(u){if(x.IPv6.isValid(u))return x.IPv6.parse(u);if(x.IPv4.isValid(u))return x.IPv4.parse(u);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(u){try{return x.IPv6.parseCIDR(u)}catch{try{return x.IPv4.parseCIDR(u)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(u){let l=this.parse(u);return l.kind()==="ipv6"&&l.isIPv4MappedAddress()?l.toIPv4Address():l},x.subnetMatch=function(u,l,g){let m,h,P,E;g==null&&(g="unicast");for(h in l)if(Object.prototype.hasOwnProperty.call(l,h)){for(P=l[h],P[0]&&!(P[0]instanceof Array)&&(P=[P]),m=0;m<P.length;m++)if(E=P[m],u.kind()===E[0].kind()&&u.match.apply(u,E))return h}return g},typeof nr<"u"&&nr.exports?nr.exports=x:e.ipaddr=x})(ai)});var na=S((PS,ra)=>{var ta=require("stream").Stream,Kl=require("util");ra.exports=Pe;function Pe(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(Pe,"DelayedStream");Kl.inherits(Pe,ta);Pe.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var a=e.emit;return e.emit=function(){return r._handleEmit(arguments),a.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Pe.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});Pe.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Pe.prototype.resume=function(){this._released||this.release(),this.source.resume()};Pe.prototype.pause=function(){this.source.pause()};Pe.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Pe.prototype.pipe=function(){var e=ta.prototype.pipe.apply(this,arguments);return this.resume(),e};Pe.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)};Pe.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 sa=S((ES,aa)=>{var Xl=require("util"),ia=require("stream").Stream,oa=na();aa.exports=ae;function ae(){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(ae,"CombinedStream");Xl.inherits(ae,ia);ae.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};ae.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};ae.prototype.append=function(e){var t=ae.isStreamLike(e);if(t){if(!(e instanceof oa)){var r=oa.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};ae.prototype.pipe=function(e,t){return ia.prototype.pipe.call(this,e,t),this.resume(),e};ae.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}};ae.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=ae.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};ae.prototype._pipeNext=function(e){this._currentStream=e;var t=ae.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()};ae.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};ae.prototype.write=function(e){this.emit("data",e)};ae.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};ae.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")};ae.prototype.end=function(){this._reset(),this.emit("end")};ae.prototype.destroy=function(){this._reset(),this.emit("close")};ae.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};ae.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};ae.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)};ae.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var ca=S((zS,ua)=>{"use strict";ua.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 da=S(me=>{"use strict";var cr=ca(),Yl=require("path").extname,la=/^\s*([^;\s]*)(?:;|\s|$)/,Ql=/^text\//i;me.charset=pa;me.charsets={lookup:pa};me.contentType=ep;me.extension=tp;me.extensions=Object.create(null);me.lookup=rp;me.types=Object.create(null);np(me.extensions,me.types);function pa(e){if(!e||typeof e!="string")return!1;var t=la.exec(e),r=t&&cr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&Ql.test(t[1])?"UTF-8":!1}o(pa,"charset");function ep(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?me.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=me.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(ep,"contentType");function tp(e){if(!e||typeof e!="string")return!1;var t=la.exec(e),r=t&&me.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(tp,"extension");function rp(e){if(!e||typeof e!="string")return!1;var t=Yl("x."+e).toLowerCase().substr(1);return t&&me.types[t]||!1}o(rp,"lookup");function np(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(cr).forEach(o(function(a){var s=cr[a],c=s.extensions;if(!(!c||!c.length)){e[a]=c;for(var p=0;p<c.length;p++){var v=c[p];if(t[v]){var y=r.indexOf(cr[t[v]].source),_=r.indexOf(s.source);if(t[v]!=="application/octet-stream"&&(y>_||y===_&&t[v].substr(0,12)==="application/"))continue}t[v]=a}}},"forEachMimeType"))}o(np,"populateMaps")});var fa=S((AS,ma)=>{ma.exports=op;function op(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(op,"defer")});var cn=S((kS,ha)=>{var ga=fa();ha.exports=ip;function ip(e){var t=!1;return ga(function(){t=!0}),o(function(n,a){t?e(n,a):ga(o(function(){e(n,a)},"nextTick_callback"))},"async_callback")}o(ip,"async")});var ln=S((RS,ya)=>{ya.exports=ap;function ap(e){Object.keys(e.jobs).forEach(sp.bind(e)),e.jobs={}}o(ap,"abort");function sp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(sp,"clean")});var pn=S((DS,_a)=>{var va=cn(),up=ln();_a.exports=cp;function cp(e,t,r,n){var a=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[a]=lp(t,a,e[a],function(s,c){a in r.jobs&&(delete r.jobs[a],s?up(r):r.results[a]=c,n(s,r.results))})}o(cp,"iterate");function lp(e,t,r,n){var a;return e.length==2?a=e(r,va(n)):a=e(r,t,va(n)),a}o(lp,"runJob")});var dn=S((US,xa)=>{xa.exports=pp;function pp(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(a,s){return t(e[a],e[s])}),n}o(pp,"state")});var mn=S((jS,ba)=>{var dp=ln(),mp=cn();ba.exports=fp;function fp(e){Object.keys(this.jobs).length&&(this.index=this.size,dp(this),mp(e)(null,this.results))}o(fp,"terminator")});var Ta=S((FS,Pa)=>{var gp=pn(),hp=dn(),yp=mn();Pa.exports=vp;function vp(e,t,r){for(var n=hp(e);n.index<(n.keyedList||e).length;)gp(e,t,n,function(a,s){if(a){r(a,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return yp.bind(n,r)}o(vp,"parallel")});var fn=S((ZS,lr)=>{var Ea=pn(),_p=dn(),xp=mn();lr.exports=bp;lr.exports.ascending=Ia;lr.exports.descending=Pp;function bp(e,t,r,n){var a=_p(e,r);return Ea(e,t,a,o(function s(c,p){if(c){n(c,p);return}if(a.index++,a.index<(a.keyedList||e).length){Ea(e,t,a,s);return}n(null,a.results)},"iteratorHandler")),xp.bind(a,n)}o(bp,"serialOrdered");function Ia(e,t){return e<t?-1:e>t?1:0}o(Ia,"ascending");function Pp(e,t){return-1*Ia(e,t)}o(Pp,"descending")});var $a=S((qS,za)=>{var Tp=fn();za.exports=Ep;function Ep(e,t,r){return Tp(e,t,null,r)}o(Ep,"serial")});var Aa=S((WS,Sa)=>{Sa.exports={parallel:Ta(),serial:$a(),serialOrdered:fn()}});var gn=S((GS,wa)=>{"use strict";wa.exports=Object});var Oa=S((JS,ka)=>{"use strict";ka.exports=Error});var Na=S((KS,Ra)=>{"use strict";Ra.exports=EvalError});var Ca=S((XS,Da)=>{"use strict";Da.exports=RangeError});var Ma=S((YS,Ua)=>{"use strict";Ua.exports=ReferenceError});var La=S((QS,ja)=>{"use strict";ja.exports=SyntaxError});var pr=S((eA,Fa)=>{"use strict";Fa.exports=TypeError});var Za=S((tA,Ba)=>{"use strict";Ba.exports=URIError});var qa=S((rA,Va)=>{"use strict";Va.exports=Math.abs});var Wa=S((nA,Ha)=>{"use strict";Ha.exports=Math.floor});var Ja=S((oA,Ga)=>{"use strict";Ga.exports=Math.max});var Xa=S((iA,Ka)=>{"use strict";Ka.exports=Math.min});var Qa=S((aA,Ya)=>{"use strict";Ya.exports=Math.pow});var ts=S((sA,es)=>{"use strict";es.exports=Math.round});var ns=S((uA,rs)=>{"use strict";rs.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var is=S((lA,os)=>{"use strict";var Ip=ns();os.exports=o(function(t){return Ip(t)||t===0?t:t<0?-1:1},"sign")});var ss=S((dA,as)=>{"use strict";as.exports=Object.getOwnPropertyDescriptor});var hn=S((mA,us)=>{"use strict";var dr=ss();if(dr)try{dr([],"length")}catch{dr=null}us.exports=dr});var ls=S((fA,cs)=>{"use strict";var mr=Object.defineProperty||!1;if(mr)try{mr({},"a",{value:1})}catch{mr=!1}cs.exports=mr});var yn=S((gA,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 a=42;t[r]=a;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,r);if(p.value!==a||p.enumerable!==!0)return!1}return!0},"hasSymbols")});var fs=S((yA,ms)=>{"use strict";var ds=typeof Symbol<"u"&&Symbol,zp=yn();ms.exports=o(function(){return typeof ds!="function"||typeof Symbol!="function"||typeof ds("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zp()},"hasNativeSymbols")});var vn=S((_A,gs)=>{"use strict";gs.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var _n=S((xA,hs)=>{"use strict";var $p=gn();hs.exports=$p.getPrototypeOf||null});var _s=S((bA,vs)=>{"use strict";var Sp="Function.prototype.bind called on incompatible ",Ap=Object.prototype.toString,wp=Math.max,kp="[object Function]",ys=o(function(t,r){for(var n=[],a=0;a<t.length;a+=1)n[a]=t[a];for(var s=0;s<r.length;s+=1)n[s+t.length]=r[s];return n},"concatty"),Op=o(function(t,r){for(var n=[],a=r||0,s=0;a<t.length;a+=1,s+=1)n[s]=t[a];return n},"slicy"),Rp=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");vs.exports=o(function(t){var r=this;if(typeof r!="function"||Ap.apply(r)!==kp)throw new TypeError(Sp+r);for(var n=Op(arguments,1),a,s=o(function(){if(this instanceof a){var _=r.apply(this,ys(n,arguments));return Object(_)===_?_:this}return r.apply(t,ys(n,arguments))},"binder"),c=wp(0,r.length-n.length),p=[],v=0;v<c;v++)p[v]="$"+v;if(a=Function("binder","return function ("+Rp(p,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var y=o(function(){},"Empty");y.prototype=r.prototype,a.prototype=new y,y.prototype=null}return a},"bind")});var pt=S((TA,xs)=>{"use strict";var Np=_s();xs.exports=Function.prototype.bind||Np});var fr=S((EA,bs)=>{"use strict";bs.exports=Function.prototype.call});var xn=S((IA,Ps)=>{"use strict";Ps.exports=Function.prototype.apply});var Es=S((zA,Ts)=>{"use strict";Ts.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var zs=S(($A,Is)=>{"use strict";var Dp=pt(),Cp=xn(),Up=fr(),Mp=Es();Is.exports=Mp||Dp.call(Up,Cp)});var Ss=S((SA,$s)=>{"use strict";var jp=pt(),Lp=pr(),Fp=fr(),Bp=zs();$s.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new Lp("a function is required");return Bp(jp,Fp,t)},"callBindBasic")});var Ns=S((wA,Rs)=>{"use strict";var Zp=Ss(),As=hn(),ks;try{ks=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var bn=!!ks&&As&&As(Object.prototype,"__proto__"),Os=Object,ws=Os.getPrototypeOf;Rs.exports=bn&&typeof bn.get=="function"?Zp([bn.get]):typeof ws=="function"?o(function(t){return ws(t==null?t:Os(t))},"getDunder"):!1});var js=S((OA,Ms)=>{"use strict";var Ds=vn(),Cs=_n(),Us=Ns();Ms.exports=Ds?o(function(t){return Ds(t)},"getProto"):Cs?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Cs(t)},"getProto"):Us?o(function(t){return Us(t)},"getProto"):null});var Pn=S((NA,Ls)=>{"use strict";var Vp=Function.prototype.call,qp=Object.prototype.hasOwnProperty,Hp=pt();Ls.exports=Hp.call(Vp,qp)});var Ws=S((DA,Hs)=>{"use strict";var H,Wp=gn(),Gp=Oa(),Jp=Na(),Kp=Ca(),Xp=Ma(),gt=La(),ft=pr(),Yp=Za(),Qp=qa(),ed=Wa(),td=Ja(),rd=Xa(),nd=Qa(),od=ts(),id=is(),Vs=Function,Tn=o(function(e){try{return Vs('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),Dt=hn(),ad=ls(),En=o(function(){throw new ft},"throwTypeError"),sd=Dt?function(){try{return arguments.callee,En}catch{try{return Dt(arguments,"callee").get}catch{return En}}}():En,dt=fs()(),pe=js(),ud=_n(),cd=vn(),qs=xn(),Ct=fr(),mt={},ld=typeof Uint8Array>"u"||!pe?H:pe(Uint8Array),We={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?H:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?H:ArrayBuffer,"%ArrayIteratorPrototype%":dt&&pe?pe([][Symbol.iterator]()):H,"%AsyncFromSyncIteratorPrototype%":H,"%AsyncFunction%":mt,"%AsyncGenerator%":mt,"%AsyncGeneratorFunction%":mt,"%AsyncIteratorPrototype%":mt,"%Atomics%":typeof Atomics>"u"?H:Atomics,"%BigInt%":typeof BigInt>"u"?H:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?H:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?H:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?H:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Gp,"%eval%":eval,"%EvalError%":Jp,"%Float16Array%":typeof Float16Array>"u"?H:Float16Array,"%Float32Array%":typeof Float32Array>"u"?H:Float32Array,"%Float64Array%":typeof Float64Array>"u"?H:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?H:FinalizationRegistry,"%Function%":Vs,"%GeneratorFunction%":mt,"%Int8Array%":typeof Int8Array>"u"?H:Int8Array,"%Int16Array%":typeof Int16Array>"u"?H:Int16Array,"%Int32Array%":typeof Int32Array>"u"?H:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dt&&pe?pe(pe([][Symbol.iterator]())):H,"%JSON%":typeof JSON=="object"?JSON:H,"%Map%":typeof Map>"u"?H:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dt||!pe?H:pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Wp,"%Object.getOwnPropertyDescriptor%":Dt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?H:Promise,"%Proxy%":typeof Proxy>"u"?H:Proxy,"%RangeError%":Kp,"%ReferenceError%":Xp,"%Reflect%":typeof Reflect>"u"?H:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?H:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dt||!pe?H:pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?H:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dt&&pe?pe(""[Symbol.iterator]()):H,"%Symbol%":dt?Symbol:H,"%SyntaxError%":gt,"%ThrowTypeError%":sd,"%TypedArray%":ld,"%TypeError%":ft,"%Uint8Array%":typeof Uint8Array>"u"?H:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?H:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?H:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?H:Uint32Array,"%URIError%":Yp,"%WeakMap%":typeof WeakMap>"u"?H:WeakMap,"%WeakRef%":typeof WeakRef>"u"?H:WeakRef,"%WeakSet%":typeof WeakSet>"u"?H:WeakSet,"%Function.prototype.call%":Ct,"%Function.prototype.apply%":qs,"%Object.defineProperty%":ad,"%Object.getPrototypeOf%":ud,"%Math.abs%":Qp,"%Math.floor%":ed,"%Math.max%":td,"%Math.min%":rd,"%Math.pow%":nd,"%Math.round%":od,"%Math.sign%":id,"%Reflect.getPrototypeOf%":cd};if(pe)try{null.error}catch(e){Fs=pe(pe(e)),We["%Error.prototype%"]=Fs}var Fs,pd=o(function e(t){var r;if(t==="%AsyncFunction%")r=Tn("async function () {}");else if(t==="%GeneratorFunction%")r=Tn("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Tn("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&pe&&(r=pe(a.prototype))}return We[t]=r,r},"doEval"),Bs={__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"]},Ut=pt(),gr=Pn(),dd=Ut.call(Ct,Array.prototype.concat),md=Ut.call(qs,Array.prototype.splice),Zs=Ut.call(Ct,String.prototype.replace),hr=Ut.call(Ct,String.prototype.slice),fd=Ut.call(Ct,RegExp.prototype.exec),gd=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,hd=/\\(\\)?/g,yd=o(function(t){var r=hr(t,0,1),n=hr(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 a=[];return Zs(t,gd,function(s,c,p,v){a[a.length]=p?Zs(v,hd,"$1"):c||s}),a},"stringToPath"),vd=o(function(t,r){var n=t,a;if(gr(Bs,n)&&(a=Bs[n],n="%"+a[0]+"%"),gr(We,n)){var s=We[n];if(s===mt&&(s=pd(n)),typeof s>"u"&&!r)throw new ft("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:s}}throw new gt("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Hs.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(fd(/^%?[^%]*%?$/,t)===null)throw new gt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=yd(t),a=n.length>0?n[0]:"",s=vd("%"+a+"%",r),c=s.name,p=s.value,v=!1,y=s.alias;y&&(a=y[0],md(n,dd([0,1],y)));for(var _=1,T=!0;_<n.length;_+=1){var x=n[_],u=hr(x,0,1),l=hr(x,-1);if((u==='"'||u==="'"||u==="`"||l==='"'||l==="'"||l==="`")&&u!==l)throw new gt("property names with quotes must have matching quotes");if((x==="constructor"||!T)&&(v=!0),a+="."+x,c="%"+a+"%",gr(We,c))p=We[c];else if(p!=null){if(!(x in p)){if(!r)throw new ft("base intrinsic for "+t+" exists, but the property is not available.");return}if(Dt&&_+1>=n.length){var g=Dt(p,x);T=!!g,T&&"get"in g&&!("originalValue"in g.get)?p=g.get:p=p[x]}else T=gr(p,x),p=p[x];T&&!v&&(We[c]=p)}}return p},"GetIntrinsic")});var Js=S((UA,Gs)=>{"use strict";var _d=yn();Gs.exports=o(function(){return _d()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Ys=S((jA,Xs)=>{"use strict";var xd=Ws(),Ks=xd("%Object.defineProperty%",!0),bd=Js()(),Pd=Pn(),Td=pr(),yr=bd?Symbol.toStringTag:null;Xs.exports=o(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,a=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof a<"u"&&typeof a!="boolean")throw new Td("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");yr&&(n||!Pd(t,yr))&&(Ks?Ks(t,yr,{configurable:!a,enumerable:!1,value:r,writable:!1}):t[yr]=r)},"setToStringTag")});var eu=S((FA,Qs)=>{"use strict";var Ed=Function.prototype.call,Id=Object.prototype.hasOwnProperty,zd=pt();Qs.exports=zd.call(Ed,Id)});var ru=S((BA,tu)=>{"use strict";tu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var iu=S((ZA,ou)=>{"use strict";var Sn=sa(),$d=require("util"),In=require("path"),Sd=require("http"),Ad=require("https"),wd=require("url").parse,kd=require("fs"),Od=require("stream").Stream,Rd=require("crypto"),zn=da(),Nd=Aa(),Dd=Ys(),je=eu(),$n=ru();function nu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(nu,"escapeHeaderParam");function W(e){if(!(this instanceof W))return new W(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Sn.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(W,"FormData");$d.inherits(W,Sn);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=Sn.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 a=this._multiPartHeader(e,t,r),s=this._multiPartFooter();n(a),n(t),n(s),this._trackLength(a,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&&je(t,"httpVersion"))&&!(t instanceof Od))&&(r.knownLength||this._valuesToMeasure.push(t))};W.prototype._lengthRetriever=function(e,t){je(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 a=n.size-(e.start?e.start:0);t(null,a)}):je(e,"httpVersion")?t(null,Number(e.headers["content-length"])):je(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),a=this._getContentType(t,r),s="",c={"Content-Disposition":["form-data",'name="'+nu(e)+'"'].concat(n||[]),"Content-Type":[].concat(a||[])};typeof r.header=="object"&&$n(c,r.header);var p;for(var v in c)if(je(c,v)){if(p=c[v],p==null)continue;Array.isArray(p)||(p=[p]),p.length&&(s+=v+": "+p.join("; ")+W.LINE_BREAK)}return"--"+this.getBoundary()+W.LINE_BREAK+s+W.LINE_BREAK};W.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=In.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=In.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&je(e,"httpVersion")&&(r=In.basename(e.client._httpMessage.path||"")),r)return'filename="'+nu(r)+'"'};W.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=zn.lookup(e.name)),!r&&e&&e.path&&(r=zn.lookup(e.path)),!r&&e&&e.readable&&je(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=zn.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)je(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="--------------------------"+Rd.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}Nd.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(a){t+=a}),e(null,t)})};W.prototype.submit=function(e,t){var r,n,a={method:"post"};return typeof e=="string"?(e=wd(e),n=$n({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},a)):(n=$n(e,a),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=Ad.request(n):r=Sd.request(n),this.getLength(function(s,c){if(s&&s!=="Unknown stream"){this._error(s);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),t){var p,v=o(function(y,_){return r.removeListener("error",v),r.removeListener("response",p),t.call(this,y,_)},"callback");p=v.bind(this,null),r.on("error",v),r.on("response",p)}}.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]"};Dd(W.prototype,"FormData");ou.exports=W});var Yd={};jn(Yd,{cloudconvert:()=>Xd});module.exports=Pu(Yd);var Tu=Object.freeze({status:"aborted"});function z(e,t,r){function n(p,v){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:v,constr:c,traits:new Set},enumerable:!1}),p._zod.traits.has(e))return;p._zod.traits.add(e),t(p,v);let y=c.prototype,_=Object.keys(y);for(let T=0;T<_.length;T++){let x=_[T];x in p||(p[x]=y[x].bind(p))}}o(n,"init");let a=r?.Parent??Object;class s extends a{static{o(this,"Definition")}}Object.defineProperty(s,"name",{value:e});function c(p){var v;let y=r?.Parent?new s:this;n(y,p),(v=y._zod).deferred??(v.deferred=[]);for(let _ of y._zod.deferred)_();return y}return o(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:o(p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e),"value")}),Object.defineProperty(c,"name",{value:e}),c}o(z,"$constructor");var Eu=Symbol("zod_brand"),Ee=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},jt=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},_r={};function $e(e){return e&&Object.assign(_r,e),_r}o($e,"config");function br(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,a])=>t.indexOf(+n)===-1).map(([n,a])=>a)}o(br,"getEnumValues");function Bn(e,t){return typeof t=="bigint"?t.toString():t}o(Bn,"jsonStringifyReplacer");function Ft(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Ft,"cached");function Zn(e){return e==null}o(Zn,"nullish");function Bt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(Bt,"cleanRegex");var Fn=Symbol("evaluating");function se(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Fn)return n===void 0&&(n=Fn,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}o(se,"defineLazy");var Pr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(yt,"isObject");var Iu=Ft(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Tr(e){if(yt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(yt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Tr,"isPlainObject");function Er(e){return Tr(e)?{...e}:Array.isArray(e)?[...e]:e}o(Er,"shallowClone");var Vn=new Set(["string","number","symbol"]);function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Ye,"escapeRegex");function Zt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(Zt,"clone");function te(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(te,"normalizeParams");function qn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(qn,"optionalKeys");var zu={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 Qe(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(Qe,"aborted");function Re(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(Re,"prefixIssues");function Lt(e){return typeof e=="string"?e:e?.message}o(Lt,"unwrapMessage");function Ne(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let a=Lt(e.inst?._zod.def?.error?.(e))??Lt(t?.error?.(e))??Lt(r.customError?.(e))??Lt(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(Ne,"finalizeIssue");function Hn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Hn,"getLengthableOrigin");function Ir(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(Ir,"issue");var Wn=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,Bn,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Gn=z("$ZodError",Wn),vt=z("$ZodError",Wn,{Parent:Error});var Su=o(e=>(t,r,n,a)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new Ee;if(c.issues.length){let p=new(a?.Err??e)(c.issues.map(v=>Ne(v,s,$e())));throw Pr(p,a?.callee),p}return c.value},"_parse"),Vt=Su(vt),Au=o(e=>async(t,r,n,a)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let p=new(a?.Err??e)(c.issues.map(v=>Ne(v,s,$e())));throw Pr(p,a?.callee),p}return c.value},"_parseAsync"),qt=Au(vt),wu=o(e=>(t,r,n)=>{let a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new Ee;return s.issues.length?{success:!1,error:new(e??Gn)(s.issues.map(c=>Ne(c,a,$e())))}:{success:!0,data:s.value}},"_safeParse"),_t=wu(vt),ku=o(e=>async(t,r,n)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>Ne(c,a,$e())))}:{success:!0,data:s.value}},"_safeParseAsync"),xt=ku(vt);var Ou="(?:(?:\\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])))",Ru=new RegExp(`^${Ou}$`);var Jn=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Kn=/^-?\d+n?$/;var zr=/^-?\d+(?:\.\d+)?$/,Xn=/^(?:true|false)$/i;var Be=z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Nu={number:"number",bigint:"bigint",object:"date"};var $r=z("$ZodCheckGreaterThan",(e,t)=>{Be.init(e,t);let r=Nu[typeof t.value];e._zod.onattach.push(n=>{let a=n._zod.bag,s=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?a.minimum=t.value:a.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 Yn=z("$ZodCheckMinLength",(e,t)=>{var r;Be.init(e,t),(r=e._zod.def).when??(r.when=n=>{let a=n.value;return!Zn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{let a=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let a=n.value;if(a.length>=t.minimum)return;let c=Hn(a);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}});var Sr=z("$ZodCheckStringFormat",(e,t)=>{var r,n;Be.init(e,t),e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Qn=z("$ZodCheckRegex",(e,t)=>{Sr.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 to={major:4,minor:3,patch:6};var ne=z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=to;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let a of n)for(let s of a._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let a=o((c,p,v)=>{let y=Qe(c),_;for(let T of p){if(T._zod.def.when){if(!T._zod.def.when(c))continue}else if(y)continue;let x=c.issues.length,u=T._zod.check(c);if(u instanceof Promise&&v?.async===!1)throw new Ee;if(_||u instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await u,c.issues.length!==x&&(y||(y=Qe(c,x)))});else{if(c.issues.length===x)continue;y||(y=Qe(c,x))}}return _?_.then(()=>c):c},"runChecks"),s=o((c,p,v)=>{if(Qe(c))return c.aborted=!0,c;let y=a(p,n,v);if(y instanceof Promise){if(v.async===!1)throw new Ee;return y.then(_=>e._zod.parse(_,v))}return e._zod.parse(y,v)},"handleCanaryResult");e._zod.run=(c,p)=>{if(p.skipChecks)return e._zod.parse(c,p);if(p.direction==="backward"){let y=e._zod.parse({value:c.value,issues:[]},{...p,skipChecks:!0});return y instanceof Promise?y.then(_=>s(_,c,p)):s(y,c,p)}let v=e._zod.parse(c,p);if(v instanceof Promise){if(p.async===!1)throw new Ee;return v.then(y=>a(y,n,p))}return a(v,n,p)}}se(e,"~standard",()=>({validate:o(a=>{try{let s=_t(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return xt(e,a).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Gt=z("$ZodString",(e,t)=>{ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jn(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}}),Ar=z("$ZodStringFormat",(e,t)=>{Sr.init(e,t),Gt.init(e,t)});var so=z("$ZodURL",(e,t)=>{Ar.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),a=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var uo=z("$ZodNumber",(e,t)=>{ne.init(e,t),e._zod.pattern=e._zod.bag.pattern??zr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let a=r.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return r;let s=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),r}});var wr=z("$ZodBoolean",(e,t)=>{ne.init(e,t),e._zod.pattern=Xn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let a=r.value;return typeof a=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),co=z("$ZodBigInt",(e,t)=>{ne.init(e,t),e._zod.pattern=Kn,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 lo=z("$ZodAny",(e,t)=>{ne.init(e,t),e._zod.parse=r=>r}),po=z("$ZodUnknown",(e,t)=>{ne.init(e,t),e._zod.parse=r=>r});var mo=z("$ZodVoid",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{let a=r.value;return typeof a>"u"||r.issues.push({expected:"void",code:"invalid_type",input:a,inst:e}),r}}),fo=z("$ZodDate",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let a=r.value,s=a instanceof Date;return s&&!Number.isNaN(a.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:a,...s?{received:"Invalid Date"}:{},inst:e}),r}});function ro(e,t,r){e.issues.length&&t.issues.push(...Re(r,e.issues)),t.value[r]=e.value}o(ro,"handleArrayResult");var go=z("$ZodArray",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);let s=[];for(let c=0;c<a.length;c++){let p=a[c],v=t.element._zod.run({value:p,issues:[]},n);v instanceof Promise?s.push(v.then(y=>ro(y,r,c))):ro(v,r,c)}return s.length?Promise.all(s).then(()=>r):r}});function Wt(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Re(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(Wt,"handlePropertyResult");function Du(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(Du,"normalizeDef");function Cu(e,t,r,n,a,s){let c=[],p=a.keySet,v=a.catchall._zod,y=v.def.type,_=v.optout==="optional";for(let T in t){if(p.has(T))continue;if(y==="never"){c.push(T);continue}let x=v.run({value:t[T],issues:[]},n);x instanceof Promise?e.push(x.then(u=>Wt(u,r,T,t,_))):Wt(x,r,T,t,_)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}o(Cu,"handleCatchall");var ho=z("$ZodObject",(e,t)=>{if(ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let p=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let v={...p};return Object.defineProperty(t,"shape",{value:v}),v},"get")})}let n=Ft(()=>Du(t));se(e._zod,"propValues",()=>{let p=t.shape,v={};for(let y in p){let _=p[y]._zod;if(_.values){v[y]??(v[y]=new Set);for(let T of _.values)v[y].add(T)}}return v});let a=yt,s=t.catchall,c;e._zod.parse=(p,v)=>{c??(c=n.value);let y=p.value;if(!a(y))return p.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),p;p.value={};let _=[],T=c.shape;for(let x of c.keys){let u=T[x],l=u._zod.optout==="optional",g=u._zod.run({value:y[x],issues:[]},v);g instanceof Promise?_.push(g.then(m=>Wt(m,p,x,y,l))):Wt(g,p,x,y,l)}return s?Cu(_,y,p,v,n.value,e):_.length?Promise.all(_).then(()=>p):p}});function no(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let a=e.filter(s=>!Qe(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(c=>Ne(c,n,$e())))}),t)}o(no,"handleUnionResults");var kr=z("$ZodUnion",(e,t)=>{ne.init(e,t),se(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),se(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),se(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),se(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){let a=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${a.map(s=>Bt(s.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(r)return n(a,s);let c=!1,p=[];for(let v of t.options){let y=v._zod.run({value:a.value,issues:[]},s);if(y instanceof Promise)p.push(y),c=!0;else{if(y.issues.length===0)return y;p.push(y)}}return c?Promise.all(p).then(v=>no(v,a,e,s)):no(p,a,e,s)}});var yo=z("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kr.init(e,t);let r=e._zod.parse;se(e._zod,"propValues",()=>{let a={};for(let s of t.options){let c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[p,v]of Object.entries(c)){a[p]||(a[p]=new Set);for(let y of v)a[p].add(y)}}return a});let n=Ft(()=>{let a=t.options,s=new Map;for(let c of a){let p=c._zod.propValues?.[t.discriminator];if(!p||p.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(let v of p){if(s.has(v))throw new Error(`Duplicate discriminator value "${String(v)}"`);s.set(v,c)}}return s});e._zod.parse=(a,s)=>{let c=a.value;if(!yt(c))return a.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),a;let p=n.value.get(c?.[t.discriminator]);return p?p._zod.run(a,s):t.unionFallback?r(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),a)}});var vo=z("$ZodRecord",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{let a=r.value;if(!Tr(a))return r.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),r;let s=[],c=t.keyType._zod.values;if(c){r.value={};let p=new Set;for(let y of c)if(typeof y=="string"||typeof y=="number"||typeof y=="symbol"){p.add(typeof y=="number"?y.toString():y);let _=t.valueType._zod.run({value:a[y],issues:[]},n);_ instanceof Promise?s.push(_.then(T=>{T.issues.length&&r.issues.push(...Re(y,T.issues)),r.value[y]=T.value})):(_.issues.length&&r.issues.push(...Re(y,_.issues)),r.value[y]=_.value)}let v;for(let y in a)p.has(y)||(v=v??[],v.push(y));v&&v.length>0&&r.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:v})}else{r.value={};for(let p of Reflect.ownKeys(a)){if(p==="__proto__")continue;let v=t.keyType._zod.run({value:p,issues:[]},n);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&zr.test(p)&&v.issues.length){let T=t.keyType._zod.run({value:Number(p),issues:[]},n);if(T instanceof Promise)throw new Error("Async schemas not supported in object keys currently");T.issues.length===0&&(v=T)}if(v.issues.length){t.mode==="loose"?r.value[p]=a[p]:r.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map(T=>Ne(T,n,$e())),input:p,path:[p],inst:e});continue}let _=t.valueType._zod.run({value:a[p],issues:[]},n);_ instanceof Promise?s.push(_.then(T=>{T.issues.length&&r.issues.push(...Re(p,T.issues)),r.value[v.value]=T.value})):(_.issues.length&&r.issues.push(...Re(p,_.issues)),r.value[v.value]=_.value)}}return s.length?Promise.all(s).then(()=>r):r}});var _o=z("$ZodEnum",(e,t)=>{ne.init(e,t);let r=br(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(a=>Vn.has(typeof a)).map(a=>typeof a=="string"?Ye(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{let c=a.value;return n.has(c)||a.issues.push({code:"invalid_value",values:r,input:c,inst:e}),a}}),xo=z("$ZodLiteral",(e,t)=>{if(ne.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"?Ye(n):n?Ye(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,a)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var bo=z("$ZodTransform",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new jt(e.constructor.name);let a=t.transform(r.value,r);if(n.async)return(a instanceof Promise?a:Promise.resolve(a)).then(c=>(r.value=c,r));if(a instanceof Promise)throw new Ee;return r.value=a,r}});function oo(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(oo,"handleOptionalResult");var Po=z("$ZodOptional",(e,t)=>{ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),se(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(s=>oo(s,r.value)):oo(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var To=z("$ZodNullable",(e,t)=>{ne.init(e,t),se(e._zod,"optin",()=>t.innerType._zod.optin),se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)}|null)$`):void 0}),se(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)}),Eo=z("$ZodDefault",(e,t)=>{ne.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(s=>io(s,t)):io(a,t)}});function io(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}o(io,"handleDefaultResult");var Io=z("$ZodPipe",(e,t)=>{ne.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(c=>Ht(c,t.in,n)):Ht(s,t.in,n)}let a=t.in._zod.run(r,n);return a instanceof Promise?a.then(s=>Ht(s,t.out,n)):Ht(a,t.out,n)}});function Ht(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(Ht,"handlePipeResult");var zo=z("$ZodCustom",(e,t)=>{Be.init(e,t),ne.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(s=>ao(s,r,n,e));ao(a,r,n,e)}});function ao(e,t,r,n){if(!e){let a={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(a.params=n._zod.def.params),t.issues.push(Ir(a))}}o(ao,"handleRefineResult");var So,Lu=Symbol("ZodOutput"),Fu=Symbol("ZodInput"),Or=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 a={...n,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Ao(){return new Or}o(Ao,"registry");(So=globalThis).__zod_globalRegistry??(So.__zod_globalRegistry=Ao());var Rr=globalThis.__zod_globalRegistry;function wo(e,t){return new e({type:"string",...te(t)})}o(wo,"_string");function ko(e,t){return new e({type:"string",coerce:!0,...te(t)})}o(ko,"_coercedString");function Oo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}o(Oo,"_url");function Ro(e,t){return new e({type:"number",checks:[],...te(t)})}o(Ro,"_number");function No(e,t){return new e({type:"number",coerce:!0,checks:[],...te(t)})}o(No,"_coercedNumber");function Do(e,t){return new e({type:"boolean",...te(t)})}o(Do,"_boolean");function Co(e,t){return new e({type:"boolean",coerce:!0,...te(t)})}o(Co,"_coercedBoolean");function Uo(e,t){return new e({type:"bigint",coerce:!0,...te(t)})}o(Uo,"_coercedBigint");function Mo(e){return new e({type:"any"})}o(Mo,"_any");function jo(e){return new e({type:"unknown"})}o(jo,"_unknown");function Lo(e,t){return new e({type:"void",...te(t)})}o(Lo,"_void");function Fo(e,t){return new e({type:"date",coerce:!0,...te(t)})}o(Fo,"_coercedDate");function Bo(e,t){return new $r({check:"greater_than",...te(t),value:e,inclusive:!1})}o(Bo,"_gt");function Nr(e,t){return new $r({check:"greater_than",...te(t),value:e,inclusive:!0})}o(Nr,"_gte");function _e(e){return Bo(0,e)}o(_e,"_positive");function et(e){return Nr(0,e)}o(et,"_nonnegative");function le(e,t){return new Yn({check:"min_length",...te(t),minimum:e})}o(le,"_minLength");function De(e,t){return new Qn({check:"string_format",format:"regex",...te(t),pattern:e})}o(De,"_regex");function Zo(e,t,r){let n=te(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(Zo,"_custom");function Vo(e,t,r){return new e({type:"custom",check:"custom",fn:t,...te(r)})}o(Vo,"_refine");var ue=z("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ne.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>Vt(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>_t(e,r,n),e.parseAsync=async(r,n)=>qt(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>xt(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)=>Zt(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.apply=r=>r(e)}),Kt=z("ZodMiniString",(e,t)=>{Gt.init(e,t),ue.init(e,t)});function i(e){return wo(Kt,e)}o(i,"string");var qo=z("ZodMiniStringFormat",(e,t)=>{Ar.init(e,t),Kt.init(e,t)});var Ku=z("ZodMiniURL",(e,t)=>{so.init(e,t),qo.init(e,t)});function tt(e){return Oo(Ku,e)}o(tt,"url");var Dr=z("ZodMiniNumber",(e,t)=>{uo.init(e,t),ue.init(e,t)});function Y(e){return Ro(Dr,e)}o(Y,"number");var Cr=z("ZodMiniBoolean",(e,t)=>{wr.init(e,t),ue.init(e,t)});function B(e){return Do(Cr,e)}o(B,"boolean");var Ho=z("ZodMiniBigInt",(e,t)=>{co.init(e,t),ue.init(e,t)});var Xu=z("ZodMiniAny",(e,t)=>{lo.init(e,t),ue.init(e,t)});function Pt(){return Mo(Xu)}o(Pt,"any");var Yu=z("ZodMiniUnknown",(e,t)=>{po.init(e,t),ue.init(e,t)});function U(){return jo(Yu)}o(U,"unknown");var Qu=z("ZodMiniVoid",(e,t)=>{mo.init(e,t),ue.init(e,t)});function Wo(e){return Lo(Qu,e)}o(Wo,"_void");var Go=z("ZodMiniDate",(e,t)=>{fo.init(e,t),ue.init(e,t)});var ec=z("ZodMiniArray",(e,t)=>{go.init(e,t),ue.init(e,t)});function O(e,t){return new ec({type:"array",element:e,...te(t)})}o(O,"array");var tc=z("ZodMiniObject",(e,t)=>{ho.init(e,t),ue.init(e,t),se(e,"shape",()=>t.shape)});function d(e,t){let r={type:"object",shape:e??{},...te(t)};return new tc(r)}o(d,"object");var rc=z("ZodMiniUnion",(e,t)=>{kr.init(e,t),ue.init(e,t)});function Z(e,t){return new rc({type:"union",options:e,...te(t)})}o(Z,"union");var nc=z("ZodMiniDiscriminatedUnion",(e,t)=>{yo.init(e,t),ue.init(e,t)});function rt(e,t,r){return new nc({type:"union",options:t,discriminator:e,...te(r)})}o(rt,"discriminatedUnion");var oc=z("ZodMiniRecord",(e,t)=>{vo.init(e,t),ue.init(e,t)});function M(e,t,r){return new oc({type:"record",keyType:e,valueType:t,...te(r)})}o(M,"record");var ic=z("ZodMiniEnum",(e,t)=>{_o.init(e,t),ue.init(e,t),e.options=Object.values(t.entries)});function F(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ic({type:"enum",entries:r,...te(t)})}o(F,"_enum");var ac=z("ZodMiniLiteral",(e,t)=>{xo.init(e,t),ue.init(e,t)});function w(e,t){return new ac({type:"literal",values:Array.isArray(e)?e:[e],...te(t)})}o(w,"literal");var sc=z("ZodMiniTransform",(e,t)=>{bo.init(e,t),ue.init(e,t)});function Ce(e){return new sc({type:"transform",transform:e})}o(Ce,"transform");var uc=z("ZodMiniOptional",(e,t)=>{Po.init(e,t),ue.init(e,t)});function f(e){return new uc({type:"optional",innerType:e})}o(f,"optional");var cc=z("ZodMiniNullable",(e,t)=>{To.init(e,t),ue.init(e,t)});function I(e){return new cc({type:"nullable",innerType:e})}o(I,"nullable");var lc=z("ZodMiniDefault",(e,t)=>{Eo.init(e,t),ue.init(e,t)});function xe(e,t){return new lc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Er(t)}})}o(xe,"_default");var pc=z("ZodMiniPipe",(e,t)=>{Io.init(e,t),ue.init(e,t)});function Ue(e,t){return new pc({type:"pipe",in:e,out:t})}o(Ue,"pipe");var Jo=z("ZodMiniCustom",(e,t)=>{zo.init(e,t),ue.init(e,t)});function Xt(e,t){return Zo(Jo,e??(()=>!0),t)}o(Xt,"custom");function Ze(e,t={}){return Vo(Jo,e,t)}o(Ze,"refine");var Tt={};jn(Tt,{bigint:()=>yc,boolean:()=>hc,date:()=>vc,number:()=>gc,string:()=>fc});function fc(e){return ko(Kt,e)}o(fc,"string");function gc(e){return No(Dr,e)}o(gc,"number");function hc(e){return Co(Cr,e)}o(hc,"boolean");function yc(e){return Uo(Ho,e)}o(yc,"bigint");function vc(e){return Fo(Go,e)}o(vc,"date");var Mr=d({retryOnFailure:d({defaultValue:f(B()),hide:f(B())}),continueOnFailure:d({defaultValue:f(B()),hide:f(B())})}),Ur=class{constructor(t,r,n,a,s,c,p,v,y,_,T){this.name=t;this.displayName=r;this.description=n;this.props=a;this.run=s;this.test=c;this.requireAuth=p;this.errorHandlingOptions=v;this.outputSchema=y;this.audience=_;this.aiMetadata=T}static{o(this,"IAction")}},de=o(e=>new Ur(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 G=d({displayName:i(),description:f(i())}),V=o((e,t)=>d({type:w(t),required:B(),defaultValue:f(Pt())}),"TPropertyValue");var fe=d({...G.shape,...V(i(),"SHORT_TEXT").shape}),Se=d({...G.shape,...V(i(),"LONG_TEXT").shape});var Xo=d({label:i(),value:U()}),Yt=d({disabled:f(B()),placeholder:f(i()),options:O(Xo)});var ge=d({...G.shape,options:Yt,...V(U(),"STATIC_DROPDOWN").shape}),Ae=d({...G.shape,options:Yt,...V(O(U()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var jr=d({...G.shape,...V(U(),"DROPDOWN").shape,refreshers:O(i())}),Et=d({...G.shape,...V(O(U()),"MULTI_SELECT_DROPDOWN").shape,refreshers:O(i())});var we=d({...G.shape,...V(B(),"CHECKBOX").shape});var ke=d({...G.shape,...V(Y(),"NUMBER").shape});var It=d({...G.shape,...V(U(),"FILE").shape});var zt=d({...G.shape,...V(i(),"DATE_TIME").shape});var Yo=M(i(),Z([fe,Se,ge,Et,Ae,we,ke,It,zt])),$t=d({...G.shape,properties:Yo,...V(O(U()),"ARRAY").shape});var St=d({...G.shape,...V(Z([M(i(),U())]),"JSON").shape});var Qo=Z([fe,ge,St,$t,Ae]),xc=M(i(),Qo),Lr=d({refreshers:O(i()),...G.shape,...V(U(),"DYNAMIC").shape});var Qt=d({...G.shape,...V(Wo(),"MARKDOWN").shape});var At=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(At||{}),nt=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(nt||{}),ot=(h=>(h.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",h.COMMUNICATION="COMMUNICATION",h.COMMERCE="COMMERCE",h.CORE="CORE",h.UNIVERSAL_AI="UNIVERSAL_AI",h.FLOW_CONTROL="FLOW_CONTROL",h.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",h.ACCOUNTING="ACCOUNTING",h.PRODUCTIVITY="PRODUCTIVITY",h.CONTENT_AND_FILES="CONTENT_AND_FILES",h.DEVELOPER_TOOLS="DEVELOPER_TOOLS",h.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",h.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",h.HUMAN_RESOURCES="HUMAN_RESOURCES",h.PAYMENT_PROCESSING="PAYMENT_PROCESSING",h.MARKETING="MARKETING",h.SALES_AND_CRM="SALES_AND_CRM",h))(ot||{});var it=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(it||{}),Fr="both_client_credentials_and_authorization_code";var Ie=(a=>(a.POLLING="POLLING",a.WEBHOOK="WEBHOOK",a.APP_WEBHOOK="APP_WEBHOOK",a.MANUAL="MANUAL",a))(Ie||{}),wt=(s=>(s.NONE="NONE",s.HEADER_PRESENT="HEADER_PRESENT",s.QUERY_PRESENT="QUERY_PRESENT",s.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",s.HEAD_REQUEST="HEAD_REQUEST",s))(wt||{}),bc=d({strategy:F(wt),paramName:f(i())}),kt=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(kt||{});var er=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(er||{}),ei=d({status:f(Y()),body:f(U()),headers:f(M(i(),i()))}),ti=d({type:w("DELAY"),resumeDateTime:i(),requestIdToReply:f(i()),handlerId:f(i()),streamStepProgress:f(F(er))}),ri=d({type:w("WEBHOOK"),requestId:i(),requestIdToReply:f(i()),response:ei,handlerId:f(i()),streamStepProgress:f(F(er))}),Pc=Z([ti,ri]);var Tc=d({body:U(),rawBody:f(U()),headers:M(i(),i()),queryParams:M(i(),i())});function be(e){return e==null}o(be,"isNil");function Ot(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(Ot,"isEmpty");function tr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(tr,"assertNotNullOrUndefined");var Br=Xe(require("crypto"),1);var Ec=128,Ve,at,Ic=o(e=>{!Ve||Ve.length<e?(Ve=Buffer.allocUnsafe(e*Ec),Br.default.randomFillSync(Ve),at=0):at+e>Ve.length&&(Br.default.randomFillSync(Ve),at=0),at+=e},"fillPool"),zc=o(e=>(Ic(e|=0),Ve.subarray(at-e,at)),"random"),$c=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,a=Math.ceil(1.6*n*t/e.length);return(s=t)=>{let c="";for(;;){let p=r(a),v=a;for(;v--;)if(c+=e[p[v]&n]||"",c.length===s)return c}}},"customRandom"),oi=o((e,t=21)=>$c(e,t,zc),"customAlphabet");var Sc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ii=21,AP=i().check(De(new RegExp(`^[0-9a-zA-Z]{${ii}}$`))),Ac=oi(Sc,ii);var Me=Ue(Ce(e=>e instanceof Date?e.toISOString():e),i()),ye={id:i(),created:Me,updated:Me},oe=o(e=>f(I(e)),"Nullable");function Zr(e){return f(I(F(e)))}o(Zr,"NullableEnum");var OP=Ue(Ce(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),f(B())),rr=o(e=>Ue(Ce(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),f(O(e))),"OptionalArrayFromQuery");var DP=M(i(),U());var Rt=(_=>(_.OPENAI="openai",_.OPENROUTER="openrouter",_.ANTHROPIC="anthropic",_.AZURE="azure",_.GOOGLE="google",_.ACTIVEPIECES="activepieces",_.CLOUDFLARE_GATEWAY="cloudflare-gateway",_.CUSTOM="custom",_.BEDROCK="bedrock",_.MISTRAL="mistral",_))(Rt||{});var WP=i().check(De(/^#[0-9A-Fa-f]{6}$/));var JP=d({filename:i(),data:U(),type:w("file"),mimetype:f(i())});var wc=Xe(si());var rT=d({...ye,name:i(),permissions:O(i()),platformId:oe(i()),type:i(),userCount:f(Y())});var ui=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(ui||{}),Vr=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Vr||{}),qr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(qr||{});var Hr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Hr||{});var Wr=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Wr||{});var kc=d({mode:F(ui),value:U()}),Oc=d({auth:f(i()),fields:M(i(),kc)}),Rc=d({pieceName:i(),pieceVersion:i(),actionName:i(),predefinedInput:f(Oc)}),Nc=d({type:w("PIECE"),toolName:i().check(le(1)),pieceMetadata:Rc}),Dc=d({type:w("none")}),Cc=d({type:w("access_token"),accessToken:i()}),Uc=d({type:w("api_key"),apiKey:i(),apiKeyHeader:i()}),Mc=d({type:w("headers"),headers:M(i(),i())}),jc=rt("type",[Dc,Cc,Uc,Mc]),ci=d({type:w("FLOW"),toolName:i().check(le(1)),externalFlowId:i(),flowDisplayName:f(i())}),li=d({type:w("MCP"),toolName:i().check(le(1)),serverUrl:tt(),protocol:F(qr),auth:jc}),pi=d({type:w("KNOWLEDGE_BASE"),toolName:i().check(le(1)),sourceType:F(Vr),sourceId:i(),sourceName:i()}),Lc=rt("type",[Nc,ci,li,pi]),Fc=d({displayName:i(),description:f(i()),type:F(Hr)}),di=d({type:w("MARKDOWN"),markdown:i()}),st={type:w("TOOL_CALL"),input:oe(M(i(),U())),output:f(U()),toolName:i(),status:F(Wr),toolCallId:i(),startTime:i(),endTime:f(i())},AT=d(st),mi=rt("toolCallType",[d({...st,toolCallType:w("PIECE"),pieceName:i(),pieceVersion:i(),actionName:i()}),d({...st,toolCallType:w("FLOW"),displayName:i(),externalFlowId:i()}),d({...st,toolCallType:w("MCP"),displayName:i(),serverUrl:i()}),d({...st,toolCallType:w("KNOWLEDGE_BASE"),displayName:i(),sourceType:i()}),d({...st,toolCallType:w("UNKNOWN"),displayName:i()})]),Bc=Z([di,mi]);var Gr=(r=>(r.IMAGE="image",r.TEXT="text",r))(Gr||{}),Oe=d({apiKey:i()}),Zc=Oe,Vc=d({apiKey:i(),apiKeyHash:i()}),qc=Oe,Hc=Oe,Wc=Oe,Gc=Oe,Jc=Oe,Kc=Oe,Xc=Oe,fi=d({accessKeyId:i().check(le(1)),secretAccessKey:i().check(le(1))}),Yc=d({}),Qc=d({}),el=d({}),tl=d({}),rl=d({}),nl=d({}),gi=d({modelId:i(),modelName:i(),modelType:F(Gr)}),hi=d({apiKeyHeader:i(),baseUrl:i(),models:O(gi),defaultHeaders:f(M(i(),i()))}),yi=d({accountId:i(),gatewayId:i(),models:O(gi),vertexProject:f(i()),vertexRegion:f(i())}),vi=d({resourceName:i(),apiVersion:Ue(Ce(e=>typeof e=="string"&&e.trim().length===0?void 0:e),f(i()))}),_i=d({region:i().check(le(1))}),ol=Z([Zc,Wc,Gc,Jc,Kc,Hc,qc,Vc,fi,Xc]),xi=Z([hi,yi,vi,_i,Yc,el,tl,rl,Qc,nl]),il=d({id:i(),name:i(),type:F(Gr)}),al=d({id:i(),name:i(),provider:F(Rt),config:xi,enabledForChat:B()}),sl=d({provider:F(Rt),config:xi,auth:ol,platformId:i()});var RT={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var ul=d({base64Url:i(),fileName:i(),extension:f(i())}),cl=d({mimeType:i(),url:i(),fileName:f(i())}),Jr=Z([ul,cl]);var ll=Z([d({type:w("file"),value:Jr}),d({type:w("markdown"),value:i(),files:f(O(Jr))})]),pl=d({sessionId:i(),message:i(),files:f(O(i()))});var Pi=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Pi||{}),Ti=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Ti||{}),Kr=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Kr||{});var dl=Z([d({...ye,name:i(),externalId:i(),type:w("STATIC_DROPDOWN"),tableId:i(),projectId:i(),data:d({options:O(d({value:i()}))})}),d({...ye,name:i(),externalId:i(),type:Z([w("TEXT"),w("NUMBER"),w("DATE")]),tableId:i(),projectId:i()})]),ml=d({...ye,name:i(),folderId:oe(i()),projectId:i(),externalId:i(),status:Zr(Ti),trigger:Zr(Pi)}),fl=d({...ye,tableId:i(),projectId:i(),cells:M(i(),d({updated:i(),created:i(),value:U(),fieldName:i()}))}),gl=d({events:O(F(Kr)),webhookUrl:i(),flowId:i()}),hl=d({fields:O(d({id:i(),name:i()})),rows:O(M(i(),i())),name:i()}),yl=d({projectId:i(),limit:f(Tt.number()),cursor:f(i()),name:f(i()),externalIds:rr(i()),folderId:f(i()),folderIds:rr(i())}),vl=d({records:O(O(d({fieldId:i(),value:Ii()}))),tableId:i()}),_l=d({cells:f(O(d({fieldId:i(),value:Ii()}))),tableId:i(),agentUpdate:f(B())}),Ei=rt("operator",[qe("eq"),qe("neq"),qe("gt"),qe("gte"),qe("lt"),qe("lte"),qe("co"),bi("exists"),bi("not_exists")]),xl=d({tableId:i(),limit:f(Tt.number()),cursor:f(i()),filters:rr(Ei)});function Ii(){return Ue(Ce(e=>e==null?e:String(e)),I(i()))}o(Ii,"coerceToString");function qe(e){return d({fieldId:i(),operator:w(e),value:i()})}o(qe,"valueFilter");function bi(e){return d({fieldId:i(),operator:w(e)})}o(bi,"existenceFilter");var bl=d({status:f(Y()),body:f(U()),headers:f(M(i(),i()))}),Pl=d({...ye,deleted:oe(Me),ownerId:i(),displayName:i(),platformId:i(),externalId:oe(i())});var zi=d({name:i(),description:f(i()),type:i(),required:B()}),Tl=d({pieceName:i(),triggerName:i(),input:d({toolName:i(),toolDescription:i(),inputSchema:O(zi),returnsResponse:B()})});var $i="^[0-9]+\\.[0-9]+\\.[0-9]+$",YT=new RegExp($i),Il="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",QT=i().check(De(new RegExp($i))),eE=i().check(De(new RegExp(Il))),zl=d({packageType:w("ARCHIVE"),pieceType:F(nt),pieceName:i(),pieceVersion:i(),archiveId:i(),platformId:i()}),Si=d({packageType:w("REGISTRY"),pieceType:w("OFFICIAL"),pieceName:i(),pieceVersion:i()}),Ai=d({packageType:w("REGISTRY"),pieceType:w("CUSTOM"),pieceName:i(),pieceVersion:i(),platformId:i()}),tE=Z([Si,Ai]),rE=Z([zl,Si,Ai]),wi=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(wi||{}),$l=d({type:F(wi),cronExpression:i(),timezone:i()}),nE=d({...ye,type:F(Ie),projectId:i(),flowId:i(),triggerName:i(),schedule:oe($l),flowVersionId:i(),pieceName:i(),pieceVersion:i(),deleted:oe(i()),simulate:B()}),ki=(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))(ki||{}),Oi=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Oi||{}),Ri=(r=>(r.S3="S3",r.DB="DB",r))(Ri||{}),oE=d({...ye,projectId:oe(i()),platformId:oe(i()),type:F(ki),compression:F(Oi),data:f(U()),location:F(Ri),size:oe(Y()),fileName:oe(i()),s3Key:oe(i()),metadata:oe(M(i(),i()))}),Ni=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Ni||{}),Di=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Di||{}),iE=d({id:i(),email:i(),firstName:i(),status:F(Di),externalId:oe(i()),platformId:oe(i()),platformRole:F(Ni),lastName:i(),created:Me,updated:Me,lastActiveDate:oe(Me),imageUrl:oe(i())});var Xr=d({...G.shape,...V(M(i(),U()),"OBJECT").shape});var ji=d({...G.shape,...V(i(),"COLOR").shape});var Yr=Z([fe,Se,Qt,we,ge,Ae,jr,Et,Lr,ke,$t,Xr,St,zt,It,ji]),b={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 ze=d({displayName:i(),description:f(i())});var Li=d({username:i(),password:i()}),Qr=d({...ze.shape,username:d({displayName:i(),description:f(i())}),password:d({displayName:i(),description:f(i())}),...V(Li,"BASIC_AUTH").shape});var kl=M(i(),Z([fe,Se,ke,we,ge])),en=d({...ze.shape,props:kl,...V(U(),"CUSTOM_AUTH").shape});var He=d({...ze.shape,...V(d({auth:i()}),"SECRET_TEXT").shape});var Ol=M(i(),Z([fe,Se,He,ke,we,ge,Ae,Qt])),Fi=d({...ze.shape,props:Ol,...V(U(),"OIDC").shape});var tn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(tn||{}),Bi=Z([fe,He,ge]),Zi=M(i(),Bi),Rl=d({props:f(M(i(),Bi)),authUrl:i(),tokenUrl:i(),scope:O(i()),prompt:f(Z([w("none"),w("consent"),w("login"),w("omit")])),pkce:f(B()),pkceMethod:f(Z([w("plain"),w("S256")])),authorizationMethod:f(F(tn)),grantType:f(Z([F(it),w(Fr)])),extra:f(M(i(),i()))}),Vi=d({access_token:i(),props:f(Zi),data:M(i(),Pt())}),rn=d({...ze.shape,...Rl.shape,...V(Vi,"OAUTH2").shape});var ut=Z([Qr,en,Fi,rn,He]),Nt="Connection",nn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Nt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Nt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Nt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Nt}},None(){}};var UI={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 Nl=d({...G.shape,...V(U(),"CUSTOM").shape,code:i()});var Dl=Z([Yr,ut]),on=M(i(),Dl),rz=M(i(),Yr);var qi=Z([d({strategy:w("CRON"),cronExpression:i()}),d({strategy:w("NONE")})]),ct=class{constructor(t,r,n,a,s,c,p,v,y,_,T,x,u,l,g,m,h,P,E){this.name=t;this.displayName=r;this.description=n;this.requireAuth=a;this.props=s;this.type=c;this.handshakeConfiguration=p;this.onHandshake=v;this.renewConfiguration=y;this.onRenew=_;this.onEnable=T;this.onDisable=x;this.onStart=u;this.run=l;this.test=g;this.sampleData=m;this.testStrategy=h;this.outputSchema=P;this.aiMetadata=E}static{o(this,"ITrigger")}},lt=o(e=>{switch(e.type){case"WEBHOOK":return new ct(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 ct(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 ct(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 ct(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,be(e.sampleData)&&be(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Hi="2",or="0.82.0";var an=class{constructor(t,r,n,a,s,c,p,v,y=or,_,T=""){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=a;this.categories=p;this.auth=v;this.minimumSupportedRelease=y;this.maximumSupportedRelease=_;this.description=T;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:Hi}),"getContextInfo");(!Cl(y)||Ul(y,or))&&(this.minimumSupportedRelease=or),s.forEach(x=>this._actions[x.name]=x),c.forEach(x=>this._triggers[x.name]=x)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},Wi=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,a)=>n===a.findIndex(s=>s.type===r.type)))throw new Error("Auth properties must be unique by type");return new an(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function Cl(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Cl,"isValidSimpleSemver");function Ul(e,t){let[r,n,a]=e.split(".").map(Number),[s,c,p]=t.split(".").map(Number);return r!==s?r<s:n!==c?n<c:a<p}o(Ul,"isSemverLessThan");var Ml=f(M(i(),M(i(),i()))),Gi=d({id:f(i()),name:i(),displayName:i(),logoUrl:i(),description:i(),authors:O(i()),platformId:f(i()),directoryPath:f(i()),auth:f(Z([ut,O(ut)])),version:i(),categories:f(O(F(ot))),minimumSupportedRelease:f(i()),maximumSupportedRelease:f(i()),i18n:Ml}),jl=F(["human","ai","both"]),Ji=d({description:f(i()),idempotent:f(B())}),Ki=d({name:i(),displayName:i(),description:i(),props:on,requireAuth:B(),errorHandlingOptions:f(Mr),outputSchema:f(Xt()),audience:f(jl),aiMetadata:f(Ji)}),Xi=d({name:i(),displayName:i(),description:i(),props:on,errorHandlingOptions:f(Mr),type:F(Ie),sampleData:U(),handshakeConfiguration:f(Xt()),renewConfiguration:f(qi),testStrategy:F(kt),outputSchema:f(Xt()),aiMetadata:f(Ji)}),Ll=d({...Gi.shape,actions:M(i(),Ki),triggers:M(i(),Xi)}),Fl=d({...Gi.shape,actions:Y(),triggers:Y(),suggestedActions:f(O(Xi)),suggestedTriggers:f(O(Ki))}),Yi=d({projectUsage:Y(),tags:f(O(i())),pieceType:F(nt),packageType:F(At),platformId:f(i()),archiveId:f(i())}),r$=d({...Ll.shape,...Yi.shape}),n$=d({...Fl.shape,...Yi.shape}),o$=d({name:i(),version:i()});var Bl=Xe(require("path")),Zl=Xe(require("fs/promises"));var ir=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}`,a=new URLSearchParams;return r.searchParams.forEach((s,c)=>{a.append(c,s)}),{urlWithoutQueryParams:n,queryParams:a}}getHeaders(t){let r={Accept:"application/json"};if(t.authentication&&this.populateAuthentication(t.authentication,r),t.body)switch(t.headers?.["Content-Type"]){case"text/csv":r["Content-Type"]="text/csv";break;default:r["Content-Type"]="application/json";break}return t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var ar=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new sn,r=new un){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},sn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},un=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,a=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${a}`,r}};var sr=class extends Error{constructor(r,n){let a=n.status||500,s=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:a,body:s},request:{body:r}}));this.requestBody=r;this.status=a,this.responseBody=s}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var ur=class extends ir{static{o(this,"FetchHttpClient")}constructor(t="",r=new ar){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:a}=this.getUrl(t),s=this.getHeaders(t),c=t.queryParams??{};for(let[E,j]of Object.entries(c))a.append(E,j);let p=a.toString(),v=p?`${n}?${p}`:n,y=t.responseType??"json",_=t.followRedirects??!0,T=t.retries??0,{body:x,extraHeaders:u,isStream:l}=Vl(t.body,s),g=Hl({...s,...u}),m=await ql(async()=>{let E=new AbortController,j=t.timeout&&t.timeout>0?setTimeout(()=>E.abort(),t.timeout):void 0;try{let A={method:t.method.toString(),headers:g,body:x,redirect:_?"follow":"manual",signal:E.signal};return l&&(A.duplex="half"),r?.dispatcher!==void 0&&(A.dispatcher=r.dispatcher),await fetch(v,A)}finally{j!==void 0&&clearTimeout(j)}},T),h=_?300:400;if(m.status<200||m.status>=h){let E=await Qi(m,y),j=new sr(t.body,{status:m.status,responseBody:E});throw console.error("[HttpClient#(sanitized error message)] Request failed:",j),j}let P=await Qi(m,y);return{status:m.status,headers:Wl(m.headers),body:P}}};function Vl(e,t){return Jl(e)?{body:void 0,extraHeaders:{},isStream:!1}:Gl(e)?{body:e,extraHeaders:e.getHeaders(),isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(Vl,"serializeBody");async function Qi(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();case"json":default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(Qi,"parseResponseBody");async function ql(e,t){let r;for(let n=0;n<=t;n++)try{let a=await e();if(a.status>=500&&n<t){await ea(n);continue}return a}catch(a){if(r=a,n<t){await ea(n);continue}throw a}throw r}o(ql,"sendWithRetries");function ea(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(ea,"backoff");function Hl(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]=Array.isArray(n)?n.join(", "):n);return t}o(Hl,"normalizeHeaders");function Wl(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(Wl,"toHttpHeaders");function Gl(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}o(Gl,"isNodeFormData");function Jl(e){return e==null}o(Jl,"isNil");var X=new ur;var he=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(he||{});var Cd=Xe(require("fs")),au=Xe(iu());var Ud={"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 Md(e){let t=e.split(";")[0].trim().toLowerCase();return Ud[t]??""}o(Md,"contentTypeToExtension");var jd=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Ld=o((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function su({auth:e,baseUrl:t,authMapping:r,description:n,displayName:a,name:s,props:c,extraProps:p,authLocation:v="headers"}){return de({audience:"human",name:s||"custom_api_call",displayName:a||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:b.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:y})=>({url:b.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
+ i.e ${Ld(t,y)}/resource or /resource`,required:!0,defaultValue:y?t(y):"",...c?.url??{}})}),"props")}),method:b.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(he).map(y=>({label:y,value:y}))},...c?.method??{}}),headers:b.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:b.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:b.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:b.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:y})=>{if(!y)return{};let _=y,T={};switch(_){case"none":break;case"json":T.data=b.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":T.data=b.LongText({displayName:"Raw Body",required:!0});break;case"form_data":T.data=b.Array({displayName:"Form Data",required:!0,properties:{fieldName:b.ShortText({displayName:"Field Name",required:!0}),fieldType:b.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:b.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:b.File({displayName:"File Field Value",required:!1})}});break}return T},"props")}),response_is_binary:b.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:b.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:b.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:b.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...p},run:o(async y=>{let{method:_,url:T,headers:x,queryParams:u,body:l,body_type:g,failsafe:m,timeout:h,response_is_binary:P,followRedirects:E}=y.propsValue;tr(_,"Method"),tr(T,"URL");let j=be(r)?{}:await r(y.auth,y.propsValue),A=T.url,L=A.startsWith("http://")||A.startsWith("https://")?A:jd({baseUrl:t(y.auth),relativePath:A}),k={method:_,url:L,headers:{...x??{},...v==="headers"||!be(v)?j:{}},queryParams:{...v==="queryParams"?j:{},...u??{}},timeout:h?h*1e3:0,followRedirects:E};if(P&&(k.responseType="arraybuffer"),l)if(g&&g!=="none"){let J=l.data;if(g==="form_data"){let re=J,q=new au.default;for(let{fieldName:ee,fieldType:K,textFieldValue:Le,fileFieldValue:Ge}of re)K==="text"&&!Ot(Le)?q.append(ee,Le):K==="file"&&!Ot(Ge)&&q.append(ee,Ge.data,{filename:Ge?.filename});k.body=q,k.headers={...k.headers,...q.getHeaders()}}else k.body=J}else g||(k.body=l);try{let J=await X.sendRequest(k);return await Fd(y.files,J.body,J.status,J.headers,P)}catch(J){if(m)return J.errorMessage();throw J}},"run")})}o(su,"createCustomApiCallAction");var Fd=o(async(e,t,r,n,a)=>{let s;if(a&&Bd(t)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],p=Md(c??"")||"txt",v;t instanceof ArrayBuffer?v=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?v=t:v=Buffer.from(t),s=await e.write({fileName:`output.${p}`,data:v})}else s=t;return{status:r,headers:n,body:s}},"handleBinaryResponse"),Bd=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var Q=nn.OAuth2({description:"Connect your CloudConvert account using OAuth2",authUrl:"https://cloudconvert.com/oauth/authorize",tokenUrl:"https://cloudconvert.com/oauth/token",required:!0,grantType:"authorization_code",scope:["task.read","task.write"],props:{region:b.StaticDropdown({displayName:"Region",description:"CloudConvert processing region",required:!0,options:{options:[{label:"Auto (Nearest)",value:"auto"},{label:"EU Central (Germany)",value:"eu-central"},{label:"US East (Virginia)",value:"us-east"}]},defaultValue:"auto"})}});var ce=class{static{o(this,"CloudConvertClient")}constructor(t){switch(this.auth=t,t.region||"auto"){case"eu-central":this.baseUrl="https://eu-central.api.cloudconvert.com/v2";break;case"us-east":this.baseUrl="https://us-east.api.cloudconvert.com/v2";break;default:this.baseUrl="https://api.cloudconvert.com/v2"}}async apiCall({method:t,resourceUri:r,body:n=void 0,queryParams:a=void 0}){let s={type:"BEARER_TOKEN",token:this.auth.access_token};return await X.sendRequest({method:t,url:`${this.baseUrl}${r}`,body:n,queryParams:a,authentication:s})}async createImportTask(t,r){let n=await this.apiCall({method:"POST",resourceUri:"/import/url",body:{url:t,...r&&{filename:r}}});if(n.status!==201)throw new Error(`Failed to create import task: HTTP ${n.status} - ${n.body?.message||"Unknown error"}`);return n.body.data}async createUploadTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/import/upload",body:{filename:t}});if(r.status!==201)throw new Error(`Failed to create upload task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createImportBase64Task(t,r){let n=await this.apiCall({method:"POST",resourceUri:"/import/base64",body:{file:t,filename:r}});if(n.status!==201)throw new Error(`Failed to create base64 import task: HTTP ${n.status} - ${n.body?.message||"Unknown error"}`);return n.body.data}async createArchiveTask(t,r,n){let a={input:Array.isArray(t)&&t.length===1?t[0]:t,output_format:r};n?.filename&&(a.filename=n.filename),n?.engine&&(a.engine=n.engine,n.engineVersion&&(a.engine_version=n.engineVersion)),n?.timeout&&(a.timeout=n.timeout);let s=await this.apiCall({method:"POST",resourceUri:"/archive",body:a});if(s.status!==201)throw new Error(`Failed to create archive task: HTTP ${s.status} - ${s.body?.message||"Unknown error"}`);return s.body.data}async createCaptureTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/capture-website",body:t});if(r.status!==201)throw new Error(`Failed to create capture task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createConvertTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/convert",body:t});if(r.status!==201)throw new Error(`Failed to create convert task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createMergeTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/merge",body:t});if(r.status!==201)throw new Error(`Failed to create merge task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createOptimizeTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/optimize",body:t});if(r.status!==201)throw new Error(`Failed to create optimize task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createExportTask(t){let r=await this.apiCall({method:"POST",resourceUri:"/export/url",body:{input:t}});if(r.status!==201)throw new Error(`Failed to create export task: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async createJob(t,r){let n=await this.apiCall({method:"POST",resourceUri:"/jobs",body:{tasks:t,...r&&{tag:r}}});if(n.status!==201)throw new Error(`Failed to create job: HTTP ${n.status} - ${n.body?.message||"Unknown error"}`);return n.body.data}async getJob(t){let r=await this.apiCall({method:"GET",resourceUri:`/jobs/${t}`});if(r.status!==200)throw new Error(`Failed to get job: HTTP ${r.status} - ${r.body?.message||"Unknown error"}`);return r.body.data}async getTask(t,r){let n=await this.apiCall({method:"GET",resourceUri:`/tasks/${t}`,queryParams:r});if(n.status!==200)throw new Error(`Failed to get task: HTTP ${n.status} - ${n.body?.message||"Unknown error"}`);return n.body.data}async getSupportedFormats(t){let r={};t?.inputFormat&&(r["filter[input_format]"]=t.inputFormat),t?.outputFormat&&(r["filter[output_format]"]=t.outputFormat),t?.engine&&(r["filter[engine]"]=t.engine),t?.include&&(r.include=t.include.join(","));let n=await this.apiCall({method:"GET",resourceUri:"/convert/formats",queryParams:r});if(n.status!==200)throw new Error(`Failed to get supported formats: HTTP ${n.status} - ${n.body?.message||"Unknown error"}`);return n.body.data||[]}};var Zd=o(()=>b.Dropdown({displayName:"Output Format",description:"The target format to convert to",required:!0,refreshers:["auth"],auth:Q,options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your CloudConvert account first",options:[]};try{let r=await new ce(e.props).getSupportedFormats();if(r.length===0)return{disabled:!0,placeholder:"No supported formats found",options:[]};let n={};r.forEach(c=>{let p=c.meta?.group||"Other";n[p]||(n[p]=[]),n[p].push({label:c.output_format.toUpperCase(),value:c.output_format})});let a=["pdf","docx","jpg","png","mp4","mp3"],s=[];return a.forEach(c=>{let p=r.find(v=>v.output_format===c);p&&s.push({label:p.output_format.toUpperCase(),value:p.output_format})}),r.forEach(c=>{a.includes(c.output_format)||s.push({label:c.output_format.toUpperCase(),value:c.output_format})}),{options:s.slice(0,50)}}catch{return{disabled:!0,placeholder:"Error loading formats - please try again",options:[]}}},"options")}),"outputFormatDropdown"),Vd=o(({required:e=!1})=>b.Dropdown({auth:Q,displayName:"Engine",description:"Use a specific engine for the conversion",required:e,refreshers:["auth"],options:o(async({auth:t})=>t?{options:[{label:"LibreOffice (Default)",value:"libreoffice"},{label:"Microsoft Office",value:"office"},{label:"OnlyOffice",value:"onlyoffice"},{label:"Chrome/Puppeteer",value:"chrome"},{label:"ImageMagick",value:"imagemagick"},{label:"Poppler",value:"poppler"},{label:"GraphicsMagick",value:"graphicsmagick"},{label:"FFmpeg",value:"ffmpeg"},{label:"Calibre",value:"calibre"},{label:"Pandoc",value:"pandoc"},{label:"3-Heights",value:"3heights"},{label:"PDFTron",value:"pdftron"},{label:"MuPDF",value:"mupdf"},{label:"Inkscape",value:"inkscape"}]}:{disabled:!0,placeholder:"Connect your CloudConvert account first",options:[]},"options")}),"engineDropdown"),wn=o(()=>({import_method:b.StaticDropdown({displayName:"Import Method",description:"How to import the file for conversion",required:!0,options:{options:[{label:"File Upload",value:"upload"},{label:"File URL",value:"url"},{label:"Stored File ID",value:"stored_file"}]},defaultValue:"upload"}),file:b.File({displayName:"File",description:"File to upload and convert (select from your device)",required:!1}),url:b.ShortText({displayName:"File URL",description:"URL of the file to convert",required:!1}),stored_file_id:b.ShortText({displayName:"Stored File ID",description:"ID of a previously stored file in Activepieces to convert",required:!1}),input_format:b.StaticDropdown({displayName:"Input Format",description:'The format of the input file. Leave as "Auto-detect" to let CloudConvert detect automatically',required:!1,options:{options:[{label:"Auto-detect",value:"auto"},{label:"PDF",value:"pdf"},{label:"DOCX",value:"docx"},{label:"DOC",value:"doc"},{label:"TXT",value:"txt"},{label:"JPG",value:"jpg"},{label:"PNG",value:"png"},{label:"HTML",value:"html"},{label:"Other",value:"other"}]},defaultValue:"auto"}),output_format:Zd(),filename:b.ShortText({displayName:"Output Filename",description:"Choose a filename (including extension) for the output file",required:!1,defaultValue:"converted-file"}),engine:Vd({required:!1}),engine_version:b.ShortText({displayName:"Engine Version",description:"Use a specific engine version for the conversion",required:!1}),timeout:b.Number({displayName:"Timeout (seconds)",description:"Timeout in seconds after which the task will be cancelled",required:!1}),wait_for_completion:b.Checkbox({displayName:"Wait for Completion",description:"Wait for the conversion to complete before returning",required:!0,defaultValue:!0}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the converted file in Activepieces",required:!1,defaultValue:!0})}),"convertFileProps");var kn=d({import_method:F(["upload","url","stored_file"]),file:f(I(d({base64:i(),filename:f(i()),extension:f(i())}))),url:f(I(i().check(tt()))),stored_file_id:f(I(i())),input_format:f(I(i())).check(Ze(e=>!e||e==="auto"||e.length>0,{message:"Input format must be either 'auto' or a valid format"})),output_format:i().check(le(1,"Output format is required")),filename:f(I(i())),engine:f(I(i())),engine_version:f(I(i())),timeout:f(I(Y().check(_e()))),wait_for_completion:xe(B(),!0),store_file:xe(B(),!0)}).check(Ze(e=>e.import_method==="upload"?e.file&&e.file.base64:e.import_method==="url"?e.url:e.import_method==="stored_file"?e.stored_file_id:!1,{message:"File is required for upload method, URL is required for URL method, Stored File ID is required for stored file method",path:["file"]})),On=d({url:i().check(tt("Valid website URL is required")),output_format:i().check(le(1,"Output format is required")),pages:f(I(i())),zoom:f(I(Y().check(_e()))),page_width:f(I(Y().check(_e()))),page_height:f(I(Y().check(_e()))),page_format:f(I(i())),page_orientation:f(I(i())),margin_top:f(I(Y().check(et()))),margin_bottom:f(I(Y().check(et()))),margin_left:f(I(Y().check(et()))),margin_right:f(I(Y().check(et()))),print_background:f(I(B())),display_header_footer:f(I(B())),header_template:f(I(i())),footer_template:f(I(i())),wait_until:f(I(i())),wait_for_element:f(I(i())),wait_time:f(I(Y().check(_e()))),css_media_type:f(I(i())),filename:f(I(i())),engine:f(I(i())),engine_version:f(I(i())),timeout:f(I(Y().check(_e()))),wait_for_completion:xe(B(),!0),store_file:xe(B(),!0)}),Rn=d({import_method:F(["upload","url","stored_file"]),files:O(d({url:f(I(i())),file:f(I(d({base64:i(),filename:f(i()),extension:f(i())}))),stored_file_id:f(I(i())),filename:f(I(i()))})).check(le(2,"At least 2 files are required for merging")),filename:f(I(i())),engine:f(I(i())),engine_version:f(I(i())),timeout:f(I(Y().check(_e()))),wait_for_completion:xe(B(),!0),store_file:xe(B(),!0)}).check(Ze(e=>e.files.every(t=>e.import_method==="upload"?t.file&&t.file.base64:e.import_method==="url"?t.url:e.import_method==="stored_file"?t.stored_file_id:!1),{message:"All files must have valid input based on the selected import method",path:["files"]})),Nn=d({task_id:i().check(le(1,"Task ID is required")),include:f(I(O(i()))),store_file:f(B())}),Dn=d({import_method:F(["upload","url","stored_file"]),files:O(d({url:f(I(i())),file:f(I(d({base64:i(),filename:f(i()),extension:f(i())}))),stored_file_id:f(I(i())),filename:f(I(i()))})).check(le(1,"At least one file is required to create an archive")),output_format:i().check(le(1,"Output format is required")),filename:f(I(i())),engine:f(I(i())),engine_version:f(I(i())),timeout:f(I(Y().check(_e()))),wait_for_completion:xe(B(),!0),store_file:xe(B(),!0)}).check(Ze(e=>e.files.every(t=>e.import_method==="upload"?t.file&&t.file.base64:e.import_method==="url"?t.url:e.import_method==="stored_file"?t.stored_file_id:!1),{message:"All files must have valid input based on the selected import method",path:["files"]})),Cn=d({import_method:F(["upload","url","stored_file"]),file:f(I(d({base64:i(),filename:f(i()),extension:f(i())}))),url:f(I(i().check(tt()))),stored_file_id:f(I(i())),input_format:f(I(i())),profile:f(I(i())),flatten_signatures:f(I(B())),colorspace:f(I(i())),filename:f(I(i())),engine:f(I(i())),engine_version:f(I(i())),timeout:f(I(Y().check(_e()))),wait_for_completion:xe(B(),!0),store_file:xe(B(),!0)}).check(Ze(e=>e.import_method==="upload"?e.file&&e.file.base64:e.import_method==="url"?e.url:e.import_method==="stored_file"?e.stored_file_id:!1,{message:"File is required for upload method, URL is required for URL method, Stored File ID is required for stored file method",path:["file"]}));var ve={baseUrl:o((e="auto")=>{switch(e){case"eu-central":return"https://eu-central.api.cloudconvert.com/v2";case"us-east":return"https://us-east.api.cloudconvert.com/v2";default:return"https://api.cloudconvert.com/v2"}},"baseUrl"),createClient(e){return new ce(e)}};var uu=lt({name:"new_job",displayName:"New Job Event",description:"Triggers when a new job has been created",aiMetadata:{description:"Fires when a new CloudConvert job is created (job.created webhook event), before its tasks have run. Represents a freshly queued conversion/merge/archive/optimize job and carries the job with its waiting tasks."},auth:Q,type:"WEBHOOK",props:{},sampleData:{event:"job.created",job:{id:"6559c281-ed85-4728-80db-414561c631e9",tag:"myjob-123",status:"waiting",created_at:"2018-09-19T14:42:58+00:00",started_at:null,ended_at:null,tasks:[{id:"7f110c42-3245-41cf-8555-37087c729ed2",name:"import-my-file",operation:"import/s3",status:"waiting",created_at:"2018-09-19T14:42:58+00:00",started_at:null,ended_at:null},{id:"7a142bd0-fa20-493e-abf5-99cc9b5fd7e9",name:"convert-my-file",operation:"convert",status:"waiting",created_at:"2018-09-19T14:42:58+00:00",started_at:null,ended_at:null,engine:"office",engine_version:"2016"},{id:"36af6f54-1c01-45cc-bcc3-97dd23d2f93d",name:"export-my-file",operation:"export/s3",status:"waiting",created_at:"2018-09-19T14:42:58+00:00",started_at:null,ended_at:null}]}},async test(e){return[this.sampleData]},onEnable:o(async e=>{let t=e.webhookUrl,r={method:"POST",url:`${ve.baseUrl(e.auth.props?.region||"auto")}/webhooks`,body:{url:t,events:["job.created"]},authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{"Content-Type":"application/json"}},n=await X.sendRequest(r);if(n.status!==201)throw new Error(`Failed to register webhook. Status: ${n.status}`)},"onEnable"),onDisable:o(async e=>{let t=e.webhookUrl,r={method:"GET",url:`${ve.baseUrl(e.auth.region||"auto")}/users/me/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};try{let n=await X.sendRequest(r);if(n.status===200&&n.body.data){let a=n.body.data.find(s=>s.url===t);if(a){let s={method:"DELETE",url:`${ve.baseUrl(e.auth.region||"auto")}/webhooks/${a.id}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};await X.sendRequest(s)}}}catch{}},"onDisable"),run:o(async e=>{let t=e.payload.body;return t?.event==="job.created"&&t?.job?[t]:[]},"run")});var cu=lt({name:"job_finished",displayName:"Job Finished",description:"Triggers when a CloudConvert job has been completed",aiMetadata:{description:"Fires when a CloudConvert job finishes successfully (job.finished webhook event). Represents a completed job whose tasks have all succeeded, carrying the finished tasks and the download URLs of the resulting output files."},auth:Q,type:"WEBHOOK",props:{},sampleData:{event:"job.finished",job:{id:"6559c281-ed85-4728-80db-414561c631e9",tag:"myjob-123",status:"finished",created_at:"2018-09-19T14:42:58+00:00",started_at:"2018-09-19T14:42:58+00:00",ended_at:"2018-09-19T14:43:08+00:00",tasks:[{id:"1f34c1b5-9ee8-4c8c-890f-bf44cda1deb7",name:"import-my-file",operation:"import/url",status:"finished",created_at:"2018-09-19T14:42:58+00:00",started_at:"2018-09-19T14:42:58+00:00",ended_at:"2018-09-19T14:42:59+00:00",result:{files:[{filename:"input.pdf",size:10240}]}},{id:"48c6e72b-cb8e-4ecc-bf3d-ead5477b4741",name:"convert-my-file",operation:"convert",status:"finished",created_at:"2018-09-19T14:42:58+00:00",started_at:"2018-09-19T14:42:59+00:00",ended_at:"2018-09-19T14:43:08+00:00",engine:"office",engine_version:"2016",result:{files:[{filename:"output.docx",url:"https://storage.cloudconvert.com/48c6e72b-cb8e-4ecc-bf3d-ead5477b4741/output.docx",size:15360}]}},{id:"36af6f54-1c01-45cc-bcc3-97dd23d2f93d",name:"export-my-file",operation:"export/url",status:"finished",created_at:"2018-09-19T14:42:58+00:00",started_at:"2018-09-19T14:43:08+00:00",ended_at:"2018-09-19T14:43:08+00:00",result:{files:[{filename:"output.docx",url:"https://storage.cloudconvert.com/36af6f54-1c01-45cc-bcc3-97dd23d2f93d/output.docx",size:15360}]}}]}},async test(e){return[this.sampleData]},onEnable:o(async e=>{let t=e.webhookUrl,r={method:"POST",url:`${ve.baseUrl(e.auth.props?.region||"auto")}/webhooks`,body:{url:t,events:["job.finished"]},authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{"Content-Type":"application/json"}},n=await X.sendRequest(r);if(n.status!==201)throw new Error(`Failed to register webhook. Status: ${n.status}`)},"onEnable"),onDisable:o(async e=>{let t=e.webhookUrl,r={method:"GET",url:`${ve.baseUrl(e.auth.region||"auto")}/users/me/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};try{let n=await X.sendRequest(r);if(n.status===200&&n.body.data){let a=n.body.data.find(s=>s.url===t);if(a){let s={method:"DELETE",url:`${ve.baseUrl(e.auth.region||"auto")}/webhooks/${a.id}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};await X.sendRequest(s)}}}catch{}},"onDisable"),run:o(async e=>{let t=e.payload.body;return t?.event==="job.finished"&&t?.job?[t]:[]},"run")});var lu=lt({name:"job_failed",displayName:"Job Failed",description:"Triggers when a CloudConvert job has failed",aiMetadata:{description:"Fires when a CloudConvert job fails (job.failed webhook event). Represents a job that ended in error, carrying the failed tasks along with their error message and code for handling or alerting."},auth:Q,type:"WEBHOOK",props:{},sampleData:{event:"job.failed",job:{id:"job_123456789",tag:"example-job",status:"error",created_at:"2023-12-01T12:00:00Z",started_at:"2023-12-01T12:00:05Z",ended_at:"2023-12-01T12:00:15Z",message:"Task failed: File conversion error",code:"CONVERSION_FAILED",tasks:[{id:"task_123456789",name:"convert-my-file",operation:"convert",status:"error",message:"File conversion error",code:"CONVERSION_FAILED",created_at:"2023-12-01T12:00:00Z",started_at:"2023-12-01T12:00:05Z",ended_at:"2023-12-01T12:00:15Z",engine:"office",engine_version:"2016",result:null}]}},async test(e){return[this.sampleData]},onEnable:o(async e=>{let t=e.webhookUrl,r={method:"POST",url:`${ve.baseUrl(e.auth.props?.region||"auto")}/webhooks`,body:{url:t,events:["job.failed"]},authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{"Content-Type":"application/json"}},n=await X.sendRequest(r);if(n.status!==201)throw new Error(`Failed to register webhook. Status: ${n.status}`)},"onEnable"),onDisable:o(async e=>{let t=e.webhookUrl,r={method:"GET",url:`${ve.baseUrl(e.auth.props?.region||"auto")}/users/me/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};try{let n=await X.sendRequest(r);if(n.status===200&&n.body.data){let a=n.body.data.find(s=>s.url===t);if(a){let s={method:"DELETE",url:`${ve.baseUrl(e.auth.props?.region||"auto")}/webhooks/${a.id}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}};await X.sendRequest(s)}}}catch{}},"onDisable"),run:o(async e=>{let t=e.payload.body;return t?.event==="job.failed"&&t?.job?[t]:[]},"run")});var qd=wn,pu=de({name:"convert_file",displayName:"Convert File",description:"Create a basic file conversion task for a single file with desired output format",audience:"both",aiMetadata:{description:"Converts a single file from one format to another via CloudConvert (200+ formats; input format auto-detected unless specified). Choose this to transform a document, image, audio, or video file into a different format. Supply the input via one of three import methods \u2014 a public URL, an uploaded file, or a previously stored Activepieces file ID \u2014 and set the target output_format. Each call creates a new conversion job, so it is not idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:qd(),async run(e){await kn.parseAsync(e.propsValue);let{import_method:t,url:r,file:n,stored_file_id:a,input_format:s,output_format:c,filename:p,engine:v,engine_version:y,timeout:_,wait_for_completion:T,store_file:x}=e.propsValue,u=new ce(e.auth);try{let l=await u.getSupportedFormats({inputFormat:s==="auto"?void 0:s,outputFormat:c,include:["options","engine_versions"]});if(l.length===0){let E=await u.getSupportedFormats({outputFormat:c,include:["options","engine_versions"]});throw new Error(`Conversion from ${s||"auto-detected format"} to ${c} is not supported by CloudConvert. Available input formats for ${c}: ${E.map(j=>j.input_format).join(", ")}`)}let g=[...new Set(l.map(E=>E.engine))],m={};if(t==="url"){if(!r)throw new Error("File URL is required when using URL import method");m["import-file"]={operation:"import/url",url:r,...p&&{filename:p}}}else if(t==="stored_file"){if(!a)throw new Error("Stored File ID is required when using stored file import method");if(!e.server?.apiUrl)throw new Error("Server API URL is not available. Please check your Activepieces server configuration.");let j=`${e.server.apiUrl.replace(/\/$/,"")}/v1/step-files/${a}`;try{new URL(j)}catch(A){throw new Error(`Invalid file URL constructed: ${j}. URL Error: ${A instanceof Error?A.message:String(A)}`)}m["import-file"]={operation:"import/url",url:j,...p&&{filename:p}}}else if(t==="upload"){if(!n||!n.base64)throw new Error("Please select a file to upload from your device");let E=await u.createUploadTask(n.filename||"uploaded-file"),j=E.result.form.url,A=E.result.form.parameters,L=new FormData;if(Object.entries(A).forEach(([J,re])=>{L.append(J,re)}),n.base64){let J=Buffer.from(n.base64,"base64"),re=new Blob([J],{type:n.extension?`application/${n.extension}`:"application/octet-stream"});L.append("file",re,n.filename)}let k=await X.sendRequest({method:"POST",url:j,body:L});if(k.status<200||k.status>=300)throw new Error(`Failed to upload file: HTTP ${k.status} - ${k.body?.message||"Upload failed"}`);m["import-file"]={operation:"import/upload",...p&&{filename:p}}}else throw new Error("Invalid import method selected");let h={input:"import-file",output_format:c};s&&s!=="auto"&&(h.input_format=s),p&&(h.filename=p),v?g.includes(v)?h.engine=v:h.engine=g[0]:g.length>0&&(h.engine=g[0]),y&&(h.engine_version=y),_&&(h.timeout=_),m["convert-file"]={operation:"convert",...h},m["export-file"]={operation:"export/url",input:"convert-file"};let P=await u.createJob(m,`convert-${Date.now()}`);if(T){let E=0,j=60;for(;E<j;){let A=await u.getJob(P.id);if(A.status==="finished"){let L=A.tasks?.find(q=>q.name==="export-file"),k=L?.result?.files?.[0]?.url,J=L?.result?.files?.[0]?.filename||`converted-${c}`,re;if(x&&k)try{if(!k||typeof k!="string")throw new Error(`Invalid download URL: ${k}`);try{new URL(k)}catch(ee){throw new Error(`Invalid download URL format: ${k} - ${ee instanceof Error?ee.message:String(ee)}`)}let q=await X.sendRequest({method:"GET",url:k});if(q.status===200&&q.body){let ee;typeof q.body=="string"?ee=Buffer.from(q.body,"binary"):ee=Buffer.from(q.body),re=await e.files.write({data:ee,fileName:J})}}catch{}return{job:A,download_url:k,filename:J,stored_file_id:re,input_format:s,output_format:c}}else if(A.status==="error"){let L=A.tasks?.filter(J=>J.status==="error")||[],k=`Conversion job failed: ${A.message||"Unknown error"}`;if(L.length>0){let J=L.map(q=>{let ee=`${q.name} (${q.operation})`;return q.code&&(ee+=` - Code: ${q.code}`),q.message&&(ee+=` - ${q.message}`),q.engine&&(ee+=` - Engine: ${q.engine}`),q.engine_version&&(ee+=` v${q.engine_version}`),ee}).join("; ");k+=`
4
+
5
+ Task errors: ${J}`;let re=L.find(q=>q.operation==="convert");re&&(re.engine==="pdftron-pdf2word"&&re.code==="UNKNOWN_ERROR"?(k+=`
6
+
7
+ This appears to be a file-specific issue. PDFs from website captures often contain complex layouts or images that cannot be converted to editable formats.`,k+=`
8
+
9
+ Suggested alternatives:`,k+=`
10
+ \u2022 Try converting to TXT (text only) or HTML format instead`,k+=`
11
+ \u2022 Use RTF format which is simpler than DOCX`,k+=`
12
+ \u2022 If this is a scanned/image-based PDF, it may need OCR processing`,k+=`
13
+ \u2022 Consider capturing the website directly to HTML instead of PDF\u2192DOCX`):re.engine==="pdftron-pdf2word"&&(k+=`
14
+
15
+ Tip: Try converting without specifying an engine, or try a different engine for better compatibility.`))}throw new Error(k)}await new Promise(L=>setTimeout(L,5e3)),E++}throw new Error("Conversion did not complete within the timeout period")}return{job:P,input_format:s,output_format:c,status:"processing"}}catch(l){throw l instanceof Error?l:new Error(`File conversion failed: ${String(l)}`)}}});var Hd=o(()=>({url:b.ShortText({displayName:"Website URL",description:"The URL of the website to capture",required:!0}),output_format:b.StaticDropdown({displayName:"Output Format",description:"The target format to convert to",required:!0,options:{options:[{label:"PDF",value:"pdf"},{label:"PNG",value:"png"},{label:"JPG",value:"jpg"}]},defaultValue:"pdf"}),pages:b.ShortText({displayName:"Pages",description:"Page range (e.g. 1-3) or comma separated list (e.g. 1,2,3) of pages",required:!1}),zoom:b.Number({displayName:"Zoom Level",description:"Zoom level to display the website. Defaults to 1",required:!1}),page_width:b.Number({displayName:"Page Width (cm)",description:"Page width in cm",required:!1}),page_height:b.Number({displayName:"Page Height (cm)",description:"Page height in cm",required:!1}),page_format:b.StaticDropdown({displayName:"Page Format",description:"Paper format type when printing a PDF. Overrides page_width and page_height",required:!1,options:{options:[{label:"Letter",value:"letter"},{label:"Legal",value:"legal"},{label:"Tabloid",value:"tabloid"},{label:"Ledger",value:"ledger"},{label:"A0",value:"a0"},{label:"A1",value:"a1"},{label:"A2",value:"a2"},{label:"A3",value:"a3"},{label:"A4",value:"a4"},{label:"A5",value:"a5"},{label:"A6",value:"a6"}]}}),page_orientation:b.StaticDropdown({displayName:"Page Orientation",description:"Page orientation for PDF output",required:!1,options:{options:[{label:"Portrait",value:"portrait"},{label:"Landscape",value:"landscape"}]},defaultValue:"portrait"}),margin_top:b.Number({displayName:"Top Margin (mm)",description:"Page top margin in mm",required:!1}),margin_bottom:b.Number({displayName:"Bottom Margin (mm)",description:"Page bottom margin in mm",required:!1}),margin_left:b.Number({displayName:"Left Margin (mm)",description:"Page left margin in mm",required:!1}),margin_right:b.Number({displayName:"Right Margin (mm)",description:"Page right margin in mm",required:!1}),print_background:b.Checkbox({displayName:"Print Background",description:"Render the background of websites",required:!1,defaultValue:!0}),display_header_footer:b.Checkbox({displayName:"Display Header/Footer",description:"Create a header and a footer with the URL and page numbers",required:!1}),header_template:b.LongText({displayName:"Header Template",description:"HTML template for the print header with classes: date, title, url, pageNumber, totalPages",required:!1}),footer_template:b.LongText({displayName:"Footer Template",description:"HTML template for the print footer with classes: date, title, url, pageNumber, totalPages",required:!1}),wait_until:b.StaticDropdown({displayName:"Wait Until",description:"When to consider navigation finished",required:!1,options:{options:[{label:"Load Event",value:"load"},{label:"DOMContentLoaded",value:"domcontentloaded"},{label:"Network Idle (0 connections)",value:"networkidle0"},{label:"Network Idle (2 connections)",value:"networkidle2"}]},defaultValue:"load"}),wait_for_element:b.ShortText({displayName:"Wait for Element",description:'CSS selector for element to wait for (e.g. "body" or "#element")',required:!1}),wait_time:b.Number({displayName:"Wait Time (ms)",description:"Additional time in ms to wait after the page load",required:!1}),css_media_type:b.StaticDropdown({displayName:"CSS Media Type",description:"Changes the CSS media type of the page",required:!1,options:{options:[{label:"Print",value:"print"},{label:"Screen",value:"screen"}]},defaultValue:"print"}),filename:b.ShortText({displayName:"Output Filename",description:"Choose a filename (including extension) for the output file",required:!1,defaultValue:"captured-website"}),engine:b.StaticDropdown({displayName:"Engine",description:"Use a specific engine for the conversion",required:!1,options:{options:[{label:"Chrome (Default)",value:"chrome"},{label:"wkhtmltopdf",value:"wkhtml"}]}}),engine_version:b.ShortText({displayName:"Engine Version",description:"Use a specific engine version for the conversion",required:!1}),timeout:b.Number({displayName:"Timeout (seconds)",description:"Timeout in seconds after the task will be cancelled",required:!1}),wait_for_completion:b.Checkbox({displayName:"Wait for Completion",description:"Wait for the capture to complete before returning",required:!0,defaultValue:!0}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the captured file in Activepieces",required:!1,defaultValue:!0})}),"captureWebsiteProps"),du=de({name:"capture_website",displayName:"Capture Website",description:"Capture webpage as PDF, screenshot PNG, or JPG from a URL",audience:"both",aiMetadata:{description:"Renders a live webpage at a given URL and captures it as a PDF, PNG, or JPG via CloudConvert, with optional page sizing, margins, and render-wait controls. Choose this to snapshot or archive a web page rather than convert an existing file. Requires a reachable URL and an output_format. Each call creates a new capture task, so it is not idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:Hd(),async run(e){await On.parseAsync(e.propsValue);let{url:t,output_format:r,pages:n,zoom:a,page_width:s,page_height:c,page_format:p,page_orientation:v,margin_top:y,margin_bottom:_,margin_left:T,margin_right:x,print_background:u,display_header_footer:l,header_template:g,footer_template:m,wait_until:h,wait_for_element:P,wait_time:E,css_media_type:j,filename:A,engine:L,engine_version:k,timeout:J,wait_for_completion:re,store_file:q}=e.propsValue,ee=new ce(e.auth);try{let K={url:t,output_format:r};n&&(K.pages=n),a!==void 0&&(K.zoom=a),s!==void 0&&(K.page_width=s),c!==void 0&&(K.page_height=c),p&&(K.page_format=p),v&&(K.page_orientation=v),y!==void 0&&(K.margin_top=y),_!==void 0&&(K.margin_bottom=_),T!==void 0&&(K.margin_left=T),x!==void 0&&(K.margin_right=x),u!==void 0&&(K.print_background=u),l!==void 0&&(K.display_header_footer=l),g&&(K.header_template=g),m&&(K.footer_template=m),h&&(K.wait_until=h),P&&(K.wait_for_element=P),E!==void 0&&(K.wait_time=E),j&&(K.css_media_type=j),A&&(K.filename=A),L&&(K.engine=L),k&&(K.engine_version=k),J!==void 0&&(K.timeout=J);let Le=await ee.createCaptureTask(K);if(re){let Je=0,Mt=60;for(;Je<Mt;){let Te=await ee.getTask(Le.id);if(Te.status==="finished")break;if(Te.status==="error")throw new Error(`Capture task failed: ${Te.message||"Unknown error"}`);await new Promise(Fe=>setTimeout(Fe,5e3)),Je++}if(Je>=Mt)throw new Error("Capture task did not complete within the timeout period")}let Ge=await ee.createExportTask(Le.id);if(re){let Je=0,Mt=60;for(;Je<Mt;){let Te=await ee.getTask(Ge.id);if(Te.status==="finished"){let Fe=Te.result?.files?.[0]?.url,Un=Te.result?.files?.[0]?.filename||"captured-website.pdf",Mn;if(q&&Fe)try{let Ke=await X.sendRequest({method:"GET",url:Fe});if(Ke.status===200&&Ke.body){let vr;typeof Ke.body=="string"?vr=Buffer.from(Ke.body,"binary"):vr=Buffer.from(Ke.body),Mn=await e.files.write({data:vr,fileName:Un})}}catch{}return{capture_task:Le,export_task:Te,download_url:Fe,filename:Un,stored_file_id:Mn,url:t,output_format:r}}else if(Te.status==="error")throw new Error(`Export task failed: ${Te.message||"Unknown error"}`);await new Promise(Fe=>setTimeout(Fe,5e3)),Je++}throw new Error("Export did not complete within the timeout period")}return{capture_task:Le,export_task:Ge,url:t,output_format:r,status:"processing"}}catch(K){throw K instanceof Error?K:new Error(`Website capture failed: ${String(K)}`)}}});var Wd=o(()=>({import_method:b.StaticDropdown({displayName:"Import Method",description:"How to import the files for merging",required:!0,options:{options:[{label:"File Upload",value:"upload"},{label:"File URL",value:"url"},{label:"Stored File ID",value:"stored_file"}]},defaultValue:"upload"}),files:b.Array({displayName:"Files to Merge",description:"List of files to merge into a single PDF",required:!0,properties:{url:b.ShortText({displayName:"File URL",description:"URL of the file to merge",required:!1}),file:b.File({displayName:"File",description:"File to upload and merge",required:!1}),stored_file_id:b.ShortText({displayName:"Stored File ID",description:"ID of a previously stored file in Activepieces to merge",required:!1}),filename:b.ShortText({displayName:"Filename in PDF",description:"Optional filename for this file within the PDF",required:!1})}}),filename:b.ShortText({displayName:"Output Filename",description:"Choose a filename (including extension) for the output file",required:!1,defaultValue:"merged-document.pdf"}),engine:b.StaticDropdown({displayName:"Engine",description:"Use a specific engine for the conversion",required:!1,options:{options:[{label:"3-Heights (Default)",value:"3heights"},{label:"PDFTron",value:"pdftron"},{label:"MuPDF",value:"mupdf"},{label:"Poppler",value:"poppler"},{label:"LibreOffice",value:"libreoffice"}]}}),engine_version:b.ShortText({displayName:"Engine Version",description:"Use a specific engine version for the conversion",required:!1}),timeout:b.Number({displayName:"Timeout (seconds)",description:"Timeout in seconds after which the task will be cancelled",required:!1}),wait_for_completion:b.Checkbox({displayName:"Wait for Completion",description:"Wait for the merge to complete before returning",required:!0,defaultValue:!0}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the merged PDF in Activepieces",required:!1,defaultValue:!0})}),"mergePdfProps"),mu=de({name:"merge_pdf",displayName:"Merge Files to PDF",description:"Combine multiple documents/images into a single PDF",audience:"both",aiMetadata:{description:"Merges two or more files into a single PDF via CloudConvert. Choose this to combine separate documents or images into one PDF. Requires at least two input files supplied via the selected import method (file URL or previously stored Activepieces file ID; multi-file uploads are not supported). Each call creates a new merge job, so it is not idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:Wd(),async run(e){await Rn.parseAsync(e.propsValue);let{import_method:t,files:r,filename:n,engine:a,engine_version:s,timeout:c,wait_for_completion:p,store_file:v}=e.propsValue;if(!r||r.length<2)throw new Error("At least 2 files are required for merging");let y=new ce(e.auth);try{let _={};r.forEach((l,g)=>{let m=`import-file-${g+1}`;if(t==="url"){if(!l.url)throw new Error(`File URL is required for file ${g+1} when using URL import method`);_[m]={operation:"import/url",url:l.url,...l.filename&&{filename:l.filename}}}else if(t==="stored_file"){if(!l.stored_file_id)throw new Error(`Stored File ID is required for file ${g+1} when using stored file import method`);if(!e.server?.apiUrl)throw new Error("Server API URL is not available. Please check your Activepieces server configuration.");let P=`${e.server.apiUrl.replace(/\/$/,"")}/v1/step-files/${l.stored_file_id}`;try{new URL(P)}catch(E){throw new Error(`Invalid file URL constructed: ${P}. URL Error: ${E instanceof Error?E.message:String(E)}`)}_[m]={operation:"import/url",url:P,...l.filename&&{filename:l.filename}}}else throw t==="upload"?!l.file||!l.file.base64?new Error(`Please select a file to upload for file ${g+1}`):new Error("Upload method for multiple files is not yet supported with the new job format. Please use URL or stored file methods."):new Error("Invalid import method selected")});let T=r.map((l,g)=>`import-file-${g+1}`),x={input:T.length===1?T[0]:T,output_format:"pdf"};n&&(x.filename=n),a&&(x.engine=a),s&&(x.engine_version=s),c&&(x.timeout=c),_["merge-files"]={operation:"merge",...x},_["export-file"]={operation:"export/url",input:"merge-files"};let u=await y.createJob(_,`merge-${Date.now()}`);if(p){let l=0,g=60;for(;l<g;){let m=await y.getJob(u.id);if(m.status==="finished"){let h=m.tasks?.find(A=>A.name==="export-file"),P=h?.result?.files?.[0]?.url,E=h?.result?.files?.[0]?.filename||"merged-document.pdf",j;if(v&&P)try{let A=await X.sendRequest({method:"GET",url:P});if(A.status===200&&A.body){let L;typeof A.body=="string"?L=Buffer.from(A.body,"binary"):L=Buffer.from(A.body),j=await e.files.write({data:L,fileName:E})}}catch{}return{job:m,download_url:P,filename:E,stored_file_id:j,file_count:r.length,output_format:"pdf"}}else if(m.status==="error")throw new Error(`Merge job failed: ${m.message||"Unknown error"}`);await new Promise(h=>setTimeout(h,5e3)),l++}throw new Error("Merge did not complete within the timeout period")}return{job:u,file_count:r.length,output_format:"pdf",status:"processing"}}catch(_){throw _ instanceof Error?_:new Error(`Merge failed: ${String(_)}`)}}});var Gd=o(()=>({task_id:b.ShortText({displayName:"Task ID",description:"ID of the CloudConvert task to retrieve",required:!0}),include:b.MultiSelectDropdown({auth:Q,displayName:"Include Additional Data",description:"Additional data to include in the response",required:!1,refreshers:[],options:o(async()=>({options:[{label:"Retries",value:"retries"},{label:"Depends On Tasks",value:"depends_on_tasks"},{label:"Payload",value:"payload"},{label:"Job",value:"job"}]}),"options")}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the output files in Activepieces",required:!1,defaultValue:!0})}),"downloadFileProps"),fu=de({name:"download_file",displayName:"Download a File",description:"Downloads output from a completed task",audience:"both",aiMetadata:{description:"Retrieves a finished CloudConvert task by its ID and returns its output file download URLs, optionally fetching and storing the files in Activepieces. Choose this to collect results from a conversion/merge/archive/optimize job that was started without waiting for completion. The task must already be finished; if it lacks download URLs an export task is created on the fly, so this is not strictly idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:Gd(),async run(e){await Nn.parseAsync(e.propsValue);let{task_id:t,include:r,store_file:n}=e.propsValue,a=new ce(e.auth);try{let s={};r&&Array.isArray(r)&&r.length>0&&(s.include=r.join(","));let c=await a.getTask(t,s);if(c.status!=="finished")throw new Error(`Task is not finished. Current status: ${c.status}. ${c.message||""}`);let p=c,v;if(c.operation!=="export/url"&&c.result?.files&&c.result.files.length>0&&!c.result.files.some(T=>T.url))try{let T=await a.createExportTask(t);v=T.id;let x=0,u=60;for(;x<u;){let l=await a.getTask(T.id);if(l.status==="finished"){p=l;break}else if(l.status==="error")throw new Error(`Export task failed: ${l.message||"Unknown error"}. Code: ${l.code||"N/A"}`);await new Promise(g=>setTimeout(g,2e3)),x++}if(x>=u)throw new Error("Export task did not complete within the timeout period")}catch{}let y={id:c.id,job_id:c.job_id,name:c.name,operation:c.operation,status:c.status,message:c.message,code:c.code,credits:c.credits,created_at:c.created_at,started_at:c.started_at,ended_at:c.ended_at,engine:c.engine,engine_version:c.engine_version,...v&&{export_task_id:v}};if(c.depends_on_tasks&&(y.depends_on_tasks=c.depends_on_tasks),c.retry_of_task_id&&(y.retry_of_task_id=c.retry_of_task_id),c.retries&&(y.retries=c.retries),c.payload&&(y.payload=c.payload),p.result&&(y.result=p.result,p.result.files&&p.result.files.length>0&&(y.download_urls=p.result.files.map(_=>({filename:_.filename,url:_.url,size:_.size})),n))){y.stored_files=[];for(let _ of p.result.files)try{if(!_.url||typeof _.url!="string")continue;try{new URL(_.url)}catch{continue}let T=await X.sendRequest({method:"GET",url:_.url});if(T.status===200&&T.body){let x;typeof T.body=="string"?x=Buffer.from(T.body,"binary"):x=Buffer.from(T.body);let u=await e.files.write({data:x,fileName:_.filename||`downloaded-file-${Date.now()}`});y.stored_files.push({filename:_.filename,size:_.size,stored_file_id:u,original_url:_.url})}}catch{}}return y}catch(s){throw s instanceof Error?s:new Error(`Task retrieval failed: ${String(s)}`)}}});var Jd=o(()=>({import_method:b.StaticDropdown({displayName:"Import Method",description:"How to import the files for archiving",required:!0,options:{options:[{label:"File Upload",value:"upload"},{label:"File URL",value:"url"},{label:"Stored File ID",value:"stored_file"}]},defaultValue:"upload"}),files:b.Array({displayName:"Files to Archive",description:"List of files to include in the archive",required:!0,properties:{url:b.ShortText({displayName:"File URL",description:"URL of the file to archive",required:!1}),file:b.File({displayName:"File",description:"File to upload and archive",required:!1}),stored_file_id:b.ShortText({displayName:"Stored File ID",description:"ID of a previously stored file in Activepieces to archive",required:!1}),filename:b.ShortText({displayName:"Filename in Archive",description:"Optional filename for this file within the archive",required:!1})}}),output_format:b.StaticDropdown({displayName:"Archive Format",description:"The archive format to create",required:!0,options:{options:[{label:"ZIP",value:"zip"},{label:"RAR",value:"rar"},{label:"7Z",value:"7z"},{label:"TAR",value:"tar"},{label:"TAR.GZ",value:"targz"},{label:"TAR.BZ2",value:"tarbz2"}]},defaultValue:"zip"}),filename:b.ShortText({displayName:"Archive Filename",description:"Choose a filename (including extension) for the archive file",required:!1,defaultValue:"archive.zip"}),engine:b.StaticDropdown({displayName:"Engine",description:"Use a specific engine for the archiving",required:!1,options:{options:[{label:"7-Zip",value:"7z"},{label:"Archive Tool (Default)",value:"archivetool"}]}}),engine_version:b.ShortText({displayName:"Engine Version",description:"Use a specific engine version for the archiving",required:!1}),timeout:b.Number({displayName:"Timeout (seconds)",description:"Timeout in seconds after which the task will be cancelled",required:!1}),wait_for_completion:b.Checkbox({displayName:"Wait for Completion",description:"Wait for the archive creation to complete before returning",required:!0,defaultValue:!0}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the created archive in Activepieces",required:!1,defaultValue:!0})}),"archiveFileProps"),gu=de({name:"archive_file",displayName:"Archive File",description:"Creates a ZIP, RAR, 7Z, TAR, TAR.GZ or TAR.BZ2 archive",audience:"both",aiMetadata:{description:"Bundles one or more files into a single archive (ZIP, RAR, 7Z, TAR, TAR.GZ, or TAR.BZ2) via CloudConvert. Choose this to compress or package multiple files together. Requires at least one input file supplied via the selected import method (file URL or previously stored Activepieces file ID; multi-file uploads are not supported) and an output archive format. Each call creates a new archive job, so it is not idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:Jd(),async run(e){await Dn.parseAsync(e.propsValue);let{import_method:t,files:r,output_format:n,filename:a,engine:s,engine_version:c,timeout:p,wait_for_completion:v,store_file:y}=e.propsValue;if(!r||r.length===0)throw new Error("At least one file is required to create an archive");let _=new ce(e.auth);try{let T={};r.forEach((g,m)=>{let h=`import-file-${m+1}`;if(t==="url"){if(!g.url)throw new Error(`File URL is required for file ${m+1} when using URL import method`);T[h]={operation:"import/url",url:g.url,...g.filename&&{filename:g.filename}}}else if(t==="stored_file"){if(!g.stored_file_id)throw new Error(`Stored File ID is required for file ${m+1} when using stored file import method`);if(!e.server?.apiUrl)throw new Error("Server API URL is not available. Please check your Activepieces server configuration.");let E=`${e.server.apiUrl.replace(/\/$/,"")}/v1/step-files/${g.stored_file_id}`;try{new URL(E)}catch(j){throw new Error(`Invalid file URL constructed: ${E}. URL Error: ${j instanceof Error?j.message:String(j)}`)}T[h]={operation:"import/url",url:E,...g.filename&&{filename:g.filename}}}else throw t==="upload"?!g.file||!g.file.base64?new Error(`Please select a file to upload for file ${m+1}`):new Error("Upload method for multiple files is not yet supported with the new job format. Please use URL or stored file methods."):new Error("Invalid import method selected")});let x=r.map((g,m)=>`import-file-${m+1}`),u={input:x.length===1?x[0]:x,output_format:n};a&&(u.filename=a),s&&(u.engine=s),c&&(u.engine_version=c),p&&(u.timeout=p),T["archive-files"]={operation:"archive",...u},T["export-file"]={operation:"export/url",input:"archive-files"};let l=await _.createJob(T,`archive-${Date.now()}`);if(v){let g=0,m=60;for(;g<m;){let h=await _.getJob(l.id);if(h.status==="finished"){let P=h.tasks?.find(L=>L.name==="export-file"),E=P?.result?.files?.[0]?.url,j=P?.result?.files?.[0]?.filename||`archive.${n}`,A;if(y&&E)try{let L=await X.sendRequest({method:"GET",url:E});if(L.status===200&&L.body){let k;typeof L.body=="string"?k=Buffer.from(L.body,"binary"):k=Buffer.from(L.body),A=await e.files.write({data:k,fileName:j})}}catch{}return{job:h,download_url:E,filename:j,stored_file_id:A,file_count:r.length,output_format:n,size:P?.result?.files?.[0]?.size||0}}else if(h.status==="error")throw new Error(`Archive job failed: ${h.message||"Unknown error"}`);await new Promise(P=>setTimeout(P,5e3)),g++}throw new Error("Archive creation did not complete within the timeout period")}return{job:l,file_count:r.length,output_format:n,status:"processing"}}catch(T){throw T instanceof Error?T:new Error(`Archive creation failed: ${String(T)}`)}}});var Kd=o(()=>({import_method:b.StaticDropdown({displayName:"Import Method",description:"How to import the file for optimization",required:!0,options:{options:[{label:"File Upload",value:"upload"},{label:"File URL",value:"url"},{label:"Stored File ID",value:"stored_file"}]},defaultValue:"upload"}),file:b.File({displayName:"File",description:"File to upload and optimize (PDF, PNG, JPG)",required:!1}),url:b.ShortText({displayName:"File URL",description:"URL of the file to optimize",required:!1}),stored_file_id:b.ShortText({displayName:"Stored File ID",description:"ID of a previously stored file in Activepieces to optimize",required:!1}),input_format:b.StaticDropdown({displayName:"Input Format",description:"The current format of the file. If not set, the extension of the input file is used",required:!1,options:{options:[{label:"PDF",value:"pdf"},{label:"PNG",value:"png"},{label:"JPG",value:"jpg"}]}}),profile:b.StaticDropdown({displayName:"Optimization Profile",description:"Optimization profile for specific target needs",required:!1,defaultValue:"web",options:{options:[{label:"Web - Remove redundant data for the web",value:"web"},{label:"Print - Optimized for printing",value:"print"},{label:"Archive - Optimized for archiving purposes",value:"archive"},{label:"MRC - Optimized for scanned images",value:"mrc"},{label:"Max - Maximal size reduction",value:"max"}]}}),flatten_signatures:b.Checkbox({displayName:"Flatten Signatures",description:"Flatten visible signatures and keep them as non-editable graphics",required:!1,defaultValue:!1}),colorspace:b.StaticDropdown({displayName:"Color Space",description:"Color space of raster images",required:!1,options:{options:[{label:"Unchanged",value:"unchanged"},{label:"RGB",value:"rgb"},{label:"CMYK",value:"cmyk"},{label:"Grayscale",value:"grayscale"}]}}),filename:b.ShortText({displayName:"Output Filename",description:"Choose a filename (including extension) for the output file",required:!1,defaultValue:"optimized-document.pdf"}),engine:b.StaticDropdown({displayName:"Engine",description:"Use a specific engine for the optimization",required:!1,options:{options:[{label:"3-Heights",value:"3heights"},{label:"PDF Tools",value:"pdftools"}]}}),engine_version:b.ShortText({displayName:"Engine Version",description:"Use a specific engine version for the optimization",required:!1}),timeout:b.Number({displayName:"Timeout (seconds)",description:"Timeout in seconds after which the task will be cancelled",required:!1}),wait_for_completion:b.Checkbox({displayName:"Wait for Completion",description:"Wait for the optimization to complete before returning",required:!0,defaultValue:!0}),store_file:b.Checkbox({displayName:"Store File",description:"Download and store the optimized file in Activepieces",required:!1,defaultValue:!0})}),"optimizeFileProps"),hu=de({name:"optimize_file",displayName:"Optimize File",description:"Creates a task to optimize and compress a file",audience:"both",aiMetadata:{description:"Compresses and optimizes a PDF or image (PNG/JPG) to reduce file size via CloudConvert, targeting a profile such as web, print, archive, MRC, or max. Choose this to shrink a file without changing its format. Supply the input via one of three import methods \u2014 a public URL, an uploaded file, or a previously stored Activepieces file ID. Each call creates a new optimize job, so it is not idempotent.",idempotent:!1},auth:Q,requireAuth:!0,props:Kd(),async run(e){await Cn.parseAsync(e.propsValue);let{import_method:t,url:r,file:n,stored_file_id:a,input_format:s,profile:c,flatten_signatures:p,colorspace:v,filename:y,engine:_,engine_version:T,timeout:x,wait_for_completion:u,store_file:l}=e.propsValue,g=new ce(e.auth);try{let m={};if(t==="url"){if(!r)throw new Error("File URL is required when using URL import method");m["import-file"]={operation:"import/url",url:r,...y&&{filename:y}}}else if(t==="stored_file"){if(!a)throw new Error("Stored File ID is required when using stored file import method");if(!e.server?.apiUrl)throw new Error("Server API URL is not available. Please check your Activepieces server configuration.");let j=`${e.server.apiUrl.replace(/\/$/,"")}/v1/step-files/${a}`;try{new URL(j)}catch(A){throw new Error(`Invalid file URL constructed: ${j}. URL Error: ${A instanceof Error?A.message:String(A)}`)}m["import-file"]={operation:"import/url",url:j,...y&&{filename:y}}}else if(t==="upload"){if(!n||!n.base64)throw new Error("Please select a file to upload from your device");let E=await g.createUploadTask(n.filename||"uploaded-file"),j=E.result.form.url,A=E.result.form.parameters,L=new FormData;if(Object.entries(A).forEach(([J,re])=>{L.append(J,re)}),n.base64){let J=Buffer.from(n.base64,"base64"),re=new Blob([J],{type:n.extension?`application/${n.extension}`:"application/octet-stream"});L.append("file",re,n.filename)}let k=await X.sendRequest({method:"POST",url:j,body:L});if(k.status<200||k.status>=300)throw new Error(`Failed to upload file: HTTP ${k.status} - ${k.body?.message||"Upload failed"}`);m["import-file"]={operation:"import/upload",...y&&{filename:y}}}else throw new Error("Invalid import method selected");let h={input:"import-file"};s&&(h.input_format=s),c&&(h.profile=c),p!==void 0&&(h.flatten_signatures=p),v&&(h.colorspace=v),y&&(h.filename=y),_&&(h.engine=_),T&&(h.engine_version=T),x&&(h.timeout=x),m["optimize-file"]={operation:"optimize",...h},m["export-file"]={operation:"export/url",input:"optimize-file"};let P=await g.createJob(m,`optimize-${Date.now()}`);if(u){let E=0,j=60;for(;E<j;){let A=await g.getJob(P.id);if(A.status==="finished"){let L=A.tasks?.find(q=>q.name==="export-file"),k=L?.result?.files?.[0]?.url,J=L?.result?.files?.[0]?.filename||`optimized-${s||"file"}`,re;if(l&&k)try{let q=await X.sendRequest({method:"GET",url:k});if(q.status===200&&q.body){let ee;typeof q.body=="string"?ee=Buffer.from(q.body,"binary"):ee=Buffer.from(q.body),re=await e.files.write({data:ee,fileName:J})}}catch{}return{job:A,download_url:k,filename:J,stored_file_id:re,input_format:s,profile:c,size:L?.result?.files?.[0]?.size||0}}else if(A.status==="error")throw new Error(`Optimize job failed: ${A.message||"Unknown error"}`);await new Promise(L=>setTimeout(L,5e3)),E++}throw new Error("Optimization did not complete within the timeout period")}return{job:P,input_format:s,profile:c,status:"processing"}}catch(m){throw m instanceof Error?m:new Error(`File optimization failed: ${String(m)}`)}}});var Xd=Wi({displayName:"CloudConvert",description:"File conversion and processing platform supporting 200+ formats",minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/cloudconvert.png",categories:["DEVELOPER_TOOLS","CONTENT_AND_FILES"],authors:["owuzo"],auth:Q,actions:[pu,du,mu,fu,gu,hu,su({baseUrl:o(()=>"https://api.cloudconvert.com/v2","baseUrl"),auth:Q,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],triggers:[uu,cu,lu]});0&&(module.exports={cloudconvert});
16
+ /*! Bundled license information:
17
+
18
+ mime-types/index.js:
19
+ (*!
20
+ * mime-types
21
+ * Copyright(c) 2014 Jonathan Ong
22
+ * Copyright(c) 2015 Douglas Christopher Wilson
23
+ * MIT Licensed
24
+ *)
25
+ */
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # pieces-cloudconvert
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build pieces-cloudconvert` to build the library.
package/src/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const cloudconvert: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/cloudconvert/src/index.ts"],"names":[],"mappings":";;;;AACA,+DAAwE;AACxE,qEAA6D;AAC7D,iDAAqD;AACrD,4CAAqD;AACrD,oDAAgD;AAChD,8DAA0D;AAC1D,0DAAsD;AACtD,6DAAyD;AACzD,mEAA+D;AAC/D,uDAAmD;AACnD,+DAA2D;AAC3D,6DAAyD;AACzD,+DAA2D;AAE9C,QAAA,YAAY,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,iEAAiE;IAC9E,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,eAAe,EAAE,sBAAa,CAAC,iBAAiB,CAAC;IAC5E,OAAO,EAAE,CAAC,OAAO,CAAC;IAClB,IAAI,EAAE,uBAAgB;IACtB,OAAO,EAAE;QACL,0BAAW;QACX,gCAAc;QACd,oBAAQ;QACR,4BAAY;QACZ,0BAAW;QACX,4BAAY;QACZ,IAAA,yCAAyB,EAAC;YACtB,OAAO,EAAE,GAAG,EAAE,CAAC,iCAAiC;YAChD,IAAI,EAAE,uBAAgB;YACtB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC1B,aAAa,EAAE,UAAU,IAAI,CAAC,YAAY,EAAE;iBAC/C,CAAC,CAAA;cAAA;SACL,CAAC;KACL;IACD,QAAQ,EAAE,CAAC,gBAAM,EAAE,0BAAW,EAAE,sBAAS,CAAC;CAC7C,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare const archiveFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- import_method: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
- files: import("@activepieces/pieces-framework").ArrayProperty<false> | import("@activepieces/pieces-framework").ArrayProperty<true>;
4
- output_format: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
- filename: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
- engine: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
7
- engine_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- timeout: import("@activepieces/pieces-framework").NumberProperty<false>;
9
- wait_for_completion: import("@activepieces/pieces-framework").CheckboxProperty<true>;
10
- store_file: import("@activepieces/pieces-framework").CheckboxProperty<false>;
11
- }>;