/*! For license information please see background.js.LICENSE.txt */ (()=>{var e={2009:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=s(e),a=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),f=0,d=c>0?a-4:a;for(r=0;r>16&255,u[f++]=t>>8&255,u[f++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[f++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,u=n-i;su?u:s+a));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,a=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2940:function(e,t,r){!function(e){"use strict";var t="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var o={},a={encrypt:function(e,t){return e._cipher.encryptBlock(t)},decrypt:function(e,t){return e._cipher.decryptBlock(t)}},s={},c="undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},u=[],f=[],d="undefined"!==typeof Uint8Array?Uint8Array:Array,l=!1;function h(){l=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new d(3*s/4-o),n=o>0?s-4:s;var c=0;for(t=0,r=0;t>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===o?(i=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===o&&(i=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}function m(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function v(e,t,r){for(var n,i=[],o=t;oc?c:s+a));return 1===n?(t=e[r-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),o.push(i),o.join("")}function g(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<>1,f=-7,d=r?i-1:0,l=r?-1:1,h=e[t+d];for(d+=l,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+e[t+d],d+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+e[t+d],d+=l,f-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)}function y(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?l/c:l*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=f?(s=0,a=f):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*m}var _={}.toString,w=Array.isArray||function(e){return"[object Array]"==_.call(e)},x=50;A.TYPED_ARRAY_SUPPORT=void 0===c.TYPED_ARRAY_SUPPORT||c.TYPED_ARRAY_SUPPORT;var E=S();function S(){return A.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(e,t){if(S()=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function B(e){return+e!=e&&(e=0),A.alloc(+e)}function D(e){return!(null==e||!e._isBuffer)}function L(e,t){if(D(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return pe(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return be(e).length;default:if(n)return pe(e).length;t=(""+t).toLowerCase(),n=!0}}function F(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return te(this,t,r);case"utf8":case"utf-8":return Q(this,t,r);case"ascii":return $(this,t,r);case"latin1":case"binary":return ee(this,t,r);case"base64":return K(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return re(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function j(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function z(e,t,r,n,i){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof t&&(t=A.from(t,n)),D(t))return 0===t.length?-1:H(e,t,r,n,i);if("number"===typeof t)return t&=255,A.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):H(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function H(e,t,r,n,i){var o,a=1,s=e.length,c=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,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;os&&(r=s-c),o=r;o>=0;o--){for(var d=!0,l=0;li&&(n=i):n=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(f=u);break;case 2:128===(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],a=e[i+2],128===(192&o)&&128===(192&a)&&(c=(15&u)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128===(192&o)&&128===(192&a)&&128===(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(f=c)}null===f?(f=65533,d=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=d}return Z(n)}A.poolSize=8192,A._augment=function(e){return e.__proto__=A.prototype,e},A.from=function(e,t,r){return R(null,e,t,r)},A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&A[Symbol.species]),A.alloc=function(e,t,r){return I(null,e,t,r)},A.allocUnsafe=function(e){return O(null,e)},A.allocUnsafeSlow=function(e){return O(null,e)},A.isBuffer=_e,A.compare=function(e,t){if(!D(e)||!D(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},A.prototype.compare=function(e,t,r,n,i){if(!D(e))throw new TypeError("Argument must be a Buffer");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 new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return q(this,e,t,r);case"utf8":case"utf-8":return G(this,e,t,r);case"ascii":return W(this,e,t,r);case"latin1":case"binary":return Y(this,e,t,r);case"base64":return V(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;function Z(e){var t=e.length;if(t<=J)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function ie(e,t,r,n,i,o){if(!D(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function oe(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function ae(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function se(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ce(e,t,r,n,i){return i||se(e,t,r,4),y(e,t,r,n,23,4),r+4}function ue(e,t,r,n,i){return i||se(e,t,r,8),y(e,t,r,n,52,8),r+8}A.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},A.prototype.readUInt8=function(e,t){return t||ne(e,1,this.length),this[e]},A.prototype.readUInt16LE=function(e,t){return t||ne(e,2,this.length),this[e]|this[e+1]<<8},A.prototype.readUInt16BE=function(e,t){return t||ne(e,2,this.length),this[e]<<8|this[e+1]},A.prototype.readUInt32LE=function(e,t){return t||ne(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},A.prototype.readUInt32BE=function(e,t){return t||ne(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},A.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||ne(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},A.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||ne(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},A.prototype.readInt8=function(e,t){return t||ne(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},A.prototype.readInt16LE=function(e,t){t||ne(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},A.prototype.readInt16BE=function(e,t){t||ne(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},A.prototype.readInt32LE=function(e,t){return t||ne(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},A.prototype.readInt32BE=function(e,t){return t||ne(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},A.prototype.readFloatLE=function(e,t){return t||ne(e,4,this.length),g(this,e,!0,23,4)},A.prototype.readFloatBE=function(e,t){return t||ne(e,4,this.length),g(this,e,!1,23,4)},A.prototype.readDoubleLE=function(e,t){return t||ne(e,8,this.length),g(this,e,!0,52,8)},A.prototype.readDoubleBE=function(e,t){return t||ne(e,8,this.length),g(this,e,!1,52,8)},A.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ie(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},A.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,1,255,0),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},A.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):oe(this,e,t,!0),t+2},A.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):oe(this,e,t,!1),t+2},A.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ae(this,e,t,!0),t+4},A.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ae(this,e,t,!1),t+4},A.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ie(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},A.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);ie(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},A.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,1,127,-128),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},A.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):oe(this,e,t,!0),t+2},A.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):oe(this,e,t,!1),t+2},A.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,4,2147483647,-2147483648),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ae(this,e,t,!0),t+4},A.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||ie(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ae(this,e,t,!1),t+4},A.prototype.writeFloatLE=function(e,t,r){return ce(this,e,t,!0,r)},A.prototype.writeFloatBE=function(e,t,r){return ce(this,e,t,!1,r)},A.prototype.writeDoubleLE=function(e,t,r){return ue(this,e,t,!0,r)},A.prototype.writeDoubleBE=function(e,t,r){return ue(this,e,t,!1,r)},A.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!A.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(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=65536+(i-55296<<10|r-56320)}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))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function me(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function be(e){return p(de(e))}function ge(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function ye(e){return e!==e}function _e(e){return null!=e&&(!!e._isBuffer||we(e)||xe(e))}function we(e){return!!e.constructor&&"function"===typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function xe(e){return"function"===typeof e.readFloatLE&&"function"===typeof e.slice&&we(e.slice(0,0))}var Ee=Object.freeze({__proto__:null,Buffer:A,INSPECT_MAX_BYTES:x,SlowBuffer:B,isBuffer:_e,kMaxLength:E}),Se=function(e,t){for(var r=Math.min(e.length,t.length),n=new A(r),i=0;i>o%8,e._prev=Fe(e._prev,r?n:i);return s}function Fe(e,t){var r=e.length,n=-1,i=De.allocUnsafe(e.length);for(e=De.concat([e,De.from([t])]);++n>7;return i}Be.encrypt=function(e,t,r){for(var n=t.length,i=De.allocUnsafe(n),o=-1;++o>>24]^f[p>>>16&255]^d[m>>>8&255]^l[255&v]^t[b++],a=u[p>>>24]^f[m>>>16&255]^d[v>>>8&255]^l[255&h]^t[b++],s=u[m>>>24]^f[v>>>16&255]^d[h>>>8&255]^l[255&p]^t[b++],c=u[v>>>24]^f[h>>>16&255]^d[p>>>8&255]^l[255&m]^t[b++],h=o,p=a,m=s,v=c;return o=(n[h>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&v])^t[b++],a=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[v>>>8&255]<<8|n[255&h])^t[b++],s=(n[m>>>24]<<24|n[v>>>16&255]<<16|n[h>>>8&255]<<8|n[255&p])^t[b++],c=(n[v>>>24]<<24|n[h>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^t[b++],[o>>>=0,a>>>=0,s>>>=0,c>>>=0]}var st,ct=[0,1,2,4,8,16,32,64,128,27,54],ut=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,c=0;c<256;++c){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,n[u]=a;var f=e[a],d=e[f],l=e[d],h=257*e[u]^16843008*u;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*l^65537*d^257*f^16843008*a,o[0][u]=h<<24|h>>>8,o[1][u]=h<<16|h>>>16,o[2][u]=h<<8|h>>>24,o[3][u]=h,0===a?a=s=1:(a=f^e[e[e[l^f]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function ft(e){this._key=it(e),this._reset()}function dt(){}function lt(){lt.init.call(this)}function ht(e){return void 0===e._maxListeners?lt.defaultMaxListeners:e._maxListeners}function pt(e,t,r){if(t)e.call(r);else for(var n=e.length,i=St(e,n),o=0;o0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,_t(s)}}else a=o[t]=r,++e._eventsCount;return e}function _t(e){"function"===typeof console.warn?console.warn(e):console.log(e)}function wt(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function xt(e){var t=this._events;if(t){var r=t[e];if("function"===typeof r)return 1;if(r)return r.length}return 0}function Et(e,t){for(var r=t,n=r+1,i=e.length;n>>24,a=ut.SBOX[a>>>24]<<24|ut.SBOX[a>>>16&255]<<16|ut.SBOX[a>>>8&255]<<8|ut.SBOX[255&a],a^=ct[o/t|0]<<24):t>6&&o%t===4&&(a=ut.SBOX[a>>>24]<<24|ut.SBOX[a>>>16&255]<<16|ut.SBOX[a>>>8&255]<<8|ut.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],c=0;c>>24]]^ut.INV_SUB_MIX[1][ut.SBOX[f>>>16&255]]^ut.INV_SUB_MIX[2][ut.SBOX[f>>>8&255]]^ut.INV_SUB_MIX[3][ut.SBOX[255&f]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},ft.prototype.encryptBlockRaw=function(e){return at(e=it(e),this._keySchedule,ut.SUB_MIX,ut.SBOX,this._nRounds)},ft.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=nt.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},ft.prototype.decryptBlock=function(e){var t=(e=it(e))[1];e[1]=e[3],e[3]=t;var r=at(e,this._invKeySchedule,ut.INV_SUB_MIX,ut.INV_SBOX,this._nRounds),n=nt.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},ft.prototype.scrub=function(){ot(this._keySchedule),ot(this._invKeySchedule),ot(this._key)},rt.AES=ft,dt.prototype=Object.create(null),lt.EventEmitter=lt,lt.usingDomains=!1,lt.prototype.domain=void 0,lt.prototype._events=void 0,lt.prototype._maxListeners=void 0,lt.defaultMaxListeners=10,lt.init=function(){this.domain=null,lt.usingDomains&&st.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new dt,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},lt.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},lt.prototype.getMaxListeners=function(){return ht(this)},lt.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var f="function"===typeof r;switch(n=arguments.length){case 1:pt(r,f,this);break;case 2:mt(r,f,this,arguments[1]);break;case 3:vt(r,f,this,arguments[1],arguments[2]);break;case 4:bt(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0===--this._eventsCount)return this._events=new dt,this;delete n[e]}else Et(r,i);n.removeListener&&this.emit("removeListener",e,a||t)}return this},lt.prototype.off=function(e,t){return this.removeListener(e,t)},lt.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new dt,this._eventsCount=0):r[e]&&(0===--this._eventsCount?this._events=new dt:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o0?Reflect.ownKeys(this._events):[]};var At=Object.freeze({__proto__:null,EventEmitter:lt,default:lt});function Rt(){throw new Error("setTimeout has not been defined")}function Mt(){throw new Error("clearTimeout has not been defined")}var It=Rt,Ot=Mt;function Ct(e){if(It===setTimeout)return setTimeout(e,0);if((It===Rt||!It)&&setTimeout)return It=setTimeout,setTimeout(e,0);try{return It(e,0)}catch(t){try{return It.call(null,e,0)}catch(t){return It.call(this,e,0)}}}function Pt(e){if(Ot===clearTimeout)return clearTimeout(e);if((Ot===Mt||!Ot)&&clearTimeout)return Ot=clearTimeout,clearTimeout(e);try{return Ot(e)}catch(t){try{return Ot.call(null,e)}catch(t){return Ot.call(this,e)}}}"function"===typeof c.setTimeout&&(It=setTimeout),"function"===typeof c.clearTimeout&&(Ot=clearTimeout);var Nt,kt=[],Ut=!1,Bt=-1;function Dt(){Ut&&Nt&&(Ut=!1,Nt.length?kt=Nt.concat(kt):Bt=-1,kt.length&&Lt())}function Lt(){if(!Ut){var e=Ct(Dt);Ut=!0;for(var t=kt.length;t;){for(Nt=kt,kt=[];++Bt1)for(var r=1;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Nr(t)?r.showHidden=t:t&&Zr(r,t),Fr(r.showHidden)&&(r.showHidden=!1),Fr(r.depth)&&(r.depth=2),Fr(r.colors)&&(r.colors=!1),Fr(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Er),Ar(r,e,r.depth)}function Er(e,t){var r=xr.styles[t];return r?"\x1b["+xr.colors[r][0]+"m"+e+"\x1b["+xr.colors[r][1]+"m":e}function Sr(e,t){return e}function Tr(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}function Ar(e,t,r){if(e.customInspect&&t&&Gr(t.inspect)&&t.inspect!==xr&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Dr(n)||(n=Ar(e,n,r)),n}var i=Rr(e,t);if(i)return i;var o=Object.keys(t),a=Tr(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),qr(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Mr(t);if(0===o.length){if(Gr(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(jr(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Hr(t))return e.stylize(Date.prototype.toString.call(t),"date");if(qr(t))return Mr(t)}var c,u="",f=!1,d=["{","}"];return Pr(t)&&(f=!0,d=["[","]"]),Gr(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),jr(t)&&(u=" "+RegExp.prototype.toString.call(t)),Hr(t)&&(u=" "+Date.prototype.toUTCString.call(t)),qr(t)&&(u=" "+Mr(t)),0!==o.length||f&&0!=t.length?r<0?jr(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=f?Ir(e,t,r,a,o):o.map((function(n){return Or(e,t,r,a,n,f)})),e.seen.pop(),Cr(c,u,d)):d[0]+u+d[1]}function Rr(e,t){if(Fr(t))return e.stylize("undefined","undefined");if(Dr(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return Br(t)?e.stylize(""+t,"number"):Nr(t)?e.stylize(""+t,"boolean"):kr(t)?e.stylize("null","null"):void 0}function Mr(e){return"["+Error.prototype.toString.call(e)+"]"}function Ir(e,t,r,n,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Fr(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Cr(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function Pr(e){return Array.isArray(e)}function Nr(e){return"boolean"===typeof e}function kr(e){return null===e}function Ur(e){return null==e}function Br(e){return"number"===typeof e}function Dr(e){return"string"===typeof e}function Lr(e){return"symbol"===typeof e}function Fr(e){return void 0===e}function jr(e){return zr(e)&&"[object RegExp]"===Vr(e)}function zr(e){return"object"===typeof e&&null!==e}function Hr(e){return zr(e)&&"[object Date]"===Vr(e)}function qr(e){return zr(e)&&("[object Error]"===Vr(e)||e instanceof Error)}function Gr(e){return"function"===typeof e}function Wr(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e||"symbol"===typeof e||"undefined"===typeof e}function Yr(e){return A.isBuffer(e)}function Vr(e){return Object.prototype.toString.call(e)}function Xr(e){return e<10?"0"+e.toString(10):e.toString(10)}xr.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},xr.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Kr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Qr(){var e=new Date,t=[Xr(e.getHours()),Xr(e.getMinutes()),Xr(e.getSeconds())].join(":");return[e.getDate(),Kr[e.getMonth()],t].join(" ")}function Jr(){console.log("%s - %s",Qr(),br.apply(null,arguments))}function Zr(e,t){if(!t||!zr(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function $r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var en="undefined"!==typeof Symbol?Symbol("util.promisify.custom"):void 0;function tn(e){if("function"!==typeof e)throw new TypeError('The "original" argument must be of type Function');if(en&&e[en]){var t;if("function"!==typeof(t=e[en]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,en,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o0?this.tail.next=t:this.head=t,this.tail=t,++this.length},sn.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},sn.prototype.shift=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}},sn.prototype.clear=function(){this.head=this.tail=null,this.length=0},sn.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},sn.prototype.concat=function(e){if(0===this.length)return A.alloc(0);if(1===this.length)return this.head.data;for(var t=A.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var cn=A.isEncoding||function(e){switch(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 un(e){if(e&&!cn(e))throw new Error("Unknown encoding: "+e)}function fn(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),un(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=ln;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=hn;break;default:return void(this.write=dn)}this.charBuffer=new A(6),this.charReceived=0,this.charLength=0}function dn(e){return e.toString(this.encoding)}function ln(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function hn(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}fn.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(n=t.charCodeAt(i))>=55296&&n<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},fn.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},fn.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};var pn=Object.freeze({__proto__:null,StringDecoder:fn});yn.ReadableState=gn;var mn=wr("stream");function vn(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)}function bn(e,t){return e.listeners(t).length}function gn(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof hi&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new sn,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.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new fn(e.encoding),this.encoding=e.encoding)}function yn(e){if(!(this instanceof yn))return new yn(e);this._readableState=new gn(e,this),this.readable=!0,e&&"function"===typeof e.read&&(this._read=e.read),lt.call(this)}function _n(e,t,r,n,i){var o=Tn(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,An(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var c;!t.decoder||i||n||(r=t.decoder.write(r),c=!t.objectMode&&0===r.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Rn(e))),In(e,t)}else i||(t.reading=!1);return wn(t)}function wn(e){return!e.ended&&(e.needReadable||e.length=xn?e=xn:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Sn(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=En(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Tn(e,t){var r=null;return A.isBuffer(t)||"string"===typeof t||null===t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function An(e,t){if(!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,Rn(e)}}function Rn(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(mn("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ft(Mn,e):Mn(e))}function Mn(e){mn("emit readable"),e.emit("readable"),Un(e)}function In(e,t){t.readingMore||(t.readingMore=!0,Ft(On,e,t))}function On(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=Dn(e,t.buffer,t.decoder),r);var r}function Dn(e,t,r){var n;return eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}function Fn(e,t){var r=A.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}function jn(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ft(zn,t,e))}function zn(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Hn(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return mn("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?jn(this):Rn(this),null;if(0===(e=Sn(e,t))&&t.ended)return 0===t.length&&jn(this),null;var n,i=t.needReadable;return mn("need readable",i),(0===t.length||t.length-e0?Bn(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&jn(this)),null!==n&&this.emit("data",n),n},yn.prototype._read=function(e){this.emit("error",new Error("not implemented"))},yn.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,mn("pipe count=%d opts=%j",n.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){mn("onunpipe"),e===r&&u()}function a(){mn("onend"),e.end()}n.endEmitted?Ft(i):r.once("end",i),e.on("unpipe",o);var s=Cn(r);e.on("drain",s);var c=!1;function u(){mn("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",l),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",u),r.removeListener("data",d),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function d(t){mn("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==qn(n.pipes,e))&&!c&&(mn("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function l(t){mn("onerror",t),m(),e.removeListener("error",l),0===bn(e,"error")&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){mn("onfinish"),e.removeListener("close",h),m()}function m(){mn("unpipe"),r.unpipe(e)}return r.on("data",d),vn(e,"error",l),e.once("close",h),e.once("finish",p),e.emit("pipe",r),n.flowing||(mn("pipe resume"),r.resume()),e},yn.prototype.unpipe=function(e){var t=this._readableState;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)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Vn.prototype._write=function(e,t,r){r(new Error("not implemented"))},Vn.prototype._writev=null,Vn.prototype.end=function(e,t,r){var n=this._writableState;"function"===typeof e?(r=e,e=null,t=null):"function"===typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||ci(this,n,r)},pr(hi,yn);for(var fi=Object.keys(Vn.prototype),di=0;di>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function Ui(e){this.h=e,this.state=Ci.alloc(16,0),this.cache=Ci.allocUnsafe(0)}Ui.prototype.ghash=function(e){for(var t=-1;++t0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=r[0]^225<<24)}this.state=ki(n)},Ui.prototype.update=function(e){var t;for(this.cache=Ci.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},Ui.prototype.final=function(e,t){return this.cache.length&&this.ghash(Ci.concat([this.cache,Pi],16)),this.ghash(ki([0,e,0,t])),this.state};var Bi=Ui,Di=rt,Li=Ie.Buffer,Fi=Oi,ji=Bi,zi=Se,Hi=We;function qi(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i0?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 c.alloc(0);for(var t=c.allocUnsafe(e>>>0),r=this.head,n=0;r;)d(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return ei.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=c.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:f,value:function(e,r){return u(this,t(t({},r),{},{depth:0,customInspect:!1}))}}]),e}(),Ji}function oo(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,hr.nextTick(uo,this,e)):hr.nextTick(uo,this,e)),this):(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?hr.nextTick(so,r):(r._writableState.errorEmitted=!0,hr.nextTick(ao,r,e)):hr.nextTick(ao,r,e):t?(hr.nextTick(so,r),t(e)):hr.nextTick(so,r)})),this)}function ao(e,t){uo(e,t),so(e)}function so(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function co(){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)}function uo(e,t){e.emit("error",t)}function fo(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var lo={destroy:oo,undestroy:co,errorOrDestroy:fo},ho={};function po(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var mo={};function vo(e,t,r){function n(e,r,n){return"string"===typeof t?t:t(e,r,n)}r||(r=Error);var i=function(e){function t(t,r,i){return e.call(this,n(t,r,i))||this}return po(t,e),t}(r);i.prototype.name=r.name,i.prototype.code=e,mo[e]=i}function bo(e,t){if(Array.isArray(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])}return"of ".concat(t," ").concat(String(e))}function go(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function yo(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function _o(e,t,r){return"number"!==typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}vo("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),vo("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i;if("string"===typeof t&&go(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be",yo(e," argument"))i="The ".concat(e," ").concat(n," ").concat(bo(t,"type"));else{var o=_o(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(n," ").concat(bo(t,"type"))}return i+=". Received type ".concat(typeof r)}),TypeError),vo("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),vo("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),vo("ERR_STREAM_PREMATURE_CLOSE","Premature close"),vo("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),vo("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),vo("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),vo("ERR_STREAM_WRITE_AFTER_END","write after end"),vo("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),vo("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),vo("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ho.codes=mo;var wo=ho.codes.ERR_INVALID_OPT_VALUE;function xo(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function Eo(e,t,r,n){var i=xo(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new wo(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}var So,To,Ao,Ro,Mo={getHighWaterMark:Eo},Io=Oo;function Oo(e,t){if(Co("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Co("throwDeprecation"))throw new Error(t);Co("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Co(e){try{if(!t.localStorage)return!1}catch(n){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}function Po(){if(To)return So;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){z(t,e)}}var r;To=1,So=S,S.WritableState=E;var n={deprecate:Io},i=ro,o=Me.Buffer,a=("undefined"!==typeof t?t:"undefined"!==typeof window?window:"undefined"!==typeof self?self:{}).Uint8Array||function(){};function s(e){return o.from(e)}function c(e){return o.isBuffer(e)||e instanceof a}var u,f=lo,d=Mo.getHighWaterMark,l=ho.codes,h=l.ERR_INVALID_ARG_TYPE,p=l.ERR_METHOD_NOT_IMPLEMENTED,m=l.ERR_MULTIPLE_CALLBACK,v=l.ERR_STREAM_CANNOT_PIPE,b=l.ERR_STREAM_DESTROYED,g=l.ERR_STREAM_NULL_VALUES,y=l.ERR_STREAM_WRITE_AFTER_END,_=l.ERR_UNKNOWN_ENCODING,w=f.errorOrDestroy;function x(){}function E(t,n,i){r=r||No(),t=t||{},"boolean"!==typeof i&&(i=n instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){P(n,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!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function S(e){var t=this instanceof(r=r||No());if(!t&&!u.call(S,this))return new S(e);this._writableState=new E(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)),i.call(this)}function T(e,t){var r=new y;w(e,r),hr.nextTick(t,r)}function A(e,t,r,n){var i;return null===r?i=new g:"string"===typeof r||t.objectMode||(i=new h("chunk",["string","Buffer"],r)),!i||(w(e,i),hr.nextTick(n,i),!1)}function R(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!==typeof t||(t=o.from(t,r)),t}function M(e,t,r,n,i,o){if(!r){var a=R(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var c=t.length-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(e,t,r){r(new p("_write()"))},S.prototype._writev=null,S.prototype.end=function(e,t,r){var n=this._writableState;return"function"===typeof e?(r=e,e=null,t=null):"function"===typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||j(this,n,r),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=f.destroy,S.prototype._undestroy=f.undestroy,S.prototype._destroy=function(e,t){t(e)},So}function No(){if(Ro)return Ao;Ro=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};Ao=a;var t=Xo(),r=Po();Ti(a,t);for(var n=e(r.prototype),i=0;i0)if("string"===typeof t||u.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=a(t)),n)u.endEmitted?w(e,new _):R(e,u,t,!0);else if(u.ended)w(e,new g);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(t=u.decoder.write(t),u.objectMode||0!==t.length?R(e,u,t,!1):U(e,u)):R(e,u,t,!1)}else n||(u.reading=!1,U(e,u));return!u.ended&&(u.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function C(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=O(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e,t){if(c("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?N(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,k(e)))}}function N(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,hr.nextTick(k,e))}function k(e){var t=e._readableState;c("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,H(e)}function U(e,t){t.readingMore||(t.readingMore=!0,hr.nextTick(B,e,t))}function B(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function F(e){c("readable nexttick read 0"),e.read(0)}function j(e,t){t.resumeScheduled||(t.resumeScheduled=!0,hr.nextTick(z,e,t))}function z(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),H(e),t.flowing&&!t.reading&&e.read(0)}function H(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function q(e,t){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);var r}function G(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,hr.nextTick(W,t,e))}function W(e,t){if(c("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 Y(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?G(this):N(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&G(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?q(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&G(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){w(this,new y("_read()"))},T.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var o=t&&!1===t.end||e===hr.stdout||e===hr.stderr?v:s;function a(e,t){c("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function s(){c("onend"),e.end()}i.endEmitted?hr.nextTick(o):n.once("end",o),e.on("unpipe",a);var u=D(n);e.on("drain",u);var f=!1;function d(){c("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",u),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",s),n.removeListener("end",v),n.removeListener("data",l),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u()}function l(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Y(i.pipes,e))&&!f&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(t){c("onerror",t),v(),e.removeListener("error",h),0===r(e,"error")&&w(e,t)}function p(){e.removeListener("finish",m),v()}function m(){c("onfinish"),e.removeListener("close",p),v()}function v(){c("unpipe"),n.unpipe(e)}return n.on("data",l),E(e,"error",h),e.once("close",p),e.once("finish",m),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},T.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;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?N(this):i.reading||hr.nextTick(F,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&hr.nextTick(L,this),r},T.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||hr.nextTick(L,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,j(this,e)),e.paused=!1,this},T.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o0,(function(e){n||(n=e),e&&o.forEach(ba),a||(o.forEach(ba),i(n))}))}));return t.reduce(ga)}var wa=_a;!function(e,t){(t=e.exports=Xo()).Stream=t,t.Readable=t,t.Writable=Po(),t.Duplex=No(),t.Transform=Ko,t.PassThrough=sa,t.finished=Wo,t.pipeline=wa}(eo,eo.exports);var xa=eo.exports,Ea=Ie.Buffer,Sa=xa.Transform;function Ta(e,t){if(!Ea.isBuffer(e)&&"string"!==typeof e)throw new TypeError(t+" must be a string or a buffer")}function Aa(e){Sa.call(this),this._block=Ea.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Ti(Aa,Sa),Aa.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(i){n=i}r(n)},Aa.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)},Aa.prototype.update=function(e,t){if(Ta(e,"Data"),this._finalized)throw new Error("Digest already called");Ea.isBuffer(e)||(e=Ea.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},Aa.prototype._update=function(){throw new Error("_update is not implemented")},Aa.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},Aa.prototype._digest=function(){throw new Error("_digest is not implemented")};var Ra=Aa,Ma=Ti,Ia=Ra,Oa=Ie.Buffer,Ca=new Array(16);function Pa(){Ia.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Na(e,t){return e<>>32-t}function ka(e,t,r,n,i,o,a){return Na(e+(t&r|~t&n)+i+o|0,a)+t|0}function Ua(e,t,r,n,i,o,a){return Na(e+(t&n|r&~n)+i+o|0,a)+t|0}function Ba(e,t,r,n,i,o,a){return Na(e+(t^r^n)+i+o|0,a)+t|0}function Da(e,t,r,n,i,o,a){return Na(e+(r^(t|~n))+i+o|0,a)+t|0}Ma(Pa,Ia),Pa.prototype._update=function(){for(var e=Ca,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=ka(r,n,i,o,e[0],3614090360,7),o=ka(o,r,n,i,e[1],3905402710,12),i=ka(i,o,r,n,e[2],606105819,17),n=ka(n,i,o,r,e[3],3250441966,22),r=ka(r,n,i,o,e[4],4118548399,7),o=ka(o,r,n,i,e[5],1200080426,12),i=ka(i,o,r,n,e[6],2821735955,17),n=ka(n,i,o,r,e[7],4249261313,22),r=ka(r,n,i,o,e[8],1770035416,7),o=ka(o,r,n,i,e[9],2336552879,12),i=ka(i,o,r,n,e[10],4294925233,17),n=ka(n,i,o,r,e[11],2304563134,22),r=ka(r,n,i,o,e[12],1804603682,7),o=ka(o,r,n,i,e[13],4254626195,12),i=ka(i,o,r,n,e[14],2792965006,17),r=Ua(r,n=ka(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=Ua(o,r,n,i,e[6],3225465664,9),i=Ua(i,o,r,n,e[11],643717713,14),n=Ua(n,i,o,r,e[0],3921069994,20),r=Ua(r,n,i,o,e[5],3593408605,5),o=Ua(o,r,n,i,e[10],38016083,9),i=Ua(i,o,r,n,e[15],3634488961,14),n=Ua(n,i,o,r,e[4],3889429448,20),r=Ua(r,n,i,o,e[9],568446438,5),o=Ua(o,r,n,i,e[14],3275163606,9),i=Ua(i,o,r,n,e[3],4107603335,14),n=Ua(n,i,o,r,e[8],1163531501,20),r=Ua(r,n,i,o,e[13],2850285829,5),o=Ua(o,r,n,i,e[2],4243563512,9),i=Ua(i,o,r,n,e[7],1735328473,14),r=Ba(r,n=Ua(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=Ba(o,r,n,i,e[8],2272392833,11),i=Ba(i,o,r,n,e[11],1839030562,16),n=Ba(n,i,o,r,e[14],4259657740,23),r=Ba(r,n,i,o,e[1],2763975236,4),o=Ba(o,r,n,i,e[4],1272893353,11),i=Ba(i,o,r,n,e[7],4139469664,16),n=Ba(n,i,o,r,e[10],3200236656,23),r=Ba(r,n,i,o,e[13],681279174,4),o=Ba(o,r,n,i,e[0],3936430074,11),i=Ba(i,o,r,n,e[3],3572445317,16),n=Ba(n,i,o,r,e[6],76029189,23),r=Ba(r,n,i,o,e[9],3654602809,4),o=Ba(o,r,n,i,e[12],3873151461,11),i=Ba(i,o,r,n,e[15],530742520,16),r=Da(r,n=Ba(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=Da(o,r,n,i,e[7],1126891415,10),i=Da(i,o,r,n,e[14],2878612391,15),n=Da(n,i,o,r,e[5],4237533241,21),r=Da(r,n,i,o,e[12],1700485571,6),o=Da(o,r,n,i,e[3],2399980690,10),i=Da(i,o,r,n,e[10],4293915773,15),n=Da(n,i,o,r,e[1],2240044497,21),r=Da(r,n,i,o,e[8],1873313359,6),o=Da(o,r,n,i,e[15],4264355552,10),i=Da(i,o,r,n,e[6],2734768916,15),n=Da(n,i,o,r,e[13],1309151649,21),r=Da(r,n,i,o,e[4],4149444226,6),o=Da(o,r,n,i,e[11],3174756917,10),i=Da(i,o,r,n,e[2],718787259,15),n=Da(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},Pa.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Oa.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var La=Pa,Fa=Ie.Buffer,ja=La;function za(e,t,r,n){if(Fa.isBuffer(e)||(e=Fa.from(e,"binary")),t&&(Fa.isBuffer(t)||(t=Fa.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=r/8,o=Fa.alloc(i),a=Fa.alloc(n||0),s=Fa.alloc(0);i>0||n>0;){var c=new ja;c.update(s),c.update(e),t&&c.update(t),s=c.digest();var u=0;if(i>0){var f=o.length-i;u=Math.min(i,s.length),s.copy(o,f,0,u),i-=u}if(u0){var d=a.length-n,l=Math.min(n,s.length-u);s.copy(a,d,u,u+l),n-=l}}return s.fill(0),{key:o,iv:a}}var Ha=za,qa=tt,Ga=Yi,Wa=Ie.Buffer,Ya=$i,Va=Oi,Xa=rt,Ka=Ha;function Qa(e,t,r){Va.call(this),this._cache=new Za,this._cipher=new Xa.AES(t),this._prev=Wa.from(r),this._mode=e,this._autopadding=!0}Ti(Qa,Va),Qa.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return Wa.concat(n)};var Ja=Wa.alloc(16,16);function Za(){this.cache=Wa.allocUnsafe(0)}function $a(e,t,r){var n=qa[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"===typeof t&&(t=Wa.from(t)),t.length!==n.key/8)throw new TypeError("invalid key length "+t.length);if("string"===typeof r&&(r=Wa.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===n.type?new Ya(n.module,t,r):"auth"===n.type?new Ga(n.module,t,r):new Qa(n.module,t,r)}function es(e,t){var r=qa[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=Ka(t,!1,r.key,r.iv);return $a(e,n.key,n.iv)}Qa.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(Ja))throw this._cipher.scrub(),new Error("data not multiple of block length")},Qa.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Za.prototype.add=function(e){this.cache=Wa.concat([this.cache,e])},Za.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Za.prototype.flush=function(){for(var e=16-this.cache.length,t=Wa.allocUnsafe(e),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},fs.prototype.flush=function(){if(this.cache.length)return this.cache},ts.createDecipher=hs,ts.createDecipheriv=ls,e.getCiphers=void 0;var ps=o,ms=ts,vs=Je;function bs(){return Object.keys(vs)}var gs=ps.createCipher,ys=ps.createCipheriv,_s=ms.createDecipher,ws=ms.createDecipheriv;e.getCiphers=bs;var xs={},Es={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},Ss={},Ts={exports:{}};Ts.exports,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"===typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:Me.Buffer}catch(A){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"===typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2===0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,d=67108863&c,l=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=l;h++){var p=u-h|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?m+n:u[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return r("undefined"!==typeof o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),f=this.clone();if(c){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0===(8191&t)&&(r+=13,t>>>=13),0===(127&t)&&(r+=7,t>>>=7),0===(15&t)&&(r+=4,t>>>=4),0===(3&t)&&(r+=2,t>>>=2),0===(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,v=0|a[2],b=8191&v,g=v>>>13,y=0|a[3],_=8191&y,w=y>>>13,x=0|a[4],E=8191&x,S=x>>>13,T=0|a[5],A=8191&T,R=T>>>13,M=0|a[6],I=8191&M,O=M>>>13,C=0|a[7],P=8191&C,N=C>>>13,k=0|a[8],U=8191&k,B=k>>>13,D=0|a[9],L=8191&D,F=D>>>13,j=0|s[0],z=8191&j,H=j>>>13,q=0|s[1],G=8191&q,W=q>>>13,Y=0|s[2],V=8191&Y,X=Y>>>13,K=0|s[3],Q=8191&K,J=K>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],de=8191&fe,le=fe>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(u+(n=Math.imul(d,z))|0)+((8191&(i=(i=Math.imul(d,H))+Math.imul(l,z)|0))<<13)|0;u=((o=Math.imul(l,H))+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var be=(u+(n=n+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(l,G)|0))<<13)|0;u=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,z),i=(i=Math.imul(b,H))+Math.imul(g,z)|0,o=Math.imul(g,H),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0;var ge=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,V)|0))<<13)|0;u=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,H))+Math.imul(w,z)|0,o=Math.imul(w,H),n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,X)|0;var ye=(u+(n=n+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(l,Q)|0))<<13)|0;u=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(E,z),i=(i=Math.imul(E,H))+Math.imul(S,z)|0,o=Math.imul(S,H),n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,J)|0;var _e=(u+(n=n+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,$)|0))<<13)|0;u=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,H))+Math.imul(R,z)|0,o=Math.imul(R,H),n=n+Math.imul(E,G)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,J)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,ee)|0;var we=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,H))+Math.imul(O,z)|0,o=Math.imul(O,H),n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var xe=(u+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(l,oe)|0))<<13)|0;u=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,H))+Math.imul(N,z)|0,o=Math.imul(N,H),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,X)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((o=o+Math.imul(l,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,H))+Math.imul(B,z)|0,o=Math.imul(B,H),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var Se=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,z),i=(i=Math.imul(L,H))+Math.imul(F,z)|0,o=Math.imul(F,H),n=n+Math.imul(U,G)|0,i=(i=i+Math.imul(U,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,n=n+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,ue)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,le)|0;var Te=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,pe)|0))<<13)|0;u=((o=o+Math.imul(l,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,W))+Math.imul(F,G)|0,o=Math.imul(F,W),n=n+Math.imul(U,V)|0,i=(i=i+Math.imul(U,X)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,n=n+Math.imul(b,de)|0,i=(i=i+Math.imul(b,le)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,le)|0;var Ae=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,X))+Math.imul(F,V)|0,o=Math.imul(F,X),n=n+Math.imul(U,Q)|0,i=(i=i+Math.imul(U,J)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(E,ce)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,ue)|0,n=n+Math.imul(_,de)|0,i=(i=i+Math.imul(_,le)|0)+Math.imul(w,de)|0,o=o+Math.imul(w,le)|0;var Re=(u+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,me)|0)+Math.imul(g,pe)|0))<<13)|0;u=((o=o+Math.imul(g,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,J))+Math.imul(F,Q)|0,o=Math.imul(F,J),n=n+Math.imul(U,$)|0,i=(i=i+Math.imul(U,ee)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,n=n+Math.imul(E,de)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,le)|0;var Me=(u+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;u=((o=o+Math.imul(w,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,$),i=(i=Math.imul(L,ee))+Math.imul(F,$)|0,o=Math.imul(F,ee),n=n+Math.imul(U,re)|0,i=(i=i+Math.imul(U,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(A,de)|0,i=(i=i+Math.imul(A,le)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,le)|0;var Ie=(u+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;u=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(U,oe)|0,i=(i=i+Math.imul(U,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,ce)|0,o=o+Math.imul(N,ue)|0,n=n+Math.imul(I,de)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,le)|0;var Oe=(u+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),n=n+Math.imul(U,ce)|0,i=(i=i+Math.imul(U,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(P,de)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,le)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,ce),i=(i=Math.imul(L,ue))+Math.imul(F,ce)|0,o=Math.imul(F,ue),n=n+Math.imul(U,de)|0,i=(i=i+Math.imul(U,le)|0)+Math.imul(B,de)|0,o=o+Math.imul(B,le)|0;var Pe=(u+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(L,de),i=(i=Math.imul(L,le))+Math.imul(F,de)|0,o=Math.imul(F,le);var Ne=(u+(n=n+Math.imul(U,pe)|0)|0)+((8191&(i=(i=i+Math.imul(U,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var ke=(u+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,c[0]=ve,c[1]=be,c[2]=ge,c[3]=ye,c[4]=_e,c[5]=we,c[6]=xe,c[7]=Ee,c[8]=Se,c[9]=Te,c[10]=Ae,c[11]=Re,c[12]=Me,c[13]=Ie,c[14]=Oe,c[15]=Ce,c[16]=Pe,c[17]=Ne,c[18]=ke,0!==u&&(c[19]=u,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function v(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=h),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?h(this,e,t):r<1024?m(this,e,t):v(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=l(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==f||u>=i);u--){var d=0|this.words[u];this.words[u]=f<<26-o|d>>>o,f=d&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;d--){var l=67108864*(0|n.words[o.length+d])+(0|n.words[o.length+d-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0===(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(f),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0===(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,l=1;0===(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"===typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(_,y),_.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},_.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return g[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var d=this.pow(f,o),l=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v=0;o--){for(var f=t.words[o],d=u-1;d>=0;d--){var l=f>>d&1;a!==n[0]&&(a=this.sqr(a)),0!==l||0!==s?(s<<=1,s|=l,(++c===r||0===o&&0===d)&&(a=this.mul(a,n[s]),c=0,s=0)):c=0}u=26}return a},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},n(T,S),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Ts,t);var As=Ts.exports,Rs=Ms;function Ms(e,t){if(!e)throw new Error(t||"Assertion failed")}Ms.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Is={};(function(e){var t=e;function r(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!==typeof e){for(var n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r}function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n}function a(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=0===(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(a),s=0===(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r}function s(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function c(e){return"string"===typeof e?t.toArray(e,"hex"):e}function u(e){return new r(e,"hex","le")}t.assert=n,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=o,t.getJSF=a,t.cachedProperty=s,t.parseBytes=c,t.intFromLE=u}(Ss);var Os,Cs={exports:{}},Ps={},Ns=i(Object.freeze({__proto__:null,default:Ps}));function ks(e){this.rand=e}if(Cs.exports=function(e){return Os||(Os=new ks(null)),Os.generate(e)},Cs.exports.Rand=ks,ks.prototype.generate=function(e){return this._rand(e)},ks.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Gs=qs;function Ws(e,t){this.curve=e,this.type=t,this.precomputed=null}qs.prototype.point=function(){throw new Error("Not implemented")},qs.prototype.validate=function(){throw new Error("Not implemented")},qs.prototype._fixedNafMul=function(e,t){Hs(e.precomputed);var r=e._getDoubles(),n=js(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Hs(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},qs.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,f=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],b=zs(r[h],r[p]);for(d=Math.max(b[0].length,d),f[h]=new Array(d),f[p]=new Array(d),a=0;a=0;o--){for(var x=0;o>=0;){var E=!0;for(a=0;a=0&&x++,_=_.dblp(x),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),_="affine"===s.type?_.mixedAdd(s):_.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Ws.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},Qs.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},Qs.prototype.pointFromX=function(e,t){(e=new Ys(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Qs.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Qs.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Zs.prototype.isInfinity=function(){return this.inf},Zs.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Zs.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Zs.prototype.getX=function(){return this.x.fromRed()},Zs.prototype.getY=function(){return this.y.fromRed()},Zs.prototype.mul=function(e){return e=new Ys(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Zs.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Zs.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Zs.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Zs.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Zs.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Vs($s,Xs.BasePoint),Qs.prototype.jpoint=function(e,t,r){return new $s(this,e,t,r)},$s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},$s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$s.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),d=n.redMul(u),l=c.redSqr().redIAdd(f).redISub(d).redISub(d),h=c.redMul(d.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,h,p)},$s.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),f=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(f).redISub(f),l=s.redMul(f.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,l,h)},$s.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},$s.prototype.inspect=function(){return this.isInfinity()?"":""},$s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ec=As,tc=Ti,rc=Gs,nc=Ss;function ic(e){rc.call(this,"mont",e),this.a=new ec(e.a,16).toRed(this.red),this.b=new ec(e.b,16).toRed(this.red),this.i4=new ec(4).toRed(this.red).redInvm(),this.two=new ec(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}tc(ic,rc);var oc=ic;function ac(e,t,r){rc.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ec(t,16),this.z=new ec(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}ic.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},tc(ac,rc.BasePoint),ic.prototype.decodePoint=function(e,t){return this.point(nc.toArray(e,t),1)},ic.prototype.point=function(e,t){return new ac(this,e,t)},ic.prototype.pointFromJSON=function(e){return ac.fromJSON(this,e)},ac.prototype.precompute=function(){},ac.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},ac.fromJSON=function(e,t){return new ac(e,t[0],t[1]||e.one)},ac.prototype.inspect=function(){return this.isInfinity()?"":""},ac.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},ac.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},ac.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},ac.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},ac.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=this,o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var a=o.length-1;a>=0;a--)0===o[a]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},ac.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},ac.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},ac.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},ac.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},ac.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var sc=As,cc=Ti,uc=Gs,fc=Ss.assert;function dc(e){this.twisted=1!==(0|e.a),this.mOneA=this.twisted&&-1===(0|e.a),this.extended=this.mOneA,uc.call(this,"edwards",e),this.a=new sc(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new sc(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new sc(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),fc(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|e.c)}cc(dc,uc);var lc=dc;function hc(e,t,r,n,i){uc.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new sc(t,16),this.y=new sc(r,16),this.z=n?new sc(n,16):this.curve.one,this.t=i&&new sc(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}dc.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},dc.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},dc.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},dc.prototype.pointFromX=function(e,t){(e=new sc(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},dc.prototype.pointFromY=function(e,t){(e=new sc(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},dc.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},cc(hc,uc.BasePoint),dc.prototype.pointFromJSON=function(e){return hc.fromJSON(this,e)},dc.prototype.point=function(e,t,r,n){return new hc(this,e,t,r,n)},hc.fromJSON=function(e,t){return new hc(e,t[0],t[1],t[2])},hc.prototype.inspect=function(){return this.isInfinity()?"":""},hc.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},hc.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),c=i.redMul(a),u=o.redMul(s),f=i.redMul(s),d=a.redMul(o);return this.curve.point(c,u,d,f)},hc.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},hc.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},hc.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=o.redMul(a),f=s.redMul(c),d=o.redMul(c),l=a.redMul(s);return this.curve.point(u,f,l,d)},hc.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},hc.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},hc.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},hc.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},hc.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},hc.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},hc.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},hc.prototype.getX=function(){return this.normalize(),this.x.fromRed()},hc.prototype.getY=function(){return this.normalize(),this.y.fromRed()},hc.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},hc.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},hc.prototype.toP=hc.prototype.normalize,hc.prototype.mixedAdd=hc.prototype.add,function(e){var t=e;t.base=Gs,t.short=Js,t.mont=oc,t.edwards=lc}(Ds);var pc={},mc={},vc={},bc=Rs,gc=Ti;function yc(e,t){return 55296===(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1))}function _c(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):yc(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Ec(e,t){for(var r="",n=0;n>>0}return o}function Rc(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function Mc(e,t){return e>>>t|e<<32-t}function Ic(e,t){return e<>>32-t}function Oc(e,t){return e+t>>>0}function Cc(e,t,r){return e+t+r>>>0}function Pc(e,t,r,n){return e+t+r+n>>>0}function Nc(e,t,r,n,i){return e+t+r+n+i>>>0}function kc(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o}function Uc(e,t,r,n){return(t+n>>>0>>0}function Bc(e,t,r,n){return t+n>>>0}function Dc(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0}function Lc(e,t,r,n,i,o,a,s){return t+n+o+s>>>0}function Fc(e,t,r,n,i,o,a,s,c,u){var f=0,d=t;return f+=(d=d+n>>>0)>>0)>>0)>>0)>>0}function jc(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0}function zc(e,t,r){return(t<<32-r|e>>>r)>>>0}function Hc(e,t,r){return(e<<32-r|t>>>r)>>>0}function qc(e,t,r){return e>>>r}function Gc(e,t,r){return(e<<32-r|t>>>r)>>>0}vc.inherits=gc,vc.toArray=_c,vc.toHex=wc,vc.htonl=xc,vc.toHex32=Ec,vc.zero2=Sc,vc.zero8=Tc,vc.join32=Ac,vc.split32=Rc,vc.rotr32=Mc,vc.rotl32=Ic,vc.sum32=Oc,vc.sum32_3=Cc,vc.sum32_4=Pc,vc.sum32_5=Nc,vc.sum64=kc,vc.sum64_hi=Uc,vc.sum64_lo=Bc,vc.sum64_4_hi=Dc,vc.sum64_4_lo=Lc,vc.sum64_5_hi=Fc,vc.sum64_5_lo=jc,vc.rotr64_hi=zc,vc.rotr64_lo=Hc,vc.shr64_hi=qc,vc.shr64_lo=Gc;var Wc={},Yc=vc,Vc=Rs;function Xc(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wc.BlockHash=Xc,Xc.prototype.update=function(e,t){if(e=Yc.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=Yc.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3}function ou(e){return Jc(e,17)^Jc(e,19)^e>>>10}Qc.ft_1=Zc,Qc.ch32=$c,Qc.maj32=eu,Qc.p32=tu,Qc.s0_256=ru,Qc.s1_256=nu,Qc.g0_256=iu,Qc.g1_256=ou;var au=vc,su=Wc,cu=Qc,uu=au.rotl32,fu=au.sum32,du=au.sum32_5,lu=cu.ft_1,hu=su.BlockHash,pu=[1518500249,1859775393,2400959708,3395469782];function mu(){if(!(this instanceof mu))return new mu;hu.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}au.inherits(mu,hu);var vu=mu;mu.blockSize=512,mu.outSize=160,mu.hmacStrength=80,mu.padLength=64,mu.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),Bf(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Yf=Wf;Wf.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Wf.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(n=r,r=t,t=null),r&&(r=qf.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var Jf=As,Zf=Ss,$f=Zf.assert;function ed(e,t){if(e instanceof ed)return e;this._importDER(e,t)||($f(e.r&&e.s,"Signature without r or s"),this.r=new Jf(e.r,16),this.s=new Jf(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var td=ed;function rd(){this.place=0}function nd(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function id(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}ed.prototype._importDER=function(e,t){e=Zf.toArray(e,t);var r=new rd;if(48!==e[r.place++])return!1;var n=nd(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=nd(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=nd(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Jf(o),this.s=new Jf(s),this.recoveryParam=null,!0},ed.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=id(t),r=id(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];od(n,t.length),(n=n.concat(t)).push(2),od(n,r.length);var i=n.concat(r),o=[48];return od(o,i.length),o=o.concat(i),Zf.encode(o,e)};var ad=As,sd=Yf,cd=pc,ud=Bs,fd=Ss.assert,dd=Qf,ld=td;function hd(e){if(!(this instanceof hd))return new hd(e);"string"===typeof e&&(fd(Object.prototype.hasOwnProperty.call(cd,e),"Unknown curve "+e),e=cd[e]),e instanceof cd.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var pd=hd;hd.prototype.keyPair=function(e){return new dd(this,e)},hd.prototype.keyFromPrivate=function(e,t){return dd.fromPrivate(this,e,t)},hd.prototype.keyFromPublic=function(e,t){return dd.fromPublic(this,e,t)},hd.prototype.genKeyPair=function(e){e||(e={});for(var t=new sd({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ud(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new ad(2));;){var i=new ad(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},hd.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},hd.prototype.sign=function(e,t,r,n){"object"===typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new ad(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new sd({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new ad(1)),u=0;;u++){var f=n.k?n.k(u):new ad(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var l=d.getX(),h=l.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==l.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new ld({r:h,s:p,recoveryParam:m})}}}}}},hd.prototype.verify=function(e,t,r,n){e=this._truncateToN(new ad(e,16)),r=this.keyFromPublic(r,n);var i=(t=new ld(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},hd.prototype.recoverPubKey=function(e,t,r,n){fd((3&r)===r,"The recovery param is more than two bits"),t=new ld(t,n);var i=this.n,o=new ad(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var f=t.r.invm(i),d=i.sub(o).mul(f).umod(i),l=s.mul(f).umod(i);return this.g.mulAdd(d,a,l)},hd.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new ld(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var md=Ss,vd=md.assert,bd=md.parseBytes,gd=md.cachedProperty;function yd(e,t){this.eddsa=e,this._secret=bd(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=bd(t.pub)}yd.fromPublic=function(e,t){return t instanceof yd?t:new yd(e,{pub:t})},yd.fromSecret=function(e,t){return t instanceof yd?t:new yd(e,{secret:t})},yd.prototype.secret=function(){return this._secret},gd(yd,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),gd(yd,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),gd(yd,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),gd(yd,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),gd(yd,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),gd(yd,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),yd.prototype.sign=function(e){return vd(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},yd.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},yd.prototype.getSecret=function(e){return vd(this._secret,"KeyPair is public only"),md.encode(this.secret(),e)},yd.prototype.getPublic=function(e){return md.encode(this.pubBytes(),e)};var _d=yd,wd=As,xd=Ss,Ed=xd.assert,Sd=xd.cachedProperty,Td=xd.parseBytes;function Ad(e,t){this.eddsa=e,"object"!==typeof t&&(t=Td(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Ed(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof wd&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Sd(Ad,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Sd(Ad,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Sd(Ad,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Sd(Ad,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Ad.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Ad.prototype.toHex=function(){return xd.encode(this.toBytes(),"hex").toUpperCase()};var Rd=Ad,Md=mc,Id=pc,Od=Ss,Cd=Od.assert,Pd=Od.parseBytes,Nd=_d,kd=Rd;function Ud(e){if(Cd("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Ud))return new Ud(e);e=Id[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Md.sha512}var Bd=Ud;Ud.prototype.sign=function(e,t){e=Pd(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},Ud.prototype.verify=function(e,t,r){e=Pd(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},Ud.prototype.hashInt=function(){for(var e=this.hash(),t=0;tGd||t!==t)throw new TypeError("Bad key length")},Yd=t.process&&t.process.browser?"utf-8":t.process&&t.process.version?parseInt(hr.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",Vd=La,Xd=function(e){return(new Vd).update(e).digest()},Kd=Me.Buffer,Qd=Ti,Jd=Ra,Zd=new Array(16),$d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],el=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],tl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],rl=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],nl=[0,1518500249,1859775393,2400959708,2840853838],il=[1352829926,1548603684,1836072691,2053994217,0];function ol(){Jd.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function al(e,t){return e<>>32-t}function sl(e,t,r,n,i,o,a,s){return al(e+(t^r^n)+o+a|0,s)+i|0}function cl(e,t,r,n,i,o,a,s){return al(e+(t&r|~t&n)+o+a|0,s)+i|0}function ul(e,t,r,n,i,o,a,s){return al(e+((t|~r)^n)+o+a|0,s)+i|0}function fl(e,t,r,n,i,o,a,s){return al(e+(t&n|r&~n)+o+a|0,s)+i|0}function dl(e,t,r,n,i,o,a,s){return al(e+(t^(r|~n))+o+a|0,s)+i|0}Qd(ol,Jd),ol.prototype._update=function(){for(var e=Zd,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,c=0|this._b,u=0|this._c,f=0|this._d,d=0|this._e,l=0;l<80;l+=1){var h,p;l<16?(h=sl(r,n,i,o,a,e[$d[l]],nl[0],tl[l]),p=dl(s,c,u,f,d,e[el[l]],il[0],rl[l])):l<32?(h=cl(r,n,i,o,a,e[$d[l]],nl[1],tl[l]),p=fl(s,c,u,f,d,e[el[l]],il[1],rl[l])):l<48?(h=ul(r,n,i,o,a,e[$d[l]],nl[2],tl[l]),p=ul(s,c,u,f,d,e[el[l]],il[2],rl[l])):l<64?(h=fl(r,n,i,o,a,e[$d[l]],nl[3],tl[l]),p=cl(s,c,u,f,d,e[el[l]],il[3],rl[l])):(h=dl(r,n,i,o,a,e[$d[l]],nl[4],tl[l]),p=sl(s,c,u,f,d,e[el[l]],il[4],rl[l])),r=a,a=o,o=al(i,10),i=n,n=h,s=d,d=f,f=al(u,10),u=c,c=p}var m=this._b+i+f|0;this._b=this._c+o+d|0,this._c=this._d+a+s|0,this._d=this._e+r+c|0,this._e=this._a+n+u|0,this._a=m},ol.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Kd.alloc?Kd.alloc(20):new Kd(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var ll=ol,hl={exports:{}},pl=Ie.Buffer;function ml(e,t){this._block=pl.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}ml.prototype.update=function(e,t){"string"===typeof e&&(t=t||"utf8",e=pl.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},ml.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var vl=ml,bl=Ti,gl=vl,yl=Ie.Buffer,_l=[1518500249,1859775393,-1894007588,-899497514],wl=new Array(80);function xl(){this.init(),this._w=wl,gl.call(this,64,56)}function El(e){return e<<5|e>>>27}function Sl(e){return e<<30|e>>>2}function Tl(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}bl(xl,gl),xl.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},xl.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0;s<16;++s)t[s]=e.readInt32BE(4*s);for(;s<80;++s)t[s]=t[s-3]^t[s-8]^t[s-14]^t[s-16];for(var c=0;c<80;++c){var u=~~(c/20),f=El(r)+Tl(u,n,i,o)+a+t[c]+_l[u]|0;a=o,o=i,i=Sl(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},xl.prototype._hash=function(){var e=yl.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Al=xl,Rl=Ti,Ml=vl,Il=Ie.Buffer,Ol=[1518500249,1859775393,-1894007588,-899497514],Cl=new Array(80);function Pl(){this.init(),this._w=Cl,Ml.call(this,64,56)}function Nl(e){return e<<1|e>>>31}function kl(e){return e<<5|e>>>27}function Ul(e){return e<<30|e>>>2}function Bl(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Rl(Pl,Ml),Pl.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Pl.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0;s<16;++s)t[s]=e.readInt32BE(4*s);for(;s<80;++s)t[s]=Nl(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var c=0;c<80;++c){var u=~~(c/20),f=kl(r)+Bl(u,n,i,o)+a+t[c]+Ol[u]|0;a=o,o=i,i=Ul(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},Pl.prototype._hash=function(){var e=Il.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Dl=Pl,Ll=Ti,Fl=vl,jl=Ie.Buffer,zl=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Hl=new Array(64);function ql(){this.init(),this._w=Hl,Fl.call(this,64,56)}function Gl(e,t,r){return r^e&(t^r)}function Wl(e,t,r){return e&t|r&(e|t)}function Yl(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Vl(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Xl(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Kl(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Ll(ql,Fl),ql.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},ql.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,c=0|this._g,u=0|this._h,f=0;f<16;++f)t[f]=e.readInt32BE(4*f);for(;f<64;++f)t[f]=Kl(t[f-2])+t[f-7]+Xl(t[f-15])+t[f-16]|0;for(var d=0;d<64;++d){var l=u+Vl(a)+Gl(a,s,c)+zl[d]+t[d]|0,h=Yl(r)+Wl(r,n,i)|0;u=c,c=s,s=a,a=o+l|0,o=i,i=n,n=r,r=l+h|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0},ql.prototype._hash=function(){var e=jl.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Ql=ql,Jl=Ti,Zl=Ql,$l=vl,eh=Ie.Buffer,th=new Array(64);function rh(){this.init(),this._w=th,$l.call(this,64,56)}Jl(rh,Zl),rh.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},rh.prototype._hash=function(){var e=eh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var nh=rh,ih=Ti,oh=vl,ah=Ie.Buffer,sh=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],ch=new Array(160);function uh(){this.init(),this._w=ch,oh.call(this,128,112)}function fh(e,t,r){return r^e&(t^r)}function dh(e,t,r){return e&t|r&(e|t)}function lh(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function hh(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ph(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function vh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function bh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function gh(e,t){return e>>>0>>0?1:0}ih(uh,oh),uh.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},uh.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,c=0|this._gh,u=0|this._hh,f=0|this._al,d=0|this._bl,l=0|this._cl,h=0|this._dl,p=0|this._el,m=0|this._fl,v=0|this._gl,b=0|this._hl,g=0;g<32;g+=2)t[g]=e.readInt32BE(4*g),t[g+1]=e.readInt32BE(4*g+4);for(;g<160;g+=2){var y=t[g-30],_=t[g-30+1],w=ph(y,_),x=mh(_,y),E=vh(y=t[g-4],_=t[g-4+1]),S=bh(_,y),T=t[g-14],A=t[g-14+1],R=t[g-32],M=t[g-32+1],I=x+A|0,O=w+T+gh(I,x)|0;O=(O=O+E+gh(I=I+S|0,S)|0)+R+gh(I=I+M|0,M)|0,t[g]=O,t[g+1]=I}for(var C=0;C<160;C+=2){O=t[C],I=t[C+1];var P=dh(r,n,i),N=dh(f,d,l),k=lh(r,f),U=lh(f,r),B=hh(a,p),D=hh(p,a),L=sh[C],F=sh[C+1],j=fh(a,s,c),z=fh(p,m,v),H=b+D|0,q=u+B+gh(H,b)|0;q=(q=(q=q+j+gh(H=H+z|0,z)|0)+L+gh(H=H+F|0,F)|0)+O+gh(H=H+I|0,I)|0;var G=U+N|0,W=k+P+gh(G,U)|0;u=c,b=v,c=s,v=m,s=a,m=p,a=o+q+gh(p=h+H|0,h)|0,o=i,h=l,i=n,l=d,n=r,d=f,r=q+W+gh(f=H+G|0,H)|0}this._al=this._al+f|0,this._bl=this._bl+d|0,this._cl=this._cl+l|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+v|0,this._hl=this._hl+b|0,this._ah=this._ah+r+gh(this._al,f)|0,this._bh=this._bh+n+gh(this._bl,d)|0,this._ch=this._ch+i+gh(this._cl,l)|0,this._dh=this._dh+o+gh(this._dl,h)|0,this._eh=this._eh+a+gh(this._el,p)|0,this._fh=this._fh+s+gh(this._fl,m)|0,this._gh=this._gh+c+gh(this._gl,v)|0,this._hh=this._hh+u+gh(this._hl,b)|0},uh.prototype._hash=function(){var e=ah.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var yh=uh,_h=Ti,wh=yh,xh=vl,Eh=Ie.Buffer,Sh=new Array(160);function Th(){this.init(),this._w=Sh,xh.call(this,128,112)}_h(Th,wh),Th.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Th.prototype._hash=function(){var e=Eh.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ah=Th,Rh=hl.exports=function(e){e=e.toLowerCase();var t=Rh[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Rh.sha=Al,Rh.sha1=Dl,Rh.sha224=nh,Rh.sha256=Ql,Rh.sha384=Ah,Rh.sha512=yh;var Mh=hl.exports,Ih=Ie.Buffer,Oh=function(e,t,r){if(Ih.isBuffer(e))return e;if("string"===typeof e)return Ih.from(e,t);if(ArrayBuffer.isView(e))return Ih.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},Ch=Xd,Ph=ll,Nh=Mh,kh=Ie.Buffer,Uh=Wd,Bh=Yd,Dh=Oh,Lh=kh.alloc(128),Fh={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function jh(e,t,r){var n=zh(e),i="sha512"===e||"sha384"===e?128:64;t.length>i?t=n(t):t.length{"use strict";const n=r(2009),i=r(4038),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|m(e,t);let n=s(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!==typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!==typeof e.length||Q(e.length)?s(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return f(e),s(e<0?0:0|p(e))}function l(e){const t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(i)return n?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function v(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return M(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){let o,a=1,s=e.length,c=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,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;os&&(r=s-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let a;for(n>o/2&&(n=o/2),a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128===(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128===(192&r)&&128===(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128===(192&r)&&128===(192&n)&&128===(192&s)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new 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 new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(o,a),u=this.slice(n,i),f=e.slice(t,r);for(let c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return x(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function M(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let o=t;or)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function k(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function U(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||P(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z((function(e){return k(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Z((function(e){return U(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z((function(e){return k(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Z((function(e){return U(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new 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=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(i=t;i=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function H(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(o+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(o+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(n):">= ".concat(t).concat(n," and <= ").concat(r).concat(n),new F.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!==typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"===typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=" It must be ".concat(t,". Received ").concat(i),n}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(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=65536+(i-55296<<10|r-56320)}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))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function X(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Z(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},4038:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<>1,f=-7,d=r?i-1:0,l=r?-1:1,h=e[t+d];for(d+=l,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+e[t+d],d+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+e[t+d],d+=l,f-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?l/c:l*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=f?(s=0,a=f):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*m}},763:function(e,t,r){var n;e=r.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=16,u=32,f=64,d=128,l=256,h=1/0,p=9007199254740991,m=NaN,v=4294967295,b=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",f],["rearg",l]],g="[object Arguments]",y="[object Array]",_="[object Boolean]",w="[object Date]",x="[object Error]",E="[object Function]",S="[object GeneratorFunction]",T="[object Map]",A="[object Number]",R="[object Object]",M="[object Promise]",I="[object RegExp]",O="[object Set]",C="[object String]",P="[object Symbol]",N="[object WeakMap]",k="[object ArrayBuffer]",U="[object DataView]",B="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",F="[object Int16Array]",j="[object Int32Array]",z="[object Uint8Array]",H="[object Uint8ClampedArray]",q="[object Uint16Array]",G="[object Uint32Array]",W=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,V=/(__e\(.*?\)|\b__t\)) \+\n'';/g,X=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,Q=RegExp(X.source),J=RegExp(K.source),Z=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ie.source),ae=/^\s+/,se=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,fe=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,me=/\w*$/,ve=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,_e=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xe=/($^)/,Ee=/['\n\r\u2028\u2029\\]/g,Se="\\ud800-\\udfff",Te="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ae="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",Me="A-Z\\xc0-\\xd6\\xd8-\\xde",Ie="\\ufe0e\\ufe0f",Oe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="['\u2019]",Pe="["+Se+"]",Ne="["+Oe+"]",ke="["+Te+"]",Ue="\\d+",Be="["+Ae+"]",De="["+Re+"]",Le="[^"+Se+Oe+Ue+Ae+Re+Me+"]",Fe="\\ud83c[\\udffb-\\udfff]",je="[^"+Se+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",He="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Me+"]",Ge="\\u200d",We="(?:"+De+"|"+Le+")",Ye="(?:"+qe+"|"+Le+")",Ve="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Xe="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Ke="(?:"+ke+"|"+Fe+")"+"?",Qe="["+Ie+"]?",Je=Qe+Ke+("(?:"+Ge+"(?:"+[je,ze,He].join("|")+")"+Qe+Ke+")*"),Ze="(?:"+[Be,ze,He].join("|")+")"+Je,$e="(?:"+[je+ke+"?",ke,ze,He,Pe].join("|")+")",et=RegExp(Ce,"g"),tt=RegExp(ke,"g"),rt=RegExp(Fe+"(?="+Fe+")|"+$e+Je,"g"),nt=RegExp([qe+"?"+De+"+"+Ve+"(?="+[Ne,qe,"$"].join("|")+")",Ye+"+"+Xe+"(?="+[Ne,qe+We,"$"].join("|")+")",qe+"?"+We+"+"+Ve,qe+"+"+Xe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ue,Ze].join("|"),"g"),it=RegExp("["+Ge+Se+Te+Ie+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,ct={};ct[B]=ct[D]=ct[L]=ct[F]=ct[j]=ct[z]=ct[H]=ct[q]=ct[G]=!0,ct[g]=ct[y]=ct[k]=ct[_]=ct[U]=ct[w]=ct[x]=ct[E]=ct[T]=ct[A]=ct[R]=ct[I]=ct[O]=ct[C]=ct[N]=!1;var ut={};ut[g]=ut[y]=ut[k]=ut[U]=ut[_]=ut[w]=ut[B]=ut[D]=ut[L]=ut[F]=ut[j]=ut[T]=ut[A]=ut[R]=ut[I]=ut[O]=ut[C]=ut[P]=ut[z]=ut[H]=ut[q]=ut[G]=!0,ut[x]=ut[E]=ut[N]=!1;var ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,lt=parseInt,ht="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,pt="object"==typeof self&&self&&self.Object===Object&&self,mt=ht||pt||Function("return this")(),vt=t&&!t.nodeType&&t,bt=vt&&e&&!e.nodeType&&e,gt=bt&&bt.exports===vt,yt=gt&&ht.process,_t=function(){try{var e=bt&&bt.require&&bt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(t){}}(),wt=_t&&_t.isArrayBuffer,xt=_t&&_t.isDate,Et=_t&&_t.isMap,St=_t&&_t.isRegExp,Tt=_t&&_t.isSet,At=_t&&_t.isTypedArray;function Rt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Mt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function kt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function nr(e,t){for(var r=e.length;r--&&qt(t,e[r],0)>-1;);return r}var ir=Xt({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),or=Xt({"&":"&","<":"<",">":">",'"':""","'":"'"});function ar(e){return"\\"+ft[e]}function sr(e){return it.test(e)}function cr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function ur(e,t){return function(r){return e(t(r))}}function fr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r",""":'"',"'":"'"});var br=function e(t){var r=(t=null==t?mt:br.defaults(mt.Object(),t,br.pick(mt,at))).Array,n=t.Date,se=t.Error,Se=t.Function,Te=t.Math,Ae=t.Object,Re=t.RegExp,Me=t.String,Ie=t.TypeError,Oe=r.prototype,Ce=Se.prototype,Pe=Ae.prototype,Ne=t["__core-js_shared__"],ke=Ce.toString,Ue=Pe.hasOwnProperty,Be=0,De=function(){var e=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Le=Pe.toString,Fe=ke.call(Ae),je=mt._,ze=Re("^"+ke.call(Ue).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=gt?t.Buffer:i,qe=t.Symbol,Ge=t.Uint8Array,We=He?He.allocUnsafe:i,Ye=ur(Ae.getPrototypeOf,Ae),Ve=Ae.create,Xe=Pe.propertyIsEnumerable,Ke=Oe.splice,Qe=qe?qe.isConcatSpreadable:i,Je=qe?qe.iterator:i,Ze=qe?qe.toStringTag:i,$e=function(){try{var e=lo(Ae,"defineProperty");return e({},"",{}),e}catch(t){}}(),rt=t.clearTimeout!==mt.clearTimeout&&t.clearTimeout,it=n&&n.now!==mt.Date.now&&n.now,ft=t.setTimeout!==mt.setTimeout&&t.setTimeout,ht=Te.ceil,pt=Te.floor,vt=Ae.getOwnPropertySymbols,bt=He?He.isBuffer:i,yt=t.isFinite,_t=Oe.join,jt=ur(Ae.keys,Ae),Xt=Te.max,gr=Te.min,yr=n.now,_r=t.parseInt,wr=Te.random,xr=Oe.reverse,Er=lo(t,"DataView"),Sr=lo(t,"Map"),Tr=lo(t,"Promise"),Ar=lo(t,"Set"),Rr=lo(t,"WeakMap"),Mr=lo(Ae,"create"),Ir=Rr&&new Rr,Or={},Cr=Lo(Er),Pr=Lo(Sr),Nr=Lo(Tr),kr=Lo(Ar),Ur=Lo(Rr),Br=qe?qe.prototype:i,Dr=Br?Br.valueOf:i,Lr=Br?Br.toString:i;function Fr(e){if(ts(e)&&!Ga(e)&&!(e instanceof qr)){if(e instanceof Hr)return e;if(Ue.call(e,"__wrapped__"))return Fo(e)}return new Hr(e)}var jr=function(){function e(){}return function(t){if(!es(t))return{};if(Ve)return Ve(t);e.prototype=t;var r=new e;return e.prototype=i,r}}();function zr(){}function Hr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function qr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function cn(e,t,r,n,o,a){var s,c=1&t,u=2&t,f=4&t;if(r&&(s=o?r(e,n,o,a):r(e)),s!==i)return s;if(!es(e))return e;var d=Ga(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Ue.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!c)return Ii(e,s)}else{var l=mo(e),h=l==E||l==S;if(Xa(e))return Ei(e,c);if(l==R||l==g||h&&!o){if(s=u||h?{}:bo(e),!c)return u?function(e,t){return Oi(e,po(e),t)}(e,function(e,t){return e&&Oi(t,Ps(t),e)}(s,e)):function(e,t){return Oi(e,ho(e),t)}(e,nn(s,e))}else{if(!ut[l])return o?e:{};s=function(e,t,r){var n=e.constructor;switch(t){case k:return Si(e);case _:case w:return new n(+e);case U:return function(e,t){var r=t?Si(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case B:case D:case L:case F:case j:case z:case H:case q:case G:return Ti(e,r);case T:return new n;case A:case C:return new n(e);case I:return function(e){var t=new e.constructor(e.source,me.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new n;case P:return i=e,Dr?Ae(Dr.call(i)):{}}var i}(e,l,c)}}a||(a=new Xr);var p=a.get(e);if(p)return p;a.set(e,s),as(e)?e.forEach((function(n){s.add(cn(n,t,r,n,e,a))})):rs(e)&&e.forEach((function(n,i){s.set(i,cn(n,t,r,i,e,a))}));var m=d?i:(f?u?io:no:u?Ps:Cs)(e);return It(m||e,(function(n,i){m&&(n=e[i=n]),en(s,i,cn(n,t,r,i,e,a))})),s}function un(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ae(e);n--;){var o=r[n],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function fn(e,t,r){if("function"!=typeof e)throw new Ie(o);return Co((function(){e.apply(i,r)}),t)}function dn(e,t,r,n){var i=-1,o=Nt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;r&&(t=Ut(t,$t(r))),n?(o=kt,a=!1):t.length>=200&&(o=tr,a=!1,t=new Vr(t));e:for(;++i-1},Wr.prototype.set=function(e,t){var r=this.__data__,n=tn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Yr.prototype.clear=function(){this.size=0,this.__data__={hash:new Gr,map:new(Sr||Wr),string:new Gr}},Yr.prototype.delete=function(e){var t=uo(this,e).delete(e);return this.size-=t?1:0,t},Yr.prototype.get=function(e){return uo(this,e).get(e)},Yr.prototype.has=function(e){return uo(this,e).has(e)},Yr.prototype.set=function(e,t){var r=uo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,a),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Xr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Xr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Xr.prototype.get=function(e){return this.__data__.get(e)},Xr.prototype.has=function(e){return this.__data__.has(e)},Xr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!Sr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Yr(n)}return r.set(e,t),this.size=r.size,this};var ln=Ni(_n),hn=Ni(wn,!0);function pn(e,t){var r=!0;return ln(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function mn(e,t,r){for(var n=-1,o=e.length;++n0&&r(s)?t>1?bn(s,t-1,r,n,i):Bt(i,s):n||(i[i.length]=s)}return i}var gn=ki(),yn=ki(!0);function _n(e,t){return e&&gn(e,t,Cs)}function wn(e,t){return e&&yn(e,t,Cs)}function xn(e,t){return Pt(t,(function(t){return Ja(e[t])}))}function En(e,t){for(var r=0,n=(t=yi(t,e)).length;null!=e&&rt}function Rn(e,t){return null!=e&&Ue.call(e,t)}function Mn(e,t){return null!=e&&t in Ae(e)}function In(e,t,n){for(var o=n?kt:Nt,a=e[0].length,s=e.length,c=s,u=r(s),f=1/0,d=[];c--;){var l=e[c];c&&t&&(l=Ut(l,$t(t))),f=gr(l.length,f),u[c]=!n&&(t||a>=120&&l.length>=120)?new Vr(c&&l):i}l=e[0];var h=-1,p=u[0];e:for(;++h=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function Wn(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&Ke.call(s,c,1),Ke.call(e,c,1);return e}function Vn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;yo(i)?Ke.call(e,i,1):di(e,i)}}return e}function Xn(e,t){return e+pt(wr()*(t-e+1))}function Kn(e,t){var r="";if(!e||t<1||t>p)return r;do{t%2&&(r+=e),(t=pt(t/2))&&(e+=e)}while(t);return r}function Qn(e,t){return Po(Ro(e,t,nc),e+"")}function Jn(e){return Qr(js(e))}function Zn(e,t){var r=js(e);return Uo(r,sn(t,0,r.length))}function $n(e,t,r,n){if(!es(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,c=e;null!=c&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!cs(a)&&(r?a<=t:a=200){var u=t?null:Ki(e);if(u)return dr(u);a=!1,i=tr,c=new Vr}else c=t?[]:s;e:for(;++n=n?e:ni(e,t,r)}var xi=rt||function(e){return mt.clearTimeout(e)};function Ei(e,t){if(t)return e.slice();var r=e.length,n=We?We(r):new e.constructor(r);return e.copy(n),n}function Si(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function Ti(e,t){var r=t?Si(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ai(e,t){if(e!==t){var r=e!==i,n=null===e,o=e===e,a=cs(e),s=t!==i,c=null===t,u=t===t,f=cs(t);if(!c&&!f&&!a&&e>t||a&&s&&u&&!c&&!f||n&&s&&u||!r&&u||!o)return 1;if(!n&&!a&&!f&&e1?r[o-1]:i,s=o>2?r[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,s&&_o(r[0],r[1],s)&&(a=o<3?i:a,o=1),t=Ae(t);++n-1?o[a?t[s]:s]:i}}function Fi(e){return ro((function(t){var r=t.length,n=r,a=Hr.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new Ie(o);if(a&&!c&&"wrapper"==ao(s))var c=new Hr([],!0)}for(n=c?n:r;++n1&&_.reverse(),h&&fc))return!1;var f=a.get(e),d=a.get(t);if(f&&d)return f==t&&d==e;var l=-1,h=!0,p=2&r?new Vr:i;for(a.set(e,t),a.set(t,e);++l-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(b,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(fe):[]}(n),r)))}function ko(e){var t=0,r=0;return function(){var n=yr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Uo(e,t){var r=-1,n=e.length,o=n-1;for(t=t===i?n:t;++r1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,oa(e,r)}));function la(e){var t=Fr(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var pa=ro((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,o=function(t){return an(t,e)};return!(t>1||this.__actions__.length)&&n instanceof qr&&yo(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:i}),new Hr(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var ma=Ci((function(e,t,r){Ue.call(e,r)?++e[r]:on(e,r,1)}));var va=Li(qo),ba=Li(Go);function ga(e,t){return(Ga(e)?It:ln)(e,co(t,3))}function ya(e,t){return(Ga(e)?Ot:hn)(e,co(t,3))}var _a=Ci((function(e,t,r){Ue.call(e,r)?e[r].push(t):on(e,r,[t])}));var wa=Qn((function(e,t,n){var i=-1,o="function"==typeof t,a=Ya(e)?r(e.length):[];return ln(e,(function(e){a[++i]=o?Rt(t,e,n):On(e,t,n)})),a})),xa=Ci((function(e,t,r){on(e,r,t)}));function Ea(e,t){return(Ga(e)?Ut:Fn)(e,co(t,3))}var Sa=Ci((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var Ta=Qn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&_o(e,t[0],t[1])?t=[]:r>2&&_o(t[0],t[1],t[2])&&(t=[t[0]]),Gn(e,bn(t,1),[])})),Aa=it||function(){return mt.Date.now()};function Ra(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Ji(e,d,i,i,i,i,t)}function Ma(e,t){var r;if("function"!=typeof t)throw new Ie(o);return e=ps(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Ia=Qn((function(e,t,r){var n=1;if(r.length){var i=fr(r,so(Ia));n|=u}return Ji(e,n,t,r,i)})),Oa=Qn((function(e,t,r){var n=3;if(r.length){var i=fr(r,so(Oa));n|=u}return Ji(t,n,e,r,i)}));function Ca(e,t,r){var n,a,s,c,u,f,d=0,l=!1,h=!1,p=!0;if("function"!=typeof e)throw new Ie(o);function m(t){var r=n,o=a;return n=a=i,d=t,c=e.apply(o,r)}function v(e){var r=e-f;return f===i||r>=t||r<0||h&&e-d>=s}function b(){var e=Aa();if(v(e))return g(e);u=Co(b,function(e){var r=t-(e-f);return h?gr(r,s-(e-d)):r}(e))}function g(e){return u=i,p&&n?m(e):(n=a=i,c)}function y(){var e=Aa(),r=v(e);if(n=arguments,a=this,f=e,r){if(u===i)return function(e){return d=e,u=Co(b,t),l?m(e):c}(f);if(h)return xi(u),u=Co(b,t),m(f)}return u===i&&(u=Co(b,t)),c}return t=vs(t)||0,es(r)&&(l=!!r.leading,s=(h="maxWait"in r)?Xt(vs(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),y.cancel=function(){u!==i&&xi(u),d=0,n=f=a=u=i},y.flush=function(){return u===i?c:g(Aa())},y}var Pa=Qn((function(e,t){return fn(e,1,t)})),Na=Qn((function(e,t,r){return fn(e,vs(t)||0,r)}));function ka(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(o);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ka.Cache||Yr),r}function Ua(e){if("function"!=typeof e)throw new Ie(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ka.Cache=Yr;var Ba=_i((function(e,t){var r=(t=1==t.length&&Ga(t[0])?Ut(t[0],$t(co())):Ut(bn(t,1),$t(co()))).length;return Qn((function(n){for(var i=-1,o=gr(n.length,r);++i=t})),qa=Cn(function(){return arguments}())?Cn:function(e){return ts(e)&&Ue.call(e,"callee")&&!Xe.call(e,"callee")},Ga=r.isArray,Wa=wt?$t(wt):function(e){return ts(e)&&Tn(e)==k};function Ya(e){return null!=e&&$a(e.length)&&!Ja(e)}function Va(e){return ts(e)&&Ya(e)}var Xa=bt||vc,Ka=xt?$t(xt):function(e){return ts(e)&&Tn(e)==w};function Qa(e){if(!ts(e))return!1;var t=Tn(e);return t==x||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Ja(e){if(!es(e))return!1;var t=Tn(e);return t==E||t==S||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==ps(e)}function $a(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function es(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ts(e){return null!=e&&"object"==typeof e}var rs=Et?$t(Et):function(e){return ts(e)&&mo(e)==T};function ns(e){return"number"==typeof e||ts(e)&&Tn(e)==A}function is(e){if(!ts(e)||Tn(e)!=R)return!1;var t=Ye(e);if(null===t)return!0;var r=Ue.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ke.call(r)==Fe}var os=St?$t(St):function(e){return ts(e)&&Tn(e)==I};var as=Tt?$t(Tt):function(e){return ts(e)&&mo(e)==O};function ss(e){return"string"==typeof e||!Ga(e)&&ts(e)&&Tn(e)==C}function cs(e){return"symbol"==typeof e||ts(e)&&Tn(e)==P}var us=At?$t(At):function(e){return ts(e)&&$a(e.length)&&!!ct[Tn(e)]};var fs=Yi(Ln),ds=Yi((function(e,t){return e<=t}));function ls(e){if(!e)return[];if(Ya(e))return ss(e)?pr(e):Ii(e);if(Je&&e[Je])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Je]());var t=mo(e);return(t==T?cr:t==O?dr:js)(e)}function hs(e){return e?(e=vs(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e===e?e:0:0===e?e:0}function ps(e){var t=hs(e),r=t%1;return t===t?r?t-r:t:0}function ms(e){return e?sn(ps(e),0,v):0}function vs(e){if("number"==typeof e)return e;if(cs(e))return m;if(es(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=es(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var r=be.test(e);return r||ye.test(e)?lt(e.slice(2),r?2:8):ve.test(e)?m:+e}function bs(e){return Oi(e,Ps(e))}function gs(e){return null==e?"":ui(e)}var ys=Pi((function(e,t){if(So(t)||Ya(t))Oi(t,Cs(t),e);else for(var r in t)Ue.call(t,r)&&en(e,r,t[r])})),_s=Pi((function(e,t){Oi(t,Ps(t),e)})),ws=Pi((function(e,t,r,n){Oi(t,Ps(t),e,n)})),xs=Pi((function(e,t,r,n){Oi(t,Cs(t),e,n)})),Es=ro(an);var Ss=Qn((function(e,t){e=Ae(e);var r=-1,n=t.length,o=n>2?t[2]:i;for(o&&_o(t[0],t[1],o)&&(n=1);++r1),t})),Oi(e,io(e),r),n&&(r=cn(r,7,eo));for(var i=t.length;i--;)di(r,t[i]);return r}));var Bs=ro((function(e,t){return null==e?{}:function(e,t){return Wn(e,t,(function(t,r){return Rs(e,r)}))}(e,t)}));function Ds(e,t){if(null==e)return{};var r=Ut(io(e),(function(e){return[e]}));return t=co(t),Wn(e,r,(function(e,r){return t(e,r[0])}))}var Ls=Qi(Cs),Fs=Qi(Ps);function js(e){return null==e?[]:er(e,Cs(e))}var zs=Bi((function(e,t,r){return t=t.toLowerCase(),e+(r?Hs(t):t)}));function Hs(e){return Qs(gs(e).toLowerCase())}function qs(e){return(e=gs(e))&&e.replace(we,ir).replace(tt,"")}var Gs=Bi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Ws=Bi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ys=Ui("toLowerCase");var Vs=Bi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Xs=Bi((function(e,t,r){return e+(r?" ":"")+Qs(t)}));var Ks=Bi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Qs=Ui("toUpperCase");function Js(e,t,r){return e=gs(e),(t=r?i:t)===i?function(e){return ot.test(e)}(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Zs=Qn((function(e,t){try{return Rt(e,i,t)}catch(r){return Qa(r)?r:new se(r)}})),$s=ro((function(e,t){return It(t,(function(t){t=Do(t),on(e,t,Ia(e[t],e))})),e}));function ec(e){return function(){return e}}var tc=Fi(),rc=Fi(!0);function nc(e){return e}function ic(e){return Un("function"==typeof e?e:cn(e,1))}var oc=Qn((function(e,t){return function(r){return On(r,e,t)}})),ac=Qn((function(e,t){return function(r){return On(e,r,t)}}));function sc(e,t,r){var n=Cs(t),i=xn(t,n);null!=r||es(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Cs(t)));var o=!(es(r)&&"chain"in r)||!!r.chain,a=Ja(e);return It(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ii(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Bt([this.value()],arguments))})})),e}function cc(){}var uc=qi(Ut),fc=qi(Ct),dc=qi(Ft);function lc(e){return wo(e)?Vt(Do(e)):function(e){return function(t){return En(t,e)}}(e)}var hc=Wi(),pc=Wi(!0);function mc(){return[]}function vc(){return!1}var bc=Hi((function(e,t){return e+t}),0),gc=Xi("ceil"),yc=Hi((function(e,t){return e/t}),1),_c=Xi("floor");var wc=Hi((function(e,t){return e*t}),1),xc=Xi("round"),Ec=Hi((function(e,t){return e-t}),0);return Fr.after=function(e,t){if("function"!=typeof t)throw new Ie(o);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},Fr.ary=Ra,Fr.assign=ys,Fr.assignIn=_s,Fr.assignInWith=ws,Fr.assignWith=xs,Fr.at=Es,Fr.before=Ma,Fr.bind=Ia,Fr.bindAll=$s,Fr.bindKey=Oa,Fr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Fr.chain=la,Fr.chunk=function(e,t,n){t=(n?_o(e,t,n):t===i)?1:Xt(ps(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,c=r(ht(o/t));ao?0:o+r),(n=n===i||n>o?o:ps(n))<0&&(n+=o),n=r>n?0:ms(n);r>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=ui(t))&&sr(e)?wi(pr(e),0,r):e.split(t,r):[]},Fr.spread=function(e,t){if("function"!=typeof e)throw new Ie(o);return t=null==t?0:Xt(ps(t),0),Qn((function(r){var n=r[t],i=wi(r,0,t);return n&&Bt(i,n),Rt(e,this,i)}))},Fr.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},Fr.take=function(e,t,r){return e&&e.length?ni(e,0,(t=r||t===i?1:ps(t))<0?0:t):[]},Fr.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?ni(e,(t=n-(t=r||t===i?1:ps(t)))<0?0:t,n):[]},Fr.takeRightWhile=function(e,t){return e&&e.length?hi(e,co(t,3),!1,!0):[]},Fr.takeWhile=function(e,t){return e&&e.length?hi(e,co(t,3)):[]},Fr.tap=function(e,t){return t(e),e},Fr.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Ie(o);return es(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Ca(e,t,{leading:n,maxWait:t,trailing:i})},Fr.thru=ha,Fr.toArray=ls,Fr.toPairs=Ls,Fr.toPairsIn=Fs,Fr.toPath=function(e){return Ga(e)?Ut(e,Do):cs(e)?[e]:Ii(Bo(gs(e)))},Fr.toPlainObject=bs,Fr.transform=function(e,t,r){var n=Ga(e),i=n||Xa(e)||us(e);if(t=co(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:es(e)&&Ja(o)?jr(Ye(e)):{}}return(i?It:_n)(e,(function(e,n,i){return t(r,e,n,i)})),r},Fr.unary=function(e){return Ra(e,1)},Fr.union=ta,Fr.unionBy=ra,Fr.unionWith=na,Fr.uniq=function(e){return e&&e.length?fi(e):[]},Fr.uniqBy=function(e,t){return e&&e.length?fi(e,co(t,2)):[]},Fr.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?fi(e,i,t):[]},Fr.unset=function(e,t){return null==e||di(e,t)},Fr.unzip=ia,Fr.unzipWith=oa,Fr.update=function(e,t,r){return null==e?e:li(e,t,gi(r))},Fr.updateWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:li(e,t,gi(r),n)},Fr.values=js,Fr.valuesIn=function(e){return null==e?[]:er(e,Ps(e))},Fr.without=aa,Fr.words=Js,Fr.wrap=function(e,t){return Da(gi(t),e)},Fr.xor=sa,Fr.xorBy=ca,Fr.xorWith=ua,Fr.zip=fa,Fr.zipObject=function(e,t){return vi(e||[],t||[],en)},Fr.zipObjectDeep=function(e,t){return vi(e||[],t||[],$n)},Fr.zipWith=da,Fr.entries=Ls,Fr.entriesIn=Fs,Fr.extend=_s,Fr.extendWith=ws,sc(Fr,Fr),Fr.add=bc,Fr.attempt=Zs,Fr.camelCase=zs,Fr.capitalize=Hs,Fr.ceil=gc,Fr.clamp=function(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=vs(r))===r?r:0),t!==i&&(t=(t=vs(t))===t?t:0),sn(vs(e),t,r)},Fr.clone=function(e){return cn(e,4)},Fr.cloneDeep=function(e){return cn(e,5)},Fr.cloneDeepWith=function(e,t){return cn(e,5,t="function"==typeof t?t:i)},Fr.cloneWith=function(e,t){return cn(e,4,t="function"==typeof t?t:i)},Fr.conformsTo=function(e,t){return null==t||un(e,t,Cs(t))},Fr.deburr=qs,Fr.defaultTo=function(e,t){return null==e||e!==e?t:e},Fr.divide=yc,Fr.endsWith=function(e,t,r){e=gs(e),t=ui(t);var n=e.length,o=r=r===i?n:sn(ps(r),0,n);return(r-=t.length)>=0&&e.slice(r,o)==t},Fr.eq=ja,Fr.escape=function(e){return(e=gs(e))&&J.test(e)?e.replace(K,or):e},Fr.escapeRegExp=function(e){return(e=gs(e))&&oe.test(e)?e.replace(ie,"\\$&"):e},Fr.every=function(e,t,r){var n=Ga(e)?Ct:pn;return r&&_o(e,t,r)&&(t=i),n(e,co(t,3))},Fr.find=va,Fr.findIndex=qo,Fr.findKey=function(e,t){return zt(e,co(t,3),_n)},Fr.findLast=ba,Fr.findLastIndex=Go,Fr.findLastKey=function(e,t){return zt(e,co(t,3),wn)},Fr.floor=_c,Fr.forEach=ga,Fr.forEachRight=ya,Fr.forIn=function(e,t){return null==e?e:gn(e,co(t,3),Ps)},Fr.forInRight=function(e,t){return null==e?e:yn(e,co(t,3),Ps)},Fr.forOwn=function(e,t){return e&&_n(e,co(t,3))},Fr.forOwnRight=function(e,t){return e&&wn(e,co(t,3))},Fr.get=As,Fr.gt=za,Fr.gte=Ha,Fr.has=function(e,t){return null!=e&&vo(e,t,Rn)},Fr.hasIn=Rs,Fr.head=Yo,Fr.identity=nc,Fr.includes=function(e,t,r,n){e=Ya(e)?e:js(e),r=r&&!n?ps(r):0;var i=e.length;return r<0&&(r=Xt(i+r,0)),ss(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&qt(e,t,r)>-1},Fr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ps(r);return i<0&&(i=Xt(n+i,0)),qt(e,t,i)},Fr.inRange=function(e,t,r){return t=hs(t),r===i?(r=t,t=0):r=hs(r),function(e,t,r){return e>=gr(t,r)&&e=-9007199254740991&&e<=p},Fr.isSet=as,Fr.isString=ss,Fr.isSymbol=cs,Fr.isTypedArray=us,Fr.isUndefined=function(e){return e===i},Fr.isWeakMap=function(e){return ts(e)&&mo(e)==N},Fr.isWeakSet=function(e){return ts(e)&&"[object WeakSet]"==Tn(e)},Fr.join=function(e,t){return null==e?"":_t.call(e,t)},Fr.kebabCase=Gs,Fr.last=Qo,Fr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=ps(r))<0?Xt(n+o,0):gr(o,n-1)),t===t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Ht(e,Wt,o,!0)},Fr.lowerCase=Ws,Fr.lowerFirst=Ys,Fr.lt=fs,Fr.lte=ds,Fr.max=function(e){return e&&e.length?mn(e,nc,An):i},Fr.maxBy=function(e,t){return e&&e.length?mn(e,co(t,2),An):i},Fr.mean=function(e){return Yt(e,nc)},Fr.meanBy=function(e,t){return Yt(e,co(t,2))},Fr.min=function(e){return e&&e.length?mn(e,nc,Ln):i},Fr.minBy=function(e,t){return e&&e.length?mn(e,co(t,2),Ln):i},Fr.stubArray=mc,Fr.stubFalse=vc,Fr.stubObject=function(){return{}},Fr.stubString=function(){return""},Fr.stubTrue=function(){return!0},Fr.multiply=wc,Fr.nth=function(e,t){return e&&e.length?qn(e,ps(t)):i},Fr.noConflict=function(){return mt._===this&&(mt._=je),this},Fr.noop=cc,Fr.now=Aa,Fr.pad=function(e,t,r){e=gs(e);var n=(t=ps(t))?hr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Gi(pt(i),r)+e+Gi(ht(i),r)},Fr.padEnd=function(e,t,r){e=gs(e);var n=(t=ps(t))?hr(e):0;return t&&nt){var n=e;e=t,t=n}if(r||e%1||t%1){var o=wr();return gr(e+o*(t-e+dt("1e-"+((o+"").length-1))),t)}return Xn(e,t)},Fr.reduce=function(e,t,r){var n=Ga(e)?Dt:Kt,i=arguments.length<3;return n(e,co(t,4),r,i,ln)},Fr.reduceRight=function(e,t,r){var n=Ga(e)?Lt:Kt,i=arguments.length<3;return n(e,co(t,4),r,i,hn)},Fr.repeat=function(e,t,r){return t=(r?_o(e,t,r):t===i)?1:ps(t),Kn(gs(e),t)},Fr.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fr.result=function(e,t,r){var n=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=i);++np)return[];var r=v,n=gr(e,v);t=co(t),e-=v;for(var i=Jt(n,t);++r=a)return e;var c=r-hr(n);if(c<1)return n;var u=s?wi(s,0,c).join(""):e.slice(0,c);if(o===i)return u+n;if(s&&(c+=u.length-c),os(o)){if(e.slice(c).search(o)){var f,d=u;for(o.global||(o=Re(o.source,gs(me.exec(o))+"g")),o.lastIndex=0;f=o.exec(d);)var l=f.index;u=u.slice(0,l===i?c:l)}}else if(e.indexOf(ui(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+n},Fr.unescape=function(e){return(e=gs(e))&&Q.test(e)?e.replace(X,vr):e},Fr.uniqueId=function(e){var t=++Be;return gs(e)+t},Fr.upperCase=Ks,Fr.upperFirst=Qs,Fr.each=ga,Fr.eachRight=ya,Fr.first=Yo,sc(Fr,function(){var e={};return _n(Fr,(function(t,r){Ue.call(Fr.prototype,r)||(e[r]=t)})),e}(),{chain:!1}),Fr.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fr[e].placeholder=Fr})),It(["drop","take"],(function(e,t){qr.prototype[e]=function(r){r=r===i?1:Xt(ps(r),0);var n=this.__filtered__&&!t?new qr(this):this.clone();return n.__filtered__?n.__takeCount__=gr(r,n.__takeCount__):n.__views__.push({size:gr(r,v),type:e+(n.__dir__<0?"Right":"")}),n},qr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;qr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:co(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");qr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");qr.prototype[e]=function(){return this.__filtered__?new qr(this):this[r](1)}})),qr.prototype.compact=function(){return this.filter(nc)},qr.prototype.find=function(e){return this.filter(e).head()},qr.prototype.findLast=function(e){return this.reverse().find(e)},qr.prototype.invokeMap=Qn((function(e,t){return"function"==typeof e?new qr(this):this.map((function(r){return On(r,e,t)}))})),qr.prototype.reject=function(e){return this.filter(Ua(co(e)))},qr.prototype.slice=function(e,t){e=ps(e);var r=this;return r.__filtered__&&(e>0||t<0)?new qr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=ps(t))<0?r.dropRight(-t):r.take(t-e)),r)},qr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},qr.prototype.toArray=function(){return this.take(v)},_n(qr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Fr[n?"take"+("last"==t?"Right":""):t],a=n||/^find/.test(t);o&&(Fr.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,c=t instanceof qr,u=s[0],f=c||Ga(t),d=function(e){var t=o.apply(Fr,Bt([e],s));return n&&l?t[0]:t};f&&r&&"function"==typeof u&&1!=u.length&&(c=f=!1);var l=this.__chain__,h=!!this.__actions__.length,p=a&&!l,m=c&&!h;if(!a&&f){t=m?t:new qr(this);var v=e.apply(t,s);return v.__actions__.push({func:ha,args:[d],thisArg:i}),new Hr(v,l)}return p&&m?e.apply(this,s):(v=this.thru(d),p?n?v.value()[0]:v.value():v)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Oe[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Fr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[r]((function(r){return t.apply(Ga(r)?r:[],e)}))}})),_n(qr.prototype,(function(e,t){var r=Fr[t];if(r){var n=r.name+"";Ue.call(Or,n)||(Or[n]=[]),Or[n].push({name:t,func:r})}})),Or[ji(i,2).name]=[{name:"wrapper",func:i}],qr.prototype.clone=function(){var e=new qr(this.__wrapped__);return e.__actions__=Ii(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ii(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ii(this.__views__),e},qr.prototype.reverse=function(){if(this.__filtered__){var e=new qr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},qr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ga(e),n=t<0,i=r?e.length:0,o=function(e,t,r){var n=-1,i=r.length;for(;++n=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Fr.prototype.plant=function(e){for(var t,r=this;r instanceof zr;){var n=Fo(r);n.__index__=0,n.__values__=i,t?o.__wrapped__=n:t=n;var o=n;r=r.__wrapped__}return o.__wrapped__=e,t},Fr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof qr){var t=e;return this.__actions__.length&&(t=new qr(this)),(t=t.reverse()).__actions__.push({func:ha,args:[ea],thisArg:i}),new Hr(t,this.__chain__)}return this.thru(ea)},Fr.prototype.toJSON=Fr.prototype.valueOf=Fr.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Fr.prototype.first=Fr.prototype.head,Je&&(Fr.prototype[Je]=function(){return this}),Fr}();mt._=br,(n=function(){return br}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},566:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.filetypeextension=t.filetypemime=t.filetypename=t.filetypeinfo=void 0;const i=n(r(1)),o=r(2684),a=i.default();t.filetypeinfo=e=>{let t=a;for(const r of Object.keys(t.offset)){const t=o.fromHex(r);if(t>=e.length)continue;const n=a.offset[r],i=s(t,e,n);if(i.length>0)return i}return null===t.noOffset?[]:s(0,e,t.noOffset)};const s=(e,t,r)=>{let n=r,i=[];for(;;){const r=o.toHex(t[e]);if(n=n.bytes["?"]&&!n.bytes[r]?n.bytes["?"]:n.bytes[r],!n)return i;n&&n.matches&&(i=n.matches.slice(0)),e+=1}};t.default=t.filetypeinfo;t.filetypename=e=>t.filetypeinfo(e).map((e=>e.typename));t.filetypemime=e=>t.filetypeinfo(e).map((e=>e.mime?e.mime:null)).filter((e=>null!==e));t.filetypeextension=e=>t.filetypeinfo(e).map((e=>e.extension?e.extension:null)).filter((e=>null!==e))},1:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2684),i=r(2674);let o={noOffset:null,offset:{}};const a=(e,t,r,a)=>{if(a){const s=o.offset[n.toHex(a)];if(s){const c=i.merge(i.createNode(e,t.map((e=>e.toLowerCase())),r),{...s});o.offset[n.toHex(a)]=c}else o.offset[n.toHex(a)]=i.createComplexNode(e,t.map((e=>e.toLowerCase())),r)}else null===o.noOffset?o.noOffset=i.createComplexNode(e,t.map((e=>e.toLowerCase())),r):o.noOffset=i.merge(i.createNode(e,t.map((e=>e.toLowerCase())),r),o.noOffset)};a("gif",["0x47","0x49","0x46","0x38","0x37","0x61"],{mime:"image/gif",extension:"gif"}),a("gif",["0x47","0x49","0x46","0x38","0x39","0x61"],{mime:"image/gif",extension:"gif"}),a("jpg",["0xFF","0xD8","0xFF","0xDB"],{mime:"image/jpeg",extension:"jpeg"}),a("jpg",["0xFF","0xD8","0xFF","0xE0","?","?","0x4A","0x46","0x49","0x46","0x00","0x01"],{mime:"image/jpeg",extension:"jpeg"}),a("jpg",["0xFF","0xD8","0xFF","0xE1","?","?","0x45","0x78","0x69","0x66","0x00","0x00"],{mime:"image/jpeg",extension:"jpeg"}),a("webp",["0x52","0x49","0x46","0x46","?","?","?","?","0x57","0x45","0x42","0x50"],{mime:"image/webp",extension:"webp"}),a("heif",["0x66","0x74","0x79","0x70","0x6D","0x69","0x66","0x31"],{mime:"image/heif",extension:"heif"},4),a("heif",["0x66","0x74","0x79","0x70","0x68","0x65","0x69","0x63"],{mime:"image/heif",extension:"heic"},4),a("rpm",["0xed","0xab","0xee","0xdb"]),a("bin",["0x53","0x50","0x30","0x31"],{mime:"application/octet-stream",extension:"bin"}),a("pic",["0x00"]),a("pif",["0x00"]),a("sea",["0x00"]),a("ytr",["0x00"]),a("mp4",["0x66","0x74","0x79","0x70"],{mime:"video/mp4",extension:"mp4"},4),a("ttf",["0x00","0x01","0x00","0x00","0x00"],{mime:"font/ttf",extension:"ttf"}),a("otf",["0x4F","0x54","0x54","0x4F"],{mime:"font/otf",extension:"otf"}),a("eot",["0x50","0x4C"],{mime:"application/vnd.ms-fontobject",extension:"eot"}),a("woff",["0x77","0x4F","0x46","0x46"],{mime:"font/woff",extension:"woff"}),a("woff2",["0x77","0x4F","0x46","0x32"],{mime:"font/woff2",extension:"woff2"}),a("pdb",["0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00"]),a("dba",["0xBE","0xBA","0xFE","0xCA"]),a("dba2",["0x00","0x01","0x42","0x44"]),a("tda",["0x00","0x01","0x44","0x54"]),a("tda2",["0x00","0x01","0x00","0x00"]),a("ico",["0x00","0x00","0x01","0x00"],{mime:"image/x-icon",extension:"ico"}),a("3gp",["0x66","0x74","0x79","0x70","0x33","0x67"]),a("z",["0x1F","0x9D"]),a("tar.z",["0x1F","0xA0"]),a("bac",["0x42","0x41","0x43","0x4B","0x4D","0x49","0x4B","0x45","0x44","0x49","0x53","0x4B"]),a("bz2",["0x42","0x5A","0x68"],{mime:"application/x-bzip2",extension:"bz2"}),a("tif",["0x49","0x49","0x2A","0x00"],{mime:"image/tiff",extension:"tif"}),a("tiff",["0x4D","0x4D","0x00","0x2A"],{mime:"image/tiff",extension:"tiff"}),a("cr2",["0x49","0x49","0x2A","0x00","0x10","0x00","0x00","0x00","0x43","0x52"]),a("cin",["0x80","0x2A","0x5F","0xD7"]),a("cin1",["0x52","0x4E","0x43","0x01"]),a("cin2",["0x52","0x4E","0x43","0x02"]),a("dpx",["0x53","0x44","0x50","0x58"]),a("dpx2",["0x58","0x50","0x44","0x53"]),a("exr",["0x76","0x2F","0x31","0x01"]),a("bpg",["0x42","0x50","0x47","0xFB"]),a("ilbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x49","0x4C","0x42","0x4D"]),a("8svx",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x38","0x53","0x56","0x58"]),a("acbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x43","0x42","0x4D"]),a("anbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x4E","0x42","0x4D"]),a("anim",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x4E","0x49","0x4D"]),a("faxx",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x41","0x58","0x58"]),a("ftxt",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x54","0x58","0x54"]),a("smus",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x53","0x4D","0x55","0x53"]),a("cmus",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x43","0x4D","0x55","0x53"]),a("yuvn",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x59","0x55","0x56","0x4E"]),a("iff",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x41","0x4E","0x54"]),a("aiff",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x49","0x46","0x46"],{mime:"audio/x-aiff",extension:"aiff"}),a("idx",["0x49","0x4E","0x44","0x58"]),a("lz",["0x4C","0x5A","0x49","0x50"]),a("exe",["0x4D","0x5A"]),a("zip",["0x50","0x4B","0x03","0x04"],{mime:"application/zip",extension:"zip"}),a("zip",["0x50","0x4B","0x05","0x06"],{mime:"application/zip",extension:"zip"}),a("zip",["0x50","0x4B","0x07","0x08"],{mime:"application/zip",extension:"zip"}),a("jar",["0x50","0x4B","0x03","0x04"],{mime:"application/java-archive",extension:"jar"}),a("jar",["0x50","0x4B","0x05","0x06"],{mime:"application/java-archive",extension:"jar"}),a("jar",["0x50","0x4B","0x07","0x08"],{mime:"application/java-archive",extension:"jar"}),a("odt",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),a("odt",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),a("odt",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),a("ods",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),a("ods",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),a("ods",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),a("odp",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),a("odp",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),a("odp",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),a("docx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),a("docx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),a("docx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),a("xlsx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),a("xlsx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),a("xlsx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),a("pptx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),a("pptx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),a("pptx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),a("vsdx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),a("vsdx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),a("vsdx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),a("apk",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.android.package-archive",extension:"apk"}),a("apk",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.android.package-archive",extension:"apk"}),a("apk",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.android.package-archive",extension:"apk"}),a("aar",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.android.package-archive",extension:"aar"}),a("aar",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.android.package-archive",extension:"aar"}),a("aar",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.android.package-archive",extension:"aar"}),a("rar",["0x52","0x61","0x72","0x21","0x1A","0x07","0x00"],{mime:"application/vnd.rar",extension:"rar"}),a("rar",["0x52","0x61","0x72","0x21","0x1A","0x07","0x01","0x00"],{mime:"application/vnd.rar",extension:"rar"}),a("rar",["0x7F","0x45","0x4C","0x46"],{mime:"application/vnd.rar",extension:"rar"}),a("png",["0x89","0x50","0x4E","0x47","0x0D","0x0A","0x1A","0x0A"],{mime:"image/png",extension:"png"}),a("apng",["0x89","0x50","0x4E","0x47","0x0D","0x0A","0x1A","0x0A"],{mime:"image/apng",extension:"apng"}),a("class",["0xCA","0xFE","0xBA","0xBE"]),a("class",["0xEF","0xBB","0xBF"]),a("class",["0xFE","0xed","0xFA","0xCE"],void 0,4096),a("class",["0xFE","0xed","0xFA","0xCF"],void 0,4096),a("class",["0xCE","0xFA","0xed","0xFE"]),a("class",["0xCF","0xFA","0xed","0xFE"]),a("class",["0xFF","0xFE"]),a("class",["0xFF","0xFE"]),a("class",["0xFF","0xFE","0x00","0x00"]),a("ps",["0x25","0x21","0x50","0x53"]),a("pdf",["0x25","0x50","0x44","0x46"],{mime:"application/pdf",extension:"pdf"}),a("asf",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),a("wma",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),a("wmv",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),a("deploymentimage",["0x24","0x53","0x44","0x49","0x30","0x30","0x30","0x31"]),a("ogv",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x80","0x74","0x68","0x65","0x6F","0x72","0x61"],{mime:"video/ogg",extension:"ogv"}),a("ogm",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x01","0x76","0x69","0x64","0x65","0x6F","0x00"],{mime:"video/ogg",extension:"ogm"}),a("oga",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x7F","0x46","0x4C","0x41","0x43"],{mime:"audio/ogg",extension:"oga"}),a("spx",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x53","0x70","0x65","0x65","0x78","0x20","0x20"],{mime:"audio/ogg",extension:"spx"}),a("ogg",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x01","0x76","0x6F","0x72","0x62","0x69","0x73"],{mime:"audio/ogg",extension:"ogg"}),a("ogx",["0x4F","0x67","0x67","0x53"],{mime:"application/ogg",extension:"ogx"}),a("psd",["0x38","0x42","0x50","0x53"],{mime:"application/x-photoshop",extension:"psd"}),a("clip",["0x43","0x53","0x46","0x43","0x48","0x55","0x4e","0x4b"]),a("wav",["0x52","0x49","0x46","0x46","?","?","?","?","0x57","0x41","0x56","0x45"],{mime:"audio/x-wav",extension:"wav"}),a("avi",["0x52","0x49","0x46","0x46","?","?","?","?","0x41","0x56","0x49","0x20"],{mime:"video/x-msvideo",extension:"avi"}),a("mp3",["0xFF","0xFB"],{mime:"audio/mpeg",extension:"mp3"}),a("mp3",["0xFF","0xF3"],{mime:"audio/mpeg",extension:"mp3"}),a("mp3",["0xFF","0xF2"],{mime:"audio/mpeg",extension:"mp3"}),a("mp3",["0x49","0x44","0x33"],{mime:"audio/mpeg",extension:"mp3"}),a("bmp",["0x42","0x4D"],{mime:"image/bmp",extension:"bmp"}),a("iso",["0x43","0x44","0x30","0x30","0x31"]),a("flac",["0x66","0x4C","0x61","0x43"]),a("mid",["0x4D","0x54","0x68","0x64"],{mime:"audio/midi",extension:"mid"}),a("midi",["0x4D","0x54","0x68","0x64"],{mime:"audio/midi",extension:"midi"}),a("doc",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/msword",extension:"doc"}),a("xls",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/vnd.ms-excel",extension:"xls"}),a("ppt",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/vnd.ms-powerpoint",extension:"ppt"}),a("msg",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"]),a("dex",["0x64","0x65","0x78","0x0A","0x30","0x33","0x35","0x00"]),a("vmdk",["0x4B","0x44","0x4D"]),a("crx",["0x43","0x72","0x32","0x34"]),a("fh8",["0x41","0x47","0x44","0x33"]),a("cwk",["0x05","0x07","0x00","0x00","0x42","0x4F","0x42","0x4F","0x05","0x07","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x01"]),a("cwk",["0x06","0x07","0xE1","0x00","0x42","0x4F","0x42","0x4F","0x06","0x07","0xE1","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x01"]),a("toast",["0x45","0x52","0x02","0x00","0x00","0x00"]),a("toast",["0x8B","0x45","0x52","0x02","0x00","0x00","0x00"]),a("dmg",["0x78","0x01","0x73","0x0D","0x62","0x62","0x60"]),a("xar",["0x78","0x61","0x72","0x21"]),a("dat",["0x50","0x4D","0x4F","0x43","0x43","0x4D","0x4F","0x43"]),a("nes",["0x4E","0x45","0x53","0x1A"]),a("tar",["0x75","0x73","0x74","0x61","0x72","0x00","0x30","0x30"],void 0,257),a("tar",["0x75","0x73","0x74","0x61","0x72","0x20","0x20","0x00"],void 0,257),a("tox",["0x74","0x6F","0x78","0x33"]),a("mlv",["0x4D","0x4C","0x56","0x49"]),a("windowsupdate",["0x44","0x43","0x4D","0x01","0x50","0x41","0x33","0x30"]),a("7z",["0x37","0x7A","0xBC","0xAF","0x27","0x1C"],{mime:"application/x-7z-compressed",extension:"7z"}),a("gz",["0x1F","0x8B"],{mime:"application/gzip",extension:"gz"}),a("tar.gz",["0x1F","0x8B"],{mime:"application/gzip",extension:"tar.gz"}),a("xz",["0xFD","0x37","0x7A","0x58","0x5A","0x00","0x00"],{mime:"application/gzip",extension:"xz"}),a("tar.xz",["0xFD","0x37","0x7A","0x58","0x5A","0x00","0x00"],{mime:"application/gzip",extension:"tar.xz"}),a("lz2",["0x04","0x22","0x4D","0x18"]),a("cab",["0x4D","0x53","0x43","0x46"]),a("mkv",["0x1A","0x45","0xDF","0xA3"],{mime:"video/x-matroska",extension:"mkv"}),a("mka",["0x1A","0x45","0xDF","0xA3"],{mime:"audio/x-matroska",extension:"mka"}),a("mks",["0x1A","0x45","0xDF","0xA3"],{mime:"video/x-matroska",extension:"mks"}),a("mk3d",["0x1A","0x45","0xDF","0xA3"]),a("webm",["0x1A","0x45","0xDF","0xA3"],{mime:"audio/webm",extension:"webm"}),a("dcm",["0x44","0x49","0x43","0x4D"],void 0,128),a("xml",["0x3C","0x3f","0x78","0x6d","0x6C","0x20"],{mime:"application/xml",extension:"xml"}),a("wasm",["0x00","0x61","0x73","0x6d"],{mime:"application/wasm",extension:"wasm"}),a("lep",["0xCF","0x84","0x01"]),a("swf",["0x43","0x57","0x53"],{mime:"application/x-shockwave-flash",extension:"swf"}),a("swf",["0x46","0x57","0x53"],{mime:"application/x-shockwave-flash",extension:"swf"}),a("deb",["0x21","0x3C","0x61","0x72","0x63","0x68","0x3E"]),a("rtf",["0x7B","0x5C","0x72","0x74","0x66","0x31"],{mime:"application/rtf",extension:"rtf"}),a("m2p",["0x00","0x00","0x01","0xBA"]),a("vob",["0x00","0x00","0x01","0xBA"]),a("mpg",["0x00","0x00","0x01","0xBA"],{mime:"video/mpeg",extension:"mpg"}),a("mpeg",["0x00","0x00","0x01","0xBA"],{mime:"video/mpeg",extension:"mpeg"}),a("mpeg",["0x47"],{mime:"video/mpeg",extension:"mpeg"}),a("mpeg",["0x00","0x00","0x01","0xB3"],{mime:"video/mpeg",extension:"mpeg"}),a("mov",["0x66","0x72","0x65","0x65"],{mime:"video/quicktime",extension:"mov"},4),a("mov",["0x6D","0x64","0x61","0x74"],{mime:"video/quicktime",extension:"mov"},4),a("mov",["0x6D","0x6F","0x6F","0x76"],{mime:"video/quicktime",extension:"mov"},4),a("mov",["0x77","0x69","0x64","0x65"],{mime:"video/quicktime",extension:"mov"},4),a("mov",["0x66","0x74","0x79","0x70","0x71","0x74"],{mime:"video/quicktime",extension:"mov"},4),a("hl2demo",["0x48","0x4C","0x32","0x44","0x45","0x4D","0x4F"]),a("txt",["0xEF","0xBB","0xBF"],{mime:"text/plain; charset=UTF-8",extension:"txt"}),a("txt",["0xFF","0xFE"],{mime:"text/plain; charset=UTF-16LE",extension:"txt"}),a("txt",["0xFE","0xFF"],{mime:"text/plain; charset=UTF-16BE",extension:"txt"}),a("txt",["0xFF","0xFE","0x00","0x00"],{mime:"text/plain; charset=UTF-32LE",extension:"txt"}),a("txt",["0x00","0x00","0xFE","0xFF"],{mime:"text/plain; charset=UTF-32BE",extension:"txt"}),a("SubRip",["0x31","0x0D","0x0A","0x30","0x30","0x3A"],{mime:"application/x-subrip",extension:"srt"}),a("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x0A"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x0D"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x20"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x09"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x0A"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x0D"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x20"],{mime:"text/vtt",extension:"vtt"}),a("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x09"],{mime:"text/vtt",extension:"vtt"}),a("Json",["0x7B"],{mime:"application/json",extension:".json"}),a("Json",["0x5B"],{mime:"application/json",extension:".json"}),a("ELF",["0x7F","0x45","0x4C","0x46"],{mime:"application/x-executable",extension:".elf"}),a("Mach-O",["0xFE","0xED","0xFA","0xC"],{mime:"application/x-mach-binary",extension:".o"}),a("Mach-O",["0xFE","0xED","0xFA","0xCF"],{mime:"application/x-executable",extension:"elf"}),a("EML",["0x52","0x65","0x63","0x65","0x69","0x76","0x65","0x64","0x3A"],{mime:"message/rfc822",extension:".eml"}),t.default=()=>o},2684:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromHex=t.toHex=void 0;const r=e=>new Number(e).toString(16).toLowerCase();t.toHex=e=>"0x".concat(1===r(e).length?"0"+r(e):r(e));t.fromHex=e=>new Number(e)},2674:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createComplexNode=t.createNode=t.merge=void 0;const r=e=>({typename:e.typename,mime:e.info.mime,extension:e.info.extension}),n=e=>e[0],i=e=>e.slice(1,e.length);t.merge=(e,o)=>{if(0===e.bytes.length)return o;const a=n(e.bytes),s=i(e.bytes);if(((e,t)=>e&&0===t.length)(o.bytes[a],s)){const t=o.bytes[a];return o.bytes[a]={...t,matches:[...t.matches?t.matches:[],r(e)]},o}return o.bytes[a]?(o.bytes[a]=t.merge(t.createNode(e.typename,s,e.info),o.bytes[a]),o):(o.bytes[a]||(o.bytes[a]={...o.bytes[a],...t.createComplexNode(e.typename,s,e.info)}),o)};t.createNode=(e,t,r)=>({typename:e,bytes:t,info:r||{}});t.createComplexNode=(e,o,a)=>{let s={bytes:{},matches:void 0};const c=n(o),u=i(o);return 0===o.length?{matches:[r({typename:e,info:a?{extension:a.extension,mime:a.mime}:{}})],bytes:{}}:(s.bytes[c]=t.createComplexNode(e,u,a),s)}},6962:(e,t)=>{"use strict";var r=Object.prototype.hasOwnProperty;function n(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function i(e){try{return encodeURIComponent(e)}catch(t){return null}}t.stringify=function(e,t){t=t||"";var n,o,a=[];for(o in"string"!==typeof t&&(t="?"),e)if(r.call(e,o)){if((n=e[o])||null!==n&&undefined!==n&&!isNaN(n)||(n=""),o=i(o),n=i(n),null===o||null===n)continue;a.push(o+"="+n)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,i={};t=r.exec(e);){var o=n(t[1]),a=n(t[2]);null===o||null===a||o in i||(i[o]=a)}return i}},3841:e=>{"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},5915:(e,t,r)=>{"use strict";var n=r(3841),i=r(6962),o=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,a=/[\n\r\t]/g,s=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,c=/:\d+$/,u=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,f=/^[a-zA-Z]:/;function d(e){return(e||"").toString().replace(o,"")}var l=[["#","hash"],["?","query"],function(e,t){return m(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],h={hash:1,query:1};function p(e){var t,n=("undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:{}).location||{},i={},o=typeof(e=e||n);if("blob:"===e.protocol)i=new b(unescape(e.pathname),{});else if("string"===o)for(t in i=new b(e,{}),h)delete i[t];else if("object"===o){for(t in e)t in h||(i[t]=e[t]);void 0===i.slashes&&(i.slashes=s.test(e.href))}return i}function m(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function v(e,t){e=(e=d(e)).replace(a,""),t=t||{};var r,n=u.exec(e),i=n[1]?n[1].toLowerCase():"",o=!!n[2],s=!!n[3],c=0;return o?s?(r=n[2]+n[3]+n[4],c=n[2].length+n[3].length):(r=n[2]+n[4],c=n[2].length):s?(r=n[3]+n[4],c=n[3].length):r=n[4],"file:"===i?c>=2&&(r=r.slice(2)):m(i)?r=n[4]:i?o&&(r=r.slice(2)):c>=2&&m(t.protocol)&&(r=n[4]),{protocol:i,slashes:o||m(i),slashesCount:c,rest:r}}function b(e,t,r){if(e=(e=d(e)).replace(a,""),!(this instanceof b))return new b(e,t,r);var o,s,c,u,h,g,y=l.slice(),_=typeof t,w=this,x=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!==typeof r&&(r=i.parse),o=!(s=v(e||"",t=p(t))).protocol&&!s.slashes,w.slashes=s.slashes||o&&t.slashes,w.protocol=s.protocol||t.protocol||"",e=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||f.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!m(w.protocol)))&&(y[3]=[/(.*)/,"pathname"]);x{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";let e=function(e){return e.TO_CONTENT_SCRAP_AUTO_BY_URL="TO_CONTENT_SCRAP_AUTO_BY_URL",e.TO_BACKGROUND_SET_1688_QUERY="TO_BACKGROUND_SET_1688_QUERY",e.GET_PERCENTY_TOKEN="GET_PERCENTY_TOKEN",e.INJECT_RESULT="INJECT_RESULT",e.OPEN_TAB_AND_SCRAP="OPEN_TAB_AND_SCRAP",e.OPEN_TAB_AND_SCRAP_FINISH="OPEN_TAB_AND_SCRAP_FINISH",e.SCRAP_AUTO="SCRAP_AUTO",e.SCRAP_AUTO_FINISH="SCRAP_AUTO_FINISH",e.SCRAP_AUTO_FINISH_TO_LIST_PAGE="SCRAP_AUTO_FINISH_TO_LIST_PAGE",e.OPEN_PERCENTY_TAB="OPEN_PERCENTY_TAB",e.GET_CURRENT_TAB_ID_FROM_CONTENTS_SCRIPT="GET_CURRENT_TAB_ID_FROM_CONTENTS_SCRIPT",e.CLOSE_TAB="CLOSE_TAB",e.SCRAP_SUCCESS_TO_PERCENTY_WEB="SCRAP_SUCCESS_TO_PERCENTY_WEB",e.SCRAP_SUCCESS_TO_PERCENTY_WEB_TAB="SCRAP_SUCCESS_TO_PERCENTY_WEB_TAB",e.EXTENSION_INSTALLED_TO_PERCENTY_WEB_TAB="EXTENSION_INSTALLED_TO_PERCENTY_WEB_TAB",e.FETCH_RAW="FETCH_RAW",e.GET_NAVER_SHOPPING_LENS="GET_NAVER_SHOPPING_LENS",e.IMG_SEARCH="IMG_SEARCH",e.IMG_SEARCH_TAB="IMG_SEARCH_TAB",e.IMG_SEARCH_RESULT="IMG_SEARCH_RESULT",e.IMAGE_SEARCH_POSITION="IMAGE_SEARCH_POSITION",e.IMAGE_SEARCH_BTN_POSITION="IMAGE_SEARCH_BTN_POSITION",e.IMAGE_SEARCH_RESULT="IMAGE_SEARCH_RESULT",e.IMAGE_SEARCH_MODAL_OPEN="IMAGE_SEARCH_MODAL_OPEN",e.UPDATE_DECLARATIVE_NET_REQUEST_RULES="UPDATE_DECLARATIVE_NET_REQUEST_RULES",e.GET_SHEIN_THUMBNAIL_IMGS="GET_SHEIN_THUMBNAIL_IMGS",e.GET_IMG_BLOB_URL="GET_IMG_BLOB_URL",e.TO_DELETE_COOKIES="TO_DELETE_COOKIES",e.HEALTH_CHECK="HEALTH_CHECK",e.OPEN_SMART_STORE_LOGIN_EXTERNAL="OPEN_SMART_STORE_LOGIN_EXTERNAL",e.UPLOAD_SMART_STORE_EXTERNAL="UPLOAD_SMART_STORE_EXTERNAL",e.EDIT_SMART_STORE_EXTERNAL="EDIT_SMART_STORE_EXTERNAL",e.GET_CURRENT_LOGGED_IN_SMART_STORE_CHANNEL_EXTERNAL="GET_CURRENT_LOGGED_IN_SMART_STORE_CHANNEL_EXTERNAL",e.GET_CHROME_EXTENSION_VERSION_EXTERNAL="GET_CHROME_EXTENSION_VERSION_EXTERNAL",e.DELETE_SMART_STORE_PRODUCT_EXTERNAL="DELETE_SMART_STORE_PRODUCT_EXTERNAL",e.UPDATE_SMART_STORE_PRODUCT_STATE_EXTERNAL="UPDATE_SMART_STORE_PRODUCT_STATE_EXTERNAL",e.GET_SMART_STORE_PRODUCT_EXTERNAL="GET_SMART_STORE_PRODUCT_EXTERNAL",e.FETCH_RAW_EXTERNAL="FETCH_RAW_EXTERNAL",e.UPDATE_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL="UPDATE_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL",e.GET_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL="GET_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL",e.SCRAP_START_EXTERNAL="SCRAP_START_EXTERNAL",e.REQUEST_AI_SOURCING="REQUEST_AI_SOURCING",e.REQUEST_NAVER_SHOPPING_POPULAR_TERMS="REQUEST_NAVER_SHOPPING_POPULAR_TERMS",e.REQUEST_TAOBAO_IMG_SEARCH_EXTERNAL="REQUEST_TAOBAO_IMG_SEARCH_EXTERNAL",e.SCRAP_SUCCESS_FROM_EXT="SCRAP_SUCCESS_FROM_EXT",e.CHROME_EXTENSION_INSTALLED_FROM_EXT="CHROME_EXTENSION_INSTALLED_FROM_EXT",e.NAVER_SHOPPING_LENS_FROM_EXT="NAVER_SHOPPING_LENS_FROM_EXT",e}({});const t={getCookie:async function(e,t){var r;const n=await chrome.cookies.get({url:e,name:t});return null!==(r=null===n||void 0===n?void 0:n.value)&&void 0!==r?r:""},getLocalStorage:async function(e){return new Promise(((t,r)=>{try{chrome.storage.sync.get(e,(r=>{t(null===r||void 0===r?void 0:r[e])}))}catch(n){console.error(n),r(n)}}))},setLocalStorage:async function(e,t){return new Promise(((r,i)=>{try{chrome.storage.sync.set({[e]:t},(()=>r()))}catch(n){console.error(n),i(n)}}))},getBytesInUse:async function(){return new Promise(((e,t)=>{chrome.storage.sync.getBytesInUse((t=>{e(t)}))}))}};function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidCharacterError";var i="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,o=0,a=0,s="";i=t.charAt(a++);~i&&(r=o%4?64*r+i:i,o++%4)?s+=String.fromCharCode(255&r>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};function o(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(i(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return i(t)}}function a(e){this.message=e}a.prototype=new Error,a.prototype.name="InvalidTokenError";const s=function(e,t){if("string"!=typeof e)throw new a("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(o(e.split(".")[r]))}catch(e){throw new a("Invalid token specified: "+e.message)}},c="_jg_tk";async function u(){return t.getLocalStorage(c).then((e=>null!==e&&void 0!==e?e:""))}const f={getToken:u,setToken:async function(e){return t.setLocalStorage(c,e)},isTokenValid:async function(){try{const e=await u();if(!e)return!1;const t=s(null!==e&&void 0!==e?e:"");if(null!==t&&void 0!==t&&t.exp&&t.exp>Date.now()/1e3)return!0}catch(n){console.error(n)}return!1},getStagedRolloutNumber:async function(){try{const e=await u();if(!e)return 0;return s(null!==e&&void 0!==e?e:"").sub.split("").reduce(((e,t)=>e+t.charCodeAt(0)),0)%100}catch(n){return console.error(n),0}},getUserId:async function(){try{const e=await u();if(!e)return"";return s(null!==e&&void 0!==e?e:"").sub}catch(n){return console.error(n),""}}},d="IS_EXTENSION_DEBUG_MODE";const l={initDebugMode:function(){chrome.management.getSelf().then((e=>t.setLocalStorage(d,String("development"===e.installType))))},isDebug:async function(){return"true"===await t.getLocalStorage(d)}},h={endpointUrlTest:"",endpointUrlProd:"https://api.percenty.co.kr",percentyWebProd:"https://www.percenty.co.kr",percentyWebTest:"",siteConfigProd:"https://typebinc.github.io/chrome_extension/siteconfig.json",siteConfigTest:"https://typebinc.github.io/chrome_extension/siteconfig_test.json",remoteConfigProd:"https://typebinc.github.io/chrome_extension/remoteconfig.json",remoteConfigTest:"https://typebinc.github.io/chrome_extension/remoteconfig_test.json",tmallConfigProd:"https://typebinc.github.io/chrome_extension/tmallconfig.json",tmallConfigTest:"https://typebinc.github.io/chrome_extension/tmallconfig_test.json",fileUrlProd:"https://file.percenty.co.kr",fileUrlTest:"https://file-test.percenty.co.kr",parsingEndpointUrlProd:"https://parsing.percenty.co.kr",gaApiSecret:"6F_X_cGYRW2K2Xz_wNbf5Q",gaEndPoint:"https://www.google-analytics.com/mp/collect",gaMeasurementId:"G-PT1DCF1CNY",smartStoreLoginUrl:"https://sell.smartstore.naver.com/#/login",smartStoreProductCreate:"https://sell.smartstore.naver.com/api/products?_action=create",mixpanelToken:"0eaaabb8d460388c88440ca704e72d8d"};function p(e){return e?h.endpointUrlTest:h.endpointUrlProd}function m(e){return e?h.fileUrlTest:h.fileUrlProd}function v(e){return e?h.endpointUrlTest:h.parsingEndpointUrlProd}const b=h;async function g(e){const t=[],r=[],n=await Promise.allSettled(e);for(const i of n)"fulfilled"===i.status?t.push(i.value):"rejected"===i.status&&r.push(i.reason);return{fulfilled:t,rejected:r}}const y={delay:function(e){return new Promise(((t,r)=>{setTimeout((()=>{t()}),e)}))},debounce:function(e,t){let r;return n=>{clearTimeout(r),r=setTimeout((()=>{e(n)}),t)}},startInterval:function(e,t){let r=0,n=setInterval((()=>{e(++r)||clearInterval(n)}),t)},startIntervalAsync:function(e,t){const r=[];let i=0;const o=async()=>{try{await e(++i)?r.push(setTimeout(o,t)):r.forEach((e=>clearTimeout(e)))}catch(n){r.forEach((e=>clearTimeout(e))),console.error(n)}};o()}},_="PENDING_MESSAGE_KEY";async function w(e){return new Promise(((t,r)=>{chrome.tabs.sendMessage(e.targetTabId,e,(e=>{chrome.runtime.lastError?t("CONNECTION_ERROR"):t(e)}))}))}const x={addPendingMessage:async function(e){var r;const n=null!==(r=await t.getLocalStorage(_))&&void 0!==r?r:Array(),i=Date.now(),o=n.filter((e=>e.expirationAt>=i));o.push({...e}),await t.setLocalStorage(_,o)},consumePendingMessage:async function(e){var r;return(null!==(r=await t.getLocalStorage(_))&&void 0!==r?r:Array()).find((t=>(null===t||void 0===t?void 0:t.receiverName)===e))},sendRuntimeMessage:function(e,t){chrome.runtime.sendMessage(e,(e=>{null===t||void 0===t||t(null!==e&&void 0!==e?e:void 0)}))},sendRuntimeMessageAsync:async function(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage(e,(e=>{t(e)}))}))},sendTabsMessage:function(e,t){chrome.tabs.sendMessage(e.targetTabId,e,(e=>{null===t||void 0===t||t(null!==e&&void 0!==e?e:void 0)}))},sendTabsMessageAsync:w,sendTabMessageAsyncUntilConnect:async function(e,t){return new Promise(((r,n)=>{y.startIntervalAsync((async n=>{const i=await w(e);return"CONNECTION_ERROR"===i&&n<=t||(r("CONNECTION_ERROR"===i&&n>t?"CONNECTION_ERROR":i),!1)}),1e3)}))},addMessageListener:function(e){chrome.runtime.onMessage.addListener(((t,r,n)=>e(t,r,n)))}};var E,S=new Uint8Array(16);function T(){if(!E&&!(E="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return E(S)}const A=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const R=function(e){return"string"===typeof e&&A.test(e)};for(var M=[],I=0;I<256;++I)M.push((I+256).toString(16).substr(1));const O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(M[e[t+0]]+M[e[t+1]]+M[e[t+2]]+M[e[t+3]]+"-"+M[e[t+4]]+M[e[t+5]]+"-"+M[e[t+6]]+M[e[t+7]]+"-"+M[e[t+8]]+M[e[t+9]]+"-"+M[e[t+10]]+M[e[t+11]]+M[e[t+12]]+M[e[t+13]]+M[e[t+14]]+M[e[t+15]]).toLowerCase();if(!R(r))throw TypeError("Stringified UUID is invalid");return r};const C=function(e,t,r){var n=(e=e||{}).random||(e.rng||T)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return O(n)};const P={getRandomUUID:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?C().replace(/-/g,""):C()},getByteSize:function(e){return e?new Blob([e]).size:0},isVersionLowEqual:function(e,t){if(!e||!t)return!1;const r=e.split("."),n=t.split(".");for(let i=0;it)return!1}return!0}};var N=r(566),k=r.n(N),U=r(9778);const B={encodeBase64:function(e,t){if(!e)return"";const r=U.lW.from(e,"utf8").toString("base64");return t?r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):r},decodeBase64:function(e,t){return e?t?((e=e.replace(/-/g,"+").replace(/_/g,"/")).length%4!==0&&(e+="===".slice(0,4-e.length%4)),U.lW.from(e,"base64").toString("utf8")):U.lW.from(e,"base64").toString("utf8"):""},encodeURL:function(e){return encodeURIComponent(e)},decodeURL:function(e){return decodeURIComponent(e)},createNaverSearchAdSignature:async function(e,t,r,n){const i=new TextEncoder,o=i.encode("".concat(t,".").concat(r,".").concat(n)),a=await crypto.subtle.importKey("raw",i.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),s=await crypto.subtle.sign("HMAC",a,o);return btoa(String.fromCharCode(...new Uint8Array(s)))}};class D{constructor(e,t,r){this.typename=e,this.mime=t,this.extension=r}}function L(e){return new Promise(((t,r)=>{if(!e)return t("");const n=new FileReader;n.onload=()=>{var e,r;return t(null!==(e=null===(r=n.result)||void 0===r?void 0:r.toString())&&void 0!==e?e:"")},n.onerror=()=>r("file read error"),n.readAsDataURL(e)}))}function F(e){var t,r;if(!e)return;let n=e.split(","),i=null===(t=n[0])||void 0===t||null===(r=t.match(/:(.*?);/))||void 0===r?void 0:r[1],o=atob(n[1]),a=o.length,s=new Uint8Array(a);for(;a--;)s[a]=o.charCodeAt(a);return new Blob([s],{type:i})}async function j(e){return new Promise(((t,r)=>{try{const n=new FileReader;n.onloadend=async function(n){var i,o;if(null===(i=n.target)||void 0===i||!i.result)return void r("");const a=new Uint8Array(null===(o=n.target)||void 0===o?void 0:o.result);let s=[];a.forEach((e=>{s.push(e.toString(16))}));const c=s.join("").toUpperCase();var u;let f=z((u=c).startsWith("89504E47")?"image/png":u.startsWith("47494638")?"image/gif":u.startsWith("25504446")?"application/pdf":u.startsWith("FFD8FFDB")||u.startsWith("FFD8FFE0")||u.startsWith("FFD8FFE1")?"image/jpeg":u.startsWith("504B0304")?"application/zip":u.startsWith("424D")?"image/bmp":"");0===f.length&&(f=z(e.type)),t(f)},n.readAsArrayBuffer(e.slice(0,4))}catch(n){console.error(n),t("")}}))}function z(e){switch(e){case"audio/aac":return"aac";case"application/octet-stream":return"bin";case"application/x-bzip":return"bz";case"application/x-bzip2":return"bz2";case"text/css":return"css";case"text/csv":return"csv";case"application/msword":return"doc";case"image/gif":return"gif";case"text/html":return"html";case"image/x-icon":return"ico";case"application/java-archive":return"jar";case"image/jpeg":return"jpeg";case"image/png":return"png";case"image/bmp":return"bmp";case"image/svg+xml":return"svg";case"image/webp":return"webp";case"application/js":return"js";case"application/json":return"json";case"audio/midi":return"midi";case"video/mpeg":return"mpeg";case"application/vnd.oasis.opendocument.presentation":return"odp";case"application/vnd.oasis.opendocument.spreadsheet":return"ods";case"application/vnd.oasis.opendocument.text":return"odt";case"audio/ogg":return"oga";case"video/ogg":return"ogv";case"application/ogg":return"ogx";case"application/pdf":return"pdf";case"application/vnd.ms-powerpoint":return"ppt";case"application/x-rar-compressed":return"rar";case"application/rtf":return"rtf";case"application/x-sh":return"sh";case"application/x-shockwave-flash":return"swf";case"application/x-tar":return"tar";case"image/tiff":return"tiff";case"application/x-font-ttf":return"ttf";case"application/vnd.visio":return"vsd";case"audio/x-wav":return"wav";case"audio/webm":return"weba";case"video/webm":return"webm";case"application/x-font-woff":return"woff";case"application/xhtml+xml":return"xhtml";case"application/vnd.ms-excel":return"xls";case"application/xml":return"xml";case"application/vnd.mozilla.xul+xml":return"xul";case"application/zip":return"zip";case"video/3gpp":case"audio/3gpp":return"3gp";case"video/3gpp2":case"audio/3gpp2":return"3g2";case"application/x-7z-compressed":return"7z";default:return""}}const H={fileToBlob:async function(e){return L(e).then((e=>F(e)))},fileReader:L,dataURLtoBlob:F,getRandomFileName:async function(e,t){let r=await j(e);return!r&&t&&(r=t),P.getRandomUUID()+"."+r},blobToFile:function(e,t){return new File([e],t,{type:e.type})},getFileExtension:j,getExtensionFromUri:function(e){var t;return e&&null!==(t=e.split(".").pop())&&void 0!==t?t:""},getFileInfo:async function(e){return new Promise((t=>{try{const r=new FileReader;r.onloadend=async function(e){var r,i;if(null===(r=e.target)||void 0===r||!r.result)return void t(void 0);const o=new Uint8Array(null===(i=e.target)||void 0===i?void 0:i.result);t(function(e){try{const t=k()(e);if(t.length>0)return new D(t[0].typename,t[0].mime,t[0].extension)}catch(n){console.error(n)}}(o))},r.readAsArrayBuffer(e.slice(0,e.size>=100?100:e.size))}catch(n){console.error(n),t(void 0)}}))},downloadBlobToLocal:function(e,t){if(!e)return;const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=null!==t&&void 0!==t?t:"test",n.click(),URL.revokeObjectURL(r)},getImageMeta:async function(e){return new Promise((t=>{const r=new Image;r.onload=r=>{try{const n=r.target.naturalWidth,i=r.target.naturalHeight;t({width:n,height:i,fileSize:e.size})}catch(n){console.error(n),t({width:0,height:0,fileSize:0})}},r.onerror=()=>{console.error("fileUtil image load error"),t({width:0,height:0,fileSize:0})},"image/svg+xml"===e.type||"application/xml"===e.type?e.text().then((e=>{var n;const i=null===(n=e.match(//gi))||void 0===n?void 0:n[0];i?r.src="data:image/svg+xml;base64, ".concat(B.encodeBase64(i)):t({width:0,height:0,fileSize:0})})).catch((e=>{console.error(e),t({width:0,height:0,fileSize:0})})):r.src=URL.createObjectURL(e)}))},encodeFileToBase64:async function(e){return new Promise(((t,r)=>{const n=new FileReader;n.onload=()=>{const e=n.result;"string"===typeof e?t(e):r(new Error("[encodeFileToBase64] onload ERROR"))},n.onerror=e=>{r(new Error("[encodeFileToBase64] ".concat(e)))},n.readAsDataURL(e)}))}};let q=function(e){return e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e}({});class G{constructor(e,t,r,n){this.message=e,this.code=t,this.data=r,this.originalError=n}}let W="";async function Y(e,t,r,n,i){const o={"Accept-Language":"ko",Accept:"application/json","Content-Type":"application/json;charset=utf-8","X-AUTH-TOKEN":await f.getToken()};if(!W){const e=await l.isDebug();W=p(e)}const a=new URLSearchParams(r).toString();return fetch(W+t+"?".concat(a),{method:e,headers:o,body:JSON.stringify(n),...i}).then((e=>e.json())).then((e=>{var t,r;if(!e.success)throw new G(null!==(t=e.msg)&&void 0!==t?t:"",null!==(r=e.code)&&void 0!==r?r:"-1");return e})).catch((e=>{var t,r,n;throw new G(null!==(t=null!==(r=e.msg)&&void 0!==r?r:e.message)&&void 0!==t?t:"",null!==(n=e.code)&&void 0!==n?n:"-1")}))}async function V(e,t){return await fetch(e,t).then((e=>{if(e.ok)return e.blob();throw new G("File download failed","-1")}))}var X=r(5915),K=r.n(X),Q=r(763),J=r.n(Q);function Z(e){return!Number.isNaN(parseFloat(String(e)))}function $(e){return!e||(J().isString(e)?0===e.length||!e.trim():0===e.length)}const ee={toInt:function(e,t){var r;return void 0!==t?null!==(r=J().toSafeInteger(e))&&void 0!==r?r:t:J().toSafeInteger(e)},toFloat:function(e,t){try{return Z(e)?parseFloat(String(e)):null!==t&&void 0!==t?t:0}catch(n){return null!==t&&void 0!==t?t:0}},isNumber:Z,mergeObjects:function(e,t,r,n){return J().merge({},e,t,r,n)},every:function(e,t){return J().every(e,(e=>t(e)))},getProperty:function(e,t){if(e)return J().get(e,t)},setProperty:function(e,t,r){if(e)return J().set(e,t,r)},isEmpty:function(e){return J().isEmpty(e)},isBlank:$,isNotBlank:function(e){return!$(e)},range:function(e,t,r){return J().range(e,t,r)},mapToRecord:function(e){const t={};return e.forEach(((e,r)=>{t[r]=e})),t},convertKeysToCamelCase:function e(t){return null===t||"object"!==typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((r,n)=>(r[n.replace(/_([a-z])/g,((e,t)=>t.toUpperCase()))]=e(t[n]),r)),{})},chunk:function(e,t){const r=[];for(let n=0;n0?"?":""),e+="".concat(new URLSearchParams(ee.mapToRecord(this.queryMap)).toString()),e}}function re(e,t){return e.includes(":")?e:"".concat(null!==t&&void 0!==t?t:"http","://").concat(e.replace(RegExp("^[/]+"),""))}const ne={setSchemeToUri:re,parseURL:function(e){if(!e)return new te("","","",[],new Map);const t=new(K())(e),r=t.pathname.split("/").filter((e=>e.length>0)),n=t.query.replace("?","").split("&").map((e=>{var t,r;const n=e.split("=");return{key:null!==(t=null===n||void 0===n?void 0:n[0])&&void 0!==t?t:"",value:null!==(r=null===n||void 0===n?void 0:n[1])&&void 0!==r?r:""}})),i=new Map;for(const o of n)o.key&&i.set(o.key,o.value);return new te(e,t.protocol,t.host,r,i)},getChromeExtensionUrl:function(e){return chrome.runtime.getURL(e)},matchUrlWithAsteriskPattern:function(e,t){return!(!e||!t)&&new RegExp("^".concat(t.replace(/\*/g,".*"),"$")).test(e)},appendQueryParam:function(e,t,r){if(!e)return"";const n=new URL(re(e,"https")),i=new URLSearchParams(n.search);return i.set(t,r),n.search=i.toString(),n.toString()},objectToQueryString:function(e){if(!e)return"";const t=new URLSearchParams;for(const r in e)e[r]&&t.set(r,e[r]);return t.toString()},getURLQuery:function(e,t){const r=new URL(e);return new URLSearchParams(r.search).get(t)}},ie={SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:864e5,WEEK:6048e5,YEAR:31536e6,BIT_1MB:8388608,BYTE_1MB:1048576,KILOBYTE_1MB:1024,P_SITE_CONFIG:"tmmy_p_conf_sit",P_TMALL_CONFIG:"tmmy_p_conf_tmall",P_CORS_TMALL_NET_REQUEST_QUERY_NAME:"pdirkr0s83o0fosdk2ch14",P_CORS_TMALL_NET_REQUEST_QUERY_VALUE:"pretu35njx5lwqx231mc8iwo5fl4dx3j2fg7qpxlfjd",P_CORS_TMALL_CHAOSHI_NET_REQUEST_QUERY_VALUE:"sdfw843eldfogor28rgjvxlow28403lfllsk21adds",P_REMOVE_ORIGIN_NET_REQUEST_QUERY_NAME:"thoxmfo305z4lhou547",P_REMOVE_ORIGIN_NET_REQUEST_QUERY_VALUE:"fgk40kxjsd2kwlakghfzncmbiqpx",P_REMOVE_ORIGIN_NET_REQUEST_STRING:"fgk40kxjsd2kwlakghfzncmbiqpx",P_ADD_NAVER_SHOPPING_REFERER:"pqQ7SSVhjhsvHsSpr6PqsP88vDhR3TtdQH5HP1Jp6IiV",P_RAKUTEN_IFRAME_GALLERY_ELEMENT_ID:"p_rakuten_gallery_images"};async function oe(e){return fetch(e).then((e=>e.json()))}async function ae(e){try{return await async function(e){return V(e)}((t=e,t.includes("video.aliexpress-media.com")?ne.appendQueryParam(t,ie.P_REMOVE_ORIGIN_NET_REQUEST_QUERY_NAME,ie.P_REMOVE_ORIGIN_NET_REQUEST_QUERY_VALUE):t))}catch(n){return console.error(n),await async function(e){let t=W;if(!t){t=p(await l.isDebug())}return V("".concat(t,"/download-thirdparty?url=").concat(e),{headers:{"X-AUTH-TOKEN":await f.getToken()}})}(e)}var t}const se={loadAssetFile:oe,loadSmartStoreLeafCategories:async function(){return oe(chrome.runtime.getURL("./SmartStoreLeafCategory.json"))},downloadFile:ae,batchDownloadFile:async function(e){const t=e.map((e=>ae(e))),r=await g(t);return r.rejected.length>0&&console.error("File download failed",r.rejected),r.fulfilled},downloadFromPercenty:async function(e){const t=await l.isDebug(),r={"Accept-Language":"ko",Accept:"application/json","Content-Type":"application/json;charset=utf-8","X-AUTH-TOKEN":await f.getToken()};return V(p(t)+"/download?url="+e,{method:q.GET,headers:r})},uploadImageToPercenty:async function(e,t){var r,n,i,o;const a=await l.isDebug(),s=v(a);return await async function(e,t,r,n){var i;if(!W){const e=await l.isDebug();W=p(e)}const o=new FormData;o.append("file",null!==t&&void 0!==t?t:"",r),o.append("data",JSON.stringify(e));const a={"Accept-Language":"ko",Accept:"application/json","X-AUTH-TOKEN":null!==(i=await f.getToken())&&void 0!==i?i:""};return fetch((null!==n&&void 0!==n?n:W)+"/files",{method:q.POST,headers:a,body:o})}({isPublic:!0,noChangeFilename:!1,isCreateThumbnail:!1,filePath:null!==t&&void 0!==t&&t.path?t.path:null,isResize:null!==(r=null===t||void 0===t?void 0:t.isResize)&&void 0!==r&&r,resizeByWidth:null!==(n=null===t||void 0===t?void 0:t.resizeByWidth)&&void 0!==n&&n,isImage:void 0===(null===t||void 0===t?void 0:t.isImage)||t.isImage,isTemp:null!==(i=null===t||void 0===t?void 0:t.isTemp)&&void 0!==i&&i},e,null!==(o=null===t||void 0===t?void 0:t.fileName)&&void 0!==o?o:P.getRandomUUID(),s).then((e=>e.json())).then((e=>{if(!e.data)throw new Error("image upload failed");return m(a)+"/"+e.data}))},uploadImageToPercentyWithoutToken:async(e,t)=>{const r=v(await l.isDebug()),n=new FormData;return n.append("file",null!==e&&void 0!==e?e:"",t),fetch((null!==r&&void 0!==r?r:W)+"/ejrlkwjer",{method:q.POST,body:n}).then((e=>e.json())).then((e=>e.data))}};const ce={crawlerProduct:async function(e){return await Y(q.POST,"/products/crawling",void 0,e)},crawlerProductNew:async function(e){return await Y(q.POST,"/products/crawling",void 0,e)},fetchProductList:async function(){return await Y(q.GET,"/products")},fetchProduct:async function(e){return await Y(q.GET,"/products/".concat(e))},errorProduct:async function(e,t){return await Y(q.POST,"/smartstore/products/".concat(e,"/error"),void 0,t)},fetchProductForSmartStore:async function(e){return await Y(q.GET,"/smartstore/products/".concat(e))},updateProductStateToSale:async function(e,t,r,n){return await Y(q.POST,"/smartstore/products/".concat(e,"/stores/").concat(t,"/").concat(r,"/").concat(n))},updateProductState:async function(e,t){return await Y(q.PUT,"/smartstore/products/".concat(e,"/state/").concat(t))}},ue=/[^\s\uac00-\ud7a3\u3131-\u314e\u314f-\u3163a-zA-Z0-9\u4e00-\u9faf\u3041-\u3093\u30a1-\u30f3!@#$%^&\u20a9~()[\]{},.;:/|_\-'=+\u318D\u119E\u11A2\u2022\u2025\u00B7\uFE55]/gi,fe=/\D+/gi;const de={removeSmartStoreSpecialCharacter:function(e){var t;return null!==(t=null===e||void 0===e?void 0:e.replace(ue,""))&&void 0!==t?t:""},removeNonDigit:function(e){return e.replace(fe,"")},getSmartStoreOptionPriceRangeFromErrorMessage:function(e){try{const t=/(-*\d+\uc6d0)/gi;if(!e)return;const r=e.replace(/,/gi,""),n=[];let i;for(;i=t.exec(r);)n.push(parseInt(i[1].replace("\uc6d0","")));if(2===n.length)return n}catch(n){console.error(n)}},getSmartStoreOptionNumberFromErrorMessage:function(e){try{var t;if(!e)return;const r=/(\d+\ubc88\uc9f8)/gi.exec(e),n=null===r||void 0===r||null===(t=r[1])||void 0===t?void 0:t.replace("\ubc88\uc9f8","");if(n)return parseInt(n)}catch(n){console.error(n)}},hasSpecialCharacter:function(e){const t=/[^\uac00-\ud7a3\u3131-\u314e\u314f-\u3163a-zA-Z0-9\u4e00-\u9faf\u3041-\u3093\u30a1-\u30f3]/gi.exec(e);return!!t&&t.length>0},removeEncodedHtmlTags:function(e){return e.replace(/<[^&]+>/g,"").replace(/&/g,"&").replace(/ /g," ").replace(/"/g,'"').replace(/'/g,"'")}};let le=function(e){return e.SMART_STORE_ERROR="SMART_STORE_ERROR",e.SMART_STORE_UPLOAD_ERROR="SMART_STORE_UPLOAD_ERROR",e.SMART_STORE_LOGIN_NEED="SMART_STORE_LOGIN_NEED",e.SMART_STORE_EMPTY_PRODUCT_NAME="SMART_STORE_EMPTY_PRODUCT_NAME",e.SMART_STORE_PRODUCT_NAME_SPECIAL_CHARACTER="SMART_STORE_PRODUCT_NAME_SPECIAL_CHARACTER",e.SMART_STORE_OPTION_PRICE_RANGE_OVER="SMART_STORE_OPTION_PRICE_RANGE_OVER",e.SMART_STORE_DUPLICATED_OPTION_NAME="SMART_STORE_DUPLICATED_OPTION_NAME",e.SMART_STORE_EMPTY_OPTION="SMART_STORE_EMPTY_OPTION",e.SMART_STORE_EMPTY_OPTION_STOCK="SMART_STORE_EMPTY_OPTION_STOCK",e.SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST="SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST",e.SMART_STORE_EDIT_PRODUCT_BAD_REQUEST="SMART_STORE_EDIT_PRODUCT_BAD_REQUEST",e.SMART_STORE_UPLOAD_PHOTO_BAD_REQUEST="SMART_STORE_UPLOAD_PHOTO_BAD_REQUEST",e.SMART_STORE_EMPTY_MARKET_PROFILE="SMART_STORE_EMPTY_MARKET_PROFILE",e.SMART_STORE_PRODUCT_NOT_EXIST="SMART_STORE_PRODUCT_NOT_EXIST",e.SMART_STORE_PRODUCT_ALREADY_DELETED="SMART_STORE_PRODUCT_ALREADY_DELETED",e.SMART_STORE_VIDEO_UPLOAD_FAIL="SMART_STORE_VIDEO_UPLOAD_FAIL",e.SMART_STORE_CANNOT_CHANGE_PRODUCT_STATE="SMART_STORE_CANNOT_CHANGE_PRODUCT_STATE",e.SMART_STORE_ALREADY_UPLOADING="SMART_STORE_ALREADY_UPLOADING",e.SCRAP_AUTO_BY_URL_FAIL="SCRAP_AUTO_BY_URL_FAIL",e.SCRAP_AUTO_BY_URL_FAIL_CAPTCHA="SCRAP_AUTO_BY_URL_FAIL_CAPTCHA",e.AI_SOURCING_MISSING_PARAMS="AI_SOURCING_MISSING_PARAMS",e.AI_SOURCING_NAVER_FETCH_ERROR="AI_SOURCING_NAVER_FETCH_ERROR",e.AI_NAVER_SHOPPING_POPULAR_TERMS_ERROR="AI_NAVER_SHOPPING_POPULAR_TERMS_ERROR",e.AI_NAVER_SHOPPING_POPULAR_TERMS_MISSING_BODY="AI_NAVER_SHOPPING_POPULAR_TERMS_MISSING_BODY",e.AI_SOURCING_API_ERROR="AI_SOURCING_API_ERROR",e.AI_SOURCING_NOT_FOUND_TAB="AI_SOURCING_NOT_FOUND_TAB",e.TAOBAO_COOKIE_NONE="TAOBAO_COOKIE_NONE",e}({});const he={getOptionInfo:function(e,t){const r=[];let n=t.split(";");const i=e.flatMap((e=>e.infos));return n.forEach((e=>{const t=i.find((t=>e===t.path));t&&r.push({optionName:t.name.transMap.ko,imageUrl:t.img})})),r},createHtml:function(e,t){let r="";return e.htmlWithTopBottom&&e.userOption.topImg&&(r=r.concat(''))),r=r.concat(t),e.htmlWithOptions&&e.infos.forEach((e=>{const t=e.title.transMap.ko;e.infos.forEach((e=>{e.img&&e.name.transMap.ko&&(r=r.concat('
['.concat(t,"]
")),r=r.concat('
'.concat(e.name.transMap.ko,"
")),r=r.concat('')))}))})),e.htmlWithTopBottom&&e.userOption.bottomImg&&(r=r.concat(''))),r},getDeliveryFeeType:function(e){var t;const r=e.userOption;return 0===r.deliveryCharge?"FREE":r.deliveryCharge>0&&r.freeShipOverAmount>0?"CONDITIONAL_FREE":null!==(t=e.storeProfileMap.ss)&&void 0!==t&&t.deliveryChargePerCnt&&e.storeProfileMap.ss.deliveryChargePerCnt>0?"UNIT_QUANTITY_PAID":"PAID"}};let pe=function(e){return e.AbrHls="AbrHls",e.Thumbnails="Thumbnails",e.Hls="Hls",e.VideoHashCode="VideoHashCode",e.Encoding="Encoding",e.Ingest="Ingest",e.VideoHeader="VideoHeader",e}({});function me(e){return me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},me(e)}function ve(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function be(e){ve(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===me(e)&&"[object Date]"===t?new Date(e.getTime()):"number"===typeof e||"[object Number]"===t?new Date(e):("string"!==typeof e&&"[object String]"!==t||"undefined"===typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function ge(e){if(ve(1,arguments),!function(e){return ve(1,arguments),e instanceof Date||"object"===me(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)&&"number"!==typeof e)return!1;var t=be(e);return!isNaN(Number(t))}function ye(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function _e(e,t){return ve(2,arguments),function(e,t){ve(2,arguments);var r=be(e).getTime(),n=ye(t);return new Date(r+n)}(e,-ye(t))}function we(e){ve(1,arguments);var t=be(e),r=t.getUTCDay(),n=(r<1?7:0)+r-1;return t.setUTCDate(t.getUTCDate()-n),t.setUTCHours(0,0,0,0),t}function xe(e){ve(1,arguments);var t=be(e),r=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var i=we(n),o=new Date(0);o.setUTCFullYear(r,0,4),o.setUTCHours(0,0,0,0);var a=we(o);return t.getTime()>=i.getTime()?r+1:t.getTime()>=a.getTime()?r:r-1}function Ee(e){ve(1,arguments);var t=be(e),r=we(t).getTime()-function(e){ve(1,arguments);var t=xe(e),r=new Date(0);return r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0),we(r)}(t).getTime();return Math.round(r/6048e5)+1}var Se={};function Te(){return Se}function Ae(e,t){var r,n,i,o,a,s,c,u;ve(1,arguments);var f=Te(),d=ye(null!==(r=null!==(n=null!==(i=null!==(o=null===t||void 0===t?void 0:t.weekStartsOn)&&void 0!==o?o:null===t||void 0===t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:f.weekStartsOn)&&void 0!==n?n:null===(c=f.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==r?r:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=be(e),h=l.getUTCDay(),p=(h=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(d+1,0,h),p.setUTCHours(0,0,0,0);var m=Ae(p,t),v=new Date(0);v.setUTCFullYear(d,0,h),v.setUTCHours(0,0,0,0);var b=Ae(v,t);return f.getTime()>=m.getTime()?d+1:f.getTime()>=b.getTime()?d:d-1}function Me(e,t){ve(1,arguments);var r=be(e),n=Ae(r,t).getTime()-function(e,t){var r,n,i,o,a,s,c,u;ve(1,arguments);var f=Te(),d=ye(null!==(r=null!==(n=null!==(i=null!==(o=null===t||void 0===t?void 0:t.firstWeekContainsDate)&&void 0!==o?o:null===t||void 0===t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:f.firstWeekContainsDate)&&void 0!==n?n:null===(c=f.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==r?r:1),l=Re(e,t),h=new Date(0);return h.setUTCFullYear(l,0,d),h.setUTCHours(0,0,0,0),Ae(h,t)}(r,t).getTime();return Math.round(n/6048e5)+1}function Ie(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length0?r:1-r;return Ie("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):Ie(r+1,2)},d:function(e,t){return Ie(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return Ie(e.getUTCHours()%12||12,t.length)},H:function(e,t){return Ie(e.getUTCHours(),t.length)},m:function(e,t){return Ie(e.getUTCMinutes(),t.length)},s:function(e,t){return Ie(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return Ie(Math.floor(n*Math.pow(10,r-3)),t.length)}};var Ce="midnight",Pe="noon",Ne="morning",ke="afternoon",Ue="evening",Be="night",De={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return Oe.y(e,t)},Y:function(e,t,r,n){var i=Re(e,n),o=i>0?i:1-i;return"YY"===t?Ie(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):Ie(o,t.length)},R:function(e,t){return Ie(xe(e),t.length)},u:function(e,t){return Ie(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Ie(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Ie(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return Oe.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return Ie(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var i=Me(e,n);return"wo"===t?r.ordinalNumber(i,{unit:"week"}):Ie(i,t.length)},I:function(e,t,r){var n=Ee(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):Ie(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):Oe.d(e,t)},D:function(e,t,r){var n=function(e){ve(1,arguments);var t=be(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=r-t.getTime();return Math.floor(n/864e5)+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):Ie(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var i=e.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ie(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var i=e.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ie(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),i=0===n?7:n;switch(t){case"i":return String(i);case"ii":return Ie(i,t.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,i=e.getUTCHours();switch(n=12===i?Pe:0===i?Ce:i/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,i=e.getUTCHours();switch(n=i>=17?Ue:i>=12?ke:i>=4?Ne:Be,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Oe.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):Oe.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):Ie(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):Ie(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Oe.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Oe.s(e,t)},S:function(e,t){return Oe.S(e,t)},X:function(e,t,r,n){var i=(n._originalDate||e).getTimezoneOffset();if(0===i)return"Z";switch(t){case"X":return Fe(i);case"XXXX":case"XX":return je(i);default:return je(i,":")}},x:function(e,t,r,n){var i=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return Fe(i);case"xxxx":case"xx":return je(i);default:return je(i,":")}},O:function(e,t,r,n){var i=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Le(i,":");default:return"GMT"+je(i,":")}},z:function(e,t,r,n){var i=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Le(i,":");default:return"GMT"+je(i,":")}},t:function(e,t,r,n){var i=n._originalDate||e;return Ie(Math.floor(i.getTime()/1e3),t.length)},T:function(e,t,r,n){return Ie((n._originalDate||e).getTime(),t.length)}};function Le(e,t){var r=e>0?"-":"+",n=Math.abs(e),i=Math.floor(n/60),o=n%60;if(0===o)return r+String(i);var a=t||"";return r+String(i)+a+Ie(o,2)}function Fe(e,t){return e%60===0?(e>0?"-":"+")+Ie(Math.abs(e)/60,2):je(e,t)}function je(e,t){var r=t||"",n=e>0?"-":"+",i=Math.abs(e);return n+Ie(Math.floor(i/60),2)+r+Ie(i%60,2)}const ze=De;var He=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},qe=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ge={p:qe,P:function(e,t){var r,n=e.match(/(P+)(p+)?/)||[],i=n[1],o=n[2];if(!o)return He(e,t);switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",He(i,t)).replace("{{time}}",qe(o,t))}};const We=Ge;var Ye=["D","DD"],Ve=["YY","YYYY"];function Xe(e,t,r){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Ke={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};const Qe=function(e,t,r){var n,i=Ke[e];return n="string"===typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),null!==r&&void 0!==r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Je(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var Ze={date:Je({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Je({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Je({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})};var $e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function et(e){return function(t,r){var n;if("formatting"===(null!==r&&void 0!==r&&r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,o=null!==r&&void 0!==r&&r.width?String(r.width):i;n=e.formattingValues[o]||e.formattingValues[i]}else{var a=e.defaultWidth,s=null!==r&&void 0!==r&&r.width?String(r.width):e.defaultWidth;n=e.values[s]||e.values[a]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function tt(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;var a,s=o[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(c)?function(e,t){for(var r=0;r20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:et({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:et({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:et({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:et({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:et({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(rt={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(rt.matchPattern);if(!r)return null;var n=r[0],i=e.match(rt.parsePattern);if(!i)return null;var o=rt.valueCallback?rt.valueCallback(i[0]):i[0];return{value:o=t.valueCallback?t.valueCallback(o):o,rest:e.slice(n.length)}}),era:tt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:tt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:tt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:tt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:tt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};var it=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ot=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,at=/^'([^]*?)'?$/,st=/''/g,ct=/[a-zA-Z]/;function ut(e,t,r){var n,i,o,a,s,c,u,f,d,l,h,p,m,v,b,g,y,_;ve(2,arguments);var w=String(t),x=Te(),E=null!==(n=null!==(i=null===r||void 0===r?void 0:r.locale)&&void 0!==i?i:x.locale)&&void 0!==n?n:nt,S=ye(null!==(o=null!==(a=null!==(s=null!==(c=null===r||void 0===r?void 0:r.firstWeekContainsDate)&&void 0!==c?c:null===r||void 0===r||null===(u=r.locale)||void 0===u||null===(f=u.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==s?s:x.firstWeekContainsDate)&&void 0!==a?a:null===(d=x.locale)||void 0===d||null===(l=d.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==o?o:1);if(!(S>=1&&S<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=ye(null!==(h=null!==(p=null!==(m=null!==(v=null===r||void 0===r?void 0:r.weekStartsOn)&&void 0!==v?v:null===r||void 0===r||null===(b=r.locale)||void 0===b||null===(g=b.options)||void 0===g?void 0:g.weekStartsOn)&&void 0!==m?m:x.weekStartsOn)&&void 0!==p?p:null===(y=x.locale)||void 0===y||null===(_=y.options)||void 0===_?void 0:_.weekStartsOn)&&void 0!==h?h:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!E.localize)throw new RangeError("locale must contain localize property");if(!E.formatLong)throw new RangeError("locale must contain formatLong property");var A=be(e);if(!ge(A))throw new RangeError("Invalid time value");var R=function(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}(A),M=_e(A,R),I={firstWeekContainsDate:S,weekStartsOn:T,locale:E,_originalDate:A};return w.match(ot).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,We[t])(e,E.formatLong):e})).join("").match(it).map((function(n){if("''"===n)return"'";var i=n[0];if("'"===i)return function(e){var t=e.match(at);if(!t)return e;return t[1].replace(st,"'")}(n);var o,a=ze[i];if(a)return null!==r&&void 0!==r&&r.useAdditionalWeekYearTokens||(o=n,-1===Ve.indexOf(o))||Xe(n,t,String(e)),null!==r&&void 0!==r&&r.useAdditionalDayOfYearTokens||!function(e){return-1!==Ye.indexOf(e)}(n)||Xe(n,t,String(e)),a(M,n,E.localize,I);if(i.match(ct))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return n})).join("")}function ft(e,t){return ve(2,arguments),function(e,t){ve(2,arguments);var r=be(e),n=ye(t);return isNaN(n)?new Date(NaN):n?(r.setDate(r.getDate()+n),r):r}(e,-ye(t))}const dt=864e5;function lt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return"";const n=e instanceof Date?e:new Date(e),i=n.getTimezoneOffset();let o=n.valueOf();switch(r&&0!==i&&(o+=60*i*1e3),t){case"ISO8601_UTC0":return ut(o,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");case"ISO8601":return ut(o,"yyyy-MM-dd'T'HH:mm:ss.SSSXXX");default:return ut(o,t)}}const ht={SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:dt,WEEK:6048e5,YEAR:31536e6,FORMAT_yyyy_MM_DD_HHmm:"yyyy/MM/dd HH:mm",FORMAT_yyyy_MM_DD:"yyyy/MM/dd",FORMAT_YY_MM_DD:"YY/MM/dd",MM_DD:"MM.dd",FORMAT_yyyyMMdd:"yyyyMMdd",FORMAT_yyyyDashMMDashDD:"yyyy-MM-dd",now:function(){return Date.now()},addDays:function(e,t){const r=e instanceof Date?e.getTime():e;return new Date(r+t*dt)},addMonths:function(e,t){const r=e instanceof Date?e:new Date(e);return new Date(r.setMonth(r.getMonth()+t))},subtractDays:function(e,t){return ft(e instanceof Date?e:new Date(e),t)},format:lt,changeFormat:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e?lt(new Date(e),t,r):""},startOf:function(e,t){switch(e){case"year":return function(e){ve(1,arguments);var t=be(e),r=new Date(0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}(t);case"month":return function(e){ve(1,arguments);var t=be(e);return t.setDate(1),t.setHours(0,0,0,0),t}(t);case"day":return function(e){ve(1,arguments);var t=be(e);return t.setHours(0,0,0,0),t}(t);case"hour":return function(e){ve(1,arguments);var t=be(e);return t.setMinutes(0,0,0),t}(t);case"minute":return function(e){ve(1,arguments);var t=be(e);return t.setSeconds(0,0),t}(t);case"second":return function(e){ve(1,arguments);var t=be(e);return t.setMilliseconds(0),t}(t)}},endOf:function(e,t){switch(e){case"year":return function(e){ve(1,arguments);var t=be(e),r=t.getFullYear();return t.setFullYear(r+1,0,0),t.setHours(23,59,59,999),t}(t);case"month":return function(e){ve(1,arguments);var t=be(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}(t);case"day":return function(e){ve(1,arguments);var t=be(e);return t.setHours(23,59,59,999),t}(t);case"hour":return function(e){ve(1,arguments);var t=be(e);return t.setMinutes(59,59,999),t}(t);case"minute":return function(e){ve(1,arguments);var t=be(e);return t.setSeconds(59,999),t}(t);case"second":return function(e){ve(1,arguments);var t=be(e);return t.setMilliseconds(999),t}(t)}}},pt="CACHED_SS_SHIPMENT_LIST_KEY";const mt={getShipmentList:async function(){try{var e,r;const n=Date.now(),i=await t.getLocalStorage(pt);if(null!==i&&void 0!==i&&i.expireAt&&i.expireAt>n&&i.list&&i.list.length>0)return i.list;const o=await Y(q.GET,"/smartstore/shipments");return o.list&&o.list.length>0&&t.setLocalStorage(pt,{expireAt:n+ht.DAY,list:o.list}),null!==(e=null!==(r=o.list)&&void 0!==r?r:null===i||void 0===i?void 0:i.list)&&void 0!==e?e:[]}catch(n){return console.error(n),[]}}};async function vt(e){const t=e.map((e=>e.replace(/\s+/gi,""))).filter((e=>{const t=P.getByteSize(e);return t>0&&t<=30})).filter((e=>!de.hasSpecialCharacter(e))).filter(((e,t,r)=>r.indexOf(e)===t)),r=[];try{const e=[];for await(const r of t)e.push(Bt.checkRestrictedTag(r).then((e=>({tag:r,...e}))));const n=await Promise.all(e);for(const t of n)t.restricted||r.push({text:t.tag})}catch(n){console.error(n)}const i=[],o=await Bt.checkSearchableTags(r.map((e=>e.text))).catch((e=>{}));return o&&o.length>0?(i.push(...o.filter((e=>e.searchable)).map((e=>({text:e.tag})))),i.push(...o.filter((e=>!e.searchable)).map((e=>({text:e.tag}))))):i.push(...r),i.slice(0,10)}async function bt(e){var t,r;const n=await mt.getShipmentList(),i=null===(t=e.storeProfileMap)||void 0===t||null===(r=t.ss)||void 0===r?void 0:r.shipmentCode;return null===n||void 0===n?void 0:n.find((e=>e.id===i))}function gt(e){try{const t=e=>{let t="";for(let r=1;r<=100;r++){const n=e["optionName".concat(r)];if(!n)break;t=t.concat(n)}return t};let r=!1;const n=[];for(const i of e){const e=t(i);if(!(e.length<=0)){if(n.includes(e)){r=!0;break}n.push(e)}}if(r){const t=new Map,r=new Map;for(let e=0;e<=100;e++)r.set(e,1);e.forEach((e=>{var n,i,o;const a=null!==(n=null===(i=e.paths)||void 0===i||null===(o=i.split(";"))||void 0===o?void 0:o.filter((e=>!!e)))&&void 0!==n?n:[];a.length>0&&a.forEach(((e,n)=>{if(!t.has(e)){const i=r.get(n);t.set(e,i),r.set(n,i+1)}}))})),e.forEach(((e,r)=>{var n,i,o;const a=null!==(n=null===(i=e.paths)||void 0===i||null===(o=i.split(";"))||void 0===o?void 0:o.filter((e=>!!e)))&&void 0!==n?n:[];if(a.length>0)for(let c=0;c0&&(t=t.concat(", ")),t=t.concat('"'.concat(r,'"'));return t}function _t(e){let t="\n";for(const r of e)switch(r){case pe.AbrHls:t=t.concat("...abrHls\n");break;case pe.Encoding:t=t.concat("...encoding\n");break;case pe.Hls:t=t.concat("...hls\n");break;case pe.VideoHashCode:t=t.concat("...videoHashCode\n");break;case pe.Thumbnails:t=t.concat("...thumbnails\n");break;case pe.Ingest:t=t.concat("...ingest\n");break;case pe.VideoHeader:t=t.concat("...videoHeader\n")}return t}function wt(e){let t="";for(const r of e)switch(r){case pe.AbrHls:t=t.concat("\nfragment abrHls on AbrHls {\n status\n }");break;case pe.Encoding:t=t.concat("\nfragment encoding on Encoding {\n encoding\n complete\n percentage\n totalFrames\n qualityId\n }");break;case pe.Hls:t=t.concat("\nfragment hls on Hls {\n status\n qualityId\n }");break;case pe.VideoHashCode:t=t.concat("\nfragment videoHashCode on VideoHashCode {\n videoMD5\n videoSHA256\n }");break;case pe.Thumbnails:t=t.concat("\nfragment thumbnails on Thumbnails {\n type\n path\n timeMark\n }");break;case pe.Ingest:t=t.concat("\nfragment ingest on Ingest {\n videoId\n encodeType\n }");break;case pe.VideoHeader:t=t.concat("\nfragment videoHeader on VideoHeader {\n videoCodec\n videoBitrate\n audioCodec\n audioBitrate\n audioSamplingRate\n audioChannel\n audioSamplingBit\n duration\n width\n height\n fps\n rotation\n fileSize\n }")}return t}function xt(e){var t,r,n,i,o,a,s,c,u,f;return!!(null!==e&&void 0!==e&&null!==(t=e.storeProfileMap)&&void 0!==t&&null!==(r=t.ss)&&void 0!==r&&r.rvpAftMtPav||null!==e&&void 0!==e&&null!==(n=e.storeProfileMap)&&void 0!==n&&null!==(i=n.ss)&&void 0!==i&&i.rvpAftMtTxt||null!==e&&void 0!==e&&null!==(o=e.storeProfileMap)&&void 0!==o&&null!==(a=o.ss)&&void 0!==a&&a.rvpPav||null!==e&&void 0!==e&&null!==(s=e.storeProfileMap)&&void 0!==s&&null!==(c=s.ss)&&void 0!==c&&c.rvpAgr||null!==e&&void 0!==e&&null!==(u=e.storeProfileMap)&&void 0!==u&&null!==(f=u.ss)&&void 0!==f&&f.rvpTxt)}const Et={listenSmartStoreLoginSuccess:async function(e){const t=new Array(100).fill(0,0,100);for await(const s of t){var r,i;if(await y.delay(1e3),null!==(r=e.tabs)&&void 0!==r&&null!==(i=r[0])&&void 0!==i&&i.id){let t;try{var o,a;if(t=await chrome.tabs.get(e.tabs[0].id),null===(o=t)||void 0===o||!o.url||null!==(a=t)&&void 0!==a&&a.url.includes("login"))continue}catch(n){return void console.error(n)}try{const e=await Bt.fetchStoreCreateView();if(null!==e&&void 0!==e&&e.simpleAccountInfo)return e.simpleAccountInfo}catch(n){console.error(n)}}}},createUploadProduct:async function(e,t,r,n,i,o){var a,s,c,u,f,d,l,h,p,m,v,b,g,y,_,w,x,E,S,T,A,R,M,I,O,C,P,N,k,U,B,D,L,F,j,z,H,q,G,W,Y,V,X,K,Q,J,Z,$,te,re,ne,ie,oe,ae,ce,ue,fe,de,le,pe,me,ve,be,ge,ye,_e,we,xe,Ee,Se,Te,Ae,Re,Me,Ie,Oe,Ce,Pe,Ne,ke;const Ue=(new Date).toISOString(),Be=e.salePrice.transMap.ko,De=e.infos.map((e=>({groupName:e.title.transMap.ko.substring(0,25),usable:!0,optionType:"COMBINATION",sortType:"CREATE"}))),Le=e.options.filter((e=>e.isExpose)).map(((t,r)=>({usable:t.isExpose,stockQuantity:t.stock,price:t.salePrice.transMap.ko-Be,optionType:"COMBINATION",sortType:"CREATE",paths:t.path,...he.getOptionInfo(e.infos,t.path).reduce(((e,t,r)=>Object.assign(e,{["optionName".concat(r+1)]:t.optionName.substring(0,25)})),{})})));gt(Le);const Fe=r.map(((e,t)=>({imageType:0===t?"REPRESENTATIVE":"OPTIONAL",order:0===t||1===t?1:t,fileSize:e.fileSize,height:e.height,width:e.width,imageUrl:e.imageUrl}))),je=null===(a=e.optionMap)||void 0===a||null===(s=a.ss)||void 0===s||null===(c=s.category)||void 0===c?void 0:c.code,ze=(await se.loadSmartStoreLeafCategories()).find((e=>e.id===je));let He={};if(ze){var qe,Ge,We,Ye,Ve,Xe,Ke;const e=null!==(qe=null===(Ge=ze.wholeCategoryId)||void 0===Ge?void 0:Ge.split(">"))&&void 0!==qe?qe:[],t=null!==(We=null===(Ye=ze.wholeCategoryName)||void 0===Ye?void 0:Ye.split(">"))&&void 0!==We?We:[];e.reduce(((e,t,r)=>Object.assign(e,{["category".concat(r+1,"Id")]:t})),He),Object.assign(He,{category:{deleted:!1,id:ze.id,impossibleByCredit:!1,largeCategoryName:null!==(Ve=null===t||void 0===t?void 0:t[0])&&void 0!==Ve?Ve:void 0,middleCategoryName:null!==(Xe=null===t||void 0===t?void 0:t[1])&&void 0!==Xe?Xe:void 0,smallCategoryName:null!==(Ke=null===t||void 0===t?void 0:t[2])&&void 0!==Ke?Ke:void 0,detailCategoryName:ze.name,lastLevel:!0,level:e.length,name:ze.name,parentId:null===e||void 0===e?void 0:e[(null===e||void 0===e?void 0:e.length)-2],sellBlogUse:ze.sellBlogUse,sellBlogUseYn:ze.sellBlogUse,serviceUse:!0,sortOrder:ze.sortOrder,wholeCategoryId:ze.wholeCategoryId,wholeCategoryName:ze.wholeCategoryName,juvenileHarmful:!1}})}const Qe=await vt(null!==(u=e.keywords)&&void 0!==u?u:[]),Je=await bt(e);let Ze={accountNo:null!==(f=null!==(d=null===(l=t.product)||void 0===l||null===(h=l.deliveryInfo)||void 0===h?void 0:h.accountNo)&&void 0!==d?d:null===(p=t.simpleAccountInfo)||void 0===p?void 0:p.accountNo)&&void 0!==f?f:0,name:e.name.transMap.ko.substring(0,100),salePrice:Be,stockQuantity:e.options.reduce(((e,t)=>e+t.stock),0),saleType:"NEW",excludeAdminDiscount:!1,excludeGivePresent:!1,payExposure:!0,...He,images:Fe,videos:n?[n]:[],modAuditInfo:null===(m=t.product)||void 0===m||null===(v=m.deliveryInfo)||void 0===v||null===(b=v.claimDeliveryInfo)||void 0===b||null===(g=b.returnDeliveryCompany)||void 0===g?void 0:g.modAuditInfo,modDate:Ue,regAuditInfo:null===(y=t.product)||void 0===y||null===(_=y.deliveryInfo)||void 0===_||null===(w=_.claimDeliveryInfo)||void 0===w||null===(x=w.returnDeliveryCompany)||void 0===x?void 0:x.regAuditInfo,regDate:null===(E=t.product)||void 0===E||null===(S=E.deliveryInfo)||void 0===S||null===(T=S.claimDeliveryInfo)||void 0===T||null===(A=T.returnDeliveryCompany)||void 0===A?void 0:A.regDate,videoRegisterYn:!!n,detailAttribute:{naverShoppingSearchInfo:{manufacturerName:"",modelName:"",brandName:"",brandId:"",modelId:""},afterServiceInfo:{afterServiceTelephoneNumber:null===(R=e.userOption)||void 0===R?void 0:R.asNumber,afterServiceGuideContent:null===(M=e.userOption)||void 0===M?void 0:M.asDesc},originAreaInfo:{type:"INCLUDE_IN_DETAILS",originArea:{code:"03"},content:""},sellerCodeInfo:{sellerManagementCode:e._id,sellerBarcode:"",sellerCustomCode1:"",sellerCustomCode2:""},seoInfo:{pageTitle:"",metaDescription:"",sellerTags:Qe},optionInfo:{optionUsable:!0,useStockManagement:!0,options:De,optionCombinations:Le,optionStandards:[],optionDeliveryAttributes:[],useDispatchPolicyManagement:!1},supplementProductInfo:{sortType:"CREATE",count:0,usable:!1,supplementProducts:[]},purchaseReviewInfo:{purchaseReviewExposure:!0,reviewUnExposeReason:""},customMadeInfo:{customMade:!1},taxType:e.userOption.isTax?"TAX":"DUTYFREE",productCertificationInfos:[],certification:!1,certificationTargetExcludeContent:{kcYn:"KC_EXEMPTION_OBJECT",kcExemption:"OVERSEAS"},consumptionTax:"TEN",minorPurchasable:!(null!==(I=e.optionMap)&&void 0!==I&&null!==(O=I.ss)&&void 0!==O&&null!==(C=O.category)&&void 0!==C&&C.onlyAdult),productInfoProvidedNotice:{productInfoProvidedNoticeType:"ETC",productInfoProvidedNoticeContent:{templateType:"PRODUCT_INFO_PROVIDED_NOTICE",productInfoProvidedNoticeType:"ETC",returnCostReason:"0",noRefundReason:"0",qualityAssuranceStandard:"0",compensationProcedure:"0",troubleShootingContents:"0",itemName:"\uc0c1\ud488\uc0c1\uc138 \ucc38\uc870",modelName:"\uc0c1\ud488\uc0c1\uc138 \ucc38\uc870",certificateDetails:"\ud574\ub2f9\uc0ac\ud56d \uc5c6\uc74c",manufacturer:"\uc0c1\ud488\uc0c1\uc138 \ucc38\uc870",customerServicePhoneNumber:e.userOption.asNumber}},productAttributes:[],productAttributeUsable:!1,useReturnCancelNotification:!1,editorType:"NONE",bookInfo:{authors:[],illustrators:[],translators:[]},detailContentTextInfo:{excessDetailContentText:!1},itselfProductionProductYn:!1,naverShoppingDisplayStatusType:"ON",purchaseQuantityInfo:{maxPurchaseQuantityPerOrder:String(null!==(P=e.userOption.maxPCnt)&&void 0!==P?P:1e3)}},detailContent:{productDetailInfoContent:e.htmlSrc,editorType:"NONE",editorTypeForEditor:"NONE",existsRemoveTags:!1,mobileDetailType:"PREVIEW",mobileProductDetailPreviewType:"SNAP"},deliveryInfo:{deliveryType:"DELIVERY",deliveryAttributeType:"NORMAL",deliveryCompany:Je,deliveryCompanyId:null===Je||void 0===Je?void 0:Je.id,deliveryFee:{deliveryFeeType:he.getDeliveryFeeType(e),baseFee:String(e.userOption.deliveryCharge),deliveryFeePayType:"PREPAID",deliveryFeeByArea:null!==(N=e.storeProfileMap.ss)&&void 0!==N&&N.jejuDlvCst&&null!==(k=e.storeProfileMap.ss)&&void 0!==k&&k.islandDlvCst?{deliveryAreaType:"AREA_3",area2extraFee:null!==(U=null===(B=e.storeProfileMap.ss)||void 0===B||null===(D=B.jejuDlvCst)||void 0===D?void 0:D.toString())&&void 0!==U?U:0,area3extraFee:null!==(L=null===(F=e.storeProfileMap.ss)||void 0===F||null===(j=F.islandDlvCst)||void 0===j?void 0:j.toString())&&void 0!==L?L:0}:void 0,freeConditionalAmount:"CONDITIONAL_FREE"===he.getDeliveryFeeType(e)?String(e.userOption.freeShipOverAmount):void 0,repeatQuantity:"UNIT_QUANTITY_PAID"===he.getDeliveryFeeType(e)?null===(z=e.storeProfileMap.ss)||void 0===z||null===(H=z.deliveryChargePerCnt)||void 0===H?void 0:H.toString():void 0},claimDeliveryInfo:{returnDeliveryCompany:null===(q=t.deliveryBaseInfoVO)||void 0===q||null===(G=q.returnDeliveryCompanies)||void 0===G?void 0:G.find((e=>"PRIMARY"===e.returnDeliveryCompanyPriorityType)),returnDeliveryCompanySeq:null===(W=t.deliveryBaseInfoVO)||void 0===W||null===(Y=W.returnDeliveryCompanies)||void 0===Y||null===(V=Y.find((e=>"PRIMARY"===e.returnDeliveryCompanyPriorityType)))||void 0===V?void 0:V.id,returnDeliveryFee:e.userOption.returnCharge,exchangeDeliveryFee:e.userOption.exchangeCharge,shippingAddress:null===(X=t.deliveryBaseInfoVO)||void 0===X?void 0:X.baseShippingAddress,shippingAddressId:null===(K=t.deliveryBaseInfoVO)||void 0===K||null===(Q=K.baseShippingAddress)||void 0===Q?void 0:Q.id,returnAddress:null===(J=t.deliveryBaseInfoVO)||void 0===J?void 0:J.baseReturnAddress,returnAddressId:null===(Z=t.deliveryBaseInfoVO)||void 0===Z||null===($=Z.baseReturnAddress)||void 0===$?void 0:$.id,freeReturnInsuranceYn:!1},installationFee:!1,expectedDeliveryPeriodDirectInput:"",accountNo:null!==(te=null!==(re=null===(ne=t.product)||void 0===ne||null===(ie=ne.deliveryInfo)||void 0===ie?void 0:ie.accountNo)&&void 0!==re?re:null===(oe=t.simpleAccountInfo)||void 0===oe?void 0:oe.accountNo)&&void 0!==te?te:0,cloneDeliveryAttributeType:"NORMAL",customMadeDirectInputYn:!1,expectedDeliveryPeriodType:"",freeReturnInsuranceYn:!1},productStats:{},representImageUrl:null!==(ae=null===r||void 0===r||null===(ce=r[0])||void 0===ce?void 0:ce.imageUrl)&&void 0!==ae?ae:"",useSalePeriod:!1};const $e=e.oriPrice.transMap.ko;if($e-Be>=10){var et,tt,rt,nt,it,ot,at,st,ct,ut,ft,dt,lt,ht,pt;const t=$e-Be;Ze.salePrice=$e,Ze.customerBenefit={reviewPointPolicy:xt(e)?{afterUsePhotoVideoReviewPoint:null===(et=e.storeProfileMap)||void 0===et||null===(tt=et.ss)||void 0===tt||null===(rt=tt.rvpAftMtPav)||void 0===rt?void 0:rt.toString(),afterUseTextReviewPoint:null===(nt=e.storeProfileMap)||void 0===nt||null===(it=nt.ss)||void 0===it||null===(ot=it.rvpAftMtTxt)||void 0===ot?void 0:ot.toString(),photoVideoReviewPoint:null===(at=e.storeProfileMap)||void 0===at||null===(st=at.ss)||void 0===st||null===(ct=st.rvpPav)||void 0===ct?void 0:ct.toString(),storeMemberReviewPoint:null===(ut=e.storeProfileMap)||void 0===ut||null===(ft=ut.ss)||void 0===ft||null===(dt=ft.rvpAgr)||void 0===dt?void 0:dt.toString(),textReviewPoint:null===(lt=e.storeProfileMap)||void 0===lt||null===(ht=lt.ss)||void 0===ht||null===(pt=ht.rvpTxt)||void 0===pt?void 0:pt.toString()}:void 0,immediateDiscountPolicy:{discountMethod:{discountUnitType:"WON",value:t},mobileDiscountMethod:{discountUnitType:"WON",value:t}}}}var mt;return i&&(Ze=ee.mergeObjects(Ze,i),Ze.detailAttribute&&null!==(mt=i.detailAttribute)&&void 0!==mt&&mt.productInfoProvidedNotice&&(Ze.detailAttribute.productInfoProvidedNotice=i.detailAttribute.productInfoProvidedNotice),o&&o.forEach((e=>{"DELETE"===e.action?void 0!==ee.getProperty(Ze,e.path)&&ee.setProperty(Ze,e.path,void 0):"SET"===e.action&&ee.setProperty(Ze,e.path,e.value)}))),{product:Ze,singleChannelProductMap:{STOREFARM:{selfProductNameUsable:!1,channelProductName:"",channelServiceType:"STOREFARM",channelProductType:"SINGLE",channel:null,epInfo:{naverShoppingRegistration:null!==(ue=null===(fe=t.simpleAccountInfo)||void 0===fe?void 0:fe.epNaverShoppingOperable)&&void 0!==ue&&ue,enuriRegistration:null!==(de=null===(le=t.simpleAccountInfo)||void 0===le?void 0:le.epEnuriOperable)&&void 0!==de&&de,danawaRegistration:null!==(pe=null===(me=t.simpleAccountInfo)||void 0===me?void 0:me.epDanawaOperable)&&void 0!==pe&&pe,naverDisabled:!(null!==(ve=t.simpleAccountInfo)&&void 0!==ve&&ve.epNaverShoppingOperable),enuriDisabled:!(null!==(be=t.simpleAccountInfo)&&void 0!==be&&be.epEnuriOperable),danawaDisabled:!(null!==(ge=t.simpleAccountInfo)&&void 0!==ge&&ge.epDanawaOperable),disabledAll:!(null!==(ye=t.simpleAccountInfo)&&void 0!==ye&&ye.epNaverShoppingOperable)&&!(null!==(_e=t.simpleAccountInfo)&&void 0!==_e&&_e.epEnuriOperable)&&!(null!==(we=t.simpleAccountInfo)&&void 0!==we&&we.epDanawaOperable)},channelProductDisplayStatusType:"ON",channelProductStatusType:"NORMAL",storeKeepExclusiveProduct:!1,orderRequestUsable:!1,best:!1,bbsConfig:!1,materialImages:[],images:[],modAuditInfo:null===(xe=t.product)||void 0===xe||null===(Ee=xe.deliveryInfo)||void 0===Ee||null===(Se=Ee.claimDeliveryInfo)||void 0===Se||null===(Te=Se.returnDeliveryCompany)||void 0===Te?void 0:Te.modAuditInfo,modDate:Ue,regAuditInfo:null===(Ae=t.product)||void 0===Ae||null===(Re=Ae.deliveryInfo)||void 0===Re||null===(Me=Re.claimDeliveryInfo)||void 0===Me||null===(Ie=Me.returnDeliveryCompany)||void 0===Ie?void 0:Ie.regAuditInfo,regDate:null===(Oe=t.product)||void 0===Oe||null===(Ce=Oe.deliveryInfo)||void 0===Ce||null===(Pe=Ce.claimDeliveryInfo)||void 0===Pe||null===(Ne=Pe.returnDeliveryCompany)||void 0===Ne?void 0:Ne.regDate,tagImages:[],barcodeImage:null,affiliateInfo:{affiliateYn:!1},channelNo:null===(ke=t.simpleAccountInfo)||void 0===ke?void 0:ke.defaultChannelNo,channelProductSupplyType:"OWNER",videos:[],videoRegisterYn:!1,productAttributeUsable:!1,productAttributes:[],naverShoppingSearchInfo:{},representImageUrl:"",product:Ze}},...t.simpleAccountInfo}},createEditProduct:async function(e,t,r,n,i,o){var a,s,c,u,f,d,l,h,p;const m=(new Date).toISOString(),v=e.salePrice.transMap.ko,b=e.infos.map((e=>({groupName:e.title.transMap.ko.substring(0,25),usable:!0,optionType:"COMBINATION",sortType:"CREATE"}))),g=e.options.filter((e=>e.isExpose)).map(((t,r)=>({usable:t.isExpose,stockQuantity:t.stock,price:t.salePrice.transMap.ko-v,optionType:"COMBINATION",sortType:"CREATE",paths:t.path,...he.getOptionInfo(e.infos,t.path).reduce(((e,t,r)=>Object.assign(e,{["optionName".concat(r+1)]:t.optionName.substring(0,25)})),{})})));gt(g);const y=r.map(((e,t)=>({imageType:0===t?"REPRESENTATIVE":"OPTIONAL",order:0===t||1===t?1:t,fileSize:e.fileSize,height:e.height,width:e.width,imageUrl:e.imageUrl}))),_=null===(a=e.optionMap)||void 0===a||null===(s=a.ss)||void 0===s||null===(c=s.category)||void 0===c?void 0:c.code,w=(await se.loadSmartStoreLeafCategories()).find((e=>e.id===_));let x={};if(w){var E,S,T,A,R,M,I;const e=null!==(E=null===(S=w.wholeCategoryId)||void 0===S?void 0:S.split(">"))&&void 0!==E?E:[],t=null!==(T=null===(A=w.wholeCategoryName)||void 0===A?void 0:A.split(">"))&&void 0!==T?T:[];e.reduce(((e,t,r)=>Object.assign(e,{["category".concat(r+1,"Id")]:t})),x),Object.assign(x,{category:{deleted:!1,id:w.id,impossibleByCredit:!1,largeCategoryName:null!==(R=null===t||void 0===t?void 0:t[0])&&void 0!==R?R:void 0,middleCategoryName:null!==(M=null===t||void 0===t?void 0:t[1])&&void 0!==M?M:void 0,smallCategoryName:null!==(I=null===t||void 0===t?void 0:t[2])&&void 0!==I?I:void 0,detailCategoryName:w.name,lastLevel:!0,level:e.length,name:w.name,parentId:null===e||void 0===e?void 0:e[(null===e||void 0===e?void 0:e.length)-2],sellBlogUse:w.sellBlogUse,sellBlogUseYn:w.sellBlogUse,serviceUse:!0,sortOrder:w.sortOrder,wholeCategoryId:w.wholeCategoryId,wholeCategoryName:w.wholeCategoryName,juvenileHarmful:!1}})}const O=await vt(null!==(u=e.keywords)&&void 0!==u?u:[]),C=await bt(e);var P,N;if(t.product&&(t.product.name=e.name.transMap.ko.substring(0,100),t.product.stockQuantity=e.options.reduce(((e,t)=>e+t.stock),0),t.product.salePrice=v,t.product.images=y,t.product.representImageUrl=null!==(P=null===r||void 0===r||null===(N=r[0])||void 0===N?void 0:N.imageUrl)&&void 0!==P?P:"",t.product.modDate=m,n&&("add"===n.action&&n.video?(t.product.videos=[n.video],t.product.videoRegisterYn=!0):"remove"===n.action&&(t.product.videos=[],t.product.videoRegisterYn=!1)),x.category1Id===t.product.category1Id&&Object.assign(t.product,{...x})),null!==(f=t.product)&&void 0!==f&&f.detailAttribute){var k,U,B,D,L,F,j,z,H,q,G,W,Y,V,X,K,Q,J;if(t.product.detailAttribute.taxType=e.userOption.isTax?"TAX":"DUTYFREE",t.product.detailAttribute.minorPurchasable=!(null!==(k=e.optionMap)&&void 0!==k&&null!==(U=k.ss)&&void 0!==U&&null!==(B=U.category)&&void 0!==B&&B.onlyAdult),null!==(D=t.product)&&void 0!==D&&null!==(L=D.detailAttribute)&&void 0!==L&&L.optionInfo&&(t.product.detailAttribute.optionInfo.options=b),null!==(F=t.product)&&void 0!==F&&null!==(j=F.detailAttribute)&&void 0!==j&&j.optionInfo&&(t.product.detailAttribute.optionInfo.optionCombinations=g),null!==(z=t.product)&&void 0!==z&&null!==(H=z.detailAttribute)&&void 0!==H&&null!==(q=H.productInfoProvidedNotice)&&void 0!==q&&q.productInfoProvidedNoticeContent&&(t.product.detailAttribute.productInfoProvidedNotice.productInfoProvidedNoticeContent.customerServicePhoneNumber=e.userOption.asNumber),null!==(G=t.product)&&void 0!==G&&null!==(W=G.detailAttribute)&&void 0!==W&&W.sellerCodeInfo&&(t.product.detailAttribute.sellerCodeInfo.sellerManagementCode=e._id),null!==(Y=t.product)&&void 0!==Y&&null!==(V=Y.detailAttribute)&&void 0!==V&&V.afterServiceInfo)t.product.detailAttribute.afterServiceInfo.afterServiceTelephoneNumber=null===(Q=e.userOption)||void 0===Q?void 0:Q.asNumber,t.product.detailAttribute.afterServiceInfo.afterServiceGuideContent=null===(J=e.userOption)||void 0===J?void 0:J.asDesc;null!==(X=t.product)&&void 0!==X&&null!==(K=X.detailAttribute)&&void 0!==K&&K.seoInfo&&(t.product.detailAttribute.seoInfo={pageTitle:"",metaDescription:"",sellerTags:O})}if(null!==(d=t.product)&&void 0!==d&&d.detailContent&&(t.product.detailContent.productDetailInfoContent=e.htmlSrc),null!==(l=t.product)&&void 0!==l&&l.deliveryInfo){var Z,$,te,re,ne,ie,oe,ae,ce,ue;if(t.product.deliveryInfo.deliveryCompany=C,t.product.deliveryInfo.deliveryCompanyId=null===C||void 0===C?void 0:C.id,t.product.deliveryInfo.deliveryFee)t.product.deliveryInfo.deliveryFee.deliveryFeeType=he.getDeliveryFeeType(e),t.product.deliveryInfo.deliveryFee.baseFee=String(e.userOption.deliveryCharge),t.product.deliveryInfo.deliveryFee.deliveryFeePayType="PREPAID",t.product.deliveryInfo.deliveryFee.deliveryFeeByArea=null!==(Z=e.storeProfileMap.ss)&&void 0!==Z&&Z.jejuDlvCst&&null!==($=e.storeProfileMap.ss)&&void 0!==$&&$.islandDlvCst?{deliveryAreaType:"AREA_3",area2extraFee:null!==(te=null===(re=e.storeProfileMap.ss)||void 0===re||null===(ne=re.jejuDlvCst)||void 0===ne?void 0:ne.toString())&&void 0!==te?te:0,area3extraFee:null!==(ie=null===(oe=e.storeProfileMap.ss)||void 0===oe||null===(ae=oe.islandDlvCst)||void 0===ae?void 0:ae.toString())&&void 0!==ie?ie:0}:void 0,t.product.deliveryInfo.deliveryFee.freeConditionalAmount="CONDITIONAL_FREE"===he.getDeliveryFeeType(e)?String(e.userOption.freeShipOverAmount):void 0,t.product.deliveryInfo.deliveryFee.repeatQuantity="UNIT_QUANTITY_PAID"===he.getDeliveryFeeType(e)?null===(ce=e.storeProfileMap.ss)||void 0===ce||null===(ue=ce.deliveryChargePerCnt)||void 0===ue?void 0:ue.toString():void 0;t.product.deliveryInfo.claimDeliveryInfo&&(t.product.deliveryInfo.claimDeliveryInfo.returnDeliveryFee=e.userOption.returnCharge,t.product.deliveryInfo.claimDeliveryInfo.exchangeDeliveryFee=e.userOption.exchangeCharge)}const fe=e.oriPrice.transMap.ko;if(t.product)if(fe-v>=10){var de,le,pe,me,ve,be,ge,ye,_e,we,xe,Ee,Se,Te,Ae;const r=fe-v;t.product.salePrice=fe,t.product.customerBenefit={reviewPointPolicy:xt(e)?{afterUsePhotoVideoReviewPoint:null===(de=e.storeProfileMap)||void 0===de||null===(le=de.ss)||void 0===le||null===(pe=le.rvpAftMtPav)||void 0===pe?void 0:pe.toString(),afterUseTextReviewPoint:null===(me=e.storeProfileMap)||void 0===me||null===(ve=me.ss)||void 0===ve||null===(be=ve.rvpAftMtTxt)||void 0===be?void 0:be.toString(),photoVideoReviewPoint:null===(ge=e.storeProfileMap)||void 0===ge||null===(ye=ge.ss)||void 0===ye||null===(_e=ye.rvpPav)||void 0===_e?void 0:_e.toString(),storeMemberReviewPoint:null===(we=e.storeProfileMap)||void 0===we||null===(xe=we.ss)||void 0===xe||null===(Ee=xe.rvpAgr)||void 0===Ee?void 0:Ee.toString(),textReviewPoint:null===(Se=e.storeProfileMap)||void 0===Se||null===(Te=Se.ss)||void 0===Te||null===(Ae=Te.rvpTxt)||void 0===Ae?void 0:Ae.toString()}:void 0,immediateDiscountPolicy:{discountMethod:{discountUnitType:"WON",value:r},mobileDiscountMethod:{discountUnitType:"WON",value:r}}}}else t.product.salePrice=v,t.product.customerBenefit=void 0;var Re;return i&&t.product&&(t.product=ee.mergeObjects(t.product,i),t.product.detailAttribute&&null!==(Re=i.detailAttribute)&&void 0!==Re&&Re.productInfoProvidedNotice&&(t.product.detailAttribute.productInfoProvidedNotice=i.detailAttribute.productInfoProvidedNotice),o&&o.forEach((e=>{"DELETE"===e.action?void 0!==ee.getProperty(t.product,e.path)&&ee.setProperty(t.product,e.path,void 0):"SET"===e.action&&ee.setProperty(t.product,e.path,e.value)}))),null!==(h=t.singleChannelProductMap)&&void 0!==h&&h.STOREFARM&&(t.singleChannelProductMap.STOREFARM.product=t.product),{product:t.product,singleChannelProductMap:{STOREFARM:null===(p=t.singleChannelProductMap)||void 0===p?void 0:p.STOREFARM}}},findTargetStoreFarmChannelFromCreateView:function(e){var t,r,n,i,o,a;const s=null===(t=e.simpleAccountInfo)||void 0===t?void 0:t.defaultChannelNo;if(s)return null!==(r=null===(n=e.simpleAccountInfo)||void 0===n||null===(i=n.ownerChannelInfoList)||void 0===i?void 0:i.find((e=>e.id===s)))&&void 0!==r?r:null===(o=e.simpleAccountInfo)||void 0===o||null===(a=o.ownerChannelInfoList)||void 0===a?void 0:a[0]},findTargetStoreFarmChannelFromProduct:function(e){var t,r,n,i;const o=null===(t=e.singleChannelProductMap)||void 0===t||null===(r=t.STOREFARM)||void 0===r?void 0:r.id;if(o)return null===(n=e.simpleAccountInfo)||void 0===n||null===(i=n.ownerChannelInfoList)||void 0===i?void 0:i.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===o}))},makeFileMetaRequestBody:function(e,t){return{query:'{\n _0_0: video(id: "'.concat(e,'", type: [').concat(yt(t),"]) {\n type\n status\n data {").concat(_t(t),"}\n errors {\n code\n message\n }\n }\n}\n").concat(wt(t),"\n")}}};let St=function(e){return e.NONE="none",e.SALE="sale",e.STOP="stop",e.DELETE="delete",e.ERROR="error",e.UPLOADING="uploading",e}({}),Tt=function(e){return e.SALE="SALE",e.SUSPENSION="SUSPENSION",e}({});const At={percentyStateToSmartStoreState:function(e){switch(e){case St.SALE:return Tt.SALE;case St.STOP:return Tt.SUSPENSION;default:return}}};async function Rt(){try{const e=await Ot();return Et.findTargetStoreFarmChannelFromCreateView(e)}catch(n){if("401"===n.code)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ub85c\uadf8\uc778\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.",le.SMART_STORE_LOGIN_NEED);throw n}}async function Mt(e,t,r,i){var o,a,s,c,u,f,d,l,h;let p;try{p=await Ot()}catch(n){if("401"===n.code)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ub85c\uadf8\uc778\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.",le.SMART_STORE_LOGIN_NEED);throw n}await kt().catch((e=>!1));const m=await se.batchDownloadFile(e.imgs.filter((e=>!!e))),v=await Ct(m,!0).catch((e=>[]));if(t&&t.length>0){const e=await se.downloadFile(ne.setSchemeToUri(t)).catch((e=>{}));if(e){const t=await Ct([e],!1);t&&t.length>0&&(v[0]=t[0])}}let b;if(e.videoUrl)try{b=await Pt(e.videoUrl)}catch(n){console.error(n)}const g=await Et.createUploadProduct(e,p,v,b,r,i);Ut(g,e,v);const y=await async function(e){return fetch("https://sell.smartstore.naver.com/api/products",{method:"POST",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"Content-Type":"application/json;charset=UTF-8","x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors",body:JSON.stringify(e)}).then((t=>t.ok?t.json():t.json().then((t=>{var r;const n=null===t||void 0===t||null===(r=t.invalidInputs)||void 0===r?void 0:r.map((t=>{if("NumberRangePrice"===t.type){var r;const n=de.getSmartStoreOptionPriceRangeFromErrorMessage(t.message),i=de.getSmartStoreOptionNumberFromErrorMessage(t.message);if(n&&i&&null!==(r=e.product)&&void 0!==r&&r.salePrice)return new G("".concat(i,"\ubc88\uc9f8 \uc635\uc158\uc758 \uc635\uc158\uac00\ub294 \ucd5c\uc800 ").concat(n[0]+e.product.salePrice,"\uc6d0\uc5d0\uc11c ").concat(n[1]+e.product.salePrice,"\uc6d0\uae4c\uc9c0 \uc785\ub825\ud574 \uc8fc\uc138\uc694."),le.SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST)}return new G(t.message,le.SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST)}));throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \uc5c5\ub85c\ub4dc \uc2e4\ud328",le.SMART_STORE_UPLOAD_ERROR,n,t)}))))}(g);return{storeProductRootId:String(null!==(o=y.productId)&&void 0!==o?o:""),storefarmProductId:String(null!==(a=null===(s=y.singleChannelProductMap)||void 0===s||null===(c=s.STOREFARM)||void 0===c?void 0:c.id)&&void 0!==a?a:""),storefarmUrlId:null!==(u=null===(f=ne.parseURL(null!==(d=y.storefarmProductDirectUrl)&&void 0!==d?d:"").pathList)||void 0===f?void 0:f[0])&&void 0!==u?u:"",storefarmProductDirectUrl:null!==(l=y.storefarmProductDirectUrl)&&void 0!==l?l:"",mobileStorefarmProductDirectUrl:null!==(h=y.mobileStorefarmProductDirectUrl)&&void 0!==h?h:""}}async function It(e,t,r,i){var o,a,s,c,u,f,d,l,h,p,m,v,b;const g=null===(o=e.optionMap)||void 0===o||null===(a=o.ss)||void 0===a?void 0:a.storeId;if(!g)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST);const y=await Nt(g),_=(await kt().catch((e=>!1)),await se.batchDownloadFile(e.imgs.filter((e=>!!e)))),w=await Ct(_,!0).catch((e=>[]));if(t&&t.length>0){const e=await se.downloadFile(ne.setSchemeToUri(t)).catch((e=>{}));if(e){const t=await Ct([e],!1);t&&t.length>0&&(w[0]=t[0])}}let x;if(null!==(s=y.product)&&void 0!==s&&s.videos&&y.product.videos.length>0&&!e.videoUrl)x={action:"remove"};else if((null===(c=y.product)||void 0===c||!c.videos||y.product.videos.length<=0)&&e.videoUrl)try{x={action:"add",video:await Pt(e.videoUrl)}}catch(n){console.error(n)}const E=await Et.createEditProduct(e,y,w,x,r,i);Ut(E,e,w);const S=await async function(e){var t;return fetch("https://sell.smartstore.naver.com/api/products",{method:"PATCH",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"Content-Type":"application/json;charset=UTF-8","x-current-state":"https://sell.smartstore.naver.com/#/products/edit/".concat(null===(t=e.product)||void 0===t?void 0:t.id),"x-current-statename":"main.product.edit","x-to-statename":"main.product.edit"},mode:"cors",body:JSON.stringify(e)}).then((t=>t.ok?t.json():t.json().then((t=>{var r;const n=null===t||void 0===t||null===(r=t.invalidInputs)||void 0===r?void 0:r.map((t=>{if("NumberRangePrice"===t.type){var r;const n=de.getSmartStoreOptionPriceRangeFromErrorMessage(t.message),i=de.getSmartStoreOptionNumberFromErrorMessage(t.message);if(n&&i&&null!==(r=e.product)&&void 0!==r&&r.salePrice)return new G("".concat(i,"\ubc88\uc9f8 \uc635\uc158\uc758 \uc635\uc158\uac00\ub294 \ucd5c\uc800 ").concat(n[0]+e.product.salePrice,"\uc6d0\uc5d0\uc11c ").concat(n[1]+e.product.salePrice,"\uc6d0\uae4c\uc9c0 \uc785\ub825\ud574 \uc8fc\uc138\uc694."),le.SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST)}return new G(t.message,le.SMART_STORE_UPLOAD_PRODUCT_BAD_REQUEST)}));throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \uc218\uc815 \uc2e4\ud328",le.SMART_STORE_UPLOAD_ERROR,n,t)}))))}(E);return{storeProductRootId:String(null!==(u=S.productId)&&void 0!==u?u:""),storefarmProductId:String(null!==(f=null===(d=S.singleChannelProductMap)||void 0===d||null===(l=d.STOREFARM)||void 0===l?void 0:l.id)&&void 0!==f?f:""),storefarmUrlId:null!==(h=null===(p=ne.parseURL(null!==(m=S.storefarmProductDirectUrl)&&void 0!==m?m:"").pathList)||void 0===p?void 0:p[0])&&void 0!==h?h:"",storefarmProductDirectUrl:null!==(v=S.storefarmProductDirectUrl)&&void 0!==v?v:"",mobileStorefarmProductDirectUrl:null!==(b=S.mobileStorefarmProductDirectUrl)&&void 0!==b?b:""}}async function Ot(){return fetch("https://sell.smartstore.naver.com/api/products?_action=create",{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>{if(e.ok)return e.json();throw new G("Error: Product View \ub85c\ub529 \uc2e4\ud328",e.status.toString())}))}async function Ct(e,t){if(!e||0===e.length)return[];const r=new FormData;let i=0;for await(const n of e){const e=await H.getRandomFileName(n,"jpeg");r.append("files[".concat(i++,"]"),n,e)}try{const e=await fetch("https://sell.smartstore.naver.com/api/v2/product-photos/uploads?acceptedPatterns=image%2Fjpeg,image%2Fgif,image%2Fpng,image%2Fbmp",{method:"POST",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors",body:r});if(e.ok)return await e.json();{var o;const t=await e.json(),r=null===t||void 0===t||null===(o=t.invalidInputs)||void 0===o?void 0:o.map((e=>new G(e.message,le.SMART_STORE_UPLOAD_PHOTO_BAD_REQUEST)));throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ud30c\uc77c \uc5c5\ub85c\ub4dc \uc2e4\ud328",le.SMART_STORE_ERROR,r)}}catch(n){console.error(n)}if(!t||e.length<2)return[];console.log("file upload retry each");const a=[];for await(const n of e){const e=await Ct([n],!1);e.length>0&&a.push(e[0])}return a}async function Pt(e){var t,r,n,i;const o=await se.downloadFile(e).catch((e=>{}));if(!o)throw new G("Video download failed",le.SMART_STORE_VIDEO_UPLOAD_FAIL);if(o.size>200*ie.BYTE_1MB)throw new G("Video size too large",le.SMART_STORE_VIDEO_UPLOAD_FAIL);const a=await H.getRandomFileName(o,H.getExtensionFromUri(e)),s=await fetch("https://sell.smartstore.naver.com/api/videoinfra/SELLER/bypass/token?durationLimit=900&fileSizeLimit=1073741824",{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",mode:"cors"}).then((e=>e.json())),c=await fetch("https://sell.smartstore.naver.com/api/videoinfra/SELLER/videoId",{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",mode:"cors"}).then((e=>e.json())),u=await fetch("https://nexus.vod.naver.com/warp/21/upload/v4/".concat(c.videoId,"/sessions"),{method:"POST",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",mode:"cors",body:JSON.stringify({chunkSize:5242880,chunkUpload:!0,delayIngestion:"additional",fileName:a,fileSize:o.size,serviceId:21,token:s.token,userId:s.data.userId})}).then((e=>e.json())),f=[];let d=1;for(let y=0;y{var t;return fetch("https://".concat(null===(t=u.servers)||void 0===t?void 0:t[0],"/upload/v2/files"),{method:"POST",credentials:"include",cache:"no-cache",mode:"cors",body:e}).then((e=>e.json()))}));await Promise.all(l),await fetch("https://nexus.vod.naver.com/warp/21/upload/v4/files/".concat(c.videoId,"/additionalInfo"),{method:"POST",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"Content-Type":"application/json;charset=UTF-8"},mode:"cors",body:JSON.stringify({channel:null,encodeType:"normal",logoId:null,trailer:{aniGif:{startTime:0,fps:10,endTime:1e4},manualMp4s:[{startTime:0,endTime:3e4,hasSound:!0,resolutionCode:720}]}})}).then((e=>e.json()));const h=async e=>await fetch("https://nexus.vod.naver.com/api/v1/files",{method:"POST",cache:"no-cache",keepalive:!0,referrer:"https://sell.smartstore.naver.com/",body:JSON.stringify(e)}).then((e=>e.json()));let p,m,v,b,g,_,w;for await(const L of[1,2,3,4,5,6,7,8,9,10]){let e=[];if(p&&m){if(v&&b&&g&&_&&w)break;{var x,E,S,T,A,R,M,I,O,C;e=[],_||e.push(pe.VideoHashCode),b||e.push(pe.Thumbnails),w||e.push(pe.Encoding),g||e.push(pe.Hls),v||e.push(pe.AbrHls);const t=await h(Et.makeFileMetaRequestBody(u.key,e));v||(v=null===(x=t.data)||void 0===x||null===(E=x._0_0)||void 0===E?void 0:E.find((e=>e.type===pe.AbrHls&&"done"===e.status))),b||(b=null===(S=t.data)||void 0===S||null===(T=S._0_0)||void 0===T?void 0:T.find((e=>e.type===pe.Thumbnails&&"done"===e.status))),g||(g=null===(A=t.data)||void 0===A||null===(R=A._0_0)||void 0===R?void 0:R.find((e=>e.type===pe.Hls&&"done"===e.status))),_||(_=null===(M=t.data)||void 0===M||null===(I=M._0_0)||void 0===I?void 0:I.find((e=>e.type===pe.VideoHashCode&&"done"===e.status))),w||(w=null===(O=t.data)||void 0===O||null===(C=O._0_0)||void 0===C?void 0:C.find((e=>e.type===pe.Encoding&&"done"===e.status)))}}else{var P,N,k,U;p||e.push(pe.Ingest),m||e.push(pe.VideoHeader);const t=await h(Et.makeFileMetaRequestBody(u.key,e));p||(p=null===(P=t.data)||void 0===P||null===(N=P._0_0)||void 0===N?void 0:N.find((e=>e.type===pe.Ingest&&"done"===e.status))),m||(m=null===(k=t.data)||void 0===k||null===(U=k._0_0)||void 0===U?void 0:U.find((e=>e.type===pe.VideoHeader&&"done"===e.status)))}await y.delay(5e3)}if(!p||null===(t=m)||void 0===t||null===(r=t.data)||void 0===r||!r[0]||!v||null===(n=b)||void 0===n||null===(i=n.data)||void 0===i||!i[0]||!g||!_||!w)throw new G("\ube44\ub514\uc624 \uc5c5\ub85c\ub4dc\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. [fetching meta fail]",le.SMART_STORE_VIDEO_UPLOAD_FAIL);const B=await fetch("https://sell.smartstore.naver.com/api/file/photoinfra/uploadUrl",{method:"POST",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"Content-Type":"application/json;charset=UTF-8","x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors",body:JSON.stringify({url:b.data[0].path})}).then((e=>e.json())),D=await fetch("https://sell.smartstore.naver.com/api/videoinfra/SELLER/".concat(c.videoId,"/animated-gif"),{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>e.json()));return{videoId:c.videoId,thumbnailUrl:B.imageUrl,thumbnailWidth:B.width,thumbnailHeight:B.height,encodeStatusType:"COMPLETE",trailerStatusType:"WAIT",order:1,gifThumbnailInfo:{gifThumbnailStatusType:"COMPLETE",gifThumbnailUrl:D.imageUrl,gifThumbnailWidth:D.width,gifThumbnailHeight:D.height},detailInfo:{error:!1,...m.data[0]}}}async function Nt(e){try{const t=await fetch("https://sell.smartstore.naver.com/api/products/".concat(e),{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/origin-list","x-current-statename":"main.product.origin-list","x-to-statename":"main.product.edit"},mode:"cors"}).then((e=>{if(e.ok)return e.json();throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST,void 0,e)}));if(null===t||void 0===t||!t.product)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST);return t}catch(n){throw"401"===n.code?new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ub85c\uadf8\uc778\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.",le.SMART_STORE_LOGIN_NEED):n}}async function kt(){return await fetch("https://sell.smartstore.naver.com/api/login/check-neoid-session",{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>e.ok?e.json():{existNeoIdSession:!1})).then((e=>e.existNeoIdSession)).catch((e=>!1))}function Ut(e,t,r){var n;const i=[];if(null!==(n=t.storeProfileMap)&&void 0!==n&&n.ss||i.push(new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ub9c8\ucf13 \uc124\uc815\uc744 \ud574\uc8fc\uc138\uc694",le.SMART_STORE_EMPTY_MARKET_PROFILE)),t.name.transMap.ko||i.push(new G("\uc0c1\ud488\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694",le.SMART_STORE_EMPTY_PRODUCT_NAME)),t.options.some((e=>e.isExpose))||i.push(new G("\ubaa8\ub4e0 \uc635\uc158\uc774 \uc5c5\ub85c\ub4dc \uc81c\uc678\ub418\uc5b4\uc788\uc2b5\ub2c8\ub2e4",le.SMART_STORE_EMPTY_OPTION)),t.options.some((e=>e.stock>0))||i.push(new G("\ubaa8\ub4e0 \uc635\uc158\uc758 \uc7ac\uace0\uc218\ub7c9\uc774 0 \uc785\ub2c8\ub2e4",le.SMART_STORE_EMPTY_OPTION_STOCK)),i.length>0)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \ub370\uc774\ud130 \uc624\ub958",le.SMART_STORE_ERROR,i)}const Bt={uploadSmartStoreWithRetry:async function(e,t,r,i){const o=(await ce.fetchProductForSmartStore(e)).data;try{const a=await Mt(o,t,r,i);try{await ce.updateProductStateToSale(e,a.storefarmUrlId,a.storeProductRootId,a.storefarmProductId)}catch(n){console.error(n)}return a}catch(n){if(n instanceof G&&n.code===le.SMART_STORE_UPLOAD_ERROR){let a="[".concat(n.message,"] ");n.data&&Array.isArray(n.data)&&(a=a.concat(n.data.map((e=>"[".concat(e.message,"]"))).join(" ")));const s=(await ce.errorProduct(e,{errorMsg:a,additionalInfo:n.originalError})).data;if(s){const o=await Mt(s,t,r,i);try{await ce.updateProductStateToSale(e,o.storefarmUrlId,o.storeProductRootId,o.storefarmProductId)}catch(n){console.error(n)}return o}throw n}throw n}},editSmartStoreWithRetry:async function(e,t,r,i){const o=(await ce.fetchProductForSmartStore(e)).data;try{return await It(o,t,r,i)}catch(n){if(n instanceof G&&n.code===le.SMART_STORE_UPLOAD_ERROR){let a="[".concat(n.message,"] ");n.data&&Array.isArray(n.data)&&(a=a.concat(n.data.map((e=>"[".concat(e.message,"]"))).join(" ")));const s=(await ce.errorProduct(e,{errorMsg:a,additionalInfo:n.originalError})).data;if(s)return await It(s,t,r,i);throw n}throw n}},deleteSmartStore:async function(e){var t,r;let i;i=(await ce.fetchProductForSmartStore(e)).data;const o=null===(t=i.optionMap)||void 0===t||null===(r=t.ss)||void 0===r?void 0:r.storeId;if(!o)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST);let a;try{var s,c;a=null===(s=await Nt(o))||void 0===s||null===(c=s.product)||void 0===c?void 0:c.id}catch(n){if(n instanceof G&&n.code===le.SMART_STORE_PRODUCT_NOT_EXIST){var u,f;const t=await Rt();if(null!==t&&void 0!==t&&t.url&&(null===(u=i.optionMap)||void 0===u||null===(f=u.ss)||void 0===f?void 0:f.storeName)===t.url)return await ce.updateProductState(e,St.DELETE),!0}throw n}const d=await fetch("https://sell.smartstore.naver.com/api/products/".concat(a),{method:"DELETE",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/edit/".concat(a),"x-current-statename":"main.product.edit","x-to-statename":"main.product.edit"},mode:"cors"}).then((e=>{if(e.ok)return!0;throw new G("\uc0c1\ud488 \uc0ad\uc81c \uc2e4\ud328",e.status.toString())}));try{await ce.updateProductState(e,St.DELETE)}catch(n){console.error(n)}return d},updateProductState:async function(e,t){var r,i;const o=null===(r=(await ce.fetchProductForSmartStore(e)).data.optionMap)||void 0===r||null===(i=r.ss)||void 0===i?void 0:i.storeId;if(!o)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST);const a=parseInt(o),s=At.percentyStateToSmartStoreState(t);if(!s)throw new G("\ubcc0\uacbd\ud560 \uc218 \uc5c6\ub294 \uc0c1\ud0dc\uc785\ub2c8\ub2e4.",le.SMART_STORE_CANNOT_CHANGE_PRODUCT_STATE);const c={productBulkUpdateType:s,productStatusType:s,productNos:[a]};await fetch("https://sell.smartstore.naver.com/api/products/bulk-update?_action=updateProductStatusType",{method:"PATCH",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/origin-list","x-current-statename":"main.product.origin-list","x-to-statename":"main.product.origin-list"},mode:"cors",body:JSON.stringify(c)});for await(const h of[1,2,3,4,5]){var u,f,d,l;await y.delay(500);const r=await fetch("https://sell.smartstore.naver.com/api/products/bulk-update?_action=getBulkUpdateProgressResult",{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/origin-list","x-current-statename":"main.product.origin-list","x-to-statename":"main.product.origin-list"},mode:"cors"}).then((e=>{if(e.ok)return e.json();throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \uc0c1\ud0dc\ubcc0\uacbd \uc2e4\ud328",e.status.toString())}));if((null===r||void 0===r||null===(u=r.productBulkUpdateResultVO)||void 0===u?void 0:u.bulkUpdateType)===s&&null!==r&&void 0!==r&&null!==(f=r.productBulkUpdateResultVO)&&void 0!==f&&null!==(d=f.successIds)&&void 0!==d&&d.includes(a)){try{await ce.updateProductState(e,t)}catch(n){console.error(n)}return!0}if(null!==r&&void 0!==r&&null!==(l=r.productBulkUpdateResultVO)&&void 0!==l&&l.resultMessage){const e=Object.values(r.productBulkUpdateResultVO.resultMessage).filter((e=>!!e)).join(", ");if(e.includes("\uc0ad\uc81c\ub41c \uc0c1\ud488"))throw new G(e,le.SMART_STORE_PRODUCT_ALREADY_DELETED)}}return!1},fetchSmartStoreProduct:async function(e){var t,r;const n=null===(t=(await ce.fetchProductForSmartStore(e)).data.optionMap)||void 0===t||null===(r=t.ss)||void 0===r?void 0:r.storeId;if(!n)throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4\uc5d0 \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud488\uc785\ub2c8\ub2e4.",le.SMART_STORE_PRODUCT_NOT_EXIST);return await Nt(n)},getCurrentLoggedInChannel:Rt,fetchStoreCreateView:Ot,checkRestrictedTag:async function(e){return fetch("https://sell.smartstore.naver.com/api/product/shared/is-restrict-tag?_action=isRestrictTag&tag=".concat(e),{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>{if(e.ok)return e.json();throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 TAG \uccb4\ud06c \uc2e4\ud328",e.status.toString())}))},checkNeoIdSession:kt,fetchCategories:async function(){const e=async e=>fetch("https://sell.smartstore.naver.com/api/category-search/".concat(e,"?_action=getChild&isValid=true"),{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>e.text())).then((e=>e?JSON.parse(e):[])),t=await e("root");for await(const o of t){var r;o.children=null!==(r=await e(o.id))&&void 0!==r?r:[]}for await(const o of t.flatMap((e=>e.children))){var n;o&&(o.children=null!==(n=await e(o.id))&&void 0!==n?n:[])}for await(const o of t.flatMap((e=>e.children)).flatMap((e=>null===e||void 0===e?void 0:e.children))){var i;o&&(o.children=null!==(i=await e(o.id))&&void 0!==i?i:[])}return t},fetchNaverShoppingResultPage:async function(e){try{const r=await fetch((t=e,"".concat(t,"&").concat(ie.P_REMOVE_ORIGIN_NET_REQUEST_STRING)),{method:"GET",cache:"no-cache",credentials:"include",mode:"cors"});return await r.text()}catch(n){throw new G("\uc0c1\ud488 \uc815\ubcf4\ub97c \ubd88\ub7ec\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc7a0\uc2dc \ud6c4 \ub2e4\uc2dc \uc2dc\ub3c4\ud574\uc8fc\uc138\uc694",le.AI_SOURCING_NAVER_FETCH_ERROR,void 0,n)}var t},checkSearchableTags:async function(e){const t=e.map((e=>"tags=".concat(encodeURIComponent(e)))).join("&");return fetch("https://sell.smartstore.naver.com/api/product/shared/check-searchable-tags?_action=checkSearchableTags&".concat(t),{method:"GET",credentials:"include",cache:"no-cache",referrer:"https://sell.smartstore.naver.com/",headers:{"x-current-state":"https://sell.smartstore.naver.com/#/products/create","x-current-statename":"main.product.create","x-to-statename":"main.product.create"},mode:"cors"}).then((e=>{if(e.ok)return e.json();throw new G("\uc2a4\ub9c8\ud2b8\uc2a4\ud1a0\uc5b4 \uac80\uc0c9\uac00\ub2a5 TAG \uccb4\ud06c \uc2e4\ud328",e.status.toString())})).then((t=>e.map((e=>{const r=t.find((t=>t.tag===e));return{tag:e,count:null===r||void 0===r?void 0:r.count,id:null===r||void 0===r?void 0:r.id,searchable:!!r}}))))},fetchNaverShoppingPopularTermsByCategory:async function(e){try{const r=await fetch((t="https://datalab.naver.com/shoppingInsight/getCategoryKeywordRank.naver","".concat(t,"?").concat(ie.P_ADD_NAVER_SHOPPING_REFERER)),{method:"POST",cache:"no-cache",credentials:"omit",mode:"cors",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams(e)});return await r.json()}catch(n){throw new G("\uc778\uae30 \uac80\uc0c9\uc5b4 \uc815\ubcf4\ub97c \ubd88\ub7ec\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc7a0\uc2dc \ud6c4 \ub2e4\uc2dc \uc2dc\ub3c4\ud574\uc8fc\uc138\uc694",le.AI_NAVER_SHOPPING_POPULAR_TERMS_ERROR,void 0,n)}var t}};class Dt{constructor(e,t){this.tabId=e,this.url=t}}class Lt{constructor(e){this.percentyToken=e}}class Ft{constructor(t,r,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.senderTabId=t,this.targetProductId=n,this.ignoreDuplicatedScrap=i,this.type=void 0,this.receiverName=void 0,this.expirationAt=void 0,this.type=e.SCRAP_AUTO,this.receiverName=String(r),this.expirationAt=Date.now()+1e4}}class jt{constructor(e,t){this.type=e,this.targetTabId=t}}class zt extends jt{constructor(t,r,n){super(e.SCRAP_AUTO_FINISH_TO_LIST_PAGE,t),this.targetTabId=t,this.targetProductId=r,this.scrapState=n}}class Ht extends jt{constructor(t,r,n){super(e.SCRAP_SUCCESS_TO_PERCENTY_WEB_TAB,t),this.tabUrl=r,this.percentyProductId=n}}class qt extends jt{constructor(t){super(e.EXTENSION_INSTALLED_TO_PERCENTY_WEB_TAB,t)}}const Gt={requestRaw:async function(e,t,r,n){if("FormData"===(null===r||void 0===r?void 0:r.type)&&r.formData){const e=new FormData;for await(const t of r.formData)if("File"===t.dataType){let r=await fetch(t.value),n=await r.blob();e.append(t.name,n,t.fileName)}else e.append(t.name,t.value,t.fileName);t&&(t.body=e)}else"Normal"===(null===r||void 0===r?void 0:r.type)&&r.normalData&&t&&(t.body=r.normalData);const i=await fetch(e,t);let o;if(i.ok)switch(n){case"json":default:o=await i.json();break;case"text":o=await i.text();break;case"blob":o=await i.blob();break;case"formdata":o=await i.formData();break;case"arraybuffer":o=await i.arrayBuffer()}else o=await i.json();return{success:i.ok,data:o}}};chrome.declarativeNetRequest.ResourceType;const Wt=Object.values(chrome.declarativeNetRequest.ResourceType),Yt=[{id:1,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,requestHeaders:[{operation:chrome.declarativeNetRequest.HeaderOperation.SET,header:"origin",value:"https://sell.smartstore.naver.com"}]},condition:{urlFilter:"https://sell.smartstore.naver.com/api/*",resourceTypes:Wt}},{id:2,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,responseHeaders:[{operation:chrome.declarativeNetRequest.HeaderOperation.SET,header:"Access-Control-Allow-Origin",value:"https://detail.tmall.com"}]},condition:{urlFilter:"*^pretu35njx5lwqx231mc8iwo5fl4dx3j2fg7qpxlfjd|",resourceTypes:Wt}},{id:3,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,responseHeaders:[{operation:chrome.declarativeNetRequest.HeaderOperation.SET,header:"Access-Control-Allow-Origin",value:"https://chaoshi.detail.tmall.com"}]},condition:{urlFilter:"*^sdfw843eldfogor28rgjvxlow28403lfllsk21adds|",resourceTypes:Wt}},{id:4,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,requestHeaders:[{operation:chrome.declarativeNetRequest.HeaderOperation.REMOVE,header:"origin"}]},condition:{urlFilter:"*^".concat(ie.P_REMOVE_ORIGIN_NET_REQUEST_STRING,"|"),resourceTypes:Wt}},{id:5,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,requestHeaders:[{operation:chrome.declarativeNetRequest.HeaderOperation.SET,header:"Referer",value:"https://datalab.naver.com/shoppingInsight/sCategory.naver"},{operation:chrome.declarativeNetRequest.HeaderOperation.SET,header:"Origin",value:"https://datalab.naver.com"}]},condition:{urlFilter:"*^".concat(ie.P_ADD_NAVER_SHOPPING_REFERER,"|"),resourceTypes:Wt}}];class Vt extends jt{constructor(t,r,n){super(e.TO_CONTENT_SCRAP_AUTO_BY_URL,t),this.targetTabId=t,this.scrapTarget=r,this.allowDuplicateScrap=n,this.type=e.TO_CONTENT_SCRAP_AUTO_BY_URL}}class Xt{constructor(e,t,r,n){this.chromeExtensionVersion=e,this.success=t,this.data=r,this.error=n}}var Kt=r(2940);const Qt=async(e,t)=>{const r=()=>{const e="sb".concat((new Date).toUTCString(),"th"),t=(0,Kt.createCipheriv)("aes-256-cbc","12501986019234170293715203984170","6269036102394823"),r=Kt.Buffer.concat([Kt.Buffer.from(e),Kt.Buffer.from("utf8"),Kt.Buffer.from("hex")]),n=Kt.Buffer.concat([t.update(r),t.final()]);return Array.from(n).map((e=>e.toString(16).padStart(2,"0"))).join("")},n=7339288,i=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Promise((r=>{chrome.cookies.getAll({domain:e,partitionKey:{topLevelSite:null}},(e=>{const n=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map);e.map((e=>{var r;(null==(r=e.partitionKey)?void 0:r.topLevelSite)===t&&n.set(e.name,e.value)}));const i=Array.from(n.entries()).reduce(((e,t)=>{let[r,n]=t;return e+"".concat(r,"=").concat(n,"; ")}),"");r(i)}))}))};try{const o=await(async()=>await new Promise((async(t,r)=>{try{let n="";if(n||(n=p(await l.isDebug())),"string"!==typeof e)return r("[UPLOAD FILE API FAIL] type is not string");const i=await fetch(e).then((e=>e.blob()));await H.getRandomFileName(i,"jpeg").then((async e=>{await se.uploadImageToPercentyWithoutToken(i,e).then((e=>{t(e)}))}))}catch(n){r(n)}finally{chrome.declarativeNetRequest.updateSessionRules({removeRuleIds:[2931199]})}})))(),a=await l.isDebug(),s=btoa("".concat(m(a),"/").concat(o)),c="https://msearch.shopping.naver.com/search/image?id=".concat(s),u="".concat("https://msearch.shopping.naver.com/api/search/image/crop","?").concat(new URLSearchParams({from:"shoppinglensid",height:String(600),id:s,width:String(600),x:String(0),y:String(0)}));await(async(e,t)=>{var r,o,a,s,c,u;const f=await i(".naver.com"),d=await i(".shopping.naver.com");await chrome.declarativeNetRequest.updateSessionRules({removeRuleIds:[n],addRules:[{id:n,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,requestHeaders:[{header:"cookie",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:"string"!==typeof f||"string"!==typeof d?"NNB=RB3JOK3TS75GK; SHP_BUCKET_ID=8; spage_uid=":f+d},{header:"origin",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:"https://msearch.shopping.naver.com"},{header:"referer",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:e},{header:"sec-ch-ua",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:t?null===(r=t.userAgentData)||void 0===r||null===(o=r.brands)||void 0===o?void 0:o.map((e=>'"'.concat(e.brand,'";v="').concat(e.version,'"'))).join(","):'"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"'},{header:"sec-ch-ua-arch",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:'""'},{header:"sec-ch-ua-bitness",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:'"64"'},{header:"sec-ch-ua-full-version-list",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:t?null===(a=t.userAgentData)||void 0===a||null===(s=a.brands)||void 0===s?void 0:s.map((e=>'"'.concat(e.brand,'";v="').concat(e.version,'"'))).join(","):'"Google Chrome";v="123.0.6312.87", "Not:A-Brand";v="8.0.0.0", "Chromium";v="123.0.6312.87"'},{header:"sec-ch-ua-mobile",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:t?null!==t&&void 0!==t&&null!==(c=t.userAgentData)&&void 0!==c&&c.mobile?"?1":"?0":"?1"},{header:"sec-ch-ua-model",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:'"Nexus 5"'},{header:"sec-ch-ua-platform",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:t?null===t||void 0===t||null===(u=t.userAgentData)||void 0===u?void 0:u.platform:'"Android"'},{header:"sec-ch-ua-platform-version",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:'"6.0"'},{header:"sec-ch-ua-wow64",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:'"?0"'}]},condition:{regexFilter:"^https://msearch.shopping.naver.com/*",resourceTypes:[chrome.declarativeNetRequest.ResourceType.XMLHTTPREQUEST]}}]})})(c,t);const f=await fetch(u,{headers:{accept:"application/json, text/plain, */*","accept-language":"ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7",sbth:r(),"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin","Referrer-Policy":"unsafe-url"}});return(e=>{var t,r;return(null!=(r=null==(t=null==e?void 0:e.searchResponse)?void 0:t.similarImages)?r:[]).map((e=>{const{productTitle:t,imageUrl:r,price:n,purchaseCnt:i=0,reviewCount:o=0,score:a=0,openDate:s,rank:c,link:u,mallProductUrl:f,category1Name:d,category2Name:l,category3Name:h,category4Name:p,category1Id:m,category2Id:v,category3Id:b,category4Id:g,relevance:y=0}=e;return{productTitle:t,imageUrl:r,price:Number(n),purchaseCnt:Number(i),reviewCount:Number(o),score:Number(a),openDate:s,link:u,mallProductUrl:f,rank:Number(c),category1Name:d,category2Name:l,category3Name:h,category4Name:p,category1Id:m,category2Id:v,category3Id:b,category4Id:g,relevance:Number(y)}}))})(await f.json())}catch(o){throw new Error("handleNaverImageSearch : ".concat(o))}finally{chrome.declarativeNetRequest.updateSessionRules({removeRuleIds:[n]})}},Jt="SMART_STORE_SEMAPHORE_KEY";const Zt={canUploadSmartStore:async function(e){try{var r;const n=null!==(r=await t.getLocalStorage(Jt))&&void 0!==r?r:[],i=Date.now();return!n.filter((e=>e.expireAt>i)).find((t=>t.percentyProductId===e))}catch(n){return console.error(n),!0}},setSmartStoreUploading:async function(e){try{var r;const n=null!==(r=await t.getLocalStorage(Jt))&&void 0!==r?r:[],i=Date.now(),o=n.filter((t=>t.expireAt>i&&t.percentyProductId!==e));o.push({percentyProductId:e,expireAt:i+10*ie.MINUTE}),await t.setLocalStorage(Jt,o)}catch(n){console.error(n)}},setSmartStoreUploadFinish:async function(e){try{var r;const n=null!==(r=await t.getLocalStorage(Jt))&&void 0!==r?r:[],i=Date.now(),o=n.filter((e=>e.expireAt>i)),a=o.find((t=>t.percentyProductId===e));a&&(a.expireAt=i+10*ie.SECOND),await t.setLocalStorage(Jt,o)}catch(n){console.error(n)}}},$t=331128332;let er=5;const tr=async(e,t,r)=>{e.map((e=>{chrome.cookies.getAll({domain:e,name:t},(t=>{if(t.length>0){const r=new Date;r.setTime(r.getTime()+6048e5),t.forEach((t=>{chrome.cookies.set({url:e,name:t.name,value:t.value,domain:e,path:t.path,secure:t.secure,httpOnly:t.httpOnly,expirationDate:Math.floor(r.getTime()/1e3)})}))}}))}));const n=e.map((e=>new Promise(((r,n)=>{chrome.cookies.getAll({domain:e,name:t},(e=>{if(0===e.length)return void n(new G("[ERROR] Cookies not found",le.TAOBAO_COOKIE_NONE));const t=e.filter((e=>e.value)).map((e=>e.value));t.length>0?r(t):n(new G("[ERROR] Cookies not found",le.TAOBAO_COOKIE_NONE))}))})))),i=(await Promise.allSettled(n)).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(0===i.length)throw new G("[ERROR] Cookies not found",le.TAOBAO_COOKIE_NONE);return i.flat()[0]},rr=async()=>{const e=[".taobao.com",".tmall.com"];return{mh5tkCookie:await tr(e,"_m_h5_tk").catch((e=>{})),mh5tkencCookie:await tr(e,"_m_h5_tk_enc").catch((e=>{}))}};async function nr(e){try{var t,r;const n="12574478",i=(new Date).getTime(),o=await async function(e){return{appId:"34850",params:JSON.stringify({pcGraphSearch:!0,region:"",strimg:e.replace(/^data:image\/[a-z]+;base64,/,""),sortOrder:"0",ttid:"600000@taobao_android_10.16.10",tab:"all",sversion:15.8,vm:"nw"})}}(e),a=function(e){const t=JSON.stringify(e);return"data=".concat(encodeURIComponent(t))}(o),s=await rr();!s||s.mh5tkCookie&&s.mh5tkencCookie||(er<=0?er=5:er--),0===er&&(er=5),await async function(e){try{const t=await function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Promise((r=>{chrome.cookies.getAll({domain:e,partitionKey:{topLevelSite:null}},(e=>{const n=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map);e.map((e=>{let r;(null==(r=e.partitionKey)?void 0:r.topLevelSite)===t&&n.set(e.name,e.value)}));const i=Array.from(n.entries()).reduce(((e,t)=>{let[r,n]=t;return e+"".concat(r,"=").concat(n,"; ")}),"");r(i)}))}))}(".taobao.com","https://taobao.com");let r=t.replace(/_m_h5_tk=[^;]+/,"_m_h5_tk=".concat(e.mh5tkCookie));r=t.replace(/_m_h5_tk_enc=[^;]+/,"_m_h5_tk_enc=".concat(e.mh5tkencCookie)),chrome.declarativeNetRequest.updateSessionRules({removeRuleIds:[$t],addRules:[{id:$t,priority:1,action:{type:chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,requestHeaders:[{header:"cookie",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:r},{header:"origin",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:"https://world.taobao.com"},{header:"referer",operation:chrome.declarativeNetRequest.HeaderOperation.SET,value:"https://world.taobao.com"}]},condition:{regexFilter:"^https://h5api.m.taobao.com/h5/mtop.relationrecommend.wirelessrecommend.recommend/2.0/*",resourceTypes:[chrome.declarativeNetRequest.ResourceType.XMLHTTPREQUEST]}}]})}catch(t){console.error("[MODIFY TAOBAO COOKIE ERROR]",t)}}(s);const c=await async function(e){const{bodyData:t,appKey:r,mh5tkCookie:n,nowTime:i}=e,o=n.split("_").concat([""])[0].trim();return await async function(e){function t(e,t){return e<>>32-t}function r(e,t){let r,n,i,o,a;return i=2147483648&e,o=2147483648&t,a=(1073741823&e)+(1073741823&t),(r=1073741824&e)&(n=1073741824&t)?2147483648^a^i^o:r|n?1073741824&a?3221225472^a^i^o:1073741824^a^i^o:a^i^o}function n(e,n,i,o,a,s,c){return e=r(e,r(r((u=n)&i|~u&o,a),c)),r(t(e,s),n);var u}function i(e,n,i,o,a,s,c){return e=r(e,r(r(n&(u=o)|i&~u,a),c)),r(t(e,s),n);var u}function o(e,n,i,o,a,s,c){return e=r(e,r(r(n^i^o,a),c)),r(t(e,s),n)}function a(e,n,i,o,a,s,c){return e=r(e,r(r(i^(n|~o),a),c)),r(t(e,s),n)}function s(e){let t,r="",n="";for(t=0;3>=t;t++)r+=(n="0"+(e>>>8*t&255).toString(16)).substr(n.length-2,2);return r}let c,u,f,d,l,h,p,m,v,b;for(b=function(e){for(var t,r=e.length,n=r+8,i=16*((n-n%64)/64+1),o=new Array(i-1),a=0,s=0;r>s;)a=s%4*8,o[t=(s-s%4)/4]=o[t]|e.charCodeAt(s)<>>29,o}(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;rn?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}(e)),h=1732584193,p=4023233417,m=2562383102,v=271733878,c=0;ce.json())),f=null===(r=u.ret)||void 0===r?void 0:r[0];if(0===er)er=5;else{if(f.includes("FAIL_SYS_ILLEGAL_ACCESS")||f.includes("FAIL_SYS_TOKEN_ILLEGAL::\u975e\u6cd5\u4ee4\u724c")||f.includes("FAILSYS::trace")||f.includes("FAIL_SYS_USER_VALIDATE")||f.includes("RGV587_ERROR::SM::\u54ce\u54df\u5582,\u88ab\u6324\u7206\u5566,\u8bf7\u7a0d\u540e\u91cd\u8bd5!"))throw er<=0?er=5:er--,new G(f,le.TAOBAO_COOKIE_NONE,u.data.url);er=5}const d=u.data.itemsArray?u.data.itemsArray.map((async e=>{const t=e.pics.mainPic;return{...e,pics:{...e.pics,mainPic:t.replace(/(http:\/\/).*(\.alicdn)/,"$1img$2")}}})):[];return await Promise.all(d).then((e=>e))}finally{chrome.declarativeNetRequest.updateSessionRules({removeRuleIds:[$t]})}}const ir=async function(e){const t=await async function(e){const t=await fetch(e,{mode:"no-cors"}),r=await t.blob();return new File([r],e,{type:r.type})}(e),r=await H.encodeFileToBase64(t);return await nr(r)};class or extends jt{constructor(t,r,n,i){super(e.IMAGE_SEARCH_BTN_POSITION,t),this.targetTabId=t,this.imgUrl=r,this.left=n,this.top=i}}class ar extends jt{constructor(t,r,n){super(e.IMAGE_SEARCH_MODAL_OPEN,t),this.targetTabId=t,this.isOpen=r,this.imgUrl=n}}const sr=async e=>{const t=await l.isDebug(),r=t?"":"".concat(h.gaEndPoint,"?measurement_id=").concat(h.gaMeasurementId,"&api_secret=").concat(h.gaApiSecret,"&endpoint_secret");if(""!==r){var n;const t=null!==(n=await f.getUserId())&&void 0!==n?n:"None User",i=async()=>{let e=(await chrome.storage.local.get("clientId")).clientId;return e||(e=P.getRandomUUID(),await chrome.storage.local.set({clientId:e})),e};await fetch(r,{method:"POST",body:JSON.stringify({client_id:await i(),events:e.map((e=>({...e,name:e.name,params:{...e.params,percenty_id:t}})))})})}};let cr=function(e){return e.EXT_IMGSEARCH_TAOBAO_BTN_CLICK="ext_imgsearch_taobao_btn_click",e.EXT_IMGSEARCH_TAOBAO_OVERSEAS_BTN_CLICK="ext_imgsearch_taobao_overseas_btn_click",e.EXT_IMGSEARCH_1688_BTN_CLICK="ext_imgsearch_1688_btn_click",e.EXT_IMGSEARCH_TAOBAODETAIL_CLICK="ext_imgsearch_taobaodetail_click",e.EXT_IMGSEARCH_TAOBAO_OVERSEASDETAIL_CLICK="ext_imgsearch_taobao_overseasdetail_click",e.EXT_IMGSEARCH_1688DETAIL_CLICK="ext_imgsearch_1688detail_click",e.EXT_IMGSEARCH_NAVERDETAIL_CLICK="ext_imgsearch_naverdetail_click",e.EXT_IMGSEARCH_NAVERDETAILITEM_CLICK="ext_imgsearch_naverdetailitem_click",e.EXT_IMGSEARCH_CONTEXT_MENU_TAOBAO_BTN_CLICK="ext_imgsearch_context_menu_taobao_btn_click",e.EXT_IMGSEARCH_CONTEXT_MENU_TAOBAO_OVERSEAS_BTN_CLICK="ext_imgsearch_context_menu_taobao_overseas_btn_click",e.EXT_IMGSEARCH_CONTEXT_MENU_1688_BTN_CLICK="ext_imgsearch_context_menu_1688_btn_click",e.EXT_IMGSEARCH_TAOBAO_REFRESH_CLICK="ext_imgsearch_taobao_refresh_click",e.EXT_IMGSEARCH_TAOBAO_OVERSEAS_REFRESH_CLICK="ext_imgsearch_taobao_overseas_refresh_click",e.EXT_IMGSEARCH_REFRESH_1688_CLICK="ext_imgsearch_refresh_1688_click",e.EXT_IMGSEARCH_NAVERDETAIL_REFRESH_CLICK="ext_imgsearch_naverdetailitem_refresh_click",e.EXT_IMGSEARCH_REDRIECT_PERCENTY_SITE="ext_imgsearch_redriect_percenty_site",e.EXT_IMGSEARCH_TAOBAO_TAB_BTN_CLICK="ext_imgsearch_taobao_tab_btn_click",e.EXT_IMGSEARCH_TAOBAO_OVERSEAS_TAB_BTN_CLICK="ext_imgsearch_taobao_overseas_tab_btn_click",e.EXT_IMGSEARCH_1688_TAB_BTN_CLICK="ext_imgsearch_1688_tab_btn_click",e}({});const ur="REMOTE_CONFIG_KEY";const fr={getRemoteConfig:async function(){const e=await t.getLocalStorage(ur).catch((e=>{}));if(e&&e.expireAt&&e.config&&e.expireAt>ht.now())return e.config;const r=await l.isDebug()?h.remoteConfigTest:h.remoteConfigProd;return await fetch(r,{method:"GET"}).then((e=>e.json())).then((e=>(t.setLocalStorage(ur,{expireAt:ht.now()+10*ht.MINUTE,config:e}),e)))}};class dr{constructor(e){this.type=e}}class lr extends dr{constructor(t,r,n,i){super(e.IMG_SEARCH),this.imgUrl=t,this.targetTabId=r,this.imgDataUrl=n,this.market=i}}class hr extends jt{constructor(t,r,n,i,o,a){super(e.IMAGE_SEARCH_RESULT,t),this.targetTabId=t,this.imgUrl=r,this.imgErr=n,this.imgData=i,this.cny=o,this.marketType=a}}const pr=async(e,t)=>{const r={from:t,imgUrls:[e]},n=await l.isDebug();return await fetch("".concat(p(n),"/sourcing/products"),{method:"POST",headers:{"Content-Type":"application/json","X-AUTH-TOKEN":await f.getToken()},body:JSON.stringify(r)})};let mr=function(e){return e.KO="ko",e.CN="cn",e.EN="en",e.GB="gb",e.DE="de",e.FR="fr",e.JA="ja",e.IT="it",e.ES="es",e.IN="in",e.USD="USD",e.CAD="CAD",e.EUR="EUR",e.JPY="JPY",e.INR="INR",e.MXN="MXN",e.GBP="GBP",e.CNY="CNY",e.KRW="KRW",e}({});Object.values(mr).reduce(((e,t)=>(e[t]=void 0,e)),{});const vr=async e=>await fetch("https://api.coinbase.com/v2/exchange-rates?currency=".concat(e),{method:"GET"}).then((e=>e.json())).then((e=>e.data.rates.KRW)),br=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"tb";return t.setLocalStorage("searchImgMarketName",e)},gr=async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;switch(e.market){case"osee":await pr(e.imgUrl,e.market).then((e=>vr(mr.CNY).then((t=>({err:null,data:e.json(),cny:t}))))).then((r=>{let{data:n,cny:i}=r;n.then((r=>{const n=r.data.list.map((e=>{var t,r;return{imgSrc:null!==(t=null===e||void 0===e?void 0:e.imgUrl)&&void 0!==t?t:"",auctionUrl:e.id?"https://detail.1688.com/offer/".concat(e.id,".html"):"",price:null!==(r=e.price)&&void 0!==r?r:0,monetaryUnit:"\xa5",sale:"0",review:0}}));x.sendTabsMessage(new hr(t,e.imgUrl,null,n,String(i),"osee"))}))})).catch((r=>{x.sendTabsMessage(new hr(t,e.imgUrl,r,void 0))}));break;case"tb_overseas":await pr(e.imgUrl,"tb").then((e=>vr(mr.CNY).then((t=>({err:null,data:e.json(),cny:t}))))).then((r=>{let{data:n,cny:i}=r;n.then((r=>{const n=r.data.list.map((e=>{var t,r;return{imgSrc:null!==(t=null===e||void 0===e?void 0:e.imgUrl)&&void 0!==t?t:"",auctionUrl:null!==e&&void 0!==e&&e.id?"https://detail.tmall.com/item.htm?id=".concat(e.id):"",price:null!==(r=e.price)&&void 0!==r?r:0,monetaryUnit:"\xa5",sale:"0",review:0}}));x.sendTabsMessage(new hr(t,e.imgUrl,null,n,String(i),"tb_overseas"))}))})).catch((r=>{x.sendTabsMessage(new hr(t,e.imgUrl,r,void 0))}));break;default:await ir(e.imgUrl).then((e=>vr(mr.CNY).then((t=>({err:null,data:e,cny:t}))))).then((n=>{const i=n.data.map((e=>{var t,r,n,i,o,a,s,c,u,f,d;return{imgSrc:null!==(t=null===e||void 0===e||null===(r=e.pics)||void 0===r?void 0:r.mainPic)&&void 0!==t?t:"",auctionUrl:null!==(n=e.auctionUrl)&&void 0!==n?n:"",price:null!==(i=null===e||void 0===e||null===(o=e.priceInfo)||void 0===o?void 0:o.pcFinalPrice)&&void 0!==i?i:0,monetaryUnit:null!==(a=null===e||void 0===e||null===(s=e.priceInfo)||void 0===s?void 0:s.monetaryUnit)&&void 0!==a?a:"\xa5",sale:null!==(c=null===e||void 0===e||null===(u=e.salesInfo)||void 0===u?void 0:u.totalSale)&&void 0!==c?c:"",review:null!==(f=null===e||void 0===e||null===(d=e.comments)||void 0===d?void 0:d.nums)&&void 0!==f?f:0}}));i.length<=0?(console.count("[RESTART GET TAOBAO IMG SEARCH API]: ".concat(r)),r--,gr(e,t,r)):(x.sendTabsMessage(new hr(t,e.imgUrl,n.err,i,String(n.cny),"tb")),r=5)})).catch((n=>{r>0?(console.count("[RESTART GET TAOBAO IMG SEARCH API]: ".concat(r)),r--,gr(e,t,r)):(x.sendTabsMessage(new hr(t,e.imgUrl,n,void 0)),r=5)}))}},yr={tabItemName:e=>"osee"===e?"1688.com":"\ud0c0\uc624\ubc14\uc624",getCurrentMarketTabId:()=>t.getLocalStorage("searchImgMarketName").catch((()=>"tb")),setCurrentMarketTabId:br,getImgSearch:async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];switch(e){case"osee":const i=r?n?cr.EXT_IMGSEARCH_1688_TAB_BTN_CLICK:cr.EXT_IMGSEARCH_REFRESH_1688_CLICK:cr.EXT_IMGSEARCH_1688_BTN_CLICK;sr([{name:i,params:{site_url:window.location.host}}]).catch((e=>console.error("[GA 1688 BTN CLICK ERROR]",e))),x.sendRuntimeMessage(new lr(t,void 0,void 0,"osee")),br("osee");break;case"tb_overseas":const o=r?n?cr.EXT_IMGSEARCH_TAOBAO_OVERSEAS_TAB_BTN_CLICK:cr.EXT_IMGSEARCH_TAOBAO_OVERSEAS_REFRESH_CLICK:cr.EXT_IMGSEARCH_TAOBAO_OVERSEAS_BTN_CLICK;sr([{name:o,params:{site_url:window.location.host}}]).catch((e=>console.error("[GA 1688 BTN CLICK ERROR]",e))),x.sendRuntimeMessage(new lr(t,void 0,void 0,e)),br(e);break;default:const a=r?n?cr.EXT_IMGSEARCH_TAOBAO_TAB_BTN_CLICK:cr.EXT_IMGSEARCH_TAOBAO_REFRESH_CLICK:cr.EXT_IMGSEARCH_TAOBAO_BTN_CLICK;sr([{name:a,params:{site_url:window.location.host}}]).catch((e=>console.error("[GA TAOBAO BTN CLICK ERROR]",e))),x.sendRuntimeMessage(new lr(t,void 0,void 0,"tb")),br("tb")}},getImgSearchApi:gr},_r="background:";async function wr(){if(await l.isDebug()){const e=(await chrome.tabs.query({url:"http://localhost/"})).filter((e=>!!e.id&&!!e.url)),t=(await chrome.tabs.query({url:b.percentyWebTest+"/"})).filter((e=>!!e.id&&!!e.url)),r=[];return e&&r.push(...e),t&&r.push(...t),r}return(await chrome.tabs.query({url:b.percentyWebProd+"/"})).filter((e=>!!e.id&&!!e.url))}function xr(){return chrome.runtime.getManifest().version}async function Er(e,t){return await chrome.declarativeNetRequest.updateDynamicRules({removeRuleIds:e,addRules:t})}l.initDebugMode(),chrome.action.onClicked.addListener((e=>{l.isDebug().then((e=>{}))})),chrome.runtime.onMessage.addListener((function(r,n,i){var o,a,s,c,u,d,h,p,m,v,g;switch(console.log("".concat(_r," onMessage ").concat(null===r||void 0===r?void 0:r.type)),r.type){case e.GET_PERCENTY_TOKEN:const w=r;return async function(e,r,n){if(!e||!r)return;const i=await t.getCookie(e,r);if(!i)return;await f.getToken()!==i&&(await f.setToken(i),n(new Lt(i)))}(null!==(o=w.percentyUrl)&&void 0!==o?o:"",null!==(a=w.tokenKey)&&void 0!==a?a:"",i),!0;case e.OPEN_TAB_AND_SCRAP:const E=r;chrome.tabs.create({url:r.url,active:!1},(e=>{var t;x.addPendingMessage(new Ft(E.callerTabId,null!==(t=e.id)&&void 0!==t?t:-1,E.targetProductId,E.ignoreDuplicatedScrap))}));break;case e.OPEN_PERCENTY_TAB:l.isDebug().then((e=>{let t;t=e?b.percentyWebTest:b.percentyWebProd,chrome.tabs.create({url:t,active:!0},(e=>{}))}));break;case e.GET_CURRENT_TAB_ID_FROM_CONTENTS_SCRIPT:i(new Dt(null!==(s=null===(c=n.tab)||void 0===c?void 0:c.id)&&void 0!==s?s:-1,null!==(u=null===(d=n.tab)||void 0===d?void 0:d.url)&&void 0!==u?u:""));break;case e.CLOSE_TAB:const S=r;S.tabId&&S.tabId>=0&&chrome.tabs.remove(S.tabId);break;case e.SCRAP_AUTO_FINISH:const T=r;chrome.tabs.get(T.targetTabId).then((e=>{x.sendTabsMessage(new zt(T.targetTabId,T.targetProductId,T.scrapState))}));break;case e.SCRAP_SUCCESS_TO_PERCENTY_WEB:const A=r;wr().then((e=>{for(const t of e)x.sendTabsMessage(new Ht(t.id,t.url,A.percentyProductId))}));break;case e.FETCH_RAW:const R=r;return Gt.requestRaw(R.url,R.requestInit,R.bodyData,R.responseType).then((e=>{i({success:e.success,data:e.data})})).catch((e=>i({success:!1,error:e}))),!0;case e.GET_NAVER_SHOPPING_LENS:const M=r;return Qt(M.imgUrl,M.navigator).then((e=>i(e))),!0;case e.IMG_SEARCH:const I=r,O=null!==(h=null===(p=n.tab)||void 0===p?void 0:p.id)&&void 0!==h?h:0;return x.sendTabsMessage(new ar(O,!0,I.imgUrl),(async()=>await yr.getImgSearchApi(I,O))),!0;case e.IMAGE_SEARCH_POSITION:const C=r,P=null!==(m=null===(v=n.tab)||void 0===v?void 0:v.id)&&void 0!==m?m:0;return x.sendTabsMessage(new or(P,null!==(g=C.imgUrl)&&void 0!==g?g:"",C.left,C.top)),!1;case e.GET_IMG_BLOB_URL:const N=r;return(async()=>{try{const e=await fetch(N.imgUrl,{mode:"no-cors"}),t=await e.blob(),r=new FileReader;r.onloadend=()=>i(r.result),r.onerror=e=>i(void 0),r.readAsDataURL(t)}catch(e){i(void 0)}})(),!0;case e.UPDATE_DECLARATIVE_NET_REQUEST_RULES:{var y,_;const e=r;return Er(null!==(y=e.removeRuleIds)&&void 0!==y?y:[],null!==(_=e.addRules)&&void 0!==_?_:[]).then((e=>{i({success:!0})})).catch((e=>i({success:!1,error:e}))),!0}case e.TO_BACKGROUND_SET_1688_QUERY:{const e=r;if(!e.tabId||!e.url)return;const t=e.addQuery;let n=e.url;return t.forEach((e=>{n=ne.appendQueryParam(n,e.key,e.value)})),chrome.tabs.update(e.tabId,{url:n}).catch((e=>console.error(e))),!1}case e.TO_DELETE_COOKIES:{const e=r;if(!e.url||!e.domainList)return;return chrome.tabs.create({url:e.url},(()=>{e.domainList.forEach((e=>{chrome.cookies.getAll({domain:e},(e=>{for(var t=0;t{var i,o,a;switch(console.error("".concat(_r," onMessageExternal ").concat(t.type)),t.type){case e.OPEN_SMART_STORE_LOGIN_EXTERNAL:return function(e,t,r){chrome.windows.create({url:"https://sell.smartstore.naver.com/#/login",type:"popup",width:970,height:700}).then((e=>Et.listenSmartStoreLoginSuccess(e).then((t=>({win:e,account:t}))))).then((e=>e.win.id&&e.account?chrome.windows.remove(e.win.id).then((t=>e)).catch((t=>e)):e)).then((e=>{null===r||void 0===r||r({chromeExtensionVersion:xr(),success:!!e.account,...e.account})})).catch((e=>{null===r||void 0===r||r({chromeExtensionVersion:xr(),success:!1}),console.error(e)}))}(0,0,n),!0;case e.UPLOAD_SMART_STORE_EXTERNAL:if(!t.productId)return;return Zt.canUploadSmartStore(t.productId).then((e=>{if(e)return Zt.setSmartStoreUploading(t.productId),Bt.uploadSmartStoreWithRetry(t.productId,t.mainImageUrl,t.additionalProductData,t.additionalProductDataAction);throw new G("\uc774\ubbf8 \uc5c5\ub85c\ub4dc \uc911\uc785\ub2c8\ub2e4.",le.SMART_STORE_ALREADY_UPLOADING)})).then((e=>{Zt.setSmartStoreUploadFinish(t.productId),n({chromeExtensionVersion:xr(),success:!0,storeProductId:e.storeProductRootId,storefarmProductId:e.storefarmProductId,storefarmUrlId:e.storefarmUrlId,storefarmProductDirectUrl:e.storefarmProductDirectUrl,mobileStorefarmProductDirectUrl:e.mobileStorefarmProductDirectUrl})})).catch((e=>{Zt.setSmartStoreUploadFinish(t.productId),n({chromeExtensionVersion:xr(),success:!1,error:e})})),!0;case e.EDIT_SMART_STORE_EXTERNAL:if(!t.productId)return;return Bt.editSmartStoreWithRetry(t.productId,t.mainImageUrl,t.additionalProductData,t.additionalProductDataAction).then((e=>n({chromeExtensionVersion:xr(),success:!0,storeProductId:e.storeProductRootId,storefarmProductId:e.storefarmProductId,storefarmUrlId:e.storefarmUrlId,storefarmProductDirectUrl:e.storefarmProductDirectUrl,mobileStorefarmProductDirectUrl:e.mobileStorefarmProductDirectUrl}))).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.GET_CURRENT_LOGGED_IN_SMART_STORE_CHANNEL_EXTERNAL:return Bt.getCurrentLoggedInChannel().then((e=>n({chromeExtensionVersion:xr(),success:!0,...e}))).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.GET_CHROME_EXTENSION_VERSION_EXTERNAL:return n({chromeExtensionVersion:xr()}),!0;case e.REQUEST_AI_SOURCING:{const{requestUrl:e}=t;return e?(Bt.fetchNaverShoppingResultPage(e).then((e=>{n({chromeExtensionVersion:xr(),success:!0,data:e})})).catch((e=>{n({chromeExtensionVersion:xr(),success:!1,error:e})})),!0):n({chromeExtensionVersion:xr(),success:!1,error:new G("\uc694\uccad \uc8fc\uc18c\uac00 \ub204\ub77d\ub410\uc2b5\ub2c8\ub2e4",le.AI_SOURCING_MISSING_PARAMS)})}case e.REQUEST_NAVER_SHOPPING_POPULAR_TERMS:{const{requestBody:e}=t;return e?(Bt.fetchNaverShoppingPopularTermsByCategory(e).then((e=>{n({chromeExtensionVersion:xr(),success:!0,data:e})})).catch((e=>{n({chromeExtensionVersion:xr(),success:!1,error:e})})),!0):n({chromeExtensionVersion:xr(),success:!1,error:new G("\uc694\uccad \ubc14\ub514\uac00 \ub204\ub77d\ub410\uc2b5\ub2c8\ub2e4",le.AI_NAVER_SHOPPING_POPULAR_TERMS_MISSING_BODY)})}case e.GET_SMART_STORE_PRODUCT_EXTERNAL:if(!t.productId)return;return Bt.fetchSmartStoreProduct(t.productId).then((e=>{n({chromeExtensionVersion:xr(),success:!0,smartStoreProduct:e})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.DELETE_SMART_STORE_PRODUCT_EXTERNAL:if(!t.productId)return;return Bt.deleteSmartStore(t.productId).then((e=>{n({chromeExtensionVersion:xr(),success:e})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.UPDATE_SMART_STORE_PRODUCT_STATE_EXTERNAL:if(!t.productId||!t.state)return;return Bt.updateProductState(t.productId,t.state).then((e=>{n({chromeExtensionVersion:xr(),success:e})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.SCRAP_START_EXTERNAL:const r=t;return null!==r&&void 0!==r&&null!==(i=r.scrapTarget)&&void 0!==i&&i.url?(chrome.tabs.create({url:r.scrapTarget.url,active:!1},(e=>{const t=e.id;t&&x.sendTabMessageAsyncUntilConnect(new Vt(t,r.scrapTarget,r.allowDuplicateScrap),30).then((e=>{var i;"CONNECTION_ERROR"===e?(n(new Xt(xr(),!1,void 0,new G("URL \ub85c\ub529 \uc2e4\ud328",le.SCRAP_AUTO_BY_URL_FAIL))),chrome.tabs.remove(t)):(n(new Xt(xr(),!(null===e||void 0===e||!e.success),null===e||void 0===e?void 0:e.successData,null===e||void 0===e?void 0:e.error)),r.keepCaptchaTabOpen&&(null===e||void 0===e||null===(i=e.error)||void 0===i?void 0:i.code)===le.SCRAP_AUTO_BY_URL_FAIL_CAPTCHA?chrome.tabs.update(t,{active:!0}):chrome.tabs.remove(t))}))})),!0):void n({chromeExtensionVersion:xr(),success:!1,error:"scrapTarget is not exist"});case e.FETCH_RAW_EXTERNAL:if(!t.url)return;return Gt.requestRaw(t.url,t.requestInit,t.bodyData,t.responseType).then((e=>{n({chromeExtensionVersion:xr(),success:e.success,data:e.data})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.UPDATE_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL:return Er(null!==(o=t.removeRuleIds)&&void 0!==o?o:[],null!==(a=t.addRules)&&void 0!==a?a:[]).then((e=>{n({chromeExtensionVersion:xr(),success:!0})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.GET_DECLARATIVE_NET_REQUEST_RULES_EXTERNAL:return async function(){return await chrome.declarativeNetRequest.getDynamicRules()}().then((e=>{n({chromeExtensionVersion:xr(),success:!0,data:e})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.HEALTH_CHECK:return y.delay(100).then((e=>{n({chromeExtensionVersion:xr(),success:!0})})).catch((e=>n({chromeExtensionVersion:xr(),success:!1,error:e}))),!0;case e.REQUEST_TAOBAO_IMG_SEARCH_EXTERNAL:return ir(t.imgUrl).then((e=>{n({chromeExtensionVersion:xr(),success:!1,data:e})})).catch((e=>{n({chromeExtensionVersion:xr(),success:!1,error:e})})),!0}})),chrome.runtime.onInstalled.addListener((e=>{switch(e.reason){case chrome.runtime.OnInstalledReason.INSTALL:(async function(){const e=await wr();if(0===e.length)return!1;const t=[];for(const r of e)t.push(chrome.tabs.reload(r.id));return await Promise.all(t),!0})().then((e=>y.delay(1e4))).then((e=>wr())).then((e=>{for(const t of e)x.sendTabsMessage(new qt(t.id))}));case chrome.runtime.OnInstalledReason.UPDATE:case chrome.runtime.OnInstalledReason.CHROME_UPDATE:case chrome.runtime.OnInstalledReason.SHARED_MODULE_UPDATE:}chrome.contextMenus.create({title:"\ud37c\uc13c\ud2f0 \uc774\ubbf8\uc9c0 \uac80\uc0c9",id:"percenty_imgsearch_contextmenu",contexts:["image"]})})),Er(Yt.map((e=>e.id)),Yt),async function(){try{var e,t;const r=await fr.getRemoteConfig();if(!r.decNetReq||!r.decNetReq.removeRuleIds&&!r.decNetReq.addRules)return;await Er(null!==(e=r.decNetReq.removeRuleIds)&&void 0!==e?e:[],null!==(t=r.decNetReq.addRules)&&void 0!==t?t:[])}catch(n){console.error(n)}}(),chrome.contextMenus.onClicked.addListener((async(e,t)=>{var r;const n=e.srcUrl,i=null===t||void 0===t?void 0:t.id,o=new URL(null!==(r=null===t||void 0===t?void 0:t.url)&&void 0!==r?r:"").host;if("percenty_imgsearch_contextmenu"===e.menuItemId&&n&&i){const e=await yr.getCurrentMarketTabId();x.sendTabsMessage(new ar(i,!0,n),(async()=>{const t={imgUrl:n,market:null!==e&&void 0!==e?e:"tb"};yr.getImgSearchApi(t,i)}));let t=cr.EXT_IMGSEARCH_CONTEXT_MENU_TAOBAO_BTN_CLICK;switch(e){case"osee":t=cr.EXT_IMGSEARCH_CONTEXT_MENU_1688_BTN_CLICK;break;case"tb_overseas":t=cr.EXT_IMGSEARCH_CONTEXT_MENU_TAOBAO_OVERSEAS_BTN_CLICK;break;default:t=cr.EXT_IMGSEARCH_CONTEXT_MENU_TAOBAO_BTN_CLICK}return sr([{name:t,params:{site_url:o}}]).catch((e=>console.error("[GA TAOBAO CONTEXT MENU CLICK ERROR]",e))),!0}}))})()})(); //# sourceMappingURL=background.js.map