(()=>{var t={7757:(t,e,n)=>{t.exports=n(5666)},9742:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,o=u(t),a=o[0],s=o[1],l=new r(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),c=0,h=s>0?a-4:a;for(n=0;n>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,l[c++]=255&e);1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,o=[],a=16383,s=0,u=i-r;su?u:s+a));1===r?(e=t[i-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},8764:(t,e,n)=>{"use strict"; /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */const i=n(9742),r=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|g(t,e);let i=s(n);const r=i.write(t,e);r!==n&&(i=i.slice(0,r));return i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return u.from(i,e,n);const r=function(t){if(u.isBuffer(t)){const e=0|d(t.length),n=s(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||K(t.length)?s(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}(t);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),s(t<0?0:0|d(t))}function f(t){const e=t.length<0?0:0|d(t.length),n=s(e);for(let i=0;i=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(t).length;default:if(r)return i?-1:q(t).length;e=(""+e).toLowerCase(),r=!0}}function v(t,e,n){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return D(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function m(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function y(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:w(t,e,n,i,r);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,i,r){let o,a=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){let i=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let i=0;ir&&(i=r):i=r;const o=e.length;let a;for(i>o/2&&(i=o/2),a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function I(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);const i=[];let r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+a<=n){let n,i,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[r+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[r+1],i=t[r+2],128==(192&n)&&128==(192&i)&&(u=(15&e)<<12|(63&n)<<6|63&i,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[r+1],i=t[r+2],s=t[r+3],128==(192&n)&&128==(192&i)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&i)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),r+=a}return function(t){const e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);let n="",i=0;for(;ii.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(i,r)):Uint8Array.prototype.set.call(i,e,r);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,r)}r+=e.length}return i},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,i,r){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0);const s=Math.min(o,a),l=this.slice(i,r),c=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return k(this,t,e,n);case"base64":return P(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function C(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;ri)&&(n=i);let r="";for(let i=e;in)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,n,i,r,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function _(t,e,n,i,r){H(e,i,r,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function M(t,e,n,i,r){H(e,i,r,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function N(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function U(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t+--e],r=1;for(;e>0&&(r*=256);)i+=this[t+--e]*r;return i},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,r=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],r=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,o=0;for(;++o=r&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=e,r=1,o=this[t+--i];for(;i>0&&(r*=256);)o+=this[t+--i]*r;return r*=128,o>=r&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||L(t,4,this.length),r.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e>>>=0,n>>>=0,!i){A(this,t,e,n,Math.pow(2,8*n)-1,0)}let r=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,!i){A(this,t,e,n,Math.pow(2,8*n)-1,0)}let r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Q((function(t,e=0){return _(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);A(this,t,e,n,i-1,-i)}let r=0,o=1,a=0;for(this[e]=255&t;++r>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);A(this,t,e,n,i-1,-i)}let r=n-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Q((function(t,e=0){return _(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,i){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(r=e;r=i+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function H(t,e,n,i,r,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new F.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||z(e,t.length-(n+1))}(i,r,o)}function V(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,n){if(Math.floor(t)!==t)throw V(t,n),new F.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(t,e,n){let i=`The value of "${t}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=W(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=W(r)),r+="n"),i+=` It must be ${e}. Received ${r}`,i}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function q(t,e){let n;e=e||1/0;const i=t.length;let r=null;const o=[];for(let a=0;a55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function $(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,i){let r;for(r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)e[i+r]=t[n]+t[r]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}},7187:t=>{"use strict";var e,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,n)}(t,r,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function l(t,e,n,i){var r,o,a,l;if(s(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=u(t))>0&&a.length>r&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=a.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function f(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,e);else{var l=u.length,c=d(u,l);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},645:(t,e)=>{ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ e.read=function(t,e,n,i,r){var o,a,s=8*r-i-1,u=(1<>1,c=-7,h=n?r-1:0,f=n?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,i),o-=l}return(p?-1:1)*a*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var a,s,u,l=8*o-r-1,c=(1<>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,d=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[n+p]=255&s,p+=d,s/=256,r-=8);for(a=a<0;t[n+p]=255&a,p+=d,a/=256,l-=8);t[n+p-d]|=128*g}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},5666:t=>{var e=function(t){"use strict";var e,n=Object.prototype,i=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof v?e:v,o=Object.create(r.prototype),a=new C(i||[]);return o._invoke=function(t,e,n){var i=h;return function(r,o){if(i===p)throw new Error("Generator is already running");if(i===d){if("throw"===r)throw o;return O()}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var u=c(t,e,n);if("normal"===u.type){if(i=n.done?d:f,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=d,n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h="suspendedStart",f="suspendedYield",p="executing",d="completed",g={};function v(){}function m(){}function y(){}var w={};u(w,o,(function(){return this}));var b=Object.getPrototypeOf,E=b&&b(b(D([])));E&&E!==n&&i.call(E,o)&&(w=E);var k=y.prototype=v.prototype=Object.create(w);function P(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(r,o,a,s){var u=c(t[r],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&i.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;this._invoke=function(t,i){function o(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(o,o):o()}}function I(t,n){var i=t.iterator[n.method];if(i===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,I(t,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var r=c(i,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;var o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function D(t){if(t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:D(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},9509:(t,e,n)=>{var i=n(8764),r=i.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return r(t,e,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=a),o(r,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return r(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=r(t);return void 0!==e?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},6099:(t,e,n)=>{!function(t){t.parser=function(t,e){return new r(t,e)},t.SAXParser=r,t.SAXStream=a,t.createStream=function(t,e){return new a(t,e)},t.MAX_BUFFER_LENGTH=65536;var e,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function r(e,n){if(!(this instanceof r))return new r(e,n);var o=this;!function(t){for(var e=0,n=i.length;e"===o?(I(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=k.TEXT):g(o)?(n.state=k.SGML_DECL_QUOTED,n.sgmlDecl+=o):n.sgmlDecl+=o;continue;case k.SGML_DECL_QUOTED:o===n.q&&(n.state=k.SGML_DECL,n.q=""),n.sgmlDecl+=o;continue;case k.DOCTYPE:">"===o?(n.state=k.TEXT,I(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=o,"["===o?n.state=k.DOCTYPE_DTD:g(o)&&(n.state=k.DOCTYPE_QUOTED,n.q=o));continue;case k.DOCTYPE_QUOTED:n.doctype+=o,o===n.q&&(n.q="",n.state=k.DOCTYPE);continue;case k.DOCTYPE_DTD:n.doctype+=o,"]"===o?n.state=k.DOCTYPE:g(o)&&(n.state=k.DOCTYPE_DTD_QUOTED,n.q=o);continue;case k.DOCTYPE_DTD_QUOTED:n.doctype+=o,o===n.q&&(n.state=k.DOCTYPE_DTD,n.q="");continue;case k.COMMENT:"-"===o?n.state=k.COMMENT_ENDING:n.comment+=o;continue;case k.COMMENT_ENDING:"-"===o?(n.state=k.COMMENT_ENDED,n.comment=x(n.opt,n.comment),n.comment&&I(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+o,n.state=k.COMMENT);continue;case k.COMMENT_ENDED:">"!==o?(O(n,"Malformed comment"),n.comment+="--"+o,n.state=k.COMMENT):n.state=k.TEXT;continue;case k.CDATA:"]"===o?n.state=k.CDATA_ENDING:n.cdata+=o;continue;case k.CDATA_ENDING:"]"===o?n.state=k.CDATA_ENDING_2:(n.cdata+="]"+o,n.state=k.CDATA);continue;case k.CDATA_ENDING_2:">"===o?(n.cdata&&I(n,"oncdata",n.cdata),I(n,"onclosecdata"),n.cdata="",n.state=k.TEXT):"]"===o?n.cdata+="]":(n.cdata+="]]"+o,n.state=k.CDATA);continue;case k.PROC_INST:"?"===o?n.state=k.PROC_INST_ENDING:d(o)?n.state=k.PROC_INST_BODY:n.procInstName+=o;continue;case k.PROC_INST_BODY:if(!n.procInstBody&&d(o))continue;"?"===o?n.state=k.PROC_INST_ENDING:n.procInstBody+=o;continue;case k.PROC_INST_ENDING:">"===o?(I(n,"onprocessinginstruction",{name:n.procInstName,body:n.procInstBody}),n.procInstName=n.procInstBody="",n.state=k.TEXT):(n.procInstBody+="?"+o,n.state=k.PROC_INST_BODY);continue;case k.OPEN_TAG:m(h,o)?n.tagName+=o:(R(n),">"===o?_(n):"/"===o?n.state=k.OPEN_TAG_SLASH:(d(o)||O(n,"Invalid character in tag name"),n.state=k.ATTRIB));continue;case k.OPEN_TAG_SLASH:">"===o?(_(n,!0),M(n)):(O(n,"Forward-slash in opening tag not followed by >"),n.state=k.ATTRIB);continue;case k.ATTRIB:if(d(o))continue;">"===o?_(n):"/"===o?n.state=k.OPEN_TAG_SLASH:m(c,o)?(n.attribName=o,n.attribValue="",n.state=k.ATTRIB_NAME):O(n,"Invalid attribute name");continue;case k.ATTRIB_NAME:"="===o?n.state=k.ATTRIB_VALUE:">"===o?(O(n,"Attribute without value"),n.attribValue=n.attribName,A(n),_(n)):d(o)?n.state=k.ATTRIB_NAME_SAW_WHITE:m(h,o)?n.attribName+=o:O(n,"Invalid attribute name");continue;case k.ATTRIB_NAME_SAW_WHITE:if("="===o)n.state=k.ATTRIB_VALUE;else{if(d(o))continue;O(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",I(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===o?_(n):m(c,o)?(n.attribName=o,n.state=k.ATTRIB_NAME):(O(n,"Invalid attribute name"),n.state=k.ATTRIB)}continue;case k.ATTRIB_VALUE:if(d(o))continue;g(o)?(n.q=o,n.state=k.ATTRIB_VALUE_QUOTED):(O(n,"Unquoted attribute value"),n.state=k.ATTRIB_VALUE_UNQUOTED,n.attribValue=o);continue;case k.ATTRIB_VALUE_QUOTED:if(o!==n.q){"&"===o?n.state=k.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=o;continue}A(n),n.q="",n.state=k.ATTRIB_VALUE_CLOSED;continue;case k.ATTRIB_VALUE_CLOSED:d(o)?n.state=k.ATTRIB:">"===o?_(n):"/"===o?n.state=k.OPEN_TAG_SLASH:m(c,o)?(O(n,"No whitespace between attributes"),n.attribName=o,n.attribValue="",n.state=k.ATTRIB_NAME):O(n,"Invalid attribute name");continue;case k.ATTRIB_VALUE_UNQUOTED:if(!v(o)){"&"===o?n.state=k.ATTRIB_VALUE_ENTITY_U:n.attribValue+=o;continue}A(n),">"===o?_(n):n.state=k.ATTRIB;continue;case k.CLOSE_TAG:if(n.tagName)">"===o?M(n):m(h,o)?n.tagName+=o:n.script?(n.script+=""===o?M(n):O(n,"Invalid characters in closing tag");continue;case k.TEXT_ENTITY:case k.ATTRIB_VALUE_ENTITY_Q:case k.ATTRIB_VALUE_ENTITY_U:var u,l;switch(n.state){case k.TEXT_ENTITY:u=k.TEXT,l="textNode";break;case k.ATTRIB_VALUE_ENTITY_Q:u=k.ATTRIB_VALUE_QUOTED,l="attribValue";break;case k.ATTRIB_VALUE_ENTITY_U:u=k.ATTRIB_VALUE_UNQUOTED,l="attribValue"}";"===o?(n[l]+=N(n),n.entity="",n.state=u):m(n.entity.length?p:f,o)?n.entity+=o:(O(n,"Invalid character in entity name"),n[l]+="&"+n.entity+o,n.entity="",n.state=u);continue;default:throw new Error(n,"Unknown state: "+n.state)}n.position>=n.bufferCheckPosition&&function(e){for(var n=Math.max(t.MAX_BUFFER_LENGTH,10),r=0,o=0,a=i.length;on)switch(i[o]){case"textNode":T(e);break;case"cdata":I(e,"oncdata",e.cdata),e.cdata="";break;case"script":I(e,"onscript",e.script),e.script="";break;default:C(e,"Max buffer length exceeded: "+i[o])}r=Math.max(r,s)}var u=t.MAX_BUFFER_LENGTH-r;e.bufferCheckPosition=u+e.position}(n);return n} /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;T(t=this),""!==t.cdata&&(I(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(I(t,"onscript",t.script),t.script="")}};try{e=n(2830).Stream}catch(t){e=function(){}}var o=t.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function a(t,n){if(!(this instanceof a))return new a(t,n);e.apply(this),this._parser=new r(t,n),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(t){i.emit("error",t),i._parser.error=null},this._decoder=null,o.forEach((function(t){Object.defineProperty(i,"on"+t,{get:function(){return i._parser["on"+t]},set:function(e){if(!e)return i.removeAllListeners(t),i._parser["on"+t]=e,e;i.on(t,e)},enumerable:!0,configurable:!1})}))}a.prototype=Object.create(e.prototype,{constructor:{value:a}}),a.prototype.write=function(t){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)){if(!this._decoder){var e=n(2553).s;this._decoder=new e("utf8")}t=this._decoder.write(t)}return this._parser.write(t.toString()),this.emit("data",t),!0},a.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},a.prototype.on=function(t,n){var i=this;return i._parser["on"+t]||-1===o.indexOf(t)||(i._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),i.emit.apply(i,e)}),e.prototype.on.call(i,t,n)};var s="http://www.w3.org/XML/1998/namespace",u="http://www.w3.org/2000/xmlns/",l={xml:s,xmlns:u},c=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function d(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function g(t){return'"'===t||"'"===t}function v(t){return">"===t||d(t)}function m(t,e){return t.test(e)}function y(t,e){return!m(t,e)}var w,b,E,k=0;for(var P in t.STATE={BEGIN:k++,BEGIN_WHITESPACE:k++,TEXT:k++,TEXT_ENTITY:k++,OPEN_WAKA:k++,SGML_DECL:k++,SGML_DECL_QUOTED:k++,DOCTYPE:k++,DOCTYPE_QUOTED:k++,DOCTYPE_DTD:k++,DOCTYPE_DTD_QUOTED:k++,COMMENT_STARTING:k++,COMMENT:k++,COMMENT_ENDING:k++,COMMENT_ENDED:k++,CDATA:k++,CDATA_ENDING:k++,CDATA_ENDING_2:k++,PROC_INST:k++,PROC_INST_BODY:k++,PROC_INST_ENDING:k++,OPEN_TAG:k++,OPEN_TAG_SLASH:k++,ATTRIB:k++,ATTRIB_NAME:k++,ATTRIB_NAME_SAW_WHITE:k++,ATTRIB_VALUE:k++,ATTRIB_VALUE_QUOTED:k++,ATTRIB_VALUE_CLOSED:k++,ATTRIB_VALUE_UNQUOTED:k++,ATTRIB_VALUE_ENTITY_Q:k++,ATTRIB_VALUE_ENTITY_U:k++,CLOSE_TAG:k++,CLOSE_TAG_SAW_WHITE:k++,SCRIPT:k++,SCRIPT_ENDING:k++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach((function(e){var n=t.ENTITIES[e],i="number"==typeof n?String.fromCharCode(n):n;t.ENTITIES[e]=i})),t.STATE)t.STATE[t.STATE[P]]=P;function S(t,e,n){t[e]&&t[e](n)}function I(t,e,n){t.textNode&&T(t),S(t,e,n)}function T(t){t.textNode=x(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function x(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function C(t,e){return T(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function D(t){return t.sawRoot&&!t.closedRoot&&O(t,"Unclosed root tag"),t.state!==k.BEGIN&&t.state!==k.BEGIN_WHITESPACE&&t.state!==k.TEXT&&C(t,"Unexpected end"),T(t),t.c="",t.closed=!0,S(t,"onend"),r.call(t,t.strict,t.opt),t}function O(t,e){if("object"!=typeof t||!(t instanceof r))throw new Error("bad call to strictFail");t.strict&&C(t,e)}function R(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,n=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(n.ns=e.ns),t.attribList.length=0,I(t,"onopentagstart",n)}function L(t,e){var n=t.indexOf(":")<0?["",t]:t.split(":"),i=n[0],r=n[1];return e&&"xmlns"===t&&(i="xmlns",r=""),{prefix:i,local:r}}function A(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=L(t.attribName,!0),n=e.prefix,i=e.local;if("xmlns"===n)if("xml"===i&&t.attribValue!==s)O(t,"xml: prefix must be bound to "+s+"\nActual: "+t.attribValue);else if("xmlns"===i&&t.attribValue!==u)O(t,"xmlns: prefix must be bound to "+u+"\nActual: "+t.attribValue);else{var r=t.tag,o=t.tags[t.tags.length-1]||t;r.ns===o.ns&&(r.ns=Object.create(o.ns)),r.ns[i]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,I(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function _(t,e){if(t.opt.xmlns){var n=t.tag,i=L(t.tagName);n.prefix=i.prefix,n.local=i.local,n.uri=n.ns[i.prefix]||"",n.prefix&&!n.uri&&(O(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),n.uri=i.prefix);var r=t.tags[t.tags.length-1]||t;n.ns&&r.ns!==n.ns&&Object.keys(n.ns).forEach((function(e){I(t,"onopennamespace",{prefix:e,uri:n.ns[e]})}));for(var o=0,a=t.attribList.length;o",t.tagName="",void(t.state=k.SCRIPT);I(t,"onscript",t.script),t.script=""}var e=t.tags.length,n=t.tagName;t.strict||(n=n[t.looseCase]());for(var i=n;e--;){if(t.tags[e].name===i)break;O(t,"Unexpected close tag")}if(e<0)return O(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=k.TEXT);t.tagName=n;for(var r=t.tags.length;r-- >e;){var o=t.tag=t.tags.pop();t.tagName=t.tag.name,I(t,"onclosetag",t.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(e){var n=o.ns[e];I(t,"onclosenamespace",{prefix:e,uri:n})}))}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=k.TEXT}function N(t){var e,n=t.entity,i=n.toLowerCase(),r="";return t.ENTITIES[n]?t.ENTITIES[n]:t.ENTITIES[i]?t.ENTITIES[i]:("#"===(n=i).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),r=(e=parseInt(n,16)).toString(16)):(n=n.slice(1),r=(e=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(e)||r.toLowerCase()!==n?(O(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function B(t,e){"<"===e?(t.state=k.OPEN_WAKA,t.startTagPosition=t.position):d(e)||(O(t,"Non-whitespace before first tag."),t.textNode=e,t.state=k.TEXT)}function U(t,e){var n="";return e1114111||b(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?i.push(s):(t=55296+((s-=65536)>>10),e=s%1024+56320,i.push(t,e)),(r+1===o||i.length>n)&&(a+=w.apply(null,i),i.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:E,configurable:!0,writable:!0}):String.fromCodePoint=E)}(e)},4889:function(t,e,n){!function(t,e){"use strict";if(!t.setImmediate){var n,i,r,o,a,s=1,u={},l=!1,c=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?n=function(t){process.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){r.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,n=function(t){var e=c.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(o="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(o+e,"*")}),h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i{t.exports=r;var i=n(7187).EventEmitter;function r(){i.call(this)}n(5717)(r,i),r.Readable=n(6577),r.Writable=n(323),r.Duplex=n(8656),r.Transform=n(4473),r.PassThrough=n(2366),r.finished=n(1086),r.pipeline=n(6472),r.Stream=r,r.prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){n.removeListener("data",r),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",l),t.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),t.removeListener("close",c)}return n.on("error",l),t.on("error",l),n.on("end",c),n.on("close",c),t.on("close",c),t.emit("pipe",n),t}},8106:t=>{"use strict";var e={};function n(t,n,i){i||(i=Error);var r=function(t){var e,i;function r(e,i,r){return t.call(this,function(t,e,i){return"string"==typeof n?n:n(t,e,i)}(e,i,r))||this}return i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,r}(i);r.prototype.name=i.name,r.prototype.code=t,e[t]=r}function i(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,o,a,s;if("string"==typeof e&&(o="not ",e.substr(!a||a<0?0:+a,o.length)===o)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(r," ").concat(i(e,"type"));else{var u=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(r," ").concat(i(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},8656:(t,e,n)=>{"use strict";var i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=l;var r=n(6577),o=n(323);n(5717)(l,r);for(var a=i(o.prototype),s=0;s{"use strict";t.exports=r;var i=n(4473);function r(t){if(!(this instanceof r))return new r(t);i.call(this,t)}n(5717)(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},6577:(t,e,n)=>{"use strict";var i;t.exports=S,S.ReadableState=P;n(7187).EventEmitter;var r=function(t,e){return t.listeners(e).length},o=n(3194),a=n(8764).Buffer,s=n.g.Uint8Array||function(){};var u,l=n(964);u=l&&l.debuglog?l.debuglog("stream"):function(){};var c,h,f,p=n(9686),d=n(1029),g=n(94).getHighWaterMark,v=n(8106).q,m=v.ERR_INVALID_ARG_TYPE,y=v.ERR_STREAM_PUSH_AFTER_EOF,w=v.ERR_METHOD_NOT_IMPLEMENTED,b=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(5717)(S,o);var E=d.errorOrDestroy,k=["error","close","destroy","pause","resume"];function P(t,e,r){i=i||n(8656),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",r),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=n(2553).s),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function S(t){if(i=i||n(8656),!(this instanceof S))return new S(t);var e=this instanceof i;this._readableState=new P(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function I(t,e,n,i,r){u("readableAddChunk",e);var o,l=t._readableState;if(null===e)l.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?D(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,O(t)))}(t,l);else if(r||(o=function(t,e){var n;i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],e));var i;return n}(l,e)),o)E(t,o);else if(l.objectMode||e&&e.length>0)if("string"==typeof e||l.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)l.endEmitted?E(t,new b):T(t,l,e,!0);else if(l.ended)E(t,new y);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(e=l.decoder.write(e),l.objectMode||0!==e.length?T(t,l,e,!1):R(t,l)):T(t,l,e,!1)}else i||(l.reading=!1,R(t,l));return!l.ended&&(l.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=x?t=x:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function D(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(O,t))}function O(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function R(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function _(t){u("readable nexttick read 0"),t.read(0)}function M(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function B(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,i=t.length;n=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):D(this),null;if(0===(t=C(t,e))&&e.ended)return 0===e.length&&U(this),null;var i,r=e.needReadable;return u("need readable",r),(0===e.length||e.length-t0?B(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&U(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(t){E(this,new w("_read()"))},S.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==process.stdout&&t!==process.stderr?s:g;function a(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",d),t.removeListener("drain",l),t.removeListener("error",f),t.removeListener("unpipe",a),n.removeListener("end",s),n.removeListener("end",g),n.removeListener("data",h),c=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function s(){u("onend"),t.end()}i.endEmitted?process.nextTick(o):n.once("end",o),t.on("unpipe",a);var l=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&r(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",l);var c=!1;function h(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==j(i.pipes,t))&&!c&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function f(e){u("onerror",e),g(),t.removeListener("error",f),0===r(t,"error")&&E(t,e)}function p(){t.removeListener("finish",d),g()}function d(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),n.unpipe(t)}return n.on("data",h),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",f),t.once("close",p),t.once("finish",d),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var i=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?D(this):i.reading||process.nextTick(_,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=o.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(A,this),n},S.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(A,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(M,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,i=!1;for(var r in t.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(r){(u("wrapped data"),n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(e.push(r)||(i=!0,t.pause()))})),t)void 0===this[r]&&"function"==typeof t[r]&&(this[r]=function(e){return function(){return t[e].apply(t,arguments)}}(r));for(var o=0;o{"use strict";t.exports=c;var i=n(8106).q,r=i.ERR_METHOD_NOT_IMPLEMENTED,o=i.ERR_MULTIPLE_CALLBACK,a=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=n(8656);function l(t,e){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),i(t);var r=this._readableState;r.reading=!1,(r.needReadable||r.length{"use strict";function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}var r;t.exports=S,S.WritableState=P;var o={deprecate:n(4927)},a=n(3194),s=n(8764).Buffer,u=n.g.Uint8Array||function(){};var l,c=n(1029),h=n(94).getHighWaterMark,f=n(8106).q,p=f.ERR_INVALID_ARG_TYPE,d=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,v=f.ERR_STREAM_CANNOT_PIPE,m=f.ERR_STREAM_DESTROYED,y=f.ERR_STREAM_NULL_VALUES,w=f.ERR_STREAM_WRITE_AFTER_END,b=f.ERR_UNKNOWN_ENCODING,E=c.errorOrDestroy;function k(){}function P(t,e,o){r=r||n(8656),t=t||{},"boolean"!=typeof o&&(o=e instanceof r),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if("function"!=typeof r)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(process.nextTick(r,i),process.nextTick(O,t,e),t._writableState.errorEmitted=!0,E(t,i)):(r(i),t._writableState.errorEmitted=!0,E(t,i),O(t,e))}(t,n,i,e,r);else{var o=C(n)||t.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||x(t,n),i?process.nextTick(T,t,n,o,r):T(t,n,o,r)}}(e,t)},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 i(this)}function S(t){var e=this instanceof(r=r||n(8656));if(!e&&!l.call(S,this))return new S(t);this._writableState=new P(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function I(t,e,n,i,r,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):n?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}function T(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),O(t,e)}function x(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)o[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;o.allBuffers=u,I(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,h=n.callback;if(I(t,e,!1,e.objectMode?1:l.length,l,c,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function D(t,e){t._final((function(n){e.pendingcb--,n&&E(t,n),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var n=C(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(D,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(5717)(S,a),P.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(P.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===S&&(t&&t._writableState instanceof P)}})):l=function(t){return t instanceof this},S.prototype.pipe=function(){E(this,new v)},S.prototype.write=function(t,e,n){var i,r=this._writableState,o=!1,a=!r.objectMode&&(i=t,s.isBuffer(i)||i instanceof u);return a&&!s.isBuffer(t)&&(t=function(t){return s.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=k),r.ending?function(t,e){var n=new w;E(t,n),process.nextTick(e,n)}(this,n):(a||function(t,e,n,i){var r;return null===n?r=new y:"string"==typeof n||e.objectMode||(r=new p("chunk",["string","Buffer"],n)),!r||(E(t,r),process.nextTick(i,r),!1)}(this,r,t,n))&&(r.pendingcb++,o=function(t,e,n,i,r,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=s.from(e,n));return e}(e,i,r);i!==a&&(n=!0,r="buffer",i=a)}var u=e.objectMode?1:i.length;e.length+=u;var l=e.length-1))throw new b(t);return this._writableState.defaultEncoding=t,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(t,e,n){n(new d("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,O(t,e),n&&(e.finished?process.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),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(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=c.destroy,S.prototype._undestroy=c.undestroy,S.prototype._destroy=function(t,e){e(t)}},828:(t,e,n)=>{"use strict";var i;function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(1086),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function d(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[c]=null,t[a]=null,t[s]=null,e(p(n,!1)))}}function g(t){process.nextTick(d,t)}var v=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((r(i={get stream(){return this[f]},next:function(){var t=this,e=this[u];if(null!==e)return Promise.reject(e);if(this[l])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){process.nextTick((function(){t[u]?n(t[u]):e(p(void 0,!0))}))}));var n,i=this[c];if(i)n=new Promise(function(t,e){return function(n,i){t.then((function(){e[l]?n(p(void 0,!0)):e[h](n,i)}),i)}}(i,this));else{var r=this[f].read();if(null!==r)return Promise.resolve(p(r,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,(function(){return this})),r(i,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),i),v);t.exports=function(t){var e,n=Object.create(m,(r(e={},f,{value:t,writable:!0}),r(e,a,{value:null,writable:!0}),r(e,s,{value:null,writable:!0}),r(e,u,{value:null,writable:!0}),r(e,l,{value:t._readableState.endEmitted,writable:!0}),r(e,h,{value:function(t,e){var i=n[f].read();i?(n[c]=null,n[a]=null,n[s]=null,t(p(i,!1))):(n[a]=t,n[s]=e)},writable:!0}),e));return n[c]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[s];return null!==e&&(n[c]=null,n[a]=null,n[s]=null,e(t)),void(n[u]=t)}var i=n[a];null!==i&&(n[c]=null,n[a]=null,n[s]=null,i(p(void 0,!0))),n[l]=!0})),t.on("readable",g.bind(null,n)),n}},9686:(t,e,n)=>{"use strict";function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,n,i,r=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=r,i=s,a.prototype.copy.call(e,n,i),s+=o.data.length,o=o.next;return r}},{key:"consume",value:function(t,e){var n;return tr.length?r.length:t;if(o===r.length?i+=r:i+=r.slice(0,t),0==(t-=o)){o===r.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=r.slice(o));break}++n}return this.length-=n,i}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),n=this.head,i=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var r=n.data,o=t>r.length?r.length:t;if(r.copy(e,e.length-t,0,o),0==(t-=o)){o===r.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=r.slice(o));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e{"use strict";function e(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,r){var o=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(i,this,t)):process.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!r&&t?o._writableState?o._writableState.errorEmitted?process.nextTick(n,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,t)):process.nextTick(e,o,t):r?(process.nextTick(n,o),r(t)):process.nextTick(n,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,i=t._writableState;n&&n.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}}},1086:(t,e,n)=>{"use strict";var i=n(8106).q.ERR_STREAM_PREMATURE_CLOSE;function r(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,i=new Array(n),r=0;r{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},6472:(t,e,n)=>{"use strict";var i;var r=n(8106).q,o=r.ERR_MISSING_ARGS,a=r.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,r,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===i&&(i=n(1086)),i(t,{readable:e,writable:r},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function l(t){t()}function c(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){i||(i=t),t&&a.forEach(l),o||(a.forEach(l),r(i))}))}));return e.reduce(c)}},94:(t,e,n)=>{"use strict";var i=n(8106).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,r){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,r,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new i(r?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},3194:(t,e,n)=>{t.exports=n(7187).EventEmitter},2553:(t,e,n)=>{"use strict";var i=n(9509).Buffer,r=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===r||!r(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},5475:function(t,e,n){var i=void 0!==n.g&&n.g||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(4889),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==n.g&&n.g.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==n.g&&n.g.clearImmediate||this&&this.clearImmediate},4927:(t,e,n)=>{function i(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(i("noDeprecation"))return t;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(e);i("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},306:function(t,e){(function(){"use strict";e.stripBOM=function(t){return"\ufeff"===t[0]?t.substring(1):t}}).call(this)},4096:function(t,e,n){(function(){"use strict";var t,i,r,o,a,s={}.hasOwnProperty;t=n(5532),i=n(8381).defaults,o=function(t){return"string"==typeof t&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},a=function(t){return""},r=function(t){return t.replace("]]>","]]]]>")},e.Builder=function(){function e(t){var e,n,r;for(e in this.options={},n=i[.2])s.call(n,e)&&(r=n[e],this.options[e]=r);for(e in t)s.call(t,e)&&(r=t[e],this.options[e]=r)}return e.prototype.buildObject=function(e){var n,r,u,l,c,h;return n=this.options.attrkey,r=this.options.charkey,1===Object.keys(e).length&&this.options.rootName===i[.2].rootName?e=e[c=Object.keys(e)[0]]:c=this.options.rootName,h=this,u=function(t,e){var i,l,c,f,p,d;if("object"!=typeof e)h.options.cdata&&o(e)?t.raw(a(e)):t.txt(e);else if(Array.isArray(e)){for(f in e)if(s.call(e,f))for(p in l=e[f])c=l[p],t=u(t.ele(p),c).up()}else for(p in e)if(s.call(e,p))if(l=e[p],p===n){if("object"==typeof l)for(i in l)d=l[i],t=t.att(i,d)}else if(p===r)t=h.options.cdata&&o(l)?t.raw(a(l)):t.txt(l);else if(Array.isArray(l))for(f in l)s.call(l,f)&&(t="string"==typeof(c=l[f])?h.options.cdata&&o(c)?t.ele(p).raw(a(c)).up():t.ele(p,c).up():u(t.ele(p),c).up());else"object"==typeof l?t=u(t.ele(p),l).up():"string"==typeof l&&h.options.cdata&&o(l)?t=t.ele(p).raw(a(l)).up():(null==l&&(l=""),t=t.ele(p,l.toString()).up());return t},l=t.create(c,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),u(l,e).end(this.options.renderOpts)},e}()}).call(this)},8381:function(t,e){(function(){e.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(this)},9082:function(t,e,n){(function(){"use strict";var t,i,r,o,a,s,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},h={}.hasOwnProperty;u=n(6099),r=n(7187),t=n(306),s=n(7526),l=n(5475).setImmediate,i=n(8381).defaults,o=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},a=function(t,e,n){var i,r;for(i=0,r=t.length;i0&&(u[t.options.childkey]=c),c=u;return i.length>0?t.assignOrPush(d,l,c):(t.options.explicitRoot&&(p=c,(c={})[l]=p),t.resultObject=c,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),n=function(t){return function(n){var r,o;if(o=i[i.length-1])return o[e]+=n,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==n.replace(/\\n/g,"").trim())&&(o[t.options.childkey]=o[t.options.childkey]||[],(r={"#name":"__text__"})[e]=n,t.options.normalize&&(r[e]=r[e].replace(/\s{2,}/g," ").trim()),o[t.options.childkey].push(r)),o}}(this),this.saxParser.ontext=n,this.saxParser.oncdata=function(t){var e;if(e=n(t))return e.cdata=!0}},r.prototype.parseString=function(e,n){var i;null!=n&&"function"==typeof n&&(this.on("end",(function(t){return this.reset(),n(null,t)})),this.on("error",(function(t){return this.reset(),n(t)})));try{return""===(e=e.toString()).trim()?(this.emit("end",null),!0):(e=t.stripBOM(e),this.options.async?(this.remaining=e,l(this.processAsync),this.saxParser):this.saxParser.write(e).close())}catch(t){if(i=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",i),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw i}},r.prototype.parseStringPromise=function(t){return new Promise((e=this,function(n,i){return e.parseString(t,(function(t,e){return t?i(t):n(e)}))}));var e},r}(r),e.parseString=function(t,n,i){var r,o;return null!=i?("function"==typeof i&&(r=i),"object"==typeof n&&(o=n)):("function"==typeof n&&(r=n),o={}),new e.Parser(o).parseString(t,r)},e.parseStringPromise=function(t,n){var i;return"object"==typeof n&&(i=n),new e.Parser(i).parseStringPromise(t)}}).call(this)},7526:function(t,e){(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),e.normalize=function(t){return t.toLowerCase()},e.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},e.stripPrefix=function(e){return e.replace(t,"")},e.parseNumbers=function(t){return isNaN(t)||(t=t%1==0?parseInt(t,10):parseFloat(t)),t},e.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t="true"===t.toLowerCase()),t}}).call(this)},5055:function(t,e,n){(function(){"use strict";var t,i,r,o,a={}.hasOwnProperty;i=n(8381),t=n(4096),r=n(9082),o=n(7526),e.defaults=i.defaults,e.processors=o,e.ValidationError=function(t){function e(t){this.message=t}return function(t,e){for(var n in e)a.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(e,Error),e}(),e.Builder=t.Builder,e.Parser=r.Parser,e.parseString=r.parseString,e.parseStringPromise=r.parseStringPromise}).call(this)},7557:function(t){(function(){t.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},9335:function(t){(function(){t.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},8369:function(t){(function(){var e,n,i,r,o,a,s,u=[].slice,l={}.hasOwnProperty;e=function(){var t,e,n,i,r,a;if(a=arguments[0],r=2<=arguments.length?u.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(t=0,n=r.length;t":"attribute: {"+t+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(t){return t.namespaceURI===this.namespaceURI&&(t.prefix===this.prefix&&(t.localName===this.localName&&t.value===this.value))},t}()}).call(this)},6170:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;e=n(9335),i=n(6488),t.exports=function(t){function n(t,i){if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(i)}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},6488:function(t,e,n){(function(){var e,i={}.hasOwnProperty;e=n(2026),t.exports=function(t){function e(t){e.__super__.constructor.call(this,t),this.value=""}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(e.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),e.prototype.clone=function(){return Object.create(this)},e.prototype.substringData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendData=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.insertData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.deleteData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.replaceData=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(t){return!!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.data===this.data},e}(e)}).call(this)},2096:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;e=n(9335),i=n(6488),t.exports=function(t){function n(t,i){if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(i)}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},383:function(t,e,n){(function(){var e,i;e=n(3933),i=n(6210),t.exports=function(){function t(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(t.prototype,"parameterNames",{get:function(){return new i(Object.keys(this.defaultParams))}}),t.prototype.getParameter=function(t){return this.params.hasOwnProperty(t)?this.params[t]:null},t.prototype.canSetParameter=function(t,e){return!0},t.prototype.setParameter=function(t,e){return null!=e?this.params[t]=e:delete this.params[t]},t}()}).call(this)},3933:function(t){(function(){t.exports=function(){function t(){}return t.prototype.handleError=function(t){throw new Error(t)},t}()}).call(this)},1770:function(t){(function(){t.exports=function(){function t(){}return t.prototype.hasFeature=function(t,e){return!0},t.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},t}()}).call(this)},6210:function(t){(function(){t.exports=function(){function t(t){this.arr=t||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(t){return this.arr[t]||null},t.prototype.contains=function(t){return-1!==this.arr.indexOf(t)},t}()}).call(this)},1179:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;i=n(2026),e=n(9335),t.exports=function(t){function n(t,i,r,o,a,s){if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==r)throw new Error("Missing DTD attribute name. "+this.debugInfo(i));if(!o)throw new Error("Missing DTD attribute type. "+this.debugInfo(i));if(!a)throw new Error("Missing DTD attribute default. "+this.debugInfo(i));if(0!==a.indexOf("#")&&(a="#"+a),!a.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(i));if(s&&!a.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(i));this.elementName=this.stringify.name(i),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(r),this.attributeType=this.stringify.dtdAttType(o),s&&(this.defaultValue=this.stringify.dtdAttDefault(s)),this.defaultValueType=a}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.toString=function(t){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},6347:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;i=n(2026),e=n(9335),t.exports=function(t){function n(t,i,r){if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());r||(r="(#PCDATA)"),Array.isArray(r)&&(r="("+r.join(",")+")"),this.name=this.stringify.name(i),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(r)}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.toString=function(t){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},9078:function(t,e,n){(function(){var e,i,r,o={}.hasOwnProperty;r=n(8369).isObject,i=n(2026),e=n(9335),t.exports=function(t){function n(t,i,o,a){if(n.__super__.constructor.call(this,t),null==o)throw new Error("Missing DTD entity name. "+this.debugInfo(o));if(null==a)throw new Error("Missing DTD entity value. "+this.debugInfo(o));if(this.pe=!!i,this.name=this.stringify.name(o),this.type=e.EntityDeclaration,r(a)){if(!a.pubID&&!a.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(o));if(a.pubID&&!a.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(o));if(this.internal=!1,null!=a.pubID&&(this.pubID=this.stringify.dtdPubID(a.pubID)),null!=a.sysID&&(this.sysID=this.stringify.dtdSysID(a.sysID)),null!=a.nData&&(this.nData=this.stringify.dtdNData(a.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(o))}else this.value=this.stringify.dtdEntityValue(a),this.internal=!0}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),Object.defineProperty(n.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(n.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(n.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(n.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(n.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(n.prototype,"xmlVersion",{get:function(){return null}}),n.prototype.toString=function(t){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},4777:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;i=n(2026),e=n(9335),t.exports=function(t){function n(t,i,r){if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing DTD notation name. "+this.debugInfo(i));if(!r.pubID&&!r.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(i));this.name=this.stringify.name(i),this.type=e.NotationDeclaration,null!=r.pubID&&(this.pubID=this.stringify.dtdPubID(r.pubID)),null!=r.sysID&&(this.sysID=this.stringify.dtdSysID(r.sysID))}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),Object.defineProperty(n.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(n.prototype,"systemId",{get:function(){return this.sysID}}),n.prototype.toString=function(t){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},9077:function(t,e,n){(function(){var e,i,r,o={}.hasOwnProperty;r=n(8369).isObject,i=n(2026),e=n(9335),t.exports=function(t){function n(t,i,o,a){var s;n.__super__.constructor.call(this,t),r(i)&&(i=(s=i).version,o=s.encoding,a=s.standalone),i||(i="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(i),null!=o&&(this.encoding=this.stringify.xmlEncoding(o)),null!=a&&(this.standalone=this.stringify.xmlStandalone(a))}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.toString=function(t){return this.options.writer.declaration(this,this.options.writer.filterOptions(t))},n}(i)}).call(this)},6544:function(t,e,n){(function(){var e,i,r,o,a,s,u,l,c={}.hasOwnProperty;l=n(8369).isObject,u=n(2026),e=n(9335),i=n(1179),o=n(9078),r=n(6347),a=n(4777),s=n(663),t.exports=function(t){function n(t,i,r){var o,a,s,u,c,h;if(n.__super__.constructor.call(this,t),this.type=e.DocType,t.children)for(a=0,s=(u=t.children).length;a=0;)this.up();return this.onEnd()},t.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},t.prototype.openNode=function(t){var n,r,o,a;if(!t.isOpen){if(this.root||0!==this.currentLevel||t.type!==e.Element||(this.root=t),r="",t.type===e.Element){for(o in this.writerOptions.state=i.OpenTag,r=this.writer.indent(t,this.writerOptions,this.currentLevel)+"<"+t.name,a=t.attribs)I.call(a,o)&&(n=a[o],r+=this.writer.attribute(n,this.writerOptions,this.currentLevel));r+=(t.children?">":"/>")+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=i.InsideTag}else this.writerOptions.state=i.OpenTag,r=this.writer.indent(t,this.writerOptions,this.currentLevel)+""),r+=this.writer.endline(t,this.writerOptions,this.currentLevel);return this.onData(r,this.currentLevel),t.isOpen=!0}},t.prototype.closeNode=function(t){var n;if(!t.isClosed)return n="",this.writerOptions.state=i.CloseTag,n=t.type===e.Element?this.writer.indent(t,this.writerOptions,this.currentLevel)+""+this.writer.endline(t,this.writerOptions,this.currentLevel):this.writer.indent(t,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=i.None,this.onData(n,this.currentLevel),t.isClosed=!0},t.prototype.onData=function(t,e){return this.documentStarted=!0,this.onDataCallback(t,e+1)},t.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},t.prototype.debugInfo=function(t){return null==t?"":"node: <"+t+">"},t.prototype.ele=function(){return this.element.apply(this,arguments)},t.prototype.nod=function(t,e,n){return this.node(t,e,n)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.com=function(t){return this.comment(t)},t.prototype.ins=function(t,e){return this.instruction(t,e)},t.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},t.prototype.dtd=function(t,e,n){return this.doctype(t,e,n)},t.prototype.e=function(t,e,n){return this.element(t,e,n)},t.prototype.n=function(t,e,n){return this.node(t,e,n)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.i=function(t,e){return this.instruction(t,e)},t.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.ent=function(t,e){return this.entity(t,e)},t.prototype.pent=function(t,e){return this.pEntity(t,e)},t.prototype.not=function(t,e){return this.notation(t,e)},t}()}).call(this)},8833:function(t,e,n){(function(){var e,i,r={}.hasOwnProperty;i=n(2026),e=n(9335),t.exports=function(t){function n(t){n.__super__.constructor.call(this,t),this.type=e.Dummy}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(n,t),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(t){return""},n}(i)}).call(this)},2161:function(t,e,n){(function(){var e,i,r,o,a,s,u,l,c={}.hasOwnProperty;l=n(8369),u=l.isObject,s=l.isFunction,a=l.getValue,o=n(2026),e=n(9335),i=n(2750),r=n(663),t.exports=function(t){function n(t,i,r){var o,a,s,u;if(n.__super__.constructor.call(this,t),null==i)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(i),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,null!=r&&this.attribute(r),t.type===e.Document&&(this.isRoot=!0,this.documentObject=t,t.rootObject=this,t.children))for(a=0,s=(u=t.children).length;a=r;e=0<=r?++i:--i)if(!this.attribs[e].isEqualNode(t.attribs[e]))return!1;return!0},n}(o)}).call(this)},663:function(t){(function(){t.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(t){return this.nodes[t]},t.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},t.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},t.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},t.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t}()}).call(this)},2026:function(t,e,n){(function(){var e,i,r,o,a,s,u,l,c,h,f,p,d,g,v,m,y,w={}.hasOwnProperty;y=n(8369),m=y.isObject,v=y.isFunction,g=y.isEmpty,d=y.getValue,l=null,r=null,o=null,a=null,s=null,f=null,p=null,h=null,u=null,i=null,c=null,e=null,t.exports=function(){function t(t){this.parent=t,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,l||(l=n(2161),r=n(6170),o=n(2096),a=n(9077),s=n(6544),f=n(9406),p=n(3595),h=n(9181),u=n(8833),i=n(9335),c=n(2390),n(663),e=n(7557))}return Object.defineProperty(t.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new c(this.children)),this.childNodeList}}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t-1]||null}}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t+1]||null}}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(t.prototype,"textContent",{get:function(){var t,e,n,r,o;if(this.nodeType===i.Element||this.nodeType===i.DocumentFragment){for(o="",e=0,n=(r=this.children).length;e":(null!=(n=this.parent)?n.name:void 0)?"node: <"+t+">, parent: <"+this.parent.name+">":"node: <"+t+">":""},t.prototype.ele=function(t,e,n){return this.element(t,e,n)},t.prototype.nod=function(t,e,n){return this.node(t,e,n)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.com=function(t){return this.comment(t)},t.prototype.ins=function(t,e){return this.instruction(t,e)},t.prototype.doc=function(){return this.document()},t.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},t.prototype.e=function(t,e,n){return this.element(t,e,n)},t.prototype.n=function(t,e,n){return this.node(t,e,n)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.i=function(t,e){return this.instruction(t,e)},t.prototype.u=function(){return this.up()},t.prototype.importXMLBuilder=function(t){return this.importDocument(t)},t.prototype.replaceChild=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.removeChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.appendChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.hasChildNodes=function(){return 0!==this.children.length},t.prototype.cloneNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isSupported=function(t,e){return!0},t.prototype.hasAttributes=function(){return 0!==this.attribs.length},t.prototype.compareDocumentPosition=function(t){var n,i;return(n=this)===t?0:this.document()!==t.document()?(i=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?i|=e.Preceding:i|=e.Following,i):n.isAncestor(t)?e.Contains|e.Preceding:n.isDescendant(t)?e.Contains|e.Following:n.isPreceding(t)?e.Preceding:e.Following},t.prototype.isSameNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.lookupPrefix=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isDefaultNamespace=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.lookupNamespaceURI=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isEqualNode=function(t){var e,n,i;if(t.nodeType!==this.nodeType)return!1;if(t.children.length!==this.children.length)return!1;for(e=n=0,i=this.children.length-1;0<=i?n<=i:n>=i;e=0<=i?++n:--n)if(!this.children[e].isEqualNode(t.children[e]))return!1;return!0},t.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.setUserData=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.getUserData=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.contains=function(t){return!!t&&(t===this||this.isDescendant(t))},t.prototype.isDescendant=function(t){var e,n,i,r;for(n=0,i=(r=this.children).length;nn},t.prototype.treePosition=function(t){var e,n;return n=0,e=!1,this.foreachTreeNode(this.document(),(function(i){if(n++,!e&&i===t)return e=!0})),e?n:-1},t.prototype.foreachTreeNode=function(t,e){var n,i,r,o,a;for(t||(t=this.document()),i=0,r=(o=t.children).length;i0){for(this.stream.write(" ["),this.stream.write(this.endline(t,e,n)),e.state=i.InsideTag,o=0,a=(s=t.children).length;o"),this.stream.write(this.endline(t,e,n)),e.state=i.None,this.closeNode(t,e,n)},n.prototype.element=function(t,n,r){var a,s,u,l,c,h,f,p,d;for(f in r||(r=0),this.openNode(t,n,r),n.state=i.OpenTag,this.stream.write(this.indent(t,n,r)+"<"+t.name),p=t.attribs)o.call(p,f)&&(a=p[f],this.attribute(a,n,r));if(l=0===(u=t.children.length)?null:t.children[0],0===u||t.children.every((function(t){return(t.type===e.Text||t.type===e.Raw)&&""===t.value})))n.allowEmpty?(this.stream.write(">"),n.state=i.CloseTag,this.stream.write("")):(n.state=i.CloseTag,this.stream.write(n.spaceBeforeSlash+"/>"));else if(!n.pretty||1!==u||l.type!==e.Text&&l.type!==e.Raw||null==l.value){for(this.stream.write(">"+this.endline(t,n,r)),n.state=i.InsideTag,c=0,h=(d=t.children).length;c")}else this.stream.write(">"),n.state=i.InsideTag,n.suppressPrettyCount++,!0,this.writeChildNode(l,n,r+1),n.suppressPrettyCount--,!1,n.state=i.CloseTag,this.stream.write("");return this.stream.write(this.endline(t,n,r)),n.state=i.None,this.closeNode(t,n,r)},n.prototype.processingInstruction=function(t,e,i){return this.stream.write(n.__super__.processingInstruction.call(this,t,e,i))},n.prototype.raw=function(t,e,i){return this.stream.write(n.__super__.raw.call(this,t,e,i))},n.prototype.text=function(t,e,i){return this.stream.write(n.__super__.text.call(this,t,e,i))},n.prototype.dtdAttList=function(t,e,i){return this.stream.write(n.__super__.dtdAttList.call(this,t,e,i))},n.prototype.dtdElement=function(t,e,i){return this.stream.write(n.__super__.dtdElement.call(this,t,e,i))},n.prototype.dtdEntity=function(t,e,i){return this.stream.write(n.__super__.dtdEntity.call(this,t,e,i))},n.prototype.dtdNotation=function(t,e,i){return this.stream.write(n.__super__.dtdNotation.call(this,t,e,i))},n}(r)}).call(this)},6434:function(t,e,n){(function(){var e,i={}.hasOwnProperty;e=n(751),t.exports=function(t){function e(t){e.__super__.constructor.call(this,t)}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.document=function(t,e){var n,i,r,o,a;for(e=this.filterOptions(e),o="",i=0,r=(a=t.children).length;i","]]]]>"),this.assertLegalChar(t))},t.prototype.comment=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+t);return this.assertLegalChar(t)},t.prototype.raw=function(t){return this.options.noValidation?t:""+t||""},t.prototype.attValue=function(t){return this.options.noValidation?t:this.assertLegalChar(this.attEscape(t=""+t||""))},t.prototype.insTarget=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.insValue=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+t);return this.assertLegalChar(t)},t.prototype.xmlVersion=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+t);return t},t.prototype.xmlEncoding=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+t);return this.assertLegalChar(t)},t.prototype.xmlStandalone=function(t){return this.options.noValidation?t:t?"yes":"no"},t.prototype.dtdPubID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdSysID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdElementValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdAttType=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdAttDefault=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdEntityValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdNData=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.convertAttKey="@",t.prototype.convertPIKey="?",t.prototype.convertTextKey="#text",t.prototype.convertCDataKey="#cdata",t.prototype.convertCommentKey="#comment",t.prototype.convertRawKey="#raw",t.prototype.assertLegalChar=function(t){var e,n;if(this.options.noValidation)return t;if(e="","1.0"===this.options.version){if(e=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,n=t.match(e))throw new Error("Invalid character in string: "+t+" at index "+n.index)}else if("1.1"===this.options.version&&(e=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,n=t.match(e)))throw new Error("Invalid character in string: "+t+" at index "+n.index);return t},t.prototype.assertLegalName=function(t){var e;if(this.options.noValidation)return t;if(this.assertLegalChar(t),e=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!t.match(e))throw new Error("Invalid character in name");return t},t.prototype.textEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&").replace(//g,">").replace(/\r/g," "))},t.prototype.attEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&").replace(/0?new Array(i).join(e.indent):""},t.prototype.endline=function(t,e,n){return!e.pretty||e.suppressPrettyCount?"":e.newline},t.prototype.attribute=function(t,e,n){var i;return this.openAttribute(t,e,n),i=" "+t.name+'="'+t.value+'"',this.closeAttribute(t,e,n),i},t.prototype.cdata=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+""+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.comment=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+"\x3c!-- ",e.state=i.InsideTag,r+=t.value,e.state=i.CloseTag,r+=" --\x3e"+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.declaration=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+"",r+=this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.docType=function(t,e,n){var r,o,a,s,u;if(n||(n=0),this.openNode(t,e,n),e.state=i.OpenTag,s=this.indent(t,e,n),s+="0){for(s+=" [",s+=this.endline(t,e,n),e.state=i.InsideTag,o=0,a=(u=t.children).length;o",s+=this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),s},t.prototype.element=function(t,n,r){var a,s,u,l,c,h,f,p,d,g,v,m,y,w;for(d in r||(r=0),g=!1,v="",this.openNode(t,n,r),n.state=i.OpenTag,v+=this.indent(t,n,r)+"<"+t.name,m=t.attribs)o.call(m,d)&&(a=m[d],v+=this.attribute(a,n,r));if(l=0===(u=t.children.length)?null:t.children[0],0===u||t.children.every((function(t){return(t.type===e.Text||t.type===e.Raw)&&""===t.value})))n.allowEmpty?(v+=">",n.state=i.CloseTag,v+=""+this.endline(t,n,r)):(n.state=i.CloseTag,v+=n.spaceBeforeSlash+"/>"+this.endline(t,n,r));else if(!n.pretty||1!==u||l.type!==e.Text&&l.type!==e.Raw||null==l.value){if(n.dontPrettyTextNodes)for(c=0,f=(y=t.children).length;c"+this.endline(t,n,r),n.state=i.InsideTag,h=0,p=(w=t.children).length;h",g&&n.suppressPrettyCount--,v+=this.endline(t,n,r),n.state=i.None}else v+=">",n.state=i.InsideTag,n.suppressPrettyCount++,g=!0,v+=this.writeChildNode(l,n,r+1),n.suppressPrettyCount--,g=!1,n.state=i.CloseTag,v+=""+this.endline(t,n,r);return this.closeNode(t,n,r),v},t.prototype.writeChildNode=function(t,n,i){switch(t.type){case e.CData:return this.cdata(t,n,i);case e.Comment:return this.comment(t,n,i);case e.Element:return this.element(t,n,i);case e.Raw:return this.raw(t,n,i);case e.Text:return this.text(t,n,i);case e.ProcessingInstruction:return this.processingInstruction(t,n,i);case e.Dummy:return"";case e.Declaration:return this.declaration(t,n,i);case e.DocType:return this.docType(t,n,i);case e.AttributeDeclaration:return this.dtdAttList(t,n,i);case e.ElementDeclaration:return this.dtdElement(t,n,i);case e.EntityDeclaration:return this.dtdEntity(t,n,i);case e.NotationDeclaration:return this.dtdNotation(t,n,i);default:throw new Error("Unknown XML node type: "+t.constructor.name)}},t.prototype.processingInstruction=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+"",r+=this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.raw=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n),e.state=i.InsideTag,r+=t.value,e.state=i.CloseTag,r+=this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.text=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n),e.state=i.InsideTag,r+=t.value,e.state=i.CloseTag,r+=this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.dtdAttList=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+""+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.dtdElement=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+""+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.dtdEntity=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+""+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.dtdNotation=function(t,e,n){var r;return this.openNode(t,e,n),e.state=i.OpenTag,r=this.indent(t,e,n)+""+this.endline(t,e,n),e.state=i.None,this.closeNode(t,e,n),r},t.prototype.openNode=function(t,e,n){},t.prototype.closeNode=function(t,e,n){},t.prototype.openAttribute=function(t,e,n){},t.prototype.closeAttribute=function(t,e,n){},t}()}).call(this)},5532:function(t,e,n){(function(){var e,i,r,o,a,s,u,l,c,h;h=n(8369),l=h.assign,c=h.isFunction,r=n(1770),o=n(6934),a=n(9227),u=n(6434),s=n(1996),e=n(9335),i=n(594),t.exports.create=function(t,e,n,i){var r,a;if(null==t)throw new Error("Root element needs a name.");return i=l({},e,n,i),a=(r=new o(i)).element(t),i.headless||(r.declaration(i),null==i.pubID&&null==i.sysID||r.dtd(i)),a},t.exports.begin=function(t,e,n){var i;return c(t)&&(e=(i=[t,e])[0],n=i[1],t={}),e?new a(t,e,n):new o(t)},t.exports.stringWriter=function(t){return new u(t)},t.exports.streamWriter=function(t,e){return new s(t,e)},t.exports.implementation=new r,t.exports.nodeType=e,t.exports.writerState=i}).call(this)},9862:()=>{},964:()=>{}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";function t(t,e,n,i,r,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(i,r)}function e(e){return function(){var n=this,i=arguments;return new Promise((function(r,o){var a=e.apply(n,i);function s(e){t(a,r,o,s,u,"next",e)}function u(e){t(a,r,o,s,u,"throw",e)}s(void 0)}))}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:w.debug;this.errorList.push({message:t,level:e,time:this.getTime()})}},{key:"get",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t;return(null===t||t>=this.errorList.length)&&(e=this.errorList.length-1),e<0?null:this.getCurrentErrorLevel()>=this.errorList[e].level?this.errorList[e].message:null}},{key:"getCurrentErrorLevel",value:function(){for(var t=0,e=Object.entries(w);t1&&void 0!==arguments[1]?arguments[1]:1500;return e.addMessage(t,w.debug,n)})),d(this,"addMessageInfo",(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500;return e.addMessage(t,w.info,n)})),d(this,"addMessageWarn",(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500;return e.addMessage(t,w.warn,n)})),d(this,"addMessageError",(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500;return e.addMessage(t,w.error,n)})),d(this,"addMessageFatal",(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500;return e.addMessage(t,w.fatal,n)}))}return o(t,[{key:"appComponent",get:function(){return this.getComponent("app")}},{key:"viewerWrapper",get:function(){return this.getComponent("viewer-wrapper")}},{key:"pageContainer",get:function(){return this.getComponent("page-container")}},{key:"firstSideMenu",get:function(){return this.getComponent("first-side-menu")}},{key:"secondSideMenu",get:function(){return this.getComponent("second-side-menu")}},{key:"leftBookBorder",get:function(){return this.getComponent("left-book-border")}},{key:"rightBookBorder",get:function(){return this.getComponent("right-book-border")}},{key:"firstBookmark",get:function(){return this.getComponent("first-bookmark")}},{key:"secondBookmark",get:function(){return this.getComponent("second-bookmark")}},{key:"drawingCanvas",get:function(){return this.getComponent("drawing-canvas")}},{key:"drawingMenu",get:function(){return this.getComponent("drawing-menu")}},{key:"scale",get:function(){return this.getComponent("scale")}},{key:"globalToast",get:function(){return this.getComponent("global-toast")}},{key:"floatingMenu",get:function(){return this.getComponent("floating-menu")}},{key:"pageSlider",get:function(){return this.getComponent("page-slider")}},{key:"viewerWidth",get:function(){var t,e;return null!==(t=null===(e=this.viewerWrapper)||void 0===e?void 0:e.viewerWidth)&&void 0!==t?t:0}},{key:"viewerHeight",get:function(){var t,e;return null!==(t=null===(e=this.viewerWrapper)||void 0===e?void 0:e.viewerHeight)&&void 0!==t?t:0}},{key:"getComponent",value:function(t){var e=this.components.filter((function(e){return e.id===t}));return 0===e.length?null:e[0].object}},{key:"addComponent",value:function(t,e){if(0!==this.components.filter((function(e){return e.id===t})).length)throw this.addMessageFatal("AppManager addComponent: id already exists: ".concat(t)),Error("id already exists: ".concat(t));this.components.push({id:t,object:e})}},{key:"removeComponent",value:function(t){this.components=this.components.filter((function(e){return e.id!==t}))}},{key:"getClientVariable",value:function(t){return this.clientVariable.get(t)}},{key:"setClientVariable",value:function(t,e){t&&this.clientVariable.set(t,e)}},{key:"updateWindowRatio",value:function(){var t,e,n,i,r,o;null===(t=this.viewerWrapper)||void 0===t||t.updateUi(),null===(e=this.firstSideMenu)||void 0===e||e.updateUi(),null===(n=this.secondSideMenu)||void 0===n||n.updateUi(),null===(i=this.leftBookBorder)||void 0===i||i.updateUi(),null===(r=this.rightBookBorder)||void 0===r||r.updateUi(),null===(o=this.drawingCanvas)||void 0===o||o.updateUi()}},{key:"addMessage",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1500;this.error.add(t,e);var i,r=this.error.get();r&&(null===(i=this.globalToast)||void 0===i||i.show(r,e,n))}},{key:"updateBookmark",value:function(){var t,e;null===(t=this.firstBookmark)||void 0===t||t.updateUi(),null===(e=this.secondBookmark)||void 0===e||e.updateUi()}},{key:"enableBook",value:function(){var t,e,n,i,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(r){if(this.enableBookTargetId!==o)return;this.enableBookTargetId=""}else{if(0!==this.enableBookTargetId.length)return;this.enableBookTargetId=o}null===(t=this.viewerWrapper)||void 0===t||t.setEnable(r),null===(e=this.pageContainer)||void 0===e||e.setEnable(r),null===(n=this.leftBookBorder)||void 0===n||n.setEnable(r),null===(i=this.rightBookBorder)||void 0===i||i.setEnable(r)}}]),t}());const k=new(function(){function t(){i(this,t),d(this,"audioList",[{name:"flip-page",path:"src/assets/audios/page-flip.mp3",element:null}]),this.preloadAudio()}return o(t,[{key:"preloadAudio",value:function(){this.audioList.forEach((function(t){var e=new Audio;e.loop=!1,e.volume=1,e.preload="auto",e.addEventListener("canplaythrough",(function(){e.play().catch((function(t){console.error(t)}))})),t.element=e}))}},{key:"stopAll",value:function(){this.audioList.forEach((function(t){t.element&&(t.element.pause(),t.element.currentTime=0)}))}},{key:"play",value:function(t){var e=this.audioList.filter((function(e){return e.name===t}));0!==e.length&&e[0].element&&(e[0].element.src=e[0].path)}},{key:"playFlipPage",value:function(){g.flipSound&&this.play("flip-page")}}]),t}());var P=function(t,e){window[t]=e};function S(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var I=n(5055),T=n.n(I);var x=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.width=e,this.height=n}return o(t,[{key:"object",get:function(){return{width:this.width,height:this.height}}}],[{key:"defaultSize",get:function(){return new t(0,0)}}]),t}(),C=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.x=e,this.y=n}return o(t,[{key:"object",get:function(){return{x:this.x,y:this.y}}}],[{key:"defaultPoint",get:function(){return new t(0,0)}},{key:"defaultScale",get:function(){return new t(1,1)}}]),t}(),D=function(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=null,o=null;return r=null!==(e=t.clientX)&&void 0!==e?e:null,o=null!==(n=t.clientY)&&void 0!==n?n:null,null!==r&&null!==o||!t.changedTouches[0]||(r=t.changedTouches[0].clientX,o=t.changedTouches[0].clientY),null!==r&&null!==o?new C(r/i,o/i):null};function O(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;i(this,t),d(this,"element",null),this.id=e,this.elementCreationData=n,this.element=n?this.createElement(e,n.className):this.get("#".concat(e))}return o(t,[{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}},{key:"child",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return e?e.querySelector(t):null}},{key:"children",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return e?Array.from(e.querySelectorAll(t)):[]}},{key:"getIframeDocument",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=e.querySelector(t);return n?n.contentDocument?n.contentDocument:n.contentWindow?n.contentWindow.document:null:null}},{key:"createElement",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"div",i=document.createElement(n);return 0!==t.length&&(i.id=t),0!==e.length&&e.split(" ").forEach((function(t){return 0!==t.length&&i.classList.add(t)})),i}},{key:"removeElement",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;null==t||t.remove()}},{key:"removeAllChild",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;if(t)for(;t.firstChild;)t.removeChild(t.firstChild)}},{key:"appendChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;null==e||e.appendChild(t)}},{key:"insertBefore",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;null==n||n.insertBefore(t,n.children[e])}},{key:"addAttribute",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;n&&n.setAttribute(t,e)}},{key:"setHtml",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;e&&(e.innerHTML=t)}},{key:"setText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;e&&(e.innerText=t)}},{key:"hasClass",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return null!==(e=null==n?void 0:n.classList.contains(t))&&void 0!==e&&e}},{key:"addClass",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;null==e||e.classList.add(t)}},{key:"removeClass",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;null==e||e.classList.remove(t)}},{key:"removeClassByPrefix",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;if(e)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:this.element;e&&(e.style.margin=L(t))}},{key:"getSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;return t?new x(A(t.style.width),A(t.style.height)):x.defaultSize}},{key:"setSize",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;n&&(n.style.width=null===t?"":L(t),n.style.height=null===e?"":L(e))}},{key:"getPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;if(t){var e=M(t.style.left),n=M(t.style.top);return new C(Number.isNaN(e)?0:e,Number.isNaN(n)?0:n)}return C.defaultPoint}},{key:"setPoint",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;n&&(n.style.left=null===t?"":L(t),n.style.top=null===e?"":L(e))}},{key:"setScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;if(e){var n="scale(".concat(t,", ").concat(t,")");e.style.webkitTransform=n,e.style.msTransform=n,e.style.transform=n}}},{key:"setAbsolute",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.element;r&&(r.style.position="absolute",r.style.top=null===t?"":L(t),r.style.right=null===e?"":L(e),r.style.bottom=null===n?"":L(n),r.style.left=null===i?"":L(i))}},{key:"setCss",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;n&&(n.style[t]=e)}},{key:"getComputedSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;if(!t)return x.defaultSize;var e=window.getComputedStyle(t),n=_(e.width),i=_(e.height);return new x(n,i)}},{key:"getComputedStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;return t?window.getComputedStyle(t):new CSSStyleDeclaration}},{key:"getWindowSize",value:function(){var t=document,e=t.documentElement,n=t.body,i=e.clientWidth||n.clientWidth,r=e.clientHeight||n.clientHeight;return new x(i,r)}},{key:"isWindowPortrait",value:function(){var t=this.getWindowSize();return!(t.width>=t.height)}},{key:"getScreenOrientationPortrait",value:function(){var t=this.getWindowSize();return!(t.width>t.height)}}]),t}();function H(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var V=function(t){s(n,t);var e=H(n);function n(t,r,o){var a;return i(this,n),(a=e.call(this,t,o)).setHtml(r),a.addClass("".concat(t,"-host")),E.addComponent(t,l(a)),a}return o(n,[{key:"destroy",value:function(){this.removeElement(),E.removeComponent(this.id)}},{key:"append",value:function(){this.element&&this.elementCreationData&&this.appendChild(this.element,this.elementCreationData.parentElement)}},{key:"setOn",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return this.setClass("--on",t,e)}},{key:"setDisplay",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return this.setClass("--display",t,e)}},{key:"setEnable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.element;return this.setClass("--disable",!t,e)}},{key:"setClass",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.element;return e?this.addClass(t,n):this.removeClass(t,n),this}}]),n}(W);function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var G=function(t){s(n,t);var e=z(n);function n(){var t;return i(this,n),d(l(t=e.call(this,"console-panel","",{parentElement:E.appComponent,className:"console-panel-host"})),"index",1),t.append(),t}return o(n,[{key:"updateUi",value:function(){}},{key:"addMessage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this.createElement("","message");n.innerHTML="".concat(this.index,": ").concat(t,"
").concat(e,"
"),this.index+=1,this.insertBefore(n,0)}}],[{key:"addMessage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=E.getComponent("console-panel");i||(i=new n),i.addMessage(t,e)}}]),n}(V),q=new(function(){function t(){i(this,t),d(this,"startTime",0),d(this,"endTime",0)}return o(t,[{key:"elapsedTime",get:function(){return this.endTime-this.startTime}},{key:"startSpeedTest",value:function(){g.testRequestSpeed&&(this.reset(),this.start())}},{key:"endSpeedTest",value:function(t,e){g.testRequestSpeed&&(this.end(),this.log(t,e.split("/").pop()),G.addMessage("".concat(t,": ").concat(e.split("/").pop(),":"),"".concat(Math.round(this.elapsedTime),"ms")))}},{key:"reset",value:function(){this.startTime=0,this.endTime=0}},{key:"start",value:function(){this.startTime=performance.now()}},{key:"end",value:function(){this.endTime=performance.now()}},{key:"log",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n="SpeedTest:";t+=":",e+=":",console.log("%c".concat(n," %c").concat(t),"color: skyblue; font-weight: bold;","color: skyblue;",e,this.elapsedTime)}}]),t}()),$=function(){var t=e(p().mark((function t(e){var n,i=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.length>1&&void 0!==i[1]&&i[1],t.prev=1,t.next=4,fetch(e,n?void 0:{cache:"no-cache"});case 4:return t.abrupt("return",t.sent);case 7:return t.prev=7,t.t0=t.catch(1),t.abrupt("return",null);case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),Y=function(){var t=e(p().mark((function t(e){var n,i,r,o=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>1&&void 0!==o[1]&&o[1],q.startSpeedTest(),t.next=4,$(e,n);case 4:if(!(i=t.sent)||!i.ok){t.next=11;break}return t.next=8,i.text();case 8:t.t0=t.sent,t.next=12;break;case 11:t.t0=null;case 12:return r=t.t0,q.endSpeedTest("requestTextGet",e),t.abrupt("return",r);case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),X=function(){var t=e(p().mark((function t(e){var n,i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return q.startSpeedTest(),t.next=3,$(e);case 3:if(!(n=t.sent)||!n.ok){t.next=10;break}return t.next=7,n.json();case 7:t.t0=t.sent,t.next=11;break;case 10:t.t0=null;case 11:return i=t.t0,q.endSpeedTest("requestJsonGet",e),t.abrupt("return",i);case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),K=function(){var t=e(p().mark((function t(e){var n,i,r,o=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>1&&void 0!==o[1]&&o[1],t.next=3,Y(e,n);case 3:if(!(i=t.sent)){t.next=10;break}return t.next=7,T().parseStringPromise(i,{strict:!1,trim:!0});case 7:t.t0=t.sent,t.next=11;break;case 10:t.t0=null;case 11:return r=t.t0,t.abrupt("return",r);case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Z="CurrentPage",Q="Annotation",J="Setting",tt="EpubConfig",et="".concat(location.host).concat(location.pathname.replace("index.html","")),nt=function(){return U(g.bookUrl)},it=function(t){return"".concat(t).concat("V3","-").concat(nt(),"-").concat(et)},rt=function(t){var e=it(t),n=localStorage.getItem(e);return n?function(t){var e=null;try{e=JSON.parse(t)}catch(t){console.error("failed to parse json",t),E.addMessageError("failed to parse json")}return e}(n):null},ot=function(t,e){var n=it(t),i=function(t){var e="";try{e=JSON.stringify(t)}catch(t){console.error("failed to stringify json",t),E.addMessageError("failed to stringify json")}return e}(e);i&&0!==i.length&&localStorage.setItem(n,i)};function at(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return st(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return st(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n2&&void 0!==arguments[2]&&arguments[2];i(this,t),d(this,"bookUrl",""),d(this,"id",""),d(this,"title",""),d(this,"coverImageUrl",""),d(this,"epubUrl",""),d(this,"containerUrl",""),d(this,"contentUrl",""),d(this,"opfUrl",""),d(this,"metaTitle",""),d(this,"metaLesson",""),d(this,"metaGeneratorVersion",0),d(this,"metaItemList",[]),d(this,"metaSpineList",[]),this.bookUrl=e,r?this.parseDataDirect():this.parseData(n)}var n,r;return o(t,[{key:"parseData",value:function(t){try{this.id=St(t),this.title=Tt(t),this.epubUrl="".concat(this.bookUrl,"/").concat(It(t)),this.containerUrl="".concat(this.epubUrl,"/META-INF/container.xml"),xt(t)&&(this.coverImageUrl="".concat(this.bookUrl,"/").concat(Ct(t)))}catch(t){console.error("failed to parse epub ref data",t),E.addMessageError("failed to parse epub ref data")}}},{key:"parseDataDirect",value:function(){this.epubUrl=this.bookUrl,this.containerUrl="".concat(this.epubUrl,"/META-INF/container.xml")}},{key:"parseMetadata",value:(r=e(p().mark((function t(e){var n,i,r,o,a,s,u,l,c,h,f,d;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getOpfData(e);case 3:n=t.sent,this.setContentUrl(),this.metaTitle=Rt(n),this.metaLesson=Lt(n),i=Et(At(n));try{for(i.s();!(r=i.n()).done;)o=r.value,"generator"===Nt(o)&&(a=Bt(o))&&(s=a.replace(/[^0-9]/g,"")).length>0&&(this.metaGeneratorVersion=M(s[0]))}catch(t){i.e(t)}finally{i.f()}u=Et(_t(n));try{for(u.s();!(l=u.n()).done;)c=l.value,this.metaItemList.push(c.$)}catch(t){u.e(t)}finally{u.f()}h=Et(Mt(n));try{for(h.s();!(f=h.n()).done;)d=f.value,this.metaSpineList.push(d.$.IDREF)}catch(t){h.e(t)}finally{h.f()}0===this.id.length&&(this.id=Ot(n)),0===this.title.length&&(this.title=this.metaTitle),0===this.coverImageUrl.length&&(this.coverImageUrl="".concat(this.contentUrl,"/").concat(this.getMetaItem("coverimage"))),t.next=22;break;case 18:t.prev=18,t.t0=t.catch(0),console.error("failed to parse epub meta data",t.t0),E.addMessageError("failed to parse epub meta data");case 22:case"end":return t.stop()}}),t,this,[[0,18]])}))),function(t){return r.apply(this,arguments)})},{key:"getOpfData",value:(n=e(p().mark((function t(e){var n,i,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}this.opfUrl="".concat(this.epubUrl,"/").concat(e),t.next=9;break;case 4:return t.next=6,K(this.containerUrl);case 6:n=t.sent,i=Dt(n),this.opfUrl="".concat(this.epubUrl,"/").concat(i);case 9:return t.next=11,K(this.opfUrl);case 11:if((r=t.sent)&&!r.HTML){t.next=17;break}return this.opfUrl=this.opfUrl.toLowerCase(),t.next=16,K(this.opfUrl);case 16:r=t.sent;case 17:return t.abrupt("return",r);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"setContentUrl",value:function(){var t=this.opfUrl.split("/");t.pop(),this.contentUrl=t.join("/")}},{key:"getMetaItem",value:function(t){var e=this.metaItemList.filter((function(e){return e.ID===t}));return 0===e.length?"":e[0].HREF}}]),t}(),St=function(t){return t.$.ID},It=function(t){return t.$.HREF},Tt=function(t){return t.TITLE[0]},xt=function(t){return t.COVERIMAGE[0]},Ct=function(t){return t.COVERIMAGE[0].$.HREF},Dt=function(t){return t.CONTAINER.ROOTFILES[0].ROOTFILE[0].$["FULL-PATH"]},Ot=function(t){return t.PACKAGE.$["UNIQUE-IDENTIFIER"]},Rt=function(t){try{return t.PACKAGE.METADATA[0]["DC:TITLE"][0]}catch(t){return""}},Lt=function(t){try{return t.PACKAGE.METADATA[0]["DC:LESSON"][0]}catch(t){return""}},At=function(t){return t.PACKAGE.METADATA[0].META},_t=function(t){return t.PACKAGE.MANIFEST[0].ITEM},Mt=function(t){return t.PACKAGE.SPINE[0].ITEMREF},Nt=function(t){return t.$.NAME},Bt=function(t){return t.$.CONTENT},Ut="page_thumbnails",Ft="_publish/page_thumbnails",jt=function(){function t(e,n,r,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;i(this,t),d(this,"id",""),d(this,"startPageNumber",0),d(this,"pageUrl",""),d(this,"pageNumber",0),d(this,"thumbnailUrl",""),this.id=e,this.startPageNumber=n,a?this.parseData(r,o,a):this.parseDataDirect(r,o)}return o(t,[{key:"parseData",value:function(t,e,n){var i=e.metaGeneratorVersion>=3?Ft:Ut;try{this.pageUrl=F("".concat(e.contentUrl,"/").concat(n.$.HREF)),this.pageNumber=M(n.$.PAGENUMBER),this.thumbnailUrl="".concat(e.contentUrl,"/").concat(i,"/").concat(B(t.toString(),4),".jpg")}catch(t){console.error("failed to parse page ref data",t),E.addMessageError("failed to parse page ref data")}}},{key:"parseDataDirect",value:function(t,e){var n=e.metaGeneratorVersion>=3?Ft:Ut,i=e.metaSpineList[t];this.pageUrl=F("".concat(e.contentUrl,"/").concat(e.getMetaItem(i))),this.pageNumber=this.startPageNumber+t,this.thumbnailUrl="".concat(e.contentUrl,"/").concat(n,"/").concat(B(t.toString(),4),".jpg")}}]),t}(),Wt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i(this,t),d(this,"label",""),d(this,"section",""),d(this,"pageNumber",0),d(this,"index",0),d(this,"level",0),n?this.parseDataDirect(e):this.parseData(e)}return o(t,[{key:"parseData",value:function(t){try{var e=Ht(t);e||(e=0),this.label=Vt(t),this.section=Gt(t),this.pageNumber=M($t(t)),this.index=M(Xt(t)),this.level=e}catch(t){console.error("failed to parse toc ref data",t),E.addMessageError("failed to parse toc ref data")}}},{key:"parseDataDirect",value:function(t){try{var e=Ht(t);e||(e=0),this.label=zt(t),this.section=qt(t),this.pageNumber=M(Yt(t)),this.index=M(Kt(t)),this.level=e}catch(t){console.error("failed to parse toc ref data",t),E.addMessageError("failed to parse toc ref data")}}}]),t}(),Ht=function(t){return t.LEVEL},Vt=function(t){return t.NAVLABEL[0].TEXT[0]},zt=function(t){return t.A[0]._},Gt=function(t){return t.CONTENT[0].$.SECTION},qt=function(t){return t.SECTION},$t=function(t){return t.CONTENT[0].$.PAGENUMBER},Yt=function(t){return t.PAGENUMBER},Xt=function(t){return t.CONTENT[0].$.INDEX},Kt=function(t){return t.INDEX};function Zt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Qt(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qt(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Qt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function se(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:null!==(t=g.currentPageNumber)&&void 0!==t?t:0,n=0,i=0;ithis.endPageNumber?g.currentPageNumber:t}},{key:"getStartPageNumber",value:function(){return 0!==this.pageList.length?this.pageList[0].startPageNumber:0}},{key:"getEndPageNumber",value:function(){return Math.max.apply(Math,S(this.pageList.map((function(t){return t.pageNumber}))))}},{key:"getPages",value:function(t){var e=[];return e.push(this.getPageItem(t)),g.isDoublePage&&e.push(this.getPageItem(t,!0)),e}},{key:"getPagesWithIndex",value:function(t){var e=[];return e.push(this.getPageItemWithIndex(t)),g.isDoublePage&&e.push(this.getPageItemWithIndex(t,!0)),e}},{key:"getPageItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t;0===(n=e?n+1:n)&&(n+=1);var i=this.pageList.filter((function(t){return t.pageNumber===n}));return 0===i.length?null:i[0]}},{key:"getPageItemWithIndex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e?t+1:t,i=this.pageList[n];return i||null}},{key:"isPageNumberAvailable",value:function(t){var e=this.pageList.filter((function(e){return e.pageNumber===t}));return 0!==e.length}}]),t}(),ge=function(t){return t.DTEXT.METADATA[0]["DC:TITLE"][0]},ve=function(t){return t.DTEXT.MANIFEST[0].TOC[0].$.HREF},me=function(t){return t.DTEXT.MANIFEST[0].EPUBITEM},ye=function(t){return t.DTEXT.SPINE[0].EPUBREF},we=function(t){return t.DTEXTTOC.NAVMAP[0].NAVPOINT},be=function(t){return t.NAVPOINT},Ee=function(t){return t.CDBOOK.MANIFEST[0].EPUBITEM[0].TITLE[0]},ke=function(t){return t.CDBOOK.MANIFEST[0].TOC[0].$.HREF},Pe=function(t){return t.CDBOOK.MANIFEST[0].EPUBITEM},Se=function(t){return t.CDBOOK.SPINE[0].EPUBREF},Ie=function(t){return t.CDBOOKTOC.NAVMAP[0].NAVPOINT},Te=function(t){return t.NAVPOINT},xe=function(t){return t.CONTAINER.ROOTFILES[0].ROOTFILE[0].$["FULL-PATH"]},Ce=function(t){return t.$.IDREF},De=function(t){return t.$.STARTPAGENUMBER},Oe=function(t){return t.SPINEITEM};!function(t){t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(fe||(fe={})),function(t){t.SOFT="soft",t.HARD="hard"}(pe||(pe={}));var Re,Le=function(){function t(e,n){i(this,t),d(this,"orientation",fe.LEFT),this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0},this.createdDensity=n,this.nowDrawingDensity=this.createdDensity,this.render=e}return o(t,[{key:"setDensity",value:function(t){this.createdDensity=t,this.nowDrawingDensity=t}},{key:"setDrawingDensity",value:function(t){this.nowDrawingDensity=t}},{key:"setPosition",value:function(t){this.state.position=t}},{key:"setAngle",value:function(t){this.state.angle=t}},{key:"setArea",value:function(t){this.state.area=t}},{key:"setHardDrawingAngle",value:function(t){this.state.hardDrawingAngle=t}},{key:"setHardAngle",value:function(t){this.state.hardAngle=t,this.state.hardDrawingAngle=t}},{key:"setOrientation",value:function(t){this.orientation=t}},{key:"getDrawingDensity",value:function(){return this.nowDrawingDensity}},{key:"getDensity",value:function(){return this.createdDensity}},{key:"getHardAngle",value:function(){return this.state.hardAngle}}]),t}();!function(t){t.PORTRAIT="portrait",t.LANDSCAPE="landscape"}(Re||(Re={}));var Ae,_e,Me,Ne=function(){function t(e,n){i(this,t),d(this,"leftPage",null),d(this,"rightPage",null),d(this,"flippingPage",null),d(this,"bottomPage",null),d(this,"direction",null),d(this,"orientation",null),d(this,"shadow",null),d(this,"animation",null),d(this,"pageRect",null),d(this,"boundsRect",null),d(this,"timer",0),d(this,"safari",!1),this.setting=n,this.app=e;var r=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==r.exec(window.navigator.userAgent)}return o(t,[{key:"render",value:function(t){if(null!==this.animation){var e=Math.round((t-this.animation.startedAt)/this.animation.durationFrame);e1&&void 0!==arguments[1]?arguments[1]:this.direction;e||(e=Ae.FORWARD);var n=this.getRect(),i=e===Ae.FORWARD?t.x-n.left-n.width/2:n.width/2-t.x+n.left;return this.getOrientation()===Re.PORTRAIT&&(i=e===Ae.FORWARD?t.x:n.width-t.x),{x:i,y:t.y-n.top}}},{key:"convertToGlobal",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.direction;if(e||(e=Ae.FORWARD),null==t)return null;var n=this.getRect(),i=e===Ae.FORWARD?t.x+n.left+n.width/2:n.width/2-t.x+n.left;return this.getOrientation()===Re.PORTRAIT&&(i=e===Ae.FORWARD?t.x:n.width-t.x),{x:i,y:t.y+n.top}}},{key:"convertRectToGlobal",value:function(t){var e,n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.direction;return o||(o=Ae.FORWARD),{topLeft:null!==(e=this.convertToGlobal(t.topLeft,o))&&void 0!==e?e:{x:0,y:0},topRight:null!==(n=this.convertToGlobal(t.topRight,o))&&void 0!==n?n:{x:0,y:0},bottomLeft:null!==(i=this.convertToGlobal(t.bottomLeft,o))&&void 0!==i?i:{x:0,y:0},bottomRight:null!==(r=this.convertToGlobal(t.bottomRight,o))&&void 0!==r?r:{x:0,y:0}}}}]),t}(),Be=function(){function t(){i(this,t)}return o(t,null,[{key:"GetDistanceBetweenTwoPoint",value:function(t,e){return null===t||null===e?1/0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}},{key:"GetSegmentLength",value:function(e){return t.GetDistanceBetweenTwoPoint(e[0],e[1])}},{key:"GetAngleBetweenTwoLine",value:function(t,e){var n=t[0].y-t[1].y,i=e[0].y-e[1].y,r=t[1].x-t[0].x,o=e[1].x-e[0].x;return Math.acos((n*i+r*o)/(Math.sqrt(n*n+r*r)*Math.sqrt(i*i+o*o)))}},{key:"PointInRect",value:function(t,e){return null===e?null:e.x>=t.left&&e.x<=t.width+t.left&&e.y>=t.top&&e.y<=t.top+t.height?e:null}},{key:"GetRotatedPoint",value:function(t,e,n){return{x:t.x*Math.cos(n)+t.y*Math.sin(n)+e.x,y:t.y*Math.cos(n)-t.x*Math.sin(n)+e.y}}},{key:"LimitPointToCircle",value:function(e,n,i){if(t.GetDistanceBetweenTwoPoint(e,i)<=n)return i;var r=e.x,o=e.y,a=i.x,s=i.y,u=Math.sqrt(Math.pow(n,2)*Math.pow(r-a,2)/(Math.pow(r-a,2)+Math.pow(o-s,2)))+r;i.x<0&&(u*=-1);var l=(u-r)*(o-s)/(r-a)+o;return r-a+o===0&&(l=n),{x:u,y:l}}},{key:"GetIntersectBetweenTwoSegment",value:function(e,n,i){return t.PointInRect(e,t.GetIntersectBeetwenTwoLine(n,i))}},{key:"GetIntersectBeetwenTwoLine",value:function(t,e){var n=t[0].y-t[1].y,i=e[0].y-e[1].y,r=t[1].x-t[0].x,o=e[1].x-e[0].x,a=t[0].x*t[1].y-t[1].x*t[0].y,s=e[0].x*e[1].y-e[1].x*e[0].y,u=n*s-i*a,l=r*s-o*a,c=-(a*o-s*r)/(n*o-i*r),h=-(n*s-i*a)/(n*o-i*r);if(isFinite(c)&&isFinite(h))return{x:c,y:h};if(Math.abs(u-l)<.1)throw new Error("Segment included");return null}},{key:"GetCordsFromTwoPoint",value:function(t,e){var n=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y),r=Math.max(n,i),o=[t];function a(t,e,n,i,r){return e>t?t+r*(n/i):e=10&&t.push(this.sideIntersectPoint):this.corner===_e.TOP&&t.push({x:this.pageWidth,y:this.pageHeight}),t.push(this.bottomIntersectPoint),t.push(this.topIntersectPoint),t}},{key:"getAngle",value:function(){return this.direction===Ae.FORWARD?-this.angle:this.angle}},{key:"getRect",value:function(){return this.rect}},{key:"getPosition",value:function(){return this.position}},{key:"getActiveCorner",value:function(){return this.direction===Ae.FORWARD?this.rect.topLeft:this.rect.topRight}},{key:"getDirection",value:function(){return this.direction}},{key:"getFlippingProgress",value:function(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}},{key:"getCorner",value:function(){return this.corner}},{key:"getBottomPagePosition",value:function(){return this.direction===Ae.BACK?{x:this.pageWidth,y:0}:{x:0,y:0}}},{key:"getShadowStartPoint",value:function(){var t,e;return this.corner===_e.TOP?null!==(t=this.topIntersectPoint)&&void 0!==t?t:{x:0,y:0}:null!==this.sideIntersectPoint?this.sideIntersectPoint:null!==(e=this.topIntersectPoint)&&void 0!==e?e:{x:0,y:0}}},{key:"getShadowAngle",value:function(){var t=Be.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return this.direction===Ae.FORWARD?t:Math.PI-t}},{key:"calcAngleAndPosition",value:function(t){var e=t;if(this.updateAngleAndGeometry(e),e=this.corner===_e.TOP?this.checkPositionAtCenterLine(e,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(e,{x:0,y:this.pageHeight},{x:0,y:0}),Math.abs(e.x-this.pageWidth)<1&&Math.abs(e.y)<1)throw new Error("Point is too small");return e}},{key:"updateAngleAndGeometry",value:function(t){this.angle=this.calculateAngle(t),this.rect=this.getPageRect(t)}},{key:"calculateAngle",value:function(t){var e=this.pageWidth-t.x+1,n=this.corner===_e.BOTTOM?this.pageHeight-t.y:t.y,i=2*Math.acos(e/Math.sqrt(n*n+e*e));n<0&&(i=-i);var r=Math.PI-i;if(!isFinite(i)||r>=0&&r<.003)throw new Error("The G point is too small");return this.corner===_e.BOTTOM&&(i=-i),i}},{key:"getPageRect",value:function(t){return this.corner===_e.TOP?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],t):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],t)}},{key:"getRectFromBasePoint",value:function(t,e){return{topLeft:this.getRotatedPoint(t[0],e),topRight:this.getRotatedPoint(t[1],e),bottomLeft:this.getRotatedPoint(t[2],e),bottomRight:this.getRotatedPoint(t[3],e)}}},{key:"getRotatedPoint",value:function(t,e){return{x:t.x*Math.cos(this.angle)+t.y*Math.sin(this.angle)+e.x,y:t.y*Math.cos(this.angle)-t.x*Math.sin(this.angle)+e.y}}},{key:"calculateIntersectPoint",value:function(t){var e={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};this.corner===_e.TOP?(this.topIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[t,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]),this.sideIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[t,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]),this.bottomIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])):(this.topIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]),this.sideIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[t,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]),this.bottomIntersectPoint=Be.GetIntersectBetweenTwoSegment(e,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}]))}},{key:"checkPositionAtCenterLine",value:function(t,e,n){var i=t,r=Be.LimitPointToCircle(e,this.pageWidth,i);i!==r&&(i=r,this.updateAngleAndGeometry(i));var o=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2)),a=this.rect.bottomRight,s=this.rect.topLeft;if(this.corner===_e.BOTTOM&&(a=this.rect.topRight,s=this.rect.bottomLeft),a.x<=0){var u=Be.LimitPointToCircle(n,o,s);u!==i&&(i=u,this.updateAngleAndGeometry(i))}return i}},{key:"getSegmentToShadowLine",value:function(){var t,e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:null!==(t=this.bottomIntersectPoint)&&void 0!==t?t:{x:0,y:0}]}}]),t}();function Fe(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return je(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return je(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function je(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]&&arguments[1];if((!this.app.getSettings().disableFlipByClick||this.isPointOnCorners(t))&&(null!==this.calc&&this.render.finishAnimation(),this.start(t,r))){var o=this.getBoundsRect();this.setState(Me.FLIPPING);var a=o.height/10,s=(null===(e=this.calc)||void 0===e?void 0:e.getCorner())===_e.BOTTOM?o.height-a:a,u=(null===(n=this.calc)||void 0===n?void 0:n.getCorner())===_e.BOTTOM?o.height:0;null===(i=this.calc)||void 0===i||i.calc({x:o.pageWidth-a,y:s}),this.animateFlippingTo({x:o.pageWidth-a,y:s},{x:-o.pageWidth,y:u},!0,!0,r)}}},{key:"start",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.reset();var n=this.render.convertToBook(t),i=this.getBoundsRect(),r=this.getDirectionByPoint(n),o=n.y>=i.height/2?_e.BOTTOM:_e.TOP;if(!this.checkDirection(r,e))return!1;try{if(this.flippingPage=this.app.getPageCollection().getFlippingPage(r),this.bottomPage=this.app.getPageCollection().getBottomPage(r),!this.flippingPage)throw Error;if(this.render.getOrientation()===Re.LANDSCAPE)if(r===Ae.BACK){var a=this.app.getPageCollection().nextBy(this.flippingPage);null!==a&&this.flippingPage.getDensity()!==a.getDensity()&&(this.flippingPage.setDrawingDensity(pe.HARD),a.setDrawingDensity(pe.HARD))}else{var s=this.app.getPageCollection().prevBy(this.flippingPage);null!==s&&this.flippingPage.getDensity()!==s.getDensity()&&(this.flippingPage.setDrawingDensity(pe.HARD),s.setDrawingDensity(pe.HARD))}return this.render.setDirection(r),this.calc=new Ue(r,o,i.pageWidth.toString(10),i.height.toString(10)),!0}catch(t){return!1}}},{key:"do",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null!==this.calc&&this.calc.calc(t)){var n,i,r,o,a,s,u,l,c,h=this.calc.getFlippingProgress();if(null===(n=this.bottomPage)||void 0===n||n.setArea(this.calc.getBottomClipArea()),null===(i=this.bottomPage)||void 0===i||i.setPosition(this.calc.getBottomPagePosition()),null===(r=this.bottomPage)||void 0===r||r.setAngle(0),null===(o=this.bottomPage)||void 0===o||o.setHardAngle(0),null===(a=this.flippingPage)||void 0===a||a.setArea(this.calc.getFlippingClipArea()),null===(s=this.flippingPage)||void 0===s||s.setPosition(this.calc.getActiveCorner()),null===(u=this.flippingPage)||void 0===u||u.setAngle(this.calc.getAngle()),this.calc.getDirection()===Ae.FORWARD)null===(l=this.flippingPage)||void 0===l||l.setHardAngle(90*(200-2*h)/100);else null===(c=this.flippingPage)||void 0===c||c.setHardAngle(-90*(200-2*h)/100);this.render.setPageRect(this.calc.getRect()),this.render.setBottomPage(this.bottomPage),e||this.render.setFlippingPage(this.flippingPage),this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),h,this.calc.getDirection())}}},{key:"flipToPage",value:function(t,e){var n=this.app.getPageCollection().getCurrentSpreadIndex(),i=this.app.getPageCollection().getSpreadIndexByPage(t);if(null!==i)try{i>n&&(this.app.getPageCollection().setCurrentSpreadIndex(i-1),this.flipNext(e)),i1&&void 0!==arguments[1]&&arguments[1],n=this.render.getRect().pageWidth;this.app.getOrientation()===Re.LANDSCAPE&&(n*=2),this.flip({x:this.render.getRect().left+n-10,y:t===_e.TOP?1:this.render.getRect().height-2},e)}},{key:"flipPrev",value:function(t){this.flip({x:10,y:t===_e.TOP?1:this.render.getRect().height-2})}},{key:"stopMove",value:function(){if(null!==this.calc){var t=this.calc.getPosition(),e=this.getBoundsRect(),n=this.calc.getCorner()===_e.BOTTOM?e.height:0;t.x<0?this.animateFlippingTo(t,{x:-e.pageWidth,y:n},!0):this.animateFlippingTo(t,{x:e.pageWidth,y:n},!1)}}},{key:"showCorner",value:function(t){if(this.checkState(Me.READ,Me.FOLD_CORNER)){var e=this.getBoundsRect(),n=e.pageWidth;if(this.isPointOnCorners(t))if(null===this.calc){if(!this.start(t))return;if(!this.calc)return;this.setState(Me.FOLD_CORNER),this.calc.calc({x:n-1,y:1});var i=this.calc.getCorner()===_e.BOTTOM?e.height-1:1,r=this.calc.getCorner()===_e.BOTTOM?e.height-50:50;this.animateFlippingTo({x:n-1,y:i},{x:n-50,y:r},!1,!1)}else this.do(this.render.convertToPage(t));else this.setState(Me.READ),this.render.finishAnimation(),this.stopMove()}}},{key:"animateFlippingTo",value:function(t,e,n){var i=this,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=Be.GetCordsFromTwoPoint(t,e),s=[];if(o)s.push((function(){return i.do(a[a.length-1],o)}));else{var u,l=Fe(a);try{var c=function(){var t=u.value;s.push((function(){return i.do(t)}))};for(l.s();!(u=l.n()).done;)c()}catch(t){l.e(t)}finally{l.f()}}var h=o?100:this.getAnimationDuration(a.length);this.render.startAnimation(s,h,(function(){i.calc&&(n&&(i.calc.getDirection()===Ae.BACK?i.app.turnToPrevPage():i.app.turnToNextPage()),r&&(i.render.setBottomPage(null),i.render.setFlippingPage(null),i.render.clearShadow(),i.setState(Me.READ),i.reset()))}))}},{key:"getCalculation",value:function(){return this.calc}},{key:"getState",value:function(){return this.state}},{key:"setState",value:function(t){this.state!==t&&(this.app.getUI().removeOptionClass(),this.app.getUI().addOptionClass(t),this.app.updateState(t),this.state=t)}},{key:"setDirectionByPoint",value:function(t){var e=this.render.convertToBook(t),n=this.getDirectionByPoint(e);this.checkDirection(n)&&this.render.setDirection(n)}},{key:"getDirectionByPoint",value:function(t){var e=this.getBoundsRect();return t.x=1e3?e:t/1e3*e}},{key:"checkDirection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!!e||(t===Ae.FORWARD?this.app.isSinglePage?this.app.viewerCurrentPageIndex=1)}},{key:"reset",value:function(){this.calc=null,this.flippingPage=null,this.bottomPage=null}},{key:"getBoundsRect",value:function(){return this.render.getRect()}},{key:"checkState",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0&&i.y>0&&i.xe.width-n)&&(i.ye.height-n)}}]),t}(),He=function(t){return new URLSearchParams(decodeURIComponent(window.location.search)).get(t)},Ve=function(){function t(){var e;i(this,t),d(this,"bookData",new de),d(this,"pageFlip",null),d(this,"isPageSwapped",!1),d(this,"bookLoaded",!1),e=this.goPage.bind(this),P("GO_PAGE_LOAD",e),function(t){P("GO_PAGE_PREVIOUS",t)}(this.loadPrevPage.bind(this)),function(t){P("GO_PAGE_NEXT",t)}(this.loadNextPage.bind(this)),function(t){P("GET_CURRENT_PAGE_NUMBER",t)}(this.getCurrentPageNumber.bind(this)),function(t){P("GET_PAGE_COUNT",t)}(this.getPageCount.bind(this)),function(t){P("GET_FIRST_PAGE_NUMBER",t)}(this.getStartPageNumber.bind(this)),function(t){P("GET_LAST_PAGE_NUMBER",t)}(this.getLastPageNumber.bind(this))}var n,r;return o(t,[{key:"title",get:function(){return this.bookData.title}},{key:"toc",get:function(){return this.bookData.tocList}},{key:"loadBook",value:(r=e(p().mark((function t(){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bookData.loadBook(g.bookUrl);case 2:this.bookLoaded=!0,console.log("%cbook loaded:","color: #fff",this.bookData);case 4:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"isLeftPageIndex",value:function(t){return t%2==0}},{key:"isRightPageIndex",value:function(t){return!this.isLeftPageIndex(t)}},{key:"goPage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isPageSwapped=!1,!this.pageFlip)return!1;var n=this.getPageIndex(t),i=t;if(g.isDoublePage&&n%2!=0&&(i-=1),this.loadBottomPage(i),e)this.pageFlip.flipNext(_e.BOTTOM,!0);else if(this.getCurrentPageIndex()>n)this.pageFlip.flipPrev(_e.BOTTOM);else if(g.isSinglePage&&this.getCurrentPageIndex()1&&void 0!==arguments[1]&&arguments[1],n=this.bookData.getPageItemWithIndex(t);return!!n&&this.goPage(n.pageNumber,e)}},{key:"isPageNumberAvailable",value:function(t){return this.bookData.isPageNumberAvailable(t)}},{key:"originalPageDirection",value:function(){return this.bookData.getPageIndex()%2!=0}},{key:"getStartPageNumber",value:function(){return this.bookData.getStartPageNumber()}},{key:"getLastPageNumber",value:function(){return this.bookData.getEndPageNumber()}},{key:"getPages",value:function(){return this.bookData.pageList}},{key:"getPageCount",value:function(){return this.bookData.getPageCount()}},{key:"getPageIndex",value:function(t){return this.bookData.getPageIndex(t)}},{key:"getCurrentPage",value:function(){return this.bookData.getCurrentPage()}},{key:"getCurrentPageIndex",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.bookData.getPageIndex();return t&&g.isDoublePage&&!0===this.originalPageDirection()&&(e-=1),e}},{key:"setCurrentPageIndex",value:function(t){this.bookData.setCurrentPageIndex(t)}},{key:"getCurrentPageNumber",value:function(){return this.bookData.getCurrentPageNumber()}},{key:"setCurrentPageNumber",value:function(t){this.bookData.setCurrentPageNumber(t)}},{key:"setCurrentPageNumberToPrev",value:function(){this.bookData.setCurrentPageNumber(this.bookData.getPrevPageNumber())}},{key:"setCurrentPageNumberToNext",value:function(){this.bookData.setCurrentPageNumber(this.bookData.getNextPageNumber())}},{key:"getThumbnailWithIndex",value:function(t){var e=this.bookData.getPageItemWithIndex(t);return e?e.thumbnailUrl:null}},{key:"loadPrevPage",value:function(){this.goPage(this.bookData.getPrevPageNumber())||this.getCurrentPageNumber()<=this.bookData.getStartPageNumber()&&E.addMessageInfo("첫 페이지입니다.")}},{key:"loadNextPage",value:function(){this.goPage(this.bookData.getNextPageNumber())||(this.getCurrentPageNumber()>=this.bookData.getEndPageNumber()||g.isDoublePage&&this.getCurrentPageNumber()>=this.bookData.getEndPageNumber()-1)&&E.addMessageInfo("마지막 페이지입니다.")}},{key:"loadPageWithIndex",value:function(t){var e,n=this.bookData.getPagesWithIndex(t);null===(e=E.pageContainer)||void 0===e||e.loadPages(n)}},{key:"loadPrevBottomPage",value:function(){this.loadBottomPage(this.bookData.getPrevPageNumber())}},{key:"loadNextBottomPage",value:function(){this.loadBottomPage(this.bookData.getNextPageNumber())}},{key:"loadBottomPage",value:function(t){var e,n=this.bookData.getPages(t);null===(e=E.pageContainer)||void 0===e||e.loadBottomPages(n)}},{key:"swapPages",value:function(){var t;null===(t=E.pageContainer)||void 0===t||t.swapPages()}},{key:"reloadBottomPages",value:function(){var t,e;g.forceReloadBottomPage?null===(t=E.pageContainer)||void 0===t||t.resetBottomPages():null===(e=E.pageContainer)||void 0===e||e.reloadPlayingBottomPage()}},{key:"updateUrl",value:function(){var t,e,n;t="page",e=this.getCurrentPageNumber().toString(),(n=new URLSearchParams("".concat(window.location.pathname).concat(window.location.search))).delete(t),n.append(t,e),window.history.replaceState({additionalInformation:"Updated the URL with JS"},"",decodeURIComponent(n.toString()))}},{key:"saveCurrentPage",value:function(){ot(Z,this.getCurrentPage()),this.updateUrl()}},{key:"setDisplayType",value:(n=e(p().mark((function t(e){var n,i,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=E.pageContainer,g.isSinglePage=void 0===e?!g.isSinglePage:e,null==r||r.updateUi(),null===(n=this.pageFlip)||void 0===n||n.update(),null===(i=this.pageFlip)||void 0===i||i.resetCurrentSpreadIndex(),null==r||r.resetPageRefs(),E.updateWindowRatio(),this.goPage(this.getCurrentPageNumber(),!0);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})}]),t}();const ze=new Ve;var Ge,qe=new Uint8Array(16);function $e(){if(!Ge&&!(Ge="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 Ge(qe)}const Ye=/^(?:[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 Xe=function(t){return"string"==typeof t&&Ye.test(t)};for(var Ke=[],Ze=0;Ze<256;++Ze)Ke.push((Ze+256).toString(16).substr(1));const Qe=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase();if(!Xe(n))throw TypeError("Stringified UUID is invalid");return n};const Je=function(t,e,n){var i=(t=t||{}).random||(t.rng||$e)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=i[r];return e}return Qe(i)};var tn;!function(t){t.dandelion="#ffda65",t.pineGlade="#a9d18e",t.mauve="#cb99fe",t.cerulean="#00b0f0",t.tacao="#f4b183"}(tn||(tn={}));var en=function(){function t(){i(this,t)}return o(t,[{key:"makeId",value:function(){return Je()}}]),t}();function nn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return rn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rn(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function rn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function cn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);no?(this.zoomRate=o,this.hCenter&&(this.left=(e-i.width*this.zoomRate)/2)):(this.zoomRate=r,this.left+=this.hPadding,this.vCenter&&(this.top=(n-i.height*this.zoomRate)/2)),E.globalZoomRate=this.zoomRate}}]),n}(V);var bn=function(){function t(e,n){i(this,t),this.callback=n,e.addEventListener("touchstart",this.handleTouchStart.bind(this),!1),e.addEventListener("touchmove",this.handleTouchMove.bind(this),!1),e.addEventListener("touchend",this.handleTouchEnd.bind(this),!1),e.addEventListener("mousedown",this.handleTouchStart.bind(this),!1),e.addEventListener("mousemove",this.handleTouchMove.bind(this),!1),e.addEventListener("mouseup",this.handleTouchEnd.bind(this),!1)}return o(t,[{key:"getPoint",value:function(t){var e=t.clientX||t.changedTouches[0].clientX,n=t.clientY||t.changedTouches[0].clientY;return new C(e,n)}}]),t}();function En(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var kn=function(t){s(n,t);var e=En(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,r)),"threshold",150),d(l(o),"restraint",100),d(l(o),"allowedTime",300),d(l(o),"swipeDirection","none"),d(l(o),"startPos",C.defaultPoint),d(l(o),"distPos",C.defaultPoint),d(l(o),"startTime",0),d(l(o),"elapsedTime",0),o}return o(n,[{key:"handleTouchStart",value:function(t){var e=this.getPoint(t);this.swipeDirection="none",this.startPos=e,this.distPos=C.defaultPoint,this.startTime=(new Date).getTime()}},{key:"handleTouchMove",value:function(t){}},{key:"handleTouchEnd",value:function(t){var e=this.getPoint(t);this.distPos.x=e.x-this.startPos.x,this.distPos.y=e.y-this.startPos.y,this.elapsedTime=(new Date).getTime()-this.startTime,this.elapsedTime<=this.allowedTime&&(Math.abs(this.distPos.x)>=this.threshold&&Math.abs(this.distPos.y)<=this.restraint?this.swipeDirection=this.distPos.x<0?"left":"right":Math.abs(this.distPos.y)>=this.threshold&&Math.abs(this.distPos.x)<=this.restraint&&(this.swipeDirection=this.distPos.y<0?"up":"down")),"none"!==this.swipeDirection&&this.callback(this.swipeDirection)}}]),n}(bn),Pn=function(){function t(){i(this,t),d(this,"id",0)}return o(t,[{key:"trigger",value:function(t,e){var n=this;this.clear(),this.id=window.setTimeout((function(){n.clear(),e()}),t)}},{key:"clear",value:function(){this.id&&(window.clearTimeout(this.id),this.id=0)}}]),t}();function Sn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var In=function(t){s(n,t);var e=Sn(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,r)),"timeThreshold",30),d(l(o),"prevDistance",0),d(l(o),"prevScale",1),d(l(o),"prevTime",0),d(l(o),"start",!1),o}return o(n,[{key:"handleTouchStart",value:function(t){var e=this.getDistanceBetweenPoint(t);0!==e&&(this.prevDistance=e,this.prevScale=1,this.prevTime=t.timeStamp,this.start=!0)}},{key:"handleTouchMove",value:function(t){if(this.start){var e=this.getDistanceBetweenPoint(t),n=e/this.prevDistance*this.prevScale;if(n<1&&(n=1),t.timeStamp-this.prevTime>this.timeThreshold){var i=n-this.prevScale;this.callback(n,Number.isNaN(i)?0:i),this.prevDistance=e,this.prevScale=n,this.prevTime=t.timeStamp}}}},{key:"handleTouchEnd",value:function(t){this.start=!1}},{key:"getDistanceBetweenPoint",value:function(t){if(t.touches&&2===t.touches.length){var e=t.touches[0],n=t.touches[1];return this.getDistance(e.clientX,e.clientY,n.clientX,n.clientY)}return 0}},{key:"getDistance",value:function(t,e,n,i){var r=n-t,o=i-e;return Math.sqrt(r*r+o*o)}}]),n}(bn);function Tn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var xn=function(t){s(u,t);var n,r,a=Tn(u);function u(t,e,n,r,o){var s;return i(this,u),d(l(s=a.call(this,t,'
')),"delayTimeout",new Pn),d(l(s),"pageIndex",0),d(l(s),"url",""),d(l(s),"timestamp",0),d(l(s),"resetTimerId",0),d(l(s),"resetResolve",null),d(l(s),"pageLoadTimerId",0),d(l(s),"pageLoadResolve",null),d(l(s),"swipe",null),d(l(s),"press",null),d(l(s),"pinch",null),s.swipeCallback=e,s.pressCallback=n,s.pinchCallback=r,s.doubleClickCallback=o,s.iframeElement=s.child("iframe"),s.iframeElement.addEventListener("load",s.onIframeLoad.bind(l(s))),function(t,e){var n=function(){var n,i,r=null!==(n=null===(i=t.contentWindow)||void 0===i?void 0:i.location.href)&&void 0!==n?n:null;e(r)},i=function(){setTimeout(n,0)};function r(){var e,n;null===(e=t.contentWindow)||void 0===e||e.removeEventListener("unload",i),null===(n=t.contentWindow)||void 0===n||n.addEventListener("unload",i)}t.addEventListener("load",(function(){r(),n()})),r()}(s.iframeElement,(function(t){s.silenceIframeConsole()})),s.updateUi(),s}return o(u,[{key:"divider",get:function(){return this.child("#divider")}},{key:"updateUi",value:function(){var t=this,e=this.children(".corner");e.forEach((function(e){var n=60/E.globalZoomRate;t.setSize(n,n,e)}))}},{key:"resetUi",value:function(){this.setDisplay(!1),this.setOn(!1)}},{key:"finishUi",value:function(){var t=this;this.setOn(),this.delayTimeout.trigger(500,(function(){return t.setDisplay()}))}},{key:"resetPage",value:function(){this.iframeElement.src="about:blank",this.resetUi()}},{key:"finishPage",value:function(){this.finishUi()}},{key:"isUrlEqual",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)return this.iframeElement.src===t;for(var n=this.iframeElement.src.split("/"),i=t?t.split("/"):[],r=1;r<=3;r++)if(n[n.length-r]!==i[i.length-r])return!1;return!0}},{key:"getScriptElementCount",value:(r=e(p().mark((function t(e){var n,i,r,o;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=0,t.prev=1,t.next=4,K(this.url,!0);case 4:i=t.sent,r=i.HTML.HEAD[0].SCRIPT,o=i.HTML.BODY[0].SCRIPT,r&&(n+=r.length),o&&(n+=o.length),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),console.error(t.t0);case 14:return t.abrupt("return",n);case 15:case"end":return t.stop()}}),t,this,[[1,11]])}))),function(t){return r.apply(this,arguments)})},{key:"loadPage",value:(n=e(p().mark((function t(e,n){var i,r,o=this;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.timestamp=performance.now(),window.clearInterval(this.resetTimerId),window.clearInterval(this.pageLoadTimerId),this.resetResolve&&this.resetResolve(),this.pageLoadResolve&&this.pageLoadResolve(),this.url=e,this.pageIndex=n,i===this.timestamp){t.next=9;break}return t.abrupt("return");case 9:return t.next=11,this.getScriptElementCount(this.url);case 11:if(r=t.sent,i===this.timestamp){t.next=14;break}return t.abrupt("return");case 14:if(this.iframeElement.src=this.url,i===this.timestamp){t.next=17;break}return t.abrupt("return");case 17:return t.abrupt("return",new Promise((function(t){o.pageLoadResolve=t;var e=0,n=function(e){window.clearInterval(e),t(),o.onLoadEnd()},i=o.pageLoadTimerId=window.setInterval((function(){var t=o.iframeElement.contentWindow;t&&t.document&&(o.onLoadStart(),"none"===g.pageShowMode&&n(i),t.document.querySelectorAll("script").length>=r&&n(i)),(e+=100)>500&&n(i)}),100)})));case 18:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"onLoadStart",value:function(){this.silenceIframeConsole()}},{key:"onLoadEnd",value:function(){this.initAnnotation(),this.url=""}},{key:"onIframeLoad",value:function(){this.silenceIframeConsole(),this.addStyle(),this.addGesture(),this.addListener()}},{key:"initAnnotation",value:function(){mn.assignPageInputData(this.iframeElement,this.pageIndex),mn.addPageInputListener(this.iframeElement,this.pageIndex),mn.addHighlightListener(this.iframeElement)}},{key:"addStyle",value:function(){var t=this.iframeElement.contentWindow;t&&t.document.styleSheets[0]&&g.usePinchZoom&&t.document.styleSheets[0].insertRule("* { touch-action: none; }")}},{key:"addGesture",value:function(){var t=this.iframeElement.contentWindow;t&&(this.swipe=new kn(t,this.swipeCallback),g.usePinchZoom&&(this.pinch=new In(t,this.pinchCallback)))}},{key:"addListener",value:function(){var t=this.iframeElement.contentWindow;t&&(t.addEventListener("keydown",(function(t){"ArrowLeft"===t.key?ze.loadPrevPage():"ArrowRight"===t.key&&ze.loadNextPage()})),t.addEventListener("dblclick",this.doubleClickCallback))}},{key:"silenceIframeConsole",value:function(){if(!g.enableContentLog){var t=this.iframeElement.contentWindow,e=function(){};t&&t.console.log!==e&&(t.console.assert=e,t.console.clear=e,t.console.debug=e,t.console.error=e,t.console.info=e,t.console.log=e,t.console.table=e,t.console.trace=e,t.console.warn=e,t.console.dir=e,t.console.dirxml=e,t.console.count=e,t.console.countReset=e,t.console.group=e,t.console.groupCollapsed=e,t.console.groupEnd=e,t.console.time=e,t.console.timeLog=e,t.console.timeEnd=e)}}},{key:"showPageDivider",value:function(){var t;this.setEnable(!0,null!==(t=this.divider)&&void 0!==t?t:void 0)}},{key:"hidePageDivider",value:function(){var t;this.setEnable(!1,null!==(t=this.divider)&&void 0!==t?t:void 0)}}]),u}(V);function Cn(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}function Dn(){return Dn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=Cn(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?t:n):r.value}},Dn.apply(this,arguments)}const On=' ';function Rn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Ln=function(t){s(n,t);var e=Rn(n);function n(t){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;i(this,n),d(l(r=e.call(this,t,On)),"callbackInput",null),d(l(r),"callbackChange",null),r.callbackChange=c,r.callbackInput=u;var h=r.inputElement;return h&&(h.value=s.toString(),h.min=o.toString(),h.max=a.toString()),r.addListener(),r.updateUi(),r}return o(n,[{key:"inputElement",get:function(){return this.child("#slider-input")}},{key:"thumbCenterX",get:function(){var t=this.inputElement;if(t){var e=M(t.value),n=M(t.min),i=(e-n)/(M(t.max)-n),r=t.getBoundingClientRect(),o=i*(r.width-25);return r.x+o+12.5}return 0}},{key:"value",set:function(t){this.inputElement&&(this.inputElement.value=t.toString(),this.updateUi())}},{key:"updateUi",value:function(){var t=this.inputElement;if(t){var e=M(t.value),n=M(t.min),i=(e-n)/(M(t.max)-n)*100;t.style.background="linear-gradient(to right, #39c, #57e ".concat(i,"%, #def ").concat(i,"%, #eee 100%)")}}},{key:"addListener",value:function(){var t=this,e=this.inputElement;null==e||e.addEventListener("input",(function(e){if(t.updateUi(),t.callbackInput){var n=e.target.value;t.callbackInput(M(n))}})),null==e||e.addEventListener("change",(function(e){if(t.updateUi(),t.callbackChange){var n=e.target.value;t.callbackChange(M(n))}})),null==e||e.addEventListener("lostpointercapture",(function(e){if(t.updateUi(),t.callbackChange){var n=e.target.value;t.callbackChange(M(n))}}))}},{key:"setVertical",value:function(){this.addClass("--vertical")}},{key:"setStep",value:function(t){this.inputElement&&(this.inputElement.step=t.toString())}}]),n}(V);function An(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var _n=function(t){s(n,t);var e=An(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,r)),"prevPoint",null),o}return o(n,[{key:"handleTouchStart",value:function(t){var e=t;e.touches&&e.touches.length>1||(this.prevPoint=this.getPoint(t))}},{key:"handleTouchMove",value:function(t){var e=t;if(!(e.touches&&e.touches.length>1)&&this.prevPoint){var n=this.getPoint(t),i=new C(this.prevPoint.x-n.x,this.prevPoint.y-n.y);this.callback(i,t),this.prevPoint=n}}},{key:"handleTouchEnd",value:function(t){this.prevPoint=null}}]),n}(bn);function Mn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Nn=function(t){s(n,t);var e=Mn(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,"scale",'
100%
',{parentElement:t,className:"scale-host"})),"rangeSlider",null),d(l(r),"viewerWrapperComponent",E.viewerWrapper),d(l(r),"pan",null),d(l(r),"pinch",null),r.addListener(),r.updateUi(),r}return o(n,[{key:"panAreaElement",get:function(){return this.child("#pan-area")}},{key:"controllerElement",get:function(){return this.child("#scale-control")}},{key:"zoomInElement",get:function(){return this.child("#zoom-in")}},{key:"zoomOutElement",get:function(){return this.child("#zoom-out")}},{key:"scaleValueElement",get:function(){return this.child("#scale-value")}},{key:"scaleModeElement",get:function(){return this.child("#scale-mode-button")}},{key:"onInputSlider",value:function(t){this.viewerWrapperComponent.scaleValue=t/10,this.viewerWrapperComponent.applyScale(),this.setScaleValueElement()}},{key:"onChangeSlider",value:function(t){}},{key:"updateUi",value:function(){this.setComponentRect()}},{key:"append",value:function(){var t;Dn(h(n.prototype),"append",this).call(this),null===(t=E.getComponent("default-menu-scale"))||void 0===t||t.setPressed(!0);var e=this.viewerWrapperComponent.scaleMin,i=this.viewerWrapperComponent.scaleMax,r=this.viewerWrapperComponent.scaleValue;this.rangeSlider=new Ln("scale-slider",10*e,10*i,10*r,this.onInputSlider.bind(this),this.onChangeSlider.bind(this)),this.rangeSlider.addClass("range-slider-host"),this.setOptionPan(!0)}},{key:"destroy",value:function(){var t,e,i;null===(t=this.rangeSlider)||void 0===t||t.destroy(),null===(e=this.viewerWrapperComponent)||void 0===e||e.resetOuterBookScale(),null===(i=E.getComponent("default-menu-scale"))||void 0===i||i.setPressed(!1),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"addListener",value:function(){var t,e,n,i=this;this.panAreaElement&&(this.pan=new _n(this.panAreaElement,(function(t){i.viewerWrapperComponent.applyScale(t)})),g.usePinchZoom&&(this.pinch=new In(this.panAreaElement,(function(t,e){e?i.increaseScale():i.decreaseScale()}))),this.panAreaElement.addEventListener("dblclick",(function(){return i.destroy()}))),null===(t=this.zoomInElement)||void 0===t||t.addEventListener("click",(function(){return i.increaseScale()})),null===(e=this.zoomOutElement)||void 0===e||e.addEventListener("click",(function(){return i.decreaseScale()})),null===(n=this.scaleModeElement)||void 0===n||n.addEventListener("click",(function(){i.hasClass("--pan")?i.setOptionPan(!1):i.setOptionPan()}))}},{key:"increaseScale",value:function(){this.viewerWrapperComponent.increaseScaleValue(),this.applyScale()}},{key:"decreaseScale",value:function(){this.viewerWrapperComponent.decreaseScaleValue(),this.applyScale()}},{key:"setScale",value:function(t){this.viewerWrapperComponent.setScaleValue(t),this.applyScale()}},{key:"applyScale",value:function(){this.viewerWrapperComponent.applyScale(),this.applyRangeSlider(),this.setScaleValueElement()}},{key:"setOptionPan",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.removeClass("--pan"),this.removeClass("--study"),t?(this.addClass("--pan"),e&&E.addMessageInfo("화면 드래그 모드",2e3)):(this.addClass("--study"),e&&E.addMessageInfo("콘텐츠 사용 모드",2e3))}},{key:"setComponentRect",value:function(){this.setPoint(this.viewerWrapperComponent.outerBookOriginalLeft,this.viewerWrapperComponent.outerBookOriginalTop),this.setSize(this.viewerWrapperComponent.outerBookOriginalWidth,this.viewerWrapperComponent.outerBookOriginalHeight)}},{key:"setScaleValueElement",value:function(){var t="".concat(Math.floor(100*this.viewerWrapperComponent.scaleValue),"%");this.setHtml(t,this.scaleValueElement)}},{key:"applyRangeSlider",value:function(){this.rangeSlider&&(this.rangeSlider.value=10*this.viewerWrapperComponent.scaleValue)}}],[{key:"toggle",value:function(){E.getComponent("scale")?n.destroy():n.append()}},{key:"append",value:function(){if(!E.getComponent("scale")){var t=E.appComponent;if(t)new n(t.element).append()}}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("scale"))||void 0===t||t.destroy()}}]),n}(V);function Bn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Un(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Un(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Un(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n
'),new xn("left-page",e.onSwipe,e.onPress,e.onPinch,e.onDoubleClick),new xn("right-page",e.onSwipe,e.onPress,e.onPinch,e.onDoubleClick),new xn("left-bottom-page",e.onSwipe,e.onPress,e.onPinch,e.onDoubleClick),new xn("right-bottom-page",e.onSwipe,e.onPress,e.onPinch,e.onDoubleClick),e.leftPageComponent=E.getComponent("left-page"),e.rightPageComponent=E.getComponent("right-page"),e.leftBottomPageComponent=E.getComponent("left-bottom-page"),e.rightBottomPageComponent=E.getComponent("right-bottom-page"),e.currentLeftPageComponent=e.leftPageComponent,e.currentRightPageComponent=e.rightPageComponent,e.bottomLeftPageComponent=e.leftBottomPageComponent,e.bottomRightPageComponent=e.rightBottomPageComponent,e.addClass("--bottom",e.bottomLeftPageComponent.element),e.addClass("--bottom",e.bottomRightPageComponent.element),e.addListener(),e}return o(c,[{key:"pages",get:function(){return[this.currentLeftPageComponent,this.currentRightPageComponent,this.bottomLeftPageComponent,this.bottomRightPageComponent]}},{key:"onSwipe",value:function(t){g.pageSwipe&&("right"===t?ze.loadPrevPage():"left"===t&&ze.loadNextPage())}},{key:"onPress",value:function(t,e){"pressed"===t?mn.startHighlight(e):"start"===t&&mn.hideHighlightBox()}},{key:"onPinch",value:function(t,e){var n=E.getComponent("scale");n||(Nn.append(),n=E.getComponent("scale")),e?n.increaseScale():n.decreaseScale()}},{key:"onDoubleClick",value:function(){var t=E.getComponent("scale");t?t.destroy():(Nn.append(),(t=E.getComponent("scale")).setScale(1.5))}},{key:"updateUi",value:function(){this.fitSize(),this.leftPageComponent.updateUi(),this.rightPageComponent.updateUi(),this.leftBottomPageComponent.updateUi(),this.rightBottomPageComponent.updateUi()}},{key:"loadPages",value:(u=e(p().mark((function t(e){var n,i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.currentLeftPageComponent,i=this.currentRightPageComponent,t.next=4,this.loadBothPages(e,n,i);case 4:this.updateUi();case 5:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"loadBottomPages",value:(a=e(p().mark((function t(e){var n,i,r,o,a,s,u;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=g.strictPageReload,s=this.bottomLeftPageComponent,u=this.bottomRightPageComponent,!s.isUrlEqual(null!==(n=null===(i=e[0])||void 0===i?void 0:i.pageUrl)&&void 0!==n?n:null,a)||!u.isUrlEqual(null!==(r=null===(o=e[1])||void 0===o?void 0:o.pageUrl)&&void 0!==r?r:null,a)){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,this.loadBothPages(e,s,u);case 7:this.updateUi();case 8:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"addListener",value:function(){window.addEventListener("keydown",(function(t){"ArrowLeft"===t.key?ze.loadPrevPage():"ArrowRight"===t.key&&ze.loadNextPage()}))}},{key:"loadBothPages",value:(r=e(p().mark((function t(e,n,i){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.resetUi(),i.resetUi(),!e[0]){t.next=6;break}return t.next=5,this.loadPage(e[0],n);case 5:"half-loaded"===g.pageShowMode&&this.leftPageComponent.finishPage();case 6:if(!g.isSinglePage){t.next=10;break}this.finishPages(n,i),t.next=14;break;case 10:if(!e[1]){t.next=13;break}return t.next=13,this.loadPage(e[1],i);case 13:this.finishPages(n,i);case 14:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"loadPage",value:(n=e(p().mark((function t(e,n){var i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=ze.getPageIndex(e.pageNumber),t.next=3,n.loadPage(e.pageUrl,i);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)}))),function(t,e){return n.apply(this,arguments)})},{key:"resetAllPage",value:function(){this.resetPages(this.currentLeftPageComponent,this.currentRightPageComponent),this.resetPages(this.bottomLeftPageComponent,this.bottomRightPageComponent)}},{key:"resetBottomPages",value:function(){this.resetPages(this.bottomLeftPageComponent,this.bottomRightPageComponent)}},{key:"resetPages",value:function(t,e){t.resetPage(),e.resetPage()}},{key:"finishPages",value:function(t,e){t.finishPage(),e.finishPage()}},{key:"swapPages",value:function(){this.currentLeftPageComponent===this.leftPageComponent&&this.currentRightPageComponent===this.rightPageComponent?(this.currentLeftPageComponent=this.leftBottomPageComponent,this.currentRightPageComponent=this.rightBottomPageComponent,this.bottomLeftPageComponent=this.leftPageComponent,this.bottomRightPageComponent=this.rightPageComponent):this.currentLeftPageComponent===this.leftBottomPageComponent&&this.currentRightPageComponent===this.rightBottomPageComponent&&this.resetPageRefs(),this.removeClass("--bottom",this.currentLeftPageComponent.element),this.removeClass("--bottom",this.currentRightPageComponent.element),this.addClass("--bottom",this.bottomLeftPageComponent.element),this.addClass("--bottom",this.bottomRightPageComponent.element)}},{key:"resetPageRefs",value:function(){this.currentLeftPageComponent=this.leftPageComponent,this.currentRightPageComponent=this.rightPageComponent,this.bottomLeftPageComponent=this.leftBottomPageComponent,this.bottomRightPageComponent=this.rightBottomPageComponent}},{key:"fitSize",value:function(){this.setSize(g.computedPageWidth,g.pageHeight)}},{key:"stopAllMedia",value:function(){this.stopMedia(this.currentLeftPageComponent),this.stopMedia(this.currentRightPageComponent),this.stopMedia(this.bottomLeftPageComponent),this.stopMedia(this.bottomRightPageComponent)}},{key:"stopMedia",value:function(t){var e,n,i=null===(e=t.iframeElement.contentWindow)||void 0===e?void 0:e.document;(null!==(n=null==i?void 0:i.querySelectorAll("audio, video"))&&void 0!==n?n:[]).forEach((function(t){t.pause(),t.currentTime=0}))}},{key:"reloadPlayingBottomPage",value:function(){this.reloadPlayingPage(this.bottomLeftPageComponent),this.reloadPlayingPage(this.bottomRightPageComponent)}},{key:"reloadPlayingPage",value:function(t){var e,n,i,r=null===(e=t.iframeElement.contentWindow)||void 0===e?void 0:e.document,o=Bn(Array.from(null!==(n=null==r?void 0:r.querySelectorAll("audio, video"))&&void 0!==n?n:[]));try{for(o.s();!(i=o.n()).done;){var a=i.value;if(!a.paused||a.currentTime){var s;null===(s=t.iframeElement.contentWindow)||void 0===s||s.location.reload();break}}}catch(t){o.e(t)}finally{o.f()}}}]),c}(V);function Wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Hn=function(t){s(n,t);var e=Wn(n);function n(t,r){return i(this,n),e.call(this,t,r)}return o(n)}(V);function Vn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var zn=function(t){s(n,t);var e=Vn(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,'
',{parentElement:r,className:"drawing-menu-host"})),"dragElementHeight",26),d(l(o),"lineTypeCount",3),d(l(o),"colorCount",8),d(l(o),"viewerWrapperComponent",E.viewerWrapper),d(l(o),"currentLineTypeIndex",0),d(l(o),"currentColorIndex",0),d(l(o),"currentToolIndex",0),d(l(o),"isDrag",!1),d(l(o),"outerBookPoint",C.defaultPoint),d(l(o),"outerBookSize",x.defaultSize),d(l(o),"hostSize",x.defaultSize),d(l(o),"clearTimeout",new Pn),d(l(o),"functionDragMove",o.onDragMove.bind(l(o))),d(l(o),"functionDragEnd",o.onDragEnd.bind(l(o))),o.initListener(),o.updateUi(),o}return o(n,[{key:"dragElement",get:function(){return this.child("#drag")}},{key:"lineTypeElement",get:function(){return this.child("#type")}},{key:"colorElement",get:function(){return this.child("#color")}},{key:"penElement",get:function(){return this.child("#pen")}},{key:"eraserElement",get:function(){return this.child("#eraser")}},{key:"clearElement",get:function(){return this.child("#clear")}},{key:"lineWidth",get:function(){if(1===this.currentToolIndex)return 50;switch(this.currentLineTypeIndex){case 1:return 16;case 2:return 8;default:return 2}}},{key:"color",get:function(){switch(this.currentColorIndex){case 0:return"#cc0000";case 1:return"#e69138";case 2:return"#f1c233";case 3:return"#6aa84f";case 4:return"#a64d79";case 5:return"#674ea7";case 6:return"#3983c5";default:return"#000"}}},{key:"compositeOperation",get:function(){return 0===this.currentToolIndex&&1===this.currentLineTypeIndex?"xor":1===this.currentToolIndex?"destination-out":"source-over"}},{key:"initListener",value:function(){var t,e,n,i,r,o,a,s=this;null===(t=this.dragElement)||void 0===t||t.addEventListener("mousedown",this.onDragStart.bind(this),!1),null===(e=this.dragElement)||void 0===e||e.addEventListener("touchstart",this.onDragStart.bind(this),!1),window.addEventListener("mousemove",this.functionDragMove,!1),window.addEventListener("touchmove",this.functionDragMove,!1),window.addEventListener("mouseup",this.functionDragEnd,!1),window.addEventListener("touchend",this.functionDragEnd,!1),null===(n=this.lineTypeElement)||void 0===n||n.addEventListener("click",(function(){s.currentLineTypeIndex=s.increaseIndex(s.currentLineTypeIndex,s.lineTypeCount),s.setLineType(s.currentLineTypeIndex)})),null===(i=this.colorElement)||void 0===i||i.addEventListener("click",(function(){s.currentColorIndex=s.increaseIndex(s.currentColorIndex,s.colorCount),s.setColor(s.currentColorIndex)})),null===(r=this.penElement)||void 0===r||r.addEventListener("click",(function(){return s.setToolPen()})),null===(o=this.eraserElement)||void 0===o||o.addEventListener("click",(function(){return s.setToolEraser()})),null===(a=this.clearElement)||void 0===a||a.addEventListener("click",(function(){return s.setToolClear()}))}},{key:"removeListener",value:function(){window.removeEventListener("mousemove",this.functionDragMove,!1),window.removeEventListener("touchmove",this.functionDragMove,!1),window.removeEventListener("mouseup",this.functionDragEnd,!1),window.removeEventListener("touchend",this.functionDragEnd,!1)}},{key:"onDragStart",value:function(){this.isDrag=!0,this.refreshRectData()}},{key:"onDragMove",value:function(t){if(this.isDrag){var e=D(t);e&&(this.correctEventPoint(e),this.restrainBorder(e),this.setPoint(null==e?void 0:e.x,e.y))}}},{key:"onDragEnd",value:function(){this.isDrag=!1}},{key:"updateUi",value:function(){this.setLineTypePlain(),this.setColor(0),this.setToolPen(),this.refreshRectData(),this.setPoint(this.outerBookPoint.x+5,(this.outerBookSize.height-this.hostSize.height)/2+this.outerBookPoint.y)}},{key:"append",value:function(){var t;Dn(h(n.prototype),"append",this).call(this),this.updateUi(),E.enableBook(!1,this.id),null===(t=E.drawingCanvas)||void 0===t||t.setEnable()}},{key:"destroy",value:function(){var t;E.enableBook(!0,this.id),null===(t=E.drawingCanvas)||void 0===t||t.setEnable(!1),this.removeListener(),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"refreshRectData",value:function(){var t,e,n,i;this.outerBookPoint.x=null===(t=this.viewerWrapperComponent)||void 0===t?void 0:t.outerBookOriginalLeft,this.outerBookPoint.y=null===(e=this.viewerWrapperComponent)||void 0===e?void 0:e.outerBookOriginalTop,this.outerBookSize.width=null===(n=this.viewerWrapperComponent)||void 0===n?void 0:n.outerBookOriginalWidth,this.outerBookSize.height=null===(i=this.viewerWrapperComponent)||void 0===i?void 0:i.outerBookOriginalHeight,this.element&&(this.hostSize.width=this.element.getBoundingClientRect().width,this.hostSize.height=this.element.getBoundingClientRect().height)}},{key:"increaseIndex",value:function(t,e){var n=t+1;return n>=e?0:n}},{key:"correctEventPoint",value:function(t){return t.x-=this.hostSize.width/2,t.y-=this.dragElementHeight/2,t}},{key:"restrainBorder",value:function(t){return t.xthis.outerBookPoint.x+this.outerBookSize.width&&(t.x=this.outerBookPoint.x+this.outerBookSize.width-this.hostSize.width),t.y+this.hostSize.height>this.outerBookPoint.y+this.outerBookSize.height&&(t.y=this.outerBookPoint.y+this.outerBookSize.height-this.hostSize.height),t}},{key:"setLineType",value:function(t){switch(t){case 0:this.setLineTypePlain();break;case 1:this.setLineTypeHighlight();break;case 2:this.setLineTypeThick()}}},{key:"setLineTypePlain",value:function(){this.setClassLineType("plain")}},{key:"setLineTypeHighlight",value:function(){this.setClassLineType("highlight")}},{key:"setLineTypeThick",value:function(){this.setClassLineType("thick")}},{key:"setColor",value:function(t){this.setClassColor(t)}},{key:"setToolPen",value:function(){this.currentToolIndex=0,this.setClassTool("pen")}},{key:"setToolEraser",value:function(){this.currentToolIndex=1,this.setClassTool("eraser")}},{key:"setToolClear",value:function(){var t=this;this.currentToolIndex=2,this.setClassTool("clear");var e=E.drawingCanvas;e&&e.remove(),this.clearTimeout.trigger(100,(function(){return t.setToolPen()}))}},{key:"setClassLineType",value:function(t){this.removeClassByPrefix("--type-"),"plain"===t?this.addClass("--type-plain"):"highlight"===t?this.addClass("--type-highlight"):"thick"===t&&this.addClass("--type-thick")}},{key:"setClassColor",value:function(t){this.removeClassByPrefix("--color-"),this.addClass("--color-".concat(t))}},{key:"setClassTool",value:function(t){this.removeClassByPrefix("--tool-"),"pen"===t?this.addClass("--tool-pen"):"eraser"===t?this.addClass("--tool-eraser"):"clear"===t&&this.addClass("--tool-clear")}}],[{key:"toggle",value:function(){E.getComponent("drawing-menu")?n.destroy():n.append()}},{key:"append",value:function(){var t=E.appComponent;t&&new n("drawing-menu",t).append()}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("drawing-menu"))||void 0===t||t.destroy()}}]),n}(V);function Gn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var qn=function(t){s(n,t);var e=Gn(n);function n(t,r,o,a,s,u){var c;return i(this,n),d(l(c=e.call(this,t,'
',{parentElement:o,className:"".concat(r," panel-host")})),"baseElement",null),d(l(c),"toolbarElement",null),d(l(c),"closeElement",null),d(l(c),"titleElement",null),d(l(c),"iconElement",null),d(l(c),"textElement",null),d(l(c),"contentElement",null),c.initElement(),c.initTitle(a,s),c.initContent(u),c.initListener(),c.updateUi(),c}return o(n,[{key:"toolbarHeight",get:function(){return this.toolbarElement?this.toolbarElement.getBoundingClientRect().height:0}},{key:"titleHeight",get:function(){return this.titleElement?this.titleElement.getBoundingClientRect().height:0}},{key:"initElement",value:function(){this.baseElement=this.child(".base"),this.toolbarElement=this.child(".toolbar"),this.closeElement=this.child(".toolbar>#close"),this.titleElement=this.child(".title"),this.iconElement=this.child(".title>#icon"),this.textElement=this.child(".title>#text"),this.contentElement=this.child("#content")}},{key:"initTitle",value:function(t,e){this.iconElement&&(this.iconElement.src=e),this.setHtml(t,this.textElement)}},{key:"initContent",value:function(t){this.setHtml(t,this.contentElement)}},{key:"initListener",value:function(){var t,e=this;window.addEventListener("resize",this.onResize.bind(this)),null===(t=this.closeElement)||void 0===t||t.addEventListener("click",(function(){return e.destroy()}))}},{key:"updateUi",value:function(){this.getScreenOrientationPortrait()?this.setCss("left","0",this.baseElement):this.setCss("left","50%",this.baseElement)}},{key:"onResize",value:function(t){this.updateUi()}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this),E.enableBook(!1,this.id)}},{key:"destroy",value:function(){E.enableBook(!0,this.id),Dn(h(n.prototype),"destroy",this).call(this)}}]),n}(V);function $n(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Yn=function(t){s(n,t);var e=$n(n);function n(t,r,o,a,s,u){var l;return i(this,n),(l=e.call(this,t,'
',{parentElement:o,className:"".concat(r," search-item-host")})).pageNumber=s,l.text=u,l.imageElement&&(l.imageElement.src=a),l.setHtml(s.toString(),l.pageNumberElement),l.addListener(),l.updateUi(),l}return o(n,[{key:"width",get:function(){return g.panelThumbnailSize+2*g.panelThumbnailMargin}},{key:"imageElement",get:function(){return this.child("#search-image")}},{key:"pageNumberElement",get:function(){return this.child("#search-page-number")}},{key:"summaryElement",get:function(){return this.child("#summary")}},{key:"updateUi",value:function(){this.setMargin(g.panelThumbnailMargin)}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this)}},{key:"destroy",value:function(){Dn(h(n.prototype),"destroy",this).call(this)}},{key:"addListener",value:function(){var t,e,n=this;null===(t=this.element)||void 0===t||t.addEventListener("click",(function(){return n.goPage(n.pageNumber)})),null===(e=this.imageElement)||void 0===e||e.addEventListener("load",(function(t){var e=t.target,i=e.width,r=e.height,o=i/r,a=g.panelThumbnailSize;o>0?(i=a,r=a/o):(i=a/o,r=a),n.setSize(i,r,e),n.setSize(null,r,n.summaryElement),n.setHtml(n.text,n.summaryElement)}))}},{key:"goPage",value:function(t){E.getComponent("search-panel").destroy(),ze.goPage(t)}}]),n}(V);function Xn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Kn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kn(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Kn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n
')),"actionHeight",50),d(l(e),"searchItemList",[]),d(l(e),"searchLoopStarted",!1),d(l(e),"cancelSearch",!1),d(l(e),"waitTimeoutIds",[]),e.tempDiv=e.createElement("temp-div","temp-div"),e.addListener(),e}return o(a,[{key:"actionsElement",get:function(){return this.child(".base>.content>.actions")}},{key:"bodyElement",get:function(){return this.child(".base>.content>.body")}},{key:"searchInputElement",get:function(){return this.child(".base>.content>.actions>.search>.search-text")}},{key:"searchButtonElement",get:function(){return this.child(".base>.content>.actions>.search>.search-button")}},{key:"summaryElement",get:function(){return this.child(".base>.content>.actions>.summary")}},{key:"actionsHeight",get:function(){return this.actionsElement?this.actionsElement.getBoundingClientRect().height:0}},{key:"updateUi",value:function(){Dn(h(a.prototype),"updateUi",this).call(this)}},{key:"append",value:function(){Dn(h(a.prototype),"append",this).call(this),this.setContentSize()}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("default-menu-search"))||void 0===t||t.setPressed(!1),this.waitTimeoutIds.forEach((function(t){t&&window.clearInterval(t)})),this.searchItemList.forEach((function(t){return t.destroy()})),this.searchItemList=[],Dn(h(a.prototype),"destroy",this).call(this)}},{key:"addListener",value:function(){var t,e,n,i=this;null===(t=this.searchButtonElement)||void 0===t||t.addEventListener("click",this.startSearch.bind(this)),null===(e=this.searchInputElement)||void 0===e||e.addEventListener("input",(function(){i.startSearch()})),null===(n=this.searchInputElement)||void 0===n||n.addEventListener("keyup",(function(t){"Enter"===t.key&&(t.preventDefault(),i.startSearch())}))}},{key:"setContentSize",value:function(){if(this.baseElement){var t=window.getComputedStyle(this.baseElement),e=_(t.height)-2*_(t.padding)-this.toolbarHeight-this.titleHeight-this.actionsHeight;this.setSize(null,e,this.bodyElement)}}},{key:"setSummary",value:function(t){var e=this.searchItemList.length,n="";n+='\''.concat(t,"'"),n+="의 검색결과가 총 ",n+=''.concat(e,""),n+="건 있습니다.",this.setHtml(n,this.summaryElement)}},{key:"addSearchItme",value:function(t,e){if(this.bodyElement){var n=t.pageNumber,i=t.thumbnailUrl,r=new Yn("search-index-".concat(t.pageNumber),"",this.bodyElement,i,n,e);r.append(),this.searchItemList.push(r)}}},{key:"startSearch",value:function(){var t,n,i=this;this.stopSearch();var r=null!==(t=null===(n=this.searchInputElement)||void 0===n?void 0:n.value)&&void 0!==t?t:"";if(r.length<2)return this.searchItemList.forEach((function(t){return t.destroy()})),void(this.searchItemList=[]);var o=window.setInterval(e(p().mark((function t(){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i.waitTimeoutIds.push(o),i.searchLoopStarted){t.next=5;break}return i.clearWaitTimeout(o),t.next=5,i.search(r);case 5:case"end":return t.stop()}}),t)}))))}},{key:"stopSearch",value:function(){this.cancelSearch=!0,this.setSummary("")}},{key:"search",value:(n=e(p().mark((function t(e){var n,i,r,o,a,s=this;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=ze.getPages(),i=new DOMParser,this.searchItemList.forEach((function(t){return t.destroy()})),this.searchItemList=[],this.searchLoopStarted=!0,this.cancelSearch=!1,r=Xn(n),t.prev=8,a=p().mark((function t(){var n,r,a,u,l,c,h;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.value,t.next=3,Y(n.pageUrl);case 3:if(r=t.sent,a=i.parseFromString(r,"text/html"),u=Array.from(a.getElementsByTagName("div")),l=Array.from(a.getElementsByTagName("xmp")),c=[].concat(S(u),S(l)),h=[],c.forEach((function(t){var n=t.textContent;if(n&&n.includes(e)){var i=n.replace(/(?:\r\n|\r|\n|\t)/g,"").replace(/(<([^>]+)>)/gi,"").split(e),r="";i[0]&&(r+="...".concat(i[0].slice(-50),"")),r+=''.concat(e,""),i[1]&&(r+="".concat(i[1].substring(0,50),"...")),h.push(r)}})),0!==(h=h.filter((function(t,e){return h.indexOf(t)===e}))).length&&s.addSearchItme(n,h.join(", ")),s.setSummary(e),!s.cancelSearch){t.next=15;break}return t.abrupt("return","break");case 15:case"end":return t.stop()}}),t)})),r.s();case 11:if((o=r.n()).done){t.next=18;break}return t.delegateYield(a(),"t0",13);case 13:if("break"!==t.t0){t.next=16;break}return t.abrupt("break",18);case 16:t.next=11;break;case 18:t.next=23;break;case 20:t.prev=20,t.t1=t.catch(8),r.e(t.t1);case 23:return t.prev=23,r.f(),t.finish(23);case 26:this.searchLoopStarted=!1;case 27:case"end":return t.stop()}}),t,this,[[8,20,23,26]])}))),function(t){return n.apply(this,arguments)})},{key:"clearWaitTimeout",value:function(t){var e=this.waitTimeoutIds.indexOf(t);-1!==e&&(window.clearInterval(t),this.waitTimeoutIds[e]=0)}}],[{key:"append",value:function(){var t=E.appComponent;t&&new a(t.element).append()}}]),a}(qn);const Jn=' ';function ti(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var ei=function(t){s(n,t);var e=ti(n);function n(t,r){var o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return i(this,n),d(l(o=e.call(this,t,Jn,{parentElement:r,className:"bookmark-host"})),"pageNumber",null),d(l(o),"callback",null),o.pageNumber=a,o.callback=s,o.initEventListener(),o.updateUi(),o}return o(n,[{key:"isFirstComponent",get:function(){return this.id.startsWith("first")}},{key:"initEventListener",value:function(){this.element&&this.element.addEventListener("click",this.onClick.bind(this))}},{key:"onClick",value:function(t){var e;t.stopPropagation();var n=ze.getCurrentPageIndex(),i=this.isFirstComponent?n:n+1;null!==(e=E.appComponent)&&void 0!==e&&e.isPortrait()&&(i=n),null!==this.pageNumber&&(i=ze.getPageIndex(this.pageNumber)),mn.setBookmark(i),this.updateUi(),this.callback&&this.callback(i)}},{key:"updateUi",value:function(){this.setDisplay(),this.setSize(),this.setContent()}},{key:"setSize",value:function(){null===this.pageNumber&&Dn(h(n.prototype),"setSize",this).call(this,g.sideMenu.width,null)}},{key:"setContent",value:function(){this.setMarkOn()}},{key:"setMarkOn",value:function(){var t,e=ze.getCurrentPageIndex(),n=this.isFirstComponent?e:e+1;null!==(t=E.appComponent)&&void 0!==t&&t.isPortrait()&&(n=e),null!==this.pageNumber&&(n=ze.getPageIndex(this.pageNumber)),mn.containBookmark(n)?this.setOn():this.setOn(!1)}}]),n}(V);function ni(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var ii=function(t){s(n,t);var e=ni(n);function n(t,r,o,a,s){var u;return i(this,n),d(l(u=e.call(this,t,'
',{parentElement:o,className:"".concat(r," thumbnail-item-host")})),"bookmarkComponent",null),u.pageNumber=s,u.imageElement&&(u.imageElement.src=a),u.setHtml(s.toString(),u.pageNumberElement),u.addListener(),u.updateUi(),u}return o(n,[{key:"width",get:function(){return g.panelThumbnailSize+2*g.panelThumbnailMargin}},{key:"imageElement",get:function(){return this.child("#thumbnail-image")}},{key:"pageNumberElement",get:function(){return this.child("#thumbnail-page-number")}},{key:"updateUi",value:function(){this.setMargin(g.panelThumbnailMargin)}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this),!this.bookmarkComponent&&this.element&&(this.bookmarkComponent=new ei("thumbnail-bookmark-".concat(this.pageNumber),this.element,this.pageNumber,(function(){return E.updateBookmark()})),this.bookmarkComponent.append())}},{key:"destroy",value:function(){var t;null===(t=this.bookmarkComponent)||void 0===t||t.destroy(),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"addListener",value:function(){var t,e,n=this;null===(t=this.element)||void 0===t||t.addEventListener("click",(function(){return n.goPage(n.pageNumber)})),null===(e=this.imageElement)||void 0===e||e.addEventListener("load",(function(t){var e=t.target,i=e.width,r=e.height,o=i/r,a=g.panelThumbnailSize;o>0?(i=a,r=a/o):(i=a/o,r=a),n.setSize(i,r,e)}))}},{key:"goPage",value:function(t){E.getComponent("thumbnail-panel").destroy(),ze.goPage(t)}}]),n}(V);function ri(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var oi=function(t){s(n,t);var e=ri(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,"thumbnail-panel","thumbnail-panel-host",t,"섬네일 보기","src/assets/images/menu/thumbnail02.png","")),"thumbnailItemList",[]),r.setContent(),window.addEventListener("resize",(function(){r.centerContent()})),r}return o(n,[{key:"updateUi",value:function(){Dn(h(n.prototype),"updateUi",this).call(this)}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this),this.centerContent()}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("default-menu-thumbnail"))||void 0===t||t.setPressed(!1),this.thumbnailItemList.forEach((function(t){return t.destroy()})),this.thumbnailItemList=[],Dn(h(n.prototype),"destroy",this).call(this)}},{key:"setContent",value:function(){var t=this;ze.getPages().forEach((function(e,n){if(t.contentElement){var i=e.pageNumber,r=e.thumbnailUrl,o=new ii("thumbnail-index-".concat(n),"",t.contentElement,r,i);o.append(),t.thumbnailItemList.push(o)}}))}},{key:"centerContent",value:function(){if(this.baseElement){var t=window.getComputedStyle(this.baseElement),e=_(t.width)-2*_(t.padding),n=0===this.thumbnailItemList.length?0:this.thumbnailItemList[0].width,i=e-n*Math.floor(e/n);this.contentElement&&(this.contentElement.style.marginLeft=L(i/2))}}}],[{key:"append",value:function(){var t=E.appComponent;t&&new n(t.element).append()}}]),n}(qn);function ai(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var si=function(t){s(n,t);var e=ai(n);function n(t,r,o,a,s){var u,l,c,h;return i(this,n),(h=e.call(this,t,'
',{parentElement:o,className:"".concat(r," toc-item-host")})).setHtml(a,h.titleElement),h.setHtml("".concat(s,"쪽"),h.pageElement),null===(u=h.titleElement)||void 0===u||u.addEventListener("click",(function(){return h.goPage(s)})),null===(l=h.pageElement)||void 0===l||l.addEventListener("click",(function(){return h.goPage(s)})),null===(c=h.buttonElement)||void 0===c||c.addEventListener("click",(function(){return h.toggleShrink()})),h.toggleShrink(),h}return o(n,[{key:"titleElement",get:function(){return this.child("#title")}},{key:"pageElement",get:function(){return this.child("#page")}},{key:"buttonElement",get:function(){return this.child("#image")}},{key:"updateUi",value:function(){}},{key:"toggleShrink",value:function(){var t="--shrink";this.setClass(t,!this.hasClass(t))}},{key:"goPage",value:function(t){E.getComponent("toc-panel").destroy(),ze.goPage(t)}}]),n}(V);function ui(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var li=function(t){s(n,t);var e=ui(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,"toc-panel","toc-panel-host",t,"차례","src/assets/images/menu/toc02.png",'
')),"tocItemList",[]),r.setHead(),r.setBody(),r}return o(n,[{key:"headElement",get:function(){return this.child("#content>#head")}},{key:"tocElement",get:function(){return this.child("#content>#body>#toc")}},{key:"updateUi",value:function(){Dn(h(n.prototype),"updateUi",this).call(this)}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this)}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("default-menu-toc"))||void 0===t||t.setPressed(!1),this.tocItemList.forEach((function(t){return t.destroy()})),this.tocItemList=[],Dn(h(n.prototype),"destroy",this).call(this)}},{key:"setHead",value:function(){this.setHtml(ze.title,this.headElement)}},{key:"setBody",value:function(){var t=this,e=[];ze.toc.forEach((function(n,i){var r=e[n.level-1]?e[n.level-1].element:t.tocElement;if(r){var o=new si("toc-index-".concat(i),"toc-level-".concat(n.level),r,n.label,n.pageNumber);t.tocItemList.push(o),e[n.level]=o,o.append(),(!ze.toc[i+1]||ze.toc[i].level>=ze.toc[i+1].level)&&o.setClass("--terminal")}}))}}],[{key:"append",value:function(){var t=E.appComponent;t&&new n(t.element).append()}}]),n}(qn);function ci(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return hi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hi(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function hi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n ',{parentElement:t,className:"print-host"})).updateUi(),e}return o(u,[{key:"iframeElement",get:function(){return this.child("iframe")}},{key:"updateUi",value:function(){var t=this;this.iframeElement&&(this.iframeElement.addEventListener("load",e(p().mark((function e(){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.preparePageInfoData();case 2:t.showPrintPanel();case 3:case"end":return e.stop()}}),e)})))),this.iframeElement.srcdoc=" ")}},{key:"append",value:function(){Dn(h(u.prototype),"append",this).call(this),this.isPrintable()||this.destroy()}},{key:"destroy",value:function(){var t;null===(t=E.getComponent("default-menu-print"))||void 0===t||t.setPressed(!1),Dn(h(u.prototype),"destroy",this).call(this)}},{key:"isPrintable",value:function(){return 0!==ze.bookData.pageInfo.count||(E.addMessageInfo("page-info.json을 읽을 수 없습니다."),!1)}},{key:"preparePageInfoData",value:(r=e(p().mark((function t(){var e,n,i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=ci(ze.bookData.pageInfo.printList),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=9;break}return i=n.value,t.next=7,this.appendPrintPage(i.master);case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[1,11,14,17]])}))),function(){return r.apply(this,arguments)})},{key:"showPrintPanel",value:function(){var t=this;this.iframeElement&&this.iframeElement.contentWindow&&(this.iframeElement.contentWindow.onafterprint=function(){return t.destroy()},window.setTimeout((function(){var e,n;return null===(e=t.iframeElement)||void 0===e||null===(n=e.contentWindow)||void 0===n?void 0:n.print()}),100))}},{key:"appendPrintPage",value:(n=e(p().mark((function t(e){var n=this;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t){var i,r,o=n.createElement("","print-layout"),a=n.createElement("","","img");a.onload=function(){t()},a.src=e,n.appendChild(a,o),n.appendChild(o,null===(i=n.iframeElement)||void 0===i||null===(r=i.contentWindow)||void 0===r?void 0:r.document.body)}));case 2:case"end":return t.stop()}}),t)}))),function(t){return n.apply(this,arguments)})}],[{key:"append",value:function(){var t=E.appComponent;t&&new u(t.element).append()}}]),u}(V);var di=function(){function t(){i(this,t)}return o(t,[{key:"flipSound",get:function(){return g.flipSound},set:function(t){g.flipSound=t}},{key:"floatingMenu",get:function(){return g.floatingMenu},set:function(t){g.floatingMenu=t}},{key:"floatingMenuPoint",get:function(){return g.floatingMenuPoint},set:function(t){g.floatingMenuPoint=t}},{key:"pageDivider",get:function(){return g.pageDivider},set:function(t){g.pageDivider=t}},{key:"pageSlider",get:function(){return g.pageSlider},set:function(t){g.pageSlider=t}},{key:"pageBorder",get:function(){return g.pageBorder},set:function(t){g.pageBorder=t}},{key:"pageSwipe",get:function(){return g.pageSwipe},set:function(t){g.pageSwipe=t}},{key:"favoriteMenuList",get:function(){return g.sideMenu.favoriteItems},set:function(t){g.sideMenu.favoriteItems=t}},{key:"otherMenuList",get:function(){return g.sideMenu.otherItems},set:function(t){g.sideMenu.otherItems=t}},{key:"load",value:function(t){if(!t)return this.applyFloatingMenu(this.floatingMenu,!1),this.applyPageDivider(this.pageDivider,!1),this.applyPageSlider(this.pageSlider,!1),void this.applyPageBorder(this.pageBorder,!1);var e=g.forceReloadEpubSideMenu;void 0===t.flipSound||e||(this.flipSound=t.flipSound),void 0===t.floatingMenu||e||(this.floatingMenu=t.floatingMenu),t.floatingMenuPoint&&(this.floatingMenuPoint=new C(t.floatingMenuPoint.x,t.floatingMenuPoint.y)),void 0===t.pageDivider||e||(this.pageDivider=t.pageDivider),void 0===t.pageSlider||e||(this.pageSlider=t.pageSlider),void 0===t.pageBorder||e||(this.pageBorder=t.pageBorder),void 0===t.pageSwipe||e||(this.pageSwipe=t.pageSwipe),void 0===t.favoriteMenuList||e||(this.favoriteMenuList=t.favoriteMenuList),void 0===t.otherMenuList||e||(this.otherMenuList=t.otherMenuList),g.forceReloadEpubSideMenu=!1,this.applyFloatingMenu(this.floatingMenu,!1),this.applyPageDivider(this.pageDivider,!1),this.applyPageSlider(this.pageSlider,!1),this.applyPageBorder(this.pageBorder,!1),this.applyMenuList(this.favoriteMenuList,this.otherMenuList,!1),this.save()}},{key:"applyFlipSound",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.flipSound=t,e&&this.save("flipSound")}},{key:"setFloatingMenuPoint",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.floatingMenuPoint=t,e&&this.save()}},{key:"applyFloatingMenu",value:function(t){var e,n,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(this.floatingMenu=t,this.floatingMenu)?null===(e=E.floatingMenu)||void 0===e||e.show():null===(n=E.floatingMenu)||void 0===n||n.hide();i&&this.save("floatingMenu")}},{key:"applyPageDivider",value:function(t){var e,n,i=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.pageDivider=t;var o=null!==(e=null===(n=E.pageContainer)||void 0===n?void 0:n.pages)&&void 0!==e?e:[];o.forEach((function(t){i.pageDivider?t.showPageDivider():t.hidePageDivider()})),r&&this.save("pageDivider")}},{key:"applyPageSlider",value:function(t){var e,n,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(this.pageSlider=t,this.pageSlider)?null===(e=E.pageSlider)||void 0===e||e.show():null===(n=E.pageSlider)||void 0===n||n.hide();i&&this.save("pageSlider")}},{key:"applyPageBorder",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.pageBorder=t,E.updateWindowRatio(),e&&this.save("pageBorder")}},{key:"applyPageSwipe",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.pageSwipe=t,e&&this.save("pageSwipe")}},{key:"applyMenuList",value:function(t,e){var n,i,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.favoriteMenuList=t,this.otherMenuList=e,null===(n=E.firstSideMenu)||void 0===n||n.setContent(),null===(i=E.secondSideMenu)||void 0===i||i.setContent(),r&&this.save("menuList")}},{key:"save",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e={},n=rt(J);void 0===(null==n?void 0:n.flipSound)&&"flipSound"!==t||void 0===this.flipSound||(e.flipSound=this.flipSound),void 0===(null==n?void 0:n.floatingMenu)&&"floatingMenu"!==t||void 0===this.floatingMenu||(e.floatingMenu=this.floatingMenu),void 0!==this.floatingMenuPoint&&null!==this.floatingMenuPoint&&(e.floatingMenuPoint=this.floatingMenuPoint),void 0===(null==n?void 0:n.pageDivider)&&"pageDivider"!==t||void 0===this.pageDivider||(e.pageDivider=this.pageDivider),void 0===(null==n?void 0:n.pageSlider)&&"pageSlider"!==t||void 0===this.pageSlider||(e.pageSlider=this.pageSlider),void 0===(null==n?void 0:n.pageBorder)&&"pageBorder"!==t||void 0===this.pageBorder||(e.pageBorder=this.pageBorder),void 0===(null==n?void 0:n.pageSwipe)&&"pageSwipe"!==t||void 0===this.pageSwipe||(e.pageSwipe=this.pageSwipe),void 0===(null==n?void 0:n.favoriteMenuList)&&"menuList"!==t||void 0===this.favoriteMenuList||(e.favoriteMenuList=this.favoriteMenuList),void 0===(null==n?void 0:n.otherMenuList)&&"menuList"!==t||void 0===this.otherMenuList||(e.otherMenuList=this.otherMenuList),ot(J,e)}}]),t}();const gi=new di;function vi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var mi=function(t){s(n,t);var e=vi(n);function n(t,r){var o;i(this,n),o=e.call(this,t,"");var a="".concat(t,"-input");return o.addClass("switch-host"),o.inputElement=o.appendInputElement(a,r),o.labelElement=o.appendLabelElement(a),o}return o(n,[{key:"checked",get:function(){var t,e;return null!==(t=null===(e=this.inputElement)||void 0===e?void 0:e.checked)&&void 0!==t&&t}},{key:"updateUi",value:function(){}},{key:"appendInputElement",value:function(t,e){var n=this.createElement(t,"","input");return n.type="checkbox",n.addEventListener("change",e),this.appendChild(n),n}},{key:"appendLabelElement",value:function(t){var e=this.createElement("","","label");return this.addAttribute("for",t,e),this.appendChild(e),e}},{key:"setChecked",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.inputElement&&(this.inputElement.checked=t)}}]),n}(V);function yi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var wi=function(t){s(n,t);var e=yi(n);function n(t,r,o){var a;return i(this,n),(a=e.call(this,t,'
')).switchId="".concat(t,"-switch"),a.addClass("viewer-setting-item-host"),a.setHtml(r,a.title),a.appendChild(a.createElement(a.switchId)),a.switchComponent=new mi(a.switchId,o),a}return o(n,[{key:"title",get:function(){return this.child("#title")}},{key:"checked",get:function(){var t,e;return null!==(t=null===(e=this.switchComponent)||void 0===e?void 0:e.checked)&&void 0!==t&&t}},{key:"updateUi",value:function(){}},{key:"destroy",value:function(){E.getComponent(this.switchId).destroy(),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"setChecked",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.switchComponent&&this.switchComponent.setChecked(t)}}]),n}(V);function bi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Ei=function(t){s(n,t);var e=bi(n);function n(t){var r;return i(this,n),(r=e.call(this,t,'
')).flipSoundItem=new wi("setting-flip-sound","책장 넘김 효과음",(function(){var t,e;return gi.applyFlipSound(null!==(t=null===(e=r.flipSoundItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.flipSoundItem.setChecked(g.flipSound),r.pageDividerItem=new wi("setting-page-divider","페이지 구분선",(function(){var t,e;return gi.applyPageDivider(null!==(t=null===(e=r.pageDividerItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.pageDividerItem.setChecked(g.pageDivider),r.pageBorderItem=new wi("setting-page-border","페이지 테두리",(function(){var t,e;return gi.applyPageBorder(null!==(t=null===(e=r.pageBorderItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.pageBorderItem.setChecked(g.pageBorder),r.floatingMenuItem=new wi("setting-floating-menu","이동 메뉴",(function(){var t,e;return gi.applyFloatingMenu(null!==(t=null===(e=r.floatingMenuItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.floatingMenuItem.setChecked(g.floatingMenu),r.pageSliderItem=new wi("setting-page-slider","페이지 슬라이더",(function(){var t,e;return gi.applyPageSlider(null!==(t=null===(e=r.pageSliderItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.pageSliderItem.setChecked(g.pageSlider),r.pageSwipeItem=new wi("setting-page-swipe","스와이프 페이지 넘기기",(function(){var t,e;return gi.applyPageSwipe(null!==(t=null===(e=r.pageSwipeItem)||void 0===e?void 0:e.checked)&&void 0!==t&&t)})),r.pageSwipeItem.setChecked(g.pageSwipe),r}return o(n,[{key:"updateUi",value:function(){}},{key:"destroy",value:function(){var t,e,i,r,o,a;null===(t=E.getComponent("setting-flip-sound"))||void 0===t||t.destroy(),null===(e=E.getComponent("setting-page-divider"))||void 0===e||e.destroy(),null===(i=E.getComponent("setting-page-border"))||void 0===i||i.destroy(),null===(r=E.getComponent("setting-floating-menu"))||void 0===r||r.destroy(),null===(o=E.getComponent("setting-page-slider"))||void 0===o||o.destroy(),null===(a=E.getComponent("setting-page-swipe"))||void 0===a||a.destroy(),Dn(h(n.prototype),"destroy",this).call(this)}}]),n}(V);function ki(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Pi=function(t){s(n,t);var e=ki(n);function n(t,r){var o,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return i(this,n),d(l(o=e.call(this,t,r)),"threshold",500),d(l(o),"restraint",10),d(l(o),"startPoint",null),d(l(o),"timerId",0),a&&t.addEventListener("contextmenu",(function(){o.clearTimer()}),!1),o}return o(n,[{key:"handleTouchStart",value:function(t){this.startTimer(t)}},{key:"handleTouchMove",value:function(t){if(this.startPoint){var e=this.getPoint(t);(e.x
',{parentElement:a,className:"menu-setting-item-host"})),"index",0),d(l(s),"title",""),d(l(s),"width",0),d(l(s),"height",0),s.index=r,s.title=o,s.setIndex(r),s.setTitle(o),s}return o(n,[{key:"indexElement",get:function(){return this.child("#index")}},{key:"titleElement",get:function(){return this.child("#title")}},{key:"updateUi",value:function(){}},{key:"append",value:function(){var t,e,i;Dn(h(n.prototype),"append",this).call(this);var r=null===(t=this.element)||void 0===t?void 0:t.getBoundingClientRect();this.width=null!==(e=null==r?void 0:r.width)&&void 0!==e?e:0,this.height=null!==(i=null==r?void 0:r.height)&&void 0!==i?i:0}},{key:"appendWithParent",value:function(t,e){t&&this.element&&this.insertBefore(this.element,e,t)}},{key:"destroy",value:function(){Dn(h(n.prototype),"destroy",this).call(this)}},{key:"setIndex",value:function(t){this.index=t,this.setHtml(t.toString(),this.indexElement)}},{key:"setTitle",value:function(t){this.title=t,this.setHtml(t,this.titleElement)}},{key:"addTempSpace",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setClass("--temp-space",t)}}]),n}(V);function Ti(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var xi=function(t){s(n,t);var e=Ti(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,t,'
기능 목록을 기본메뉴 위치로 드래그하세요.


')),"isDrag",!1),d(l(r),"favoriteItemList",[]),d(l(r),"otherItemList",[]),d(l(r),"dragOriginElement",null),d(l(r),"dragTargetElement",null),d(l(r),"tempItem",null),d(l(r),"hoverMenuItem",null),d(l(r),"menuItemHeight",0),d(l(r),"onDragMoveBind",r.onDragMove.bind(l(r))),d(l(r),"onDragEndBind",r.onDragEnd.bind(l(r))),r.addListener(r.favoriteListElement),r.addListener(r.otherListElement),r.addFavoriteItems(),r.addOtherItems(),r.setMenuItemIndexes(),r.element&&(r.hoverMenuItem=new Ii("item-hover",0,"",r.element),r.hoverMenuItem.addClass("--hover")),r}return o(n,[{key:"favoriteListElement",get:function(){return this.child("#favorite-list")}},{key:"otherListElement",get:function(){return this.child("#other-list")}},{key:"menuItemElement",get:function(){return this.child(".menu-setting-item-host")}},{key:"menuItemWidth",get:function(){return this.menuItemElement?this.menuItemElement.getBoundingClientRect().width:0}},{key:"favoriteElementRect",get:function(){var t=this.favoriteListElement;return t?t.getBoundingClientRect():null}},{key:"favoriteElementTop",get:function(){var t=this.favoriteElementRect;return t?t.y:0}},{key:"favoriteElementHeight",get:function(){var t=this.favoriteElementRect;return t?t.height:0}},{key:"otherElementRect",get:function(){var t=this.otherListElement;return t?t.getBoundingClientRect():null}},{key:"otherElementTop",get:function(){var t=this.otherElementRect;return t?t.y:0}},{key:"otherElementHeight",get:function(){var t=this.otherElementRect;return t?t.height:0}},{key:"onDragStart",value:function(t){this.isDrag=!0,this.menuItemHeight=this.menuItemElement?this.menuItemElement.getBoundingClientRect().height:0,window.addEventListener("mousemove",this.onDragMoveBind,!1),window.addEventListener("touchmove",this.onDragMoveBind,!0),window.addEventListener("mouseup",this.onDragEndBind,!1),window.addEventListener("touchend",this.onDragEndBind,!1);var e=t.target,n=D(t);if(e&&n&&e.classList.contains("menu-setting-item-host")){var i=y(this.getPointIndex(n.y,!0),2),r=i[0],o=i[1];if(this.dragOriginElement=o,this.dragOriginElement){var a=this.getMenuItemListWithParentElement(this.dragOriginElement);this.detachMenuItem(a,r)}this.showHoverMenuItem(),this.setHoverMenuItmePoint(n)}t.stopPropagation()}},{key:"onDragMove",value:function(t){if(this.isDrag){var e=D(t);if(e){var n=y(this.getPointIndex(e.y),2),i=n[0],r=n[1];this.dragTargetElement=r,this.dragTargetElement===this.favoriteListElement?this.addTempSpace(this.favoriteItemList,i):this.dragTargetElement===this.otherListElement&&this.addTempSpace(this.otherItemList,i),this.dragOriginElement===this.dragTargetElement?this.dragOriginElement===this.favoriteListElement?(this.setSize(null,this.menuItemHeight*(this.favoriteItemList.length+1),this.favoriteListElement),this.setSize(null,null,this.otherListElement)):(this.setSize(null,null,this.favoriteListElement),this.setSize(null,this.menuItemHeight*(this.otherItemList.length+1),this.otherListElement)):this.dragOriginElement===this.favoriteListElement?(this.setSize(null,null,this.favoriteListElement),this.setSize(null,this.menuItemHeight*(this.otherItemList.length+1),this.otherListElement)):(this.setSize(null,this.menuItemHeight*(this.favoriteItemList.length+1),this.favoriteListElement),this.setSize(null,null,this.otherListElement)),this.setHoverMenuItmePoint(e)}}}},{key:"onDragEnd",value:function(t){if(this.isDrag){var e=D(t);if(e){var n=y(this.getPointIndex(e.y,!0),2),i=n[0],r=n[1];if(r){var o=this.getMenuItemListWithParentElement(r);this.restoreTempItem(o,i,r),this.setMenuItemIndexes(),this.saveSetting()}}this.hideHoverMenuItem(),this.resetTempSpace(),this.setSize(null,null,this.favoriteListElement),this.setSize(null,null,this.otherListElement),this.dragOriginElement=null,this.dragTargetElement=null,window.removeEventListener("mousemove",this.onDragMoveBind),window.removeEventListener("touchmove",this.onDragMoveBind),window.removeEventListener("mouseup",this.onDragEndBind),window.removeEventListener("touchend",this.onDragEndBind),this.isDrag=!1}}},{key:"updateUi",value:function(){}},{key:"addListener",value:function(t){null==t||t.addEventListener("mousedown",this.onDragStart.bind(this),!1),null==t||t.addEventListener("touchstart",this.onDragStart.bind(this),{passive:!0})}},{key:"destroy",value:function(){this.removeItems(),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"addFavoriteItems",value:function(){var t=this;S(g.sideMenu.favoriteItems).reverse().forEach((function(e){if(t.favoriteListElement){var n=new Ii("item-".concat(e),0,t.getMenuItemAlias(e),t.favoriteListElement);n.append(),t.favoriteItemList.push(n)}}))}},{key:"addOtherItems",value:function(){var t=this;S(g.sideMenu.otherItems).reverse().forEach((function(e){if(t.otherListElement){var n=new Ii("item-".concat(e),0,t.getMenuItemAlias(e),t.otherListElement);n.append(),t.otherItemList.push(n)}}))}},{key:"removeItems",value:function(){this.favoriteItemList.forEach((function(t){return t.destroy()})),this.otherItemList.forEach((function(t){return t.destroy()})),this.hoverMenuItem&&this.hoverMenuItem.destroy()}},{key:"getMenuItemAlias",value:function(t){var e=g.sideMenu.itemData.filter((function(e){return e.name===t}));return 0===e.length?"":e[0].aliasV2}},{key:"setMenuItemIndexes",value:function(){var t=S(this.favoriteItemList).reverse(),e=S(this.otherItemList).reverse(),n=1;t.forEach((function(t){t.setIndex(n),n+=1})),e.forEach((function(t){t.setIndex(n),n+=1}))}},{key:"getMenuItemListWithParentElement",value:function(t){return t===this.favoriteListElement?this.favoriteItemList:this.otherItemList}},{key:"showHoverMenuItem",value:function(){this.hoverMenuItem&&this.tempItem&&(this.hoverMenuItem.setIndex(this.tempItem.index),this.hoverMenuItem.setTitle(this.tempItem.title),this.hoverMenuItem.append())}},{key:"hideHoverMenuItem",value:function(){this.hoverMenuItem&&this.hoverMenuItem.removeElement()}},{key:"setHoverMenuItmePoint",value:function(t){if(this.hoverMenuItem&&this.tempItem){var e=E.getComponent("setting-panel").contentElement,n=null==e?void 0:e.getBoundingClientRect(),i=n?n.x:0,r=n?n.y:0,o=this.tempItem.width/2,a=this.tempItem.height/2;this.setAbsolute(t.y-r-a,null,null,t.x-i-o,this.hoverMenuItem.element)}}},{key:"getPointIndex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.menuItemHeight,i=this.favoriteElementTop,r=this.otherElementTop,o=t-i,a=t-r,s=a>=0?a:o,u=a>=0?this.otherListElement:this.favoriteListElement,l=e?Math.floor(s/n):Math.round(s/n);return[l,u]}},{key:"addTempSpace",value:function(t,e){var n;this.resetTempSpace(),null===(n=t[e])||void 0===n||n.addTempSpace()}},{key:"resetTempSpace",value:function(){this.favoriteItemList.forEach((function(t){return t.addTempSpace(!1)})),this.otherItemList.forEach((function(t){return t.addTempSpace(!1)}))}},{key:"detachMenuItem",value:function(t,e){var n;this.tempItem=t.splice(e,1)[0],null===(n=this.tempItem)||void 0===n||n.setCss("display","none")}},{key:"restoreTempItem",value:function(t,e,n){this.tempItem&&(t.splice(e,0,this.tempItem),this.tempItem.removeElement(),this.tempItem.appendWithParent(n,e),this.tempItem.setCss("display","flex")),this.tempItem=null}},{key:"saveSetting",value:function(){var t=S(this.favoriteItemList).sort((function(t,e){return t.index-e.index})).map((function(t){return t.id.split("-")[1]})),e=S(this.otherItemList).sort((function(t,e){return t.index-e.index})).map((function(t){return t.id.split("-")[1]}));gi.applyMenuList(t,e)}}]),n}(V);function Ci(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Di=function(t){s(n,t);var e=Ci(n);function n(t){return i(this,n),e.call(this,t,"도움말 ")}return o(n,[{key:"updateUi",value:function(){}},{key:"destroy",value:function(){Dn(h(n.prototype),"destroy",this).call(this)}}]),n}(V);function Oi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Ri=function(t){s(n,t);var e=Oi(n);function n(t){var r;return i(this,n),(r=e.call(this,"setting-panel","setting-panel-host",t,"설정","src/assets/images/menu/setting02.png",'
뷰어 설정
도움말
')).addListener(),r.onClickViewer(),window.setTimeout((function(){return r.setContent()})),r}return o(n,[{key:"actionsElement",get:function(){return this.child(".base>.content>.actions")}},{key:"viewerButtonElement",get:function(){return this.child(".base>.content>.actions>.viewer-setting-button")}},{key:"menuButtonElement",get:function(){return this.child(".base>.content>.actions>.menu-setting-button")}},{key:"helpButtonElement",get:function(){return this.child(".base>.content>.actions>.help-button")}},{key:"bodyElement",get:function(){return this.child(".base>.content>.body")}},{key:"viewerPanelElement",get:function(){return this.child(".base>.content>.body>.viewer-setting-panel")}},{key:"menuPanelElement",get:function(){return this.child(".base>.content>.body>.menu-setting-panel")}},{key:"helpPanelElement",get:function(){return this.child(".base>.content>.body>.help-setting-panel")}},{key:"onClickViewer",value:function(){this.setOnAllButtons(!1),this.setOnViewerButton(),this.setEnableAllContent(!1),this.setEnableViewerSetting()}},{key:"onClickMenu",value:function(){this.setOnAllButtons(!1),this.setOnMenuButton(),this.setEnableAllContent(!1),this.setEnableMenuSetting()}},{key:"onClickHelp",value:function(){this.setOnAllButtons(!1),this.setOnHelpButton(),this.setEnableAllContent(!1),this.setEnableHelpSetting()}},{key:"updateUi",value:function(){Dn(h(n.prototype),"updateUi",this).call(this)}},{key:"append",value:function(){Dn(h(n.prototype),"append",this).call(this)}},{key:"destroy",value:function(){var t,e,i,r;null===(t=E.getComponent("default-menu-setting"))||void 0===t||t.setPressed(!1),null===(e=E.getComponent("viewer-setting-panel"))||void 0===e||e.destroy(),null===(i=E.getComponent("menu-setting-panel"))||void 0===i||i.destroy(),null===(r=E.getComponent("help-setting-panel"))||void 0===r||r.destroy(),Dn(h(n.prototype),"destroy",this).call(this)}},{key:"addListener",value:function(){var t,e,n;this.element&&(new Pi(this.element,(function(t,e){"pressed"===t&&(!function(){for(var t=0,e=Object.keys(localStorage);t0&&void 0!==arguments[0])||arguments[0];this.setOn(e,null!==(t=this.viewerButtonElement)&&void 0!==t?t:void 0)}},{key:"setOnMenuButton",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setOn(e,null!==(t=this.menuButtonElement)&&void 0!==t?t:void 0)}},{key:"setOnHelpButton",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setOn(e,null!==(t=this.helpButtonElement)&&void 0!==t?t:void 0)}},{key:"setOnAllButtons",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setOnViewerButton(t),this.setOnMenuButton(t),this.setOnHelpButton(t)}},{key:"setEnableViewerSetting",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];null===(t=this.viewerSettingComponent)||void 0===t||t.setEnable(e)}},{key:"setEnableMenuSetting",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];null===(t=this.menuSettingComponent)||void 0===t||t.setEnable(e)}},{key:"setEnableHelpSetting",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];null===(t=this.helpSettingComponent)||void 0===t||t.setEnable(e)}},{key:"setEnableAllContent",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setEnableViewerSetting(t),this.setEnableMenuSetting(t),this.setEnableHelpSetting(t)}}],[{key:"append",value:function(){var t=E.appComponent;t&&new n(t.element).append()}}]),n}(qn),Li=function(){zn.destroy()},Ai=[{name:"menu",callback:function(t){t.toggleMenu()}},{name:"setting",callback:function(){Li(),Ri.append()}},{name:"display",callback:function(){Li(),Nn.destroy(),ze.setDisplayType()}},{name:"toc",callback:function(){Li(),li.append()}},{name:"drawing",callback:function(){var t;if(zn.toggle(),E.scale&&E.drawingMenu)null===(t=E.scale)||void 0===t||t.setOptionPan(!1);else if(E.scale&&!E.drawingMenu){var e;null===(e=E.scale)||void 0===e||e.setOptionPan(!0)}}},{name:"thumbnail",callback:function(){Li(),oi.append()}},{name:"search",callback:function(){Li(),Qn.append()}},{name:"print",callback:function(){Li(),pi.append()}},{name:"scale",callback:function(){Nn.toggle()},standAlone:!0}];function _i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Mi=function(t){s(n,t);var e=_i(n);function n(t,r,o,a){var s,u,c;return i(this,n),d(l(s=e.call(this,t,' ',{parentElement:r,className:"menu-item-host"})),"pressed",!1),s.element&&s.appendChild(s.element,r),s.parentComponent=a,s.menuItemName=o,s.data=(u=s.menuItemName,0!==(c=Ai.filter((function(t){return t.name===u}))).length?c[0]:null),s.config=s.getConfig(s.menuItemName),s.imageElement=s.child(".image"),s.initEventListener(),s.updateUi(),s}return o(n,[{key:"initEventListener",value:function(){this.element&&this.element.addEventListener("click",this.onClick.bind(this))}},{key:"onClick",value:function(){this.parentComponent.childPressed(this.menuItemName),this.pressed=!this.pressed,this.setImage(),this.data&&this.data.callback(this.parentComponent)}},{key:"updateUi",value:function(){this.setImage(),this.setSize(g.sideMenu.width,g.sideMenu.height)}},{key:"setPressed",value:function(t){this.pressed=t,this.setImage()}},{key:"setImage",value:function(){this.config&&(this.pressed?this.imageElement.src=this.config.pressedImagePath:this.imageElement.src=this.config.normalImagePath)}},{key:"getConfig",value:function(t){var e=g.sideMenu.itemData.filter((function(e){return e.name===t}));return 0!==e.length?e[0]:null}}]),n}(V),Ni=function(){var t=Bi();return t||(t=Ui()),t},Bi=function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},Ui=function(){return window.matchMedia("only screen and (min-device-width: 768px) and (max-device-width: 1024px)").matches};function Fi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return ji(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ji(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function ji(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n
')),"bookmarkComponent",null),d(l(a),"menuItemComponents",[]),d(l(a),"isOtherAreaDrag",!1),d(l(a),"prevScrollX",0),d(l(a),"prevScrollY",0),d(l(a),"timeout",new Pn),a.originalParent=null!==(r=null===(o=a.element)||void 0===o?void 0:o.parentElement)&&void 0!==r?r:null,a.contentElement=a.child("#content"),a.contentDefaultAreaElement=a.child("#default-area"),a.contentOtherAreaElement=a.child("#other-area"),a.contentOtherScrollAreaElement=a.child("#scroll-area"),a.firstArrowElement=a.child("#first-arrow"),a.secondArrowElement=a.child("#second-arrow"),a.updateUi(),a.setContent(),a.addListener(),a}return o(n,[{key:"defaultMenuItems",get:function(){return g.sideMenu.defaultItems}},{key:"favoriteMenuItems",get:function(){return g.sideMenu.favoriteItems}},{key:"otherMenuItems",get:function(){return g.sideMenu.otherItems}},{key:"itemMenu",get:function(){var t=this.menuItemComponents.filter((function(t){return"menu"===t.menuItemName}));return 0===t.length?null:t[0]}},{key:"otherElementWidth",get:function(){return E.viewerWidth-100-10-this.contentDefaultAreaElement.getBoundingClientRect().width}},{key:"otherElementHeight",get:function(){return E.viewerHeight-100-10-this.contentDefaultAreaElement.getBoundingClientRect().height}},{key:"otherScrollElementWidth",get:function(){return this.contentOtherScrollAreaElement.getBoundingClientRect().width}},{key:"otherScrollElementHeight",get:function(){return this.contentOtherScrollAreaElement.getBoundingClientRect().height}},{key:"isPortrait",get:function(){var t;return null===(t=E.appComponent)||void 0===t?void 0:t.isPortrait()}},{key:"childPressed",value:function(t){if(!this.isPortrait||this.hasClass("--on")){if("scale"!==t){var e,n=this.menuItemComponents.filter((function(e){return e.menuItemName!==t&&"menu"!==e.menuItemName})),i=Fi(n=n.filter((function(t){return"display"!==t.menuItemName})));try{for(i.s();!(e=i.n()).done;){var r,o=e.value;!0!==(null===(r=o.data)||void 0===r?void 0:r.standAlone)&&o.setPressed(!1)}}catch(t){i.e(t)}finally{i.f()}}}else this.setMenuBarOn()}},{key:"updateUi",value:function(){this.setClassName(),this.setStyle(),this.setSize(),this.setPoint(),this.setBookmark(),this.setOtherAreaSize(),this.resetOtherScrollAreaPoint(),this.applyRotation(),this.setMenuBarOn()}},{key:"onClickFirstArrow",value:function(){this.toFirstOtherScrollAreaPoint()}},{key:"onClickSecondArrow",value:function(){this.toSecondOtherScrollAreaPoint()}},{key:"onDragStart",value:function(t){this.isOtherAreaDrag=!0,E.enableBook(!1,this.id);var e=D(t);e&&(this.prevScrollX=e.x,this.prevScrollY=e.y)}},{key:"onDragMove",value:function(t){if(this.isOtherAreaDrag){this.setMenuBarOn(),this.setOtherAreaDragging();var e=D(t);if(e){var n=this.getPoint(this.contentOtherScrollAreaElement),i=(this.isPortrait?n.x:n.y)+(this.isPortrait?e.x-this.prevScrollX:e.y-this.prevScrollY);i=this.restrainBorder(i),this.setOtherScrollAreaPoint(i),this.showArrow(i),this.prevScrollX=e.x,this.prevScrollY=e.y}}}},{key:"onDragEnd",value:function(){this.isOtherAreaDrag&&(this.isOtherAreaDrag=!1,E.enableBook(!0,this.id),this.setOtherAreaDragging(!1))}},{key:"addListener",value:function(){var t,e,n,i=this;null===(t=this.element)||void 0===t||t.addEventListener("mouseover",(function(){return i.setMenuBarOn()})),null===(e=this.element)||void 0===e||e.addEventListener("mousedown",(function(){return i.setMenuBarOn()})),null===(n=this.element)||void 0===n||n.addEventListener("touchstart",(function(){return i.setMenuBarOn()})),this.firstArrowElement.addEventListener("click",this.onClickFirstArrow.bind(this)),this.secondArrowElement.addEventListener("click",this.onClickSecondArrow.bind(this)),this.contentOtherAreaElement.addEventListener("mousedown",this.onDragStart.bind(this),!1),this.contentOtherAreaElement.addEventListener("touchstart",this.onDragStart.bind(this),{passive:!0}),window.addEventListener("mousemove",this.onDragMove.bind(this),!1),window.addEventListener("touchmove",this.onDragMove.bind(this),!1),window.addEventListener("mouseup",this.onDragEnd.bind(this),!1),window.addEventListener("touchend",this.onDragEnd.bind(this),!1)}},{key:"toggleMenu",value:function(){g.sideMenu.pressed=!g.sideMenu.pressed,this.setContent()}},{key:"setMenuBarOn",value:function(){var t=this;Ni()?setTimeout((function(){return t.setMenuBarOptionOn()}),500):this.setMenuBarOptionOn()}},{key:"setMenuBarOptionOn",value:function(){var t=this;this.setOn(),this.timeout.trigger(3e3,(function(){t.setOn(!1)}))}},{key:"setClassName",value:function(){var t=this.id.startsWith("first");t?this.addClass("--left"):t||this.addClass("--right")}},{key:"setStyle",value:function(){this.setCss("backgroundColor",g.sideMenu.backgroundColor)}},{key:"setSize",value:function(){this.isPortrait?Dn(h(n.prototype),"setSize",this).call(this,E.viewerWidth,g.sideMenu.height):Dn(h(n.prototype),"setSize",this).call(this,g.sideMenu.width,E.viewerHeight)}},{key:"setPoint",value:function(){this.isPortrait?Dn(h(n.prototype),"setPoint",this).call(this,E.viewerWrapper.left,null):Dn(h(n.prototype),"setPoint",this).call(this,null,null)}},{key:"getLeftOccupiedSpace",value:function(){return Ni()?null!==(t=E.appComponent)&&void 0!==t&&t.isLandscape()?g.sideMenu.width:0:g.sideMenu.width;var t}},{key:"setBookmark",value:function(){if(!this.bookmarkComponent){var t=this.id.startsWith("first")?"first-bookmark":"second-bookmark";this.element&&(this.bookmarkComponent=new ei(t,this.element),this.bookmarkComponent.append())}}},{key:"setContent",value:function(){var t=g.sideMenuPressed,e=g.sideMenu.horizontalUseFirstBar,n=this.hasClass("--top"),i=this.hasClass("--right"),r=this.hasClass("--bottom"),o=this.hasClass("--left"),a=e&&(n||o)||!e&&(i||r);if(this.resetOtherScrollAreaPoint(),this.resetMenuItemComponents(),this.setOn(!!a,this.contentElement),a&&this.contentElement){var s=S(this.favoriteMenuItems);t||s.push.apply(s,S(this.otherMenuItems)),this.addMenuItemComponents(S(this.defaultMenuItems),this.contentDefaultAreaElement),this.addMenuItemComponents(s,this.contentOtherScrollAreaElement),this.setMenuItemPressed(t),this.resetOtherScrollAreaPoint()}}},{key:"setOtherAreaSize",value:function(){this.isPortrait?Dn(h(n.prototype),"setSize",this).call(this,this.otherElementWidth,g.sideMenu.height,this.contentOtherAreaElement):Dn(h(n.prototype),"setSize",this).call(this,g.sideMenu.width,this.otherElementHeight,this.contentOtherAreaElement)}},{key:"setOtherScrollAreaPoint",value:function(t){this.isPortrait?Dn(h(n.prototype),"setPoint",this).call(this,t,null,this.contentOtherScrollAreaElement):Dn(h(n.prototype),"setPoint",this).call(this,null,t,this.contentOtherScrollAreaElement)}},{key:"restrainBorder",value:function(t){var e=this.otherElementHeight,n=this.otherScrollElementHeight;this.isPortrait&&(e=this.otherElementWidth,n=this.otherScrollElementWidth);var i=e-n;return e0?0:te-n&&this.setOtherAreaPointInfo(!0),t<0&&this.setOtherAreaPointInfo(!1))}},{key:"resetOtherScrollAreaPoint",value:function(){this.toSecondOtherScrollAreaPoint()}},{key:"toFirstOtherScrollAreaPoint",value:function(){this.isPortrait?Dn(h(n.prototype),"setPoint",this).call(this,0,null,this.contentOtherScrollAreaElement):Dn(h(n.prototype),"setPoint",this).call(this,null,0,this.contentOtherScrollAreaElement),this.showArrow(0)}},{key:"toSecondOtherScrollAreaPoint",value:function(){var t=this.otherElementHeight,e=this.otherScrollElementHeight;this.isPortrait&&(t=this.otherElementWidth,e=this.otherScrollElementWidth);var i=t-e;t0&&void 0!==arguments[0])||arguments[0];this.setClass("--dragging",t,this.contentOtherScrollAreaElement)}},{key:"setOtherAreaPointInfo",value:function(t){null===t?(this.removeClass("--scroll-top",this.contentOtherAreaElement),this.removeClass("--scroll-bottom",this.contentOtherAreaElement)):null!==t&&this.addClass(t?"--scroll-top":"--scroll-bottom",this.contentOtherAreaElement)}},{key:"applyRotation",value:function(){var t,e,n,i,r,o;this.element&&(this.isPortrait?null===(t=E.appComponent)||void 0===t||t.element.appendChild(this.element):this.id.startsWith("first")?null===(e=this.originalParent)||void 0===e||e.insertBefore(this.element,null===(n=E.viewerWrapper)||void 0===n?void 0:n.outerBookElement):null===(i=this.originalParent)||void 0===i||i.appendChild(this.element));g.isSinglePage?null===(r=E.getComponent("default-menu-display"))||void 0===r||r.setPressed(!0):null===(o=E.getComponent("default-menu-display"))||void 0===o||o.setPressed(!1)}}]),n}(Hn);function Vi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var zi=function(t){s(n,t);var e=Vi(n);function n(t){var r;return i(this,n),(r=e.call(this,t,"")).initEventListener(),r.updateUi(),r}return o(n,[{key:"initEventListener",value:function(){var t;null===(t=this.element)||void 0===t||t.addEventListener("click",this.onClick.bind(this)),window.addEventListener("resize",this.updateUi.bind(this))}},{key:"onClick",value:function(){this.hasClass("--left")?ze.loadPrevPage():this.hasClass("--right")&&ze.loadNextPage()}},{key:"updateUi",value:function(){g.pageBorder?this.setSize(g.borderWidth,E.viewerHeight):this.setSize(0,E.viewerHeight),"left-book-border"===this.id?this.addClass("--left"):"right-book-border"===this.id&&this.addClass("--right")}}]),n}(V);function Gi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var qi=function(t){s(n,t);var e=Gi(n);function n(t,r){return i(this,n),e.call(this,t,"하이라이트 ",{parentElement:r,className:"highlight-box-host"})}return o(n,[{key:"updateUi",value:function(){}},{key:"show",value:function(t,e,n){var i=this.getOffset(n);this.append(),this.setPoint(i.x+t,i.y+e)}},{key:"getOffset",value:function(t){for(var e=C.defaultPoint,n=t;n&&"viewer-wrapper"!==n.id;)e.x+=n.offsetLeft,e.y+=n.offsetTop,n=n.parentElement;return e}}]),n}(V);function $i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Yi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yi(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Yi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n7&&void 0!==arguments[7]?arguments[7]:1,u=!(arguments.length>8&&void 0!==arguments[8])||arguments[8],l=arguments.length>9&&void 0!==arguments[9]&&arguments[9],c=0;g.isSinglePage&&!0===ze.originalPageDirection()&&(c+=this.width),l||(t/=i,e/=i),u&&(this.addData(r,o,a,s),this.addPoint(t+c,e,n)),this.applyContext(r,o,a,s),this.context.beginPath(),this.context.moveTo(t,e)}},{key:"doDrawLine",value:function(t,e,n,i){var r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=0;g.isSinglePage&&!0===ze.originalPageDirection()&&(a+=this.width),o||(t/=i,e/=i),r&&this.addPoint(t+a,e,n),this.context.lineTo(t,e),this.context.stroke()}},{key:"endDrawLine",value:function(){this.context.closePath()}},{key:"setSize",value:function(t,e){this.width=t,this.height=e}},{key:"restore",value:function(t){var e=t||this.dataList,n=!!t,i=0;g.isSinglePage&&!0===ze.originalPageDirection()&&(i=this.width);var r,o=$i(e);try{for(o.s();!(r=o.n()).done;){var a=r.value,s=E.globalZoomRate,u=a.l;if(u.length>0){this.startDrawLine(u[0].x-i,u[0].y,u[0].time,s,a.w,a.c,a.co,a.a,n,!0);for(var l=1;l3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"round",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.dataList.push({a:i,c:e,co:n,l:[],lc:r,sb:o,w:t}),this.dataIndex+=1}},{key:"addPoint",value:function(t,e,n){this.dataList[this.dataIndex].l.push({time:n,x:t,y:e})}},{key:"clearData",value:function(){this.dataList=[],this.dataIndex=-1}},{key:"clearCanvas",value:function(){this.context.clearRect(0,0,this.width,this.height)}},{key:"applyContext",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"round",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.context.lineWidth=t,this.context.strokeStyle=e,this.context.shadowColor=e,this.context.fillStyle=e,this.context.globalCompositeOperation=n,this.context.globalAlpha=i,this.context.lineCap=r,this.context.shadowBlur=o}}]),t}();function Ki(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Zi=function(t){s(n,t);var e=Ki(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,t,' ')),"isDraw",!1),d(l(r),"context",null),d(l(r),"viewerWrapperComponent",E.viewerWrapper),d(l(r),"outerBookPoint",C.defaultPoint),r.initContext(),r.addListener(),r.setComponentMargin(),r.setEnable(!1),r}return o(n,[{key:"canvasElement",get:function(){return this.child("#canvas")}},{key:"drawingMenuComponent",get:function(){return E.getComponent("drawing-menu")}},{key:"lineTypeIndex",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.currentLineTypeIndex)&&void 0!==t?t:0}},{key:"colorIndex",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.currentColorIndex)&&void 0!==t?t:0}},{key:"toolIndex",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.currentToolIndex)&&void 0!==t?t:0}},{key:"lineWidth",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.lineWidth)&&void 0!==t?t:2}},{key:"color",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.color)&&void 0!==t?t:"#000"}},{key:"compositeOperation",get:function(){var t,e;return null!==(t=null===(e=this.drawingMenuComponent)||void 0===e?void 0:e.compositeOperation)&&void 0!==t?t:"source-over"}},{key:"initContext",value:function(){if(this.canvasElement){var t=this.canvasElement.getContext("2d");t&&(this.context=new Xi(t))}}},{key:"onDragStart",value:function(t){if(t.touches&&1!==t.touches.length)this.isDraw=!1;else{this.isDraw=!0;var e=E.globalZoomRate,n=D(t);if(n){var i,r;this.refreshRectData(),this.correctEventPoint(n);var o="xor"===this.compositeOperation?.5:1,a=performance.now();null===(i=this.context)||void 0===i||i.startDrawLine(n.x,n.y,a,e,this.lineWidth,this.color,this.compositeOperation,o),null===(r=this.context)||void 0===r||r.doDrawLine(n.x,n.y,a,e)}}}},{key:"onDragMove",value:function(t){if(this.isDraw){var e,n=E.globalZoomRate,i=D(t);if(i)this.correctEventPoint(i),null===(e=this.context)||void 0===e||e.doDrawLine(i.x,i.y,performance.now(),n)}}},{key:"onDragEnd",value:function(t){var e;this.isDraw&&(null===(e=this.context)||void 0===e||e.endDrawLine(),this.isDraw=!1,this.save())}},{key:"updateUi",value:function(){var t=E.globalZoomRate;if(this.viewerWrapperComponent){var e,n,i=this.viewerWrapperComponent.outerBookWidth,r=this.viewerWrapperComponent.outerBookHeight;if(this.canvasElement)this.canvasElement.width=(i-(g.pageBorder?2*g.borderWidth:0))/t,this.canvasElement.height=r/t,null===(e=this.context)||void 0===e||e.setSize(this.canvasElement.width,this.canvasElement.height),null===(n=this.context)||void 0===n||n.restore()}this.setComponentMargin()}},{key:"setComponentMargin",value:function(){g.pageBorder?this.setAbsolute(null,g.borderWidth,null,g.borderWidth):this.setAbsolute(null,null,null,null)}},{key:"addListener",value:function(){this.canvasElement&&(this.canvasElement.addEventListener("mousedown",this.onDragStart.bind(this),!1),this.canvasElement.addEventListener("touchstart",this.onDragStart.bind(this),{passive:!0}),window.addEventListener("mousemove",this.onDragMove.bind(this),!1),window.addEventListener("touchmove",this.onDragMove.bind(this),!1),window.addEventListener("mouseup",this.onDragEnd.bind(this),!1),window.addEventListener("touchend",this.onDragEnd.bind(this),!1))}},{key:"refreshRectData",value:function(){var t,e;this.outerBookPoint.x=null===(t=this.viewerWrapperComponent)||void 0===t?void 0:t.outerBookLeft,this.outerBookPoint.y=null===(e=this.viewerWrapperComponent)||void 0===e?void 0:e.outerBookTop}},{key:"correctEventPoint",value:function(t){var e=this.viewerWrapperComponent.scaleValue,n=g.pageBorder?g.borderWidth*e:0;return t.x-=this.outerBookPoint.x+n,t.y-=this.outerBookPoint.y,t.x/=e,t.y/=e,t}},{key:"getCurrentPageIndex",value:function(){var t=ze.getCurrentPageIndex();return g.isSinglePage&&!0===ze.originalPageDirection()&&(t-=1),t}},{key:"remove",value:function(){var t,e;null===(t=this.context)||void 0===t||t.clearCanvas(),null===(e=this.context)||void 0===e||e.clearData(),mn.removeDrawing(this.getCurrentPageIndex())}},{key:"clearCanvas",value:function(){var t;null===(t=this.context)||void 0===t||t.clearCanvas()}},{key:"save",value:function(){var t,e=function(t){try{var e=JSON.stringify(t);return window.btoa(e)}catch(t){return null}}(null===(t=this.context)||void 0===t?void 0:t.drawingData);e&&mn.setDrawing(this.getCurrentPageIndex(),e)}},{key:"load",value:function(t){var e,n;if(null===(e=this.context)||void 0===e||e.clearCanvas(),null===(n=this.context)||void 0===n||n.clearData(),t){var i,r=function(t){try{var e=window.atob(t);return JSON.parse(e)}catch(t){return null}}(t);if(r)null===(i=this.context)||void 0===i||i.restore(r)}}}]),n}(V);function Qi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Ji=function(t){s(n,t);var e=Qi(n);function n(t){var r;return i(this,n),d(l(r=e.call(this,t,'
')),"viewerWidth",0),d(l(r),"viewerHeight",0),d(l(r),"prevScreenPortrait",!0),d(l(r),"scaleMin",1),d(l(r),"scaleMax",3),d(l(r),"scaleValue",1),d(l(r),"scaleStep",.1),d(l(r),"sideMenuComponent",[]),Ni()&&g.monitorMobileScreenRotation||window.addEventListener("resize",r.onResize.bind(l(r))),r.initComponent(),Ni()&&g.monitorMobileScreenRotation&&(r.prevScreenPortrait=r.isWindowPortrait(),window.setInterval((function(){r.prevScreenPortrait!==r.isWindowPortrait()&&(r.prevScreenPortrait=r.isWindowPortrait(),r.setDisplayType())}),1e3)),r}return o(n,[{key:"outerBookElement",get:function(){return this.child("#outer-book")}},{key:"pageContainerElement",get:function(){return this.child("#page-container")}},{key:"outerBookTop",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().y:0}},{key:"outerBookLeft",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().x:0}},{key:"outerBookWidth",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().width:0}},{key:"outerBookHeight",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().height:0}},{key:"outerBookOriginalTop",get:function(){var t=this.getPoint(this.outerBookElement);return this.outerBookElement?this.outerBookElement.getBoundingClientRect().y-t.y:0}},{key:"outerBookOriginalLeft",get:function(){var t=this.getPoint(this.outerBookElement);return this.outerBookElement?this.outerBookElement.getBoundingClientRect().x-t.x:0}},{key:"outerBookOriginalWidth",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().width/this.scaleValue:0}},{key:"outerBookOriginalHeight",get:function(){return this.outerBookElement?this.outerBookElement.getBoundingClientRect().height/this.scaleValue:0}},{key:"isSideMenuDefault",get:function(){return"A"===g.sideMenuType||"B"===g.sideMenuType}},{key:"onResize",value:function(t){this.updateUi(),this.setDisplayType()}},{key:"initComponent",value:function(){new jn("page-container"),new zi("left-book-border"),new zi("right-book-border"),new Zi("drawing-canvas"),this.element&&new qi("highlight-box",this.element)}},{key:"initMenuComponent",value:function(){this.sideMenuComponent.push(new Hi("first-side-menu")),this.sideMenuComponent.push(new Hi("second-side-menu"))}},{key:"updateUi",value:function(){var t,e;this.setAppRotationValue(),this.setViewerStyle(),this.setTargetToPageContainer(),this.setPageContainerSize(),this.calculateZoomRate(),this.setPageContainerScale(),this.setCanvasStyle(),this.setOuterBookSize(),Nn.destroy(),this.setViewerPoint(),this.setViewerSize(),null===(t=E.getComponent("first-side-menu"))||void 0===t||t.updateUi(),null===(e=E.getComponent("second-side-menu"))||void 0===e||e.updateUi()}},{key:"setDisplayType",value:function(){Ni()&&(this.isWindowPortrait()?ze.setDisplayType(!0):ze.setDisplayType(!1))}},{key:"setViewerStyle",value:function(){var t,e;null===(t=E.appComponent)||void 0===t||t.removeClassByPrefix("--menu-type-"),null===(e=E.appComponent)||void 0===e||e.addClass("--menu-type-".concat(g.sideMenuType)),g.isUiDebug&&this.addClass("--debug")}},{key:"setTargetToPageContainer",value:function(){this.targetElement=this.pageContainerElement,this.targetElement&&(this.setCss("transform-origin","left top",this.targetElement),this.setCss("min-width",L(g.computedPageWidth),this.targetElement),this.setCss("left",g.pageBorder?L(g.borderWidth):"0",this.targetElement)),this.targetMarginLeft=0,g.pageBorder&&(this.targetMarginLeft+=g.borderWidth),0!==this.sideMenuComponent.length&&this.isSideMenuDefault&&(this.targetMarginLeft+=this.sideMenuComponent[0].getLeftOccupiedSpace())}},{key:"setPageContainerSize",value:function(){this.width=g.computedPageWidth,this.height=g.pageHeight,this.setSize(this.width,this.height,this.pageContainerElement)}},{key:"setPageContainerScale",value:function(){this.setScale(this.zoomRate,this.pageContainerElement)}},{key:"setCanvasStyle",value:function(){var t,e=null===(t=E.drawingCanvas)||void 0===t?void 0:t.element;this.setSize(g.computedPageWidth,g.pageHeight,e),this.setScale(this.zoomRate,e)}},{key:"setOuterBookSize",value:function(){var t=g.computedPageWidth*this.zoomRate,e=this.computedHeight;g.pageBorder&&(t+=2*g.borderWidth),this.setSize(t,e,this.outerBookElement)}},{key:"setViewerPoint",value:function(){var t=this.top,e=this.left;this.setAbsolute(t,null,null,e)}},{key:"setViewerSize",value:function(){this.viewerWidth=this.computedWidth,this.viewerHeight=this.computedHeight,g.pageBorder&&(this.viewerWidth+=2*g.borderWidth),0!==this.sideMenuComponent.length&&this.isSideMenuDefault&&(this.viewerWidth+=2*this.sideMenuComponent[0].getLeftOccupiedSpace()),this.setSize(this.viewerWidth,this.viewerHeight)}},{key:"setAppRotationValue",value:function(){var t,e;Ni()&&(this.isWindowPortrait()?null===(t=E.appComponent)||void 0===t||t.setOptionPortrait():null===(e=E.appComponent)||void 0===e||e.setOptionLandscape())}},{key:"resetOuterBookScale",value:function(){var t=this.outerBookElement;this.setCss("top","",t),this.setCss("left","",t),this.setCss("transform","",t),this.setCss("clip-path","",t),this.scaleValue=this.scaleMin}},{key:"scaleOuterBook",value:function(){this.setScale(this.scaleValue,this.outerBookElement)}},{key:"panOuterBook",value:function(t){var e=this.getPoint(this.outerBookElement);e.x-=t.x,e.y-=t.y,e.x>0&&(e.x=0),e.y>0&&(e.y=0),e.x+this.outerBookWidth0&&void 0!==arguments[0]?arguments[0]:new C(0,0);this.scaleOuterBook(),this.panOuterBook(t),this.clipOuterBook()}},{key:"increaseScaleValue",value:function(){this.scaleValue+=this.scaleStep,this.scaleValue>this.scaleMax&&(this.scaleValue=this.scaleMax)}},{key:"decreaseScaleValue",value:function(){this.scaleValue-=this.scaleStep,this.scaleValuethis.scaleMax?this.scaleValue=this.scaleMax:this.scaleValue=t}}]),n}(wn);function tr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var er=function(t){s(n,t);var e=tr(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,'
',{parentElement:r,className:"global-toast-host"})),"timeout",new Pn),o}return o(n,[{key:"updateUi",value:function(){}},{key:"show",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1500;this.fadeInElement((function(){n.setMessage(t,e),n.timeout.trigger(i,(function(){n.fadeOutElement()}))}))}},{key:"setMessage",value:function(t,e){var n=this.child(".message");n&&(this.removeClassByPrefix("--",n),this.addClass("--".concat(e),n)),this.setHtml(t,this.child(".message"))}},{key:"fadeInElement",value:function(t){var e=this;this.append(),this.timeout.trigger(0,(function(){e.setOn(),t()}))}},{key:"fadeOutElement",value:function(){var t=this;this.setOn(!1),this.timeout.trigger(300,(function(){t.removeElement()}))}}]),n}(V),nr=function(){var t=e(p().mark((function t(){var e;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,X("./config.json");case 3:(e=t.sent).contentInformationURL&&(g.bookUrl=e.contentInformationURL),void 0!==e.strictPageReload&&null!==e.strictPageReload&&(g.strictPageReload=e.strictPageReload),e.errorLevel&&(g.errorLevel=e.errorLevel),void 0!==e.enableContentLog&&null!==e.enableContentLog&&(g.enableContentLog=e.enableContentLog),e.pageShowMode&&(g.pageShowMode=e.pageShowMode),t.next=13;break;case 11:t.prev=11,t.t0=t.catch(0);case 13:case"end":return t.stop()}}),t,null,[[0,11]])})));return function(){return t.apply(this,arguments)}}(),ir=function(){var t=e(p().mark((function t(){var e,n,i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,X("./theme.json");case 3:e=t.sent,n=e.app,i=e.sideMenu,n&&n.backgroundColor&&(g.app.backgroundColor=n.backgroundColor),i&&(i.type&&(g.sideMenu.type=i.type),i.width&&(g.sideMenu.width=i.width),i.height&&(g.sideMenu.height=i.height),i.backgroundColor&&(g.sideMenu.backgroundColor=i.backgroundColor),i.favoriteItems&&(g.sideMenu.favoriteItems=i.favoriteItems),i.otherItems&&(g.sideMenu.otherItems=i.otherItems)),t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(){return t.apply(this,arguments)}}(),rr=function(){var t=He("contentInformationURL"),e=He("contentUrl"),n=He("bookUrl"),i=He("page"),r=He("singlePage"),o=He("testRequestSpeed"),a=He("pageShowMode"),s=He("flippingTime"),u=He("usePinchZoom");t&&(g.bookUrl=t),e&&(g.bookUrl=e),n&&(g.bookUrl=n),null!==r&&(g.isSinglePage=N(r)),i&&(g.currentPageNumber=M(i),g.hasUriPage=!0),null!==o&&(g.testRequestSpeed=N(o)),a&&(g.pageShowMode=a),s&&(g.flippingTime=M(s)),null!==u&&(g.usePinchZoom=N(u))};function or(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return ar(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ar(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:"",e=this.render.getRect().left+this.render.getRect().width/2,n=this.state.hardDrawingAngle,i=t+"\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n clip-path: none;\n -webkit-clip-path: none;\n "+(this.orientation===fe.LEFT?"transform-origin: ".concat(this.render.getRect().pageWidth,"px 0; \n transform: translate3d(0, 0, 0) rotateY(").concat(n,"deg);"):"transform-origin: 0 0; \n transform: translate3d(".concat(e,"px, 0, 0) rotateY(").concat(n,"deg);"));this.element.style.cssText=i}},{key:"drawSoft",value:function(t){var e,n="polygon(",i=or(this.state.area);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(null!==r){var o=this.render.getDirection()===Ae.BACK?{x:-r.x+this.state.position.x,y:r.y-this.state.position.y}:{x:r.x-this.state.position.x,y:r.y-this.state.position.y};n+=(o=Be.GetRotatedPoint(o,{x:0,y:0},this.state.angle)).x+"px "+o.y+"px, "}}}catch(t){i.e(t)}finally{i.f()}n=n.slice(0,-2),n+=")";var a=this.render.isSafari()&&0===this.state.angle?"translate(".concat(t.x,"px, ").concat(t.y,"px)"):"translate3d(".concat(t.x,"px, ").concat(t.y,"px, 0) rotate(").concat(this.state.angle,"rad)");this.setElementStyle("transformOrigin","0 0"),this.setElementStyle("transform",a),this.setElementStyle("clipPath",n)}},{key:"simpleDraw",value:function(t){var e=this.render.getRect(),n=e.pageWidth,i=e.height,r=t===fe.RIGHT?e.left+e.pageWidth:e.left,o=e.top;this.element.classList.add("--simple"),this.element.style.cssText="\n position: absolute; \n display: block; \n height: ".concat(i,"px; \n left: ").concat(r,"px; \n top: ").concat(o,"px; \n width: ").concat(n,"px; \n z-index: ").concat(this.render.getSettings().startZIndex+1,";")}},{key:"getElement",value:function(){return this.element}},{key:"load",value:function(){this.isLoad=!0}},{key:"setOrientation",value:function(t){Dn(h(n.prototype),"setOrientation",this).call(this,t),this.element.classList.remove("--left","--right"),this.element.classList.add(t===fe.RIGHT?"--right":"--left")}},{key:"setDrawingDensity",value:function(t){this.element.classList.remove("--soft","--hard"),this.element.classList.add("--"+t),Dn(h(n.prototype),"setDrawingDensity",this).call(this,t)}},{key:"removeSimpleClassName",value:function(){this.element.classList.contains("--simple")&&this.element.classList.remove("--simple")}}]),n}(Le);function lr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return cr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cr(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function cr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=0&&t0?this.pages[e-1]:null}},{key:"getFlippingPage",value:function(t){if(this.app.getOrientation()===Re.PORTRAIT){if(t===Ae.FORWARD){var e=0===this.currentSpreadIndex?2:0;return this.pages[e+1]}var n=1===this.currentSpreadIndex?1:3;return this.pages[n]}var i=0===this.currentSpreadIndex?2:0;return t===Ae.FORWARD?this.pages[i]:this.pages[i+1]}},{key:"getBottomPage",value:function(t){if(this.app.getOrientation()===Re.PORTRAIT){if(t===Ae.FORWARD){var e=0===this.currentSpreadIndex?2:0;return this.pages[e]}var n=1===this.currentSpreadIndex?0:2;return this.pages[n]}var i=0===this.currentSpreadIndex?2:0;return t===Ae.FORWARD?this.pages[i+1]:this.pages[i]}},{key:"setPages",value:function(){var t=0===this.currentSpreadIndex?0:2;this.render.setLeftPage(this.pages[t]),this.render.setRightPage(this.pages[t+1])}},{key:"showNext",value:function(){this.currentSpreadIndex0?this.currentSpreadIndex--:this.currentSpreadIndex=this.getSpread().length-1,this.showSpread()}},{key:"getCurrentPageIndex",value:function(){return this.currentPageIndex}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null===t&&(t=this.currentPageIndex),!(t<0||t>=this.pages.length)){var e=this.getSpreadIndexByPage(t);null!==e&&(this.currentSpreadIndex=e,this.showSpread())}}},{key:"getCurrentSpreadIndex",value:function(){return this.currentSpreadIndex}},{key:"setCurrentSpreadIndex",value:function(t){this.currentSpreadIndex=t}},{key:"removeSimpleClassName",value:function(){var t,e=lr(this.getPages());try{for(e.s();!(t=e.n()).done;){t.value.removeSimpleClassName()}}catch(t){e.e(t)}finally{e.f()}}},{key:"showSpread",value:function(){var t=this.getSpread()[this.currentSpreadIndex];2===t.length?(this.render.setLeftPage(this.pages[t[0]]),this.render.setRightPage(this.pages[t[1]])):this.render.getOrientation()===Re.LANDSCAPE&&t[0]===this.pages.length-1?(this.render.setLeftPage(this.pages[t[0]]),this.render.setRightPage(null)):(this.render.setLeftPage(null),this.render.setRightPage(this.pages[t[0]])),this.currentPageIndex=t[0],this.app.updatePageIndex(this.currentPageIndex)}}]),t}();function fr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var pr,dr=function(t){s(n,t);var e=fr(n);function n(t,r,o,a){var s;return i(this,n),(s=e.call(this,t,r)).element=o,s.pagesElement=a,s}return o(n,[{key:"load",value:function(){for(var t=0,e=Array.from(this.pagesElement);t0){var e=t.changedTouches[0],n=o.getMousePos(e.clientX,e.clientY);o.touchPoint={point:n,time:Date.now()},null!==o.touchPoint&&o.app.startUserTouch(n),o.app.getSettings().mobileScrollSupport||t.preventDefault()}})),d(this,"onTouchMove",(function(t){if(o.app.isBlockEnabled&&t.changedTouches.length>0){var e=t.changedTouches[0],n=o.getMousePos(e.clientX,e.clientY);o.app.getSettings().mobileScrollSupport?(null!==o.touchPoint&&(Math.abs(o.touchPoint.point.x-n.x)>10||o.app.getState()!==Me.READ)&&t.cancelable&&o.app.userMove(n,!0),o.app.getState()!==Me.READ&&t.preventDefault()):o.app.userMove(n,!0)}})),d(this,"onTouchEnd",(function(t){if(t.changedTouches.length>0){var e=t.changedTouches[0],n=o.getMousePos(e.clientX,e.clientY);o.touchPoint=null,o.app.userStop(n)}})),this.parentElement=e,e.classList.add("stf__parent"),e.insertAdjacentHTML("afterbegin",'
'),this.wrapper=e.querySelector(".stf__wrapper"),this.wrapper.insertAdjacentHTML("afterbegin",'
'),this.distElement=e.querySelector(".stf__block"),this.app=n;var a=this.app.getSettings().usePortrait?1:2;e.style.minWidth=r.minWidth*a+"px",e.style.minHeight=r.minHeight+"px",r.size===pr.FIXED&&(e.style.minHeight=r.height+"px",e.style.minWidth=n.isSinglePage?r.width+"px":2*r.width+"px"),r.autoSize&&(e.style.width="100%",e.style.maxWidth=2*r.maxWidth+"px"),e.style.display="block",this.swipeDistance=r.swipeDistance}return o(t,[{key:"destroy",value:function(){this.app.getSettings().useMouseEvents&&this.removeHandlers(),this.distElement.remove(),this.wrapper.remove()}},{key:"getDistElement",value:function(){return this.distElement}},{key:"getWrapper",value:function(){return this.wrapper}},{key:"setOrientationStyle",value:function(t){this.wrapper.classList.remove("--portrait","--landscape"),t===Re.PORTRAIT?(this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%"),this.wrapper.classList.add("--portrait")):(this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%"),this.wrapper.classList.add("--landscape")),this.update()}},{key:"addOptionClass",value:function(t){this.parentElement.classList.add("--".concat(t))}},{key:"removeOptionClass",value:function(){for(var t=0;t=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){throw t})),f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){s=!0,o=t})),f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function br(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n2&&void 0!==arguments[2]?arguments[2]:null;if(this.events.has(t)){var i=this.events.get(t);if(i){var r,o=wr(i);try{for(o.s();!(r=o.n()).done;){var a=r.value;a({data:n,object:e})}}catch(t){o.e(t)}finally{o.f()}}}}}]),t}();function kr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Pr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pr(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Pr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n\n
\n
\n
'),this.outerShadow=this.element.querySelector(".stf__outerShadow"),this.innerShadow=this.element.querySelector(".stf__innerShadow"),this.hardShadow=this.element.querySelector(".stf__hardShadow"),this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}},{key:"clearShadow",value:function(){Dn(h(n.prototype),"clearShadow",this).call(this),this.outerShadow&&this.innerShadow&&this.hardShadow&&this.hardInnerShadow&&(this.outerShadow.style.cssText="display: none",this.innerShadow.style.cssText="display: none",this.hardShadow.style.cssText="display: none",this.hardInnerShadow.style.cssText="display: none")}},{key:"reload",value:function(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}},{key:"drawHardInnerShadow",value:function(){if(this.shadow&&this.hardInnerShadow){var t=this.getRect(),e=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress,n=(100-e)*(2.5*t.pageWidth)/100+20;n>t.pageWidth&&(n=t.pageWidth);var i="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+5).toString(10),";\n width: ").concat(n,"px;\n height: ").concat(t.height,"px;\n background: linear-gradient(to right,\n rgba(0, 0, 0, ").concat(this.shadow.opacity*e/100,") 5%,\n rgba(0, 0, 0, 0) 100%);\n left: ").concat(t.left+t.width/2,"px;\n transform-origin: 0 0;\n ");i+=this.getDirection()===Ae.FORWARD&&this.shadow.progress>100||this.getDirection()===Ae.BACK&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);",this.hardInnerShadow.style.cssText=i}}},{key:"drawHardOuterShadow",value:function(){if(this.shadow&&this.hardShadow){var t=this.getRect(),e=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*t.pageWidth)/100+20;e>t.pageWidth&&(e=t.pageWidth);var n="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+4).toString(10),";\n width: ").concat(e,"px;\n height: ").concat(t.height,"px;\n background: linear-gradient(to left, rgba(0, 0, 0, ").concat(this.shadow.opacity,") 5%, rgba(0, 0, 0, 0) 100%);\n left: ").concat(t.left+t.width/2,"px;\n transform-origin: 0 0;\n ");n+=this.getDirection()===Ae.FORWARD&&this.shadow.progress>100||this.getDirection()===Ae.BACK&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);",this.hardShadow.style.cssText=n}}},{key:"drawInnerShadow",value:function(){var t;if(this.shadow&&this.innerShadow&&this.pageRect){for(var e=this.getRect(),n=3*this.shadow.width/4,i=this.getDirection()===Ae.FORWARD?n:0,r=this.getDirection()===Ae.FORWARD?"to left":"to right",o=null!==(t=this.convertToGlobal(this.shadow.pos))&&void 0!==t?t:{x:0,y:0},a=this.shadow.angle+3*Math.PI/2,s="polygon(",u=0,l=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];u0&&void 0!==arguments[0]?arguments[0]:_e.TOP,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.flipTriggerName="flipNext",this.flipController.flipNext(t,e)}},{key:"flipPrev",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_e.TOP;this.flipTriggerName="flipPrev",this.flipController.flipPrev(t)}},{key:"flip",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_e.TOP;this.flipController.flipToPage(t,e)}},{key:"updateState",value:function(t){this.trigger("changeState",this,t)}},{key:"updatePageIndex",value:function(t){this.trigger("flip",this,t)}},{key:"updateOrientation",value:function(t){this.ui.setOrientationStyle(t),this.update(),this.trigger("changeOrientation",this,t)}},{key:"getPageCount",value:function(){return this.pages.getPageCount()}},{key:"getCurrentPageIndex",value:function(){return this.pages.getCurrentPageIndex()}},{key:"getPage",value:function(t){return this.pages.getPage(t)}},{key:"getRender",value:function(){return this.render}},{key:"getFlipController",value:function(){return this.flipController}},{key:"getDirection",value:function(){return this.render.getDirection()}},{key:"getOrientation",value:function(){return this.render.getOrientation()}},{key:"getBoundsRect",value:function(){return this.render.getRect()}},{key:"getSettings",value:function(){return this.setting}},{key:"getUI",value:function(){return this.ui}},{key:"getState",value:function(){return this.flipController.getState()}},{key:"getPageCollection",value:function(){return this.pages}},{key:"startUserTouch",value:function(t){this.flipController.setDirectionByPoint(t),this.mousePosition=t,this.isUserTouch=!0,this.isUserMove=!1}},{key:"userMove",value:function(t,e){if(this.isBlockEnabled)if(this.isUserTouch||e||!this.setting.showPageCorners){if(this.isUserTouch){if(!this.flipAvailable())return;this.mousePosition&&Be.GetDistanceBetweenTwoPoint(this.mousePosition,t)>5&&(this.isUserMove=!0,this.flipController.fold(t))}}else this.flipController.showCorner(t)}},{key:"userStop",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isUserTouch&&(this.isUserTouch=!1,!e)){if(this.flipTriggerName="user",!this.isUserMove)return void this.flipController.stopMove();this.flipController.stopMove()}}},{key:"flipAvailable",value:function(){if(this.isSinglePage){if(this.getDirection()===Ae.FORWARD){if(this.viewerCurrentPageIndex>=this.viewerPageCount-1)return!1}else if(this.viewerCurrentPageIndex<=0)return!1}else if(this.getDirection()===Ae.FORWARD){if(this.viewerCurrentPageIndex>=this.viewerPageCount-2)return!1}else if(this.viewerCurrentPageIndex<=0)return!1;return!0}}]),n}(Er),Cr=function(t){var e=t.data,n=t.object.getDirection();"fold_corner"===e?1===n?ze.loadPrevBottomPage():ze.loadNextBottomPage():"user_fold"===e||"flipping"===e?mn.clearDrawing():"read"===e&&mn.initDrawing()},Dr=function(t){var e=t.object;if("user"!==e.flipTriggerName)return mn.initBookmark(),void(ze.isPageSwapped&&ze.reloadBottomPages());var n=e.getDirection();ze.swapPages(),ze.reloadBottomPages(),1===n?ze.setCurrentPageNumberToPrev():ze.setCurrentPageNumberToNext(),k.playFlipPage(),mn.initBookmark(),e.viewerCurrentPageIndex=ze.getCurrentPageIndex(),E.pageSlider&&(E.pageSlider.value=ze.getCurrentPageIndex()),ze.saveCurrentPage()},Or=function(){var t;t=rt(Z),!g.hasUriPage&&t&&t.pageNumber&&(g.currentPageNumber=t.pageNumber),function(){var t=rt(Q),e=U(g.bookUrl);mn.init(e,t)}()},Rr=function(){var t;t=rt(J),gi.load(t)};function Lr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Ar=function(t){s(n,t);var e=Lr(n);function n(t){var r;return i(this,n),(r=e.call(this,t,'
')).addListener(),r}return o(n,[{key:"pageNumberElement",get:function(){return this.child("#page-number")}},{key:"goElement",get:function(){return this.child("#go")}},{key:"inputValue",get:function(){var t=this.pageNumberElement;if(t){var e=M(t.value);return Number.isInteger(e)?e:0}return 0}},{key:"updateUi",value:function(){}},{key:"onClickGo",value:function(){var t=this.inputValue;this.clearPageNumberInput(),0!==t&&ze.isPageNumberAvailable(t)?ze.goPage(t):E.addMessageInfo("잘못된 페이지 번호입니다.")}},{key:"addListener",value:function(){var t,e,n=this;null===(t=this.goElement)||void 0===t||t.addEventListener("click",this.onClickGo.bind(this)),null===(e=this.pageNumberElement)||void 0===e||e.addEventListener("keyup",(function(t){"Enter"===t.key&&(t.preventDefault(),n.onClickGo())}))}},{key:"clearPageNumberInput",value:function(){var t=this.pageNumberElement;t&&(t.value="")}}]),n}(V);function _r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Mr=function(t){s(n,t);var e=_r(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,'
',{parentElement:r,className:"floating-menu-host"})),"isDrag",!1),d(l(o),"windowSize",x.defaultSize),d(l(o),"hostSize",x.defaultSize),d(l(o),"goPage",null),o.addListener(),o}return o(n,[{key:"baseHeight",get:function(){var t,e;return null!==(t=null===(e=this.baseElement)||void 0===e?void 0:e.getBoundingClientRect().height)&&void 0!==t?t:0}},{key:"baseElement",get:function(){return this.child("#base")}},{key:"leftElement",get:function(){return this.child("#left")}},{key:"rightElement",get:function(){return this.child("#right")}},{key:"updateUi",value:function(){this.refreshRectData();var t=!1,e=gi.floatingMenuPoint;if(!e){var n=this.hostSize.width/2+20,i=this.windowSize.height-(this.hostSize.height-this.baseHeight/2)-20;e=new C(n,i),t=!0}this.setElementPoint(e,t)}},{key:"onResize",value:function(t){this.updateUi()}},{key:"onDragStart",value:function(t){this.refreshRectData(),this.isDrag=!0,E.enableBook(!1,this.id)}},{key:"onDragMove",value:function(t){if(this.isDrag){var e=D(t);e&&this.setElementPoint(e)}}},{key:"onDragEnd",value:function(){this.isDrag&&(this.isDrag=!1,E.enableBook(!0,this.id))}},{key:"addListener",value:function(){var t,e,n,i;window.addEventListener("resize",this.onResize.bind(this)),null===(t=this.leftElement)||void 0===t||t.addEventListener("click",(function(){return ze.loadPrevPage()})),null===(e=this.rightElement)||void 0===e||e.addEventListener("click",(function(){return ze.loadNextPage()})),null===(n=this.baseElement)||void 0===n||n.addEventListener("mousedown",this.onDragStart.bind(this),!1),null===(i=this.baseElement)||void 0===i||i.addEventListener("touchstart",this.onDragStart.bind(this),{passive:!0}),window.addEventListener("mousemove",this.onDragMove.bind(this),!1),window.addEventListener("touchmove",this.onDragMove.bind(this),!1),window.addEventListener("mouseup",this.onDragEnd.bind(this),!1),window.addEventListener("touchend",this.onDragEnd.bind(this),!1)}},{key:"setElementPoint",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&(this.correctEventPoint(t),gi.setFloatingMenuPoint(t)),this.restrainBorder(t),this.setPoint(t.x,t.y)}},{key:"refreshRectData",value:function(){this.windowSize=this.getWindowSize(),this.element&&(this.hostSize.width=this.element.getBoundingClientRect().width,this.hostSize.height=this.element.getBoundingClientRect().height)}},{key:"correctEventPoint",value:function(t){return t.x-=this.hostSize.width/2,t.y-=this.baseHeight/2,t}},{key:"restrainBorder",value:function(t){return t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+this.hostSize.width>this.windowSize.width&&(t.x=this.windowSize.width-this.hostSize.width),t.y+this.hostSize.height>this.windowSize.height&&(t.y=this.windowSize.height-this.hostSize.height),t}},{key:"show",value:function(){this.append(),this.goPage||(this.goPage=new Ar("floating-go-page"),this.goPage.addClass("go-page-host")),this.updateUi()}},{key:"hide",value:function(){this.removeElement()}}]),n}(V);function Nr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}var Br=function(t){s(n,t);var e=Nr(n);function n(t,r){var o;return i(this,n),d(l(o=e.call(this,t,'
',{parentElement:r,className:"page-slider-host"})),"rangeSlider",null),d(l(o),"goPage",null),d(l(o),"prevPageIndex",0),d(l(o),"isUserAction",!1),d(l(o),"callbackTimerId",0),o.addListener(),o.updateUi(),o}return o(n,[{key:"thumbnailElement",get:function(){return this.child("#page-slider-thumbnail")}},{key:"value",set:function(t){this.rangeSlider&&!this.isUserAction&&(this.prevPageIndex=t,this.rangeSlider.value=t),this.isUserAction=!1}},{key:"onInputSlider",value:function(t){var e=ze.getThumbnailWithIndex(t),n=this.thumbnailElement;e&&n&&(n.src=e),this.setThumbnailClass()}},{key:"onChangeSlider",value:function(t){var e=this;0===this.callbackTimerId&&(this.callbackTimerId=window.setTimeout((function(){e.callbackTimerId=0}),100),(g.isSinglePage&&this.prevPageIndex!==t||g.isDoublePage&&this.prevPageIndex!==t&&this.prevPageIndex+1!==t)&&(this.prevPageIndex=t,this.isUserAction=!0),ze.goPageWithIndex(t)),this.setThumbnailClass(!1)}},{key:"updateUi",value:function(){var t;null===(t=this.rangeSlider)||void 0===t||t.updateUi()}},{key:"addListener",value:function(){var t,e,n,i=this;null===(t=this.element)||void 0===t||t.addEventListener("pointerenter",(function(){E.enableBook(!1,i.id)})),null===(e=this.element)||void 0===e||e.addEventListener("pointerleave",(function(){E.enableBook(!0,i.id)})),null===(n=this.thumbnailElement)||void 0===n||n.addEventListener("load",(function(t){var e=t.target.getBoundingClientRect(),n=e.width/e.height,r=g.pageSliderThumbnailSize,o=0,a=0;n>0?(o=r,a=r/n):(o=r/n,a=r),i.setThumbnailPoint(o),i.setSize(o,a,i.thumbnailElement)}))}},{key:"setThumbnailClass",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.thumbnailElement;e&&this.setOn(t,e)}},{key:"setThumbnailPoint",value:function(t){if(this.rangeSlider){var e=this.rangeSlider.thumbCenterX-t/2;e<0&&(e=0),this.setPoint(e,null,this.thumbnailElement)}}},{key:"show",value:function(){if(this.append(),!this.rangeSlider){var t=ze.getPageCount(),e=ze.getCurrentPageIndex();this.prevPageIndex=e,this.rangeSlider=new Ln("page-slider-range",0,t-1,e,this.onInputSlider.bind(this),this.onChangeSlider.bind(this)),this.rangeSlider.addClass("range-slider-host")}this.goPage||(this.goPage=new Ar("page-slider-go-page"),this.goPage.addClass("go-page-host")),this.updateUi()}},{key:"hide",value:function(){this.removeElement()}}]),n}(V);function Ur(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=h(t);if(e){var r=h(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}new(function(t){s(u,t);var n,r,a=Ur(u);function u(t){var e;return i(this,u),(e=a.call(this,t,'
')).init(),e}return o(u,[{key:"updateUi",value:function(){}},{key:"init",value:(r=e(p().mark((function t(){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.initToast(),this.initApi(),t.next=4,nr();case 4:return t.next=6,ir();case 6:return this.initAppTheme(),this.initComponent(),rr(),Or(),t.next=12,this.loadBook();case 12:this.initPageFlip(),Rr(),this.setOn();case 15:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"initApi",value:function(){P("VIEWER_VERSION",(function(){return"3.1.12"})),P("SHOW_CONFIG",(function(){return console.log(g)})),function(t){P("GET_VARIABLE",t)}((function(t){return E.getClientVariable(t)})),function(t){P("SET_VARIABLE",t)}((function(t,e){return E.setClientVariable(t,e)}))}},{key:"initToast",value:function(){this.element&&new er("global-toast",this.element)}},{key:"initAppTheme",value:function(){g.usePinchZoom&&document.styleSheets[0].insertRule("* { touch-action: none; }"),this.setCss("backgroundColor",g.app.backgroundColor)}},{key:"initComponent",value:function(){new Ji("viewer-wrapper"),this.element&&(new Mr("floating-menu",this.element),new Br("page-slider",this.element))}},{key:"initPageFlip",value:function(){var t,e,n,i,r,o=(t="page-container",e="page-host",n={width:g.pageWidth,height:g.pageHeight,flippingTime:g.flippingTime,maxShadowOpacity:.5,disableFlipByClick:!0,startZIndex:100},i=document.getElementById(t),r=document.querySelectorAll(".".concat(e)),new xr(i,r,n));o.on("changeState",Cr),o.on("flip",Dr),o.viewerCurrentPageIndex=ze.getCurrentPageIndex(),o.viewerPageCount=ze.getPageCount(),ze.pageFlip=o}},{key:"loadBook",value:(n=e(p().mark((function t(){var e;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ze.loadBook();case 2:e=ze.getCurrentPageIndex(!1),g.isDoublePage&&ze.isRightPageIndex(e)&&(ze.setCurrentPageIndex(e-1),e=ze.getCurrentPageIndex(!1)),ze.loadPageWithIndex(e),ze.saveCurrentPage(),mn.initBookmark(),mn.initDrawing();case 8:case"end":return t.stop()}}),t)}))),function(){return n.apply(this,arguments)})},{key:"isPortrait",value:function(){return!!Ni()&&!!this.hasClass("--portrait")}},{key:"isLandscape",value:function(){return!Ni()||!!this.hasClass("--landscape")}},{key:"setOptionPortrait",value:function(){Ni()&&(this.hasClass("--portrait")||(this.removeClass("--landscape"),this.addClass("--portrait")))}},{key:"setOptionLandscape",value:function(){Ni()&&(this.hasClass("--landscape")||(this.removeClass("--portrait"),this.addClass("--landscape")))}}]),u}(V))("app")})()})();