@activepieces/piece-coupa 0.0.2 → 0.0.4

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 (80) hide show
  1. package/package.json +7 -18
  2. package/src/i18n/de.json +106 -0
  3. package/src/i18n/es.json +106 -0
  4. package/src/i18n/fr.json +106 -0
  5. package/src/i18n/ja.json +106 -0
  6. package/src/i18n/nl.json +106 -0
  7. package/src/i18n/pt.json +106 -0
  8. package/src/i18n/zh.json +106 -0
  9. package/src/index.js +13 -74
  10. package/src/index.d.ts +0 -7
  11. package/src/index.d.ts.map +0 -1
  12. package/src/index.js.map +0 -1
  13. package/src/lib/actions/add-file-attachment.d.ts +0 -23
  14. package/src/lib/actions/add-file-attachment.d.ts.map +0 -1
  15. package/src/lib/actions/add-file-attachment.js +0 -127
  16. package/src/lib/actions/add-file-attachment.js.map +0 -1
  17. package/src/lib/actions/cancel-purchase-order.d.ts +0 -14
  18. package/src/lib/actions/cancel-purchase-order.d.ts.map +0 -1
  19. package/src/lib/actions/cancel-purchase-order.js +0 -35
  20. package/src/lib/actions/cancel-purchase-order.js.map +0 -1
  21. package/src/lib/actions/close-purchase-order.d.ts +0 -14
  22. package/src/lib/actions/close-purchase-order.d.ts.map +0 -1
  23. package/src/lib/actions/close-purchase-order.js +0 -35
  24. package/src/lib/actions/close-purchase-order.js.map +0 -1
  25. package/src/lib/actions/create-object.d.ts +0 -12
  26. package/src/lib/actions/create-object.d.ts.map +0 -1
  27. package/src/lib/actions/create-object.js +0 -44
  28. package/src/lib/actions/create-object.js.map +0 -1
  29. package/src/lib/actions/get-object-by-id.d.ts +0 -17
  30. package/src/lib/actions/get-object-by-id.d.ts.map +0 -1
  31. package/src/lib/actions/get-object-by-id.js +0 -44
  32. package/src/lib/actions/get-object-by-id.js.map +0 -1
  33. package/src/lib/actions/get-remit-to-addresses.d.ts +0 -15
  34. package/src/lib/actions/get-remit-to-addresses.d.ts.map +0 -1
  35. package/src/lib/actions/get-remit-to-addresses.js +0 -80
  36. package/src/lib/actions/get-remit-to-addresses.js.map +0 -1
  37. package/src/lib/actions/get-supplier-sites.d.ts +0 -14
  38. package/src/lib/actions/get-supplier-sites.d.ts.map +0 -1
  39. package/src/lib/actions/get-supplier-sites.js +0 -40
  40. package/src/lib/actions/get-supplier-sites.js.map +0 -1
  41. package/src/lib/actions/grant-approval.d.ts +0 -14
  42. package/src/lib/actions/grant-approval.d.ts.map +0 -1
  43. package/src/lib/actions/grant-approval.js +0 -35
  44. package/src/lib/actions/grant-approval.js.map +0 -1
  45. package/src/lib/actions/reject-approval.d.ts +0 -15
  46. package/src/lib/actions/reject-approval.d.ts.map +0 -1
  47. package/src/lib/actions/reject-approval.js +0 -48
  48. package/src/lib/actions/reject-approval.js.map +0 -1
  49. package/src/lib/actions/search-objects.d.ts +0 -11
  50. package/src/lib/actions/search-objects.d.ts.map +0 -1
  51. package/src/lib/actions/search-objects.js +0 -46
  52. package/src/lib/actions/search-objects.js.map +0 -1
  53. package/src/lib/actions/set-integration-run-status.d.ts +0 -10
  54. package/src/lib/actions/set-integration-run-status.d.ts.map +0 -1
  55. package/src/lib/actions/set-integration-run-status.js +0 -49
  56. package/src/lib/actions/set-integration-run-status.js.map +0 -1
  57. package/src/lib/actions/update-object.d.ts +0 -18
  58. package/src/lib/actions/update-object.d.ts.map +0 -1
  59. package/src/lib/actions/update-object.js +0 -46
  60. package/src/lib/actions/update-object.js.map +0 -1
  61. package/src/lib/auth.d.ts +0 -7
  62. package/src/lib/auth.d.ts.map +0 -1
  63. package/src/lib/auth.js +0 -50
  64. package/src/lib/auth.js.map +0 -1
  65. package/src/lib/common/client.d.ts +0 -34
  66. package/src/lib/common/client.d.ts.map +0 -1
  67. package/src/lib/common/client.js +0 -146
  68. package/src/lib/common/client.js.map +0 -1
  69. package/src/lib/common/props.d.ts +0 -47
  70. package/src/lib/common/props.d.ts.map +0 -1
  71. package/src/lib/common/props.js +0 -366
  72. package/src/lib/common/props.js.map +0 -1
  73. package/src/lib/common/utils.d.ts +0 -22
  74. package/src/lib/common/utils.d.ts.map +0 -1
  75. package/src/lib/common/utils.js +0 -182
  76. package/src/lib/common/utils.js.map +0 -1
  77. package/src/lib/triggers/new-or-updated-object.d.ts +0 -39
  78. package/src/lib/triggers/new-or-updated-object.d.ts.map +0 -1
  79. package/src/lib/triggers/new-or-updated-object.js +0 -101
  80. package/src/lib/triggers/new-or-updated-object.js.map +0 -1
