wk-ie-ai-customer 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3329,7 +3329,6 @@ WkCustomerServiceSDK.prototype.init = function (options) {
|
|
|
3329
3329
|
self.container.style.overflow = "hidden";
|
|
3330
3330
|
self.container.style.margin = "0";
|
|
3331
3331
|
self.container.style.padding = "0";
|
|
3332
|
-
self.container.style.borderRadius = "50%";
|
|
3333
3332
|
// 确保容器有背景色,即使iframe还没加载也能看到
|
|
3334
3333
|
self.container.style.backgroundColor = "transparent";
|
|
3335
3334
|
|
|
@@ -3325,7 +3325,6 @@ WkCustomerServiceSDK.prototype.init = function (options) {
|
|
|
3325
3325
|
self.container.style.overflow = "hidden";
|
|
3326
3326
|
self.container.style.margin = "0";
|
|
3327
3327
|
self.container.style.padding = "0";
|
|
3328
|
-
self.container.style.borderRadius = "50%";
|
|
3329
3328
|
// 确保容器有背景色,即使iframe还没加载也能看到
|
|
3330
3329
|
self.container.style.backgroundColor = "transparent";
|
|
3331
3330
|
|
|
@@ -3333,7 +3333,6 @@
|
|
|
3333
3333
|
self.container.style.overflow = "hidden";
|
|
3334
3334
|
self.container.style.margin = "0";
|
|
3335
3335
|
self.container.style.padding = "0";
|
|
3336
|
-
self.container.style.borderRadius = "50%";
|
|
3337
3336
|
// 确保容器有背景色,即使iframe还没加载也能看到
|
|
3338
3337
|
self.container.style.backgroundColor = "transparent";
|
|
3339
3338
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).wkAiCustomerInstance=e()}(this,function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function e(t,e,i){return e=n(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,[],n(t).constructor):e.apply(t,i))}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(s=function(){return!!t})()}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,i){if(e){if("string"==typeof e)return t(e,i);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,i):void 0}}(e)||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.")}()}function h(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}!function(){try{"undefined"==typeof globalThis&&("undefined"!=typeof window?window.globalThis=window:"undefined"!=typeof global?global.globalThis=global:"undefined"!=typeof self&&(self.globalThis=self))}catch(t){}}();var f,l,c,p,d,y,v,m,g,b,w,T,F,B,x,E,I,S={exports:{}},D=S.exports;function q(){return f||(f=1,function(t){(function(){var e;function i(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function r(){return new i(null)}var n="undefined"!=typeof navigator;n&&"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(t,e,i,r,n,o){for(var s=32767&e,u=e>>15;--o>=0;){var a=32767&this[t],h=this[t++]>>15,f=u*a+h*s;n=((a=s*a+((32767&f)<<15)+i[r]+(1073741823&n))>>>30)+(f>>>15)+u*h+(n>>>30),i[r++]=1073741823&a}return n},e=30):n&&"Netscape"!=navigator.appName?(i.prototype.am=function(t,e,i,r,n,o){for(;--o>=0;){var s=e*this[t++]+i[r]+n;n=Math.floor(s/67108864),i[r++]=67108863&s}return n},e=26):(i.prototype.am=function(t,e,i,r,n,o){for(var s=16383&e,u=e>>14;--o>=0;){var a=16383&this[t],h=this[t++]>>14,f=u*a+h*s;n=((a=s*a+((16383&f)<<14)+i[r]+n)>>28)+(f>>14)+u*h,i[r++]=268435455&a}return n},e=28),i.prototype.DB=e,i.prototype.DM=(1<<e)-1,i.prototype.DV=1<<e;i.prototype.FV=Math.pow(2,52),i.prototype.F1=52-e,i.prototype.F2=2*e-52;var o,s,u=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)u[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)u[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)u[o++]=s;function a(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function h(t,e){var i=u[t.charCodeAt(e)];return null==i?-1:i}function f(t){var e=r();return e.fromInt(t),e}function l(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function c(t){this.m=t}function p(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function d(t,e){return t&e}function y(t,e){return t|e}function v(t,e){return t^e}function m(t,e){return t&~e}function g(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function b(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function w(){}function T(t){return t}function F(t){this.r2=r(),this.q3=r(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}c.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},c.prototype.revert=function(t){return t},c.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},c.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},c.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},p.prototype.convert=function(t){var e=r();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(i.ZERO)>0&&this.m.subTo(e,e),e},p.prototype.revert=function(t){var e=r();return t.copyTo(e),this.reduce(e),e},p.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},p.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},p.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var u=8==r?255&t[n]:h(t,n);u<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=u:s+r>this.DB?(this[this.t-1]|=(u&(1<<this.DB-s)-1)<<s,this[this.t++]=u>>this.DB-s):this[this.t-1]|=u<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},i.prototype.drShiftTo=function(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},i.prototype.lShiftTo=function(t,e){var i,r=t%this.DB,n=this.DB-r,o=(1<<n)-1,s=Math.floor(t/this.DB),u=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)e[i+s+1]=this[i]>>n|u,u=(this[i]&o)<<r;for(i=s-1;i>=0;--i)e[i]=0;e[s]=u,e.t=this.t+s+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,o=(1<<r)-1;e[0]=this[i]>>r;for(var s=i+1;s<this.t;++s)e[s-i-1]|=(this[s]&o)<<n,e[s-i]=this[s]>>r;r>0&&(e[this.t-i-1]|=(this.s&o)<<n),e.t=this.t-i,e.clamp()}},i.prototype.subTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},i.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),o=r.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+r.t]=r.am(0,n[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&i.ZERO.subTo(e,e)},i.prototype.squareTo=function(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,e,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=r());var u=r(),a=this.s,h=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,u),s.lShiftTo(f,n)):(o.copyTo(u),s.copyTo(n));var c=u.t,p=u[c-1];if(0!=p){var d=p*(1<<this.F1)+(c>1?u[c-2]>>this.F2:0),y=this.FV/d,v=(1<<this.F1)/d,m=1<<this.F2,g=n.t,b=g-c,w=null==e?r():e;for(u.dlShiftTo(b,w),n.compareTo(w)>=0&&(n[n.t++]=1,n.subTo(w,n)),i.ONE.dlShiftTo(c,w),w.subTo(u,u);u.t<c;)u[u.t++]=0;for(;--b>=0;){var T=n[--g]==p?this.DM:Math.floor(n[g]*y+(n[g-1]+m)*v);if((n[g]+=u.am(0,T,n,b,0,c))<T)for(u.dlShiftTo(b,w),n.subTo(w,n);n[g]<--T;)n.subTo(w,n)}null!=e&&(n.drShiftTo(c,e),a!=h&&i.ZERO.subTo(e,e)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),a<0&&i.ZERO.subTo(n,n)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},i.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},i.prototype.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var n=r(),o=r(),s=e.convert(this),u=l(t)-1;for(s.copyTo(n);--u>=0;)if(e.sqrTo(n,o),(t&1<<u)>0)e.mulTo(o,s,n);else{var a=n;n=o,o=a}return e.revert(n)},i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<<e)-1,n=!1,o="",s=this.t,u=this.DB-s*this.DB%e;if(s-- >0)for(u<this.DB&&(i=this[s]>>u)>0&&(n=!0,o=a(i));s>=0;)u<e?(i=(this[s]&(1<<u)-1)<<e-u,i|=this[--s]>>(u+=this.DB-e)):(i=this[s]>>(u-=e)&r,u<=0&&(u+=this.DB,--s)),i>0&&(n=!0),n&&(o+=a(i));return n?o:"0"},i.prototype.negate=function(){var t=r();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var e=r();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},i.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new c(e):new p(e),this.exp(t,i)},i.ZERO=f(0),i.ONE=f(1),w.prototype.convert=T,w.prototype.revert=T,w.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},w.prototype.sqrTo=function(t,e){t.squareTo(e)},F.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=r();return t.copyTo(e),this.reduce(e),e},F.prototype.revert=function(t){return t},F.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},F.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},F.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var B,x,E,I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],S=(1<<26)/I[I.length-1];function D(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=k&&(E-=k)}if(i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),n=f(i),o=r(),s=r(),u="";for(this.divRemTo(n,o,s);o.signum()>0;)u=(i+s.intValue()).toString(t).substr(1)+u,o.divRemTo(n,o,s);return s.intValue().toString(t)+u},i.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),o=!1,s=0,u=0,a=0;a<t.length;++a){var f=h(t,a);f<0?"-"==t.charAt(a)&&0==this.signum()&&(o=!0):(u=e*u+f,++s>=r&&(this.dMultiply(n),this.dAddOffset(u,0),s=0,u=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(u,0)),o&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},i.prototype.bitwiseTo=function(t,e,i){var r,n,o=Math.min(t.t,this.t);for(r=0;r<o;++r)i[r]=e(this[r],t[r]);if(t.t<this.t){for(n=t.s&this.DM,r=o;r<this.t;++r)i[r]=e(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=o;r<t.t;++r)i[r]=e(n,t[r]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},i.prototype.changeBit=function(t,e){var r=i.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},i.prototype.addTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},i.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(t,e,i){var r,n=Math.min(this.t+t.t,e);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(r=i.t-this.t;n<r;++n)i[n+this.t]=this.am(0,t[n],i,n,0,this.t);for(r=Math.min(t.t,e);n<r;++n)this.am(0,t[n],i,n,0,e-n);i.clamp()},i.prototype.multiplyUpperTo=function(t,e,i){--e;var r=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)},i.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},i.prototype.millerRabin=function(t){var e=this.subtract(i.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var o=e.shiftRight(n);(t=t+1>>1)>I.length&&(t=I.length);for(var s=r(),u=0;u<t;++u){s.fromInt(I[Math.floor(Math.random()*I.length)]);var a=s.modPow(o,this);if(0!=a.compareTo(i.ONE)&&0!=a.compareTo(e)){for(var h=1;h++<n&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(i.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},i.prototype.clone=function(){var t=r();return this.copyTo(t),t},i.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),128&i&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},i.prototype.equals=function(t){return 0==this.compareTo(t)},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var e=r();return this.bitwiseTo(t,d,e),e},i.prototype.or=function(t){var e=r();return this.bitwiseTo(t,y,e),e},i.prototype.xor=function(t){var e=r();return this.bitwiseTo(t,v,e),e},i.prototype.andNot=function(t){var e=r();return this.bitwiseTo(t,m,e),e},i.prototype.not=function(){for(var t=r(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},i.prototype.shiftLeft=function(t){var e=r();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},i.prototype.shiftRight=function(t){var e=r();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},i.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+g(this[t]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=b(this[i]^e);return t},i.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},i.prototype.setBit=function(t){return this.changeBit(t,y)},i.prototype.clearBit=function(t){return this.changeBit(t,m)},i.prototype.flipBit=function(t){return this.changeBit(t,v)},i.prototype.add=function(t){var e=r();return this.addTo(t,e),e},i.prototype.subtract=function(t){var e=r();return this.subTo(t,e),e},i.prototype.multiply=function(t){var e=r();return this.multiplyTo(t,e),e},i.prototype.divide=function(t){var e=r();return this.divRemTo(t,e,null),e},i.prototype.remainder=function(t){var e=r();return this.divRemTo(t,null,e),e},i.prototype.divideAndRemainder=function(t){var e=r(),i=r();return this.divRemTo(t,e,i),new Array(e,i)},i.prototype.modPow=function(t,e){var i,n,o=t.bitLength(),s=f(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new c(e):e.isEven()?new F(e):new p(e);var u=new Array,a=3,h=i-1,d=(1<<i)-1;if(u[1]=n.convert(this),i>1){var y=r();for(n.sqrTo(u[1],y);a<=d;)u[a]=r(),n.mulTo(y,u[a-2],u[a]),a+=2}var v,m,g=t.t-1,b=!0,w=r();for(o=l(t[g])-1;g>=0;){for(o>=h?v=t[g]>>o-h&d:(v=(t[g]&(1<<o+1)-1)<<h-o,g>0&&(v|=t[g-1]>>this.DB+o-h)),a=i;!(1&v);)v>>=1,--a;if((o-=a)<0&&(o+=this.DB,--g),b)u[v].copyTo(s),b=!1;else{for(;a>1;)n.sqrTo(s,w),n.sqrTo(w,s),a-=2;a>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,u[v],s)}for(;g>=0&&!(t[g]&1<<o);)n.sqrTo(s,w),m=s,s=w,w=m,--o<0&&(o=this.DB-1,--g)}return n.revert(s)},i.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return i.ZERO;for(var r=t.clone(),n=this.clone(),o=f(1),s=f(0),u=f(0),a=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(u.isEven()&&a.isEven()||(u.addTo(this,u),a.subTo(t,a)),u.rShiftTo(1,u)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&o.subTo(u,o),s.subTo(a,s)):(n.subTo(r,n),e&&u.subTo(o,u),a.subTo(s,a))}return 0!=n.compareTo(i.ONE)?i.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},i.prototype.pow=function(t){return this.exp(t,new w)},i.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return e;for(n<o&&(o=n),o>0&&(e.rShiftTo(o,e),i.rShiftTo(o,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},i.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=I[I.length-1]){for(e=0;e<I.length;++e)if(i[0]==I[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<I.length;){for(var r=I[e],n=e+1;n<I.length&&r<S;)r*=I[n++];for(r=i.modInt(r);e<n;)if(r%I[e++]==0)return!1}return i.millerRabin(t)},i.prototype.square=function(){var t=r();return this.squareTo(t),t},i.prototype.Barrett=F,null==x){var q;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var A=new Uint8Array(32);for(window.crypto.getRandomValues(A),q=0;q<32;++q)x[E++]=A[q]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(q=0;q<P.length;++q)x[E++]=255&P.charCodeAt(q)}for(;E<k;)q=Math.floor(65536*Math.random()),x[E++]=q>>>8,x[E++]=255&q;E=0,D()}function O(){if(null==B){for(D(),(B=new M).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return B.next()}function R(){}function M(){this.i=0,this.j=0,this.S=new Array}R.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=O()},M.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},M.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var k=256;t.exports={default:i,BigInteger:i,SecureRandom:R}}).call(D)}(S)),S.exports}function A(){if(c)return l;c=1;var t=q().BigInteger;var n=function(){return r(function t(){i(this,t),this.tlv=null,this.t="00",this.l="00",this.v=""},[{key:"getEncodedHex",value:function(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}},{key:"getLength",value:function(){var t=this.v.length/2,e=t.toString(16);return e.length%2==1&&(e="0"+e),t<128?e:(128+e.length/2).toString(16)+e}},{key:"getValue",value:function(){return""}}])}(),s=function(n){function s(r){var n;return i(this,s),(n=e(this,s)).t="02",r&&(n.v=function(e){var i=e.toString(16);if("-"!==i[0])i.length%2==1?i="0"+i:i.match(/^[0-7]/)||(i="00"+i);else{var r=(i=i.substr(1)).length;r%2==1?r+=1:i.match(/^[0-7]/)||(r+=2);for(var n="",o=0;o<r;o++)n+="f";i=(i=(n=new t(n,16)).xor(e).add(t.ONE)).toString(16).replace(/^-/,"")}return i}(r)),n}return o(s,n),r(s,[{key:"getValue",value:function(){return this.v}}])}(n),u=function(t){function n(t){var r;return i(this,n),(r=e(this,n)).t="30",r.asn1Array=t,r}return o(n,t),r(n,[{key:"getValue",value:function(){return this.v=this.asn1Array.map(function(t){return t.getEncodedHex()}).join(""),this.v}}])}(n);function a(t,e){return+t[e+2]<8?1:128&+t.substr(e+2,2)}function h(e,i){var r=a(e,i),n=e.substr(i+2,2*r);return n?(+n[0]<8?new t(n,16):new t(n.substr(2),16)).intValue():-1}function f(t,e){return e+2*(a(t,e)+1)}return l={encodeDer:function(t,e){var i=new s(t),r=new s(e);return new u([i,r]).getEncodedHex()},decodeDer:function(e){var i=f(e,0),r=f(e,i),n=h(e,i),o=e.substr(r,2*n),s=r+o.length,u=f(e,s),a=h(e,s),l=e.substr(u,2*a);return{r:new t(o,16),s:new t(l,16)}}}}function P(){if(v)return y;v=1;var t=q(),e=t.BigInteger,n=t.SecureRandom,o=function(){if(d)return p;d=1;var t=q().BigInteger,e=new t("2"),n=new t("3"),o=function(){function t(e,r){i(this,t),this.x=r,this.q=e}return r(t,[{key:"equals",value:function(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}},{key:"toBigInteger",value:function(){return this.x}},{key:"negate",value:function(){return new t(this.q,this.x.negate().mod(this.q))}},{key:"add",value:function(e){return new t(this.q,this.x.add(e.toBigInteger()).mod(this.q))}},{key:"subtract",value:function(e){return new t(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}},{key:"multiply",value:function(e){return new t(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}},{key:"divide",value:function(e){return new t(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}},{key:"square",value:function(){return new t(this.q,this.x.square().mod(this.q))}}])}(),s=function(){function e(r,n,o,s){i(this,e),this.curve=r,this.x=n,this.y=o,this.z=null==s?t.ONE:s,this.zinv=null}return r(e,[{key:"getX",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"getY",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"equals",value:function(e){return e===this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO))}},{key:"isInfinity",value:function(){return null===this.x&&null===this.y||this.z.equals(t.ZERO)&&!this.y.toBigInteger().equals(t.ZERO)}},{key:"negate",value:function(){return new e(this.curve,this.x,this.y.negate(),this.z)}},{key:"add",value:function(i){if(this.isInfinity())return i;if(i.isInfinity())return this;var r=this.x.toBigInteger(),n=this.y.toBigInteger(),o=this.z,s=i.x.toBigInteger(),u=i.y.toBigInteger(),a=i.z,h=this.curve.q,f=r.multiply(a).mod(h),l=s.multiply(o).mod(h),c=f.subtract(l),p=n.multiply(a).mod(h),d=u.multiply(o).mod(h),y=p.subtract(d);if(t.ZERO.equals(c))return t.ZERO.equals(y)?this.twice():this.curve.infinity;var v=f.add(l),m=o.multiply(a).mod(h),g=c.square().mod(h),b=c.multiply(g).mod(h),w=m.multiply(y.square()).subtract(v.multiply(g)).mod(h),T=c.multiply(w).mod(h),F=y.multiply(g.multiply(f).subtract(w)).subtract(p.multiply(b)).mod(h),B=b.multiply(m).mod(h);return new e(this.curve,this.curve.fromBigInteger(T),this.curve.fromBigInteger(F),B)}},{key:"twice",value:function(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;var t=this.x.toBigInteger(),i=this.y.toBigInteger(),r=this.z,o=this.curve.q,s=this.curve.a.toBigInteger(),u=t.square().multiply(n).add(s.multiply(r.square())).mod(o),a=i.shiftLeft(1).multiply(r).mod(o),h=i.square().mod(o),f=h.multiply(t).multiply(r).mod(o),l=a.square().mod(o),c=u.square().subtract(f.shiftLeft(3)).mod(o),p=a.multiply(c).mod(o),d=u.multiply(f.shiftLeft(2).subtract(c)).subtract(l.shiftLeft(1).multiply(h)).mod(o),y=a.multiply(l).mod(o);return new e(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),y)}},{key:"multiply",value:function(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;for(var e=t.multiply(n),i=this.negate(),r=this,o=e.bitLength()-2;o>0;o--){r=r.twice();var s=e.testBit(o);s!==t.testBit(o)&&(r=r.add(s?this:i))}return r}}])}(),u=function(){return r(function t(e,r,n){i(this,t),this.q=e,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new s(this,null,null)},[{key:"equals",value:function(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}},{key:"fromBigInteger",value:function(t){return new o(this.q,t)}},{key:"decodePointHex",value:function(i){switch(parseInt(i.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var r=this.fromBigInteger(new t(i.substr(2),16)),n=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new t("4")).add(t.ONE),this.q));return n.toBigInteger().mod(e).equals(new t(i.substr(0,2),16).subtract(e))||(n=n.negate()),new s(this,r,n);case 4:case 6:case 7:var o=(i.length-2)/2,u=i.substr(2,o),a=i.substr(o+2,o);return new s(this,this.fromBigInteger(new t(u,16)),this.fromBigInteger(new t(a,16)));default:return null}}}])}();return p={ECPointFp:s,ECCurveFp:u}}(),s=o.ECCurveFp,u=new n,a=c(),h=a.curve,f=a.G,l=a.n;function c(){var t=new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),i=new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new e("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new s(t,i,r),o=n.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:n,G:o,n:new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function m(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t}return y={getGlobalCurve:function(){return h},generateEcparam:c,generateKeyPairHex:function(t,i,r){var n=(t?new e(t,i,r):new e(l.bitLength(),u)).mod(l.subtract(e.ONE)).add(e.ONE),o=m(n.toString(16),64),s=f.multiply(n);return{privateKey:o,publicKey:"04"+m(s.getX().toBigInteger().toString(16),64)+m(s.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");var i=(t.length-2)/2,r=t.substr(2,i),n="03";return new e(t.substr(i+2,i),16).mod(new e("2")).equals(e.ZERO)&&(n="02"),n+r},utf8ToHex:function(t){for(var e=(t=unescape(encodeURIComponent(t))).length,i=[],r=0;r<e;r++)i[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;for(var n=[],o=0;o<e;o++){var s=i[o>>>2]>>>24-o%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},leftPad:m,arrayToHex:function(t){return t.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join("")},arrayToUtf8:function(t){for(var e=[],i=0,r=0;r<2*t.length;r+=2)e[r>>>3]|=parseInt(t[i],10)<<24-r%8*4,i++;try{for(var n=[],o=0;o<t.length;o++){var s=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(s))}return decodeURIComponent(escape(n.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){var e=[],i=t.length;i%2!=0&&(t=m(t,i+1)),i=t.length;for(var r=0;r<i;r+=2)e.push(parseInt(t.substr(r,2),16));return e},verifyPublicKey:function(t){var e=h.decodePointHex(t);if(!e)return!1;var i=e.getX();return e.getY().square().equals(i.multiply(i.square()).add(i.multiply(h.a)).add(h.b))},comparePublicKeyHex:function(t,e){var i=h.decodePointHex(t);if(!i)return!1;var r=h.decodePointHex(e);return!!r&&i.equals(r)}}}function O(){if(g)return m;g=1;var t=new Uint32Array(68),e=new Uint32Array(64);function i(t,e){var i=31&e;return t<<i|t>>>32-i}function r(t,e){for(var i=[],r=t.length-1;r>=0;r--)i[r]=255&(t[r]^e[r]);return i}function n(t){return t^i(t,9)^i(t,17)}function o(t){return t^i(t,15)^i(t,23)}function s(r){var s=8*r.length,u=s%512;u=u>=448?512-u%448-1:448-u-1;for(var h=new Array((u-7)/8),f=new Array(8),l=0,c=h.length;l<c;l++)h[l]=0;for(var p=0,d=f.length;p<d;p++)f[p]=0;s=s.toString(2);for(var y=7;y>=0;y--)if(s.length>8){var v=s.length-8;f[y]=parseInt(s.substr(v),2),s=s.substr(0,v)}else s.length>0&&(f[y]=parseInt(s,2),s="");for(var m=new Uint8Array([].concat(a(r),[128],h,f)),g=new DataView(m.buffer,0),b=m.length/64,w=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),T=0;T<b;T++){t.fill(0),e.fill(0);for(var F=16*T,B=0;B<16;B++)t[B]=g.getUint32(4*(F+B),!1);for(var x=16;x<68;x++)t[x]=o(t[x-16]^t[x-9]^i(t[x-3],15))^i(t[x-13],7)^t[x-6];for(var E=0;E<64;E++)e[E]=t[E]^t[E+4];for(var I=w[0],S=w[1],D=w[2],q=w[3],A=w[4],P=w[5],O=w[6],R=w[7],M=void 0,k=void 0,C=void 0,H=void 0,L=0;L<64;L++)H=L>=0&&L<=15?2043430169:2055708042,k=(L>=0&&L<=15?I^S^D:I&S|I&D|S&D)+q+((M=i(i(I,12)+A+i(H,L),7))^i(I,12))+e[L],C=(L>=0&&L<=15?A^P^O:A&P|~A&O)+R+M+t[L],q=D,D=i(S,9),S=I,I=k,R=O,O=i(P,19),P=A,A=n(C);w[0]^=I,w[1]^=S,w[2]^=D,w[3]^=q,w[4]^=A,w[5]^=P,w[6]^=O,w[7]^=R}for(var j=[],z=0,N=w.length;z<N;z++){var V=w[z];j.push((4278190080&V)>>>24,(16711680&V)>>>16,(65280&V)>>>8,255&V)}return j}for(var u=new Uint8Array(64),h=new Uint8Array(64),f=0;f<64;f++)u[f]=54,h[f]=92;return m={sm3:s,hmac:function(t,e){for(e.length>64&&(e=s(e));e.length<64;)e.push(0);var i=r(e,u),n=r(e,h),o=s([].concat(a(i),a(t)));return s([].concat(a(n),a(o)))}}}function R(){if(w)return b;w=1;var t=q().BigInteger,e=A(),i=e.encodeDer,r=e.decodeDer,n=P(),o=O().sm3,s=n.generateEcparam(),u=s.G,h=s.curve,f=s.n;function l(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";i=n.utf8ToHex(i);var r,s,a=n.leftPad(u.curve.a.toBigInteger().toRadix(16),64),h=n.leftPad(u.curve.b.toBigInteger().toRadix(16),64),f=n.leftPad(u.getX().toBigInteger().toRadix(16),64),l=n.leftPad(u.getY().toBigInteger().toRadix(16),64);if(128===e.length)r=e.substr(0,64),s=e.substr(64,64);else{var c=u.curve.decodePointHex(e);r=n.leftPad(c.getX().toBigInteger().toRadix(16),64),s=n.leftPad(c.getY().toBigInteger().toRadix(16),64)}var p=n.hexToArray(i+a+h+f+l+r+s),d=4*i.length;p.unshift(255&d),p.unshift(d>>8&255);var y=o(p);return n.arrayToHex(o(y.concat(n.hexToArray(t))))}function c(e){var i=u.multiply(new t(e,16));return"04"+n.leftPad(i.getX().toBigInteger().toString(16),64)+n.leftPad(i.getY().toBigInteger().toString(16),64)}function p(){var e=n.generateKeyPairHex(),i=h.decodePointHex(e.publicKey);return e.k=new t(e.privateKey,16),e.x1=i.getX().toBigInteger(),e}return b={generateKeyPairHex:n.generateKeyPairHex,compressPublicKeyHex:n.compressPublicKeyHex,comparePublicKeyHex:n.comparePublicKeyHex,doEncrypt:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e="string"==typeof e?n.hexToArray(n.utf8ToHex(e)):Array.prototype.slice.call(e),i=n.getGlobalCurve().decodePointHex(i);var s=n.generateKeyPairHex(),u=new t(s.privateKey,16),h=s.publicKey;h.length>128&&(h=h.substr(h.length-128));var f=i.multiply(u),l=n.hexToArray(n.leftPad(f.getX().toBigInteger().toRadix(16),64)),c=n.hexToArray(n.leftPad(f.getY().toBigInteger().toRadix(16),64)),p=n.arrayToHex(o([].concat(l,e,c))),d=1,y=0,v=[],m=[].concat(l,c),g=function(){v=o([].concat(a(m),[d>>24&255,d>>16&255,d>>8&255,255&d])),d++,y=0};g();for(var b=0,w=e.length;b<w;b++)y===v.length&&g(),e[b]^=255&v[y++];var T=n.arrayToHex(e);return 0===r?h+T+p:h+p+T},doDecrypt:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).output,u=void 0===s?"string":s;i=new t(i,16);var h=e.substr(128,64),f=e.substr(192);0===r&&(h=e.substr(e.length-64),f=e.substr(128,e.length-128-64));var l=n.hexToArray(f),c=n.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(i),p=n.hexToArray(n.leftPad(c.getX().toBigInteger().toRadix(16),64)),d=n.hexToArray(n.leftPad(c.getY().toBigInteger().toRadix(16),64)),y=1,v=0,m=[],g=[].concat(p,d),b=function(){m=o([].concat(a(g),[y>>24&255,y>>16&255,y>>8&255,255&y])),y++,v=0};b();for(var w=0,T=l.length;w<T;w++)v===m.length&&b(),l[w]^=255&m[v++];return n.arrayToHex(o([].concat(p,l,d)))===h.toLowerCase()?"array"===u?l:n.arrayToUtf8(l):"array"===u?[]:""},doSignature:function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.pointPool,u=o.der,a=o.hash,h=o.publicKey,d=o.userId,y="string"==typeof e?n.utf8ToHex(e):n.arrayToHex(e);a&&(y=l(y,h=h||c(r),d));var v=new t(r,16),m=new t(y,16),g=null,b=null,w=null;do{do{var T=void 0;g=(T=s&&s.length?s.pop():p()).k,b=m.add(T.x1).mod(f)}while(b.equals(t.ZERO)||b.add(g).equals(f));w=v.add(t.ONE).modInverse(f).multiply(g.subtract(b.multiply(v))).mod(f)}while(w.equals(t.ZERO));return u?i(b,w):n.leftPad(b.toString(16),64)+n.leftPad(w.toString(16),64)},doVerifySignature:function(e,i,o){var s,a,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},p=c.der,d=c.hash,y=c.userId,v="string"==typeof e?n.utf8ToHex(e):n.arrayToHex(e);if(d&&(v=l(v,o,y)),p){var m=r(i);s=m.r,a=m.s}else s=new t(i.substring(0,64),16),a=new t(i.substring(64),16);var g=h.decodePointHex(o),b=new t(v,16),w=s.add(a).mod(f);if(w.equals(t.ZERO))return!1;var T=u.multiply(a).add(g.multiply(w)),F=b.add(T.getX().toBigInteger()).mod(f);return s.equals(F)},getPublicKeyFromPrivateKey:c,getPoint:p,verifyPublicKey:n.verifyPublicKey},b}function M(){if(F)return T;F=1;var t=O(),e=t.sm3,i=t.hmac;function r(t){return t.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join("")}function n(t){var e,i,r=[],n=t.length;n%2!=0&&(i=n+1,t=(e=t).length>=i?e:new Array(i-e.length+1).join("0")+e),n=t.length;for(var o=0;o<n;o+=2)r.push(parseInt(t.substr(o,2),16));return r}return T=function(t,o){if(t="string"==typeof t?function(t){for(var e=[],i=0,r=t.length;i<r;i++){var n=t.codePointAt(i);if(n<=127)e.push(n);else if(n<=2047)e.push(192|n>>>6),e.push(128|63&n);else if(n<=55295||n>=57344&&n<=65535)e.push(224|n>>>12),e.push(128|n>>>6&63),e.push(128|63&n);else{if(!(n>=65536&&n<=1114111))throw e.push(n),new Error("input is not supported");i++,e.push(240|n>>>18&28),e.push(128|n>>>12&63),e.push(128|n>>>6&63),e.push(128|63&n)}}return e}(t):Array.prototype.slice.call(t),o){if("hmac"!==(o.mode||"hmac"))throw new Error("invalid mode");var s=o.key;if(!s)throw new Error("invalid key");return s="string"==typeof s?n(s):Array.prototype.slice.call(s),r(i(t,s))}return r(e(t))}}function k(){if(x)return B;x=1;var t=16,e=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],i=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function r(t){for(var e=[],i=0,r=t.length;i<r;i+=2)e.push(parseInt(t.substr(i,2),16));return e}function n(t,e){var i=31&e;return t<<i|t>>>32-i}function o(t){return(255&e[t>>>24&255])<<24|(255&e[t>>>16&255])<<16|(255&e[t>>>8&255])<<8|255&e[255&t]}function s(t){return t^n(t,2)^n(t,10)^n(t,18)^n(t,24)}function u(t){return t^n(t,13)^n(t,23)}function h(t,e,i){for(var r=new Array(4),n=new Array(4),u=0;u<4;u++)n[0]=255&t[4*u],n[1]=255&t[4*u+1],n[2]=255&t[4*u+2],n[3]=255&t[4*u+3],r[u]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(var a,h=0;h<32;h+=4)a=r[1]^r[2]^r[3]^i[h+0],r[0]^=s(o(a)),a=r[2]^r[3]^r[0]^i[h+1],r[1]^=s(o(a)),a=r[3]^r[0]^r[1]^i[h+2],r[2]^=s(o(a)),a=r[0]^r[1]^r[2]^i[h+3],r[3]^=s(o(a));for(var f=0;f<16;f+=4)e[f]=r[3-f/4]>>>24&255,e[f+1]=r[3-f/4]>>>16&255,e[f+2]=r[3-f/4]>>>8&255,e[f+3]=255&r[3-f/4]}function f(e,n,s){var f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=f.padding,c=void 0===l?"pkcs#7":l,p=f.mode,d=f.iv,y=void 0===d?[]:d,v=f.output,m=void 0===v?"string":v;if("cbc"===p&&("string"==typeof y&&(y=r(y)),16!==y.length))throw new Error("iv is invalid");if("string"==typeof n&&(n=r(n)),16!==n.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==s?function(t){for(var e=[],i=0,r=t.length;i<r;i++){var n=t.codePointAt(i);if(n<=127)e.push(n);else if(n<=2047)e.push(192|n>>>6),e.push(128|63&n);else if(n<=55295||n>=57344&&n<=65535)e.push(224|n>>>12),e.push(128|n>>>6&63),e.push(128|63&n);else{if(!(n>=65536&&n<=1114111))throw e.push(n),new Error("input is not supported");i++,e.push(240|n>>>18&28),e.push(128|n>>>12&63),e.push(128|n>>>6&63),e.push(128|63&n)}}return e}(e):r(e):a(e),("pkcs#5"===c||"pkcs#7"===c)&&0!==s)for(var g=t-e.length%t,b=0;b<g;b++)e.push(g);var w=new Array(32);!function(t,e,r){for(var n=new Array(4),s=new Array(4),a=0;a<4;a++)s[0]=255&t[0+4*a],s[1]=255&t[1+4*a],s[2]=255&t[2+4*a],s[3]=255&t[3+4*a],n[a]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(var h,f=0;f<32;f+=4)h=n[1]^n[2]^n[3]^i[f+0],e[f+0]=n[0]^=u(o(h)),h=n[2]^n[3]^n[0]^i[f+1],e[f+1]=n[1]^=u(o(h)),h=n[3]^n[0]^n[1]^i[f+2],e[f+2]=n[2]^=u(o(h)),h=n[0]^n[1]^n[2]^i[f+3],e[f+3]=n[3]^=u(o(h));if(0===r)for(var l,c=0;c<16;c++)l=e[c],e[c]=e[31-c],e[31-c]=l}(n,w,s);for(var T=[],F=y,B=e.length,x=0;B>=t;){var E=e.slice(x,x+16),I=new Array(16);if("cbc"===p)for(var S=0;S<t;S++)0!==s&&(E[S]^=F[S]);h(E,I,w);for(var D=0;D<t;D++)"cbc"===p&&0===s&&(I[D]^=F[D]),T[x+D]=I[D];"cbc"===p&&(F=0!==s?I:E),B-=t,x+=t}if(("pkcs#5"===c||"pkcs#7"===c)&&0===s){for(var q=T.length,A=T[q-1],P=1;P<=A;P++)if(T[q-P]!==A)throw new Error("padding is invalid");T.splice(q-A,A)}return"array"!==m?0!==s?T.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join(""):function(t){for(var e=[],i=0,r=t.length;i<r;i++)t[i]>=240&&t[i]<=247?(e.push(String.fromCodePoint(((7&t[i])<<18)+((63&t[i+1])<<12)+((63&t[i+2])<<6)+(63&t[i+3]))),i+=3):t[i]>=224&&t[i]<=239?(e.push(String.fromCodePoint(((15&t[i])<<12)+((63&t[i+1])<<6)+(63&t[i+2]))),i+=2):t[i]>=192&&t[i]<=223?(e.push(String.fromCodePoint(((31&t[i])<<6)+(63&t[i+1]))),i++):e.push(String.fromCodePoint(t[i]));return e.join("")}(T):T}return B={encrypt:function(t,e,i){return f(t,e,1,i)},decrypt:function(t,e,i){return f(t,e,0,i)}}}var C=I?E:(I=1,E={sm2:R(),sm3:M(),sm4:k()});function H(){var t=window.navigator.userAgent,e=t.indexOf("MSIE "),i=t.indexOf("Trident/"),r=t.indexOf("Edge/");return(e>0||i>0)&&r<0}function L(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on"+e,i)}function j(t,e,i){t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent&&t.detachEvent("on"+e,i)}function z(t){if(Object.entries)return Object.entries(t);for(var e=Object.keys(t),i=[],r=0;r<e.length;r++)i.push([e[r],t[e[r]]]);return i}function N(t,e){H()?(t.style.msUserSelect=e,t.style.userSelect=e):t.style.userSelect=e}function V(t,e){H()&&"grabbing"===e?t.style.cursor="move":t.style.cursor=e}!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?window.globalThis=window:"undefined"!=typeof global?global.globalThis=global:"undefined"!=typeof self?self.globalThis=self:this.globalThis=this)}();function U(){this.options={},this.container=null,this.iframe=null,this.overlay=null,this.eventListeners={}}function K(){return document.body?document.body:document.getElementsByTagName("body")[0]?document.getElementsByTagName("body")[0]:null}return U.prototype.init=function(t){var e=this;this.options=t;var i,r=function(){var i=K();if(i&&!document.getElementById("wk-ai-customer-container")){var r,n,o,s,u,a,h,f=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||1024,l=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||768;if(e.options.height=t.height||40,e.options.width=t.width||40,e.left=f-e.options.width-40,e.top=l-e.options.height-40,void 0!==t.right&&t.right>0?e.left=f-t.right-e.options.width:void 0!==t.left&&t.left>=0&&(e.left=t.left),void 0!==t.bottom&&t.bottom>0?e.top=l-t.bottom-e.options.height:void 0!==t.top&&t.top>=0&&(e.top=t.top),e.left<0&&(e.left=10),e.top<0&&(e.top=10),e.left+e.options.width>f&&(e.left=f-e.options.width-10),e.top+e.options.height>l&&(e.top=l-e.options.height-10),H()&&(e.left>f-100&&(e.left=f-e.options.width-20),e.top>l-100&&(e.top=l-e.options.height-20),e.left<0&&(e.left=100),e.top<0&&(e.top=100)),e.container=document.createElement("div"),e.container.id="wk-ai-customer-container",e.container.style.position="fixed",e.container.style.width=e.options.width+"px",e.container.style.height=e.options.height+"px",e.container.style.top=e.top+"px",e.container.style.left=e.left+"px",e.container.style.display="block",e.container.style.visibility="visible",e.container.style.zIndex="999999",e.container.style.overflow="hidden",e.container.style.margin="0",e.container.style.padding="0",e.container.style.borderRadius="50%",e.container.style.backgroundColor="transparent",H()){e.container.style.filter="alpha(opacity=100)",e.container.style.zoom="1",e.container.style.minWidth=e.options.width+"px",e.container.style.minHeight=e.options.height+"px";var c=document.createElement("div");c.style.cssText="width:100%;height:100%;position:absolute;top:0;left:0;background-color:#f0f0f0;z-index:1;",e.container.appendChild(c)}i.appendChild(e.container),H()&&(e.container.style.display="none",e.container.offsetHeight,e.container.style.display="block");try{var p=e.options.baseUrl||"https://ai.vcolco.com/chat/",d=e.buildQueryParams();e.iframe=document.createElement("iframe"),e.iframe.allowTransparency="true",e.iframe.src=p+"?"+d,e.iframe.width="100%",e.iframe.height="100%",e.iframe.frameBorder="0",e.iframe.scrolling="no",e.iframe.style.border="none",e.iframe.style.position="absolute",e.iframe.style.zIndex="2024",e.iframe.style.left="0",e.iframe.style.top="0",e.iframe.style.width="100%",e.iframe.style.height="100%",e.iframe.style.backgroundColor="transparent",e.container.appendChild(e.iframe),H()&&L(e.iframe,"load",function(){var t=e.container.querySelector("div[style*='background-color:#f0f0f0']");t&&t.parentNode&&t.parentNode.removeChild(t)})}catch(t){}e.overlay=document.createElement("div"),e.overlay.style.position="absolute",e.overlay.style.width="100%",e.overlay.style.height="100%",e.overlay.style.cursor="pointer",e.overlay.style.opacity="0",e.overlay.style.zIndex="2025",e.overlay.style.left="0",e.overlay.style.top="0",e.container.appendChild(e.overlay),r=e,n=e.overlay,o=function(){e.container.style.width="500px",e.container.style.height="100%",e.container.style.right="0",e.container.style.top="0",e.container.style.bottom="auto",e.container.style.left="auto",e.container.style.position="fixed",e.container.style.zIndex="999999",e.overlay.style.zIndex="2024",e.iframe&&(e.iframe.style.zIndex="2025"),e.postMessage({type:"clickIcon"})},s=!1,u=!1,a=function(t){if(s){u=!0;var e=n.getBoundingClientRect(),i=t.clientX-e.width/2,o=t.clientY-e.height/2;i=i<0?0:i,o=o<0?0:o,r.container.style.left=i+"px",r.container.style.top=o+"px",r.left=i,r.top=t.clientY-o}},h=function(t){N(document.body,""),s&&(s=!1,V(n,"pointer"),j(document,"mousemove",a),j(document,"mouseup",h))},L(n,"mousedown",function(t){N(document.body,"none"),s=!0,u=!1;var e=n.getBoundingClientRect?n.getBoundingClientRect():{width:n.offsetWidth||0,height:n.offsetHeight||0,left:n.offsetLeft||0,top:n.offsetTop||0};t.clientX,e.left,e.width,t.clientY,e.top,e.height,t.clientX,t.clientY,r.container.style.left=t.clientX-e.width/2+"px",r.container.style.top=t.clientY-e.height/2+"px",r.top=t.clientY-e.height/2,r.left=t.clientX-e.width/2,V(n,"grabbing"),L(document,"mousemove",a),L(document,"mouseup",h)}),L(n,"click",function(t){u?(function(t){t.stopImmediatePropagation?t.stopImmediatePropagation():(t.stopPropagation(),void 0!==t.cancelBubble&&(t.cancelBubble=!0))}(t),t.preventDefault?t.preventDefault():t.returnValue=!1,u=!1):o&&o()});var y=function(t){e.handleMessage(t)};e._boundHandleMessage=y,L(window,"message",y),e.iframe&&e.postMessage({type:"init"})}},n=function(){try{if(!K())return void setTimeout(n,50);r()}catch(t){}};n(),i=function(){try{var t=K();if(!t)return void setTimeout(function(){(t=K())&&r()},100);document.getElementById("wk-ai-customer-container")||r()}catch(t){}},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(i,1):document.addEventListener("DOMContentLoaded",i,!1)},U.prototype.buildQueryParams=function(){var t=this.options.Enterprise,e=this.options.Externalid,i=this.options.Role,r=this.options.Userid,n=this.options.Username,o=this.options.Knowledge,s=this.options.Privatekey,u=this.options.Usetype;if(!(t&&e&&i&&r&&n))throw new Error("Missing required options: Enterprise, Externalid, Role, Userid, Username");var a={Enterprise:t,Externalid:e,Knowledge:o||"",Role:i,Userid:r,Username:n};a.Knowledge||delete a.Knowledge;var h=z(a).map(function(t){return t[0]+"="+t[1]}).join("&");return a.Sign=C.sm2.doSignature(h,s,{der:!0,hash:!0}),u&&(a.Usetype=u),a.Iframe="PC",z(a).map(function(t){return t[0]+"="+t[1]}).join("&")},U.prototype.handleMessage=function(t){var e=function(t){if(!H()&&window.URL)try{return new URL(t).origin}catch(t){}var e=document.createElement("a");return e.href=t,e.protocol+"//"+e.host}(this.options.baseUrl||"https://ai.vcolco.com/chat/");if(t.origin===e){if(t.data&&t.data.type&&this.eventListeners[t.data.type])for(var i=this.eventListeners[t.data.type],r=0;r<i.length;r++)i[r](t.data);if(t.data&&t.data.type)switch(t.data.type){case"showChat":break;case"hideChat":this.container.style.width=this.options.width+"px",this.container.style.height=this.options.height+"px",this.container.style.top=this.top+"px",this.container.style.left=this.left+"px",this.container.style.bottom="auto",this.container.style.right="auto",this.container.style.position="fixed",this.overlay.style.zIndex="2025",this.iframe&&(this.iframe.style.zIndex="2024")}}},U.prototype.postMessage=function(t){if(this.iframe&&this.iframe.contentWindow){var e=this.options.baseUrl||"https://ai.vcolco.com/chat/";this.iframe.contentWindow.postMessage(t,e)}},U.prototype.on=function(t,e){return this.eventListeners[t]||(this.eventListeners[t]=[]),this.eventListeners[t].push(e),this},U.prototype.off=function(t,e){},U.prototype.show=function(){},U.prototype.hide=function(){},U.prototype.destroy=function(){this._boundHandleMessage&&j(window,"message",this._boundHandleMessage);var t=document.getElementById("wk-ai-customer-container");t&&t.parentNode&&t.parentNode.removeChild(t)},new U});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).wkAiCustomerInstance=e()}(this,function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function e(t,e,i){return e=n(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,[],n(t).constructor):e.apply(t,i))}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(s=function(){return!!t})()}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,i){if(e){if("string"==typeof e)return t(e,i);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,i):void 0}}(e)||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.")}()}function h(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}!function(){try{"undefined"==typeof globalThis&&("undefined"!=typeof window?window.globalThis=window:"undefined"!=typeof global?global.globalThis=global:"undefined"!=typeof self&&(self.globalThis=self))}catch(t){}}();var f,l,c,p,d,y,v,m,g,b,w,T,F,B,x,E,I,S={exports:{}},D=S.exports;function q(){return f||(f=1,function(t){(function(){var e;function i(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function r(){return new i(null)}var n="undefined"!=typeof navigator;n&&"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(t,e,i,r,n,o){for(var s=32767&e,u=e>>15;--o>=0;){var a=32767&this[t],h=this[t++]>>15,f=u*a+h*s;n=((a=s*a+((32767&f)<<15)+i[r]+(1073741823&n))>>>30)+(f>>>15)+u*h+(n>>>30),i[r++]=1073741823&a}return n},e=30):n&&"Netscape"!=navigator.appName?(i.prototype.am=function(t,e,i,r,n,o){for(;--o>=0;){var s=e*this[t++]+i[r]+n;n=Math.floor(s/67108864),i[r++]=67108863&s}return n},e=26):(i.prototype.am=function(t,e,i,r,n,o){for(var s=16383&e,u=e>>14;--o>=0;){var a=16383&this[t],h=this[t++]>>14,f=u*a+h*s;n=((a=s*a+((16383&f)<<14)+i[r]+n)>>28)+(f>>14)+u*h,i[r++]=268435455&a}return n},e=28),i.prototype.DB=e,i.prototype.DM=(1<<e)-1,i.prototype.DV=1<<e;i.prototype.FV=Math.pow(2,52),i.prototype.F1=52-e,i.prototype.F2=2*e-52;var o,s,u=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)u[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)u[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)u[o++]=s;function a(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function h(t,e){var i=u[t.charCodeAt(e)];return null==i?-1:i}function f(t){var e=r();return e.fromInt(t),e}function l(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function c(t){this.m=t}function p(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function d(t,e){return t&e}function y(t,e){return t|e}function v(t,e){return t^e}function m(t,e){return t&~e}function g(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function b(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function w(){}function T(t){return t}function F(t){this.r2=r(),this.q3=r(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}c.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},c.prototype.revert=function(t){return t},c.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},c.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},c.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},p.prototype.convert=function(t){var e=r();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(i.ZERO)>0&&this.m.subTo(e,e),e},p.prototype.revert=function(t){var e=r();return t.copyTo(e),this.reduce(e),e},p.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},p.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},p.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var u=8==r?255&t[n]:h(t,n);u<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=u:s+r>this.DB?(this[this.t-1]|=(u&(1<<this.DB-s)-1)<<s,this[this.t++]=u>>this.DB-s):this[this.t-1]|=u<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},i.prototype.drShiftTo=function(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},i.prototype.lShiftTo=function(t,e){var i,r=t%this.DB,n=this.DB-r,o=(1<<n)-1,s=Math.floor(t/this.DB),u=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)e[i+s+1]=this[i]>>n|u,u=(this[i]&o)<<r;for(i=s-1;i>=0;--i)e[i]=0;e[s]=u,e.t=this.t+s+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,o=(1<<r)-1;e[0]=this[i]>>r;for(var s=i+1;s<this.t;++s)e[s-i-1]|=(this[s]&o)<<n,e[s-i]=this[s]>>r;r>0&&(e[this.t-i-1]|=(this.s&o)<<n),e.t=this.t-i,e.clamp()}},i.prototype.subTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},i.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),o=r.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+r.t]=r.am(0,n[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&i.ZERO.subTo(e,e)},i.prototype.squareTo=function(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,e,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=r());var u=r(),a=this.s,h=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,u),s.lShiftTo(f,n)):(o.copyTo(u),s.copyTo(n));var c=u.t,p=u[c-1];if(0!=p){var d=p*(1<<this.F1)+(c>1?u[c-2]>>this.F2:0),y=this.FV/d,v=(1<<this.F1)/d,m=1<<this.F2,g=n.t,b=g-c,w=null==e?r():e;for(u.dlShiftTo(b,w),n.compareTo(w)>=0&&(n[n.t++]=1,n.subTo(w,n)),i.ONE.dlShiftTo(c,w),w.subTo(u,u);u.t<c;)u[u.t++]=0;for(;--b>=0;){var T=n[--g]==p?this.DM:Math.floor(n[g]*y+(n[g-1]+m)*v);if((n[g]+=u.am(0,T,n,b,0,c))<T)for(u.dlShiftTo(b,w),n.subTo(w,n);n[g]<--T;)n.subTo(w,n)}null!=e&&(n.drShiftTo(c,e),a!=h&&i.ZERO.subTo(e,e)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),a<0&&i.ZERO.subTo(n,n)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},i.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},i.prototype.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var n=r(),o=r(),s=e.convert(this),u=l(t)-1;for(s.copyTo(n);--u>=0;)if(e.sqrTo(n,o),(t&1<<u)>0)e.mulTo(o,s,n);else{var a=n;n=o,o=a}return e.revert(n)},i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<<e)-1,n=!1,o="",s=this.t,u=this.DB-s*this.DB%e;if(s-- >0)for(u<this.DB&&(i=this[s]>>u)>0&&(n=!0,o=a(i));s>=0;)u<e?(i=(this[s]&(1<<u)-1)<<e-u,i|=this[--s]>>(u+=this.DB-e)):(i=this[s]>>(u-=e)&r,u<=0&&(u+=this.DB,--s)),i>0&&(n=!0),n&&(o+=a(i));return n?o:"0"},i.prototype.negate=function(){var t=r();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var e=r();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},i.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new c(e):new p(e),this.exp(t,i)},i.ZERO=f(0),i.ONE=f(1),w.prototype.convert=T,w.prototype.revert=T,w.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},w.prototype.sqrTo=function(t,e){t.squareTo(e)},F.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=r();return t.copyTo(e),this.reduce(e),e},F.prototype.revert=function(t){return t},F.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},F.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},F.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var B,x,E,I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],S=(1<<26)/I[I.length-1];function D(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=k&&(E-=k)}if(i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),n=f(i),o=r(),s=r(),u="";for(this.divRemTo(n,o,s);o.signum()>0;)u=(i+s.intValue()).toString(t).substr(1)+u,o.divRemTo(n,o,s);return s.intValue().toString(t)+u},i.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),o=!1,s=0,u=0,a=0;a<t.length;++a){var f=h(t,a);f<0?"-"==t.charAt(a)&&0==this.signum()&&(o=!0):(u=e*u+f,++s>=r&&(this.dMultiply(n),this.dAddOffset(u,0),s=0,u=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(u,0)),o&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},i.prototype.bitwiseTo=function(t,e,i){var r,n,o=Math.min(t.t,this.t);for(r=0;r<o;++r)i[r]=e(this[r],t[r]);if(t.t<this.t){for(n=t.s&this.DM,r=o;r<this.t;++r)i[r]=e(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=o;r<t.t;++r)i[r]=e(n,t[r]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},i.prototype.changeBit=function(t,e){var r=i.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},i.prototype.addTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},i.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(t,e,i){var r,n=Math.min(this.t+t.t,e);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(r=i.t-this.t;n<r;++n)i[n+this.t]=this.am(0,t[n],i,n,0,this.t);for(r=Math.min(t.t,e);n<r;++n)this.am(0,t[n],i,n,0,e-n);i.clamp()},i.prototype.multiplyUpperTo=function(t,e,i){--e;var r=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)},i.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},i.prototype.millerRabin=function(t){var e=this.subtract(i.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var o=e.shiftRight(n);(t=t+1>>1)>I.length&&(t=I.length);for(var s=r(),u=0;u<t;++u){s.fromInt(I[Math.floor(Math.random()*I.length)]);var a=s.modPow(o,this);if(0!=a.compareTo(i.ONE)&&0!=a.compareTo(e)){for(var h=1;h++<n&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(i.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},i.prototype.clone=function(){var t=r();return this.copyTo(t),t},i.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),128&i&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},i.prototype.equals=function(t){return 0==this.compareTo(t)},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var e=r();return this.bitwiseTo(t,d,e),e},i.prototype.or=function(t){var e=r();return this.bitwiseTo(t,y,e),e},i.prototype.xor=function(t){var e=r();return this.bitwiseTo(t,v,e),e},i.prototype.andNot=function(t){var e=r();return this.bitwiseTo(t,m,e),e},i.prototype.not=function(){for(var t=r(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},i.prototype.shiftLeft=function(t){var e=r();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},i.prototype.shiftRight=function(t){var e=r();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},i.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+g(this[t]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=b(this[i]^e);return t},i.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},i.prototype.setBit=function(t){return this.changeBit(t,y)},i.prototype.clearBit=function(t){return this.changeBit(t,m)},i.prototype.flipBit=function(t){return this.changeBit(t,v)},i.prototype.add=function(t){var e=r();return this.addTo(t,e),e},i.prototype.subtract=function(t){var e=r();return this.subTo(t,e),e},i.prototype.multiply=function(t){var e=r();return this.multiplyTo(t,e),e},i.prototype.divide=function(t){var e=r();return this.divRemTo(t,e,null),e},i.prototype.remainder=function(t){var e=r();return this.divRemTo(t,null,e),e},i.prototype.divideAndRemainder=function(t){var e=r(),i=r();return this.divRemTo(t,e,i),new Array(e,i)},i.prototype.modPow=function(t,e){var i,n,o=t.bitLength(),s=f(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new c(e):e.isEven()?new F(e):new p(e);var u=new Array,a=3,h=i-1,d=(1<<i)-1;if(u[1]=n.convert(this),i>1){var y=r();for(n.sqrTo(u[1],y);a<=d;)u[a]=r(),n.mulTo(y,u[a-2],u[a]),a+=2}var v,m,g=t.t-1,b=!0,w=r();for(o=l(t[g])-1;g>=0;){for(o>=h?v=t[g]>>o-h&d:(v=(t[g]&(1<<o+1)-1)<<h-o,g>0&&(v|=t[g-1]>>this.DB+o-h)),a=i;!(1&v);)v>>=1,--a;if((o-=a)<0&&(o+=this.DB,--g),b)u[v].copyTo(s),b=!1;else{for(;a>1;)n.sqrTo(s,w),n.sqrTo(w,s),a-=2;a>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,u[v],s)}for(;g>=0&&!(t[g]&1<<o);)n.sqrTo(s,w),m=s,s=w,w=m,--o<0&&(o=this.DB-1,--g)}return n.revert(s)},i.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return i.ZERO;for(var r=t.clone(),n=this.clone(),o=f(1),s=f(0),u=f(0),a=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(u.isEven()&&a.isEven()||(u.addTo(this,u),a.subTo(t,a)),u.rShiftTo(1,u)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&o.subTo(u,o),s.subTo(a,s)):(n.subTo(r,n),e&&u.subTo(o,u),a.subTo(s,a))}return 0!=n.compareTo(i.ONE)?i.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},i.prototype.pow=function(t){return this.exp(t,new w)},i.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return e;for(n<o&&(o=n),o>0&&(e.rShiftTo(o,e),i.rShiftTo(o,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},i.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=I[I.length-1]){for(e=0;e<I.length;++e)if(i[0]==I[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<I.length;){for(var r=I[e],n=e+1;n<I.length&&r<S;)r*=I[n++];for(r=i.modInt(r);e<n;)if(r%I[e++]==0)return!1}return i.millerRabin(t)},i.prototype.square=function(){var t=r();return this.squareTo(t),t},i.prototype.Barrett=F,null==x){var q;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var A=new Uint8Array(32);for(window.crypto.getRandomValues(A),q=0;q<32;++q)x[E++]=A[q]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(q=0;q<P.length;++q)x[E++]=255&P.charCodeAt(q)}for(;E<k;)q=Math.floor(65536*Math.random()),x[E++]=q>>>8,x[E++]=255&q;E=0,D()}function O(){if(null==B){for(D(),(B=new M).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return B.next()}function R(){}function M(){this.i=0,this.j=0,this.S=new Array}R.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=O()},M.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},M.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var k=256;t.exports={default:i,BigInteger:i,SecureRandom:R}}).call(D)}(S)),S.exports}function A(){if(c)return l;c=1;var t=q().BigInteger;var n=function(){return r(function t(){i(this,t),this.tlv=null,this.t="00",this.l="00",this.v=""},[{key:"getEncodedHex",value:function(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}},{key:"getLength",value:function(){var t=this.v.length/2,e=t.toString(16);return e.length%2==1&&(e="0"+e),t<128?e:(128+e.length/2).toString(16)+e}},{key:"getValue",value:function(){return""}}])}(),s=function(n){function s(r){var n;return i(this,s),(n=e(this,s)).t="02",r&&(n.v=function(e){var i=e.toString(16);if("-"!==i[0])i.length%2==1?i="0"+i:i.match(/^[0-7]/)||(i="00"+i);else{var r=(i=i.substr(1)).length;r%2==1?r+=1:i.match(/^[0-7]/)||(r+=2);for(var n="",o=0;o<r;o++)n+="f";i=(i=(n=new t(n,16)).xor(e).add(t.ONE)).toString(16).replace(/^-/,"")}return i}(r)),n}return o(s,n),r(s,[{key:"getValue",value:function(){return this.v}}])}(n),u=function(t){function n(t){var r;return i(this,n),(r=e(this,n)).t="30",r.asn1Array=t,r}return o(n,t),r(n,[{key:"getValue",value:function(){return this.v=this.asn1Array.map(function(t){return t.getEncodedHex()}).join(""),this.v}}])}(n);function a(t,e){return+t[e+2]<8?1:128&+t.substr(e+2,2)}function h(e,i){var r=a(e,i),n=e.substr(i+2,2*r);return n?(+n[0]<8?new t(n,16):new t(n.substr(2),16)).intValue():-1}function f(t,e){return e+2*(a(t,e)+1)}return l={encodeDer:function(t,e){var i=new s(t),r=new s(e);return new u([i,r]).getEncodedHex()},decodeDer:function(e){var i=f(e,0),r=f(e,i),n=h(e,i),o=e.substr(r,2*n),s=r+o.length,u=f(e,s),a=h(e,s),l=e.substr(u,2*a);return{r:new t(o,16),s:new t(l,16)}}}}function P(){if(v)return y;v=1;var t=q(),e=t.BigInteger,n=t.SecureRandom,o=function(){if(d)return p;d=1;var t=q().BigInteger,e=new t("2"),n=new t("3"),o=function(){function t(e,r){i(this,t),this.x=r,this.q=e}return r(t,[{key:"equals",value:function(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}},{key:"toBigInteger",value:function(){return this.x}},{key:"negate",value:function(){return new t(this.q,this.x.negate().mod(this.q))}},{key:"add",value:function(e){return new t(this.q,this.x.add(e.toBigInteger()).mod(this.q))}},{key:"subtract",value:function(e){return new t(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}},{key:"multiply",value:function(e){return new t(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}},{key:"divide",value:function(e){return new t(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}},{key:"square",value:function(){return new t(this.q,this.x.square().mod(this.q))}}])}(),s=function(){function e(r,n,o,s){i(this,e),this.curve=r,this.x=n,this.y=o,this.z=null==s?t.ONE:s,this.zinv=null}return r(e,[{key:"getX",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"getY",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"equals",value:function(e){return e===this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO))}},{key:"isInfinity",value:function(){return null===this.x&&null===this.y||this.z.equals(t.ZERO)&&!this.y.toBigInteger().equals(t.ZERO)}},{key:"negate",value:function(){return new e(this.curve,this.x,this.y.negate(),this.z)}},{key:"add",value:function(i){if(this.isInfinity())return i;if(i.isInfinity())return this;var r=this.x.toBigInteger(),n=this.y.toBigInteger(),o=this.z,s=i.x.toBigInteger(),u=i.y.toBigInteger(),a=i.z,h=this.curve.q,f=r.multiply(a).mod(h),l=s.multiply(o).mod(h),c=f.subtract(l),p=n.multiply(a).mod(h),d=u.multiply(o).mod(h),y=p.subtract(d);if(t.ZERO.equals(c))return t.ZERO.equals(y)?this.twice():this.curve.infinity;var v=f.add(l),m=o.multiply(a).mod(h),g=c.square().mod(h),b=c.multiply(g).mod(h),w=m.multiply(y.square()).subtract(v.multiply(g)).mod(h),T=c.multiply(w).mod(h),F=y.multiply(g.multiply(f).subtract(w)).subtract(p.multiply(b)).mod(h),B=b.multiply(m).mod(h);return new e(this.curve,this.curve.fromBigInteger(T),this.curve.fromBigInteger(F),B)}},{key:"twice",value:function(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;var t=this.x.toBigInteger(),i=this.y.toBigInteger(),r=this.z,o=this.curve.q,s=this.curve.a.toBigInteger(),u=t.square().multiply(n).add(s.multiply(r.square())).mod(o),a=i.shiftLeft(1).multiply(r).mod(o),h=i.square().mod(o),f=h.multiply(t).multiply(r).mod(o),l=a.square().mod(o),c=u.square().subtract(f.shiftLeft(3)).mod(o),p=a.multiply(c).mod(o),d=u.multiply(f.shiftLeft(2).subtract(c)).subtract(l.shiftLeft(1).multiply(h)).mod(o),y=a.multiply(l).mod(o);return new e(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),y)}},{key:"multiply",value:function(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;for(var e=t.multiply(n),i=this.negate(),r=this,o=e.bitLength()-2;o>0;o--){r=r.twice();var s=e.testBit(o);s!==t.testBit(o)&&(r=r.add(s?this:i))}return r}}])}(),u=function(){return r(function t(e,r,n){i(this,t),this.q=e,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new s(this,null,null)},[{key:"equals",value:function(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}},{key:"fromBigInteger",value:function(t){return new o(this.q,t)}},{key:"decodePointHex",value:function(i){switch(parseInt(i.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var r=this.fromBigInteger(new t(i.substr(2),16)),n=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new t("4")).add(t.ONE),this.q));return n.toBigInteger().mod(e).equals(new t(i.substr(0,2),16).subtract(e))||(n=n.negate()),new s(this,r,n);case 4:case 6:case 7:var o=(i.length-2)/2,u=i.substr(2,o),a=i.substr(o+2,o);return new s(this,this.fromBigInteger(new t(u,16)),this.fromBigInteger(new t(a,16)));default:return null}}}])}();return p={ECPointFp:s,ECCurveFp:u}}(),s=o.ECCurveFp,u=new n,a=c(),h=a.curve,f=a.G,l=a.n;function c(){var t=new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),i=new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new e("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new s(t,i,r),o=n.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:n,G:o,n:new e("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function m(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t}return y={getGlobalCurve:function(){return h},generateEcparam:c,generateKeyPairHex:function(t,i,r){var n=(t?new e(t,i,r):new e(l.bitLength(),u)).mod(l.subtract(e.ONE)).add(e.ONE),o=m(n.toString(16),64),s=f.multiply(n);return{privateKey:o,publicKey:"04"+m(s.getX().toBigInteger().toString(16),64)+m(s.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");var i=(t.length-2)/2,r=t.substr(2,i),n="03";return new e(t.substr(i+2,i),16).mod(new e("2")).equals(e.ZERO)&&(n="02"),n+r},utf8ToHex:function(t){for(var e=(t=unescape(encodeURIComponent(t))).length,i=[],r=0;r<e;r++)i[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;for(var n=[],o=0;o<e;o++){var s=i[o>>>2]>>>24-o%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},leftPad:m,arrayToHex:function(t){return t.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join("")},arrayToUtf8:function(t){for(var e=[],i=0,r=0;r<2*t.length;r+=2)e[r>>>3]|=parseInt(t[i],10)<<24-r%8*4,i++;try{for(var n=[],o=0;o<t.length;o++){var s=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(s))}return decodeURIComponent(escape(n.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){var e=[],i=t.length;i%2!=0&&(t=m(t,i+1)),i=t.length;for(var r=0;r<i;r+=2)e.push(parseInt(t.substr(r,2),16));return e},verifyPublicKey:function(t){var e=h.decodePointHex(t);if(!e)return!1;var i=e.getX();return e.getY().square().equals(i.multiply(i.square()).add(i.multiply(h.a)).add(h.b))},comparePublicKeyHex:function(t,e){var i=h.decodePointHex(t);if(!i)return!1;var r=h.decodePointHex(e);return!!r&&i.equals(r)}}}function O(){if(g)return m;g=1;var t=new Uint32Array(68),e=new Uint32Array(64);function i(t,e){var i=31&e;return t<<i|t>>>32-i}function r(t,e){for(var i=[],r=t.length-1;r>=0;r--)i[r]=255&(t[r]^e[r]);return i}function n(t){return t^i(t,9)^i(t,17)}function o(t){return t^i(t,15)^i(t,23)}function s(r){var s=8*r.length,u=s%512;u=u>=448?512-u%448-1:448-u-1;for(var h=new Array((u-7)/8),f=new Array(8),l=0,c=h.length;l<c;l++)h[l]=0;for(var p=0,d=f.length;p<d;p++)f[p]=0;s=s.toString(2);for(var y=7;y>=0;y--)if(s.length>8){var v=s.length-8;f[y]=parseInt(s.substr(v),2),s=s.substr(0,v)}else s.length>0&&(f[y]=parseInt(s,2),s="");for(var m=new Uint8Array([].concat(a(r),[128],h,f)),g=new DataView(m.buffer,0),b=m.length/64,w=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),T=0;T<b;T++){t.fill(0),e.fill(0);for(var F=16*T,B=0;B<16;B++)t[B]=g.getUint32(4*(F+B),!1);for(var x=16;x<68;x++)t[x]=o(t[x-16]^t[x-9]^i(t[x-3],15))^i(t[x-13],7)^t[x-6];for(var E=0;E<64;E++)e[E]=t[E]^t[E+4];for(var I=w[0],S=w[1],D=w[2],q=w[3],A=w[4],P=w[5],O=w[6],R=w[7],M=void 0,k=void 0,C=void 0,H=void 0,L=0;L<64;L++)H=L>=0&&L<=15?2043430169:2055708042,k=(L>=0&&L<=15?I^S^D:I&S|I&D|S&D)+q+((M=i(i(I,12)+A+i(H,L),7))^i(I,12))+e[L],C=(L>=0&&L<=15?A^P^O:A&P|~A&O)+R+M+t[L],q=D,D=i(S,9),S=I,I=k,R=O,O=i(P,19),P=A,A=n(C);w[0]^=I,w[1]^=S,w[2]^=D,w[3]^=q,w[4]^=A,w[5]^=P,w[6]^=O,w[7]^=R}for(var j=[],z=0,N=w.length;z<N;z++){var V=w[z];j.push((4278190080&V)>>>24,(16711680&V)>>>16,(65280&V)>>>8,255&V)}return j}for(var u=new Uint8Array(64),h=new Uint8Array(64),f=0;f<64;f++)u[f]=54,h[f]=92;return m={sm3:s,hmac:function(t,e){for(e.length>64&&(e=s(e));e.length<64;)e.push(0);var i=r(e,u),n=r(e,h),o=s([].concat(a(i),a(t)));return s([].concat(a(n),a(o)))}}}function R(){if(w)return b;w=1;var t=q().BigInteger,e=A(),i=e.encodeDer,r=e.decodeDer,n=P(),o=O().sm3,s=n.generateEcparam(),u=s.G,h=s.curve,f=s.n;function l(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";i=n.utf8ToHex(i);var r,s,a=n.leftPad(u.curve.a.toBigInteger().toRadix(16),64),h=n.leftPad(u.curve.b.toBigInteger().toRadix(16),64),f=n.leftPad(u.getX().toBigInteger().toRadix(16),64),l=n.leftPad(u.getY().toBigInteger().toRadix(16),64);if(128===e.length)r=e.substr(0,64),s=e.substr(64,64);else{var c=u.curve.decodePointHex(e);r=n.leftPad(c.getX().toBigInteger().toRadix(16),64),s=n.leftPad(c.getY().toBigInteger().toRadix(16),64)}var p=n.hexToArray(i+a+h+f+l+r+s),d=4*i.length;p.unshift(255&d),p.unshift(d>>8&255);var y=o(p);return n.arrayToHex(o(y.concat(n.hexToArray(t))))}function c(e){var i=u.multiply(new t(e,16));return"04"+n.leftPad(i.getX().toBigInteger().toString(16),64)+n.leftPad(i.getY().toBigInteger().toString(16),64)}function p(){var e=n.generateKeyPairHex(),i=h.decodePointHex(e.publicKey);return e.k=new t(e.privateKey,16),e.x1=i.getX().toBigInteger(),e}return b={generateKeyPairHex:n.generateKeyPairHex,compressPublicKeyHex:n.compressPublicKeyHex,comparePublicKeyHex:n.comparePublicKeyHex,doEncrypt:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e="string"==typeof e?n.hexToArray(n.utf8ToHex(e)):Array.prototype.slice.call(e),i=n.getGlobalCurve().decodePointHex(i);var s=n.generateKeyPairHex(),u=new t(s.privateKey,16),h=s.publicKey;h.length>128&&(h=h.substr(h.length-128));var f=i.multiply(u),l=n.hexToArray(n.leftPad(f.getX().toBigInteger().toRadix(16),64)),c=n.hexToArray(n.leftPad(f.getY().toBigInteger().toRadix(16),64)),p=n.arrayToHex(o([].concat(l,e,c))),d=1,y=0,v=[],m=[].concat(l,c),g=function(){v=o([].concat(a(m),[d>>24&255,d>>16&255,d>>8&255,255&d])),d++,y=0};g();for(var b=0,w=e.length;b<w;b++)y===v.length&&g(),e[b]^=255&v[y++];var T=n.arrayToHex(e);return 0===r?h+T+p:h+p+T},doDecrypt:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).output,u=void 0===s?"string":s;i=new t(i,16);var h=e.substr(128,64),f=e.substr(192);0===r&&(h=e.substr(e.length-64),f=e.substr(128,e.length-128-64));var l=n.hexToArray(f),c=n.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(i),p=n.hexToArray(n.leftPad(c.getX().toBigInteger().toRadix(16),64)),d=n.hexToArray(n.leftPad(c.getY().toBigInteger().toRadix(16),64)),y=1,v=0,m=[],g=[].concat(p,d),b=function(){m=o([].concat(a(g),[y>>24&255,y>>16&255,y>>8&255,255&y])),y++,v=0};b();for(var w=0,T=l.length;w<T;w++)v===m.length&&b(),l[w]^=255&m[v++];return n.arrayToHex(o([].concat(p,l,d)))===h.toLowerCase()?"array"===u?l:n.arrayToUtf8(l):"array"===u?[]:""},doSignature:function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.pointPool,u=o.der,a=o.hash,h=o.publicKey,d=o.userId,y="string"==typeof e?n.utf8ToHex(e):n.arrayToHex(e);a&&(y=l(y,h=h||c(r),d));var v=new t(r,16),m=new t(y,16),g=null,b=null,w=null;do{do{var T=void 0;g=(T=s&&s.length?s.pop():p()).k,b=m.add(T.x1).mod(f)}while(b.equals(t.ZERO)||b.add(g).equals(f));w=v.add(t.ONE).modInverse(f).multiply(g.subtract(b.multiply(v))).mod(f)}while(w.equals(t.ZERO));return u?i(b,w):n.leftPad(b.toString(16),64)+n.leftPad(w.toString(16),64)},doVerifySignature:function(e,i,o){var s,a,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},p=c.der,d=c.hash,y=c.userId,v="string"==typeof e?n.utf8ToHex(e):n.arrayToHex(e);if(d&&(v=l(v,o,y)),p){var m=r(i);s=m.r,a=m.s}else s=new t(i.substring(0,64),16),a=new t(i.substring(64),16);var g=h.decodePointHex(o),b=new t(v,16),w=s.add(a).mod(f);if(w.equals(t.ZERO))return!1;var T=u.multiply(a).add(g.multiply(w)),F=b.add(T.getX().toBigInteger()).mod(f);return s.equals(F)},getPublicKeyFromPrivateKey:c,getPoint:p,verifyPublicKey:n.verifyPublicKey},b}function M(){if(F)return T;F=1;var t=O(),e=t.sm3,i=t.hmac;function r(t){return t.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join("")}function n(t){var e,i,r=[],n=t.length;n%2!=0&&(i=n+1,t=(e=t).length>=i?e:new Array(i-e.length+1).join("0")+e),n=t.length;for(var o=0;o<n;o+=2)r.push(parseInt(t.substr(o,2),16));return r}return T=function(t,o){if(t="string"==typeof t?function(t){for(var e=[],i=0,r=t.length;i<r;i++){var n=t.codePointAt(i);if(n<=127)e.push(n);else if(n<=2047)e.push(192|n>>>6),e.push(128|63&n);else if(n<=55295||n>=57344&&n<=65535)e.push(224|n>>>12),e.push(128|n>>>6&63),e.push(128|63&n);else{if(!(n>=65536&&n<=1114111))throw e.push(n),new Error("input is not supported");i++,e.push(240|n>>>18&28),e.push(128|n>>>12&63),e.push(128|n>>>6&63),e.push(128|63&n)}}return e}(t):Array.prototype.slice.call(t),o){if("hmac"!==(o.mode||"hmac"))throw new Error("invalid mode");var s=o.key;if(!s)throw new Error("invalid key");return s="string"==typeof s?n(s):Array.prototype.slice.call(s),r(i(t,s))}return r(e(t))}}function k(){if(x)return B;x=1;var t=16,e=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],i=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function r(t){for(var e=[],i=0,r=t.length;i<r;i+=2)e.push(parseInt(t.substr(i,2),16));return e}function n(t,e){var i=31&e;return t<<i|t>>>32-i}function o(t){return(255&e[t>>>24&255])<<24|(255&e[t>>>16&255])<<16|(255&e[t>>>8&255])<<8|255&e[255&t]}function s(t){return t^n(t,2)^n(t,10)^n(t,18)^n(t,24)}function u(t){return t^n(t,13)^n(t,23)}function h(t,e,i){for(var r=new Array(4),n=new Array(4),u=0;u<4;u++)n[0]=255&t[4*u],n[1]=255&t[4*u+1],n[2]=255&t[4*u+2],n[3]=255&t[4*u+3],r[u]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(var a,h=0;h<32;h+=4)a=r[1]^r[2]^r[3]^i[h+0],r[0]^=s(o(a)),a=r[2]^r[3]^r[0]^i[h+1],r[1]^=s(o(a)),a=r[3]^r[0]^r[1]^i[h+2],r[2]^=s(o(a)),a=r[0]^r[1]^r[2]^i[h+3],r[3]^=s(o(a));for(var f=0;f<16;f+=4)e[f]=r[3-f/4]>>>24&255,e[f+1]=r[3-f/4]>>>16&255,e[f+2]=r[3-f/4]>>>8&255,e[f+3]=255&r[3-f/4]}function f(e,n,s){var f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=f.padding,c=void 0===l?"pkcs#7":l,p=f.mode,d=f.iv,y=void 0===d?[]:d,v=f.output,m=void 0===v?"string":v;if("cbc"===p&&("string"==typeof y&&(y=r(y)),16!==y.length))throw new Error("iv is invalid");if("string"==typeof n&&(n=r(n)),16!==n.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==s?function(t){for(var e=[],i=0,r=t.length;i<r;i++){var n=t.codePointAt(i);if(n<=127)e.push(n);else if(n<=2047)e.push(192|n>>>6),e.push(128|63&n);else if(n<=55295||n>=57344&&n<=65535)e.push(224|n>>>12),e.push(128|n>>>6&63),e.push(128|63&n);else{if(!(n>=65536&&n<=1114111))throw e.push(n),new Error("input is not supported");i++,e.push(240|n>>>18&28),e.push(128|n>>>12&63),e.push(128|n>>>6&63),e.push(128|63&n)}}return e}(e):r(e):a(e),("pkcs#5"===c||"pkcs#7"===c)&&0!==s)for(var g=t-e.length%t,b=0;b<g;b++)e.push(g);var w=new Array(32);!function(t,e,r){for(var n=new Array(4),s=new Array(4),a=0;a<4;a++)s[0]=255&t[0+4*a],s[1]=255&t[1+4*a],s[2]=255&t[2+4*a],s[3]=255&t[3+4*a],n[a]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(var h,f=0;f<32;f+=4)h=n[1]^n[2]^n[3]^i[f+0],e[f+0]=n[0]^=u(o(h)),h=n[2]^n[3]^n[0]^i[f+1],e[f+1]=n[1]^=u(o(h)),h=n[3]^n[0]^n[1]^i[f+2],e[f+2]=n[2]^=u(o(h)),h=n[0]^n[1]^n[2]^i[f+3],e[f+3]=n[3]^=u(o(h));if(0===r)for(var l,c=0;c<16;c++)l=e[c],e[c]=e[31-c],e[31-c]=l}(n,w,s);for(var T=[],F=y,B=e.length,x=0;B>=t;){var E=e.slice(x,x+16),I=new Array(16);if("cbc"===p)for(var S=0;S<t;S++)0!==s&&(E[S]^=F[S]);h(E,I,w);for(var D=0;D<t;D++)"cbc"===p&&0===s&&(I[D]^=F[D]),T[x+D]=I[D];"cbc"===p&&(F=0!==s?I:E),B-=t,x+=t}if(("pkcs#5"===c||"pkcs#7"===c)&&0===s){for(var q=T.length,A=T[q-1],P=1;P<=A;P++)if(T[q-P]!==A)throw new Error("padding is invalid");T.splice(q-A,A)}return"array"!==m?0!==s?T.map(function(t){return 1===(t=t.toString(16)).length?"0"+t:t}).join(""):function(t){for(var e=[],i=0,r=t.length;i<r;i++)t[i]>=240&&t[i]<=247?(e.push(String.fromCodePoint(((7&t[i])<<18)+((63&t[i+1])<<12)+((63&t[i+2])<<6)+(63&t[i+3]))),i+=3):t[i]>=224&&t[i]<=239?(e.push(String.fromCodePoint(((15&t[i])<<12)+((63&t[i+1])<<6)+(63&t[i+2]))),i+=2):t[i]>=192&&t[i]<=223?(e.push(String.fromCodePoint(((31&t[i])<<6)+(63&t[i+1]))),i++):e.push(String.fromCodePoint(t[i]));return e.join("")}(T):T}return B={encrypt:function(t,e,i){return f(t,e,1,i)},decrypt:function(t,e,i){return f(t,e,0,i)}}}var C=I?E:(I=1,E={sm2:R(),sm3:M(),sm4:k()});function H(){var t=window.navigator.userAgent,e=t.indexOf("MSIE "),i=t.indexOf("Trident/"),r=t.indexOf("Edge/");return(e>0||i>0)&&r<0}function L(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on"+e,i)}function j(t,e,i){t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent&&t.detachEvent("on"+e,i)}function z(t){if(Object.entries)return Object.entries(t);for(var e=Object.keys(t),i=[],r=0;r<e.length;r++)i.push([e[r],t[e[r]]]);return i}function N(t,e){H()?(t.style.msUserSelect=e,t.style.userSelect=e):t.style.userSelect=e}function V(t,e){H()&&"grabbing"===e?t.style.cursor="move":t.style.cursor=e}!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?window.globalThis=window:"undefined"!=typeof global?global.globalThis=global:"undefined"!=typeof self?self.globalThis=self:this.globalThis=this)}();function U(){this.options={},this.container=null,this.iframe=null,this.overlay=null,this.eventListeners={}}function K(){return document.body?document.body:document.getElementsByTagName("body")[0]?document.getElementsByTagName("body")[0]:null}return U.prototype.init=function(t){var e=this;this.options=t;var i,r=function(){var i=K();if(i&&!document.getElementById("wk-ai-customer-container")){var r,n,o,s,u,a,h,f=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||1024,l=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||768;if(e.options.height=t.height||40,e.options.width=t.width||40,e.left=f-e.options.width-40,e.top=l-e.options.height-40,void 0!==t.right&&t.right>0?e.left=f-t.right-e.options.width:void 0!==t.left&&t.left>=0&&(e.left=t.left),void 0!==t.bottom&&t.bottom>0?e.top=l-t.bottom-e.options.height:void 0!==t.top&&t.top>=0&&(e.top=t.top),e.left<0&&(e.left=10),e.top<0&&(e.top=10),e.left+e.options.width>f&&(e.left=f-e.options.width-10),e.top+e.options.height>l&&(e.top=l-e.options.height-10),H()&&(e.left>f-100&&(e.left=f-e.options.width-20),e.top>l-100&&(e.top=l-e.options.height-20),e.left<0&&(e.left=100),e.top<0&&(e.top=100)),e.container=document.createElement("div"),e.container.id="wk-ai-customer-container",e.container.style.position="fixed",e.container.style.width=e.options.width+"px",e.container.style.height=e.options.height+"px",e.container.style.top=e.top+"px",e.container.style.left=e.left+"px",e.container.style.display="block",e.container.style.visibility="visible",e.container.style.zIndex="999999",e.container.style.overflow="hidden",e.container.style.margin="0",e.container.style.padding="0",e.container.style.backgroundColor="transparent",H()){e.container.style.filter="alpha(opacity=100)",e.container.style.zoom="1",e.container.style.minWidth=e.options.width+"px",e.container.style.minHeight=e.options.height+"px";var c=document.createElement("div");c.style.cssText="width:100%;height:100%;position:absolute;top:0;left:0;background-color:#f0f0f0;z-index:1;",e.container.appendChild(c)}i.appendChild(e.container),H()&&(e.container.style.display="none",e.container.offsetHeight,e.container.style.display="block");try{var p=e.options.baseUrl||"https://ai.vcolco.com/chat/",d=e.buildQueryParams();e.iframe=document.createElement("iframe"),e.iframe.allowTransparency="true",e.iframe.src=p+"?"+d,e.iframe.width="100%",e.iframe.height="100%",e.iframe.frameBorder="0",e.iframe.scrolling="no",e.iframe.style.border="none",e.iframe.style.position="absolute",e.iframe.style.zIndex="2024",e.iframe.style.left="0",e.iframe.style.top="0",e.iframe.style.width="100%",e.iframe.style.height="100%",e.iframe.style.backgroundColor="transparent",e.container.appendChild(e.iframe),H()&&L(e.iframe,"load",function(){var t=e.container.querySelector("div[style*='background-color:#f0f0f0']");t&&t.parentNode&&t.parentNode.removeChild(t)})}catch(t){}e.overlay=document.createElement("div"),e.overlay.style.position="absolute",e.overlay.style.width="100%",e.overlay.style.height="100%",e.overlay.style.cursor="pointer",e.overlay.style.opacity="0",e.overlay.style.zIndex="2025",e.overlay.style.left="0",e.overlay.style.top="0",e.container.appendChild(e.overlay),r=e,n=e.overlay,o=function(){e.container.style.width="500px",e.container.style.height="100%",e.container.style.right="0",e.container.style.top="0",e.container.style.bottom="auto",e.container.style.left="auto",e.container.style.position="fixed",e.container.style.zIndex="999999",e.overlay.style.zIndex="2024",e.iframe&&(e.iframe.style.zIndex="2025"),e.postMessage({type:"clickIcon"})},s=!1,u=!1,a=function(t){if(s){u=!0;var e=n.getBoundingClientRect(),i=t.clientX-e.width/2,o=t.clientY-e.height/2;i=i<0?0:i,o=o<0?0:o,r.container.style.left=i+"px",r.container.style.top=o+"px",r.left=i,r.top=t.clientY-o}},h=function(t){N(document.body,""),s&&(s=!1,V(n,"pointer"),j(document,"mousemove",a),j(document,"mouseup",h))},L(n,"mousedown",function(t){N(document.body,"none"),s=!0,u=!1;var e=n.getBoundingClientRect?n.getBoundingClientRect():{width:n.offsetWidth||0,height:n.offsetHeight||0,left:n.offsetLeft||0,top:n.offsetTop||0};t.clientX,e.left,e.width,t.clientY,e.top,e.height,t.clientX,t.clientY,r.container.style.left=t.clientX-e.width/2+"px",r.container.style.top=t.clientY-e.height/2+"px",r.top=t.clientY-e.height/2,r.left=t.clientX-e.width/2,V(n,"grabbing"),L(document,"mousemove",a),L(document,"mouseup",h)}),L(n,"click",function(t){u?(function(t){t.stopImmediatePropagation?t.stopImmediatePropagation():(t.stopPropagation(),void 0!==t.cancelBubble&&(t.cancelBubble=!0))}(t),t.preventDefault?t.preventDefault():t.returnValue=!1,u=!1):o&&o()});var y=function(t){e.handleMessage(t)};e._boundHandleMessage=y,L(window,"message",y),e.iframe&&e.postMessage({type:"init"})}},n=function(){try{if(!K())return void setTimeout(n,50);r()}catch(t){}};n(),i=function(){try{var t=K();if(!t)return void setTimeout(function(){(t=K())&&r()},100);document.getElementById("wk-ai-customer-container")||r()}catch(t){}},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(i,1):document.addEventListener("DOMContentLoaded",i,!1)},U.prototype.buildQueryParams=function(){var t=this.options.Enterprise,e=this.options.Externalid,i=this.options.Role,r=this.options.Userid,n=this.options.Username,o=this.options.Knowledge,s=this.options.Privatekey,u=this.options.Usetype;if(!(t&&e&&i&&r&&n))throw new Error("Missing required options: Enterprise, Externalid, Role, Userid, Username");var a={Enterprise:t,Externalid:e,Knowledge:o||"",Role:i,Userid:r,Username:n};a.Knowledge||delete a.Knowledge;var h=z(a).map(function(t){return t[0]+"="+t[1]}).join("&");return a.Sign=C.sm2.doSignature(h,s,{der:!0,hash:!0}),u&&(a.Usetype=u),a.Iframe="PC",z(a).map(function(t){return t[0]+"="+t[1]}).join("&")},U.prototype.handleMessage=function(t){var e=function(t){if(!H()&&window.URL)try{return new URL(t).origin}catch(t){}var e=document.createElement("a");return e.href=t,e.protocol+"//"+e.host}(this.options.baseUrl||"https://ai.vcolco.com/chat/");if(t.origin===e){if(t.data&&t.data.type&&this.eventListeners[t.data.type])for(var i=this.eventListeners[t.data.type],r=0;r<i.length;r++)i[r](t.data);if(t.data&&t.data.type)switch(t.data.type){case"showChat":break;case"hideChat":this.container.style.width=this.options.width+"px",this.container.style.height=this.options.height+"px",this.container.style.top=this.top+"px",this.container.style.left=this.left+"px",this.container.style.bottom="auto",this.container.style.right="auto",this.container.style.position="fixed",this.overlay.style.zIndex="2025",this.iframe&&(this.iframe.style.zIndex="2024")}}},U.prototype.postMessage=function(t){if(this.iframe&&this.iframe.contentWindow){var e=this.options.baseUrl||"https://ai.vcolco.com/chat/";this.iframe.contentWindow.postMessage(t,e)}},U.prototype.on=function(t,e){return this.eventListeners[t]||(this.eventListeners[t]=[]),this.eventListeners[t].push(e),this},U.prototype.off=function(t,e){},U.prototype.show=function(){},U.prototype.hide=function(){},U.prototype.destroy=function(){this._boundHandleMessage&&j(window,"message",this._boundHandleMessage);var t=document.getElementById("wk-ai-customer-container");t&&t.parentNode&&t.parentNode.removeChild(t)},new U});
|