apify-client 3.0.0-beta.19 → 3.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! LICENSE: bundle.js.LICENSE.txt */
2
- var e,t,r={313(e,t,r){var n=r(606);let i=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,o=()=>{let e={enabled:void 0!==n&&"0"!==n.env.FORCE_COLOR,visible:!0,styles:{},keys:{}},t=(e,t,r)=>"function"==typeof e?e(t):e.wrap(t,r),o=(r,n)=>{if(""===r||null==r)return"";if(!1===e.enabled)return r;if(!1===e.visible)return"";let i=""+r,o=i.includes("\n"),a=n.length;for(a>0&&n.includes("unstyle")&&(n=[...new Set(["unstyle",...n])].reverse());a-- >0;)i=t(e.styles[n[a]],i,o);return i},a=(t,r,n)=>{var i;let a,s,l;e.styles[t]=(a=(i={name:t,codes:r}).open=`\u001b[${i.codes[0]}m`,s=i.close=`\u001b[${i.codes[1]}m`,l=i.regex=RegExp(`\\u001b\\[${i.codes[1]}m`,"g"),i.wrap=(e,t)=>{e.includes(s)&&(e=e.replace(l,s+a));let r=a+e+s;return t?r.replace(/\r*\n/g,`${s}$&${a}`):r},i),(e.keys[n]||(e.keys[n]=[])).push(t),Reflect.defineProperty(e,t,{configurable:!0,enumerable:!0,set(r){e.alias(t,r)},get(){let r=e=>o(e,r.stack);return Reflect.setPrototypeOf(r,e),r.stack=this.stack?this.stack.concat(t):[t],r}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=i,e.hasColor=e.hasAnsi=t=>(e.ansiRegex.lastIndex=0,"string"==typeof t&&""!==t&&e.ansiRegex.test(t)),e.alias=(t,r)=>{let n="string"==typeof r?e[r]:r;if("function"!=typeof n)throw TypeError("Expected alias to be the name of an existing color (string) or a function");n.stack||(Reflect.defineProperty(n,"name",{value:t}),e.styles[t]=n,n.stack=[t]),Reflect.defineProperty(e,t,{configurable:!0,enumerable:!0,set(r){e.alias(t,r)},get(){let t=e=>o(e,t.stack);return Reflect.setPrototypeOf(t,e),t.stack=this.stack?this.stack.concat(n.stack):n.stack,t}})},e.theme=t=>{if(!(null!==t&&"object"==typeof t&&!Array.isArray(t)))throw TypeError("Expected theme to be an object");for(let r of Object.keys(t))e.alias(r,t[r]);return e},e.alias("unstyle",t=>"string"==typeof t&&""!==t?(e.ansiRegex.lastIndex=0,t.replace(e.ansiRegex,"")):""),e.alias("noop",e=>e),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=r(904),e.define=a,e};e.exports=o(),e.exports.create=o},904(e,t,r){var n=r(606);let i=void 0!==n&&"Hyper"===n.env.TERM_PROGRAM,o=void 0!==n&&"win32"===n.platform,a=void 0!==n&&"linux"===n.platform,s={ballotDisabled:"☒",ballotOff:"☐",ballotOn:"☑",bullet:"•",bulletWhite:"◦",fullBlock:"█",heart:"❤",identicalTo:"≡",line:"─",mark:"※",middot:"·",minus:"-",multiplication:"×",obelus:"÷",pencilDownRight:"✎",pencilRight:"✏",pencilUpRight:"✐",percent:"%",pilcrow2:"❡",pilcrow:"¶",plusMinus:"±",question:"?",section:"§",starsOff:"☆",starsOn:"★",upDownArrow:"↕"},l=Object.assign({},s,{check:"√",cross:"×",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"»",radioOff:"( )",radioOn:"(*)",warning:"‼"}),u=Object.assign({},s,{ballotCross:"✘",check:"✔",cross:"✖",ellipsisLarge:"⋯",ellipsis:"…",info:"ℹ",questionFull:"?",questionSmall:"﹖",pointer:a?"▸":"❯",pointerSmall:a?"‣":"›",radioOff:"◯",radioOn:"◉",warning:"⚠"});e.exports=o&&!i?l:u,Reflect.defineProperty(e.exports,"common",{enumerable:!1,value:s}),Reflect.defineProperty(e.exports,"windows",{enumerable:!1,value:l}),Reflect.defineProperty(e.exports,"other",{enumerable:!1,value:u})},336(e,t,r){var n=r(617);e.exports=function(e,t){return new Promise(function(r,i){var o,a=t||{};function s(e){i(e||Error("Aborted"))}function l(e,t){e.bail?s(e):o.retry(e)?a.onRetry&&a.onRetry(e,t):i(o.mainError())}"randomize"in a||(a.randomize=!0),(o=n.operation(a)).attempt(function(t){var n;try{n=e(s,t)}catch(e){l(e,t);return}Promise.resolve(n).then(r).catch(function(e){l(e,t)})})})}},526(e,t){t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=l(e),a=o[0],s=o[1],u=new i((a+s)*3/4-s),c=0,p=s>0?a-4:a;for(r=0;r<p;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(function(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,a,a+16383>s?s:a+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a<s;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},287(e,t,r){var n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|h(n,i),l=a(o),u=l.write(n,i);return u!==o&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e)){var c=e;if(x(c,Uint8Array)){var m=new Uint8Array(c);return d(m.buffer,m.byteOffset,m.byteLength)}return p(c)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var g=e.valueOf&&e.valueOf();if(null!=g&&g!==e)return s.from(g,t,r);var y=function(e){if(s.isBuffer(e)){var t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(y)return y;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|f(e))}function p(e){for(var t=e.length<0?0:0|f(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}function f(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,o,a,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=k[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,a=r,0===o&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var p=!0,d=0;d<l;d++)if(u(e,o+d)!==u(t,d)){p=!1;break}if(p)return o}return -1}function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,p=u>239?4:u>223?3:u>191?2:1;if(i+p<=r)switch(p){case 1:u<128&&(c=u);break;case 2:(192&(o=e[i+1]))==128&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],(192&o)==128&&(192&a)==128&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],(192&o)==128&&(192&a)==128&&(192&s)==128&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=p}var d=n,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var h="",m=0;m<f;)h+=String.fromCharCode.apply(String,d.slice(m,m+=4096));return h}function _(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,o){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function E(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function S(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(x(o,Uint8Array))i+o.length>n.length?s.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(s.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):m.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(s.prototype[o]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,a=r-t,l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),p=0;p<l;++p)if(u[p]!==c[p]){o=u[p],a=c[p];break}return o<a?-1:+(a<o)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,a,s,l,u,c,p,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s,l=parseInt(t.substr(2*a,2),16);if((s=l)!=s)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,A(T(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return a=t,s=r,A(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,a,s);case"base64":return l=t,u=r,A(C(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,p=r,A(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,p);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var o=1,a=0;for(this[t]=255&e;++a<r&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var o=r-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return S(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return S(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var O=/[^+/0-9A-Za-z-_]/g;function T(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function A(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var k=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},597(e,t){var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function o(e){this.parameters=Object.create(null),this.type=e}t.q=function(e){if(!e)throw TypeError("argument string is required");var t,a,s,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),c=-1!==u?l.slice(0,u).trim():l.trim();if(!i.test(c))throw TypeError("invalid media type");var p=new o(c.toLowerCase());if(-1!==u){for(r.lastIndex=u;a=r.exec(l);){if(a.index!==u)throw TypeError("invalid parameter format");u+=a[0].length,t=a[1].toLowerCase(),34===(s=a[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(n,"$1")),p.parameters[t]=s}if(u!==l.length)throw TypeError("invalid parameter format")}return p}},7(e){var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(r,n){var i,o,a;function s(r){e.removeListener(t,l),n(r)}function l(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}m(e,t,l,{once:!0}),"error"!==t&&(i=e,o=s,a={once:!0},"function"==typeof i.on&&m(i,"error",o,a))})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var i,o,a,u=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):h(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(o){n.once&&e.removeEventListener(t,i),r(o)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var a,s=Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else for(var u=l.length,c=h(l,u),r=0;r<u;++r)n(c[r],this,t);return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,p(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,p(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events)||void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},251(e,t){t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,d=r?-1:1,f=e[t+p];for(p+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+p],p+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+p],p+=d,c-=8);if(0===o)o=1-u;else{if(o===l)return a?0/0:(f?-1:1)*2e308;a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,p=c>>1,d=5960464477539062e-23*(23===i),f=n?0:o-1,h=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||1/0===t?(s=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?t+=d/l:t+=d*Math.pow(2,1-p),t*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(t*l-1)*Math.pow(2,i),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=h,a/=256,u-=8);e[r+f-h]|=128*m}},698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},606(e){var t,r,n,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var l=[],u=!1,c=-1;function p(){u&&n&&(u=!1,n.length?l=n.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(n=l,l=[];++c<t;)n&&n[c].run();c=-1,t=l.length}n=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}},617(e,t,r){e.exports=r(303)},303(e,t,r){var n=r(961);t.operation=function(e){return new n(t.timeouts(e),{forever:e&&(e.forever||1/0===e.retries),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<t.retries;i++)n.push(this.createTimeout(i,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(i,t)),n.sort(function(e,t){return e-t}),n},t.createTimeout=function(e,t){var r=Math.round((t.randomize?Math.random()+1:1)*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return Math.min(r,t.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var i in n=[],e)"function"==typeof e[i]&&n.push(i);for(var o=0;o<n.length;o++){var a=n[o],s=e[a];e[a]=(function(n){var i=t.operation(r),o=Array.prototype.slice.call(arguments,1),a=o.pop();o.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),a.apply(this,arguments))}),i.attempt(function(){n.apply(e,o)})}).bind(e,s),e[a].options=r}}},961(e){function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r)if(!this._cachedTimeouts)return!1;else this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],o=i.message,a=(e[o]||0)+1;e[o]=a,a>=r&&(t=i,r=a)}return t}},861(e,t,r){var n=r(287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},310(e,t,r){e.exports=i;var n=r(7).EventEmitter;function i(){n.call(this)}r(698)(i,n),i.Readable=r(891),i.Writable=r(999),i.Duplex=r(101),i.Transform=r(83),i.PassThrough=r(681),i.finished=r(257),i.pipeline=r(267),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",l));var a=!1;function s(){a||(a=!0,e.end())}function l(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",l),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",u),e.on("error",u),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},463(e){var t={};function r(e,r,n){n||(n=Error);var i=function(e){function t(t,n,i){return e.call(this,"string"==typeof r?r:r(t,n,i))||this}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e,t}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(!Array.isArray(e))return"of ".concat(t," ").concat(String(e));var r=e.length;return(e=e.map(function(e){return String(e)}),r>2)?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}r("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,r){if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(l="must not be",t=t.replace(/^not /,"")):l="must be",o=" argument",(void 0===a||a>e.length)&&(a=e.length),e.substring(a-o.length,a)===o)u="The ".concat(e," ").concat(l," ").concat(n(t,"type"));else{var i,o,a,s,l,u,c=("number"!=typeof s&&(s=0),s+1>e.length||-1===e.indexOf(".",s))?"argument":"property";u='The "'.concat(e,'" ').concat(c," ").concat(l," ").concat(n(t,"type"))}return u+". Received type ".concat(typeof r)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},101(e,t,r){var n=r(606),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(891),a=r(999);r(698)(c,o);for(var s=i(a.prototype),l=0;l<s.length;l++){var u=s[l];c.prototype[u]||(c.prototype[u]=a.prototype[u])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",p)))}function p(){this._writableState.ended||n.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},681(e,t,r){e.exports=i;var n=r(83);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},891(e,t,r){var n,i,o,a,s,l=r(606);e.exports=O,O.ReadableState=R,r(7).EventEmitter;var u=function(e,t){return e.listeners(t).length},c=r(396),p=r(287).Buffer,d=(void 0!==r.g?r.g:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},f=r(252);i=f&&f.debuglog?f.debuglog("stream"):function(){};var h=r(766),m=r(347),g=r(644).getHighWaterMark,y=r(463).F,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(698)(O,c);var E=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function R(e,t,i){n=n||r(101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=r(141).I),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function O(e){if(n=n||r(101),!(this instanceof O))return new O(e);var t=this instanceof n;this._readableState=new R(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function T(e,t,r,n,o){i("readableAddChunk",t);var a,s,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,k(e)))}}(e,l);else if(o||(s=function(e,t){var r;return p.isBuffer(t)||t instanceof d||"string"==typeof t||void 0===t||e.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],t)),r}(l,t)),s)E(e,s);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===p.prototype||(a=t,t=p.from(a)),n)l.endEmitted?E(e,new w):C(e,l,t,!0);else if(l.ended)E(e,new v);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(t=l.decoder.write(t),l.objectMode||0!==t.length?C(e,l,t,!1):P(e,l)):C(e,l,t,!1)}else n||(l.reading=!1,P(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function C(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),P(e,t)}function A(e,t){var r;if(e<=0||0===t.length&&t.ended)return 0;if(t.objectMode)return 1;if(e!=e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;return(e>t.highWaterMark&&((r=e)>=0x40000000?r=0x40000000:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),t.highWaterMark=r),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function x(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,l.nextTick(k,e))}function k(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,N(e)}function P(e,t){t.readingMore||(t.readingMore=!0,l.nextTick(U,e,t))}function U(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(i("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){i("readable nexttick read 0"),e.read(0)}function z(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function D(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,l.nextTick($,t,e))}function $(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function M(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return -1}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),O.prototype.destroy=m.destroy,O.prototype._undestroy=m.undestroy,O.prototype._destroy=function(e,t){t(e)},O.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=p.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},O.prototype.unshift=function(e){return T(this,e,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(e){o||(o=r(141).I);var t=new o(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this},O.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t,r=this._readableState,n=e;if(0!==e&&(r.emittedReadable=!1),0===e&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return i("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?D(this):x(this),null;if(0===(e=A(e,r))&&r.ended)return 0===r.length&&D(this),null;var o=r.needReadable;return i("need readable",o),(0===r.length||r.length-e<r.highWaterMark)&&i("length less than watermark",o=!0),r.ended||r.reading?i("reading or ended",o=!1):o&&(i("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(e=A(n,r))),null===(t=e>0?j(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),n!==e&&r.ended&&D(this)),null!==t&&this.emit("data",t),t},O.prototype._read=function(e){E(this,new _("_read()"))},O.prototype.pipe=function(e,t){var r,n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,i("pipe count=%d opts=%j",o.pipesCount,t);var a=t&&!1===t.end||e===l.stdout||e===l.stderr?g:s;function s(){i("onend"),e.end()}o.endEmitted?l.nextTick(a):n.once("end",a),e.on("unpipe",function t(r,a){i("onunpipe"),r===n&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,i("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",f),e.removeListener("unpipe",t),n.removeListener("end",s),n.removeListener("end",g),n.removeListener("data",d),p=!0,o.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c())});var c=(r=n,function(){var e=r._readableState;i("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&u(r,"data")&&(e.flowing=!0,N(r))});e.on("drain",c);var p=!1;function d(t){i("ondata");var r=e.write(t);i("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!p&&(i("false write response, pause",o.awaitDrain),o.awaitDrain++),n.pause())}function f(t){i("onerror",t),g(),e.removeListener("error",f),0===u(e,"error")&&E(e,t)}function h(){e.removeListener("finish",m),g()}function m(){i("onfinish"),e.removeListener("close",h),g()}function g(){i("unpipe"),n.unpipe(e)}return n.on("data",d),!function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",h),e.once("finish",m),e.emit("pipe",n),o.flowing||(i("pipe resume"),n.resume()),e},O.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=M(t.pipes,e);return -1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},O.prototype.on=function(e,t){var r=c.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"!==e||n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?x(this):n.reading||l.nextTick(L,this)),r},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&l.nextTick(I,this),r},O.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&l.nextTick(I,this),t},O.prototype.resume=function(){var e,t,r=this._readableState;return r.flowing||(i("resume"),r.flowing=!r.readableListening,e=this,(t=r).resumeScheduled||(t.resumeScheduled=!0,l.nextTick(z,e,t))),r.paused=!1,this},O.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var o in e.on("end",function(){if(i("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(o){i("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(t.push(o)||(n=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){i("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===a&&(a=r(34)),a(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),O._fromList=j,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(e,t){return void 0===s&&(s=r(968)),s(O,e,t)})},83(e,t,r){e.exports=c;var n=r(463).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,l=r(101);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);l.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",p)}function p(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,r){d(e,t,r)})}function d(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(698)(c,l),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},999(e,t,r){var n,i,o=r(606);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var r=t,n=e,i=r.entry;for(r.entry=null;i;){var o=i.callback;n.pendingcb--,o(void 0),i=i.next}n.corkedRequestsFree.next=r}}e.exports=O,O.WritableState=R;var s={deprecate:r(643)},l=r(396),u=r(287).Buffer,c=(void 0!==r.g?r.g:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},p=r(347),d=r(644).getHighWaterMark,f=r(463).F,h=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,v=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,w=f.ERR_UNKNOWN_ENCODING,E=p.errorOrDestroy;function S(){}function R(e,t,i){n=n||r(101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new g;if(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t)--r.pendingcb,n?(o.nextTick(i,t),o.nextTick(P,e,r),e._writableState.errorEmitted=!0,E(e,t)):(i(t),e._writableState.errorEmitted=!0,E(e,t),P(e,r));else{var a=x(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||A(e,r),n?o.nextTick(C,e,r,a,i):C(e,r,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}r(698)(O,l),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(R.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function O(e){var t=this instanceof(n=n||r(101));if(!t&&!i.call(O,this))return new O(e);this._writableState=new R(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function T(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new b("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function C(e,t,r,n){var i,o;r||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,n(),P(e,t)}function A(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=Array(t.bufferedRequestCount),i=t.corkedRequestsFree;i.entry=r;for(var o=0,s=!0;r;)n[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;n.allBuffers=s,T(e,t,!0,t.length,n,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback,p=t.objectMode?1:l.length;if(T(e,t,!1,p,l,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),P(e,t)})}function P(e,t){var r=x(t);if(r&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,o.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===O&&e&&e._writableState instanceof R}})):i=function(e){return e instanceof this},O.prototype.pipe=function(){E(this,new y)},O.prototype.write=function(e,t,r){var n,i,a,s,l,p,d,f=this._writableState,m=!1,g=!f.objectMode&&(n=e,u.isBuffer(n)||n instanceof c);return(g&&!u.isBuffer(e)&&(i=e,e=u.from(i)),"function"==typeof t&&(r=t,t=null),g?t="buffer":t||(t=f.defaultEncoding),"function"!=typeof r&&(r=S),f.ending)?(a=r,E(this,s=new _),o.nextTick(a,s)):(g||(l=e,p=r,null===l?d=new v:"string"==typeof l||f.objectMode||(d=new h("chunk",["string","Buffer"],l)),!d||(E(this,d),o.nextTick(p,d),0)))&&(f.pendingcb++,m=function(e,t,r,n,i,o){if(!r){var a,s,l=(a=n,s=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof a||(a=u.from(a,s)),a);n!==l&&(r=!0,i="buffer",n=l)}var c=t.objectMode?1:n.length;t.length+=c;var p=t.length<t.highWaterMark;if(p||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,c,n,i,o);return p}(this,f,g,e,t,r)),m},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||A(this,e))},O.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(e,t,r){r(new m("_write()"))},O.prototype._writev=null,O.prototype.end=function(e,t,r){var n,i,a,s=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),s.corked&&(s.corked=1,this.uncork()),s.ending||(n=this,i=s,a=r,i.ending=!0,P(n,i),a&&(i.finished?o.nextTick(a):n.once("finish",a)),i.ended=!0,n.writable=!1),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),O.prototype.destroy=p.destroy,O.prototype._undestroy=p.undestroy,O.prototype._destroy=function(e,t){t(e)}},34(e,t,r){var n,i=r(606);function o(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(257),s=Symbol("lastResolve"),l=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),p=Symbol("lastPromise"),d=Symbol("handlePromise"),f=Symbol("stream");function h(e,t){return{value:e,done:t}}function m(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[p]=null,e[s]=null,e[l]=null,t(h(r,!1)))}}function g(e){i.nextTick(m,e)}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((o(n={get stream(){return this[f]},next:function(){var e,t,r=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(h(void 0,!0));if(this[f].destroyed)return new Promise(function(e,t){i.nextTick(function(){r[u]?t(r[u]):e(h(void 0,!0))})});var o=this[p];if(o)t=new Promise((e=this,function(t,r){o.then(function(){e[c]?t(h(void 0,!0)):e[d](t,r)},r)}));else{var a=this[f].read();if(null!==a)return Promise.resolve(h(a,!1));t=new Promise(this[d])}return this[p]=t,t}},Symbol.asyncIterator,function(){return this}),o(n,"return",function(){var e=this;return new Promise(function(t,r){e[f].destroy(null,function(e){e?r(e):t(h(void 0,!0))})})}),n),y);e.exports=function(e){var t,r=Object.create(b,(o(t={},f,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,l,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,d,{value:function(e,t){var n=r[f].read();n?(r[p]=null,r[s]=null,r[l]=null,e(h(n,!1))):(r[s]=e,r[l]=t)},writable:!0}),t));return r[p]=null,a(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];null!==t&&(r[p]=null,r[s]=null,r[l]=null,t(e)),r[u]=e;return}var n=r[s];null!==n&&(r[p]=null,r[s]=null,r[l]=null,n(h(void 0,!0))),r[c]=!0}),e.on("readable",g.bind(null,r)),r}},766(e,t,r){function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=o(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var a=r(287).Buffer,s=r(88).inspect,l=s&&s.custom||"inspect";e.exports=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n=a.allocUnsafe(e>>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return s(this,i(i({},t),{},{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}()},347(e,t,r){var n=r(606);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return s||l?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},257(e,t,r){var n=r(463).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),a=o||i,s=!1,o=function(){if(!s){s=!0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];a.apply(this,t)}};var a,s,l=r.readable||!1!==r.readable&&t.readable,u=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||d()},p=t._writableState&&t._writableState.finished,d=function(){u=!1,p=!0,l||o.call(t)},f=t._readableState&&t._readableState.endEmitted,h=function(){l=!1,f=!0,u||o.call(t)},m=function(e){o.call(t,e)},g=function(){var e;return l&&!f?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):u&&!p?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",d)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",d),t.on("abort",g),t.req?y():t.on("request",y)):u&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",h),t.on("finish",d),!1!==r.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",y),t.req&&t.req.removeListener("finish",d),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",m),t.removeListener("close",g)}}},968(e){e.exports=function(){throw Error("Readable.from is not available in the browser")}},267(e,t,r){var n,i=r(463).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function l(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e,t,i=arguments.length,c=Array(i),p=0;p<i;p++)c[p]=arguments[p];var d=(e=c).length&&"function"==typeof e[e.length-1]?e.pop():s;if(Array.isArray(c[0])&&(c=c[0]),c.length<2)throw new o("streams");var f=c.map(function(e,i){var o,s,u,p,h,m,g=i<c.length-1;return o=i>0,u=s=function(e){t||(t=e),e&&f.forEach(l),g||(f.forEach(l),d(t))},p=!1,s=function(){p||(p=!0,u.apply(void 0,arguments))},h=!1,e.on("close",function(){h=!0}),void 0===n&&(n=r(257)),n(e,{readable:g,writable:o},function(e){if(e)return s(e);h=!0,s()}),m=!1,function(t){if(!h&&!m){if(m=!0,e.setHeader&&"function"==typeof e.abort)return e.abort();if("function"==typeof e.destroy)return e.destroy();s(t||new a("pipe"))}}});return c.reduce(u)}},644(e,t,r){var n=r(463).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=null!=t.highWaterMark?t.highWaterMark:i?t[r]:null;if(null!=o){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},396(e,t,r){e.exports=r(7).EventEmitter},141(e,t,r){var n=r(861).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=p,t=3;break;default:this.write=d,this.end=f;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},643(e,t,r){e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}},88(){},252(){},31(){},29(){},134(){}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n||"object"==typeof r&&r&&(4&n&&r.__esModule||16&n&&"function"==typeof r.then))return r;var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>{a[e]=()=>r[e]});return a.default=()=>r,i.d(o,a),o},i.d=(e,t,r)=>{var n=(t,r)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[r]:t[n]})};n(t,"get"),n(r,"value")},i.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{let e,t,r,n,a,s,l,u,c,p,d,f,h,m,g,y,b;i.d(o,{TD:()=>ActorClient,B:()=>ActorCollectionClient,h0:()=>ActorEnvVarClient,XP:()=>ActorEnvVarCollectionClient,v8:()=>pq,Lu:()=>cH,vp:()=>ActorVersionClient,Jo:()=>ActorVersionCollectionClient,UP:()=>ApifyApiError,rj:()=>ApifyClient,Ns:()=>ArgumentValidationError,kt:()=>BuildClient,KW:()=>BuildCollectionClient,fK:()=>ConflictError,wb:()=>DatasetClient,wv:()=>DatasetCollectionClient,yY:()=>pe,qQ:()=>ForbiddenError,tY:()=>InvalidRequestError,rE:()=>InvalidResponseBodyError,PD:()=>KeyValueStoreClient,lE:()=>KeyValueStoreCollectionClient,ss:()=>LogClient,kq:()=>LoggerActorRedirect,m_:()=>NotFoundError,O_:()=>cY,OE:()=>RateLimitError,oc:()=>RequestQueueClient,oW:()=>RequestQueueCollectionClient,dK:()=>ResponseValidationError,Ry:()=>RunClient,Ng:()=>RunCollectionClient,Hg:()=>cG,L6:()=>ScheduleClient,Ty:()=>ScheduleCollectionClient,gP:()=>ServerError,py:()=>StoreCollectionClient,YS:()=>StreamedLog,t1:()=>TaskClient,jE:()=>TaskCollectionClient,D_:()=>UnauthorizedError,jx:()=>UserClient,F:()=>WebhookClient,J_:()=>WebhookCollectionClient,hH:()=>WebhookDispatchClient,zC:()=>WebhookDispatchCollectionClient,_l:()=>cJ});var v,_,w,E,S,R,O,T,C,A,x,k,P,U,I,L,z,N,j,D,$,M={};function F(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function B(e,t="|"){return e.map(e=>en(e)).join(t)}function q(e,t){return"bigint"==typeof t?t.toString():t}function W(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Z(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function K(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function V(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}i.r(M),i.d(M,{hasBrowserEnv:()=>am,hasStandardBrowserEnv:()=>ay,hasStandardBrowserWebWorkerEnv:()=>ab,navigator:()=>ag,origin:()=>av});let J="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function H(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let G=W(()=>{if(eE.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function Y(e){if(!1===H(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==H(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Q(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let X=new Set(["string","number","symbol"]);function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function et(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function er(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function en(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let ei={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function eo(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let o=V(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(n,t))throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t of Reflect.ownKeys(n))i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return K(this,"shape",i),i},checks:[]});return et(t,o)}function ea(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function es(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function el(e){return"string"==typeof e?e:e?.message}function eu(e,t,r){var n;for(let i=t;i<e.length;i++)(n=e[i]).schema??(n.schema=r)}function ec(e,t,r){let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?e.schema??(e.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:el(e.inst?._zod.def?.error?.(e))??el(i?.(e))??el(t?.error?.(e))??el(r.customError?.(e))??el(r.localeError?.(e))??"Invalid input",{inst:a,schema:s,continue:l,input:u,...c}=e;return c.path??(c.path=[]),c.message=o,t?.reportInput&&(c.input=u),c}let ep=/[\uD800-\uDBFF]/;function ed(e){let t=e.length;if(!ep.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(64512&e.charCodeAt(n))==55296&&(64512&e.charCodeAt(n+1))==56320&&(r--,n++);return r}function ef(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eh(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function em(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}let eg=!1,ey={configurable:!0,get(){eg=!0}};function eb(t,r,n){let i=Object.getPrototypeOf(t._zod);if(r in i&&e!==t._zod){e=void 0;return}e=t._zod,Object.defineProperty(i,r,{configurable:!0,get(){Object.defineProperty(this,r,ey);let e=eg;eg=!1;try{let t=n(this);return eg?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t}),eg=eg||e,t}catch(t){throw delete this[r],eg=eg||e,t}},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:e})}})}let ev={value:void 0,enumerable:!1},e_="captureStackTrace"in Error?Error:null;function ew(e,t,r,n){function i(e){this.def=e,this.constr=l,this.traits=new Set}i.prototype={};let o=r&&new WeakSet;function a(n,a){if(!n._zod){ev.value=new i(a);try{Object.defineProperty(n,"_zod",ev)}finally{ev.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,a),o){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let a=i??e;if(!o.has(a)){o.add(a);for(let e in r){let t=Object.getOwnPropertyDescriptor(r,e);t.get?Object.defineProperty(a,e,{...t,enumerable:!1}):function(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:em(this,t,r.bind(this))},set(e){em(this,t,e)}})}(a,e,t.value)}}}let s=l.prototype;for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(e in n||(n[e]=s[e].bind(n)))}let s=n?.Parent??Object;let Definition=class Definition extends s{};function l(e){let t=n?.Parent?function(e){let t=e_;if(t){let r=t.stackTraceLimit;if("number"==typeof r){try{t.stackTraceLimit=0}catch{return e_=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}(Definition):this;a(t,e);let r=t._zod.deferred;if(r){for(let e of r)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(Definition,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!n?.Parent&&t instanceof n.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}let $ZodAsyncError=class $ZodAsyncError extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};let $ZodEncodeError=class $ZodEncodeError extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(L=globalThis).__zod_globalConfig??(L.__zod_globalConfig={});let eE=globalThis.__zod_globalConfig;function eS(e){return e&&Object.assign(eE,e),eE}let $ZodCyclicError=class $ZodCyclicError extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}};let eR="~memo",eO=[];function eT(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let eC=new WeakMap,eA=[],ex={alloc(e,r,n){let i=t;if(!i)return n;t=void 0;let o={value:n,issues:null};return i.set(r.value,o),eA.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(e,r)=>{var n,i;let o;if("backward"!==r.direction&&(n=r,i=e.value,void 0!==(o=n[eR]?.backEdges)&&null!==i&&"object"==typeof i&&o.has(i)))throw new $ZodCyclicError;return t(e,r)};e._zod.parse=r,e._zod.run===t&&(e._zod.run=r)})},attach(e){var r;let n,i,o;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,a=(s,l)=>{let u;if(void 0===n&&!(n=function e(t,r){let n=eC.get(t);if(void 0!==n)return n;if(r.has(t))return!0;r.add(t);let i=!1,o=t=>{!i&&t?._zod&&e(t,r)&&(i=!0)},a=t._zod.def;switch(a.type){case"object":for(let e of Reflect.ownKeys(a.shape))o(a.shape[e]);o(a.catchall);break;case"array":o(a.element);break;case"tuple":for(let e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(let e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":o(t._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let r=t.value;if(r&&"object"==typeof r){if(r._zod)o(r);else if(Array.isArray(r))for(let e of r)o(e)}}}return r.delete(t),eC.set(t,i),i}(e,new Set)))return e._zod.parse=r,e._zod.run===a&&(e._zod.run=r),r(s,l);let c=s.value;if(null===c||"object"!=typeof c)return r(s,l);let p=l[eR];if(p||(p={buckets:new Map,backEdges:void 0},l[eR]=p),i===l)u=o;else{var d;let t;(t=(d=p).buckets.get(e))||(t=new Map,d.buckets.set(e,t)),u=t,i=l,o=u}let f=u.get(c);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...eT(f.issues)):(s.memo=!0,p.backEdges??(p.backEdges=new Set),p.backEdges.add(f.value)),s;t=u;let h=eA.length,m=r(s,l);t=void 0;let g=eA.length>h?eA.pop():void 0;return m instanceof Promise?m.then(e=>(g&&(g.issues=e.issues.length?eT(e.issues):eO),e)):(g&&(g.issues=m.issues.length?eT(m.issues):eO),m)};e._zod.parse=a,e._zod.run===r&&(e._zod.run=a)})}},ek=/^[cC][0-9a-z]{6,}$/,eP=/^[0-9a-z]+$/,eU=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eI=/^[0-9a-vA-V]{20}$/,eL=/^[A-Za-z0-9]{27}$/,ez=/^[a-zA-Z0-9_-]{21}$/,eN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ej=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,eD=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,e$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eB=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,eq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eW=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eZ=/^[A-Za-z0-9_-]*$/,eK=/^https?$/,eV=/^\+[1-9]\d{6,14}$/,eJ="(?:(?:\\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])))",eH=RegExp(`^${eJ}$`);function eG(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let eY=/^-?\d+$/,eQ=/^-?\d+(?:\.\d+)?$/,eX=/^(?:true|false)$/i,e0=/^null$/i,e1=/^[^A-Z]*$/,e2=/^[^a-z]*$/,e4=ew("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),e3=e=>{let t=e.value;return null!=t&&void 0!==t.length},e6={number:"number",bigint:"bigint",object:"date"},e9=ew("$ZodCheckLessThan",(e,t)=>{e4.init(e,t);let r=e6[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:e6[typeof n.value]??r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),e8=ew("$ZodCheckGreaterThan",(e,t)=>{e4.init(e,t);let r=e6[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:e6[typeof n.value]??r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),e5=ew("$ZodCheckMultipleOf",(e,t)=>{e4.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let n,i,o;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):0==(i=Math.round(n=r.value/t.value),o=4*Number.EPSILON*Math.max(Math.abs(n),1),Math.abs(n-i)<o?0:n-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),e7=ew("$ZodCheckNumberFormat",(e,t)=>{e4.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=ei[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=eY)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),te=ew("$ZodCheckMaxLength",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value,i=n.length;if(("string"==typeof n&&i>t.maximum?ed(n):i)<=t.maximum)return;let o=ef(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tt=ew("$ZodCheckMinLength",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value,i=n.length;if(("string"==typeof n&&i>=t.minimum&&i<2*t.minimum?ed(n):i)>=t.minimum)return;let o=ef(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tr=ew("$ZodCheckLengthEquals",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length,o="string"==typeof n&&i>=t.length&&i<=2*t.length?ed(n):i;if(o===t.length)return;let a=ef(n),s=o>t.length;r.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),tn=ew("$ZodCheckStringFormat",(e,t)=>{var r,n;e4.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ti=ew("$ZodCheckRegex",(e,t)=>{tn.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})}}),to=ew("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e1),tn.init(e,t)}),ta=ew("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=e2),tn.init(e,t)}),ts=ew("$ZodCheckIncludes",(e,t)=>{e4.init(e,t);let r=ee(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),tl=ew("$ZodCheckStartsWith",(e,t)=>{e4.init(e,t);let r=RegExp(`^${ee(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tu=ew("$ZodCheckEndsWith",(e,t)=>{e4.init(e,t);let r=RegExp(`.*${ee(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),tc=ew("$ZodCheckOverwrite",(e,t)=>{e4.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});let Doc=class Doc{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
2
+ var e,t,r={313(e,t,r){var n=r(606);let i=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,o=()=>{let e={enabled:void 0!==n&&"0"!==n.env.FORCE_COLOR,visible:!0,styles:{},keys:{}},t=(e,t,r)=>"function"==typeof e?e(t):e.wrap(t,r),o=(r,n)=>{if(""===r||null==r)return"";if(!1===e.enabled)return r;if(!1===e.visible)return"";let i=""+r,o=i.includes("\n"),a=n.length;for(a>0&&n.includes("unstyle")&&(n=[...new Set(["unstyle",...n])].reverse());a-- >0;)i=t(e.styles[n[a]],i,o);return i},a=(t,r,n)=>{var i;let a,s,l;e.styles[t]=(a=(i={name:t,codes:r}).open=`\u001b[${i.codes[0]}m`,s=i.close=`\u001b[${i.codes[1]}m`,l=i.regex=RegExp(`\\u001b\\[${i.codes[1]}m`,"g"),i.wrap=(e,t)=>{e.includes(s)&&(e=e.replace(l,s+a));let r=a+e+s;return t?r.replace(/\r*\n/g,`${s}$&${a}`):r},i),(e.keys[n]||(e.keys[n]=[])).push(t),Reflect.defineProperty(e,t,{configurable:!0,enumerable:!0,set(r){e.alias(t,r)},get(){let r=e=>o(e,r.stack);return Reflect.setPrototypeOf(r,e),r.stack=this.stack?this.stack.concat(t):[t],r}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=i,e.hasColor=e.hasAnsi=t=>(e.ansiRegex.lastIndex=0,"string"==typeof t&&""!==t&&e.ansiRegex.test(t)),e.alias=(t,r)=>{let n="string"==typeof r?e[r]:r;if("function"!=typeof n)throw TypeError("Expected alias to be the name of an existing color (string) or a function");n.stack||(Reflect.defineProperty(n,"name",{value:t}),e.styles[t]=n,n.stack=[t]),Reflect.defineProperty(e,t,{configurable:!0,enumerable:!0,set(r){e.alias(t,r)},get(){let t=e=>o(e,t.stack);return Reflect.setPrototypeOf(t,e),t.stack=this.stack?this.stack.concat(n.stack):n.stack,t}})},e.theme=t=>{if(!(null!==t&&"object"==typeof t&&!Array.isArray(t)))throw TypeError("Expected theme to be an object");for(let r of Object.keys(t))e.alias(r,t[r]);return e},e.alias("unstyle",t=>"string"==typeof t&&""!==t?(e.ansiRegex.lastIndex=0,t.replace(e.ansiRegex,"")):""),e.alias("noop",e=>e),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=r(904),e.define=a,e};e.exports=o(),e.exports.create=o},904(e,t,r){var n=r(606);let i=void 0!==n&&"Hyper"===n.env.TERM_PROGRAM,o=void 0!==n&&"win32"===n.platform,a=void 0!==n&&"linux"===n.platform,s={ballotDisabled:"☒",ballotOff:"☐",ballotOn:"☑",bullet:"•",bulletWhite:"◦",fullBlock:"█",heart:"❤",identicalTo:"≡",line:"─",mark:"※",middot:"·",minus:"-",multiplication:"×",obelus:"÷",pencilDownRight:"✎",pencilRight:"✏",pencilUpRight:"✐",percent:"%",pilcrow2:"❡",pilcrow:"¶",plusMinus:"±",question:"?",section:"§",starsOff:"☆",starsOn:"★",upDownArrow:"↕"},l=Object.assign({},s,{check:"√",cross:"×",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"»",radioOff:"( )",radioOn:"(*)",warning:"‼"}),u=Object.assign({},s,{ballotCross:"✘",check:"✔",cross:"✖",ellipsisLarge:"⋯",ellipsis:"…",info:"ℹ",questionFull:"?",questionSmall:"﹖",pointer:a?"▸":"❯",pointerSmall:a?"‣":"›",radioOff:"◯",radioOn:"◉",warning:"⚠"});e.exports=o&&!i?l:u,Reflect.defineProperty(e.exports,"common",{enumerable:!1,value:s}),Reflect.defineProperty(e.exports,"windows",{enumerable:!1,value:l}),Reflect.defineProperty(e.exports,"other",{enumerable:!1,value:u})},336(e,t,r){var n=r(617);e.exports=function(e,t){return new Promise(function(r,i){var o,a=t||{};function s(e){i(e||Error("Aborted"))}function l(e,t){e.bail?s(e):o.retry(e)?a.onRetry&&a.onRetry(e,t):i(o.mainError())}"randomize"in a||(a.randomize=!0),(o=n.operation(a)).attempt(function(t){var n;try{n=e(s,t)}catch(e){l(e,t);return}Promise.resolve(n).then(r).catch(function(e){l(e,t)})})})}},526(e,t){t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=l(e),a=o[0],s=o[1],u=new i((a+s)*3/4-s),c=0,p=s>0?a-4:a;for(r=0;r<p;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(function(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,a,a+16383>s?s:a+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a<s;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},287(e,t,r){var n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|h(n,i),l=a(o),u=l.write(n,i);return u!==o&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e)){var c=e;if(x(c,Uint8Array)){var m=new Uint8Array(c);return d(m.buffer,m.byteOffset,m.byteLength)}return p(c)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var g=e.valueOf&&e.valueOf();if(null!=g&&g!==e)return s.from(g,t,r);var y=function(e){if(s.isBuffer(e)){var t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(y)return y;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|f(e))}function p(e){for(var t=e.length<0?0:0|f(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}function f(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,o,a,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=k[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,a=r,0===o&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var p=!0,d=0;d<l;d++)if(u(e,o+d)!==u(t,d)){p=!1;break}if(p)return o}return -1}function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,p=u>239?4:u>223?3:u>191?2:1;if(i+p<=r)switch(p){case 1:u<128&&(c=u);break;case 2:(192&(o=e[i+1]))==128&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],(192&o)==128&&(192&a)==128&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],(192&o)==128&&(192&a)==128&&(192&s)==128&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=p}var d=n,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var h="",m=0;m<f;)h+=String.fromCharCode.apply(String,d.slice(m,m+=4096));return h}function _(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,o){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function E(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function S(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(x(o,Uint8Array))i+o.length>n.length?s.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(s.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):m.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(s.prototype[o]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,a=r-t,l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),p=0;p<l;++p)if(u[p]!==c[p]){o=u[p],a=c[p];break}return o<a?-1:+(a<o)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,a,s,l,u,c,p,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s,l=parseInt(t.substr(2*a,2),16);if((s=l)!=s)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,A(T(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return a=t,s=r,A(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,a,s);case"base64":return l=t,u=r,A(C(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,p=r,A(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,p);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var o=1,a=0;for(this[t]=255&e;++a<r&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var o=r-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return S(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return S(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var O=/[^+/0-9A-Za-z-_]/g;function T(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function A(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var k=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},597(e,t){var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function o(e){this.parameters=Object.create(null),this.type=e}t.q=function(e){if(!e)throw TypeError("argument string is required");var t,a,s,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),c=-1!==u?l.slice(0,u).trim():l.trim();if(!i.test(c))throw TypeError("invalid media type");var p=new o(c.toLowerCase());if(-1!==u){for(r.lastIndex=u;a=r.exec(l);){if(a.index!==u)throw TypeError("invalid parameter format");u+=a[0].length,t=a[1].toLowerCase(),34===(s=a[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(n,"$1")),p.parameters[t]=s}if(u!==l.length)throw TypeError("invalid parameter format")}return p}},7(e){var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(r,n){var i,o,a;function s(r){e.removeListener(t,l),n(r)}function l(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}m(e,t,l,{once:!0}),"error"!==t&&(i=e,o=s,a={once:!0},"function"==typeof i.on&&m(i,"error",o,a))})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var i,o,a,u=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):h(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(o){n.once&&e.removeEventListener(t,i),r(o)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var a,s=Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else for(var u=l.length,c=h(l,u),r=0;r<u;++r)n(c[r],this,t);return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,p(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,p(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events)||void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},251(e,t){t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,d=r?-1:1,f=e[t+p];for(p+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+p],p+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+p],p+=d,c-=8);if(0===o)o=1-u;else{if(o===l)return a?0/0:(f?-1:1)*2e308;a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,p=c>>1,d=5960464477539062e-23*(23===i),f=n?0:o-1,h=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||1/0===t?(s=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?t+=d/l:t+=d*Math.pow(2,1-p),t*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(t*l-1)*Math.pow(2,i),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=h,a/=256,u-=8);e[r+f-h]|=128*m}},698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},606(e){var t,r,n,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var l=[],u=!1,c=-1;function p(){u&&n&&(u=!1,n.length?l=n.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(n=l,l=[];++c<t;)n&&n[c].run();c=-1,t=l.length}n=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}},617(e,t,r){e.exports=r(303)},303(e,t,r){var n=r(961);t.operation=function(e){return new n(t.timeouts(e),{forever:e&&(e.forever||1/0===e.retries),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<t.retries;i++)n.push(this.createTimeout(i,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(i,t)),n.sort(function(e,t){return e-t}),n},t.createTimeout=function(e,t){var r=Math.round((t.randomize?Math.random()+1:1)*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return Math.min(r,t.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var i in n=[],e)"function"==typeof e[i]&&n.push(i);for(var o=0;o<n.length;o++){var a=n[o],s=e[a];e[a]=(function(n){var i=t.operation(r),o=Array.prototype.slice.call(arguments,1),a=o.pop();o.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),a.apply(this,arguments))}),i.attempt(function(){n.apply(e,o)})}).bind(e,s),e[a].options=r}}},961(e){function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r)if(!this._cachedTimeouts)return!1;else this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],o=i.message,a=(e[o]||0)+1;e[o]=a,a>=r&&(t=i,r=a)}return t}},861(e,t,r){var n=r(287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},310(e,t,r){e.exports=i;var n=r(7).EventEmitter;function i(){n.call(this)}r(698)(i,n),i.Readable=r(891),i.Writable=r(999),i.Duplex=r(101),i.Transform=r(83),i.PassThrough=r(681),i.finished=r(257),i.pipeline=r(267),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",l));var a=!1;function s(){a||(a=!0,e.end())}function l(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",l),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",u),e.on("error",u),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},463(e){var t={};function r(e,r,n){n||(n=Error);var i=function(e){function t(t,n,i){return e.call(this,"string"==typeof r?r:r(t,n,i))||this}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e,t}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(!Array.isArray(e))return"of ".concat(t," ").concat(String(e));var r=e.length;return(e=e.map(function(e){return String(e)}),r>2)?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}r("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,r){if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(l="must not be",t=t.replace(/^not /,"")):l="must be",o=" argument",(void 0===a||a>e.length)&&(a=e.length),e.substring(a-o.length,a)===o)u="The ".concat(e," ").concat(l," ").concat(n(t,"type"));else{var i,o,a,s,l,u,c=("number"!=typeof s&&(s=0),s+1>e.length||-1===e.indexOf(".",s))?"argument":"property";u='The "'.concat(e,'" ').concat(c," ").concat(l," ").concat(n(t,"type"))}return u+". Received type ".concat(typeof r)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},101(e,t,r){var n=r(606),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(891),a=r(999);r(698)(c,o);for(var s=i(a.prototype),l=0;l<s.length;l++){var u=s[l];c.prototype[u]||(c.prototype[u]=a.prototype[u])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",p)))}function p(){this._writableState.ended||n.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},681(e,t,r){e.exports=i;var n=r(83);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},891(e,t,r){var n,i,o,a,s,l=r(606);e.exports=O,O.ReadableState=R,r(7).EventEmitter;var u=function(e,t){return e.listeners(t).length},c=r(396),p=r(287).Buffer,d=(void 0!==r.g?r.g:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},f=r(252);i=f&&f.debuglog?f.debuglog("stream"):function(){};var h=r(766),m=r(347),g=r(644).getHighWaterMark,y=r(463).F,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(698)(O,c);var E=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function R(e,t,i){n=n||r(101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=r(141).I),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function O(e){if(n=n||r(101),!(this instanceof O))return new O(e);var t=this instanceof n;this._readableState=new R(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function T(e,t,r,n,o){i("readableAddChunk",t);var a,s,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,k(e)))}}(e,l);else if(o||(s=function(e,t){var r;return p.isBuffer(t)||t instanceof d||"string"==typeof t||void 0===t||e.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],t)),r}(l,t)),s)E(e,s);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===p.prototype||(a=t,t=p.from(a)),n)l.endEmitted?E(e,new w):C(e,l,t,!0);else if(l.ended)E(e,new v);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(t=l.decoder.write(t),l.objectMode||0!==t.length?C(e,l,t,!1):P(e,l)):C(e,l,t,!1)}else n||(l.reading=!1,P(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function C(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),P(e,t)}function A(e,t){var r;if(e<=0||0===t.length&&t.ended)return 0;if(t.objectMode)return 1;if(e!=e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;return(e>t.highWaterMark&&((r=e)>=0x40000000?r=0x40000000:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),t.highWaterMark=r),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function x(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,l.nextTick(k,e))}function k(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,N(e)}function P(e,t){t.readingMore||(t.readingMore=!0,l.nextTick(U,e,t))}function U(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(i("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){i("readable nexttick read 0"),e.read(0)}function z(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function D(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,l.nextTick($,t,e))}function $(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function M(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return -1}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),O.prototype.destroy=m.destroy,O.prototype._undestroy=m.undestroy,O.prototype._destroy=function(e,t){t(e)},O.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=p.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},O.prototype.unshift=function(e){return T(this,e,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(e){o||(o=r(141).I);var t=new o(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this},O.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t,r=this._readableState,n=e;if(0!==e&&(r.emittedReadable=!1),0===e&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return i("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?D(this):x(this),null;if(0===(e=A(e,r))&&r.ended)return 0===r.length&&D(this),null;var o=r.needReadable;return i("need readable",o),(0===r.length||r.length-e<r.highWaterMark)&&i("length less than watermark",o=!0),r.ended||r.reading?i("reading or ended",o=!1):o&&(i("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(e=A(n,r))),null===(t=e>0?j(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),n!==e&&r.ended&&D(this)),null!==t&&this.emit("data",t),t},O.prototype._read=function(e){E(this,new _("_read()"))},O.prototype.pipe=function(e,t){var r,n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,i("pipe count=%d opts=%j",o.pipesCount,t);var a=t&&!1===t.end||e===l.stdout||e===l.stderr?g:s;function s(){i("onend"),e.end()}o.endEmitted?l.nextTick(a):n.once("end",a),e.on("unpipe",function t(r,a){i("onunpipe"),r===n&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,i("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",f),e.removeListener("unpipe",t),n.removeListener("end",s),n.removeListener("end",g),n.removeListener("data",d),p=!0,o.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c())});var c=(r=n,function(){var e=r._readableState;i("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&u(r,"data")&&(e.flowing=!0,N(r))});e.on("drain",c);var p=!1;function d(t){i("ondata");var r=e.write(t);i("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!p&&(i("false write response, pause",o.awaitDrain),o.awaitDrain++),n.pause())}function f(t){i("onerror",t),g(),e.removeListener("error",f),0===u(e,"error")&&E(e,t)}function h(){e.removeListener("finish",m),g()}function m(){i("onfinish"),e.removeListener("close",h),g()}function g(){i("unpipe"),n.unpipe(e)}return n.on("data",d),!function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",h),e.once("finish",m),e.emit("pipe",n),o.flowing||(i("pipe resume"),n.resume()),e},O.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=M(t.pipes,e);return -1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},O.prototype.on=function(e,t){var r=c.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"!==e||n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?x(this):n.reading||l.nextTick(L,this)),r},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&l.nextTick(I,this),r},O.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&l.nextTick(I,this),t},O.prototype.resume=function(){var e,t,r=this._readableState;return r.flowing||(i("resume"),r.flowing=!r.readableListening,e=this,(t=r).resumeScheduled||(t.resumeScheduled=!0,l.nextTick(z,e,t))),r.paused=!1,this},O.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var o in e.on("end",function(){if(i("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(o){i("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(t.push(o)||(n=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){i("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===a&&(a=r(34)),a(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),O._fromList=j,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(e,t){return void 0===s&&(s=r(968)),s(O,e,t)})},83(e,t,r){e.exports=c;var n=r(463).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,l=r(101);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);l.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",p)}function p(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,r){d(e,t,r)})}function d(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(698)(c,l),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},999(e,t,r){var n,i,o=r(606);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var r=t,n=e,i=r.entry;for(r.entry=null;i;){var o=i.callback;n.pendingcb--,o(void 0),i=i.next}n.corkedRequestsFree.next=r}}e.exports=O,O.WritableState=R;var s={deprecate:r(643)},l=r(396),u=r(287).Buffer,c=(void 0!==r.g?r.g:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},p=r(347),d=r(644).getHighWaterMark,f=r(463).F,h=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,v=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,w=f.ERR_UNKNOWN_ENCODING,E=p.errorOrDestroy;function S(){}function R(e,t,i){n=n||r(101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new g;if(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t)--r.pendingcb,n?(o.nextTick(i,t),o.nextTick(P,e,r),e._writableState.errorEmitted=!0,E(e,t)):(i(t),e._writableState.errorEmitted=!0,E(e,t),P(e,r));else{var a=x(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||A(e,r),n?o.nextTick(C,e,r,a,i):C(e,r,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}r(698)(O,l),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(R.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function O(e){var t=this instanceof(n=n||r(101));if(!t&&!i.call(O,this))return new O(e);this._writableState=new R(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function T(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new b("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function C(e,t,r,n){var i,o;r||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,n(),P(e,t)}function A(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=Array(t.bufferedRequestCount),i=t.corkedRequestsFree;i.entry=r;for(var o=0,s=!0;r;)n[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;n.allBuffers=s,T(e,t,!0,t.length,n,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback,p=t.objectMode?1:l.length;if(T(e,t,!1,p,l,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),P(e,t)})}function P(e,t){var r=x(t);if(r&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,o.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===O&&e&&e._writableState instanceof R}})):i=function(e){return e instanceof this},O.prototype.pipe=function(){E(this,new y)},O.prototype.write=function(e,t,r){var n,i,a,s,l,p,d,f=this._writableState,m=!1,g=!f.objectMode&&(n=e,u.isBuffer(n)||n instanceof c);return(g&&!u.isBuffer(e)&&(i=e,e=u.from(i)),"function"==typeof t&&(r=t,t=null),g?t="buffer":t||(t=f.defaultEncoding),"function"!=typeof r&&(r=S),f.ending)?(a=r,E(this,s=new _),o.nextTick(a,s)):(g||(l=e,p=r,null===l?d=new v:"string"==typeof l||f.objectMode||(d=new h("chunk",["string","Buffer"],l)),!d||(E(this,d),o.nextTick(p,d),0)))&&(f.pendingcb++,m=function(e,t,r,n,i,o){if(!r){var a,s,l=(a=n,s=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof a||(a=u.from(a,s)),a);n!==l&&(r=!0,i="buffer",n=l)}var c=t.objectMode?1:n.length;t.length+=c;var p=t.length<t.highWaterMark;if(p||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,c,n,i,o);return p}(this,f,g,e,t,r)),m},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||A(this,e))},O.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(e,t,r){r(new m("_write()"))},O.prototype._writev=null,O.prototype.end=function(e,t,r){var n,i,a,s=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),s.corked&&(s.corked=1,this.uncork()),s.ending||(n=this,i=s,a=r,i.ending=!0,P(n,i),a&&(i.finished?o.nextTick(a):n.once("finish",a)),i.ended=!0,n.writable=!1),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),O.prototype.destroy=p.destroy,O.prototype._undestroy=p.undestroy,O.prototype._destroy=function(e,t){t(e)}},34(e,t,r){var n,i=r(606);function o(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(257),s=Symbol("lastResolve"),l=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),p=Symbol("lastPromise"),d=Symbol("handlePromise"),f=Symbol("stream");function h(e,t){return{value:e,done:t}}function m(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[p]=null,e[s]=null,e[l]=null,t(h(r,!1)))}}function g(e){i.nextTick(m,e)}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((o(n={get stream(){return this[f]},next:function(){var e,t,r=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(h(void 0,!0));if(this[f].destroyed)return new Promise(function(e,t){i.nextTick(function(){r[u]?t(r[u]):e(h(void 0,!0))})});var o=this[p];if(o)t=new Promise((e=this,function(t,r){o.then(function(){e[c]?t(h(void 0,!0)):e[d](t,r)},r)}));else{var a=this[f].read();if(null!==a)return Promise.resolve(h(a,!1));t=new Promise(this[d])}return this[p]=t,t}},Symbol.asyncIterator,function(){return this}),o(n,"return",function(){var e=this;return new Promise(function(t,r){e[f].destroy(null,function(e){e?r(e):t(h(void 0,!0))})})}),n),y);e.exports=function(e){var t,r=Object.create(b,(o(t={},f,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,l,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,d,{value:function(e,t){var n=r[f].read();n?(r[p]=null,r[s]=null,r[l]=null,e(h(n,!1))):(r[s]=e,r[l]=t)},writable:!0}),t));return r[p]=null,a(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];null!==t&&(r[p]=null,r[s]=null,r[l]=null,t(e)),r[u]=e;return}var n=r[s];null!==n&&(r[p]=null,r[s]=null,r[l]=null,n(h(void 0,!0))),r[c]=!0}),e.on("readable",g.bind(null,r)),r}},766(e,t,r){function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=o(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var a=r(287).Buffer,s=r(88).inspect,l=s&&s.custom||"inspect";e.exports=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n=a.allocUnsafe(e>>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return s(this,i(i({},t),{},{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}()},347(e,t,r){var n=r(606);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return s||l?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},257(e,t,r){var n=r(463).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),a=o||i,s=!1,o=function(){if(!s){s=!0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];a.apply(this,t)}};var a,s,l=r.readable||!1!==r.readable&&t.readable,u=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||d()},p=t._writableState&&t._writableState.finished,d=function(){u=!1,p=!0,l||o.call(t)},f=t._readableState&&t._readableState.endEmitted,h=function(){l=!1,f=!0,u||o.call(t)},m=function(e){o.call(t,e)},g=function(){var e;return l&&!f?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):u&&!p?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",d)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",d),t.on("abort",g),t.req?y():t.on("request",y)):u&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",h),t.on("finish",d),!1!==r.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",y),t.req&&t.req.removeListener("finish",d),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",m),t.removeListener("close",g)}}},968(e){e.exports=function(){throw Error("Readable.from is not available in the browser")}},267(e,t,r){var n,i=r(463).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function l(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e,t,i=arguments.length,c=Array(i),p=0;p<i;p++)c[p]=arguments[p];var d=(e=c).length&&"function"==typeof e[e.length-1]?e.pop():s;if(Array.isArray(c[0])&&(c=c[0]),c.length<2)throw new o("streams");var f=c.map(function(e,i){var o,s,u,p,h,m,g=i<c.length-1;return o=i>0,u=s=function(e){t||(t=e),e&&f.forEach(l),g||(f.forEach(l),d(t))},p=!1,s=function(){p||(p=!0,u.apply(void 0,arguments))},h=!1,e.on("close",function(){h=!0}),void 0===n&&(n=r(257)),n(e,{readable:g,writable:o},function(e){if(e)return s(e);h=!0,s()}),m=!1,function(t){if(!h&&!m){if(m=!0,e.setHeader&&"function"==typeof e.abort)return e.abort();if("function"==typeof e.destroy)return e.destroy();s(t||new a("pipe"))}}});return c.reduce(u)}},644(e,t,r){var n=r(463).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=null!=t.highWaterMark?t.highWaterMark:i?t[r]:null;if(null!=o){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},396(e,t,r){e.exports=r(7).EventEmitter},141(e,t,r){var n=r(861).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=p,t=3;break;default:this.write=d,this.end=f;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},643(e,t,r){e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}},88(){},252(){},31(){},29(){},134(){}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n||"object"==typeof r&&r&&(4&n&&r.__esModule||16&n&&"function"==typeof r.then))return r;var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>{a[e]=()=>r[e]});return a.default=()=>r,i.d(o,a),o},i.d=(e,t,r)=>{var n=(t,r)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[r]:t[n]})};n(t,"get"),n(r,"value")},i.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{let e,t,r,n,a,s,l,u,c,p,d,f,h,m,g,y,b;i.d(o,{TD:()=>ActorClient,B:()=>ActorCollectionClient,h0:()=>ActorEnvVarClient,XP:()=>ActorEnvVarCollectionClient,v8:()=>pB,Lu:()=>cH,vp:()=>ActorVersionClient,Jo:()=>ActorVersionCollectionClient,UP:()=>ApifyApiError,rj:()=>ApifyClient,Ns:()=>ArgumentValidationError,kt:()=>BuildClient,KW:()=>BuildCollectionClient,fK:()=>ConflictError,wb:()=>DatasetClient,wv:()=>DatasetCollectionClient,yY:()=>pe,qQ:()=>ForbiddenError,tY:()=>InvalidRequestError,rE:()=>InvalidResponseBodyError,PD:()=>KeyValueStoreClient,lE:()=>KeyValueStoreCollectionClient,ss:()=>LogClient,kq:()=>LoggerActorRedirect,m_:()=>NotFoundError,O_:()=>cY,OE:()=>RateLimitError,oc:()=>RequestQueueClient,oW:()=>RequestQueueCollectionClient,dK:()=>ResponseValidationError,Ry:()=>RunClient,Ng:()=>RunCollectionClient,Hg:()=>cG,L6:()=>ScheduleClient,Ty:()=>ScheduleCollectionClient,gP:()=>ServerError,py:()=>StoreCollectionClient,YS:()=>StreamedLog,t1:()=>TaskClient,jE:()=>TaskCollectionClient,D_:()=>UnauthorizedError,jx:()=>UserClient,F:()=>WebhookClient,J_:()=>WebhookCollectionClient,hH:()=>WebhookDispatchClient,zC:()=>WebhookDispatchCollectionClient,_l:()=>cJ});var v,_,w,E,S,R,O,T,C,A,x,k,P,U,I,L,z,N,j,D,$,M={};function F(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function B(e,t="|"){return e.map(e=>en(e)).join(t)}function q(e,t){return"bigint"==typeof t?t.toString():t}function W(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Z(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function K(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function V(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}i.r(M),i.d(M,{hasBrowserEnv:()=>am,hasStandardBrowserEnv:()=>ay,hasStandardBrowserWebWorkerEnv:()=>ab,navigator:()=>ag,origin:()=>av});let J="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function H(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let G=W(()=>{if(eE.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function Y(e){if(!1===H(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==H(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Q(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let X=new Set(["string","number","symbol"]);function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function et(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function er(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function en(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let ei={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function eo(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let o=V(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(n,t))throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t of Reflect.ownKeys(n))i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return K(this,"shape",i),i},checks:[]});return et(t,o)}function ea(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function es(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function el(e){return"string"==typeof e?e:e?.message}function eu(e,t,r){var n;for(let i=t;i<e.length;i++)(n=e[i]).schema??(n.schema=r)}function ec(e,t,r){let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?e.schema??(e.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:el(e.inst?._zod.def?.error?.(e))??el(i?.(e))??el(t?.error?.(e))??el(r.customError?.(e))??el(r.localeError?.(e))??"Invalid input",{inst:a,schema:s,continue:l,input:u,...c}=e;return c.path??(c.path=[]),c.message=o,t?.reportInput&&(c.input=u),c}let ep=/[\uD800-\uDBFF]/;function ed(e){let t=e.length;if(!ep.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(64512&e.charCodeAt(n))==55296&&(64512&e.charCodeAt(n+1))==56320&&(r--,n++);return r}function ef(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eh(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function em(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}let eg=!1,ey={configurable:!0,get(){eg=!0}};function eb(t,r,n){let i=Object.getPrototypeOf(t._zod);if(r in i&&e!==t._zod){e=void 0;return}e=t._zod,Object.defineProperty(i,r,{configurable:!0,get(){Object.defineProperty(this,r,ey);let e=eg;eg=!1;try{let t=n(this);return eg?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t}),eg=eg||e,t}catch(t){throw delete this[r],eg=eg||e,t}},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:e})}})}let ev={value:void 0,enumerable:!1},e_="captureStackTrace"in Error?Error:null;function ew(e,t,r,n){function i(e){this.def=e,this.constr=l,this.traits=new Set}i.prototype={};let o=r&&new WeakSet;function a(n,a){if(!n._zod){ev.value=new i(a);try{Object.defineProperty(n,"_zod",ev)}finally{ev.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,a),o){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let a=i??e;if(!o.has(a)){o.add(a);for(let e in r){let t=Object.getOwnPropertyDescriptor(r,e);t.get?Object.defineProperty(a,e,{...t,enumerable:!1}):function(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:em(this,t,r.bind(this))},set(e){em(this,t,e)}})}(a,e,t.value)}}}let s=l.prototype;for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(e in n||(n[e]=s[e].bind(n)))}let s=n?.Parent??Object;let Definition=class Definition extends s{};function l(e){let t=n?.Parent?function(e){let t=e_;if(t){let r=t.stackTraceLimit;if("number"==typeof r){try{t.stackTraceLimit=0}catch{return e_=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}(Definition):this;a(t,e);let r=t._zod.deferred;if(r){for(let e of r)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(Definition,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!n?.Parent&&t instanceof n.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}let $ZodAsyncError=class $ZodAsyncError extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};let $ZodEncodeError=class $ZodEncodeError extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(L=globalThis).__zod_globalConfig??(L.__zod_globalConfig={});let eE=globalThis.__zod_globalConfig;function eS(e){return e&&Object.assign(eE,e),eE}let $ZodCyclicError=class $ZodCyclicError extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}};let eR="~memo",eO=[];function eT(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let eC=new WeakMap,eA=[],ex={alloc(e,r,n){let i=t;if(!i)return n;t=void 0;let o={value:n,issues:null};return i.set(r.value,o),eA.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(e,r)=>{var n,i;let o;if("backward"!==r.direction&&(n=r,i=e.value,void 0!==(o=n[eR]?.backEdges)&&null!==i&&"object"==typeof i&&o.has(i)))throw new $ZodCyclicError;return t(e,r)};e._zod.parse=r,e._zod.run===t&&(e._zod.run=r)})},attach(e){var r;let n,i,o;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,a=(s,l)=>{let u;if(void 0===n&&!(n=function e(t,r){let n=eC.get(t);if(void 0!==n)return n;if(r.has(t))return!0;r.add(t);let i=!1,o=t=>{!i&&t?._zod&&e(t,r)&&(i=!0)},a=t._zod.def;switch(a.type){case"object":for(let e of Reflect.ownKeys(a.shape))o(a.shape[e]);o(a.catchall);break;case"array":o(a.element);break;case"tuple":for(let e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(let e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":o(t._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let r=t.value;if(r&&"object"==typeof r){if(r._zod)o(r);else if(Array.isArray(r))for(let e of r)o(e)}}}return r.delete(t),eC.set(t,i),i}(e,new Set)))return e._zod.parse=r,e._zod.run===a&&(e._zod.run=r),r(s,l);let c=s.value;if(null===c||"object"!=typeof c)return r(s,l);let p=l[eR];if(p||(p={buckets:new Map,backEdges:void 0},l[eR]=p),i===l)u=o;else{var d;let t;(t=(d=p).buckets.get(e))||(t=new Map,d.buckets.set(e,t)),u=t,i=l,o=u}let f=u.get(c);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...eT(f.issues)):(s.memo=!0,p.backEdges??(p.backEdges=new Set),p.backEdges.add(f.value)),s;t=u;let h=eA.length,m=r(s,l);t=void 0;let g=eA.length>h?eA.pop():void 0;return m instanceof Promise?m.then(e=>(g&&(g.issues=e.issues.length?eT(e.issues):eO),e)):(g&&(g.issues=m.issues.length?eT(m.issues):eO),m)};e._zod.parse=a,e._zod.run===r&&(e._zod.run=a)})}},ek=/^[cC][0-9a-z]{6,}$/,eP=/^[0-9a-z]+$/,eU=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eI=/^[0-9a-vA-V]{20}$/,eL=/^[A-Za-z0-9]{27}$/,ez=/^[a-zA-Z0-9_-]{21}$/,eN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ej=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,eD=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,e$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eB=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,eq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eW=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eZ=/^[A-Za-z0-9_-]*$/,eK=/^https?$/,eV=/^\+[1-9]\d{6,14}$/,eJ="(?:(?:\\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])))",eH=RegExp(`^${eJ}$`);function eG(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let eY=/^-?\d+$/,eQ=/^-?\d+(?:\.\d+)?$/,eX=/^(?:true|false)$/i,e0=/^null$/i,e1=/^[^A-Z]*$/,e2=/^[^a-z]*$/,e4=ew("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),e3=e=>{let t=e.value;return null!=t&&void 0!==t.length},e6={number:"number",bigint:"bigint",object:"date"},e9=ew("$ZodCheckLessThan",(e,t)=>{e4.init(e,t);let r=e6[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:e6[typeof n.value]??r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),e8=ew("$ZodCheckGreaterThan",(e,t)=>{e4.init(e,t);let r=e6[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:e6[typeof n.value]??r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),e5=ew("$ZodCheckMultipleOf",(e,t)=>{e4.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let n,i,o;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):0==(i=Math.round(n=r.value/t.value),o=4*Number.EPSILON*Math.max(Math.abs(n),1),Math.abs(n-i)<o?0:n-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),e7=ew("$ZodCheckNumberFormat",(e,t)=>{e4.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=ei[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=eY)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),te=ew("$ZodCheckMaxLength",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value,i=n.length;if(("string"==typeof n&&i>t.maximum?ed(n):i)<=t.maximum)return;let o=ef(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tt=ew("$ZodCheckMinLength",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value,i=n.length;if(("string"==typeof n&&i>=t.minimum&&i<2*t.minimum?ed(n):i)>=t.minimum)return;let o=ef(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tr=ew("$ZodCheckLengthEquals",(e,t)=>{var r;e4.init(e,t),(r=e._zod.def).when??(r.when=e3),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length,o="string"==typeof n&&i>=t.length&&i<=2*t.length?ed(n):i;if(o===t.length)return;let a=ef(n),s=o>t.length;r.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),tn=ew("$ZodCheckStringFormat",(e,t)=>{var r,n;e4.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ti=ew("$ZodCheckRegex",(e,t)=>{tn.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})}}),to=ew("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e1),tn.init(e,t)}),ta=ew("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=e2),tn.init(e,t)}),ts=ew("$ZodCheckIncludes",(e,t)=>{e4.init(e,t);let r=ee(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),tl=ew("$ZodCheckStartsWith",(e,t)=>{e4.init(e,t);let r=RegExp(`^${ee(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tu=ew("$ZodCheckEndsWith",(e,t)=>{e4.init(e,t);let r=RegExp(`.*${ee(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),tc=ew("$ZodCheckOverwrite",(e,t)=>{e4.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});let Doc=class Doc{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
3
3
  ${t.join("\n")}
4
4
  };`)(...Object.values(this.closed))}};let tp={get:function(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,q,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},td={value:void 0,enumerable:!1},tf={value:void 0,enumerable:!1},th=new WeakSet([Object.prototype,Error.prototype]),tm=(e,t)=>{e.name="$ZodError",td.value=e._zod,Object.defineProperty(e,"_zod",td),tf.value=t,Object.defineProperty(e,"issues",tf),td.value=void 0,tf.value=void 0,Object.defineProperty(e,"message",tp);let r=Object.getPrototypeOf(e);th.has(r)||(th.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tg=ew("$ZodError",tm),ty=ew("$ZodError",tm,void 0,{Parent:Error});function tb(e,t){return{callee:t?.callee??e,Err:t?.Err}}let tv=e=>{let t=(r,n,i,o)=>{let a=i?{...i,async:!1}:{async:!1},s=r._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new $ZodAsyncError;if(s.issues.length){let r=new(o?.Err??e)(s.issues.map(e=>ec(e,a,eS())));throw J(r,o?.callee??t),r}return s.value};return t},t_=e=>{let t=async(r,n,i,o)=>{let a=i?{...i,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let r=new(o?.Err??e)(s.issues.map(e=>ec(e,a,eS())));throw J(r,o?.callee??t),r}return s.value};return t},tw=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new $ZodAsyncError;return o.issues.length?{success:!1,error:new(e??tg)(o.issues.map(e=>ec(e,i,eS())))}:{success:!0,data:o.value}},tE=tw(ty),tS=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>ec(e,i,eS())))}:{success:!0,data:o.value}},tR=tS(ty),tO={major:4,minor:5,patch:4},tT=ew("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tO;let n=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let t of i)for(let r of t._zod.onattach)r(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,r,n)=>{let i;if(t.memo)return t;let o=ea(t);for(let a of r){if(a._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(t)||!a._zod.def.when(t))continue}else if(o)continue;let r=t.issues.length,s=a._zod.check(t);if(s instanceof Promise&&n?.async===!1)throw new $ZodAsyncError;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,t.issues.length!==r&&(eu(t.issues,r,e),o||(o=ea(t,r)))});else{if(t.issues.length===r)continue;eu(t.issues,r,e),o||(o=ea(t,r))}}return i?i.then(()=>t):t},r=(r,n,o)=>{if(ea(r))return r.aborted=!0,r;let a=t(n,i,o);if(a instanceof Promise){if(!1===o.async)throw new $ZodAsyncError;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(n,o)=>{if(o.skipChecks)return e._zod.parse(n,o);if("backward"===o.direction){let t=e._zod.parse({value:n.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,n,o)):r(t,n,o)}let a=e._zod.parse(n,o);if(a instanceof Promise){if(!1===o.async)throw new $ZodAsyncError;return a.then(e=>t(e,i,o))}return t(a,i,o)}}},{get"~standard"(){return em(this,"~standard",tA(this),!1)},set"~standard"(e){em(this,"~standard",e)}}),tC=e=>e.success?{value:e.data}:{issues:e.error?.issues};function tA(e){return{validate:t=>{try{return tC(tE(e,t))}catch(r){return tR(e,t).then(tC)}},vendor:"zod",version:1}}let tx=ew("$ZodString",(e,t)=>{var r;let n;tT.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${n}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),tk=ew("$ZodStringFormat",(e,t)=>{tn.init(e,t),tx.init(e,t)}),tP=ew("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ej),tk.init(e,t)}),tU=ew("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=eD(e))}else t.pattern??(t.pattern=eD());tk.init(e,t)}),tI=ew("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=e$),tk.init(e,t)}),tL=/[\t\n\r]/g,tz=ew("$ZodURL",(e,t)=>{tk.init(e,t),e._zod.check=r=>{try{var n,i;let o=r.value.trim(),a=function(e,t){if(!t.normalize&&t.protocol?.source===eK.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}(o,t);if(1===a)return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});if(2===a)return void r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});t.hostname&&((n=t.hostname).lastIndex=0,!n.test(a.hostname))&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&((i=t.protocol).lastIndex=0,!i.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol))&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?a.href:o.replace(tL,"");return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tN=ew("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),tk.init(e,t)}),tj=ew("$ZodNanoID",(e,t)=>{var r;if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=void 0===t.length?ez:(r=t.length,RegExp(`^[a-zA-Z0-9_-]{${r}}$`))),tk.init(e,t)}),tD=ew("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ek),tk.init(e,t)}),t$=ew("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=eP),tk.init(e,t)}),tM=ew("$ZodULID",(e,t)=>{t.pattern??(t.pattern=eU),tk.init(e,t)}),tF=ew("$ZodXID",(e,t)=>{t.pattern??(t.pattern=eI),tk.init(e,t)}),tB=ew("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=eL),tk.init(e,t)}),tq=ew("$ZodISODateTime",(e,t)=>{let r,n,i;t.pattern??(r=["Z"],t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),n=`${eG({precision:t.precision,seconds:!0})}(?:${r.join("|")})`,i=t.local?`${n}|${eG({precision:t.precision})}`:n,t.pattern=RegExp(`^${eJ}T(?:${i})$`)),tk.init(e,t),(t.local||-1===t.precision)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),tW=ew("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eH),tk.init(e,t)}),tZ=ew("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${eG(t)}$`)),tk.init(e,t)}),tK=ew("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=eN),tk.init(e,t)}),tV=ew("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=eM),tk.init(e,t),e._zod.bag.format="ipv4"}),tJ=/^[0-9a-fA-F:.]+$/;function tH(e){if(!tJ.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}let tG=ew("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eF),tk.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{tH(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),tY=ew("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eB),tk.init(e,t)}),tQ=ew("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=eq),tk.init(e,t),e._zod.check=r=>{!function(e){let t=e.split("/");if(2!==t.length)return!1;let[r,n]=t;if(!n)return!1;let i=Number(n);return`${i}`===n&&!(i<0)&&!(i>128)&&tH(r)}(r.value)&&r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function tX(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let t0=ew("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eW),tk.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tX(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),t1=ew("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=eZ),tk.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!eZ.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tX(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),t2=ew("$ZodE164",(e,t)=>{t.pattern??(t.pattern=eV),tk.init(e,t)}),t4=ew("$ZodJWT",(e,t)=>{tk.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),t3=ew("$ZodNumber",(e,t)=>{tT.init(e,t),e._zod.pattern=e._zod.bag.pattern??eQ,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),t6=ew("$ZodNumberFormat",(e,t)=>{e7.init(e,t),t3.init(e,t)}),t9=ew("$ZodBoolean",(e,t)=>{tT.init(e,t),e._zod.pattern=eX,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),t8=ew("$ZodNull",(e,t)=>{tT.init(e,t),e._zod.pattern=e0,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),t5=ew("$ZodUnknown",(e,t)=>{tT.init(e,t),e._zod.parse=e=>e}),t7=ew("$ZodNever",(e,t)=>{tT.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),re=ew("$ZodDate",(e,t)=>{tT.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function rt(e,t,r){e.issues.length&&t.issues.push(...es(r,e.issues)),t.value[r]=e.value}let rr=ew("$ZodArray",(e,t)=>{tT.init(e,t);let r=eE.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=r?r.alloc(e,n,Array(o.length),i):Array(o.length);let a=[];for(let e=0;e<o.length;e++){let r=o[e],s=t.element._zod.run({value:r,issues:[]},i);s instanceof Promise?a.push(s.then(t=>rt(t,n,e))):rt(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function rn(e,t,r,n,i,o){let a=r in n,s="optional"===o;if(a||!s||"optional"!==i){if(e.issues.length){if(void 0!==i&&s&&!a)return;t.issues.push(...es(r,e.issues))}if(!a&&void 0===i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?a&&(t.value[r]=void 0):t.value[r]=e.value}}let ri=[];function ro(e){var t;let r=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:ri,o=i.length?[...r,...i]:r;for(let t of o)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Object.keys(t=e.shape).filter(e=>void 0!==t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,allKeys:o,symbolKeys:i,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(a)}}function ra(e,t,r,n,i,o){let a=[],s=i.keySet,l=i.catchall._zod,u=l.def.type,c=l.optin,p=l.optout;for(let i in t){if(s.has(i))continue;if("__proto__"===i){"never"===u&&a.push(i);continue}if("never"===u){a.push(i);continue}let o=l.run({value:t[i],issues:[]},n);o instanceof Promise?e.push(o.then(e=>rn(e,r,i,t,c,p))):rn(o,r,i,t,c,p)}return(a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length)?Promise.all(e).then(()=>r):r}let rs=new WeakMap,rl=ew("$ZodObject",(e,t)=>{let r;tT.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;rs.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),rs.set(t,r),r}})}let i=W(()=>ro(t));eb(e,"propValues",e=>{let t=e.def.shape,r={};for(let e in t){let n=t[e]._zod;if(n.values){for(let t of(Object.prototype.hasOwnProperty.call(r,e)||K(r,e,new Set),n.values))r[e].add(t);void 0!==n.optin&&r[e].add(void 0)}}return r});let o=t.catchall,a=eE.memoizer;a?.attach(e),e._zod.parse=(t,n)=>{r??(r=i.value);let s=t.value;if(!H(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value=a?a.alloc(e,t,{},n):{};let l=[],u=r.shape;for(let e of r.allKeys){if("__proto__"===e)continue;let r=u[e],i=r._zod.optin,o=r._zod.optout,a=r._zod.run({value:s[e],issues:[]},n);a instanceof Promise?l.push(a.then(r=>rn(r,t,e,s,i,o))):rn(a,t,e,s,i,o)}return o?ra(l,s,t,n,i.value,e):l.length?Promise.all(l).then(()=>t):t}}),ru=ew("$ZodObjectJIT",(e,t)=>{let r,n;rl.init(e,t);let i=e._zod.parse,o=W(()=>ro(t)),a=eE.memoizer,s=!eE.jitless,l=s&&G.value,u=t.catchall;e._zod.parse=(c,p)=>{n??(n=o.value);let d=c.value;return H(d)?s&&l&&p?.async===!1&&!0!==p.jitless?(r||(r=(t=>{let r=o.value,n=r.symbolKeys,i=new Doc(["payload","ctx"],{shape:t,inst:e,memo:a,syms:n}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`
5
5
  for (let i = 0; i < ${e}.issues.length; i++) {
@@ -58,7 +58,7 @@ or submit an issue to https://github.com/apify/apify-shared-js so we can help yo
58
58
  ${i}
59
59
  The API returned something its OpenAPI specification does not describe. Please report this at https://github.com/apify/apify-client-js/issues.`,{cause:e}),this.name="ResponseValidationError",this.issues=e.issues,this.method=n,this.url=r.url}};var sZ=i(287).Buffer;let sK=["audio/","image/","video/"],sV=new Set(["application/epub+zip","application/gzip","application/java-archive","application/vnd.android.package-archive","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.rar","application/x-7z-compressed","application/x-bzip","application/x-bzip2","application/x-gzip","application/x-rar-compressed","application/x-xz","application/x-zip-compressed","application/zip","application/zstd","font/woff","font/woff2"]),sJ=new Set(["audio/aiff","audio/basic","audio/l16","audio/l24","audio/midi","audio/vnd.wave","audio/wav","audio/wave","audio/x-aiff","audio/x-wav","image/bmp","image/tiff","image/vnd.adobe.photoshop","image/vnd.microsoft.icon","image/x-icon","image/x-ms-bmp"]),sH=["+json","+xml"];function sG(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let sY=ix(sG,{error:"Invalid input: expected an object"}),{localeError:sQ}=nr();function sX(e,t){let r=function(e){if("object"==typeof e&&e&&void 0!==e.data)return e.data;throw Error(`Expected response object with a "data" property, but received: ${e}`)}(e.data),n=t.safeParse(r,{error:sQ});if(!n.success){let{method:t="GET",url:i=""}=e.config;throw new ResponseValidationError(n.error,r,{method:t,url:i})}return n.data}function s0(e){if(!(e instanceof NotFoundError))throw e}function s1(e,t){if(!t)throw e;s0(e)}function s2(e){if(!e)return;let t=JSON.stringify(e);return btoa(String.fromCharCode(...new TextEncoder().encode(t)))}async function s4(e){if(!n){let{promisify:e}=await Promise.resolve().then(i.t.bind(i,29,23)),{brotliCompress:t,constants:r}=await Promise.resolve().then(i.t.bind(i,134,23)),o=e(t),a={params:{[r.BROTLI_PARAM_QUALITY]:6}};n=async e=>o(e,a)}return n(e)}async function s3(e){if(!a){let{promisify:e}=await Promise.resolve().then(i.t.bind(i,29,23)),{gzip:t}=await Promise.resolve().then(i.t.bind(i,134,23));a=e(t)}return a(e)}async function s6(e){0}function s9(e){return ArrayBuffer.isView(e)?!s8(e,"DataView"):s8(e,"ArrayBuffer")}function s8(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function s5(e){if(null===e||"object"!=typeof e)return!1;let{on:t,pipe:r}=e;return"function"==typeof t&&"function"==typeof r}C=function(e,t){if("object"!==sD(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==sD(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(Symbol.asyncIterator,"string"),r="symbol"===sD(C)?C:String(C);let RequestQueuePaginationIterator=class RequestQueuePaginationIterator{#e;#t;#r;#n;constructor(e){this.#e=e.maxPageLimit,this.#r=e.limit,this.#n=e.cursor,this.#t=e.getPage}async *[r](){let e=this.#n,t=0;for(;;){let r=this.#r?Math.min(this.#e,this.#r-t):this.#e,n=await this.#t({limit:r,cursor:e});if(0===n.items.length||(yield n,t+=n.items.length,this.#r&&t>=this.#r||!n.nextCursor))return;e=n.nextCursor}}};let s7={limit:nH().min(0).optional(),offset:nH().min(0).optional(),chunkSize:nH().positive().optional()},le=Symbol("scannedCount");function lt(e,t){for(let[r,n]of Object.entries(t??{}))if(void 0!==n){if(Array.isArray(n)){e.searchParams.set(r,n.join(","));continue}e.searchParams.set(r,String(n))}return e}let lr=nE().nonempty().refine(e=>"."!==e&&".."!==e,{error:"URL path must not contain dot segments"});function ln(e){return encodeURIComponent(sW(e,lr))}function li(e){return Array.isArray(e)?e.map(ln).join("/"):e}i(287).Buffer;let lo="application/json",la=[RegExp(`^${lo}`,"i"),/^application\/.*xml$/i,/^text\//i];function ls(e,t){return e.constructor.name!==ArrayBuffer.name?e.toString(t):new TextDecoder().decode(new Uint8Array(e))}let ll=/at( async)? ([A-Za-z]+(Collection)?Client)\.([A-Za-z]+) \(/;let ApifyApiError=class ApifyApiError extends Error{name;clientMethod;statusCode;type;attempt;httpMethod;path;originalStack;data;constructor(e,t){let r,n,i,o=e.data;if(s9(o)){let t=ls(e.data,"utf-8");try{o=JSON.parse(t)}catch{o=t}}if(o&&o.error){let{error:e}=o;r=e.message,n=e.type,i=e.data}else if(o){let e;try{e=JSON.stringify(o,null,2)}catch{e=`${o}`}r=`Unexpected error: ${e}`}super(r),this.name=this.constructor.name,this.clientMethod=this.#i(),this.statusCode=e.status,this.type=n,this.attempt=t,this.httpMethod=e.config?.method,this.path=this.#o(e);let a=this.stack;this.originalStack=a.slice(a.indexOf("\n")),this.stack=this.#a(),this.data=i}static fromResponse(e,t){return new(lu[e.status]??(e.status>=500?ServerError:ApifyApiError))(e,t)}#o(e){let t,r=e.config?.url;try{t=new URL(r)}catch{return r}return t.pathname+t.search}#i(){let e=this.stack.match(ll);return e?`${e[2]}.${e[4]}`:"unknown"}#a(){let{name:e,...t}=this,r=Object.entries(t).map(e=>{let[t,r]=e;return"originalStack"===t&&(t="stack"),` ${t}: ${r}`}).join("\n");return`${e}: ${this.message}
60
60
  ${r}`}};let InvalidRequestError=class InvalidRequestError extends ApifyApiError{};let UnauthorizedError=class UnauthorizedError extends ApifyApiError{};let ForbiddenError=class ForbiddenError extends ApifyApiError{};let NotFoundError=class NotFoundError extends ApifyApiError{};let ConflictError=class ConflictError extends ApifyApiError{};let RateLimitError=class RateLimitError extends ApifyApiError{};let ServerError=class ServerError extends ApifyApiError{};let lu={400:InvalidRequestError,401:UnauthorizedError,403:ForbiddenError,404:NotFoundError,409:ConflictError,429:RateLimitError};let InvalidResponseBodyError=class InvalidResponseBodyError extends Error{code;response;constructor(e,t){super(`Response body could not be parsed.
61
- Cause:${t.message}`),this.name=this.constructor.name,this.code="invalid-response-body",this.response=e,this.cause=t}};function lc(e,t){let r=t.toLowerCase(),n=Object.keys(e.headers??{}).find(e=>e.toLowerCase()===r),i=void 0===n?void 0:e.headers?.[n];return"string"==typeof i?i:void 0}let lp=[async function e(e){if(lc(e,"content-encoding")||!function(e){if(!e)return!0;let t=e.split(";",1)[0].trim().toLowerCase();return!!(sJ.has(t)||sH.some(e=>t.endsWith(e)))||!sV.has(t)&&!sK.some(e=>t.startsWith(e))}(lc(e,"content-type")))return e;let t=await s6(e.data);return t&&(e.headers??={},e.headers["content-encoding"]=t.encoding,e.data=t.data),e},function(e){let[t]=sc.defaults.transformRequest,r=t(e.data,e.headers);if(e.stringifyFunctions){let t=lc(e,"content-type");try{var n;let i=t?sj.q(t).type:void 0;"application/json"===i&&"object"==typeof e.data?(n=e.data,e.data=JSON.stringify(n,(e,t)=>"function"==typeof t?t.toString():t)):e.data=r}catch{e.data=r}}else e.data=r;return e},function(e){return!e.headers||e.headers instanceof sE||Object.setPrototypeOf(e.headers,sE.prototype),e}],ld=[function(e){if(!e.data||"arraybuffer"!==e.config.responseType||e.config.forceBuffer)return e;if(!e.data.byteLength)return e.data=void 0,e;let t=e.headers["content-type"];try{e.data=function(e,t){let r,n;try{let e=sj.q(t);r=e.type,n=e.parameters.charset}catch{return e}if(!function(e,t){return!!e&&la.some(t=>t.test(e))&&(!t||"utf8"===t.toLowerCase().replace("-",""))}(r,n))return e;let i=ls(e,n);return r===lo?JSON.parse(i):i}(e.data,t)}catch(t){throw new InvalidResponseBodyError(e,t)}return e}];var lf=i(606);let{version:lh}={version:"3.0.0-beta.19"};let HttpClient=class HttpClient{stats;maxRetries;minDelayBetweenRetriesMillis;userProvidedRequestInterceptors;logger;timeoutMillis;timeoutMaxMillis;httpAgent;httpsAgent;axios;workflowKey;#s;#l;constructor(e){let{token:t}=e;this.stats=e.apifyClientStats,this.maxRetries=e.maxRetries,this.minDelayBetweenRetriesMillis=e.minDelayBetweenRetriesMillis,this.userProvidedRequestInterceptors=e.requestInterceptors,this.timeoutMillis={short:1e3*e.timeoutShortSecs,medium:1e3*e.timeoutMediumSecs,long:1e3*e.timeoutLongSecs},this.timeoutMaxMillis=1e3*e.timeoutMaxSecs,this.logger=e.logger,this.workflowKey=e.workflowKey||lf.env.APIFY_WORKFLOW_KEY,this.#l=e.userAgentSuffix,this.axios=sc.create({proxy:!1,paramsSerializer:e=>new URLSearchParams(Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).map(e=>{let[t,r]=e;return r instanceof Date?[t,r.toISOString()]:[t,String("boolean"==typeof r?Number(r):r)]})).toString(),validateStatus:null,transformRequest:void 0,transformResponse:void 0,responseType:"arraybuffer",timeout:this.timeoutMaxMillis,maxBodyLength:1/0,maxContentLength:-1}),this.axios.defaults.headers=new sE,this.workflowKey&&(this.axios.defaults.headers["X-Apify-Workflow-Key"]=this.workflowKey),t&&(this.axios.defaults.headers.Authorization=`Bearer ${t}`),lp.forEach(e=>this.axios.interceptors.request.use(e)),this.userProvidedRequestInterceptors.forEach(e=>this.axios.interceptors.request.use(e)),ld.forEach(e=>this.axios.interceptors.response.use(e))}async #u(){}async #c(){}async call(e){await this.#u(),this.stats.calls++;let t=this.#p(e);return i5()(t,{retries:this.maxRetries,minTimeout:this.minDelayBetweenRetriesMillis,onRetry:(e,t)=>this.#d(e,t)})}#f(){this.logger.warningOnce("Request body was a stream - retrying will not work, as part of it was already consumed."),this.logger.warningOnce("If you want Apify client to handle retries for you, collect the stream into a buffer before sending it.")}#p(e){let{timeoutSecs:t="medium",...r}=e;return async(n,i)=>{let o;this.stats.requests++;let a=s5(e.data);try{if(a&&(r.maxRedirects=0),o=await this.axios.request({...r,timeout:this.#h(t,i)}),this.#m(o.status))return o;s5(o.data)&&(o.data=await sU(o.data).catch(()=>void 0))}catch(t){return this.#g(t,e,n)}429===o.status&&this.stats.addRateLimitError(i);let s=ApifyApiError.fromResponse(o,i);if(this.#y(o.status))if(a)this.#f();else throw s;return n(s),o}}#m(e){return e<300}#h(e,t){if("noTimeout"===e)return 0;let r="number"==typeof e?1e3*e:this.timeoutMillis[e];return r>this.timeoutMaxMillis&&this.logger.warningOnce(`The requested timeout of ${r/1e3}s exceeds timeoutMaxSecs (${this.timeoutMaxMillis/1e3}s) and is capped at it. Raise timeoutMaxSecs on the client to allow longer request timeouts.`),Math.min(r*2**(t-1),this.timeoutMaxMillis)}#g(e,t,r){if(this.#b(e)&&t.doNotRetryTimeouts)return r(e);if(this.#v(e))if(s5(t.data))this.#f();else throw e;return r(e)}#b(e){return"ECONNABORTED"===e.code}#v(e){return this.#_(e)||this.#w(e)}#w(e){return e instanceof InvalidResponseBodyError}#_(e){let t=e.request&&"object"==typeof e.request,r=e.config&&"object"==typeof e.config;return t&&r}#y(e){return 429===e||e>=500}#d(e,t){t===Math.round(this.maxRetries/2)&&this.logger.warning(`API request failed ${t} times. Max attempts: ${this.maxRetries+1}.
61
+ Cause:${t.message}`),this.name=this.constructor.name,this.code="invalid-response-body",this.response=e,this.cause=t}};function lc(e,t){let r=t.toLowerCase(),n=Object.keys(e.headers??{}).find(e=>e.toLowerCase()===r),i=void 0===n?void 0:e.headers?.[n];return"string"==typeof i?i:void 0}let lp=[async function e(e){if(lc(e,"content-encoding")||!function(e){if(!e)return!0;let t=e.split(";",1)[0].trim().toLowerCase();return!!(sJ.has(t)||sH.some(e=>t.endsWith(e)))||!sV.has(t)&&!sK.some(e=>t.startsWith(e))}(lc(e,"content-type")))return e;let t=await s6(e.data);return t&&(e.headers??={},e.headers["content-encoding"]=t.encoding,e.data=t.data),e},function(e){if("string"==typeof e.data&&lc(e,"content-type"))return e;let[t]=sc.defaults.transformRequest,r=t(e.data,e.headers);if(e.stringifyFunctions){let t=lc(e,"content-type");try{var n;let i=t?sj.q(t).type:void 0;"application/json"===i&&"object"==typeof e.data?(n=e.data,e.data=JSON.stringify(n,(e,t)=>"function"==typeof t?t.toString():t)):e.data=r}catch{e.data=r}}else e.data=r;return e},function(e){return!e.headers||e.headers instanceof sE||Object.setPrototypeOf(e.headers,sE.prototype),e}],ld=[function(e){if(!e.data||"arraybuffer"!==e.config.responseType||e.config.forceBuffer)return e;if(!e.data.byteLength)return e.data=void 0,e;let t=e.headers["content-type"];try{e.data=function(e,t){let r,n;try{let e=sj.q(t);r=e.type,n=e.parameters.charset}catch{return e}if(!function(e,t){return!!e&&la.some(t=>t.test(e))&&(!t||"utf8"===t.toLowerCase().replace("-",""))}(r,n))return e;let i=ls(e,n);return r===lo?JSON.parse(i):i}(e.data,t)}catch(t){throw new InvalidResponseBodyError(e,t)}return e}];var lf=i(606);let{version:lh}={version:"3.0.0-beta.20"};let HttpClient=class HttpClient{stats;maxRetries;minDelayBetweenRetriesMillis;userProvidedRequestInterceptors;logger;timeoutMillis;timeoutMaxMillis;httpAgent;httpsAgent;axios;workflowKey;#s;#l;constructor(e){let{token:t}=e;this.stats=e.apifyClientStats,this.maxRetries=e.maxRetries,this.minDelayBetweenRetriesMillis=e.minDelayBetweenRetriesMillis,this.userProvidedRequestInterceptors=e.requestInterceptors,this.timeoutMillis={short:1e3*e.timeoutShortSecs,medium:1e3*e.timeoutMediumSecs,long:1e3*e.timeoutLongSecs},this.timeoutMaxMillis=1e3*e.timeoutMaxSecs,this.logger=e.logger,this.workflowKey=e.workflowKey||lf.env.APIFY_WORKFLOW_KEY,this.#l=e.userAgentSuffix,this.axios=sc.create({proxy:!1,paramsSerializer:e=>new URLSearchParams(Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).map(e=>{let[t,r]=e;return r instanceof Date?[t,r.toISOString()]:[t,String("boolean"==typeof r?Number(r):r)]})).toString(),validateStatus:null,transformRequest:[],transformResponse:[],responseType:"arraybuffer",timeout:this.timeoutMaxMillis,maxBodyLength:1/0,maxContentLength:-1}),this.axios.defaults.headers=new sE,this.workflowKey&&(this.axios.defaults.headers["X-Apify-Workflow-Key"]=this.workflowKey),t&&(this.axios.defaults.headers.Authorization=`Bearer ${t}`),lp.forEach(e=>this.axios.interceptors.request.use(e)),this.userProvidedRequestInterceptors.forEach(e=>this.axios.interceptors.request.use(e)),ld.forEach(e=>this.axios.interceptors.response.use(e))}async #u(){}async #c(){}async call(e){await this.#u(),this.stats.calls++;let t=this.#p(e);return i5()(t,{retries:this.maxRetries,minTimeout:this.minDelayBetweenRetriesMillis,onRetry:(e,t)=>this.#d(e,t)})}#f(){this.logger.warningOnce("Request body was a stream - retrying will not work, as part of it was already consumed."),this.logger.warningOnce("If you want Apify client to handle retries for you, collect the stream into a buffer before sending it.")}#p(e){let{timeoutSecs:t="medium",...r}=e;return async(n,i)=>{let o;this.stats.requests++;let a=s5(e.data);try{if(a&&(r.maxRedirects=0),o=await this.axios.request({...r,timeout:this.#h(t,i)}),this.#m(o.status))return o;s5(o.data)&&(o.data=await sU(o.data).catch(()=>void 0))}catch(t){return this.#g(t,e,n)}429===o.status&&this.stats.addRateLimitError(i);let s=ApifyApiError.fromResponse(o,i);if(this.#y(o.status))if(a)this.#f();else throw s;return n(s),o}}#m(e){return e<300}#h(e,t){if("noTimeout"===e)return 0;let r="number"==typeof e?1e3*e:this.timeoutMillis[e];return r>this.timeoutMaxMillis&&this.logger.warningOnce(`The requested timeout of ${r/1e3}s exceeds timeoutMaxSecs (${this.timeoutMaxMillis/1e3}s) and is capped at it. Raise timeoutMaxSecs on the client to allow longer request timeouts.`),Math.min(r*2**(t-1),this.timeoutMaxMillis)}#g(e,t,r){if(this.#b(e)&&t.doNotRetryTimeouts)return r(e);if(this.#v(e))if(s5(t.data))this.#f();else throw e;return r(e)}#b(e){return"ECONNABORTED"===e.code}#v(e){return this.#_(e)||this.#w(e)}#w(e){return e instanceof InvalidResponseBodyError}#_(e){let t=e.request&&"object"==typeof e.request,r=e.config&&"object"==typeof e.config;return t&&r}#y(e){return 429===e||e>=500}#d(e,t){t===Math.round(this.maxRetries/2)&&this.logger.warning(`API request failed ${t} times. Max attempts: ${this.maxRetries+1}.
62
62
  Cause:${e.stack}`)}};let ApiClient=class ApiClient{id;safeId;baseUrl;publicBaseUrl;resourcePath;url;apifyClient;httpClient;params;constructor(e){let{baseUrl:t,publicBaseUrl:r,apifyClient:n,httpClient:i,resourcePath:o,id:a,params:s={}}=e;this.id=a,this.safeId=a&&this.toSafeId(a),this.baseUrl=t,this.publicBaseUrl=r,this.resourcePath=o,this.url=a?`${t}/${o}/${ln(this.safeId)}`:`${t}/${o}`,this.apifyClient=n,this.httpClient=i,this.params=s}subResourceOptions(e){return{...{baseUrl:this.buildUrl(),publicBaseUrl:this.publicBaseUrl,apifyClient:this.apifyClient,httpClient:this.httpClient,params:this.buildParams()},...e}}buildUrl(e){return e?`${this.url}/${li(e)}`:this.url}buildPublicUrl(e){let t=this.id?`${this.publicBaseUrl}/${this.resourcePath}/${ln(this.safeId)}`:`${this.publicBaseUrl}/${this.resourcePath}`;return e?`${t}/${li(e)}`:t}buildParams(e){return{...this.params,...e}}toSafeId(e){return e.replaceAll("/","~")}listPaginatedFromCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(e,t)=>(0===e&&(e=void 0),0===t&&(t=void 0),void 0===e)?t:void 0===t?e:Math.min(e,t),{chunkSize:n,...i}=t,o=e({...i,limit:r(t.limit,n)}),a=e=>e[le]??e.items.length;async function*s(){let s=await o;yield*s.items;let l=t.offset??0,u=Math.min(t.limit||s.total,s.total),c=a(s),p=l+c,d=Math.min(s.total-l,u)-c;for(;c>0&&d>0;){let t={...i,limit:r(d,n),offset:p};s=await e(t),yield*s.items,p+=c=a(s),d-=c}}return Object.defineProperty(o,Symbol.asyncIterator,{value:s})}};let ResourceClient=class ResourceClient extends ApiClient{timeoutForWaitForFinish(e,t,r){if(void 0!==e)return e;if(void 0===r)return t;let n=Math.min(r,60);return n<=0?t:n+this.httpClient.timeoutMillis[t]/1e3}async getResource(e,t,r){let n={url:this.buildUrl(),method:"GET",params:this.buildParams(t),timeoutSecs:r};try{let t=await this.httpClient.call(n);return sX(t,e)}catch(e){s1(e,this.id)}}async updateResource(e,t,r){return sX(await this.httpClient.call({url:this.buildUrl(),method:"PUT",params:this.buildParams(),data:t,timeoutSecs:r}),e)}async deleteResource(e){try{await this.httpClient.call({url:this.buildUrl(),method:"DELETE",params:this.buildParams(),timeoutSecs:e})}catch(e){s1(e,this.id)}}async waitForJobFinish(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{waitSecs:n=999999,timeoutSecs:i="noTimeout"}=r,o=1e3*n,a=Date.now(),s=()=>!(Date.now()-a>=o)&&!(t&&iD.includes(t.status));do{let r=Math.max(0,Math.round((o-(Date.now()-a))/1e3)),n={url:this.buildUrl(),method:"GET",params:this.buildParams({waitForFinish:r}),timeoutSecs:i};try{let r=await this.httpClient.call(n);t=sX(r,e)}catch(e){s0(e),t=void 0}t||await new Promise(e=>{setTimeout(e,250)})}while(s())if(!t){let e=this.constructor.name.match(/(\w+)Client/)[1].toLowerCase();throw Error(`Waiting for ${e} to finish failed. Cannot fetch actor ${e} details from the server.`)}return t}};function lm(e){return rD(nR,e)}function lg(e){return new n6({type:"date",coerce:!0,...er(e)})}function ly(e){let t;return()=>t??=e()}let lb=ly(()=>it({total:nY().min(0),offset:nY().min(0),limit:nY().min(1),desc:nX(),count:nY().min(0)})),lv=ly(()=>it({totalBuilds:nY().optional(),totalRuns:nY().optional(),totalUsers:nY().optional(),totalUsers7Days:nY().optional(),totalUsers30Days:nY().optional(),totalUsers90Days:nY().optional(),totalMetamorphs:nY().optional(),lastRunStartedAt:lm({offset:!0}).pipe(lg()).optional(),actorReviewCount:nY().optional(),actorReviewRating:nH().optional(),bookmarkCount:nY().optional(),publicActorRunStats30Days:it({ABORTED:nY().optional(),FAILED:nY().optional(),SUCCEEDED:nY().optional(),"TIMED-OUT":nY().optional(),TOTAL:nY().optional()}).optional()})),l_=ly(()=>it({id:nE(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),name:nE(),username:nE(),title:nE().optional(),stats:lv().nullable().optional()})),lw=ly(()=>lb().extend({items:n5(l_())})),lE=ly(()=>ip(["SOURCE_FILES","GIT_REPO","TARBALL","GITHUB_GIST","SOURCE_CODE"]).or(nE())),lS=ly(()=>it({name:nE(),value:nE().optional(),isSecret:nX().nullable().optional()})),lR=ly(()=>ip(["BASE64","TEXT"]).or(nE())),lO=ly(()=>it({format:lR().optional(),content:nE().optional(),name:nE()})),lT=ly(()=>it({name:nE(),folder:nX()})),lC=ly(()=>n5(ii([lO(),lT()]))),lA=ly(()=>it({versionNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$/),sourceType:lE().nullable(),envVars:n5(lS()).nullable().optional(),applyEnvVarsToBuild:nX().nullable().optional(),buildTag:nE().nullable().optional(),sourceFiles:lC().optional(),gitRepoUrl:nE().nullable().optional(),tarballUrl:nE().nullable().optional(),gitHubGistUrl:nE().nullable().optional()})),lx=ly(()=>ip(["LIMITED_PERMISSIONS","FULL_PERMISSIONS"]).or(nE())),lk=ly(()=>it({build:nE().optional(),timeoutSecs:nY().optional(),memoryMbytes:nY().optional(),restartOnError:nX().optional(),maxItems:nY().nullable().optional(),forcePermissionLevel:lx().nullable().optional()})),lP=ly(()=>it({isEnabled:nX().nullable().optional(),desiredRequestsPerActorRun:nY().nullable().optional(),maxRequestsPerActorRun:nY().nullable().optional(),idleTimeoutSecs:nY().nullable().optional(),build:nE().nullable().optional(),memoryMbytes:nY().nullable().optional(),disableStandbyFieldsOverride:nX().nullable().optional(),shouldPassActorInput:nX().nullable().optional()})),lU=ly(()=>it({body:nE().optional(),contentType:nE().optional()})),lI=ly(()=>it({apifyMarginPercentage:nH(),createdAt:lm({offset:!0}).pipe(lg()),startedAt:lm({offset:!0}).pipe(lg()),notifiedAboutFutureChangeAt:lm({offset:!0}).pipe(lg()).nullable().optional(),notifiedAboutChangeAt:lm({offset:!0}).pipe(lg()).nullable().optional(),reasonForChange:nE().nullable().optional(),isPriceChangeNotificationSuppressed:nX().optional(),forceContainsSignificantPriceChange:nX().optional()})),lL=ly(()=>it({tieredEventPriceUsd:nH()})),lz=ly(()=>iu(nE(),lL())),lN=ly(()=>it({eventTitle:nE(),eventDescription:nE(),eventPriceUsd:nH().optional(),eventTieredPricingUsd:lz().optional(),isPrimaryEvent:nX().optional(),isOneTimeEvent:nX().optional()})),lj=ly(()=>lI().extend({pricingModel:ih("PAY_PER_EVENT"),pricingPerEvent:it({actorChargeEvents:iu(nE(),lN()).optional()}),minimalMaxTotalChargeUsd:nH().nullable().optional()})),lD=ly(()=>it({tieredPricePerUnitUsd:nH()})),l$=ly(()=>iu(nE(),lD())),lM=ly(()=>lI().extend({pricingModel:ih("PRICE_PER_DATASET_ITEM"),unitName:nE(),pricePerUnitUsd:nH().optional(),tieredPricing:l$().optional()})),lF=ly(()=>lI().extend({pricingModel:ih("FLAT_PRICE_PER_MONTH"),trialMinutes:nY(),pricePerUnitUsd:nH()})),lB=ly(()=>lI().extend({pricingModel:ih("FREE")})),lq=ly(()=>ia("pricingModel",[lj(),lM(),lF(),lB()])),lW=ly(()=>it({buildId:nE().optional(),buildNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).nullable().optional(),buildNumberInt:nY().optional(),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional()})),lZ=ly(()=>iu(nE(),lW().nullable())),lK=ly(()=>ip(["NONE","RESIDENTIAL_PROXY_REQUIRED","UNDER_MAINTENANCE"]).or(nE()).nullable()),lV=ly(()=>it({id:nE(),userId:nE(),name:nE(),username:nE(),description:nE().nullable().optional(),restartOnError:nX().optional(),isPublic:nX(),actorPermissionLevel:lx().optional(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),stats:lv(),versions:n5(lA()),pricingInfos:n5(lq()).optional(),defaultRunOptions:lk(),exampleRunInput:lU().nullable().optional(),isDeprecated:nX().nullable().optional(),deploymentKey:nE().optional(),title:nE().nullable().optional(),taggedBuilds:lZ().nullable().optional(),actorStandby:lP().nullable().optional(),readmeSummary:nE().optional(),seoTitle:nE().nullable().optional(),seoDescription:nE().nullable().optional(),pictureUrl:nE().nullable().optional(),standbyUrl:nE().nullable().optional(),notice:lK().optional(),categories:n5(nE()).optional(),isCritical:nX().optional(),isGeneric:nX().optional(),isSourceCodeHidden:nX().optional(),hasNoDataset:nX().optional()})),lJ=ly(()=>it({total:nY(),items:n5(lA())})),lH=ly(()=>it({total:nY(),items:n5(lS())})),lG=ly(()=>ip(["ACTOR.BUILD.ABORTED","ACTOR.BUILD.CREATED","ACTOR.BUILD.FAILED","ACTOR.BUILD.SUCCEEDED","ACTOR.BUILD.TIMED_OUT","ACTOR.RUN.ABORTED","ACTOR.RUN.CREATED","ACTOR.RUN.FAILED","ACTOR.RUN.RESURRECTED","ACTOR.RUN.SUCCEEDED","ACTOR.RUN.TIMED_OUT","TEST"]).or(nE())),lY=ly(()=>it({actorId:nE().nullable().optional(),actorTaskId:nE().nullable().optional(),actorRunId:nE().nullable().optional()})),lQ=ly(()=>ip(["ACTIVE","SUCCEEDED","FAILED"]).or(nE())),lX=ly(()=>it({status:lQ(),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),removedAt:lm({offset:!0}).pipe(lg()).nullable().optional()})),l0=ly(()=>it({totalDispatches:nY().optional()})),l1=ly(()=>it({id:nE(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),userId:nE(),isAdHoc:nX().nullable().optional(),isApifyIntegration:nX().optional(),isEnabled:nX().optional(),actionType:nE().optional(),shouldInterpolateStrings:nX().nullable().optional(),eventTypes:n5(lG()),condition:lY(),ignoreSslErrors:nX(),doNotRetry:nX(),requestUrl:nU({normalize:!0}),lastDispatch:lX().nullable().optional(),stats:l0().nullable().optional()})),l2=ly(()=>lb().extend({items:n5(l1())})),l4=ly(()=>ip(["READY","RUNNING","SUCCEEDED","FAILED","TIMING-OUT","TIMED-OUT","ABORTING","ABORTED"]).or(nE())),l3=ly(()=>ip(["DEVELOPMENT","WEB","API","SCHEDULER","TEST","WEBHOOK","ACTOR","CLI","CI","STANDBY","MCP"]).or(nE())),l6=ly(()=>it({origin:l3(),clientIp:nE().optional(),userAgent:nE().optional()})),l9=ly(()=>it({id:nE(),actId:nE().optional(),userId:nE().optional(),status:l4(),startedAt:lm({offset:!0}).pipe(lg()),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),usageTotalUsd:nH(),buildNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),buildNumberInt:nY().optional(),meta:l6().optional()})),l8=ly(()=>lb().extend({items:n5(l9())})),l5=ly(()=>it({durationMillis:nY().optional(),runTimeSecs:nH().optional(),computeUnits:nH().optional(),imageSizeBytes:nY().nullable().optional()})),l7=ly(()=>it({useCache:nX().nullable().optional(),betaPackages:nX().nullable().optional(),memoryMbytes:nY().nullable().optional(),diskMbytes:nY().nullable().optional()})),ue=ly(()=>it({ACTOR_COMPUTE_UNITS:nH().nullable().optional()})),ut=ly(()=>it({actorSpecification:ih(1).optional(),name:nE().optional(),version:nE().regex(/^[0-9]+(\.[0-9]+)+$/).optional(),buildTag:nE().optional(),environmentVariables:iu(nE(),nE()).optional(),dockerfile:nE().optional(),dockerContextDir:nE().optional(),readme:nE().nullable().optional(),input:iu(nE(),n2()).nullable().optional(),changelog:nE().nullable().optional(),storages:it({dataset:iu(nE(),n2()).optional()}).optional(),defaultMemoryMbytes:ii([nE(),nY()]).optional(),minMemoryMbytes:nY().min(128).optional(),maxMemoryMbytes:nY().min(128).optional(),usesStandbyMode:nX().optional()})),ur=ly(()=>it({id:nE(),actId:nE(),userId:nE(),startedAt:lm({offset:!0}).pipe(lg()),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),status:l4(),meta:l6(),stats:l5().nullable().optional(),options:l7().nullable().optional(),usage:ue().nullable().optional(),usageTotalUsd:nH().nullable().optional(),usageUsd:ue().nullable().optional(),inputSchema:nE().nullable().optional(),readme:nE().nullable().optional(),buildNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),actVersion:it({sourceType:lE().optional(),buildTag:nE().optional(),versionNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$/).optional(),gitRepoUrl:nE().optional(),sourceFiles:n5(lO()).optional()}).optional(),actorDefinition:ut().nullable().optional()})),un=ly(()=>it({origin:l3(),clientIp:nE().nullable().optional(),userAgent:nE().nullable().optional(),scheduleId:nE().nullable().optional(),scheduledAt:lm({offset:!0}).pipe(lg()).nullable().optional()})),ui=ly(()=>it({id:nE(),actId:nE(),userId:nE().optional(),actorTaskId:nE().nullable().optional(),status:l4(),startedAt:lm({offset:!0}).pipe(lg()),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),buildId:nE(),buildNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).optional(),buildNumberInt:nY().optional(),meta:un(),usageTotalUsd:nH(),defaultKeyValueStoreId:nE(),defaultDatasetId:nE(),defaultRequestQueueId:nE()})),uo=ly(()=>lb().extend({items:n5(ui())})),ua=ly(()=>it({inputBodyLen:nY().min(0).nullable().optional(),migrationCount:nY().min(0).optional(),rebootCount:nY().min(0).optional(),restartCount:nY().min(0).optional(),resurrectCount:nY().min(0).optional(),memAvgBytes:nH().optional(),memMaxBytes:nY().min(0).optional(),memCurrentBytes:nY().min(0).optional(),cpuAvgUsage:nH().optional(),cpuMaxUsage:nH().optional(),cpuCurrentUsage:nH().optional(),netRxBytes:nY().min(0).optional(),netTxBytes:nY().min(0).optional(),durationMillis:nY().min(0).optional(),runTimeSecs:nH().min(0).optional(),metamorph:nY().min(0).optional(),computeUnits:nH().min(0).optional()})),us=ly(()=>it({build:nE(),timeoutSecs:nY().min(0),memoryMbytes:nY().min(128).max(32768),diskMbytes:nY().min(0),maxItems:nY().min(0).nullable().optional(),maxTotalChargeUsd:nH().min(0).nullable().optional()})),ul=ly(()=>ip(["ANYONE_WITH_ID_CAN_READ","ANYONE_WITH_NAME_CAN_READ","FOLLOW_USER_SETTING","RESTRICTED"]).or(nE())),uu=ly(()=>it({ACTOR_COMPUTE_UNITS:nH().nullable().optional(),DATASET_READS:nY().nullable().optional(),DATASET_WRITES:nY().nullable().optional(),KEY_VALUE_STORE_READS:nY().nullable().optional(),KEY_VALUE_STORE_WRITES:nY().nullable().optional(),KEY_VALUE_STORE_LISTS:nY().nullable().optional(),REQUEST_QUEUE_READS:nY().nullable().optional(),REQUEST_QUEUE_WRITES:nY().nullable().optional(),DATA_TRANSFER_INTERNAL_GBYTES:nH().nullable().optional(),DATA_TRANSFER_EXTERNAL_GBYTES:nH().nullable().optional(),PROXY_RESIDENTIAL_TRANSFER_GBYTES:nH().nullable().optional(),PROXY_SERPS:nY().nullable().optional()})),uc=ly(()=>it({ACTOR_COMPUTE_UNITS:nH().nullable().optional(),DATASET_READS:nH().nullable().optional(),DATASET_WRITES:nH().nullable().optional(),KEY_VALUE_STORE_READS:nH().nullable().optional(),KEY_VALUE_STORE_WRITES:nH().nullable().optional(),KEY_VALUE_STORE_LISTS:nH().nullable().optional(),REQUEST_QUEUE_READS:nH().nullable().optional(),REQUEST_QUEUE_WRITES:nH().nullable().optional(),DATA_TRANSFER_INTERNAL_GBYTES:nH().nullable().optional(),DATA_TRANSFER_EXTERNAL_GBYTES:nH().nullable().optional(),PROXY_RESIDENTIAL_TRANSFER_GBYTES:nH().nullable().optional(),PROXY_SERPS:nH().nullable().optional()})),up=ly(()=>it({createdAt:lm({offset:!0}).pipe(lg()),actorId:nE(),buildId:nE(),inputKey:nE().nullable().optional()})),ud=ly(()=>it({id:nE(),actId:nE(),userId:nE(),actorTaskId:nE().nullable().optional(),startedAt:lm({offset:!0}).pipe(lg()),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),status:l4(),statusMessage:nE().nullable().optional(),isStatusMessageTerminal:nX().nullable().optional(),meta:un(),pricingInfo:lq().optional(),stats:ua(),chargedEventCounts:iu(nE(),nY()).optional(),options:us(),buildId:nE(),exitCode:nY().nullable().optional(),generalAccess:ul().nullable().optional(),defaultKeyValueStoreId:nE(),defaultDatasetId:nE(),defaultRequestQueueId:nE(),storageIds:it({datasets:it({default:nE().optional()}).catchall(nE()).optional(),keyValueStores:it({default:nE().optional()}).catchall(nE()).optional(),requestQueues:it({default:nE().optional()}).catchall(nE()).optional()}).optional(),buildNumber:nE().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).nullable().optional(),containerUrl:nU({normalize:!0}).optional(),isContainerServerReady:nX().nullable().optional(),gitBranchName:nE().nullable().optional(),usage:uu().nullable().optional(),usageTotalUsd:nH().nullable().optional(),usageUsd:uc().nullable().optional(),metamorphs:n5(up()).nullable().optional(),platformUsageBillingModel:nE().optional()})),uf=ly(()=>it({readCount:nY().optional(),writeCount:nY().optional(),storageBytes:nY().optional(),inflatedBytes:nY().optional()})),uh=ly(()=>it({id:nE(),name:nE().nullable().optional(),userId:nE(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),accessedAt:lm({offset:!0}).pipe(lg()),itemCount:nY().min(0),cleanItemCount:nY().min(0),actId:nE().nullable().optional(),actRunId:nE().nullable().optional(),fields:n5(nE()).nullable().optional(),schema:iu(nE(),n2()).nullable().optional(),consoleUrl:nU({normalize:!0}),itemsPublicUrl:nU({normalize:!0}).optional(),urlSigningSecretKey:nE().nullable().optional(),generalAccess:ul().nullable().optional(),stats:uf().optional()})),um=ly(()=>it({min:nH().nullable().optional(),max:nH().nullable().optional(),nullCount:nY().nullable().optional(),emptyCount:nY().nullable().optional()})),ug=ly(()=>it({fieldStatistics:iu(nE(),um()).nullable().optional()})),uy=ly(()=>it({readCount:nY().optional(),writeCount:nY().optional(),deleteCount:nY().optional(),listCount:nY().optional(),s3StorageBytes:nY().optional(),storageBytes:nY().optional()})),ub=ly(()=>it({id:nE(),name:nE().nullable().optional(),userId:nE().nullable().optional(),username:nE().nullable().optional(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),accessedAt:lm({offset:!0}).pipe(lg()),actId:nE().nullable().optional(),actRunId:nE().nullable().optional(),consoleUrl:nU({normalize:!0}).optional(),keysPublicUrl:nU({normalize:!0}).optional(),recordsPublicUrl:nU({normalize:!0}).optional(),schema:iu(nE(),n2()).nullable().optional(),urlSigningSecretKey:nE().nullable().optional(),generalAccess:ul().nullable().optional(),stats:uy().optional()})),uv=ly(()=>it({key:nE(),size:nY(),recordPublicUrl:nU({normalize:!0})})),u_=ly(()=>it({items:n5(uv()),count:nY(),limit:nY(),exclusiveStartKey:nE().nullable().optional(),isTruncated:nX(),nextExclusiveStartKey:nE().nullable().optional()})),uw=ly(()=>nE()),uE=ly(()=>nE()),uS=ly(()=>lm({offset:!0}).pipe(lg())),uR=ly(()=>lm({offset:!0}).pipe(lg())),uO=ly(()=>lm({offset:!0}).pipe(lg())),uT=ly(()=>nY().min(0)),uC=ly(()=>nY().min(0)),uA=ly(()=>nY()),ux=ly(()=>nX()),uk=ly(()=>it({deleteCount:nY().optional(),headItemReadCount:nY().optional(),readCount:nY().optional(),storageBytes:nY().optional(),writeCount:nY().optional()})),uP=ly(()=>it({id:uw(),name:nE().nullable().optional(),userId:uE(),actId:nE().nullable().optional(),actRunId:nE().nullable().optional(),createdAt:uS(),modifiedAt:uR(),accessedAt:uO(),totalRequestCount:uT(),handledRequestCount:uC(),pendingRequestCount:uA(),hadMultipleClients:ux(),consoleUrl:nU({normalize:!0}),stats:uk().optional(),generalAccess:ul().nullable().optional()})),uU=ly(()=>nE()),uI=ly(()=>nE()),uL=ly(()=>ip(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]).or(nE())),uz=ly(()=>nY()),uN=ly(()=>iu(nE(),n2())),uj=ly(()=>it({uniqueKey:uU(),url:uI(),method:uL().optional(),retryCount:uz().optional(),loadedUrl:nE().nullable().optional(),payload:ii([nE(),iu(nE(),n2())]).nullable().optional(),headers:iu(nE(),n2()).nullable().optional(),userData:uN().optional(),noRetry:nX().nullable().optional(),errorMessages:n5(nE()).nullable().optional(),handledAt:lm({offset:!0}).pipe(lg()).nullable().optional()})),uD=ly(()=>nE()),u$=ly(()=>uj().extend({id:uD().optional()}).required({id:!0})),uM=ly(()=>it({items:n5(u$()),limit:nY(),exclusiveStartId:nE().optional(),cursor:nE().optional(),nextCursor:nE().optional()})),uF=ly(()=>nX()),uB=ly(()=>nX()),uq=ly(()=>it({requestId:uD(),wasAlreadyPresent:uF(),wasAlreadyHandled:uB()})),uW=ly(()=>it({requestId:uD(),uniqueKey:uU(),wasAlreadyPresent:uF(),wasAlreadyHandled:uB()})),uZ=ly(()=>it({id:uD().optional(),uniqueKey:uU(),url:uI(),method:uL().optional()})),uK=ly(()=>it({processedRequests:n5(uW()),unprocessedRequests:n5(uZ())})),uV=ly(()=>it({uniqueKey:uU().optional(),id:uD()})),uJ=ly(()=>it({uniqueKey:uU(),id:uD().optional()})),uH=ly(()=>ii([uV(),uJ()])),uG=ly(()=>it({processedRequests:n5(uH()),unprocessedRequests:n5(uZ())})),uY=ly(()=>it({unlockedCount:nY()})),uQ=ly(()=>lm({offset:!0}).pipe(lg())),uX=ly(()=>it({lockExpiresAt:uQ()})),u0=ly(()=>nY()),u1=ly(()=>it({id:uD(),uniqueKey:uU(),url:uI(),method:uL().optional(),retryCount:uz().optional()})),u2=ly(()=>it({limit:u0(),queueModifiedAt:uR(),hadMultipleClients:ux(),items:n5(u1())})),u4=ly(()=>it({id:uD(),uniqueKey:uU(),url:uI(),method:uL().optional(),retryCount:uz().optional(),lockExpiresAt:uQ()})),u3=ly(()=>it({limit:u0(),queueModifiedAt:uR(),queueHasLockedRequests:nX().optional(),clientKey:nE().optional(),hadMultipleClients:ux(),lockSecs:nY(),items:n5(u4())})),u6=ly(()=>it({totalRuns:nY().optional()})),u9=ly(()=>it({id:nE(),userId:nE(),actId:nE(),actName:nE().nullable().optional(),name:nE(),username:nE().nullable().optional(),actUsername:nE().nullable().optional(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),stats:u6().nullable().optional()})),u8=ly(()=>lb().extend({items:n5(u9())})),u5=ly(()=>it({build:nE().nullable().optional(),timeoutSecs:nY().nullable().optional(),memoryMbytes:nY().nullable().optional(),maxItems:nY().nullable().optional(),maxTotalChargeUsd:nH().nullable().optional(),restartOnError:nX().nullable().optional()})),u7=ly(()=>iu(nE(),n2())),ce=ly(()=>it({publishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),seoTitle:nE().max(60).nullable().optional(),seoDescription:nE().max(160).nullable().optional(),inputSchemaFields:n5(nE()).nullable().optional(),datasetName:nE().nullable().optional(),datasetView:nE().nullable().optional()})),ct=ly(()=>it({id:nE(),userId:nE(),actId:nE(),name:nE(),username:nE().nullable().optional(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),removedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),stats:u6().nullable().optional(),options:u5().nullable().optional(),input:ii([u7(),n5(u7())]).nullable().optional(),title:nE().nullable().optional(),actorStandby:lP().nullable().optional(),standbyUrl:nU({normalize:!0}).nullable().optional(),isPublic:nX().optional(),publicConfig:ce().nullable().optional()})),cr=ly(()=>it({id:nE(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),userId:nE(),isAdHoc:nX().nullable().optional(),shouldInterpolateStrings:nX().nullable().optional(),eventTypes:n5(lG()),condition:lY(),ignoreSslErrors:nX(),doNotRetry:nX().nullable().optional(),requestUrl:nU({normalize:!0}).nullable().optional(),payloadTemplate:nE().nullable().optional(),headersTemplate:nE().nullable().optional(),description:nE().nullable().optional(),lastDispatch:lX().nullable().optional(),stats:l0().nullable().optional()})),cn=ly(()=>lb().extend({unnamed:nX().optional(),items:n5(ub())})),ci=ly(()=>it({id:nE(),name:nE(),userId:nE(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),accessedAt:lm({offset:!0}).pipe(lg()),itemCount:nY(),cleanItemCount:nY(),actId:nE().nullable().optional(),actRunId:nE().nullable().optional(),title:nE().nullable().optional(),username:nE().optional(),generalAccess:ul().nullable().optional(),stats:uf().optional()})),co=ly(()=>lb().extend({unnamed:nX().optional(),items:n5(ci())})),ca=ly(()=>it({id:uw(),name:nE(),userId:uE(),username:nE(),createdAt:uS(),modifiedAt:uR(),accessedAt:uO(),expireAt:lm({offset:!0}).pipe(lg()).optional(),totalRequestCount:uT(),handledRequestCount:uC(),pendingRequestCount:uA(),actId:nE().nullable().optional(),actRunId:nE().nullable().optional(),hadMultipleClients:ux(),generalAccess:ul().nullable().optional(),stats:uk().optional()})),cs=ly(()=>lb().extend({unnamed:nX().optional(),items:n5(ca())})),cl=ly(()=>it({actionType:nE().optional(),condition:lY().optional(),requestUrl:nU({normalize:!0}).nullable().optional(),isAdHoc:nX().optional()})),cu=ly(()=>it({id:nE(),userId:nE(),webhookId:nE(),createdAt:lm({offset:!0}).pipe(lg()),status:lQ(),eventType:lG(),eventData:it({actorId:nE(),actorRunId:nE().optional(),actorBuildId:nE().optional(),actorTaskId:nE().nullable().optional()}).nullable().optional(),webhook:cl().nullable().optional(),calls:n5(it({startedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),finishedAt:lm({offset:!0}).pipe(lg()).nullable().optional(),errorMessage:nE().nullable().optional(),responseStatus:nY().nullable().optional(),responseBody:nE().nullable().optional()})).optional()})),cc=ly(()=>lb().extend({items:n5(cu())})),cp=ly(()=>it({id:nE(),userId:nE(),name:nE(),cronExpression:nE(),timezone:nE(),isEnabled:nX(),isExclusive:nX(),createdAt:lm({offset:!0}).pipe(lg()),modifiedAt:lm({offset:!0}).pipe(lg()),nextRunAt:lm({offset:!0}).pipe(lg()).nullable().optional(),lastRunAt:lm({offset:!0}).pipe(lg()).nullable().optional()})),cd=ly(()=>it({id:nE(),type:ih("RUN_ACTOR"),actorId:nE()})),cf=ly(()=>it({id:nE(),type:ih("RUN_ACTOR_TASK"),actorTaskId:nE()})),ch=ly(()=>ia("type",[cd(),cf()])),cm=ly(()=>cp().extend({actions:n5(ch())})),cg=ly(()=>lb().extend({items:n5(cm())})),cy=ly(()=>it({body:nE().nullable().optional(),contentType:nE().nullable().optional()})),cb=ly(()=>it({id:nE(),type:ih("RUN_ACTOR"),actorId:nE(),runInput:cy().nullable().optional(),runOptions:u5().nullable().optional()})),cv=ly(()=>it({id:nE(),type:ih("RUN_ACTOR_TASK"),actorTaskId:nE(),input:iu(nE(),n2()).nullable().optional()})),c_=ly(()=>ia("type",[cb(),cv()])),cw=ly(()=>cp().extend({description:nE().nullable().optional(),title:nE().nullable().optional(),notifications:it({email:nX().optional()}).optional(),actions:n5(c_())})),cE=ly(()=>it({message:nE(),level:nE(),createdAt:lm({offset:!0}).pipe(lg())})),cS=ly(()=>it({pricingModel:nE(),apifyMarginPercentage:nH().optional(),createdAt:lm({offset:!0}).pipe(lg()).optional(),startedAt:lm({offset:!0}).pipe(lg()).optional(),notifiedAboutChangeAt:lm({offset:!0}).pipe(lg()).nullable().optional(),notifiedAboutFutureChangeAt:lm({offset:!0}).pipe(lg()).nullable().optional(),isPriceChangeNotificationSuppressed:nX().optional(),forceContainsSignificantPriceChange:nX().optional(),isPPEPlatformUsagePaidByUser:nX().optional(),reasonForChange:nE().nullable().optional(),trialMinutes:nY().nullable().optional(),unitName:nE().nullable().optional(),pricePerUnitUsd:nH().nullable().optional(),minimalMaxTotalChargeUsd:nH().nullable().optional(),pricingPerEvent:iu(nE(),n2()).nullable().optional()})),cR=ly(()=>it({id:nE(),title:nE(),name:nE(),username:nE(),userFullName:nE().nullable().optional(),description:nE().nullable().optional(),categories:n5(nE()).optional(),notice:lK().optional(),pictureUrl:nE().nullable().optional(),userPictureUrl:nU({normalize:!0}).nullable().optional(),url:nU({normalize:!0}).nullable().optional(),stats:lv(),currentPricingInfo:cS().optional(),isWhiteListedForAgenticPayments:nX().nullable().optional(),actorReviewCount:nY().optional(),actorReviewRating:nH().optional(),bookmarkCount:nY().optional(),badge:nE().nullable().optional(),readmeSummary:nE().optional()})),cO=ly(()=>lb().extend({items:n5(cR())})),cT=ly(()=>it({bio:nE().nullable().optional(),name:nE().optional(),pictureUrl:nU({normalize:!0}).nullable().optional(),githubUsername:nE().nullable().optional(),websiteUrl:nU({normalize:!0}).nullable().optional(),twitterUsername:nE().nullable().optional()})),cC=ly(()=>it({name:nE(),description:nE().nullable(),availableCount:nY()})),cA=ly(()=>it({password:nE(),groups:n5(cC())})),cx=ly(()=>iu(nE(),nY())),ck=ly(()=>it({id:nE().optional(),description:nE().optional(),isEnabled:nX().optional(),monthlyBasePriceUsd:nH().optional(),monthlyUsageCreditsUsd:nH().optional(),usageDiscountPercent:nH().optional(),enabledPlatformFeatures:n5(nE()).optional(),maxMonthlyUsageUsd:nH().optional(),maxActorMemoryGbytes:nH().optional(),maxMonthlyActorComputeUnits:nH().optional(),maxMonthlyResidentialProxyGbytes:nH().optional(),maxMonthlyProxySerps:nY().optional(),maxMonthlyExternalDataTransferGbytes:nH().optional(),maxActorCount:nY().optional(),maxActorTaskCount:nY().optional(),dataRetentionDays:nY().optional(),availableProxyGroups:cx(),teamAccountSeatCount:nY().optional(),supportLevel:nE().optional(),availableAddOns:n5(nE()).optional(),tier:nE().optional(),apiRateLimitBoosts:nY().optional(),maxScheduleCount:nY().optional(),maxConcurrentActorRuns:nY().optional(),planPricing:iu(nE(),n2()).optional()})),cP=ly(()=>it({isEnabled:nX(),disabledReason:nE().nullable(),disabledReasonType:nE().nullable(),isTrial:nX(),trialExpirationAt:lm({offset:!0}).pipe(lg()).nullable()})),cU=ly(()=>it({ACTORS:cP(),STORAGE:cP(),SCHEDULER:cP(),PROXY:cP(),PROXY_EXTERNAL_ACCESS:cP(),PROXY_RESIDENTIAL:cP(),PROXY_SERPS:cP(),WEBHOOKS:cP(),ACTORS_PUBLIC_ALL:cP(),ACTORS_PUBLIC_DEVELOPER:cP()})),cI=ly(()=>it({id:nE().optional(),username:nE(),profile:cT().optional(),email:nE().optional(),proxy:cA().optional(),plan:ck().optional(),effectivePlatformFeatures:cU().optional(),createdAt:lm({offset:!0}).pipe(lg()).optional(),isPaying:nX().optional()})),cL=ly(()=>it({startAt:lm({offset:!0}).pipe(lg()),endAt:lm({offset:!0}).pipe(lg())})),cz=ly(()=>it({quantityAbove:nH(),discountPercent:nH(),tierQuantity:nH(),unitPriceUsd:nH(),priceUsd:nH()})),cN=ly(()=>it({quantity:nH(),baseAmountUsd:nH(),baseUnitPriceUsd:nH().optional(),amountAfterVolumeDiscountUsd:nH().optional(),priceTiers:n5(cz()).optional()})),cj=ly(()=>iu(nE(),cN())),cD=ly(()=>iu(nE(),cN())),c$=ly(()=>it({date:lm({offset:!0}).pipe(lg()),serviceUsage:cD(),totalUsageCreditsUsd:nH()})),cM=ly(()=>it({usageCycle:cL(),monthlyServiceUsage:cj(),dailyServiceUsages:n5(c$()),totalUsageCreditsUsdBeforeVolumeDiscount:nH(),totalUsageCreditsUsdAfterVolumeDiscount:nH()})),cF=ly(()=>it({maxMonthlyUsageUsd:nH(),maxMonthlyActorComputeUnits:nH(),maxMonthlyExternalDataTransferGbytes:nH(),maxMonthlyProxySerps:nY(),maxMonthlyResidentialProxyGbytes:nH(),maxActorMemoryGbytes:nH(),maxActorCount:nY(),maxActorTaskCount:nY(),maxConcurrentActorJobs:nY(),maxTeamAccountSeatCount:nY(),dataRetentionDays:nY(),maxScheduleCount:nY().optional()})),cB=ly(()=>it({monthlyUsageUsd:nH(),monthlyActorComputeUnits:nH(),monthlyExternalDataTransferGbytes:nH(),monthlyProxySerps:nY(),monthlyResidentialProxyGbytes:nH(),actorMemoryGbytes:nH(),actorCount:nY(),actorTaskCount:nY(),activeActorJobCount:nY(),teamAccountSeatCount:nY(),scheduleCount:nY().optional()})),cq=ly(()=>it({monthlyUsageCycle:cL(),limits:cF(),current:cB()})),cW=ii([ip(["short","medium","long","noTimeout"]),nH().positive()]).optional(),cZ={timeoutSecs:cW},cK=ie(cZ);let ActorEnvVarClient=class ActorEnvVarClient extends ResourceClient{constructor(e){super({resourcePath:"env-vars",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(lS(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(lS(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}};let ResourceCollectionClient=class ResourceCollectionClient extends ApiClient{async listResources(e,t,r){return sX(await this.httpClient.call({url:this.buildUrl(),method:"GET",params:this.buildParams(t),timeoutSecs:r}),e)}listResourcesPaginated(e,t,r){let{timeoutSecs:n=r,...i}=t;return this.listPaginatedFromCallback(async t=>this.listResources(e,t,n),i)}async createResource(e,t,r){return sX(await this.httpClient.call({url:this.buildUrl(),method:"POST",params:this.buildParams(),data:t,timeoutSecs:r}),e)}async getOrCreateResource(e,t,r,n){return sX(await this.httpClient.call({url:this.buildUrl(),method:"POST",params:this.buildParams({name:t}),data:r,timeoutSecs:n}),e)}};let cV=sY.optional();let ActorEnvVarCollectionClient=class ActorEnvVarCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"env-vars",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.listResourcesPaginated(lH(),{},t)}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,cV);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(lS(),e,r)}};var cJ=((A={}).Active="ACTIVE",A.Succeeded="SUCCEEDED",A.Failed="FAILED",A),cH=((x={}).SourceFiles="SOURCE_FILES",x.GitRepo="GIT_REPO",x.Tarball="TARBALL",x.GitHubGist="GITHUB_GIST",x.SourceCode="SOURCE_CODE",x),cG=((k={}).RunActor="RUN_ACTOR",k.RunActorTask="RUN_ACTOR_TASK",k),cY=((P={}).Actors="ACTORS",P.Storage="STORAGE",P.ProxySERPS="PROXY_SERPS",P.Scheduler="SCHEDULER",P.Webhooks="WEBHOOKS",P.Proxy="PROXY",P.ProxyExternalAccess="PROXY_EXTERNAL_ACCESS",P);let cQ=nE().min(1);let ActorVersionClient=class ActorVersionClient extends ResourceClient{constructor(e){super({resourcePath:"versions",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(lA(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(lA(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}envVar(e){return sW(e,cQ),new ActorEnvVarClient(this.subResourceOptions({id:e}))}envVars(){return new ActorEnvVarCollectionClient(this.subResourceOptions())}};let cX=sY.optional();let ActorVersionCollectionClient=class ActorVersionCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"versions",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.listResourcesPaginated(lJ(),{},t)}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,cX);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(lA(),e,r)}};var c0=i(287).Buffer;let c1=ie({raw:nX().optional(),...cZ});let LogClient=class LogClient extends ResourceClient{constructor(e){super({resourcePath:"logs",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="long",...r}=sW(e,c1,"LogOptions"),n={url:this.buildUrl(),method:"GET",params:this.buildParams(r),timeoutSecs:t};try{return(await this.httpClient.call(n)).data}catch(e){s1(e,this.id)}}async stream(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="long",raw:r}=sW(e,c1,"LogOptions"),n={url:this.buildUrl(),method:"GET",params:this.buildParams({stream:!0,raw:r}),responseType:"stream",timeoutSecs:t};try{return(await this.httpClient.call(n)).data}catch(e){s1(e,this.id)}}};let LoggerActorRedirect=class LoggerActorRedirect extends Logger{constructor(e={}){super({skipTime:!0,level:N.DEBUG,...e})}_log(e,t,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(e>this.options.level)return;if(r||n)throw Error("Redirect logger does not use other arguments than level and message");let{prefix:o}=i;o=o?`${o}`:"";let a="";this.options.skipTime||(a=`${new Date().toISOString().replace("Z","").replace("T"," ")} `);let s=`${i0().gray(a)}${i0().cyan(o)}${t||""}`;return this._outputWithConsole(N.INFO,s),s}};let StreamedLog=class StreamedLog{#E;#S=[];#R=/(?:\n|^)(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/g;#O;#T;#C=null;#A=!1;constructor(e){let{toLog:t,logClient:r,fromStart:n=!0}=e;this.#E=t,this.#T=r,this.#O=n?null:new Date}start(){if(this.#C)throw Error("Streaming task already active");this.#A=!1,this.#C=this.#x()}async stop(){if(!this.#C)throw Error("Streaming task is not active");this.#A=!0;try{await this.#C}catch(e){if(!(e instanceof Error&&"AbortError"===e.name))throw e}finally{this.#C=null}}async #x(){try{let e=await this.#T.stream({raw:!0});if(!e)return;let t=await this.#k(e),r=c0.from(t).toString().trim();r.length&&this.#E.info(r)}catch(e){i9.warning("Log redirection stopped due to error",e)}}async #k(e){let t=new Uint8Array;for await(let r of e){let e=new Uint8Array(t.length+r.length);e.set(t,0),e.set(r,t.length);let n=e.lastIndexOf(10);if(t=e.slice(n),this.#S.push(c0.from(e.slice(0,n))),this.#P(),this.#A)break}return t}#P(){let e=c0.concat(this.#S).toString().split(this.#R).slice(1),t=e.filter((e,t)=>t%2==0),r=e.filter((e,t)=>t%2!=0);this.#S=[],t.forEach((e,t)=>{let n=r[t];this.#O&&new Date(e)<this.#O||this.#E.info((e+n).trim())})}};let c2=ie({waitForFinish:nH().optional(),...cZ}),c4=ie({waitSecs:nH().optional(),...cZ});let BuildClient=class BuildClient extends ResourceClient{constructor(e){super({resourcePath:"actor-builds",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t,...r}=sW(e,c2,"BuildClientGetOptions");return this.getResource(ur(),r,this.timeoutForWaitForFinish(t,"short",r.waitForFinish))}async abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("abort"),method:"POST",params:this.buildParams(),timeoutSecs:t}),ur())}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async getOpenApiDefinition(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions");return(await this.httpClient.call({url:this.buildUrl("openapi.json"),method:"GET",params:this.buildParams(),timeoutSecs:t})).data}async waitForFinish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,c4,"BuildClientWaitForFinishOptions");return this.waitForJobFinish(ur(),t)}log(){return new LogClient(this.subResourceOptions({resourcePath:"log"}))}};let c3=ie({...s7,desc:nX().optional(),...cZ});let BuildCollectionClient=class BuildCollectionClient extends ResourceCollectionClient{constructor(e){super({...e,resourcePath:e.resourcePath||"actor-builds"})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,c3,"BuildCollectionClientListOptions");return this.listResourcesPaginated(l8(),t,"medium")}};let c6=ix(sG,"Expected an object"),c9=ie({clean:nX().optional(),desc:nX().optional(),flatten:n5(nE()).optional(),fields:n5(nE()).optional(),omit:n5(nE()).optional(),...s7,skipEmpty:nX().optional(),skipHidden:nX().optional(),unwind:ii([nE(),n5(nE())]).optional(),view:nE().optional(),signature:nE().optional(),...cZ}),c8=ie({attachment:nX().optional(),bom:nX().optional(),clean:nX().optional(),delimiter:nE().optional(),desc:nX().optional(),flatten:n5(nE()).optional(),fields:n5(nE()).optional(),omit:n5(nE()).optional(),limit:nH().min(0).optional(),offset:nH().min(0).optional(),skipEmpty:nX().optional(),skipHeaderRow:nX().optional(),skipHidden:nX().optional(),unwind:ii([nE(),n5(nE())]).optional(),view:nE().optional(),xmlRoot:nE().optional(),xmlRow:nE().optional(),signature:nE().optional(),...cZ}),c5=ii([c6,nE(),n5(ii([c6,nE()]))]),c7=ie({clean:nX().optional(),desc:nX().optional(),flatten:n5(nE()).optional(),fields:n5(nE()).optional(),omit:n5(nE()).optional(),limit:nH().min(0).optional(),offset:nH().min(0).optional(),skipEmpty:nX().optional(),skipHidden:nX().optional(),unwind:ii([nE(),n5(nE())]).optional(),view:nE().optional(),expiresInSecs:nH().optional(),...cZ});let DatasetClient=class DatasetClient extends ResourceClient{constructor(e){super({resourcePath:"datasets",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(uh(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(uh(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}listItems(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=this;let{timeoutSecs:r="long",...n}=sW(e,c9,"DatasetClientListItemOptions"),i=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=await t.httpClient.call({url:t.buildUrl("items"),method:"GET",params:t.buildParams(e),timeoutSecs:r});return t.#U(n,e.desc??!1)};return this.listPaginatedFromCallback(i,n)}async downloadItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pt);let{timeoutSecs:r="long",...n}=sW(t,c8,"DatasetClientDownloadItemsOptions"),{data:i}=await this.httpClient.call({url:this.buildUrl("items"),method:"GET",params:this.buildParams({format:e,...n}),forceBuffer:!0,timeoutSecs:r});return i}async pushItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,c5);let{timeoutSecs:r="medium"}=sW(t,cK,"TimeoutOptions");await this.httpClient.call({url:this.buildUrl("items"),method:"POST",headers:{"content-type":"application/json; charset=utf-8"},data:e,params:this.buildParams(),doNotRetryTimeouts:!0,timeoutSecs:r})}async getStatistics(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("statistics"),method:"GET",params:this.buildParams(),timeoutSecs:t}),ug())}async createItemsPublicUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="long",expiresInSecs:r,...n}=sW(e,c7,"DatasetClientCreateItemsUrlOptions"),i=await this.get({timeoutSecs:t}),o=new URL(this.buildPublicUrl("items"));if(i?.urlSigningSecretKey){let e=await sN({resourceId:i.id,urlSigningSecretKey:i.urlSigningSecretKey,expiresInMillis:r?1e3*r:void 0});o.searchParams.set("signature",e)}return(o=lt(o,n)).toString()}#U(e,t){return Object.defineProperty({items:e.data,total:Number(e.headers["x-apify-pagination-total"]),offset:Number(e.headers["x-apify-pagination-offset"]),count:e.data.length,limit:Number(e.headers["x-apify-pagination-limit"]),desc:JSON.parse(e.headers["x-apify-pagination-desc"]??t)},le,{value:Number(e.headers["x-apify-pagination-count"])||0})}};var pe=((U={}).JSON="json",U.JSONL="jsonl",U.XML="xml",U.HTML="html",U.CSV="csv",U.XLSX="xlsx",U.RSS="rss",U);let pt=ip([...new Set(Object.values(pe).map(e=>e.toLowerCase()))]),pr=ie({limit:nH().min(0).optional(),exclusiveStartKey:nE().optional(),collection:nE().optional(),prefix:nE().optional(),signature:nE().optional(),...cZ}),pn=nE().min(1),pi=ie({limit:nH().min(0).optional(),exclusiveStartKey:nE().optional(),collection:nE().optional(),prefix:nE().optional(),expiresInSecs:nH().optional(),...cZ}),po=nE(),pa=ie({buffer:nX().optional(),stream:nX().optional(),disableRedirect:nX().optional(),signature:nE().optional(),...cZ}),ps=ie({key:nE(),value:ix(e=>void 0!==e&&"symbol"!=typeof e&&"bigint"!=typeof e&&"function"!=typeof e&&("number"!=typeof e||Number.isFinite(e)),"Expected a JSON-serializable value, binary data, or a stream"),contentType:nE().min(1).optional()}),pl=ie({...cZ,doNotRetryTimeouts:nX().optional()});let KeyValueStoreClient=class KeyValueStoreClient extends ResourceClient{constructor(e){super({resourcePath:"key-value-stores",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(ub(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="long"}=sW(t,cK,"TimeoutOptions");return this.updateResource(ub(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}listKeys(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=this;let{timeoutSecs:r="medium",...n}=sW(e,pr,"KeyValueClientListKeysOptions"),i=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return sX(await t.httpClient.call({url:t.buildUrl("keys"),method:"GET",params:t.buildParams(e),timeoutSecs:r}),u_())},o=i(n);async function*a(){let e=await o;yield*e.items;let t=n.limit?n.limit-e.items.length:void 0;for(;e.items.length>0&&null!=e.nextExclusiveStartKey&&(void 0===t||t>0);){let r={...n,limit:t,exclusiveStartKey:e.nextExclusiveStartKey};e=await i(r),yield*e.items,t&&(t-=e.items.length)}}return Object.defineProperty(o,Symbol.asyncIterator,{value:a})}async getRecordPublicUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pn);let{timeoutSecs:r="long"}=sW(t,cK,"TimeoutOptions"),n=await this.get({timeoutSecs:r}),i=new URL(this.buildPublicUrl(["records",e]));if(n?.urlSigningSecretKey){let t=await sz(n.urlSigningSecretKey,e);i.searchParams.append("signature",t)}return i.toString()}async createKeysPublicUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="long",expiresInSecs:r,...n}=sW(e,pi,"KeyValueClientCreateKeysUrlOptions"),i=await this.get({timeoutSecs:t}),o=new URL(this.buildPublicUrl("keys"));if(i?.urlSigningSecretKey){let e=await sN({resourceId:i.id,urlSigningSecretKey:i.urlSigningSecretKey,expiresInMillis:r?1e3*r:void 0});o.searchParams.set("signature",e)}return(o=lt(o,n)).toString()}async recordExists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutSecs:r="long"}=sW(t,cK,"TimeoutOptions"),n={url:this.buildUrl(["records",e]),method:"HEAD",params:this.buildParams(),timeoutSecs:r};try{return await this.httpClient.call(n),!0}catch(e){s0(e)}return!1}async getRecord(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,po);let r=sW(t,pa,"KeyValueClientGetRecordOptions");if(r.stream&&1)throw Error("The stream option can only be used in Node.js environment.");"disableRedirect"in r&&i9.deprecated("The disableRedirect option for getRecord() is deprecated. It has no effect and will be removed in the following major release.");let n={attachment:"true"};r.signature&&(n.signature=r.signature);let i={url:this.buildUrl(["records",e]),method:"GET",params:this.buildParams(n),timeoutSecs:r.timeoutSecs??"long"};r.buffer&&(i.forceBuffer=!0),r.stream&&(i.responseType="stream");try{let t=await this.httpClient.call(i);return{key:e,value:t.data,contentType:t.headers["content-type"]}}catch(e){s0(e)}}async setRecord(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,ps);let r=sW(t,pl,"KeyValueStoreRecordOptions"),{key:n}=e,{value:i,contentType:o}=e,{timeoutSecs:a="long",doNotRetryTimeouts:s}=r,l=s5(i)||s9(i);if(o||(o=l?"application/octet-stream":"string"==typeof i?"text/plain; charset=utf-8":"application/json; charset=utf-8"),o.startsWith("application/json")&&!l&&"string"!=typeof i)try{i=JSON.stringify(i,null,2)}catch(e){throw Error(`The record value cannot be stringified to JSON. Please provide other content type.
63
- Cause: ${e.message}`)}let u={url:this.buildUrl(["records",n]),method:"PUT",params:this.buildParams(),data:i,headers:o?{"content-type":o}:void 0,doNotRetryTimeouts:s,timeoutSecs:a};await this.httpClient.call(u)}async deleteRecord(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,po);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");await this.httpClient.call({url:this.buildUrl(["records",e]),method:"DELETE",params:this.buildParams(),timeoutSecs:r})}};let pu=ie({limit:nH().min(0).optional(),...cZ}),pc=ie({lockSecs:nH(),limit:nH().min(0).optional(),...cZ}),pp=ix(e=>sG(e)&&void 0===e.id,"Expected a request object without an `id`"),pd=ie({forefront:nX().optional(),...cZ}),pf=n5(pp).min(1).max(25),ph=n5(pp).min(1),pm=nX().optional(),pg=nH().optional(),py=n5(ix(e=>sG(e)&&("string"==typeof e.id||"string"==typeof e.uniqueKey),"Expected a request object with an `id` or a `uniqueKey`")).min(1).max(25),pb=nE(),pv=ix(e=>sG(e)&&"string"==typeof e.id,"Expected a request object with an `id`"),p_=ie({lockSecs:nH(),forefront:nX().optional(),...cZ}),pw=n5(ip(["locked","pending"])).min(1),pE=ie({limit:nH().min(0).optional(),cursor:nE().optional(),filter:pw.optional(),...cZ}),pS=ie({limit:nH().min(0).optional(),maxPageLimit:nH().default(1e3),cursor:nE().optional(),filter:pw.optional(),...cZ});let RequestQueueClient=class RequestQueueClient extends ResourceClient{#I;#L;constructor(e,t={}){super({resourcePath:"request-queues",...e}),this.#I=t.clientKey,this.#L=t.timeoutSecs}#z(e,t){return void 0!==e?e:void 0===this.#L||this.httpClient.timeoutMillis[t]/1e3<=this.#L?t:this.#L}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return this.getResource(uP(),{},this.#z(t,"short"))}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");return this.updateResource(uP(),e,this.#z(r,"short"))}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return this.deleteResource(this.#z(t,"short"))}async listHead(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pu,"RequestQueueClientListHeadOptions");return sX(await this.httpClient.call({url:this.buildUrl("head"),method:"GET",timeoutSecs:this.#z(t.timeoutSecs,"short"),params:this.buildParams({limit:t.limit,clientKey:this.#I})}),u2())}async listAndLockHead(e){let t=sW(e,pc,"RequestQueueClientListAndLockHeadOptions");return sX(await this.httpClient.call({url:this.buildUrl("head/lock"),method:"POST",timeoutSecs:this.#z(t.timeoutSecs,"medium"),params:this.buildParams({limit:t.limit,lockSecs:t.lockSecs,clientKey:this.#I})}),u3())}async addRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pp);let r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests"),method:"POST",timeoutSecs:this.#z(r.timeoutSecs,"short"),data:e,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uq())}async addRequestBatch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pf);let r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/batch"),method:"POST",timeoutSecs:this.#z(r.timeoutSecs,"medium"),data:e,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uK())}async addRequestBatchWithRetries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{forefront:r,timeoutSecs:n,maxUnprocessedRequestsRetries:i=3,minDelayBetweenUnprocessedRequestsRetriesMillis:o=500}=t,a=e,s=[],l=[];for(let t=0;t<1+i;t++){try{let i=await this.addRequestBatch(a,{forefront:r,timeoutSecs:n});s.push(...i.processedRequests),l=i.unprocessedRequests,0!==l.length&&this.httpClient.stats.addRateLimitError(t+1);let o=s.map(e=>{let{uniqueKey:t}=e;return t});if(a=e.filter(e=>{let{uniqueKey:t}=e;return!o.includes(t)}),0===a.length)break}catch(r){if(r instanceof ResponseValidationError)throw r;i9.exception(r,"Request batch insert failed");let t=s.map(e=>{let{uniqueKey:t}=e;return t});l=e.filter(e=>{let{uniqueKey:r}=e;return!t.includes(r)}).map(e=>{let{method:t,uniqueKey:r,url:n}=e;return{method:t,uniqueKey:r,url:n}});break}let i=Math.floor((1+Math.random())*2**t*o);await new Promise(e=>{setTimeout(e,i)})}return{processedRequests:s,unprocessedRequests:l}}async batchAddRequests(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{forefront:r,timeoutSecs:n,maxUnprocessedRequestsRetries:i=3,maxParallel:o=5,minDelayBetweenUnprocessedRequestsRetriesMillis:a=500}=t;sW(e,ph),sW(r,pm),sW(n,cW),sW(i,pg),sW(o,pg),sW(a,pg);let s=new Set,l=[],u=9437184-Math.ceil(9437184*1e-4),c=0;for(;c<e.length;){let r=function(e,t,r){let n=e=>(0,new Blob([e]).size);if(n(JSON.stringify(e))<t)return e;let i=[],o=2;for(let a=0;a<e.length;a++){let s=e[a],l=n(JSON.stringify(s));if(l>t)throw Error(`RequestQueueClient.batchAddRequests: The size of the request with index: ${r+a} exceeds the maximum allowed size (${t} bytes).`);if(o+l>=t)break;o+=l,i.push(s)}return i}(e.slice(c,c+25),u,c),n=this.addRequestBatchWithRetries(r,t);s.add(n),n.then(e=>{s.delete(n),l.push(e)},()=>void 0),s.size>=o&&await Promise.race(s),c+=r.length}await Promise.all(s);let p={processedRequests:[],unprocessedRequests:[]};return l.forEach(e=>{let{processedRequests:t,unprocessedRequests:r}=e;p.processedRequests.push(...t),p.unprocessedRequests.push(...r)}),p}async batchDeleteRequests(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,py);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/batch"),method:"DELETE",timeoutSecs:this.#z(r,"short"),data:e,params:this.buildParams({clientKey:this.#I})}),uG())}async getRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pb);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions"),n={url:this.buildUrl(["requests",e]),method:"GET",timeoutSecs:this.#z(r,"short"),params:this.buildParams()};try{let e=await this.httpClient.call(n);return sX(e,u$())}catch(e){s0(e)}}async updateRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pv);let r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl(["requests",e.id]),method:"PUT",timeoutSecs:this.#z(r.timeoutSecs,"medium"),data:e,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uq())}async deleteRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pb);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");await this.httpClient.call({url:this.buildUrl(["requests",e]),method:"DELETE",timeoutSecs:this.#z(r,"short"),params:this.buildParams({clientKey:this.#I})})}async prolongRequestLock(e,t){sW(e,pb);let r=sW(t,p_,"RequestQueueClientProlongRequestLockOptions");return sX(await this.httpClient.call({url:this.buildUrl(["requests",e,"lock"]),method:"PUT",timeoutSecs:this.#z(r.timeoutSecs,"medium"),params:this.buildParams({forefront:r.forefront,lockSecs:r.lockSecs,clientKey:this.#I})}),uX())}async deleteRequestLock(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pb);let r=sW(t,pd,"RequestQueueClientDeleteRequestLockOptions");await this.httpClient.call({url:this.buildUrl(["requests",e,"lock"]),method:"DELETE",timeoutSecs:this.#z(r.timeoutSecs,"short"),params:this.buildParams({forefront:r.forefront,clientKey:this.#I})})}listRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=this;let{timeoutSecs:r,...n}=sW(e,pE,"RequestQueueClientListRequestsOptions"),i=this.#z(r,"medium"),o=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return sX(await t.httpClient.call({url:t.buildUrl("requests"),method:"GET",timeoutSecs:i,params:t.buildParams({...e,filter:e.filter?e.filter.join(","):void 0,clientKey:t.#I})}),uM())},a=o(n);async function*s(){let e=await a;yield*e.items;let t=n.limit?n.limit-e.items.length:void 0;for(;e.items.length>0&&e.nextCursor&&(void 0===t||t>0);){let r={...n,limit:t,cursor:e.nextCursor};e=await o(r),yield*e.items,t&&(t-=e.items.length)}}return Object.defineProperty(a,Symbol.asyncIterator,{value:s})}async unlockRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/unlock"),method:"POST",timeoutSecs:this.#z(t,"long"),params:this.buildParams({clientKey:this.#I})}),uY())}paginateRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{limit:t,cursor:r,filter:n,maxPageLimit:i,timeoutSecs:o}=sW(e,pS,"RequestQueueClientPaginateRequestsOptions");return new RequestQueuePaginationIterator({getPage:async e=>this.listRequests({...e,filter:n,timeoutSecs:o}),limit:t,cursor:r,maxPageLimit:i})}};let pR=ie({waitForFinish:nH().optional(),...cZ}),pO=ie({gracefully:nX().optional(),...cZ}),pT=nE(),pC=ie({contentType:nE().optional(),build:nE().optional(),...cZ}),pA=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().optional(),maxItems:nH().optional(),maxTotalChargeUsd:nH().optional(),restartOnError:nX().optional(),...cZ}),px=ie({eventName:nE(),count:nH().default(1),idempotencyKey:nE().optional(),...cZ}),pk=ie({waitSecs:nH().optional(),...cZ});let RunClient=class RunClient extends ResourceClient{constructor(e){super({...e,resourcePath:e.resourcePath||"actor-runs"})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t,...r}=sW(e,pR,"RunGetOptions");return this.getResource(ud(),r,this.timeoutForWaitForFinish(t,"short",r.waitForFinish))}async abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium",...r}=sW(e,pO,"RunAbortOptions");return sX(await this.httpClient.call({url:this.buildUrl("abort"),method:"POST",params:this.buildParams(r),timeoutSecs:t}),ud())}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async metamorph(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};sW(e,pT);let n=sW(r,pC,"RunMetamorphOptions"),i={targetActorId:this.toSafeId(e),build:n.build},o={url:this.buildUrl("metamorph"),method:"POST",data:t,params:this.buildParams(i),stringifyFunctions:!0,timeoutSecs:n.timeoutSecs??"medium"};return n.contentType&&(o.headers={"content-type":n.contentType}),sX(await this.httpClient.call(o),ud())}async reboot(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions"),r={url:this.buildUrl("reboot"),method:"POST",timeoutSecs:t};return sX(await this.httpClient.call(r),ud())}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(ud(),e,r)}async resurrect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium",runTimeoutSecs:r,...n}=sW(e,pA,"RunResurrectOptions");return sX(await this.httpClient.call({url:this.buildUrl("resurrect"),method:"POST",params:this.buildParams({...n,timeout:r}),timeoutSecs:t}),ud())}async charge(e){let{eventName:t,count:r,idempotencyKey:n,timeoutSecs:i="short"}=sW(e,px,"RunChargeOptions"),o=(Math.random()+1).toString(36).slice(3,8),a=n??`${this.id}-${t}-${Date.now()}-${o}`,s={url:this.buildUrl("charge"),method:"POST",data:{eventName:t,count:r},headers:{"idempotency-key":a},timeoutSecs:i};return await this.httpClient.call(s)}async waitForFinish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pk,"RunWaitForFinishOptions");return this.waitForJobFinish(ud(),t)}dataset(){return new DatasetClient(this.subResourceOptions({resourcePath:"dataset"}))}keyValueStore(){return new KeyValueStoreClient(this.subResourceOptions({resourcePath:"key-value-store"}))}requestQueue(){return new RequestQueueClient(this.subResourceOptions({resourcePath:"request-queue"}))}log(){return new LogClient(this.subResourceOptions({resourcePath:"log"}))}async getStreamedLog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};sW(e.timeoutSecs,cW);let{fromStart:t=!0,timeoutSecs:r="long"}=e,{toLog:n}=e}};let pP=ip(ij),pU=ie({...s7,desc:nX().optional(),status:ii([pP,n5(pP)]).optional(),startedBefore:ii([n9(),nE()]).optional(),startedAfter:ii([n9(),nE()]).optional(),...cZ});let RunCollectionClient=class RunCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"runs",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pU,"RunCollectionListOptions");return this.listResourcesPaginated(uo(),t,"medium")}};let pI=ie({...s7,desc:nX().optional(),...cZ}),pL=sY.optional();let WebhookCollectionClient=class WebhookCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"webhooks",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pI,"WebhookCollectionListOptions");return this.listResourcesPaginated(l2(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pL);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(cr(),e,r)}};let pz=ie({build:nE().optional(),contentType:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitForFinish:nH().optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),forcePermissionLevel:ip(iq).optional(),...cZ}),pN=ie({build:nE().optional(),contentType:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitSecs:nH().min(0).optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),log:ii([new n0({type:"null",...er(void 0)}),function(e,t={}){let r=new iA({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...er(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}(Log),ih("default")]).optional(),restartOnError:nX().optional(),forcePermissionLevel:ip(iq).optional(),...cZ}),pj=ie({build:nE().optional(),contentType:nE().optional(),...cZ}),pD=nE().min(1),p$=ie({betaPackages:nX().optional(),tag:nE().optional(),useCache:nX().optional(),waitForFinish:nH().optional(),...cZ}),pM=ie({waitForFinish:nH().optional(),...cZ}),pF=ie({status:ip(ij).optional(),origin:ip(i$).optional()});let ActorClient=class ActorClient extends ResourceClient{constructor(e){super({resourcePath:"actors",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(lV(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(lV(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async start(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sW(t,pz,"ActorStartOptions"),{waitForFinish:n,runTimeoutSecs:i,memory:o,build:a,maxItems:s,maxTotalChargeUsd:l,restartOnError:u,forcePermissionLevel:c,timeoutSecs:p}=r,d={waitForFinish:n,timeout:i,memory:o,build:a,webhooks:s2(r.webhooks),maxItems:s,maxTotalChargeUsd:l,restartOnError:u,forcePermissionLevel:c},f={url:this.buildUrl("runs"),method:"POST",data:e,params:this.buildParams(d),stringifyFunctions:!0,timeoutSecs:this.timeoutForWaitForFinish(p,"medium",n)};return r.contentType&&(f.headers={"content-type":r.contentType}),sX(await this.httpClient.call(f),ud())}async call(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{waitSecs:r,log:n,timeoutSecs:i="noTimeout",...o}=sW(t,pN,"ActorCallOptions"),{id:a}=await this.start(e,{...o,timeoutSecs:i}),s=this.apifyClient.run(a),l=await s.getStreamedLog({toLog:n});return l?.start(),this.apifyClient.run(a).waitForFinish({waitSecs:r,timeoutSecs:i}).finally(async()=>{await l?.stop()})}async validateInput(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sW(t,pj,"ActorValidateInputOptions"),n={url:this.buildUrl("validate-input"),method:"POST",data:e,params:this.buildParams({build:r.build}),stringifyFunctions:!0,timeoutSecs:r.timeoutSecs??"short"};return r.contentType&&(n.headers={"content-type":r.contentType}),(await this.httpClient.call(n)).data.valid}async build(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pD);let{timeoutSecs:r,...n}=sW(t,p$,"ActorBuildOptions");return sX(await this.httpClient.call({url:this.buildUrl("builds"),method:"POST",params:this.buildParams({version:e,...n}),timeoutSecs:this.timeoutForWaitForFinish(r,"medium",n.waitForFinish)}),ur())}async defaultBuild(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t,...r}=sW(e,pM,"BuildClientGetOptions"),{id:n}=sX(await this.httpClient.call({url:this.buildUrl("builds/default"),method:"GET",params:this.buildParams(r),timeoutSecs:this.timeoutForWaitForFinish(t,"short",r.waitForFinish)}),ur());return new BuildClient({baseUrl:this.apifyClient.baseUrl,publicBaseUrl:this.apifyClient.publicBaseUrl,httpClient:this.httpClient,apifyClient:this.apifyClient,id:n})}lastRun(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pF,"ActorLastRunOptions");return new RunClient(this.subResourceOptions({id:"last",params:this.buildParams(t),resourcePath:"runs"}))}builds(){return new BuildCollectionClient(this.subResourceOptions({resourcePath:"builds"}))}runs(){return new RunCollectionClient(this.subResourceOptions({resourcePath:"runs"}))}version(e){return sW(e,pD),new ActorVersionClient(this.subResourceOptions({id:e}))}versions(){return new ActorVersionCollectionClient(this.subResourceOptions())}webhooks(){return new WebhookCollectionClient(this.subResourceOptions())}};let pB=sY.optional();let ActorCollectionClient=class ActorCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"actors",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pW,"ActorCollectionListOptions");return this.listResourcesPaginated(lw(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pB);let{timeoutSecs:r="medium"}=sW(t,cK,"TimeoutOptions");return this.createResource(lV(),e,r)}};var pq=((I={}).CREATED_AT="createdAt",I.LAST_RUN_STARTED_AT="stats.lastRunStartedAt",I);let pW=ie({my:nX().optional(),...s7,desc:nX().optional(),sortBy:ip(pq).optional(),...cZ}),pZ=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pK=nE().optional(),pV=sY.optional();let DatasetCollectionClient=class DatasetCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"datasets",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pZ,"DatasetCollectionClientListOptions");return this.listResourcesPaginated(co(),t,"medium")}async getOrCreate(e,t){sW(e,pK),sW(t?.schema,pV),sW(t?.timeoutSecs,cW);let{timeoutSecs:r="short",...n}=t??{},i=Object.keys(n).length>0;return this.getOrCreateResource(uh(),e,i?n:void 0,r)}};let pJ=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pH=nE().optional(),pG=sY.optional();let KeyValueStoreCollectionClient=class KeyValueStoreCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"key-value-stores",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pJ,"KeyValueStoreCollectionClientListOptions");return this.listResourcesPaginated(cn(),t,"medium")}async getOrCreate(e,t){sW(e,pH),sW(t?.schema,pG),sW(t?.timeoutSecs,cW);let{timeoutSecs:r="short",...n}=t??{},i=Object.keys(n).length>0;return this.getOrCreateResource(ub(),e,i?n:void 0,r)}};let pY=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pQ=nE().optional();let RequestQueueCollectionClient=class RequestQueueCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"request-queues",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pY,"RequestQueueCollectionListOptions");return this.listResourcesPaginated(cs(),t,"medium")}async getOrCreate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pQ);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.getOrCreateResource(uP(),e,void 0,r)}};let pX=n5(cE());let ScheduleClient=class ScheduleClient extends ResourceClient{constructor(e){super({resourcePath:"schedules",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cw(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(cw(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async getLog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("log"),method:"GET",params:this.buildParams(),timeoutSecs:t}),pX)}};let p0=ie({...s7,desc:nX().optional(),...cZ}),p1=sY.optional();let ScheduleCollectionClient=class ScheduleCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"schedules",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p0,"ScheduleCollectionListOptions");return this.listResourcesPaginated(cg(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p1);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(cw(),e,r)}};let p2=ie({...s7,search:nE().optional(),sortBy:nE().optional(),category:nE().optional(),username:nE().optional(),pricingModel:nE().optional(),includeUnrunnableActors:nX().optional(),...cZ});let StoreCollectionClient=class StoreCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"store",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p2,"StoreCollectionListOptions");return this.listResourcesPaginated(cO(),t,"medium")}};let p4=sY.optional(),p3=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitForFinish:nH().optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),...cZ}),p6=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitSecs:nH().min(0).optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),...cZ}),p9=ie({status:ip(ij).optional(),origin:ip(i$).optional()});let TaskClient=class TaskClient extends ResourceClient{constructor(e){super({resourcePath:"actor-tasks",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(ct(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(ct(),e,r)}async publish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.update({isPublic:!0},e)}async unpublish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.update({isPublic:!1},e)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async start(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p4);let r=sW(t,p3,"TaskStartOptions"),{waitForFinish:n,runTimeoutSecs:i,memory:o,build:a,maxItems:s,maxTotalChargeUsd:l,restartOnError:u,timeoutSecs:c}=r,p={waitForFinish:n,timeout:i,memory:o,build:a,webhooks:s2(r.webhooks),maxItems:s,maxTotalChargeUsd:l,restartOnError:u},d={url:this.buildUrl("runs"),method:"POST",data:e,params:this.buildParams(p),stringifyFunctions:!0,headers:{"Content-Type":"application/json"},timeoutSecs:this.timeoutForWaitForFinish(c,"medium",n)};return sX(await this.httpClient.call(d),ud())}async call(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p4);let{waitSecs:r,timeoutSecs:n="noTimeout",...i}=sW(t,p6,"TaskCallOptions"),{id:o}=await this.start(e,{...i,timeoutSecs:n});return this.apifyClient.run(o).waitForFinish({waitSecs:r,timeoutSecs:n})}async getInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return(await this.httpClient.call({url:this.buildUrl("input"),method:"GET",params:this.buildParams(),timeoutSecs:t})).data}async updateInput(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return(await this.httpClient.call({url:this.buildUrl("input"),method:"PUT",params:this.buildParams(),data:e,timeoutSecs:r})).data}lastRun(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p9,"TaskLastRunOptions");return new RunClient(this.subResourceOptions({id:"last",params:this.buildParams(t),resourcePath:"runs"}))}runs(){return new RunCollectionClient(this.subResourceOptions({resourcePath:"runs"}))}webhooks(){return new WebhookCollectionClient(this.subResourceOptions())}};let p8=ie({...s7,desc:nX().optional(),...cZ});let TaskCollectionClient=class TaskCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"actor-tasks",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p8,"TaskCollectionListOptions");return this.listResourcesPaginated(u8(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="medium"}=sW(t,cK,"TimeoutOptions");return this.createResource(ct(),e,r)}};let UserClient=class UserClient extends ResourceClient{constructor(e){super({resourcePath:"users",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cI(),{},t)}async monthlyUsage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("usage/monthly"),method:"GET",params:this.buildParams(),timeoutSecs:t}),cM())}async limits(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("limits"),method:"GET",params:this.buildParams(),timeoutSecs:t}),cq())}async updateLimits(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions"),n={url:this.buildUrl("limits"),method:"PUT",params:this.buildParams(),data:e,timeoutSecs:r};await this.httpClient.call(n)}};let p5=ie({...s7,desc:nX().optional(),...cZ});let WebhookDispatchCollectionClient=class WebhookDispatchCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"webhook-dispatches",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p5,"WebhookDispatchCollectionListOptions");return this.listResourcesPaginated(cc(),t,"medium")}};let WebhookClient=class WebhookClient extends ResourceClient{constructor(e){super({resourcePath:"webhooks",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cr(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(cr(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async test(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("test"),method:"POST",params:this.buildParams(),timeoutSecs:t}),cu())}dispatches(){return new WebhookDispatchCollectionClient(this.subResourceOptions({resourcePath:"dispatches"}))}};let WebhookDispatchClient=class WebhookDispatchClient extends ResourceClient{constructor(e){super({resourcePath:"webhook-dispatches",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cu(),{},t)}};let p7=nH().gt(0);let Statistics=class Statistics{calls=0;requests=0;rateLimitErrors=[];addRateLimitError(e){sW(e,p7);let t=e-1;this.#N(t),this.rateLimitErrors[t]++}#N(e){if(this.rateLimitErrors.length<=e)for(let t=0;t<=e;t++)"number"!=typeof this.rateLimitErrors[t]&&(this.rateLimitErrors[t]=0)}};var de=i(606);let dt=ie({baseUrl:nE().default("https://api.apify.com"),publicBaseUrl:nE().default("https://api.apify.com"),maxRetries:nH().default(8),minDelayBetweenRetriesMillis:nH().default(500),requestInterceptors:n5(n2()).default([]),timeoutShortSecs:nH().positive().default(5),timeoutMediumSecs:nH().positive().default(30),timeoutLongSecs:nH().positive().default(360),timeoutMaxSecs:nH().positive().default(360),token:nE().optional(),userAgentSuffix:ii([nE(),n5(nE())]).optional()}),dr=nE().min(1),dn=ie({clientKey:nE().min(1).optional(),timeoutSecs:nH().positive().optional()});let ApifyClient=class ApifyClient{baseUrl;publicBaseUrl;token;stats;logger;httpClient;constructor(e={}){let t=sW(e,dt,"ApifyClientOptions"),{baseUrl:r,publicBaseUrl:n,maxRetries:i,minDelayBetweenRetriesMillis:o,requestInterceptors:a,timeoutShortSecs:s,timeoutMediumSecs:l,timeoutLongSecs:u,timeoutMaxSecs:c,token:p}=t,d=r.endsWith("/")?r.slice(0,r.length-1):r;this.baseUrl=`${d}/v2`;let f=n.endsWith("/")?n.slice(0,n.length-1):n;this.publicBaseUrl=`${f}/v2`,this.token=p,this.stats=new Statistics,this.logger=i9.child({prefix:"ApifyClient"}),this.httpClient=new HttpClient({apifyClientStats:this.stats,maxRetries:i,minDelayBetweenRetriesMillis:o,requestInterceptors:a,timeoutShortSecs:s,timeoutMediumSecs:l,timeoutLongSecs:u,timeoutMaxSecs:c,logger:this.logger,token:this.token,userAgentSuffix:t.userAgentSuffix})}#j(){return{baseUrl:this.baseUrl,publicBaseUrl:this.publicBaseUrl,apifyClient:this,httpClient:this.httpClient}}actors(){return new ActorCollectionClient(this.#j())}actor(e){return sW(e,dr),new ActorClient({id:e,...this.#j()})}builds(){return new BuildCollectionClient(this.#j())}build(e){return sW(e,dr),new BuildClient({id:e,...this.#j()})}datasets(){return new DatasetCollectionClient(this.#j())}dataset(e){return sW(e,dr),new DatasetClient({id:e,...this.#j()})}keyValueStores(){return new KeyValueStoreCollectionClient(this.#j())}keyValueStore(e){return sW(e,dr),new KeyValueStoreClient({id:e,...this.#j()})}log(e){return sW(e,dr),new LogClient({id:e,...this.#j()})}requestQueues(){return new RequestQueueCollectionClient(this.#j())}requestQueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,dr);let r=sW(t,dn,"RequestQueueUserOptions");return new RequestQueueClient({id:e,...this.#j()},r)}runs(){return new RunCollectionClient({...this.#j(),resourcePath:"actor-runs"})}run(e){return sW(e,dr),new RunClient({id:e,...this.#j()})}tasks(){return new TaskCollectionClient(this.#j())}task(e){return sW(e,dr),new TaskClient({id:e,...this.#j()})}schedules(){return new ScheduleCollectionClient(this.#j())}schedule(e){return sW(e,dr),new ScheduleClient({id:e,...this.#j()})}user(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"me";return sW(e,dr),new UserClient({id:e,...this.#j()})}webhooks(){return new WebhookCollectionClient(this.#j())}webhook(e){return sW(e,dr),new WebhookClient({id:e,...this.#j()})}webhookDispatches(){return new WebhookDispatchCollectionClient(this.#j())}webhookDispatch(e){return sW(e,dr),new WebhookDispatchClient({id:e,...this.#j()})}store(){return new StoreCollectionClient(this.#j())}async setStatusMessage(e,t){let r=de.env[iF];if(!r)throw Error(`Environment variable ${iF} is not set!`);await this.run(r).update({statusMessage:e,...t})}}})();var a=o.TD,s=o.B,l=o.h0,u=o.XP,c=o.v8,p=o.Lu,d=o.vp,f=o.Jo,h=o.UP,m=o.rj,g=o.Ns,y=o.kt,b=o.KW,v=o.fK,_=o.wb,w=o.wv,E=o.yY,S=o.qQ,R=o.tY,O=o.rE,T=o.PD,C=o.lE,A=o.ss,x=o.kq,k=o.m_,P=o.O_,U=o.OE,I=o.oc,L=o.oW,z=o.dK,N=o.Ry,j=o.Ng,D=o.Hg,$=o.L6,M=o.Ty,F=o.gP,B=o.py,q=o.YS,W=o.t1,Z=o.jE,K=o.D_,V=o.jx,J=o.F,H=o.J_,G=o.hH,Y=o.zC,Q=o._l;export{a as ActorClient,s as ActorCollectionClient,l as ActorEnvVarClient,u as ActorEnvVarCollectionClient,c as ActorListSortBy,p as ActorSourceType,d as ActorVersionClient,f as ActorVersionCollectionClient,h as ApifyApiError,m as ApifyClient,g as ArgumentValidationError,y as BuildClient,b as BuildCollectionClient,v as ConflictError,_ as DatasetClient,w as DatasetCollectionClient,E as DownloadItemsFormat,S as ForbiddenError,R as InvalidRequestError,O as InvalidResponseBodyError,T as KeyValueStoreClient,C as KeyValueStoreCollectionClient,A as LogClient,x as LoggerActorRedirect,k as NotFoundError,P as PlatformFeature,U as RateLimitError,I as RequestQueueClient,L as RequestQueueCollectionClient,z as ResponseValidationError,N as RunClient,j as RunCollectionClient,D as ScheduleActions,$ as ScheduleClient,M as ScheduleCollectionClient,F as ServerError,B as StoreCollectionClient,q as StreamedLog,W as TaskClient,Z as TaskCollectionClient,K as UnauthorizedError,V as UserClient,J as WebhookClient,H as WebhookCollectionClient,G as WebhookDispatchClient,Y as WebhookDispatchCollectionClient,Q as WebhookDispatchStatus};
63
+ Cause: ${e.message}`)}let u={url:this.buildUrl(["records",n]),method:"PUT",params:this.buildParams(),data:i,headers:o?{"content-type":o}:void 0,doNotRetryTimeouts:s,timeoutSecs:a};await this.httpClient.call(u)}async deleteRecord(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,po);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");await this.httpClient.call({url:this.buildUrl(["records",e]),method:"DELETE",params:this.buildParams(),timeoutSecs:r})}};let pu=ie({limit:nH().min(0).optional(),...cZ}),pc=ie({lockSecs:nH(),limit:nH().min(0).optional(),...cZ}),pp=ix(e=>sG(e)&&void 0===e.id,"Expected a request object without an `id`"),pd=ie({forefront:nX().optional(),...cZ}),pf=n5(pp).min(1),ph=nX().optional(),pm=nH().optional(),pg=n5(ix(e=>sG(e)&&("string"==typeof e.id||"string"==typeof e.uniqueKey),"Expected a request object with an `id` or a `uniqueKey`")).min(1).max(25),py=nE(),pb=ix(e=>sG(e)&&"string"==typeof e.id,"Expected a request object with an `id`"),pv=ie({lockSecs:nH(),forefront:nX().optional(),...cZ}),p_=n5(ip(["locked","pending"])).min(1),pw=ie({limit:nH().min(0).optional(),cursor:nE().optional(),filter:p_.optional(),...cZ}),pE=ie({limit:nH().min(0).optional(),maxPageLimit:nH().default(1e3),cursor:nE().optional(),filter:p_.optional(),...cZ});let RequestQueueClient=class RequestQueueClient extends ResourceClient{#I;#L;constructor(e,t={}){super({resourcePath:"request-queues",...e}),this.#I=t.clientKey,this.#L=t.timeoutSecs}#z(e,t){return void 0!==e?e:void 0===this.#L||this.httpClient.timeoutMillis[t]/1e3<=this.#L?t:this.#L}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return this.getResource(uP(),{},this.#z(t,"short"))}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");return this.updateResource(uP(),e,this.#z(r,"short"))}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return this.deleteResource(this.#z(t,"short"))}async listHead(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pu,"RequestQueueClientListHeadOptions");return sX(await this.httpClient.call({url:this.buildUrl("head"),method:"GET",timeoutSecs:this.#z(t.timeoutSecs,"short"),params:this.buildParams({limit:t.limit,clientKey:this.#I})}),u2())}async listAndLockHead(e){let t=sW(e,pc,"RequestQueueClientListAndLockHeadOptions");return sX(await this.httpClient.call({url:this.buildUrl("head/lock"),method:"POST",timeoutSecs:this.#z(t.timeoutSecs,"medium"),params:this.buildParams({limit:t.limit,lockSecs:t.lockSecs,clientKey:this.#I})}),u3())}async addRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pp);let r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests"),method:"POST",timeoutSecs:this.#z(r.timeoutSecs,"short"),data:e,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uq())}async addRequestBatch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/batch"),method:"POST",timeoutSecs:this.#z(r.timeoutSecs,"medium"),headers:{"content-type":"application/json"},data:`[${e.map(e=>{let{json:t}=e;return t}).join(",")}]`,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uK())}async addRequestBatchWithRetries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{forefront:r,timeoutSecs:n,maxUnprocessedRequestsRetries:i=3,minDelayBetweenUnprocessedRequestsRetriesMillis:o=500}=t,a=e,s=[],l=[];for(let t=0;t<1+i;t++){try{let i=await this.addRequestBatch(a,{forefront:r,timeoutSecs:n});s.push(...i.processedRequests),l=i.unprocessedRequests,0!==l.length&&this.httpClient.stats.addRateLimitError(t+1);let o=s.map(e=>{let{uniqueKey:t}=e;return t});if(a=e.filter(e=>{let{request:t}=e;return!o.includes(t.uniqueKey)}),0===a.length)break}catch(r){if(r instanceof ResponseValidationError)throw r;i9.exception(r,"Request batch insert failed");let t=s.map(e=>{let{uniqueKey:t}=e;return t});l=e.filter(e=>{let{request:r}=e;return!t.includes(r.uniqueKey)}).map(e=>{let{request:{method:t,uniqueKey:r,url:n}}=e;return{method:t,uniqueKey:r,url:n}});break}let i=Math.floor((1+Math.random())*2**t*o);await new Promise(e=>{setTimeout(e,i)})}return{processedRequests:s,unprocessedRequests:l}}async batchAddRequests(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{forefront:r,timeoutSecs:n,maxUnprocessedRequestsRetries:i=3,maxParallel:o=5,minDelayBetweenUnprocessedRequestsRetriesMillis:a=500}=t;sW(e,pf),sW(r,ph),sW(n,cW),sW(i,pm),sW(o,pm),sW(a,pm);let s=new Set,l=[],u=9437184-Math.ceil(9437184*1e-4);for(let r of function(e,t){let{maxCount:r,maxByteLength:n}=t,i=[],o=[],a=1;for(let t of e)o.length>0&&(o.length>=r||a+t.byteLength+1>n)&&(i.push(o),o=[],a=1),o.push(t),a+=t.byteLength+1;return o.length>0&&i.push(o),i}(e.map((e,t)=>{let r=JSON.stringify(e),n=new Blob([r]).size;if(n+2>u)throw Error(`RequestQueueClient.batchAddRequests: The size of the request with index: ${t} exceeds the maximum allowed size (${u} bytes).`);return{request:e,json:r,byteLength:n}}),{maxCount:25,maxByteLength:u})){let e=this.addRequestBatchWithRetries(r,t);s.add(e),e.then(t=>{s.delete(e),l.push(t)},()=>void 0),s.size>=o&&await Promise.race(s)}await Promise.all(s);let c={processedRequests:[],unprocessedRequests:[]};return l.forEach(e=>{let{processedRequests:t,unprocessedRequests:r}=e;c.processedRequests.push(...t),c.unprocessedRequests.push(...r)}),c}async batchDeleteRequests(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pg);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/batch"),method:"DELETE",timeoutSecs:this.#z(r,"short"),data:e,params:this.buildParams({clientKey:this.#I})}),uG())}async getRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,py);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions"),n={url:this.buildUrl(["requests",e]),method:"GET",timeoutSecs:this.#z(r,"short"),params:this.buildParams()};try{let e=await this.httpClient.call(n);return sX(e,u$())}catch(e){s0(e)}}async updateRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pb);let r=sW(t,pd,"RequestQueueClientAddRequestOptions");return sX(await this.httpClient.call({url:this.buildUrl(["requests",e.id]),method:"PUT",timeoutSecs:this.#z(r.timeoutSecs,"medium"),data:e,params:this.buildParams({forefront:r.forefront,clientKey:this.#I})}),uq())}async deleteRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,py);let{timeoutSecs:r}=sW(t,cK,"TimeoutOptions");await this.httpClient.call({url:this.buildUrl(["requests",e]),method:"DELETE",timeoutSecs:this.#z(r,"short"),params:this.buildParams({clientKey:this.#I})})}async prolongRequestLock(e,t){sW(e,py);let r=sW(t,pv,"RequestQueueClientProlongRequestLockOptions");return sX(await this.httpClient.call({url:this.buildUrl(["requests",e,"lock"]),method:"PUT",timeoutSecs:this.#z(r.timeoutSecs,"medium"),params:this.buildParams({forefront:r.forefront,lockSecs:r.lockSecs,clientKey:this.#I})}),uX())}async deleteRequestLock(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,py);let r=sW(t,pd,"RequestQueueClientDeleteRequestLockOptions");await this.httpClient.call({url:this.buildUrl(["requests",e,"lock"]),method:"DELETE",timeoutSecs:this.#z(r.timeoutSecs,"short"),params:this.buildParams({forefront:r.forefront,clientKey:this.#I})})}listRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=this;let{timeoutSecs:r,...n}=sW(e,pw,"RequestQueueClientListRequestsOptions"),i=this.#z(r,"medium"),o=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return sX(await t.httpClient.call({url:t.buildUrl("requests"),method:"GET",timeoutSecs:i,params:t.buildParams({...e,filter:e.filter?e.filter.join(","):void 0,clientKey:t.#I})}),uM())},a=o(n);async function*s(){let e=await a;yield*e.items;let t=n.limit?n.limit-e.items.length:void 0;for(;e.items.length>0&&e.nextCursor&&(void 0===t||t>0);){let r={...n,limit:t,cursor:e.nextCursor};e=await o(r),yield*e.items,t&&(t-=e.items.length)}}return Object.defineProperty(a,Symbol.asyncIterator,{value:s})}async unlockRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("requests/unlock"),method:"POST",timeoutSecs:this.#z(t,"long"),params:this.buildParams({clientKey:this.#I})}),uY())}paginateRequests(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{limit:t,cursor:r,filter:n,maxPageLimit:i,timeoutSecs:o}=sW(e,pE,"RequestQueueClientPaginateRequestsOptions");return new RequestQueuePaginationIterator({getPage:async e=>this.listRequests({...e,filter:n,timeoutSecs:o}),limit:t,cursor:r,maxPageLimit:i})}};let pS=ie({waitForFinish:nH().optional(),...cZ}),pR=ie({gracefully:nX().optional(),...cZ}),pO=nE(),pT=ie({contentType:nE().optional(),build:nE().optional(),...cZ}),pC=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().optional(),maxItems:nH().optional(),maxTotalChargeUsd:nH().optional(),restartOnError:nX().optional(),...cZ}),pA=ie({eventName:nE(),count:nH().default(1),idempotencyKey:nE().optional(),...cZ}),px=ie({waitSecs:nH().optional(),...cZ});let RunClient=class RunClient extends ResourceClient{constructor(e){super({...e,resourcePath:e.resourcePath||"actor-runs"})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t,...r}=sW(e,pS,"RunGetOptions");return this.getResource(ud(),r,this.timeoutForWaitForFinish(t,"short",r.waitForFinish))}async abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium",...r}=sW(e,pR,"RunAbortOptions");return sX(await this.httpClient.call({url:this.buildUrl("abort"),method:"POST",params:this.buildParams(r),timeoutSecs:t}),ud())}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async metamorph(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};sW(e,pO);let n=sW(r,pT,"RunMetamorphOptions"),i={targetActorId:this.toSafeId(e),build:n.build},o={url:this.buildUrl("metamorph"),method:"POST",data:t,params:this.buildParams(i),stringifyFunctions:!0,timeoutSecs:n.timeoutSecs??"medium"};return n.contentType&&(o.headers={"content-type":n.contentType}),sX(await this.httpClient.call(o),ud())}async reboot(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions"),r={url:this.buildUrl("reboot"),method:"POST",timeoutSecs:t};return sX(await this.httpClient.call(r),ud())}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(ud(),e,r)}async resurrect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium",runTimeoutSecs:r,...n}=sW(e,pC,"RunResurrectOptions");return sX(await this.httpClient.call({url:this.buildUrl("resurrect"),method:"POST",params:this.buildParams({...n,timeout:r}),timeoutSecs:t}),ud())}async charge(e){let{eventName:t,count:r,idempotencyKey:n,timeoutSecs:i="short"}=sW(e,pA,"RunChargeOptions"),o=(Math.random()+1).toString(36).slice(3,8),a=n??`${this.id}-${t}-${Date.now()}-${o}`,s={url:this.buildUrl("charge"),method:"POST",data:{eventName:t,count:r},headers:{"idempotency-key":a},timeoutSecs:i};return await this.httpClient.call(s)}async waitForFinish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,px,"RunWaitForFinishOptions");return this.waitForJobFinish(ud(),t)}dataset(){return new DatasetClient(this.subResourceOptions({resourcePath:"dataset"}))}keyValueStore(){return new KeyValueStoreClient(this.subResourceOptions({resourcePath:"key-value-store"}))}requestQueue(){return new RequestQueueClient(this.subResourceOptions({resourcePath:"request-queue"}))}log(){return new LogClient(this.subResourceOptions({resourcePath:"log"}))}async getStreamedLog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};sW(e.timeoutSecs,cW);let{fromStart:t=!0,timeoutSecs:r="long"}=e,{toLog:n}=e}};let pk=ip(ij),pP=ie({...s7,desc:nX().optional(),status:ii([pk,n5(pk)]).optional(),startedBefore:ii([n9(),nE()]).optional(),startedAfter:ii([n9(),nE()]).optional(),...cZ});let RunCollectionClient=class RunCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"runs",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pP,"RunCollectionListOptions");return this.listResourcesPaginated(uo(),t,"medium")}};let pU=ie({...s7,desc:nX().optional(),...cZ}),pI=sY.optional();let WebhookCollectionClient=class WebhookCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"webhooks",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pU,"WebhookCollectionListOptions");return this.listResourcesPaginated(l2(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pI);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(cr(),e,r)}};let pL=ie({build:nE().optional(),contentType:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitForFinish:nH().optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),forcePermissionLevel:ip(iq).optional(),...cZ}),pz=ie({build:nE().optional(),contentType:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitSecs:nH().min(0).optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),log:ii([new n0({type:"null",...er(void 0)}),function(e,t={}){let r=new iA({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...er(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}(Log),ih("default")]).optional(),restartOnError:nX().optional(),forcePermissionLevel:ip(iq).optional(),...cZ}),pN=ie({build:nE().optional(),contentType:nE().optional(),...cZ}),pj=nE().min(1),pD=ie({betaPackages:nX().optional(),tag:nE().optional(),useCache:nX().optional(),waitForFinish:nH().optional(),...cZ}),p$=ie({waitForFinish:nH().optional(),...cZ}),pM=ie({status:ip(ij).optional(),origin:ip(i$).optional()});let ActorClient=class ActorClient extends ResourceClient{constructor(e){super({resourcePath:"actors",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(lV(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(lV(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async start(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sW(t,pL,"ActorStartOptions"),{waitForFinish:n,runTimeoutSecs:i,memory:o,build:a,maxItems:s,maxTotalChargeUsd:l,restartOnError:u,forcePermissionLevel:c,timeoutSecs:p}=r,d={waitForFinish:n,timeout:i,memory:o,build:a,webhooks:s2(r.webhooks),maxItems:s,maxTotalChargeUsd:l,restartOnError:u,forcePermissionLevel:c},f={url:this.buildUrl("runs"),method:"POST",data:e,params:this.buildParams(d),stringifyFunctions:!0,timeoutSecs:this.timeoutForWaitForFinish(p,"medium",n)};return r.contentType&&(f.headers={"content-type":r.contentType}),sX(await this.httpClient.call(f),ud())}async call(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{waitSecs:r,log:n,timeoutSecs:i="noTimeout",...o}=sW(t,pz,"ActorCallOptions"),{id:a}=await this.start(e,{...o,timeoutSecs:i}),s=this.apifyClient.run(a),l=await s.getStreamedLog({toLog:n});return l?.start(),this.apifyClient.run(a).waitForFinish({waitSecs:r,timeoutSecs:i}).finally(async()=>{await l?.stop()})}async validateInput(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=sW(t,pN,"ActorValidateInputOptions"),n={url:this.buildUrl("validate-input"),method:"POST",data:e,params:this.buildParams({build:r.build}),stringifyFunctions:!0,timeoutSecs:r.timeoutSecs??"short"};return r.contentType&&(n.headers={"content-type":r.contentType}),(await this.httpClient.call(n)).data.valid}async build(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pj);let{timeoutSecs:r,...n}=sW(t,pD,"ActorBuildOptions");return sX(await this.httpClient.call({url:this.buildUrl("builds"),method:"POST",params:this.buildParams({version:e,...n}),timeoutSecs:this.timeoutForWaitForFinish(r,"medium",n.waitForFinish)}),ur())}async defaultBuild(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t,...r}=sW(e,p$,"BuildClientGetOptions"),{id:n}=sX(await this.httpClient.call({url:this.buildUrl("builds/default"),method:"GET",params:this.buildParams(r),timeoutSecs:this.timeoutForWaitForFinish(t,"short",r.waitForFinish)}),ur());return new BuildClient({baseUrl:this.apifyClient.baseUrl,publicBaseUrl:this.apifyClient.publicBaseUrl,httpClient:this.httpClient,apifyClient:this.apifyClient,id:n})}lastRun(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pM,"ActorLastRunOptions");return new RunClient(this.subResourceOptions({id:"last",params:this.buildParams(t),resourcePath:"runs"}))}builds(){return new BuildCollectionClient(this.subResourceOptions({resourcePath:"builds"}))}runs(){return new RunCollectionClient(this.subResourceOptions({resourcePath:"runs"}))}version(e){return sW(e,pj),new ActorVersionClient(this.subResourceOptions({id:e}))}versions(){return new ActorVersionCollectionClient(this.subResourceOptions())}webhooks(){return new WebhookCollectionClient(this.subResourceOptions())}};let pF=sY.optional();let ActorCollectionClient=class ActorCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"actors",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pq,"ActorCollectionListOptions");return this.listResourcesPaginated(lw(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pF);let{timeoutSecs:r="medium"}=sW(t,cK,"TimeoutOptions");return this.createResource(lV(),e,r)}};var pB=((I={}).CREATED_AT="createdAt",I.LAST_RUN_STARTED_AT="stats.lastRunStartedAt",I);let pq=ie({my:nX().optional(),...s7,desc:nX().optional(),sortBy:ip(pB).optional(),...cZ}),pW=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pZ=nE().optional(),pK=sY.optional();let DatasetCollectionClient=class DatasetCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"datasets",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pW,"DatasetCollectionClientListOptions");return this.listResourcesPaginated(co(),t,"medium")}async getOrCreate(e,t){sW(e,pZ),sW(t?.schema,pK),sW(t?.timeoutSecs,cW);let{timeoutSecs:r="short",...n}=t??{},i=Object.keys(n).length>0;return this.getOrCreateResource(uh(),e,i?n:void 0,r)}};let pV=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pJ=nE().optional(),pH=sY.optional();let KeyValueStoreCollectionClient=class KeyValueStoreCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"key-value-stores",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pV,"KeyValueStoreCollectionClientListOptions");return this.listResourcesPaginated(cn(),t,"medium")}async getOrCreate(e,t){sW(e,pJ),sW(t?.schema,pH),sW(t?.timeoutSecs,cW);let{timeoutSecs:r="short",...n}=t??{},i=Object.keys(n).length>0;return this.getOrCreateResource(ub(),e,i?n:void 0,r)}};let pG=ie({unnamed:nX().optional(),...s7,desc:nX().optional(),ownership:ip(iW).optional(),...cZ}),pY=nE().optional();let RequestQueueCollectionClient=class RequestQueueCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"request-queues",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pG,"RequestQueueCollectionListOptions");return this.listResourcesPaginated(cs(),t,"medium")}async getOrCreate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,pY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.getOrCreateResource(uP(),e,void 0,r)}};let pQ=n5(cE());let ScheduleClient=class ScheduleClient extends ResourceClient{constructor(e){super({resourcePath:"schedules",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cw(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(cw(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async getLog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("log"),method:"GET",params:this.buildParams(),timeoutSecs:t}),pQ)}};let pX=ie({...s7,desc:nX().optional(),...cZ}),p0=sY.optional();let ScheduleCollectionClient=class ScheduleCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"schedules",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,pX,"ScheduleCollectionListOptions");return this.listResourcesPaginated(cg(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p0);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.createResource(cw(),e,r)}};let p1=ie({...s7,search:nE().optional(),sortBy:nE().optional(),category:nE().optional(),username:nE().optional(),pricingModel:nE().optional(),includeUnrunnableActors:nX().optional(),...cZ});let StoreCollectionClient=class StoreCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"store",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p1,"StoreCollectionListOptions");return this.listResourcesPaginated(cO(),t,"medium")}};let p2=sY.optional(),p4=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitForFinish:nH().optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),...cZ}),p3=ie({build:nE().optional(),memory:nH().optional(),runTimeoutSecs:nH().min(0).optional(),waitSecs:nH().min(0).optional(),webhooks:n5(sY).optional(),maxItems:nH().min(0).optional(),maxTotalChargeUsd:nH().min(0).optional(),restartOnError:nX().optional(),...cZ}),p6=ie({status:ip(ij).optional(),origin:ip(i$).optional()});let TaskClient=class TaskClient extends ResourceClient{constructor(e){super({resourcePath:"actor-tasks",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(ct(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(ct(),e,r)}async publish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.update({isPublic:!0},e)}async unpublish(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.update({isPublic:!1},e)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async start(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p2);let r=sW(t,p4,"TaskStartOptions"),{waitForFinish:n,runTimeoutSecs:i,memory:o,build:a,maxItems:s,maxTotalChargeUsd:l,restartOnError:u,timeoutSecs:c}=r,p={waitForFinish:n,timeout:i,memory:o,build:a,webhooks:s2(r.webhooks),maxItems:s,maxTotalChargeUsd:l,restartOnError:u},d={url:this.buildUrl("runs"),method:"POST",data:e,params:this.buildParams(p),stringifyFunctions:!0,headers:{"Content-Type":"application/json"},timeoutSecs:this.timeoutForWaitForFinish(c,"medium",n)};return sX(await this.httpClient.call(d),ud())}async call(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,p2);let{waitSecs:r,timeoutSecs:n="noTimeout",...i}=sW(t,p3,"TaskCallOptions"),{id:o}=await this.start(e,{...i,timeoutSecs:n});return this.apifyClient.run(o).waitForFinish({waitSecs:r,timeoutSecs:n})}async getInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return(await this.httpClient.call({url:this.buildUrl("input"),method:"GET",params:this.buildParams(),timeoutSecs:t})).data}async updateInput(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return(await this.httpClient.call({url:this.buildUrl("input"),method:"PUT",params:this.buildParams(),data:e,timeoutSecs:r})).data}lastRun(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p6,"TaskLastRunOptions");return new RunClient(this.subResourceOptions({id:"last",params:this.buildParams(t),resourcePath:"runs"}))}runs(){return new RunCollectionClient(this.subResourceOptions({resourcePath:"runs"}))}webhooks(){return new WebhookCollectionClient(this.subResourceOptions())}};let p9=ie({...s7,desc:nX().optional(),...cZ});let TaskCollectionClient=class TaskCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"actor-tasks",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p9,"TaskCollectionListOptions");return this.listResourcesPaginated(u8(),t,"medium")}async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="medium"}=sW(t,cK,"TimeoutOptions");return this.createResource(ct(),e,r)}};let UserClient=class UserClient extends ResourceClient{constructor(e){super({resourcePath:"users",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cI(),{},t)}async monthlyUsage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("usage/monthly"),method:"GET",params:this.buildParams(),timeoutSecs:t}),cM())}async limits(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("limits"),method:"GET",params:this.buildParams(),timeoutSecs:t}),cq())}async updateLimits(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions"),n={url:this.buildUrl("limits"),method:"PUT",params:this.buildParams(),data:e,timeoutSecs:r};await this.httpClient.call(n)}};let p8=ie({...s7,desc:nX().optional(),...cZ});let WebhookDispatchCollectionClient=class WebhookDispatchCollectionClient extends ResourceCollectionClient{constructor(e){super({resourcePath:"webhook-dispatches",...e})}list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=sW(e,p8,"WebhookDispatchCollectionListOptions");return this.listResourcesPaginated(cc(),t,"medium")}};let WebhookClient=class WebhookClient extends ResourceClient{constructor(e){super({resourcePath:"webhooks",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cr(),{},t)}async update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,sY);let{timeoutSecs:r="short"}=sW(t,cK,"TimeoutOptions");return this.updateResource(cr(),e,r)}async delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.deleteResource(t)}async test(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="medium"}=sW(e,cK,"TimeoutOptions");return sX(await this.httpClient.call({url:this.buildUrl("test"),method:"POST",params:this.buildParams(),timeoutSecs:t}),cu())}dispatches(){return new WebhookDispatchCollectionClient(this.subResourceOptions({resourcePath:"dispatches"}))}};let WebhookDispatchClient=class WebhookDispatchClient extends ResourceClient{constructor(e){super({resourcePath:"webhook-dispatches",...e})}async get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{timeoutSecs:t="short"}=sW(e,cK,"TimeoutOptions");return this.getResource(cu(),{},t)}};let p5=nH().gt(0);let Statistics=class Statistics{calls=0;requests=0;rateLimitErrors=[];addRateLimitError(e){sW(e,p5);let t=e-1;this.#N(t),this.rateLimitErrors[t]++}#N(e){if(this.rateLimitErrors.length<=e)for(let t=0;t<=e;t++)"number"!=typeof this.rateLimitErrors[t]&&(this.rateLimitErrors[t]=0)}};var p7=i(606);let de=ie({baseUrl:nE().default("https://api.apify.com"),publicBaseUrl:nE().default("https://api.apify.com"),maxRetries:nH().default(8),minDelayBetweenRetriesMillis:nH().default(500),requestInterceptors:n5(n2()).default([]),timeoutShortSecs:nH().positive().default(5),timeoutMediumSecs:nH().positive().default(30),timeoutLongSecs:nH().positive().default(360),timeoutMaxSecs:nH().positive().default(360),token:nE().optional(),userAgentSuffix:ii([nE(),n5(nE())]).optional()}),dt=nE().min(1),dr=ie({clientKey:nE().min(1).optional(),timeoutSecs:nH().positive().optional()});let ApifyClient=class ApifyClient{baseUrl;publicBaseUrl;token;stats;logger;httpClient;constructor(e={}){let t=sW(e,de,"ApifyClientOptions"),{baseUrl:r,publicBaseUrl:n,maxRetries:i,minDelayBetweenRetriesMillis:o,requestInterceptors:a,timeoutShortSecs:s,timeoutMediumSecs:l,timeoutLongSecs:u,timeoutMaxSecs:c,token:p}=t,d=r.endsWith("/")?r.slice(0,r.length-1):r;this.baseUrl=`${d}/v2`;let f=n.endsWith("/")?n.slice(0,n.length-1):n;this.publicBaseUrl=`${f}/v2`,this.token=p,this.stats=new Statistics,this.logger=i9.child({prefix:"ApifyClient"}),this.httpClient=new HttpClient({apifyClientStats:this.stats,maxRetries:i,minDelayBetweenRetriesMillis:o,requestInterceptors:a,timeoutShortSecs:s,timeoutMediumSecs:l,timeoutLongSecs:u,timeoutMaxSecs:c,logger:this.logger,token:this.token,userAgentSuffix:t.userAgentSuffix})}#j(){return{baseUrl:this.baseUrl,publicBaseUrl:this.publicBaseUrl,apifyClient:this,httpClient:this.httpClient}}actors(){return new ActorCollectionClient(this.#j())}actor(e){return sW(e,dt),new ActorClient({id:e,...this.#j()})}builds(){return new BuildCollectionClient(this.#j())}build(e){return sW(e,dt),new BuildClient({id:e,...this.#j()})}datasets(){return new DatasetCollectionClient(this.#j())}dataset(e){return sW(e,dt),new DatasetClient({id:e,...this.#j()})}keyValueStores(){return new KeyValueStoreCollectionClient(this.#j())}keyValueStore(e){return sW(e,dt),new KeyValueStoreClient({id:e,...this.#j()})}log(e){return sW(e,dt),new LogClient({id:e,...this.#j()})}requestQueues(){return new RequestQueueCollectionClient(this.#j())}requestQueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sW(e,dt);let r=sW(t,dr,"RequestQueueUserOptions");return new RequestQueueClient({id:e,...this.#j()},r)}runs(){return new RunCollectionClient({...this.#j(),resourcePath:"actor-runs"})}run(e){return sW(e,dt),new RunClient({id:e,...this.#j()})}tasks(){return new TaskCollectionClient(this.#j())}task(e){return sW(e,dt),new TaskClient({id:e,...this.#j()})}schedules(){return new ScheduleCollectionClient(this.#j())}schedule(e){return sW(e,dt),new ScheduleClient({id:e,...this.#j()})}user(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"me";return sW(e,dt),new UserClient({id:e,...this.#j()})}webhooks(){return new WebhookCollectionClient(this.#j())}webhook(e){return sW(e,dt),new WebhookClient({id:e,...this.#j()})}webhookDispatches(){return new WebhookDispatchCollectionClient(this.#j())}webhookDispatch(e){return sW(e,dt),new WebhookDispatchClient({id:e,...this.#j()})}store(){return new StoreCollectionClient(this.#j())}async setStatusMessage(e,t){let r=p7.env[iF];if(!r)throw Error(`Environment variable ${iF} is not set!`);await this.run(r).update({statusMessage:e,...t})}}})();var a=o.TD,s=o.B,l=o.h0,u=o.XP,c=o.v8,p=o.Lu,d=o.vp,f=o.Jo,h=o.UP,m=o.rj,g=o.Ns,y=o.kt,b=o.KW,v=o.fK,_=o.wb,w=o.wv,E=o.yY,S=o.qQ,R=o.tY,O=o.rE,T=o.PD,C=o.lE,A=o.ss,x=o.kq,k=o.m_,P=o.O_,U=o.OE,I=o.oc,L=o.oW,z=o.dK,N=o.Ry,j=o.Ng,D=o.Hg,$=o.L6,M=o.Ty,F=o.gP,B=o.py,q=o.YS,W=o.t1,Z=o.jE,K=o.D_,V=o.jx,J=o.F,H=o.J_,G=o.hH,Y=o.zC,Q=o._l;export{a as ActorClient,s as ActorCollectionClient,l as ActorEnvVarClient,u as ActorEnvVarCollectionClient,c as ActorListSortBy,p as ActorSourceType,d as ActorVersionClient,f as ActorVersionCollectionClient,h as ApifyApiError,m as ApifyClient,g as ArgumentValidationError,y as BuildClient,b as BuildCollectionClient,v as ConflictError,_ as DatasetClient,w as DatasetCollectionClient,E as DownloadItemsFormat,S as ForbiddenError,R as InvalidRequestError,O as InvalidResponseBodyError,T as KeyValueStoreClient,C as KeyValueStoreCollectionClient,A as LogClient,x as LoggerActorRedirect,k as NotFoundError,P as PlatformFeature,U as RateLimitError,I as RequestQueueClient,L as RequestQueueCollectionClient,z as ResponseValidationError,N as RunClient,j as RunCollectionClient,D as ScheduleActions,$ as ScheduleClient,M as ScheduleCollectionClient,F as ServerError,B as StoreCollectionClient,q as StreamedLog,W as TaskClient,Z as TaskCollectionClient,K as UnauthorizedError,V as UserClient,J as WebhookClient,H as WebhookCollectionClient,G as WebhookDispatchClient,Y as WebhookDispatchCollectionClient,Q as WebhookDispatchStatus};
64
64
  //# sourceMappingURL=bundle.js.map