package/src/index.js CHANGED
@@ -1,74 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.coupa = 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 add_file_attachment_1 = require("./lib/actions/add-file-attachment");
9
- const cancel_purchase_order_1 = require("./lib/actions/cancel-purchase-order");
10
- const close_purchase_order_1 = require("./lib/actions/close-purchase-order");
11
- const create_object_1 = require("./lib/actions/create-object");
12
- const get_object_by_id_1 = require("./lib/actions/get-object-by-id");
13
- const get_remit_to_addresses_1 = require("./lib/actions/get-remit-to-addresses");
14
- const get_supplier_sites_1 = require("./lib/actions/get-supplier-sites");
15
- const grant_approval_1 = require("./lib/actions/grant-approval");
16
- const reject_approval_1 = require("./lib/actions/reject-approval");
17
- const search_objects_1 = require("./lib/actions/search-objects");
18
- const set_integration_run_status_1 = require("./lib/actions/set-integration-run-status");
19
- const update_object_1 = require("./lib/actions/update-object");
20
- const auth_1 = require("./lib/auth");
21
- const client_1 = require("./lib/common/client");
22
- const utils_1 = require("./lib/common/utils");
23
- const new_or_updated_object_1 = require("./lib/triggers/new-or-updated-object");
24
- exports.coupa = (0, pieces_framework_1.createPiece)({
25
- displayName: 'Coupa',
26
- description: 'Business spend management — automate procurement, approvals, purchase orders, and ERP integrations with the Coupa Core API.',
27
- minimumSupportedRelease: '0.36.1',
28
- logoUrl: 'https://cdn.activepieces.com/pieces/coupa.png',
29
- categories: [shared_1.PieceCategory.ACCOUNTING],
30
- authors: ['maurivan'],
31
- auth: auth_1.coupaAuth,
32
- actions: [
33
- create_object_1.createObject,
34
- update_object_1.updateObject,
35
- get_object_by_id_1.getObjectById,
36
- search_objects_1.searchObjects,
37
- cancel_purchase_order_1.cancelPurchaseOrder,
38
- close_purchase_order_1.closePurchaseOrder,
39
- add_file_attachment_1.addFileAttachment,
40
- get_remit_to_addresses_1.getRemitToAddresses,
41
- get_supplier_sites_1.getSupplierSites,
42
- grant_approval_1.grantApproval,
43
- reject_approval_1.rejectApproval,
44
- set_integration_run_status_1.setIntegrationRunStatus,
45
- (0, pieces_common_1.createCustomApiCallAction)({
46
- auth: auth_1.coupaAuth,
47
- name: 'custom_action',
48
- displayName: 'Custom Action',
49
- description: 'Make a custom API call to any Coupa endpoint (Purchase Orders, Suppliers, Contracts, or other resources).',
50
- baseUrl: (auth) => {
51
- if (!auth) {
52
- return '';
53
- }
54
- const host = (0, utils_1.normalizeInstanceUrl)(auth.props.instanceUrl);
55
- return `https://${host}/api`;
56
- },
57
- authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
58
- const client = new client_1.CoupaClient({
59
- instanceUrl: auth.props.instanceUrl,
60
- clientId: auth.props.clientId,
61
- clientSecret: auth.props.clientSecret,
62
- scope: auth.props.scope,
63
- });
64
- const token = yield client.getAccessToken();
65
- return {
66
- Authorization: `Bearer ${token}`,
67
- Accept: 'application/json',
68
- };
69
- }),
70
- }),
71
- ],
72
- triggers: [new_or_updated_object_1.newOrUpdatedObject],
73
- });
74
- //# sourceMappingURL=index.js.map
1
+ "use strict";var Zu=Object.create;var At=Object.defineProperty;var Vu=Object.getOwnPropertyDescriptor;var Hu=Object.getOwnPropertyNames;var qu=Object.getPrototypeOf,Wu=Object.prototype.hasOwnProperty;var i=(e,t)=>At(e,"name",{value:t,configurable:!0});var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),no=(e,t)=>{for(var r in t)At(e,r,{get:t[r],enumerable:!0})},oo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hu(t))!Wu.call(e,o)&&o!==r&&At(e,o,{get:()=>t[o],enumerable:!(n=Vu(t,o))||n.enumerable});return e};var Ze=(e,t,r)=>(r=e!=null?Zu(qu(e)):{},oo(t||!e||!e.__esModule?At(r,"default",{value:e,enumerable:!0}):r,e)),Gu=e=>oo(At({},"__esModule",{value:!0}),e);var bi=z((Pi,_r)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",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 g(u,d){if(u.indexOf("::")!==u.lastIndexOf("::"))return null;let y=0,m=-1,_=(u.match(p.zoneIndex)||[])[0],P,F;for(_&&(_=_.substring(1),u=u.replace(/%.+$/,""));(m=u.indexOf(":",m+1))>=0;)y++;if(u.substr(0,2)==="::"&&y--,u.substr(-2,2)==="::"&&y--,y>d)return null;for(F=d-y,P=":";F--;)P+="0:";return u=u.replace("::",P),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),d=function(){let se=u.split(":"),ge=[];for(let Ee=0;Ee<se.length;Ee++)ge.push(parseInt(se[Ee],16));return ge}(),{parts:d,zoneId:_}}i(g,"expandIPv6");function f(u,d,y,m){if(u.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let _=0,P;for(;m>0;){if(P=y-m,P<0&&(P=0),u[_]>>P!==d[_]>>P)return!1;m-=y,_+=1}return!0}i(f,"matchCIDR");function h(u){if(o.test(u))return parseInt(u,16);if(u[0]==="0"&&!isNaN(parseInt(u[1],10))){if(n.test(u))return parseInt(u,8);throw new Error(`ipaddr: cannot parse ${u} as octal`)}return parseInt(u,10)}i(h,"parseIntAuto");function I(u,d){for(;u.length<d;)u=`0${u}`;return u}i(I,"padPart");let x={};x.IPv4=function(){function u(d){if(d.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let y,m;for(y=0;y<d.length;y++)if(m=d[y],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=d}return i(u,"IPv4"),u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,18,0,0]),15],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]],as112:[[new u([192,175,48,0]),24],[new u([192,31,196,0]),24]],amt:[[new u([192,52,193,0]),24]]},u.prototype.kind=function(){return"ipv4"},u.prototype.match=function(d,y){let m;if(y===void 0&&(m=d,d=m[0],y=m[1]),d.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,d.octets,8,y)},u.prototype.prefixLengthFromSubnetMask=function(){let d=0,y=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},_,P,F;for(_=3;_>=0;_-=1)if(P=this.octets[_],P in m){if(F=m[P],y&&F!==0)return null;F!==8&&(y=!0),d+=F}else return null;return 32-d},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 d=this.parseCIDR(u),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),_=[],P=0;for(;P<4;)_.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(_)}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 d=u.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(u)||!d?!1:x.IPv4.isValidFourPartDecimal(d[1])},x.IPv4.networkAddressFromCIDR=function(u){let d,y,m,_,P;try{for(d=this.parseCIDR(u),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),_=[],y=0;y<4;)_.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(_)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(u){let d=this.parser(u);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},x.IPv4.parseCIDR=function(u){let d;if(d=u.match(/^(.+)\/(\d+)$/)){let y=parseInt(d[2]);if(y>=0&&y<=32){let m=[this.parse(d[1]),y];return Object.defineProperty(m,"toString",{value:i(function(){return this.join("/")},"value")}),m}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(u){let d,y,m;if(d=u.match(r.fourOctet))return function(){let _=d.slice(1,6),P=[];for(let F=0;F<_.length;F++)y=_[F],P.push(h(y));return P}();if(d=u.match(r.longValue)){if(m=h(d[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return function(){let _=[],P;for(P=0;P<=24;P+=8)_.push(m>>P&255);return _}().reverse()}else return(d=u.match(r.twoOctet))?function(){let _=d.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}():(d=u.match(r.threeOctet))?function(){let _=d.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 d=[0,0,0,0],y=0,m=Math.floor(u/8);for(;y<m;)d[y]=255,y++;return m<4&&(d[m]=Math.pow(2,u%8)-1<<8-u%8),new this(d)},x.IPv6=function(){function u(d,y){let m,_;if(d.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(d[m]<<8|d[m+1]);else if(d.length===8)this.parts=d;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(_=this.parts[m],!(0<=_&&_<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return i(u,"IPv6"),u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],discard:[new u([256,0,0,0,0,0,0,0]),64],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],benchmarking:[new u([8193,2,0,0,0,0,0,0]),48],amt:[new u([8193,3,0,0,0,0,0,0]),32],as112v6:[[new u([8193,4,274,0,0,0,0,0]),48],[new u([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new u([8193,16,0,0,0,0,0,0]),28],orchid2:[new u([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new u([8193,48,0,0,0,0,0,0]),28],reserved:[[new u([8193,0,0,0,0,0,0,0]),23],[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.kind=function(){return"ipv6"},u.prototype.match=function(d,y){let m;if(y===void 0&&(m=d,d=m[0],y=m[1]),d.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,d.parts,16,y)},u.prototype.prefixLengthFromSubnetMask=function(){let d=0,y=!1,m={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},_,P;for(let F=7;F>=0;F-=1)if(_=this.parts[F],_ in m){if(P=m[_],y&&P!==0)return null;P!==16&&(y=!0),d+=P}else return null;return 128-d},u.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){let d,y=[],m=this.parts;for(let _=0;_<m.length;_++)d=m[_],y.push(d>>8),y.push(d&255);return y},u.prototype.toFixedLengthString=function(){let d=function(){let m=[];for(let _=0;_<this.parts.length;_++)m.push(I(this.parts[_].toString(16),4));return m}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},u.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let d=this.parts.slice(-2),y=d[0],m=d[1];return new x.IPv4([y>>8,y&255,m>>8,m&255])},u.prototype.toNormalizedString=function(){let d=function(){let m=[];for(let _=0;_<this.parts.length;_++)m.push(this.parts[_].toString(16));return m}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),d+y},u.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),m=0,_=-1,P;for(;P=d.exec(y);)P[0].length>_&&(m=P.index,_=P[0].length);return _<0?y:`${y.substring(0,m)}::${y.substring(m+_)}`},u.prototype.toString=function(){return this.toRFC5952String()},u}(),x.IPv6.broadcastAddressFromCIDR=function(u){try{let d=this.parseCIDR(u),y=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),_=[],P=0;for(;P<16;)_.push(parseInt(y[P],10)|parseInt(m[P],10)^255),P++;return new this(_)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},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 d=this.parser(u);return new this(d.parts,d.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 d,y,m,_,P;try{for(d=this.parseCIDR(u),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),_=[],y=0;y<16;)_.push(parseInt(m[y],10)&parseInt(P[y],10)),y++;return new this(_)}catch(F){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${F})`)}},x.IPv6.parse=function(u){let d=this.parser(u);if(d.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(d.parts,d.zoneId)},x.IPv6.parseCIDR=function(u){let d,y,m;if((y=u.match(/^(.+)\/(\d+)$/))&&(d=parseInt(y[2]),d>=0&&d<=128))return m=[this.parse(y[1]),d],Object.defineProperty(m,"toString",{value:i(function(){return this.join("/")},"value")}),m;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(u){let d,y,m,_,P,F;if(m=u.match(p.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(p.native.test(u))return g(u,8);if((m=u.match(p.transitional))&&(F=m[6]||"",d=m[1],m[1].endsWith("::")||(d=d.slice(0,-1)),d=g(d+F,6),d.parts)){for(P=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],y=0;y<P.length;y++)if(_=P[y],!(0<=_&&_<=255))return null;return d.parts.push(P[0]<<8|P[1]),d.parts.push(P[2]<<8|P[3]),{parts:d.parts,zoneId:d.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>128)throw new Error("ipaddr: invalid IPv6 prefix length");let d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=0,m=Math.floor(u/8);for(;y<m;)d[y]=255,y++;return m<16&&(d[m]=Math.pow(2,u%8)-1<<8-u%8),new this(d)},x.fromByteArray=function(u){let d=u.length;if(d===4)return new x.IPv4(u);if(d===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 d=this.parse(u);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},x.subnetMatch=function(u,d,y){let m,_,P,F;y==null&&(y="unicast");for(_ in d)if(Object.prototype.hasOwnProperty.call(d,_)){for(P=d[_],P[0]&&!(P[0]instanceof Array)&&(P=[P]),m=0;m<P.length;m++)if(F=P[m],u.kind()===F[0].kind()&&u.match.apply(u,F))return _}return y},typeof _r<"u"&&_r.exports?_r.exports=x:e.ipaddr=x})(Pi)});var xa=z((tz,va)=>{var ha=require("stream").Stream,Il=require("util");va.exports=Se;function Se(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}i(Se,"DelayedStream");Il.inherits(Se,ha);Se.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var o=e.emit;return e.emit=function(){return r._handleEmit(arguments),o.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Se.prototype,"readable",{configurable:!0,enumerable:!0,get:i(function(){return this.source.readable},"get")});Se.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Se.prototype.resume=function(){this._released||this.release(),this.source.resume()};Se.prototype.pause=function(){this.source.pause()};Se.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Se.prototype.pipe=function(){var e=ha.prototype.pipe.apply(this,arguments);return this.resume(),e};Se.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)};Se.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 Ia=z((nz,ba)=>{var Tl=require("util"),Pa=require("stream").Stream,_a=xa();ba.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}i(ae,"CombinedStream");Tl.inherits(ae,Pa);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 _a)){var r=_a.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 Pa.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 $a=z((iz,Ta)=>{"use strict";Ta.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 Aa=z(xe=>{"use strict";var Sr=$a(),$l=require("path").extname,Sa=/^\s*([^;\s]*)(?:;|\s|$)/,Sl=/^text\//i;xe.charset=Ea;xe.charsets={lookup:Ea};xe.contentType=El;xe.extension=Al;xe.extensions=Object.create(null);xe.lookup=zl;xe.types=Object.create(null);wl(xe.extensions,xe.types);function Ea(e){if(!e||typeof e!="string")return!1;var t=Sa.exec(e),r=t&&Sr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&Sl.test(t[1])?"UTF-8":!1}i(Ea,"charset");function El(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?xe.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=xe.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}i(El,"contentType");function Al(e){if(!e||typeof e!="string")return!1;var t=Sa.exec(e),r=t&&xe.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}i(Al,"extension");function zl(e){if(!e||typeof e!="string")return!1;var t=$l("x."+e).toLowerCase().substr(1);return t&&xe.types[t]||!1}i(zl,"lookup");function wl(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Sr).forEach(i(function(o){var s=Sr[o],c=s.extensions;if(!(!c||!c.length)){e[o]=c;for(var p=0;p<c.length;p++){var g=c[p];if(t[g]){var f=r.indexOf(Sr[t[g]].source),h=r.indexOf(s.source);if(t[g]!=="application/octet-stream"&&(f>h||f===h&&t[g].substr(0,12)==="application/"))continue}t[g]=o}}},"forEachMimeType"))}i(wl,"populateMaps")});var wa=z((uz,za)=>{za.exports=Ol;function Ol(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}i(Ol,"defer")});var wn=z((pz,ka)=>{var Oa=wa();ka.exports=kl;function kl(e){var t=!1;return Oa(function(){t=!0}),i(function(n,o){t?e(n,o):Oa(i(function(){e(n,o)},"nextTick_callback"))},"async_callback")}i(kl,"async")});var On=z((dz,Ra)=>{Ra.exports=Rl;function Rl(e){Object.keys(e.jobs).forEach(Dl.bind(e)),e.jobs={}}i(Rl,"abort");function Dl(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}i(Dl,"clean")});var kn=z((fz,Na)=>{var Da=wn(),Nl=On();Na.exports=Cl;function Cl(e,t,r,n){var o=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[o]=Ul(t,o,e[o],function(s,c){o in r.jobs&&(delete r.jobs[o],s?Nl(r):r.results[o]=c,n(s,r.results))})}i(Cl,"iterate");function Ul(e,t,r,n){var o;return e.length==2?o=e(r,Da(n)):o=e(r,t,Da(n)),o}i(Ul,"runJob")});var Rn=z((yz,Ca)=>{Ca.exports=Ml;function Ml(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(o,s){return t(e[o],e[s])}),n}i(Ml,"state")});var Dn=z((vz,Ua)=>{var jl=On(),Ll=wn();Ua.exports=Fl;function Fl(e){Object.keys(this.jobs).length&&(this.index=this.size,jl(this),Ll(e)(null,this.results))}i(Fl,"terminator")});var ja=z((_z,Ma)=>{var Bl=kn(),Zl=Rn(),Vl=Dn();Ma.exports=Hl;function Hl(e,t,r){for(var n=Zl(e);n.index<(n.keyedList||e).length;)Bl(e,t,n,function(o,s){if(o){r(o,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return Vl.bind(n,r)}i(Hl,"parallel")});var Nn=z((bz,Er)=>{var La=kn(),ql=Rn(),Wl=Dn();Er.exports=Gl;Er.exports.ascending=Fa;Er.exports.descending=Jl;function Gl(e,t,r,n){var o=ql(e,r);return La(e,t,o,i(function s(c,p){if(c){n(c,p);return}if(o.index++,o.index<(o.keyedList||e).length){La(e,t,o,s);return}n(null,o.results)},"iteratorHandler")),Wl.bind(o,n)}i(Gl,"serialOrdered");function Fa(e,t){return e<t?-1:e>t?1:0}i(Fa,"ascending");function Jl(e,t){return-1*Fa(e,t)}i(Jl,"descending")});var Za=z((Tz,Ba)=>{var Kl=Nn();Ba.exports=Xl;function Xl(e,t,r){return Kl(e,t,null,r)}i(Xl,"serial")});var Ha=z((Sz,Va)=>{Va.exports={parallel:ja(),serial:Za(),serialOrdered:Nn()}});var Cn=z((Ez,qa)=>{"use strict";qa.exports=Object});var Ga=z((Az,Wa)=>{"use strict";Wa.exports=Error});var Ka=z((zz,Ja)=>{"use strict";Ja.exports=EvalError});var Ya=z((wz,Xa)=>{"use strict";Xa.exports=RangeError});var es=z((Oz,Qa)=>{"use strict";Qa.exports=ReferenceError});var rs=z((kz,ts)=>{"use strict";ts.exports=SyntaxError});var Ar=z((Rz,ns)=>{"use strict";ns.exports=TypeError});var is=z((Dz,os)=>{"use strict";os.exports=URIError});var ss=z((Nz,as)=>{"use strict";as.exports=Math.abs});var cs=z((Cz,us)=>{"use strict";us.exports=Math.floor});var ls=z((Uz,ps)=>{"use strict";ps.exports=Math.max});var ms=z((Mz,ds)=>{"use strict";ds.exports=Math.min});var gs=z((jz,fs)=>{"use strict";fs.exports=Math.pow});var hs=z((Lz,ys)=>{"use strict";ys.exports=Math.round});var xs=z((Fz,vs)=>{"use strict";vs.exports=Number.isNaN||i(function(t){return t!==t},"isNaN")});var Ps=z((Zz,_s)=>{"use strict";var Yl=xs();_s.exports=i(function(t){return Yl(t)||t===0?t:t<0?-1:1},"sign")});var Is=z((Hz,bs)=>{"use strict";bs.exports=Object.getOwnPropertyDescriptor});var Un=z((qz,Ts)=>{"use strict";var zr=Is();if(zr)try{zr([],"length")}catch{zr=null}Ts.exports=zr});var Ss=z((Wz,$s)=>{"use strict";var wr=Object.defineProperty||!1;if(wr)try{wr({},"a",{value:1})}catch{wr=!1}$s.exports=wr});var Mn=z((Gz,Es)=>{"use strict";Es.exports=i(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;t[r]=o;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,r);if(p.value!==o||p.enumerable!==!0)return!1}return!0},"hasSymbols")});var ws=z((Kz,zs)=>{"use strict";var As=typeof Symbol<"u"&&Symbol,Ql=Mn();zs.exports=i(function(){return typeof As!="function"||typeof Symbol!="function"||typeof As("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ql()},"hasNativeSymbols")});var jn=z((Yz,Os)=>{"use strict";Os.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Ln=z((Qz,ks)=>{"use strict";var ed=Cn();ks.exports=ed.getPrototypeOf||null});var Ns=z((ew,Ds)=>{"use strict";var td="Function.prototype.bind called on incompatible ",rd=Object.prototype.toString,nd=Math.max,od="[object Function]",Rs=i(function(t,r){for(var n=[],o=0;o<t.length;o+=1)n[o]=t[o];for(var s=0;s<r.length;s+=1)n[s+t.length]=r[s];return n},"concatty"),id=i(function(t,r){for(var n=[],o=r||0,s=0;o<t.length;o+=1,s+=1)n[s]=t[o];return n},"slicy"),ad=i(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");Ds.exports=i(function(t){var r=this;if(typeof r!="function"||rd.apply(r)!==od)throw new TypeError(td+r);for(var n=id(arguments,1),o,s=i(function(){if(this instanceof o){var h=r.apply(this,Rs(n,arguments));return Object(h)===h?h:this}return r.apply(t,Rs(n,arguments))},"binder"),c=nd(0,r.length-n.length),p=[],g=0;g<c;g++)p[g]="$"+g;if(o=Function("binder","return function ("+ad(p,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var f=i(function(){},"Empty");f.prototype=r.prototype,o.prototype=new f,f.prototype=null}return o},"bind")});var xt=z((rw,Cs)=>{"use strict";var sd=Ns();Cs.exports=Function.prototype.bind||sd});var Or=z((nw,Us)=>{"use strict";Us.exports=Function.prototype.call});var Fn=z((ow,Ms)=>{"use strict";Ms.exports=Function.prototype.apply});var Ls=z((iw,js)=>{"use strict";js.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Bs=z((aw,Fs)=>{"use strict";var ud=xt(),cd=Fn(),pd=Or(),ld=Ls();Fs.exports=ld||ud.call(pd,cd)});var Vs=z((sw,Zs)=>{"use strict";var dd=xt(),md=Ar(),fd=Or(),gd=Bs();Zs.exports=i(function(t){if(t.length<1||typeof t[0]!="function")throw new md("a function is required");return gd(dd,fd,t)},"callBindBasic")});var Ks=z((cw,Js)=>{"use strict";var yd=Vs(),Hs=Un(),Ws;try{Ws=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Bn=!!Ws&&Hs&&Hs(Object.prototype,"__proto__"),Gs=Object,qs=Gs.getPrototypeOf;Js.exports=Bn&&typeof Bn.get=="function"?yd([Bn.get]):typeof qs=="function"?i(function(t){return qs(t==null?t:Gs(t))},"getDunder"):!1});var tu=z((lw,eu)=>{"use strict";var Xs=jn(),Ys=Ln(),Qs=Ks();eu.exports=Xs?i(function(t){return Xs(t)},"getProto"):Ys?i(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Ys(t)},"getProto"):Qs?i(function(t){return Qs(t)},"getProto"):null});var Zn=z((mw,ru)=>{"use strict";var hd=Function.prototype.call,vd=Object.prototype.hasOwnProperty,xd=xt();ru.exports=xd.call(hd,vd)});var cu=z((fw,uu)=>{"use strict";var G,_d=Cn(),Pd=Ga(),bd=Ka(),Id=Ya(),Td=es(),It=rs(),bt=Ar(),$d=is(),Sd=ss(),Ed=cs(),Ad=ls(),zd=ms(),wd=gs(),Od=hs(),kd=Ps(),au=Function,Vn=i(function(e){try{return au('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),Xt=Un(),Rd=Ss(),Hn=i(function(){throw new bt},"throwTypeError"),Dd=Xt?function(){try{return arguments.callee,Hn}catch{try{return Xt(arguments,"callee").get}catch{return Hn}}}():Hn,_t=ws()(),de=tu(),Nd=Ln(),Cd=jn(),su=Fn(),Yt=Or(),Pt={},Ud=typeof Uint8Array>"u"||!de?G:de(Uint8Array),ot={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":_t&&de?de([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":Pt,"%AsyncGenerator%":Pt,"%AsyncGeneratorFunction%":Pt,"%AsyncIteratorPrototype%":Pt,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Pd,"%eval%":eval,"%EvalError%":bd,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":au,"%GeneratorFunction%":Pt,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":_t&&de?de(de([][Symbol.iterator]())):G,"%JSON%":typeof JSON=="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!_t||!de?G:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":_d,"%Object.getOwnPropertyDescriptor%":Xt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Id,"%ReferenceError%":Td,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!_t||!de?G:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":_t&&de?de(""[Symbol.iterator]()):G,"%Symbol%":_t?Symbol:G,"%SyntaxError%":It,"%ThrowTypeError%":Dd,"%TypedArray%":Ud,"%TypeError%":bt,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":$d,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":Yt,"%Function.prototype.apply%":su,"%Object.defineProperty%":Rd,"%Object.getPrototypeOf%":Nd,"%Math.abs%":Sd,"%Math.floor%":Ed,"%Math.max%":Ad,"%Math.min%":zd,"%Math.pow%":wd,"%Math.round%":Od,"%Math.sign%":kd,"%Reflect.getPrototypeOf%":Cd};if(de)try{null.error}catch(e){nu=de(de(e)),ot["%Error.prototype%"]=nu}var nu,Md=i(function e(t){var r;if(t==="%AsyncFunction%")r=Vn("async function () {}");else if(t==="%GeneratorFunction%")r=Vn("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Vn("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&de&&(r=de(o.prototype))}return ot[t]=r,r},"doEval"),ou={__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"]},Qt=xt(),kr=Zn(),jd=Qt.call(Yt,Array.prototype.concat),Ld=Qt.call(su,Array.prototype.splice),iu=Qt.call(Yt,String.prototype.replace),Rr=Qt.call(Yt,String.prototype.slice),Fd=Qt.call(Yt,RegExp.prototype.exec),Bd=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Zd=/\\(\\)?/g,Vd=i(function(t){var r=Rr(t,0,1),n=Rr(t,-1);if(r==="%"&&n!=="%")throw new It("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new It("invalid intrinsic syntax, expected opening `%`");var o=[];return iu(t,Bd,function(s,c,p,g){o[o.length]=p?iu(g,Zd,"$1"):c||s}),o},"stringToPath"),Hd=i(function(t,r){var n=t,o;if(kr(ou,n)&&(o=ou[n],n="%"+o[0]+"%"),kr(ot,n)){var s=ot[n];if(s===Pt&&(s=Md(n)),typeof s>"u"&&!r)throw new bt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:s}}throw new It("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");uu.exports=i(function(t,r){if(typeof t!="string"||t.length===0)throw new bt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new bt('"allowMissing" argument must be a boolean');if(Fd(/^%?[^%]*%?$/,t)===null)throw new It("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Vd(t),o=n.length>0?n[0]:"",s=Hd("%"+o+"%",r),c=s.name,p=s.value,g=!1,f=s.alias;f&&(o=f[0],Ld(n,jd([0,1],f)));for(var h=1,I=!0;h<n.length;h+=1){var x=n[h],u=Rr(x,0,1),d=Rr(x,-1);if((u==='"'||u==="'"||u==="`"||d==='"'||d==="'"||d==="`")&&u!==d)throw new It("property names with quotes must have matching quotes");if((x==="constructor"||!I)&&(g=!0),o+="."+x,c="%"+o+"%",kr(ot,c))p=ot[c];else if(p!=null){if(!(x in p)){if(!r)throw new bt("base intrinsic for "+t+" exists, but the property is not available.");return}if(Xt&&h+1>=n.length){var y=Xt(p,x);I=!!y,I&&"get"in y&&!("originalValue"in y.get)?p=y.get:p=p[x]}else I=kr(p,x),p=p[x];I&&!g&&(ot[c]=p)}}return p},"GetIntrinsic")});var lu=z((yw,pu)=>{"use strict";var qd=Mn();pu.exports=i(function(){return qd()&&!!Symbol.toStringTag},"hasToStringTagShams")});var fu=z((vw,mu)=>{"use strict";var Wd=cu(),du=Wd("%Object.defineProperty%",!0),Gd=lu()(),Jd=Zn(),Kd=Ar(),Dr=Gd?Symbol.toStringTag:null;mu.exports=i(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof o<"u"&&typeof o!="boolean")throw new Kd("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Dr&&(n||!Jd(t,Dr))&&(du?du(t,Dr,{configurable:!o,enumerable:!1,value:r,writable:!1}):t[Dr]=r)},"setToStringTag")});var yu=z((_w,gu)=>{"use strict";var Xd=Function.prototype.call,Yd=Object.prototype.hasOwnProperty,Qd=xt();gu.exports=Qd.call(Xd,Yd)});var vu=z((Pw,hu)=>{"use strict";hu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var Kn=z((bw,_u)=>{"use strict";var Jn=Ia(),em=require("util"),qn=require("path"),tm=require("http"),rm=require("https"),nm=require("url").parse,om=require("fs"),im=require("stream").Stream,am=require("crypto"),Wn=Aa(),sm=Ha(),um=fu(),Xe=yu(),Gn=vu();function xu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}i(xu,"escapeHeaderParam");function K(e){if(!(this instanceof K))return new K(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Jn.call(this),e=e||{};for(var t in e)this[t]=e[t]}i(K,"FormData");em.inherits(K,Jn);K.LINE_BREAK=`\r
2
+ `;K.DEFAULT_CONTENT_TYPE="application/octet-stream";K.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=Jn.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var o=this._multiPartHeader(e,t,r),s=this._multiPartFooter();n(o),n(t),n(s),this._trackLength(o,t,r)};K.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)+K.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&Xe(t,"httpVersion"))&&!(t instanceof im))&&(r.knownLength||this._valuesToMeasure.push(t))};K.prototype._lengthRetriever=function(e,t){Xe(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):om.stat(e.path,function(r,n){if(r){t(r);return}var o=n.size-(e.start?e.start:0);t(null,o)}):Xe(e,"httpVersion")?t(null,Number(e.headers["content-length"])):Xe(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};K.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),o=this._getContentType(t,r),s="",c={"Content-Disposition":["form-data",'name="'+xu(e)+'"'].concat(n||[]),"Content-Type":[].concat(o||[])};typeof r.header=="object"&&Gn(c,r.header);var p;for(var g in c)if(Xe(c,g)){if(p=c[g],p==null)continue;Array.isArray(p)||(p=[p]),p.length&&(s+=g+": "+p.join("; ")+K.LINE_BREAK)}return"--"+this.getBoundary()+K.LINE_BREAK+s+K.LINE_BREAK};K.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=qn.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=qn.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&Xe(e,"httpVersion")&&(r=qn.basename(e.client._httpMessage.path||"")),r)return'filename="'+xu(r)+'"'};K.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=Wn.lookup(e.name)),!r&&e&&e.path&&(r=Wn.lookup(e.path)),!r&&e&&e.readable&&Xe(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=Wn.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=K.DEFAULT_CONTENT_TYPE),r};K.prototype._multiPartFooter=function(){return function(e){var t=K.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};K.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+K.LINE_BREAK};K.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)Xe(e,t)&&(r[t.toLowerCase()]=e[t]);return r};K.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};K.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};K.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(K.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};K.prototype._generateBoundary=function(){this._boundary="--------------------------"+am.randomBytes(12).toString("hex")};K.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};K.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};K.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}sm.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(o){t+=o}),e(null,t)})};K.prototype.submit=function(e,t){var r,n,o={method:"post"};return typeof e=="string"?(e=nm(e),n=Gn({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o)):(n=Gn(e,o),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=rm.request(n):r=tm.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,g=i(function(f,h){return r.removeListener("error",g),r.removeListener("response",p),t.call(this,f,h)},"callback");p=g.bind(this,null),r.on("error",g),r.on("response",p)}}.bind(this)),r};K.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};K.prototype.toString=function(){return"[object FormData]"};um(K.prototype,"FormData");_u.exports=K});var Fu=z((to,ro)=>{(function(e,t){typeof to=="object"&&typeof ro<"u"?ro.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(to,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",s="minute",c="hour",p="day",g="week",f="month",h="quarter",I="year",x="date",u="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(M){var T=["th","st","nd","rd"],b=M%100;return"["+M+(T[(b-20)%10]||T[b]||T[0])+"]"},"ordinal")},_=i(function(M,T,b){var S=String(M);return!S||S.length>=T?M:""+Array(T+1-S.length).join(b)+M},"m"),P={s:_,z:i(function(M){var T=-M.utcOffset(),b=Math.abs(T),S=Math.floor(b/60),$=b%60;return(T<=0?"+":"-")+_(S,2,"0")+":"+_($,2,"0")},"z"),m:i(function M(T,b){if(T.date()<b.date())return-M(b,T);var S=12*(b.year()-T.year())+(b.month()-T.month()),$=T.clone().add(S,f),B=b-$<0,Z=T.clone().add(S+(B?-1:1),f);return+(-(S+(b-$)/(B?$-Z:Z-$))||0)},"t"),a:i(function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},"a"),p:i(function(M){return{M:f,y:I,w:g,d:p,D:x,h:c,m:s,s:o,ms:n,Q:h}[M]||String(M||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(M){return M===void 0},"u")},F="en",se={};se[F]=m;var ge=i(function(M){return M instanceof at},"p"),Ee=i(function M(T,b,S){var $;if(!T)return F;if(typeof T=="string"){var B=T.toLowerCase();se[B]&&($=B),b&&(se[B]=b,$=B);var Z=T.split("-");if(!$&&Z.length>1)return M(Z[0])}else{var ee=T.name;se[ee]=T,$=ee}return!S&&$&&(F=$),$||!S&&F},"t"),Q=i(function(M,T){if(ge(M))return M.clone();var b=typeof T=="object"?T:{};return b.date=M,b.args=arguments,new at(b)},"w"),q=P;q.l=Ee,q.i=ge,q.w=function(M,T){return Q(M,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var at=function(){function M(b){this.$L=Ee(b.locale,null,!0),this.parse(b)}i(M,"M");var T=M.prototype;return T.parse=function(b){this.$d=function(S){var $=S.date,B=S.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var Z=$.match(d);if(Z){var ee=Z[2]-1||0,ue=(Z[7]||"0").substring(0,3);return B?new Date(Date.UTC(Z[1],ee,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ue)):new Date(Z[1],ee,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ue)}}return new Date($)}(b),this.$x=b.x||{},this.init()},T.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},T.$utils=function(){return q},T.isValid=function(){return this.$d.toString()!==u},T.isSame=function(b,S){var $=Q(b);return this.startOf(S)<=$&&$<=this.endOf(S)},T.isAfter=function(b,S){return Q(b)<this.startOf(S)},T.isBefore=function(b,S){return this.endOf(S)<Q(b)},T.$g=function(b,S,$){return q.u(b)?this[S]:this.set($,b)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(b,S){var $=this,B=!!q.u(S)||S,Z=q.p(b),ee=i(function(et,ve){var Be=q.w($.$u?Date.UTC($.$y,ve,et):new Date($.$y,ve,et),$);return B?Be:Be.endOf(p)},"l"),ue=i(function(et,ve){return q.w($.toDate()[et].apply($.toDate("s"),(B?[0,0,0,0]:[23,59,59,999]).slice(ve)),$)},"$"),le=this.$W,fe=this.$M,be=this.$D,st="set"+(this.$u?"UTC":"");switch(Z){case I:return B?ee(1,0):ee(31,11);case f:return B?ee(1,fe):ee(0,fe+1);case g:var Qe=this.$locale().weekStart||0,St=(le<Qe?le+7:le)-Qe;return ee(B?be-St:be+(6-St),fe);case p:case x:return ue(st+"Hours",0);case c:return ue(st+"Minutes",1);case s:return ue(st+"Seconds",2);case o:return ue(st+"Milliseconds",3);default:return this.clone()}},T.endOf=function(b){return this.startOf(b,!1)},T.$set=function(b,S){var $,B=q.p(b),Z="set"+(this.$u?"UTC":""),ee=($={},$[p]=Z+"Date",$[x]=Z+"Date",$[f]=Z+"Month",$[I]=Z+"FullYear",$[c]=Z+"Hours",$[s]=Z+"Minutes",$[o]=Z+"Seconds",$[n]=Z+"Milliseconds",$)[B],ue=B===p?this.$D+(S-this.$W):S;if(B===f||B===I){var le=this.clone().set(x,1);le.$d[ee](ue),le.init(),this.$d=le.set(x,Math.min(this.$D,le.daysInMonth())).$d}else ee&&this.$d[ee](ue);return this.init(),this},T.set=function(b,S){return this.clone().$set(b,S)},T.get=function(b){return this[q.p(b)]()},T.add=function(b,S){var $,B=this;b=Number(b);var Z=q.p(S),ee=i(function(fe){var be=Q(B);return q.w(be.date(be.date()+Math.round(fe*b)),B)},"y");if(Z===f)return this.set(f,this.$M+b);if(Z===I)return this.set(I,this.$y+b);if(Z===p)return ee(1);if(Z===g)return ee(7);var ue=($={},$[s]=t,$[c]=r,$[o]=e,$)[Z]||1,le=this.$d.getTime()+b*ue;return q.w(le,this)},T.subtract=function(b,S){return this.add(-1*b,S)},T.format=function(b){var S=this,$=this.$locale();if(!this.isValid())return $.invalidDate||u;var B=b||"YYYY-MM-DDTHH:mm:ssZ",Z=q.z(this),ee=this.$H,ue=this.$m,le=this.$M,fe=$.weekdays,be=$.months,st=$.meridiem,Qe=i(function(ve,Be,Et,tr){return ve&&(ve[Be]||ve(S,B))||Et[Be].slice(0,tr)},"h"),St=i(function(ve){return q.s(ee%12||12,ve,"0")},"d"),et=st||function(ve,Be,Et){var tr=ve<12?"AM":"PM";return Et?tr.toLowerCase():tr};return B.replace(y,function(ve,Be){return Be||function(Et){switch(Et){case"YY":return String(S.$y).slice(-2);case"YYYY":return q.s(S.$y,4,"0");case"M":return le+1;case"MM":return q.s(le+1,2,"0");case"MMM":return Qe($.monthsShort,le,be,3);case"MMMM":return Qe(be,le);case"D":return S.$D;case"DD":return q.s(S.$D,2,"0");case"d":return String(S.$W);case"dd":return Qe($.weekdaysMin,S.$W,fe,2);case"ddd":return Qe($.weekdaysShort,S.$W,fe,3);case"dddd":return fe[S.$W];case"H":return String(ee);case"HH":return q.s(ee,2,"0");case"h":return St(1);case"hh":return St(2);case"a":return et(ee,ue,!0);case"A":return et(ee,ue,!1);case"m":return String(ue);case"mm":return q.s(ue,2,"0");case"s":return String(S.$s);case"ss":return q.s(S.$s,2,"0");case"SSS":return q.s(S.$ms,3,"0");case"Z":return Z}return null}(ve)||Z.replace(":","")})},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(b,S,$){var B,Z=this,ee=q.p(S),ue=Q(b),le=(ue.utcOffset()-this.utcOffset())*t,fe=this-ue,be=i(function(){return q.m(Z,ue)},"D");switch(ee){case I:B=be()/12;break;case f:B=be();break;case h:B=be()/3;break;case g:B=(fe-le)/6048e5;break;case p:B=(fe-le)/864e5;break;case c:B=fe/r;break;case s:B=fe/t;break;case o:B=fe/e;break;default:B=fe}return $?B:q.a(B)},T.daysInMonth=function(){return this.endOf(f).$D},T.$locale=function(){return se[this.$L]},T.locale=function(b,S){if(!b)return this.$L;var $=this.clone(),B=Ee(b,S,!0);return B&&($.$L=B),$},T.clone=function(){return q.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},M}(),Ye=at.prototype;return Q.prototype=Ye,[["$ms",n],["$s",o],["$m",s],["$H",c],["$W",p],["$M",f],["$y",I],["$D",x]].forEach(function(M){Ye[M[1]]=function(T){return this.$g(T,M[0],M[1])}}),Q.extend=function(M,T){return M.$i||(M(T,at,Q),M.$i=!0),Q},Q.locale=Ee,Q.isDayjs=ge,Q.unix=function(M){return Q(1e3*M)},Q.en=se[F],Q.Ls=se,Q.p={},Q})});var Tm={};no(Tm,{coupa:()=>Im});module.exports=Gu(Tm);var Ju=Object.freeze({status:"aborted"});function E(e,t,r){function n(p,g){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:g,constr:c,traits:new Set},enumerable:!1}),p._zod.traits.has(e))return;p._zod.traits.add(e),t(p,g);let f=c.prototype,h=Object.keys(f);for(let I=0;I<h.length;I++){let x=h[I];x in p||(p[x]=f[x].bind(p))}}i(n,"init");let o=r?.Parent??Object;class s extends o{static{i(this,"Definition")}}Object.defineProperty(s,"name",{value:e});function c(p){var g;let f=r?.Parent?new s:this;n(f,p),(g=f._zod).deferred??(g.deferred=[]);for(let h of f._zod.deferred)h();return f}return i(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:i(p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e),"value")}),Object.defineProperty(c,"name",{value:e}),c}i(E,"$constructor");var Ku=Symbol("zod_brand"),Ae=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},rr=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Hr={};function De(e){return e&&Object.assign(Hr,e),Hr}i(De,"config");function Wr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}i(Wr,"getEnumValues");function ao(e,t){return typeof t=="bigint"?t.toString():t}i(ao,"jsonStringifyReplacer");function or(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(or,"cached");function so(e){return e==null}i(so,"nullish");function ir(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(ir,"cleanRegex");var io=Symbol("evaluating");function ce(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==io)return n===void 0&&(n=io,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}i(ce,"defineLazy");var Gr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(zt,"isObject");var Xu=or(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function uo(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(zt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(uo,"isPlainObject");var co=new Set(["string","number","symbol"]);function ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(ut,"escapeRegex");function ar(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}i(ar,"clone");function ne(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:i(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:i(()=>t.error,"error")}:t}i(ne,"normalizeParams");function po(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(po,"optionalKeys");var Yu={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 ct(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}i(ct,"aborted");function Ve(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}i(Ve,"prefixIssues");function nr(e){return typeof e=="string"?e:e?.message}i(nr,"unwrapMessage");function He(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=nr(e.inst?._zod.def?.error?.(e))??nr(t?.error?.(e))??nr(r.customError?.(e))??nr(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}i(He,"finalizeIssue");function lo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(lo,"getLengthableOrigin");function Jr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}i(Jr,"issue");var mo=i((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ao,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),fo=E("$ZodError",mo),wt=E("$ZodError",mo,{Parent:Error});var ec=i(e=>(t,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new Ae;if(c.issues.length){let p=new(o?.Err??e)(c.issues.map(g=>He(g,s,De())));throw Gr(p,o?.callee),p}return c.value},"_parse"),sr=ec(wt),tc=i(e=>async(t,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let p=new(o?.Err??e)(c.issues.map(g=>He(g,s,De())));throw Gr(p,o?.callee),p}return c.value},"_parseAsync"),ur=tc(wt),rc=i(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ae;return s.issues.length?{success:!1,error:new(e??fo)(s.issues.map(c=>He(c,o,De())))}:{success:!0,data:s.value}},"_safeParse"),Ot=rc(wt),nc=i(e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>He(c,o,De())))}:{success:!0,data:s.value}},"_safeParseAsync"),kt=nc(wt);var oc="(?:(?:\\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])))",ic=new RegExp(`^${oc}$`);var go=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),yo=/^-?\d+n?$/;var Kr=/^-?\d+(?:\.\d+)?$/,ho=/^(?:true|false)$/i;var pt=E("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var vo=E("$ZodCheckMinLength",(e,t)=>{var r;pt.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!so(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let c=lo(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}});var Xr=E("$ZodCheckStringFormat",(e,t)=>{var r,n;pt.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),xo=E("$ZodCheckRegex",(e,t)=>{Xr.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 Po={major:4,minor:3,patch:6};var oe=E("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Po;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=i((c,p,g)=>{let f=ct(c),h;for(let I of p){if(I._zod.def.when){if(!I._zod.def.when(c))continue}else if(f)continue;let x=c.issues.length,u=I._zod.check(c);if(u instanceof Promise&&g?.async===!1)throw new Ae;if(h||u instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await u,c.issues.length!==x&&(f||(f=ct(c,x)))});else{if(c.issues.length===x)continue;f||(f=ct(c,x))}}return h?h.then(()=>c):c},"runChecks"),s=i((c,p,g)=>{if(ct(c))return c.aborted=!0,c;let f=o(p,n,g);if(f instanceof Promise){if(g.async===!1)throw new Ae;return f.then(h=>e._zod.parse(h,g))}return e._zod.parse(f,g)},"handleCanaryResult");e._zod.run=(c,p)=>{if(p.skipChecks)return e._zod.parse(c,p);if(p.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...p,skipChecks:!0});return f instanceof Promise?f.then(h=>s(h,c,p)):s(f,c,p)}let g=e._zod.parse(c,p);if(g instanceof Promise){if(p.async===!1)throw new Ae;return g.then(f=>o(f,n,p))}return o(g,n,p)}}ce(e,"~standard",()=>({validate:i(o=>{try{let s=Ot(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return kt(e,o).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),lr=E("$ZodString",(e,t)=>{oe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??go(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Yr=E("$ZodStringFormat",(e,t)=>{Xr.init(e,t),lr.init(e,t)});var So=E("$ZodURL",(e,t)=>{Yr.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Eo=E("$ZodNumber",(e,t)=>{oe.init(e,t),e._zod.pattern=e._zod.bag.pattern??Kr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}});var Qr=E("$ZodBoolean",(e,t)=>{oe.init(e,t),e._zod.pattern=ho,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Ao=E("$ZodBigInt",(e,t)=>{oe.init(e,t),e._zod.pattern=yo,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 zo=E("$ZodAny",(e,t)=>{oe.init(e,t),e._zod.parse=r=>r}),wo=E("$ZodUnknown",(e,t)=>{oe.init(e,t),e._zod.parse=r=>r});var Oo=E("$ZodVoid",(e,t)=>{oe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),ko=E("$ZodDate",(e,t)=>{oe.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function bo(e,t,r){e.issues.length&&t.issues.push(...Ve(r,e.issues)),t.value[r]=e.value}i(bo,"handleArrayResult");var Ro=E("$ZodArray",(e,t)=>{oe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let c=0;c<o.length;c++){let p=o[c],g=t.element._zod.run({value:p,issues:[]},n);g instanceof Promise?s.push(g.then(f=>bo(f,r,c))):bo(g,r,c)}return s.length?Promise.all(s).then(()=>r):r}});function pr(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ve(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}i(pr,"handlePropertyResult");function ac(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=po(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(ac,"normalizeDef");function sc(e,t,r,n,o,s){let c=[],p=o.keySet,g=o.catchall._zod,f=g.def.type,h=g.optout==="optional";for(let I in t){if(p.has(I))continue;if(f==="never"){c.push(I);continue}let x=g.run({value:t[I],issues:[]},n);x instanceof Promise?e.push(x.then(u=>pr(u,r,I,t,h))):pr(x,r,I,t,h)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}i(sc,"handleCatchall");var Do=E("$ZodObject",(e,t)=>{if(oe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let p=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let g={...p};return Object.defineProperty(t,"shape",{value:g}),g},"get")})}let n=or(()=>ac(t));ce(e._zod,"propValues",()=>{let p=t.shape,g={};for(let f in p){let h=p[f]._zod;if(h.values){g[f]??(g[f]=new Set);for(let I of h.values)g[f].add(I)}}return g});let o=zt,s=t.catchall,c;e._zod.parse=(p,g)=>{c??(c=n.value);let f=p.value;if(!o(f))return p.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),p;p.value={};let h=[],I=c.shape;for(let x of c.keys){let u=I[x],d=u._zod.optout==="optional",y=u._zod.run({value:f[x],issues:[]},g);y instanceof Promise?h.push(y.then(m=>pr(m,p,x,f,d))):pr(y,p,x,f,d)}return s?sc(h,f,p,g,n.value,e):h.length?Promise.all(h).then(()=>p):p}});function Io(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!ct(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(c=>He(c,n,De())))}),t)}i(Io,"handleUnionResults");var en=E("$ZodUnion",(e,t)=>{oe.init(e,t),ce(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ce(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ce(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ce(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>ir(s.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let c=!1,p=[];for(let g of t.options){let f=g._zod.run({value:o.value,issues:[]},s);if(f instanceof Promise)p.push(f),c=!0;else{if(f.issues.length===0)return f;p.push(f)}}return c?Promise.all(p).then(g=>Io(g,o,e,s)):Io(p,o,e,s)}});var No=E("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,en.init(e,t);let r=e._zod.parse;ce(e._zod,"propValues",()=>{let o={};for(let s of t.options){let c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[p,g]of Object.entries(c)){o[p]||(o[p]=new Set);for(let f of g)o[p].add(f)}}return o});let n=or(()=>{let o=t.options,s=new Map;for(let c of o){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 g of p){if(s.has(g))throw new Error(`Duplicate discriminator value "${String(g)}"`);s.set(g,c)}}return s});e._zod.parse=(o,s)=>{let c=o.value;if(!zt(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;let p=n.value.get(c?.[t.discriminator]);return p?p._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),o)}});var Co=E("$ZodRecord",(e,t)=>{oe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!uo(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],c=t.keyType._zod.values;if(c){r.value={};let p=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){p.add(typeof f=="number"?f.toString():f);let h=t.valueType._zod.run({value:o[f],issues:[]},n);h instanceof Promise?s.push(h.then(I=>{I.issues.length&&r.issues.push(...Ve(f,I.issues)),r.value[f]=I.value})):(h.issues.length&&r.issues.push(...Ve(f,h.issues)),r.value[f]=h.value)}let g;for(let f in o)p.has(f)||(g=g??[],g.push(f));g&&g.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:g})}else{r.value={};for(let p of Reflect.ownKeys(o)){if(p==="__proto__")continue;let g=t.keyType._zod.run({value:p,issues:[]},n);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&Kr.test(p)&&g.issues.length){let I=t.keyType._zod.run({value:Number(p),issues:[]},n);if(I instanceof Promise)throw new Error("Async schemas not supported in object keys currently");I.issues.length===0&&(g=I)}if(g.issues.length){t.mode==="loose"?r.value[p]=o[p]:r.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(I=>He(I,n,De())),input:p,path:[p],inst:e});continue}let h=t.valueType._zod.run({value:o[p],issues:[]},n);h instanceof Promise?s.push(h.then(I=>{I.issues.length&&r.issues.push(...Ve(p,I.issues)),r.value[g.value]=I.value})):(h.issues.length&&r.issues.push(...Ve(p,h.issues)),r.value[g.value]=h.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Uo=E("$ZodEnum",(e,t)=>{oe.init(e,t);let r=Wr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>co.has(typeof o)).map(o=>typeof o=="string"?ut(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),Mo=E("$ZodLiteral",(e,t)=>{if(oe.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"?ut(n):n?ut(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var jo=E("$ZodTransform",(e,t)=>{oe.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new rr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(r.value=c,r));if(o instanceof Promise)throw new Ae;return r.value=o,r}});function To(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(To,"handleOptionalResult");var Lo=E("$ZodOptional",(e,t)=>{oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ir(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>To(s,r.value)):To(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Fo=E("$ZodNullable",(e,t)=>{oe.init(e,t),ce(e._zod,"optin",()=>t.innerType._zod.optin),ce(e._zod,"optout",()=>t.innerType._zod.optout),ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ir(r.source)}|null)$`):void 0}),ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var Bo=E("$ZodPipe",(e,t)=>{oe.init(e,t),ce(e._zod,"values",()=>t.in._zod.values),ce(e._zod,"optin",()=>t.in._zod.optin),ce(e._zod,"optout",()=>t.out._zod.optout),ce(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=>cr(c,t.in,n)):cr(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>cr(s,t.out,n)):cr(o,t.out,n)}});function cr(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(cr,"handlePipeResult");var Zo=E("$ZodCustom",(e,t)=>{pt.init(e,t),oe.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>$o(s,r,n,e));$o(o,r,n,e)}});function $o(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Jr(o))}}i($o,"handleRefineResult");var Ho,lc=Symbol("ZodOutput"),dc=Symbol("ZodInput"),tn=class{static{i(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function qo(){return new tn}i(qo,"registry");(Ho=globalThis).__zod_globalRegistry??(Ho.__zod_globalRegistry=qo());var rn=globalThis.__zod_globalRegistry;function Wo(e,t){return new e({type:"string",...ne(t)})}i(Wo,"_string");function Go(e,t){return new e({type:"string",coerce:!0,...ne(t)})}i(Go,"_coercedString");function Jo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ne(t)})}i(Jo,"_url");function Ko(e,t){return new e({type:"number",checks:[],...ne(t)})}i(Ko,"_number");function Xo(e,t){return new e({type:"number",coerce:!0,checks:[],...ne(t)})}i(Xo,"_coercedNumber");function Yo(e,t){return new e({type:"boolean",...ne(t)})}i(Yo,"_boolean");function Qo(e,t){return new e({type:"boolean",coerce:!0,...ne(t)})}i(Qo,"_coercedBoolean");function ei(e,t){return new e({type:"bigint",coerce:!0,...ne(t)})}i(ei,"_coercedBigint");function ti(e){return new e({type:"any"})}i(ti,"_any");function ri(e){return new e({type:"unknown"})}i(ri,"_unknown");function ni(e,t){return new e({type:"void",...ne(t)})}i(ni,"_void");function oi(e,t){return new e({type:"date",coerce:!0,...ne(t)})}i(oi,"_coercedDate");function $e(e,t){return new vo({check:"min_length",...ne(t),minimum:e})}i($e,"_minLength");function qe(e,t){return new xo({check:"string_format",format:"regex",...ne(t),pattern:e})}i(qe,"_regex");function ii(e,t,r){let n=ne(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}i(ii,"_custom");var pe=E("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");oe.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>sr(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ot(e,r,n),e.parseAsync=async(r,n)=>ur(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>kt(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>ar(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.apply=r=>r(e)}),mr=E("ZodMiniString",(e,t)=>{lr.init(e,t),pe.init(e,t)});function a(e){return Wo(mr,e)}i(a,"string");var ai=E("ZodMiniStringFormat",(e,t)=>{Yr.init(e,t),mr.init(e,t)});var bc=E("ZodMiniURL",(e,t)=>{So.init(e,t),ai.init(e,t)});function si(e){return Jo(bc,e)}i(si,"url");var nn=E("ZodMiniNumber",(e,t)=>{Eo.init(e,t),pe.init(e,t)});function ye(e){return Ko(nn,e)}i(ye,"number");var on=E("ZodMiniBoolean",(e,t)=>{Qr.init(e,t),pe.init(e,t)});function Y(e){return Yo(on,e)}i(Y,"boolean");var ui=E("ZodMiniBigInt",(e,t)=>{Ao.init(e,t),pe.init(e,t)});var Ic=E("ZodMiniAny",(e,t)=>{zo.init(e,t),pe.init(e,t)});function Dt(){return ti(Ic)}i(Dt,"any");var Tc=E("ZodMiniUnknown",(e,t)=>{wo.init(e,t),pe.init(e,t)});function N(){return ri(Tc)}i(N,"unknown");var $c=E("ZodMiniVoid",(e,t)=>{Oo.init(e,t),pe.init(e,t)});function ci(e){return ni($c,e)}i(ci,"_void");var pi=E("ZodMiniDate",(e,t)=>{ko.init(e,t),pe.init(e,t)});var Sc=E("ZodMiniArray",(e,t)=>{Ro.init(e,t),pe.init(e,t)});function j(e,t){return new Sc({type:"array",element:e,...ne(t)})}i(j,"array");var Ec=E("ZodMiniObject",(e,t)=>{Do.init(e,t),pe.init(e,t),ce(e,"shape",()=>t.shape)});function l(e,t){let r={type:"object",shape:e??{},...ne(t)};return new Ec(r)}i(l,"object");var Ac=E("ZodMiniUnion",(e,t)=>{en.init(e,t),pe.init(e,t)});function L(e,t){return new Ac({type:"union",options:e,...ne(t)})}i(L,"union");var zc=E("ZodMiniDiscriminatedUnion",(e,t)=>{No.init(e,t),pe.init(e,t)});function lt(e,t,r){return new zc({type:"union",options:t,discriminator:e,...ne(r)})}i(lt,"discriminatedUnion");var wc=E("ZodMiniRecord",(e,t)=>{Co.init(e,t),pe.init(e,t)});function C(e,t,r){return new wc({type:"record",keyType:e,valueType:t,...ne(r)})}i(C,"record");var Oc=E("ZodMiniEnum",(e,t)=>{Uo.init(e,t),pe.init(e,t),e.options=Object.values(t.entries)});function H(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Oc({type:"enum",entries:r,...ne(t)})}i(H,"_enum");var kc=E("ZodMiniLiteral",(e,t)=>{Mo.init(e,t),pe.init(e,t)});function O(e,t){return new kc({type:"literal",values:Array.isArray(e)?e:[e],...ne(t)})}i(O,"literal");var Rc=E("ZodMiniTransform",(e,t)=>{jo.init(e,t),pe.init(e,t)});function We(e){return new Rc({type:"transform",transform:e})}i(We,"transform");var Dc=E("ZodMiniOptional",(e,t)=>{Lo.init(e,t),pe.init(e,t)});function v(e){return new Dc({type:"optional",innerType:e})}i(v,"optional");var Nc=E("ZodMiniNullable",(e,t)=>{Fo.init(e,t),pe.init(e,t)});function Nt(e){return new Nc({type:"nullable",innerType:e})}i(Nt,"nullable");var Cc=E("ZodMiniPipe",(e,t)=>{Bo.init(e,t),pe.init(e,t)});function Ge(e,t){return new Cc({type:"pipe",in:e,out:t})}i(Ge,"pipe");var Uc=E("ZodMiniCustom",(e,t)=>{Zo.init(e,t),pe.init(e,t)});function fr(e,t){return ii(Uc,e??(()=>!0),t)}i(fr,"custom");var Ct={};no(Ct,{bigint:()=>Vc,boolean:()=>Zc,date:()=>Hc,number:()=>Bc,string:()=>Fc});function Fc(e){return Go(mr,e)}i(Fc,"string");function Bc(e){return Xo(nn,e)}i(Bc,"number");function Zc(e){return Qo(on,e)}i(Zc,"boolean");function Vc(e){return ei(ui,e)}i(Vc,"bigint");function Hc(e){return oi(pi,e)}i(Hc,"date");var sn=l({retryOnFailure:l({defaultValue:v(Y()),hide:v(Y())}),continueOnFailure:l({defaultValue:v(Y()),hide:v(Y())})}),an=class{constructor(t,r,n,o,s,c,p,g,f,h,I){this.name=t;this.displayName=r;this.description=n;this.props=o;this.run=s;this.test=c;this.requireAuth=p;this.errorHandlingOptions=g;this.outputSchema=f;this.audience=h;this.aiMetadata=I}static{i(this,"IAction")}},te=i(e=>new an(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 X=l({displayName:a(),description:v(a())}),V=i((e,t)=>l({type:O(t),required:Y(),defaultValue:v(Dt())}),"TPropertyValue");var _e=l({...X.shape,...V(a(),"SHORT_TEXT").shape}),Ne=l({...X.shape,...V(a(),"LONG_TEXT").shape});var di=l({label:a(),value:N()}),gr=l({disabled:v(Y()),placeholder:v(a()),options:j(di)});var Pe=l({...X.shape,options:gr,...V(N(),"STATIC_DROPDOWN").shape}),Ce=l({...X.shape,options:gr,...V(j(N()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var un=l({...X.shape,...V(N(),"DROPDOWN").shape,refreshers:j(a())}),Ut=l({...X.shape,...V(j(N()),"MULTI_SELECT_DROPDOWN").shape,refreshers:j(a())});var Ue=l({...X.shape,...V(Y(),"CHECKBOX").shape});var Me=l({...X.shape,...V(ye(),"NUMBER").shape});var Mt=l({...X.shape,...V(N(),"FILE").shape});var jt=l({...X.shape,...V(a(),"DATE_TIME").shape});var mi=C(a(),L([_e,Ne,Pe,Ut,Ce,Ue,Me,Mt,jt])),Lt=l({...X.shape,properties:mi,...V(j(N()),"ARRAY").shape});var Ft=l({...X.shape,...V(L([C(a(),N())]),"JSON").shape});var fi=L([_e,Pe,Ft,Lt,Ce]),Wc=C(a(),fi),cn=l({refreshers:j(a()),...X.shape,...V(N(),"DYNAMIC").shape});var yr=l({...X.shape,...V(ci(),"MARKDOWN").shape});var Bt=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Bt||{}),dt=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(dt||{}),mt=(_=>(_.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",_.COMMUNICATION="COMMUNICATION",_.COMMERCE="COMMERCE",_.CORE="CORE",_.UNIVERSAL_AI="UNIVERSAL_AI",_.FLOW_CONTROL="FLOW_CONTROL",_.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",_.ACCOUNTING="ACCOUNTING",_.PRODUCTIVITY="PRODUCTIVITY",_.CONTENT_AND_FILES="CONTENT_AND_FILES",_.DEVELOPER_TOOLS="DEVELOPER_TOOLS",_.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",_.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",_.HUMAN_RESOURCES="HUMAN_RESOURCES",_.PAYMENT_PROCESSING="PAYMENT_PROCESSING",_.MARKETING="MARKETING",_.SALES_AND_CRM="SALES_AND_CRM",_))(mt||{});var Zt=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Zt||{}),pn="both_client_credentials_and_authorization_code";var Je=(o=>(o.POLLING="POLLING",o.WEBHOOK="WEBHOOK",o.APP_WEBHOOK="APP_WEBHOOK",o.MANUAL="MANUAL",o))(Je||{}),Vt=(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))(Vt||{}),Gc=l({strategy:H(Vt),paramName:v(a())}),Ht=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ht||{});var hr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(hr||{}),gi=l({status:v(ye()),body:v(N()),headers:v(C(a(),a()))}),yi=l({type:O("DELAY"),resumeDateTime:a(),requestIdToReply:v(a()),handlerId:v(a()),streamStepProgress:v(H(hr))}),hi=l({type:O("WEBHOOK"),requestId:a(),requestIdToReply:v(a()),response:gi,handlerId:v(a()),streamStepProgress:v(H(hr))}),Jc=L([yi,hi]);var Kc=l({body:N(),rawBody:v(N()),headers:C(a(),a()),queryParams:C(a(),a())});function me(e){return e==null}i(me,"isNil");function qt(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}i(qt,"isEmpty");function vr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}i(vr,"assertNotNullOrUndefined");var ln=Ze(require("crypto"),1);var Xc=128,tt,ft,Yc=i(e=>{!tt||tt.length<e?(tt=Buffer.allocUnsafe(e*Xc),ln.default.randomFillSync(tt),ft=0):ft+e>tt.length&&(ln.default.randomFillSync(tt),ft=0),ft+=e},"fillPool"),Qc=i(e=>(Yc(e|=0),tt.subarray(ft-e,ft)),"random"),ep=i((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,o=Math.ceil(1.6*n*t/e.length);return(s=t)=>{let c="";for(;;){let p=r(o),g=o;for(;g--;)if(c+=e[p[g]&n]||"",c.length===s)return c}}},"customRandom"),xi=i((e,t=21)=>ep(e,t,Qc),"customAlphabet");var tp="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",_i=21,sI=a().check(qe(new RegExp(`^[0-9a-zA-Z]{${_i}}$`))),rp=xi(tp,_i);var Ke=Ge(We(e=>e instanceof Date?e.toISOString():e),a()),Ie={id:a(),created:Ke,updated:Ke},re=i(e=>v(Nt(e)),"Nullable");function dn(e){return v(Nt(H(e)))}i(dn,"NullableEnum");var pI=Ge(We(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),v(Y())),xr=i(e=>Ge(We(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),v(j(e))),"OptionalArrayFromQuery");var mI=C(a(),N());var Wt=(h=>(h.OPENAI="openai",h.OPENROUTER="openrouter",h.ANTHROPIC="anthropic",h.AZURE="azure",h.GOOGLE="google",h.ACTIVEPIECES="activepieces",h.CLOUDFLARE_GATEWAY="cloudflare-gateway",h.CUSTOM="custom",h.BEDROCK="bedrock",h.MISTRAL="mistral",h))(Wt||{});var $I=a().check(qe(/^#[0-9A-Fa-f]{6}$/));var EI=l({filename:a(),data:N(),type:O("file"),mimetype:v(a())});var np=Ze(bi());var DI=l({...Ie,name:a(),permissions:j(a()),platformId:re(a()),type:a(),userCount:v(ye())});var Ii=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Ii||{}),mn=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(mn||{}),fn=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(fn||{});var gn=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(gn||{});var yn=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(yn||{});var op=l({mode:H(Ii),value:N()}),ip=l({auth:v(a()),fields:C(a(),op)}),ap=l({pieceName:a(),pieceVersion:a(),actionName:a(),predefinedInput:v(ip)}),sp=l({type:O("PIECE"),toolName:a().check($e(1)),pieceMetadata:ap}),up=l({type:O("none")}),cp=l({type:O("access_token"),accessToken:a()}),pp=l({type:O("api_key"),apiKey:a(),apiKeyHeader:a()}),lp=l({type:O("headers"),headers:C(a(),a())}),dp=lt("type",[up,cp,pp,lp]),Ti=l({type:O("FLOW"),toolName:a().check($e(1)),externalFlowId:a(),flowDisplayName:v(a())}),$i=l({type:O("MCP"),toolName:a().check($e(1)),serverUrl:si(),protocol:H(fn),auth:dp}),Si=l({type:O("KNOWLEDGE_BASE"),toolName:a().check($e(1)),sourceType:H(mn),sourceId:a(),sourceName:a()}),mp=lt("type",[sp,Ti,$i,Si]),fp=l({displayName:a(),description:v(a()),type:H(gn)}),Ei=l({type:O("MARKDOWN"),markdown:a()}),gt={type:O("TOOL_CALL"),input:re(C(a(),N())),output:v(N()),toolName:a(),status:H(yn),toolCallId:a(),startTime:a(),endTime:v(a())},sT=l(gt),Ai=lt("toolCallType",[l({...gt,toolCallType:O("PIECE"),pieceName:a(),pieceVersion:a(),actionName:a()}),l({...gt,toolCallType:O("FLOW"),displayName:a(),externalFlowId:a()}),l({...gt,toolCallType:O("MCP"),displayName:a(),serverUrl:a()}),l({...gt,toolCallType:O("KNOWLEDGE_BASE"),displayName:a(),sourceType:a()}),l({...gt,toolCallType:O("UNKNOWN"),displayName:a()})]),gp=L([Ei,Ai]);var hn=(r=>(r.IMAGE="image",r.TEXT="text",r))(hn||{}),je=l({apiKey:a()}),yp=je,hp=l({apiKey:a(),apiKeyHash:a()}),vp=je,xp=je,_p=je,Pp=je,bp=je,Ip=je,Tp=je,zi=l({accessKeyId:a().check($e(1)),secretAccessKey:a().check($e(1))}),$p=l({}),Sp=l({}),Ep=l({}),Ap=l({}),zp=l({}),wp=l({}),wi=l({modelId:a(),modelName:a(),modelType:H(hn)}),Oi=l({apiKeyHeader:a(),baseUrl:a(),models:j(wi),defaultHeaders:v(C(a(),a()))}),ki=l({accountId:a(),gatewayId:a(),models:j(wi),vertexProject:v(a()),vertexRegion:v(a())}),Ri=l({resourceName:a(),apiVersion:Ge(We(e=>typeof e=="string"&&e.trim().length===0?void 0:e),v(a()))}),Di=l({region:a().check($e(1))}),Op=L([yp,_p,Pp,bp,Ip,xp,vp,hp,zi,Tp]),Ni=L([Oi,ki,Ri,Di,$p,Ep,Ap,zp,Sp,wp]),kp=l({id:a(),name:a(),type:H(hn)}),Rp=l({id:a(),name:a(),provider:H(Wt),config:Ni,enabledForChat:Y()}),Dp=l({provider:H(Wt),config:Ni,auth:Op,platformId:a()});var lT={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var Np=l({base64Url:a(),fileName:a(),extension:v(a())}),Cp=l({mimeType:a(),url:a(),fileName:v(a())}),vn=L([Np,Cp]);var Up=L([l({type:O("file"),value:vn}),l({type:O("markdown"),value:a(),files:v(j(vn))})]),Mp=l({sessionId:a(),message:a(),files:v(j(a()))});var Ui=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Ui||{}),Mi=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Mi||{}),xn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(xn||{});var jp=L([l({...Ie,name:a(),externalId:a(),type:O("STATIC_DROPDOWN"),tableId:a(),projectId:a(),data:l({options:j(l({value:a()}))})}),l({...Ie,name:a(),externalId:a(),type:L([O("TEXT"),O("NUMBER"),O("DATE")]),tableId:a(),projectId:a()})]),Lp=l({...Ie,name:a(),folderId:re(a()),projectId:a(),externalId:a(),status:dn(Mi),trigger:dn(Ui)}),Fp=l({...Ie,tableId:a(),projectId:a(),cells:C(a(),l({updated:a(),created:a(),value:N(),fieldName:a()}))}),Bp=l({events:j(H(xn)),webhookUrl:a(),flowId:a()}),Zp=l({fields:j(l({id:a(),name:a()})),rows:j(C(a(),a())),name:a()}),Vp=l({projectId:a(),limit:v(Ct.number()),cursor:v(a()),name:v(a()),externalIds:xr(a()),folderId:v(a()),folderIds:xr(a())}),Hp=l({records:j(j(l({fieldId:a(),value:Li()}))),tableId:a()}),qp=l({cells:v(j(l({fieldId:a(),value:Li()}))),tableId:a(),agentUpdate:v(Y())}),ji=lt("operator",[rt("eq"),rt("neq"),rt("gt"),rt("gte"),rt("lt"),rt("lte"),rt("co"),Ci("exists"),Ci("not_exists")]),Wp=l({tableId:a(),limit:v(Ct.number()),cursor:v(a()),filters:xr(ji)});function Li(){return Ge(We(e=>e==null?e:String(e)),Nt(a()))}i(Li,"coerceToString");function rt(e){return l({fieldId:a(),operator:O(e),value:a()})}i(rt,"valueFilter");function Ci(e){return l({fieldId:a(),operator:O(e)})}i(Ci,"existenceFilter");var Gp=l({status:v(ye()),body:v(N()),headers:v(C(a(),a()))}),Jp=l({...Ie,deleted:re(Ke),ownerId:a(),displayName:a(),platformId:a(),externalId:re(a())});var Fi=l({name:a(),description:v(a()),type:a(),required:Y()}),Kp=l({pieceName:a(),triggerName:a(),input:l({toolName:a(),toolDescription:a(),inputSchema:j(Fi),returnsResponse:Y()})});var Bi="^[0-9]+\\.[0-9]+\\.[0-9]+$",wT=new RegExp(Bi),Yp="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",OT=a().check(qe(new RegExp(Bi))),kT=a().check(qe(new RegExp(Yp))),Qp=l({packageType:O("ARCHIVE"),pieceType:H(dt),pieceName:a(),pieceVersion:a(),archiveId:a(),platformId:a()}),Zi=l({packageType:O("REGISTRY"),pieceType:O("OFFICIAL"),pieceName:a(),pieceVersion:a()}),Vi=l({packageType:O("REGISTRY"),pieceType:O("CUSTOM"),pieceName:a(),pieceVersion:a(),platformId:a()}),RT=L([Zi,Vi]),DT=L([Qp,Zi,Vi]),Hi=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(Hi||{}),el=l({type:H(Hi),cronExpression:a(),timezone:a()}),NT=l({...Ie,type:H(Je),projectId:a(),flowId:a(),triggerName:a(),schedule:re(el),flowVersionId:a(),pieceName:a(),pieceVersion:a(),deleted:re(a()),simulate:Y()}),qi=(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))(qi||{}),Wi=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Wi||{}),Gi=(r=>(r.S3="S3",r.DB="DB",r))(Gi||{}),CT=l({...Ie,projectId:re(a()),platformId:re(a()),type:H(qi),compression:H(Wi),data:v(N()),location:H(Gi),size:re(ye()),fileName:re(a()),s3Key:re(a()),metadata:re(C(a(),a()))}),Ji=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Ji||{}),Ki=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Ki||{}),UT=l({id:a(),email:a(),firstName:a(),status:H(Ki),externalId:re(a()),platformId:re(a()),platformRole:H(Ji),lastName:a(),created:Ke,updated:Ke,lastActiveDate:re(Ke),imageUrl:re(a())});var _n=l({...X.shape,...V(C(a(),N()),"OBJECT").shape});var ea=l({...X.shape,...V(a(),"COLOR").shape});var Pn=L([_e,Ne,yr,Ue,Pe,Ce,un,Ut,cn,Me,Lt,_n,Ft,jt,Mt,ea]),w={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=l({displayName:a(),description:v(a())});var ta=l({username:a(),password:a()}),bn=l({...ze.shape,username:l({displayName:a(),description:v(a())}),password:l({displayName:a(),description:v(a())}),...V(ta,"BASIC_AUTH").shape});var ol=C(a(),L([_e,Ne,Me,Ue,Pe])),In=l({...ze.shape,props:ol,...V(N(),"CUSTOM_AUTH").shape});var nt=l({...ze.shape,...V(l({auth:a()}),"SECRET_TEXT").shape});var il=C(a(),L([_e,Ne,nt,Me,Ue,Pe,Ce,yr])),ra=l({...ze.shape,props:il,...V(N(),"OIDC").shape});var Tn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Tn||{}),na=L([_e,nt,Pe]),oa=C(a(),na),al=l({props:v(C(a(),na)),authUrl:a(),tokenUrl:a(),scope:j(a()),prompt:v(L([O("none"),O("consent"),O("login"),O("omit")])),pkce:v(Y()),pkceMethod:v(L([O("plain"),O("S256")])),authorizationMethod:v(H(Tn)),grantType:v(L([H(Zt),O(pn)])),extra:v(C(a(),a()))}),ia=l({access_token:a(),props:v(oa),data:C(a(),Dt())}),$n=l({...ze.shape,...al.shape,...V(ia,"OAUTH2").shape});var yt=L([bn,In,ra,$n,nt]),Gt="Connection",Jt={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Gt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Gt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Gt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Gt}},None(){}};var gS={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 sl=l({...X.shape,...V(N(),"CUSTOM").shape,code:a()});var ul=L([Pn,yt]),Sn=C(a(),ul),NS=C(a(),Pn);var aa=L([l({strategy:O("CRON"),cronExpression:a()}),l({strategy:O("NONE")})]),ht=class{constructor(t,r,n,o,s,c,p,g,f,h,I,x,u,d,y,m,_,P,F){this.name=t;this.displayName=r;this.description=n;this.requireAuth=o;this.props=s;this.type=c;this.handshakeConfiguration=p;this.onHandshake=g;this.renewConfiguration=f;this.onRenew=h;this.onEnable=I;this.onDisable=x;this.onStart=u;this.run=d;this.test=y;this.sampleData=m;this.testStrategy=_;this.outputSchema=P;this.aiMetadata=F}static{i(this,"ITrigger")}},sa=i(e=>{switch(e.type){case"WEBHOOK":return new ht(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 ht(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 ht(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 ht(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,me(e.sampleData)&&me(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var ua="2",Pr="0.82.0";var En=class{constructor(t,r,n,o,s,c,p,g,f=Pr,h,I=""){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=o;this.categories=p;this.auth=g;this.minimumSupportedRelease=f;this.maximumSupportedRelease=h;this.description=I;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:ua}),"getContextInfo");(!cl(f)||pl(f,Pr))&&(this.minimumSupportedRelease=Pr),s.forEach(x=>this._actions[x.name]=x),c.forEach(x=>this._triggers[x.name]=x)}static{i(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},ca=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,o)=>n===o.findIndex(s=>s.type===r.type)))throw new Error("Auth properties must be unique by type");return new En(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)}i(cl,"isValidSimpleSemver");function pl(e,t){let[r,n,o]=e.split(".").map(Number),[s,c,p]=t.split(".").map(Number);return r!==s?r<s:n!==c?n<c:o<p}i(pl,"isSemverLessThan");var ll=v(C(a(),C(a(),a()))),pa=l({id:v(a()),name:a(),displayName:a(),logoUrl:a(),description:a(),authors:j(a()),platformId:v(a()),directoryPath:v(a()),auth:v(L([yt,j(yt)])),version:a(),categories:v(j(H(mt))),minimumSupportedRelease:v(a()),maximumSupportedRelease:v(a()),i18n:ll}),dl=H(["human","ai","both"]),la=l({description:v(a()),idempotent:v(Y())}),da=l({name:a(),displayName:a(),description:a(),props:Sn,requireAuth:Y(),errorHandlingOptions:v(sn),outputSchema:v(fr()),audience:v(dl),aiMetadata:v(la)}),ma=l({name:a(),displayName:a(),description:a(),props:Sn,errorHandlingOptions:v(sn),type:H(Je),sampleData:N(),handshakeConfiguration:v(fr()),renewConfiguration:v(aa),testStrategy:H(Ht),outputSchema:v(fr()),aiMetadata:v(la)}),ml=l({...pa.shape,actions:C(a(),da),triggers:C(a(),ma)}),fl=l({...pa.shape,actions:ye(),triggers:ye(),suggestedActions:v(j(ma)),suggestedTriggers:v(j(da))}),fa=l({projectUsage:ye(),tags:v(j(a())),pieceType:H(dt),packageType:H(Bt),platformId:v(a()),archiveId:v(a())}),NE=l({...ml.shape,...fa.shape}),CE=l({...fl.shape,...fa.shape}),UE=l({name:a(),version:a()});var gl=Ze(require("path")),yl=Ze(require("fs/promises"));var br=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{i(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,o=new URLSearchParams;return r.searchParams.forEach((s,c)=>{o.append(c,s)}),{urlWithoutQueryParams:n,queryParams:o}}getHeaders(t){let r={Accept:"application/json"};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 Ir=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new An,r=new zn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},An=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},zn=class{static{i(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,o=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${o}`,r}};var Tr=class extends Error{constructor(r,n){let o=n.status||500,s=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:o,body:s},request:{body:r}}));this.requestBody=r;this.status=o,this.responseBody=s}static{i(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var $r=class extends br{static{i(this,"FetchHttpClient")}constructor(t="",r=new Ir){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:o}=this.getUrl(t),s=this.getHeaders(t),c=t.queryParams??{};for(let[F,se]of Object.entries(c))o.append(F,se);let p=o.toString(),g=p?`${n}?${p}`:n,f=t.responseType??"json",h=t.followRedirects??!0,I=t.retries??0,{body:x,extraHeaders:u,isStream:d}=hl(t.body,s),y=xl({...s,...u}),m=await vl(async()=>{let F=new AbortController,se=t.timeout&&t.timeout>0?setTimeout(()=>F.abort(),t.timeout):void 0;try{let ge={method:t.method.toString(),headers:y,body:x,redirect:h?"follow":"manual",signal:F.signal};return d&&(ge.duplex="half"),r?.dispatcher!==void 0&&(ge.dispatcher=r.dispatcher),await fetch(g,ge)}finally{se!==void 0&&clearTimeout(se)}},I),_=h?300:400;if(m.status<200||m.status>=_){let F=await ga(m,f),se=new Tr(t.body,{status:m.status,responseBody:F});throw console.error("[HttpClient#(sanitized error message)] Request failed:",se),se}let P=await ga(m,f);return{status:m.status,headers:_l(m.headers),body:P}}};function hl(e,t){return bl(e)?{body:void 0,extraHeaders:{},isStream:!1}:Pl(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}}i(hl,"serializeBody");async function ga(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}}}}i(ga,"parseResponseBody");async function vl(e,t){let r;for(let n=0;n<=t;n++)try{let o=await e();if(o.status>=500&&n<t){await ya(n);continue}return o}catch(o){if(r=o,n<t){await ya(n);continue}throw o}throw r}i(vl,"sendWithRetries");function ya(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(ya,"backoff");function xl(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]=Array.isArray(n)?n.join(", "):n);return t}i(xl,"normalizeHeaders");function _l(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}i(_l,"toHttpHeaders");function Pl(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}i(Pl,"isNodeFormData");function bl(e){return e==null}i(bl,"isNil");var vt=new $r;var Kt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(Kt||{});var cm=Ze(require("fs")),Pu=Ze(Kn());var pm={"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 lm(e){let t=e.split(";")[0].trim().toLowerCase();return pm[t]??""}i(lm,"contentTypeToExtension");var dm=i(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),mm=i((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function bu({auth:e,baseUrl:t,authMapping:r,description:n,displayName:o,name:s,props:c,extraProps:p,authLocation:g="headers"}){return te({audience:"human",name:s||"custom_api_call",displayName:o||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:w.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:i(async({auth:f})=>({url:w.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
+ i.e ${mm(t,f)}/resource or /resource`,required:!0,defaultValue:f?t(f):"",...c?.url??{}})}),"props")}),method:w.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Kt).map(f=>({label:f,value:f}))},...c?.method??{}}),headers:w.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:w.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:w.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:w.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:i(async({body_type:f})=>{if(!f)return{};let h=f,I={};switch(h){case"none":break;case"json":I.data=w.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":I.data=w.LongText({displayName:"Raw Body",required:!0});break;case"form_data":I.data=w.Array({displayName:"Form Data",required:!0,properties:{fieldName:w.ShortText({displayName:"Field Name",required:!0}),fieldType:w.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:w.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:w.File({displayName:"File Field Value",required:!1})}});break}return I},"props")}),response_is_binary:w.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:w.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:w.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:w.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...p},run:i(async f=>{let{method:h,url:I,headers:x,queryParams:u,body:d,body_type:y,failsafe:m,timeout:_,response_is_binary:P,followRedirects:F}=f.propsValue;vr(h,"Method"),vr(I,"URL");let se=me(r)?{}:await r(f.auth,f.propsValue),ge=I.url,Ee=ge.startsWith("http://")||ge.startsWith("https://")?ge:dm({baseUrl:t(f.auth),relativePath:ge}),Q={method:h,url:Ee,headers:{...x??{},...g==="headers"||!me(g)?se:{}},queryParams:{...g==="queryParams"?se:{},...u??{}},timeout:_?_*1e3:0,followRedirects:F};if(P&&(Q.responseType="arraybuffer"),d)if(y&&y!=="none"){let q=d.data;if(y==="form_data"){let at=q,Ye=new Pu.default;for(let{fieldName:M,fieldType:T,textFieldValue:b,fileFieldValue:S}of at)T==="text"&&!qt(b)?Ye.append(M,b):T==="file"&&!qt(S)&&Ye.append(M,S.data,{filename:S?.filename});Q.body=Ye,Q.headers={...Q.headers,...Ye.getHeaders()}}else Q.body=q}else y||(Q.body=d);try{let q=await vt.sendRequest(Q);return await fm(f.files,q.body,q.status,q.headers,P)}catch(q){if(m)return q.errorMessage();throw q}},"run")})}i(bu,"createCustomApiCallAction");var fm=i(async(e,t,r,n,o)=>{let s;if(o&&gm(t)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],p=lm(c??"")||"txt",g;t instanceof ArrayBuffer?g=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?g=t:g=Buffer.from(t),s=await e.write({fileName:`output.${p}`,data:g})}else s=t;return{status:r,headers:n,body:s}},"handleBinaryResponse"),gm=i(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var er={async poll(e,{store:t,auth:r,propsValue:n,maxItemsToPoll:o,files:s,server:c}){switch(e.strategy){case 0:{let p=await t.get("lastPoll");if(me(p))throw new Error("lastPoll doesn't exist in the store.");let g=await e.items({store:t,auth:r,propsValue:n,lastFetchEpochMS:p,server:c}),f=g.reduce((h,I)=>Math.max(h,I.epochMilliSeconds),p);return await t.put("lastPoll",f),g.filter(h=>h.epochMilliSeconds>p).map(h=>h.data)}case 1:{let p=await t.get("lastItem"),g=await e.items({store:t,auth:r,propsValue:n,lastItemId:p,files:s,server:c}),f=g.findIndex(x=>x.id===p),h=[];me(p)||f==-1?h=g??[]:h=g?.slice(0,f)??[],me(o)||(h=h.slice(-o));let I=h?.[0]?.id;return me(I)||await t.put("lastItem",I),h.map(x=>x.data)}}},async onEnable(e,{store:t,auth:r,propsValue:n,server:o}){switch(e.strategy){case 0:{await t.put("lastPoll",Date.now());break}case 1:{let c=(await e.items({store:t,auth:r,propsValue:n,lastItemId:null,server:o}))?.[0]?.id;me(c)?await t.delete("lastItem"):await t.put("lastItem",c);break}}},async onDisable(e,t){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:t,propsValue:r,store:n,files:o,server:s}){let c=[];switch(e.strategy){case 0:{c=await e.items({store:n,auth:t,propsValue:r,lastFetchEpochMS:0,server:s});break}case 1:{c=await e.items({store:n,auth:t,propsValue:r,lastItemId:null,files:o,server:s});break}}return ym(c.map(p=>p.data))}};function ym(e){return e.length<=5?e:e.slice(0,5)}i(ym,"getFirstFiveOrAll");var Au=Ze(Kn());function Nr(e){return e.trim().replace(/^https?:\/\//i,"").replace(/\/+$/,"")}i(Nr,"normalizeInstanceUrl");function we(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(we,"isRecord");function Tt(e){return typeof e=="string"?e:void 0}i(Tt,"getString");function Le(e,t="",r=0){if(e==null)return t?{[t]:e}:{};if(Array.isArray(e))return t?{[t]:JSON.stringify(e)}:{items:JSON.stringify(e)};if(!we(e))return t?{[t]:e}:{value:e};if(r>=4)return t?{[t]:JSON.stringify(e)}:{};let n={};for(let[o,s]of Object.entries(e)){let c=t?`${t}_${o.replace(/-/g,"_")}`:o.replace(/-/g,"_");Object.assign(n,Le(s,c,r+1))}return n}i(Le,"flattenRecord");function Tu(e){return e.map(t=>Le(t))}i(Tu,"flattenRecords");function hm(e,t){let r=e.supplier,n=e.contract,o={id:e.id??null,supplier_id:Iu(r)??e["supplier-id"]??e.supplier_id??null,supplier_name:vm(r)??e["supplier-name"]??e.supplier_name??null,po_number:null,po_status:null,total_amount:null,contract_id:Iu(n)??e["contract-id"]??e.contract_id??null};return t==="purchase_orders"?(o.po_number=e["po-number"]??e.po_number??e.number??null,o.po_status=e.status??null,o.total_amount=e.total??null):t==="suppliers"?(o.supplier_id=e.id??null,o.supplier_name=e.name??e["display-name"]??e.display_name??null,o.po_status=e.status??null):t==="contracts"&&(o.contract_id=e.id??null,o.po_status=e.status??null,o.total_amount=e.total??e["contract-amount"]??e.contract_amount??null),o}i(hm,"toStandardCoupaFields");function he(e,t){let r=hm(e,t);return{...Le(e),...r}}i(he,"formatCoupaOutput");function Cr(e,t){return e.map(r=>he(r,t))}i(Cr,"formatCoupaOutputs");function Ur(e){if(e==null||e==="")return{};if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(e)}catch{throw new Error("Request Body must be valid JSON.")}return e}i(Ur,"parseJsonBody");function Xn(e){let t=we(e)?e.response:void 0,r,n;if(we(t)){let c=t.status;r=typeof c=="number"?c:void 0,n=t.body}let o=r?` (${r})`:"";if(typeof n=="string")return`Coupa API error${o}: ${n}`;if(n!==null&&typeof n=="object")return`Coupa API error${o}: ${JSON.stringify(n)}`;let s=we(e)&&typeof e.message=="string"?e.message:"Unknown error";return`Coupa API error${o}: ${s}`}i(Xn,"formatCoupaError");function $u(e,t){let r=(t??e.split(".").pop()??"").toLowerCase().replace(/^\./,"");return xm[r]??"application/octet-stream"}i($u,"getMimeType");function Iu(e){if(!we(e))return null;let t=e.id;return typeof t=="number"||typeof t=="string"?t:null}i(Iu,"readNestedId");function vm(e){if(!we(e))return null;let t=e.name;return t==null?null:String(t)}i(vm,"readNestedName");var xm={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",tiff:"image/tiff",csv:"text/csv",txt:"text/plain",html:"text/html",json:"application/json",xml:"application/xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",zip:"application/zip"};var Yn=50,_m=5*60*1e3,J=class{constructor(t){this.auth=t;this.accessToken=null;this.tokenExpiresAt=0;this.tokenPromise=null;let r=Nr(this.auth.instanceUrl);this.baseUrl=`https://${r}/api`,this.tokenUrl=`https://${r}/oauth2/token`}static{i(this,"CoupaClient")}async getAccessToken(){return this.accessToken&&Date.now()<this.tokenExpiresAt?this.accessToken:(this.tokenPromise||(this.tokenPromise=this.fetchAccessToken().finally(()=>{this.tokenPromise=null})),this.tokenPromise)}async fetchAccessToken(){let t=await vt.sendRequest({method:"POST",url:this.tokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.auth.clientId,client_secret:this.auth.clientSecret,grant_type:"client_credentials",scope:this.auth.scope})});return this.accessToken=t.body.access_token,this.tokenExpiresAt=Date.now()+t.body.expires_in*1e3-_m,this.accessToken}async request({method:t,resourceUri:r,query:n,body:o,headers:s}){let c=await this.getAccessToken(),p={};if(n)for(let[h,I]of Object.entries(n))I!=null&&(p[h]=String(I));let g=r.startsWith("/")?r:`/${r}`,f={method:t,url:`${this.baseUrl}${g}`,headers:{Authorization:`Bearer ${c}`,Accept:"application/json","Content-Type":"application/json",...s},queryParams:p,body:o};try{return(await vt.sendRequest(f)).body}catch(h){throw new Error(Xn(h))}}async requestMultipart({resourceUri:t,formData:r}){let n=await this.getAccessToken(),o=t.startsWith("/")?t:`/${t}`;try{return(await vt.sendRequest({method:"POST",url:`${this.baseUrl}${o}`,headers:{Authorization:`Bearer ${n}`,Accept:"application/json",...r.getHeaders()},body:r})).body}catch(s){throw new Error(Xn(s))}}async*paginateRecords(t,r={}){let n=0;for(;;){let o=await this.request({method:"GET",resourceUri:`/${t}`,query:{...r,limit:Yn,offset:n}});if(!Array.isArray(o)||o.length===0||(yield o,o.length<Yn))break;n+=Yn}}async fetchAllRecords(t,r={}){let n=[];for await(let o of this.paginateRecords(t,r))n.push(...o);return n}};var W=Jt.CustomAuth({description:"Connect using an OAuth 2.0 OpenID Connect client with the **Client Credentials** grant. In Coupa, go to **Setup \u2192 Integrations \u2192 OAuth2/OpenID Connect Clients**, create a client, and copy the Client ID and Client Secret. Scopes use the form `core.accounting.read` \u2014 list yours at `https://{your-instance}/oauth2/scopes`.",required:!0,props:{instanceUrl:w.ShortText({displayName:"Coupa Instance URL",description:"Your Coupa hostname only, e.g. `company.coupahost.com` (without `https://`).",required:!0}),clientId:Jt.SecretText({displayName:"Client ID",required:!0}),clientSecret:Jt.SecretText({displayName:"Client Secret",required:!0}),scope:w.LongText({displayName:"OAuth Scopes",description:"Space-separated scopes granted to your OIDC client, e.g. `core.purchase_order.read core.purchase_order.write`.",required:!0,defaultValue:"core.common.read core.common.write"})},validate:i(async({auth:e})=>{try{return await new J({instanceUrl:e.instanceUrl,clientId:e.clientId,clientSecret:e.clientSecret,scope:e.scope}).getAccessToken(),{valid:!0}}catch{return{valid:!1,error:"Could not authenticate with Coupa. Check the instance URL, Client ID/Secret, and that the OIDC client uses the Client Credentials grant."}}},"validate")});var Pm=[{label:"Purchase Orders",value:"purchase_orders"},{label:"Suppliers",value:"suppliers"},{label:"Contracts",value:"contracts"},{label:"Custom resource (type below)",value:"__custom__"}],Oe=w.StaticDropdown({displayName:"Module",description:'Coupa module to work with: Purchase Orders, Suppliers, or Contracts. Pick "Custom resource" to target any other endpoint.',required:!0,options:{disabled:!1,options:Pm}}),ke=w.ShortText({displayName:"Custom Resource Path",description:"API resource segment when Module is **Custom resource**, e.g. `invoices` or `approvals`.",required:!1}),Qn=w.Number({displayName:"Object ID",description:"Numeric Coupa ID of the record.",required:!0}),Mr=w.Json({displayName:"Request Body (JSON)",description:"JSON payload sent to Coupa, using Coupa field names in kebab-case (e.g. `po-number`, `supplier-id`). See the examples above for each module.",required:!0}),jr=w.MarkDown({value:'**How to build the request body** \u2014 Coupa uses field names in **kebab-case**. Reference an existing record (like a supplier) by its numeric ID. Examples per module:\n\n**Purchase Orders**\n```json\n{ "po-number": "PO-1001", "supplier": { "id": 123 }, "order-lines": [{ "description": "Laptop", "quantity": 2, "price": 1500 }] }\n```\n\n**Suppliers**\n```json\n{ "name": "Acme Corp", "display-name": "Acme", "status": "active" }\n```\n\n**Contracts**\n```json\n{ "name": "Acme MSA 2025", "supplier": { "id": 123 }, "start-date": "2025-01-01", "end-date": "2025-12-31" }\n```'}),Lr=w.Json({displayName:"Query Parameters (JSON)",description:'Optional query filters, e.g. `{ "status[in]": "issued,closed", "exported": false }`.',required:!1}),Fe=w.Dropdown({displayName:"Purchase Order",description:"Select a purchase order from your Coupa instance (most recent 50).",required:!0,refreshers:[],auth:W,options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Connect your Coupa account first"};try{let r=await new J(e.props).request({method:"GET",resourceUri:"/purchase_orders",query:{limit:50,fields:'["id","po-number","number","status","total","supplier"]'}}),n=Array.isArray(r)?r:[];return n.length===0?{disabled:!1,options:[],placeholder:"No purchase orders found in your instance."}:{disabled:!1,options:n.map(o=>{let s=o["po-number"]??o.number??o.id,c=o.status??"unknown";return{label:`${s} \u2014 ${c} (#${o.id})`,value:String(o.id)}})}}catch{return{disabled:!0,options:[],placeholder:"Failed to load purchase orders. Check your connection and scopes."}}},"options")}),eo=w.Dropdown({displayName:"Contract",description:"Select a contract from your Coupa instance (most recent 50).",required:!0,refreshers:[],auth:W,options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Connect your Coupa account first"};try{let r=await new J(e.props).request({method:"GET",resourceUri:"/contracts",query:{limit:50,fields:'["id","name","number","status","supplier"]'}}),n=Array.isArray(r)?r:[];return n.length===0?{disabled:!1,options:[],placeholder:"No contracts found in your instance."}:{disabled:!1,options:n.map(o=>({label:`${o.name??o.number??"Contract"} (#${o.id})`,value:String(o.id)}))}}catch{return{disabled:!0,options:[],placeholder:"Failed to load contracts. Check your connection and scopes."}}},"options")}),it=w.Dropdown({displayName:"Supplier",description:"Select a supplier from your Coupa instance (most recent 50).",required:!0,refreshers:[],auth:W,options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Connect your Coupa account first"};try{let r=await new J(e.props).request({method:"GET",resourceUri:"/suppliers",query:{limit:50,fields:'["id","name","number","status"]'}}),n=Array.isArray(r)?r:[];return n.length===0?{disabled:!1,options:[],placeholder:"No suppliers found in your instance."}:{disabled:!1,options:n.map(o=>({label:`${o.name??"Supplier"} (#${o.id})`,value:String(o.id)}))}}catch{return{disabled:!0,options:[],placeholder:"Failed to load suppliers. Check your connection and scopes."}}},"options")}),Fr=w.Dropdown({displayName:"Approval",description:"Select a pending approval awaiting a decision. Shows the most recent 50 pending approvals.",required:!0,refreshers:[],auth:W,options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Connect your Coupa account first"};try{let r=await new J(e.props).request({method:"GET",resourceUri:"/approvals",query:{"status[in]":"pending_approval",limit:50,fields:'["id","status","approvable-type","approvable-id","position"]'}}),n=Array.isArray(r)?r:[];return n.length===0?{disabled:!1,options:[],placeholder:"No pending approvals found."}:{disabled:!1,options:n.map(o=>{let s=o["approvable-type"]??"Record",c=o["approvable-id"]??o.id;return{label:`${s} #${c} (approval #${o.id})`,value:String(o.id)}})}}catch{return{disabled:!0,options:[],placeholder:"Failed to load approvals. Check your connection and scopes."}}},"options")}),Br=w.DynamicProperties({displayName:"Record",description:"Pick the record by name. For a custom resource, enter its numeric ID.",required:!0,refreshers:["module"],auth:W,props:i(async({module:e})=>e==="purchase_orders"?{objectId:Fe}:e==="suppliers"?{objectId:it}:e==="contracts"?{objectId:eo}:{objectId:Qn},"props")}),Su=w.StaticDropdown({displayName:"Module",description:"The type of record to attach the file to.",required:!0,options:{disabled:!1,options:[{label:"Purchase Order",value:"purchase_orders"},{label:"Supplier",value:"suppliers"},{label:"Contract",value:"contracts"}]}}),Eu=w.StaticDropdown({displayName:"Parent Module",description:"Where to look up remit-to addresses from: a Supplier directly, or the supplier linked to a Purchase Order.",required:!0,options:{disabled:!1,options:[{label:"Supplier",value:"suppliers"},{label:"Purchase Order",value:"purchase_orders"}]}});function Re(e,t){if(e==="__custom__"){if(!t?.trim())throw new Error("Custom Resource Path is required when using a custom module.");return t.trim().replace(/^\/+/,"").replace(/\/+$/,"")}if(!e)throw new Error("Module is required.");return e}i(Re,"resolveModuleResource");function Te(e){if(e==="purchase_orders"||e==="suppliers"||e==="contracts")return e;throw new Error("Standard fields are only mapped for Purchase Orders, Suppliers, and Contracts modules.")}i(Te,"toCoupaModule");function $t(e){if(!e)return{};let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{throw new Error("Query Parameters must be valid JSON.")}if(!we(t))return{};let r={};for(let[n,o]of Object.entries(t))o!=null&&(r[n]=typeof o=="string"||typeof o=="number"||typeof o=="boolean"?o:String(o));return r}i($t,"parseOptionalQuery");var zu=te({auth:W,name:"add_file_attachment_to_object",displayName:"Add File Attachment to Object",description:"Adds an attachment (an uploaded file or a link) to a Purchase Order, Supplier, or Contract in Coupa.",audience:"both",aiMetadata:{description:"Attach a file or a URL link to an existing Coupa purchase order, supplier, or contract record. Pick the mode via attachmentSource: upload a file directly, or link a URL instead. Not idempotent \u2014 each run appends a new attachment to the record, so retries create duplicates.",idempotent:!1},props:{module:Su,parentRecord:w.DynamicProperties({displayName:"Record",description:"The record to attach to. Pick it by name after choosing a module.",required:!0,refreshers:["module"],auth:W,props:i(async({module:e})=>e==="purchase_orders"?{recordId:Fe}:e==="suppliers"?{recordId:it}:e==="contracts"?{recordId:eo}:{recordId:w.ShortText({displayName:"Record ID",description:"Select a module first.",required:!0})},"props")}),attachmentSource:w.StaticDropdown({displayName:"Attachment Type",description:"Choose whether to upload a file directly or attach a link (URL).",required:!0,defaultValue:"file",options:{disabled:!1,options:[{label:"Upload a file",value:"file"},{label:"Link a URL",value:"url"}]}}),attachment:w.DynamicProperties({displayName:"Attachment",description:"The file to upload or the URL to link.",required:!0,refreshers:["attachmentSource"],auth:W,props:i(async({attachmentSource:e})=>e==="url"?{url:w.ShortText({displayName:"URL",description:"The full link to attach (e.g. https://example.com/spec.pdf).",required:!0})}:{file:w.File({displayName:"File",description:"The file to upload to the record.",required:!0})},"props")}),intent:w.ShortText({displayName:"Intent",description:"Optional Coupa attachment intent that controls who can see the attachment (e.g. `Supplier`). Leave empty to use the Coupa default.",required:!1})},async run({auth:e,propsValue:t}){let r=new J(e.props),n=Te(t.module),o=t.parentRecord.recordId,s=t.attachmentSource,c=t.attachment,p=new Au.default;if(s==="url")p.append("attachment[url]",Tt(c.url)??""),p.append("attachment[type]","url");else{let f=c.file;if(!f)throw new Error('A file is required when the attachment type is "Upload a file".');p.append("attachment[file]",f.data,{filename:f.filename,contentType:$u(f.filename,f.extension)}),p.append("attachment[type]","file")}t.intent&&p.append("attachment[intent]",t.intent);let g=await r.requestMultipart({resourceUri:`/${n}/${o}/attachments`,formData:p});return he(g,n)}});var wu=te({auth:W,name:"cancel_purchase_order",displayName:"Cancel Purchase Order",description:"Cancels a purchase order using `PUT /api/purchase_orders/:id/cancel`.",audience:"both",aiMetadata:{description:"Cancel an existing Coupa purchase order by ID, voiding it rather than completing it \u2014 use Close Purchase Order to finalize a fulfilled order instead. This is an irreversible workflow transition and not idempotent: re-running against an already-cancelled order may fail.",idempotent:!1},props:{purchaseOrderId:Fe},async run({auth:e,propsValue:t}){let n=await new J(e.props).request({method:"PUT",resourceUri:`/purchase_orders/${t.purchaseOrderId}/cancel`});return he(n,"purchase_orders")}});var Ou=te({auth:W,name:"close_purchase_order",displayName:"Close Purchase Order",description:"Closes a purchase order using `PUT /api/purchase_orders/:id/close`.",audience:"both",aiMetadata:{description:"Close an existing Coupa purchase order by ID, marking it complete so no further receiving or invoicing occurs \u2014 use Cancel Purchase Order to void an order instead. Not idempotent: closing is a one-way workflow transition and re-running on an already-closed order may fail.",idempotent:!1},props:{purchaseOrderId:Fe},async run({auth:e,propsValue:t}){let n=await new J(e.props).request({method:"PUT",resourceUri:`/purchase_orders/${t.purchaseOrderId}/close`});return he(n,"purchase_orders")}});var ku=te({auth:W,name:"create_object",displayName:"Create Object",description:"Creates a record in the selected Coupa module (Purchase Orders, Suppliers, or Contracts).",audience:"both",aiMetadata:{description:"Create a new record in a Coupa module \u2014 purchase orders, suppliers, contracts, or any other resource via the custom-module option \u2014 from a raw JSON body matching the Coupa API schema. Not idempotent: each run POSTs a new record, so retries create duplicates. Use Update Object to modify an existing record instead.",idempotent:!1},props:{module:Oe,customResource:ke,bodyHelp:jr,body:Mr},async run({auth:e,propsValue:t}){let r=new J(e.props),n=Re(t.module,t.customResource),o=Ur(t.body),s=await r.request({method:"POST",resourceUri:`/${n}`,body:o});return t.module!=="__custom__"?he(s,Te(t.module)):s}});var Ru=te({auth:W,name:"get_object_by_id",displayName:"Get Object by ID",description:"Retrieves a single record by ID from Purchase Orders, Suppliers, or Contracts.",audience:"both",aiMetadata:{description:"Fetch one Coupa record by its ID from purchase orders, suppliers, contracts, or any other resource via the custom-module option, with optional query parameters such as a fields filter. Use this when you already know the record ID; use Search Objects to find records by criteria. Read-only and idempotent.",idempotent:!0},props:{module:Oe,customResource:ke,record:Br,queryParams:Lr},async run({auth:e,propsValue:t}){let r=new J(e.props),n=Re(t.module,t.customResource),o=t.record.objectId,s=await r.request({method:"GET",resourceUri:`/${n}/${o}`,query:$t(t.queryParams)});return t.module!=="__custom__"?he(s,Te(t.module)):s}});var Du=te({auth:W,name:"get_remit_to_addresses_by_object_id",displayName:"Get Remit-To Addresses by Object ID",description:"Lists remit-to addresses for a Supplier or resolves the supplier from a Purchase Order.",audience:"both",aiMetadata:{description:"List the remit-to (payment) addresses on file for a Coupa supplier. Works in two modes: pass a supplier ID directly, or pass a purchase order ID and it resolves the linked supplier first (failing if the order has no supplier). Read-only and idempotent.",idempotent:!0},props:{parentModule:Eu,parentRecord:w.DynamicProperties({displayName:"Record",required:!0,refreshers:["parentModule"],auth:W,props:i(async({parentModule:e})=>e==="suppliers"?{recordId:it}:e==="purchase_orders"?{recordId:Fe}:{recordId:w.ShortText({displayName:"Record ID",description:"Select a parent module first.",required:!0})},"props")})},async run({auth:e,propsValue:t}){let r=new J(e.props),n=t.parentRecord.recordId,o;if(t.parentModule==="suppliers")o=`/suppliers/${n}/addresses`;else{let g=await r.request({method:"GET",resourceUri:`/purchase_orders/${n}`,query:{fields:'["id","supplier"]'}}),f=g.supplier,h=(we(f)?f.id:void 0)??g["supplier-id"];if(!h)throw new Error("Purchase order has no linked supplier.");o=`/suppliers/${h}/addresses`}let s=await r.request({method:"GET",resourceUri:o}),c=Array.isArray(s)?s:[s],p=Tu(c);return{total_count:p.length,addresses:p}}});var Nu=te({auth:W,name:"get_supplier_sites_by_supplier",displayName:"Get Supplier Sites by Supplier",description:"Lists supplier sites for a supplier (`GET /api/suppliers/:id/supplier_sites`).",audience:"both",aiMetadata:{description:"List all supplier sites (locations/storefronts) configured under a given Coupa supplier ID. Use this to enumerate a supplier's sites; use Get Remit-To Addresses for payment addresses instead. Read-only and idempotent.",idempotent:!0},props:{supplierId:it},async run({auth:e,propsValue:t}){let n=await new J(e.props).request({method:"GET",resourceUri:`/suppliers/${t.supplierId}/supplier_sites`}),o=Array.isArray(n)?n:[n],s=Cr(o,"suppliers");return{total_count:s.length,supplier_sites:s}}});var Cu=te({auth:W,name:"grant_approval",displayName:"Grant Approval",description:"Approves a pending approval in Coupa (e.g. a requisition or purchase order awaiting your decision). Pick the approval from the dropdown.",audience:"both",aiMetadata:{description:"Approve a pending Coupa approval (e.g. a requisition or purchase order awaiting decision) by its approval ID, advancing the document through its approval chain. Use Reject Approval to decline instead. Not idempotent: the approval must be in a pending state, and re-running after it is decided may fail.",idempotent:!1},props:{approvalId:Fr},async run({auth:e,propsValue:t}){let n=await new J(e.props).request({method:"PUT",resourceUri:`/approvals/${t.approvalId}/approve`});return Le(n)}});var Uu=te({auth:W,name:"reject_approval",displayName:"Reject Approval",description:"Rejects a pending approval in Coupa (e.g. a requisition or purchase order awaiting your decision). Pick the approval from the dropdown.",audience:"both",aiMetadata:{description:"Reject a pending Coupa approval (e.g. a requisition or purchase order awaiting decision) by its approval ID, optionally recording a rejection reason. Use Grant Approval to approve instead. Not idempotent: the approval must be in a pending state, and re-running after it is decided may fail.",idempotent:!1},props:{approvalId:Fr,reason:w.LongText({displayName:"Rejection Reason",description:"Optional note explaining why the approval was rejected.",required:!1})},async run({auth:e,propsValue:t}){let r=new J(e.props),n={};t.reason&&(n.reason=t.reason);let o=await r.request({method:"PUT",resourceUri:`/approvals/${t.approvalId}/reject`,query:n});return Le(o)}});var Mu=te({auth:W,name:"search_objects",displayName:"Search Objects (Batch)",description:"Searches records in a Coupa module with pagination (50 per page) and returns standardized fields.",audience:"both",aiMetadata:{description:"Search and list records in a Coupa module \u2014 purchase orders, suppliers, contracts, or any other resource via the custom-module option \u2014 using optional Coupa query parameters as filters, auto-paginating through all matching pages. Use this to find records by criteria; use Get Object by ID when you already have an ID. Read-only and idempotent, but unfiltered searches on large modules can be slow.",idempotent:!0},props:{module:Oe,customResource:ke,queryParams:Lr},async run({auth:e,propsValue:t}){let r=new J(e.props),n=Re(t.module,t.customResource),o=$t(t.queryParams),s=await r.fetchAllRecords(n,o);if(t.module!=="__custom__"){let c=Te(t.module),p=Cr(s,c);return{total_count:p.length,records:p}}return{total_count:s.length,records:s}}});var ju=te({auth:W,name:"set_integration_run_status",displayName:"Set Integration Run Status",description:"Updates an integration run status (`run`, `success`, `fail`, `pause`, or `pending`).",audience:"both",aiMetadata:{description:"Set the status of a Coupa integration run by ID to one of: run, success, fail, pause, or pending \u2014 used to report progress of an external integration job back to Coupa. Not idempotent: each call is a status transition, and Coupa may reject transitions that are invalid from the run's current state.",idempotent:!1},props:{integrationRunId:Qn,status:w.StaticDropdown({displayName:"Status",required:!0,options:{disabled:!1,options:[{label:"Running",value:"run"},{label:"Successful",value:"success"},{label:"Failed",value:"fail"},{label:"Paused",value:"pause"},{label:"Pending",value:"pending"}]}})},async run({auth:e,propsValue:t}){let n=await new J(e.props).request({method:"PUT",resourceUri:`/integration_runs/${t.integrationRunId}/${t.status}`});return Le(n)}});var Lu=te({auth:W,name:"update_object",displayName:"Update Object",description:"Updates a record by ID in the selected Coupa module (Purchase Orders, Suppliers, or Contracts).",audience:"both",aiMetadata:{description:"Update an existing Coupa record by ID \u2014 in purchase orders, suppliers, contracts, or any other resource via the custom-module option \u2014 by PUTting a raw JSON body of the fields to change. Requires a known record ID; use Create Object for new records. Effectively idempotent: re-sending the same body to the same ID yields the same record state.",idempotent:!0},props:{module:Oe,customResource:ke,record:Br,bodyHelp:jr,body:Mr},async run({auth:e,propsValue:t}){let r=new J(e.props),n=Re(t.module,t.customResource),o=t.record.objectId,s=Ur(t.body),c=await r.request({method:"PUT",resourceUri:`/${n}/${o}`,body:s});return t.module!=="__custom__"?he(c,Te(t.module)):c}});var Vr=Ze(Fu());var bm='["id","po-number","number","status","total","supplier","contract","name","updated-at"]',Zr={strategy:0,items:i(async({auth:e,propsValue:t,lastFetchEpochMS:r})=>{let n=new J(e.props),o=Re(t.module,t.customResource),s=r===0,p={"updated-at[gt]":s?(0,Vr.default)().subtract(7,"day").format("YYYY-MM-DDTHH:mm:ss"):(0,Vr.default)(r).format("YYYY-MM-DDTHH:mm:ss"),fields:bm,...$t(t.additionalFilters)},g=s?await n.request({method:"GET",resourceUri:`/${o}`,query:{...p,limit:10}}):await n.fetchAllRecords(o,p),f=Array.isArray(g)?g:[],h=t.module,I=h&&h!=="__custom__"?Te(h):null;return f.map(x=>{let u=Tt(x["updated-at"])??Tt(x.updated_at)??Tt(x["created-at"])??new Date().toISOString(),d=I!==null?he(x,I):x;return{epochMilliSeconds:(0,Vr.default)(u).valueOf(),data:d}})},"items")},Bu=sa({auth:W,name:"new_or_updated_object",displayName:"New or Updated Object",description:"Triggers when a Purchase Order, Supplier, or Contract is created or updated in Coupa.",aiMetadata:{description:"Fires when an object in the selected Coupa module (Purchase Order, Supplier, Contract, or a custom resource) is created or updated, polling on the updated-at timestamp. Each event carries the changed record with standard fields like id, number, status, total, supplier, and updated-at; optional JSON query filters can narrow which records are emitted."},props:{module:Oe,customResource:ke,additionalFilters:w.Json({displayName:"Additional Filters (JSON)",description:'Optional Coupa query filters, e.g. `{ "status[in]": "issued,closed" }`.',required:!1})},sampleData:{id:12345,supplier_id:501,supplier_name:"Acme Corp",po_number:"PO-12345",po_status:"issued",total_amount:1500,contract_id:9001,updated_at:"2025-06-01T12:00:00Z"},type:"POLLING",async test(e){return er.test(Zr,e)},async onEnable(e){await er.onEnable(Zr,e)},async onDisable(e){await er.onDisable(Zr,e)},async run(e){return er.poll(Zr,e)}});var Im=ca({displayName:"Coupa",description:"Business spend management \u2014 automate procurement, approvals, purchase orders, and ERP integrations with the Coupa Core API.",minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/coupa.png",categories:["ACCOUNTING"],authors:["maurivan"],auth:W,actions:[ku,Lu,Ru,Mu,wu,Ou,zu,Du,Nu,Cu,Uu,ju,bu({auth:W,name:"custom_action",displayName:"Custom Action",description:"Make a custom API call to any Coupa endpoint (Purchase Orders, Suppliers, Contracts, or other resources).",baseUrl:i(e=>e?`https://${Nr(e.props.instanceUrl)}/api`:"","baseUrl"),authMapping:i(async e=>({Authorization:`Bearer ${await new J({instanceUrl:e.props.instanceUrl,clientId:e.props.clientId,clientSecret:e.props.clientSecret,scope:e.props.scope}).getAccessToken()}`,Accept:"application/json"}),"authMapping")})],triggers:[Bu]});0&&(module.exports={coupa});
4
+ /*! Bundled license information:
5
+
6
+ mime-types/index.js:
7
+ (*!
8
+ * mime-types
9
+ * Copyright(c) 2014 Jonathan Ong
10
+ * Copyright(c) 2015 Douglas Christopher Wilson
11
+ * MIT Licensed
12
+ *)
13
+ */
package/src/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export declare const coupa: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
6
- }>>;
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,KAAK;;;;;GAmDhB,CAAC"}
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAA6D;AAC7D,iDAAqD;AACrD,2EAAsE;AACtE,+EAA0E;AAC1E,6EAAwE;AACxE,+DAA2D;AAC3D,qEAA+D;AAC/D,iFAA2E;AAC3E,yEAAoE;AACpE,iEAA6D;AAC7D,mEAA+D;AAC/D,iEAA6D;AAC7D,yFAAmF;AACnF,+DAA2D;AAC3D,qCAAuC;AACvC,gDAAkD;AAClD,8CAA0D;AAC1D,gFAA0E;AAE7D,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,6HAA6H;IAC/H,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,UAAU,EAAE,CAAC,sBAAa,CAAC,UAAU,CAAC;IACtC,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,IAAI,EAAE,gBAAS;IACf,OAAO,EAAE;QACP,4BAAY;QACZ,4BAAY;QACZ,gCAAa;QACb,8BAAa;QACb,2CAAmB;QACnB,yCAAkB;QAClB,uCAAiB;QACjB,4CAAmB;QACnB,qCAAgB;QAChB,8BAAa;QACb,gCAAc;QACd,oDAAuB;QACvB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,gBAAS;YACf,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,2GAA2G;YAC7G,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO,EAAE,CAAC;gBACZ,CAAC;gBACD,MAAM,IAAI,GAAG,IAAA,4BAAoB,EAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAC1D,OAAO,WAAW,IAAI,MAAM,CAAC;YAC/B,CAAC;YACD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;oBAC7B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;oBACnC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;oBAC7B,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;iBACxB,CAAC,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC5C,OAAO;oBACL,aAAa,EAAE,UAAU,KAAK,EAAE;oBAChC,MAAM,EAAE,kBAAkB;iBAC3B,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,0CAAkB,CAAC;CAC/B,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- export declare const addFileAttachment: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
- clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
6
- }>, {
7
- module: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
- parentRecord: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
- instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
- clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
- clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
12
- scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
13
- }>>;
14
- attachmentSource: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
15
- attachment: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
16
- instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
- clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
18
- clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
19
- scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
20
- }>>;
21
- intent: import("@activepieces/pieces-framework").ShortTextProperty<false>;
22
- }>;
23
- //# sourceMappingURL=add-file-attachment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-file-attachment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-file-attachment.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAqH5B,CAAC"}