geekin-devtoys 0.2.5 → 0.2.6
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
\r \u2028\u2029`;for(
|
|
3
|
-
\r \u2028\u2029`;for(
|
|
4
|
-
`;break;default:
|
|
5
|
-
`}
|
|
6
|
-
`,
|
|
7
|
-
`;i/=2,
|
|
8
|
-
`,this.sub!==null){t+=" ";for(var i=0,n=this.sub.length;i<n;++i)e+=this.sub[i].toPrettyString(t)}return e},r.prototype.posStart=function(){return this.stream.pos},r.prototype.posContent=function(){return this.stream.pos+this.header},r.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},r.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},r.decodeLength=function(t){var e=t.get(),i=e&127;if(i==e)return i;if(i>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(i===0)return null;e=0;for(var n=0;n<i;++n)e=e*256+t.get();return e},r.prototype.getHexStringValue=function(){var t=this.toHexString(),e=this.header*2,i=this.length*2;return t.substring(e,e+i)},r.decode=function(t){var e;t instanceof vt?e=t:e=new vt(t,0);var i=new vt(e),n=new Rt(e),s=r.decodeLength(e),o=e.pos,a=o-i.pos,h=null,f=function(){var c=[];if(s!==null){for(var v=o+s;e.pos<v;)c[c.length]=r.decode(e);if(e.pos!=v)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var p=r.decode(e);if(p.tag.isEOC())break;c[c.length]=p}s=o-e.pos}catch(T){throw new Error("Exception while decoding undefined length content: "+T)}return c};if(n.tagConstructed)h=f();else if(n.isUniversal()&&(n.tagNumber==3||n.tagNumber==4))try{if(n.tagNumber==3&&e.get()!=0)throw new Error("BIT STRINGs with unused bits cannot encapsulate.");h=f();for(var l=0;l<h.length;++l)if(h[l].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch{h=null}if(h===null){if(s===null)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);e.pos=o+Math.abs(s)}return new r(i,a,s,n,h)},r})(),Rt=(function(){function r(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var i=new tt;do e=t.get(),i.mulAdd(128,e&127);while(e&128);this.tagNumber=i.simplify()}}return r.prototype.isUniversal=function(){return this.tagClass===0},r.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},r})(),U,Xt=0xdeadbeefcafe,At=(Xt&16777215)==15715070,A=[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],Qt=(1<<26)/A[A.length-1],g=(function(){function r(t,e,i){t!=null&&(typeof t=="number"?this.fromNumber(t,e,i):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}return r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var i=(1<<e)-1,n,s=!1,o="",a=this.t,h=this.DB-a*this.DB%e;if(a-- >0)for(h<this.DB&&(n=this[a]>>h)>0&&(s=!0,o=H(n));a>=0;)h<e?(n=(this[a]&(1<<h)-1)<<e-h,n|=this[--a]>>(h+=this.DB-e)):(n=this[a]>>(h-=e)&i,h<=0&&(h+=this.DB,--a)),n>0&&(s=!0),s&&(o+=H(n));return s?o:"0"},r.prototype.negate=function(){var t=S();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var e=this.s-t.s;if(e!=0)return e;var i=this.t;if(e=i-t.t,e!=0)return this.s<0?-e:e;for(;--i>=0;)if((e=this[i]-t[i])!=0)return e;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+st(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var e=S();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(r.ZERO)>0&&t.subTo(e,e),e},r.prototype.modPowInt=function(t,e){var i;return t<256||e.isEven()?i=new Bt(e):i=new It(e),this.exp(t,i)},r.prototype.clone=function(){var t=S();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i=this.DB-t*this.DB%8,n,s=0;if(t-- >0)for(i<this.DB&&(n=this[t]>>i)!=(this.s&this.DM)>>i&&(e[s++]=n|this.s<<this.DB-i);t>=0;)i<8?(n=(this[t]&(1<<i)-1)<<8-i,n|=this[--t]>>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),(n&128)!=0&&(n|=-256),s==0&&(this.s&128)!=(n&128)&&++s,(s>0||n!=this.s)&&(e[s++]=n);return e},r.prototype.equals=function(t){return this.compareTo(t)==0},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var e=S();return this.bitwiseTo(t,Jt,e),e},r.prototype.or=function(t){var e=S();return this.bitwiseTo(t,nt,e),e},r.prototype.xor=function(t){var e=S();return this.bitwiseTo(t,Et,e),e},r.prototype.andNot=function(t){var e=S();return this.bitwiseTo(t,Dt,e),e},r.prototype.not=function(){for(var t=S(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var e=S();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},r.prototype.shiftRight=function(t){var e=S();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+zt(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=Wt(this[i]^e);return t},r.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0},r.prototype.setBit=function(t){return this.changeBit(t,nt)},r.prototype.clearBit=function(t){return this.changeBit(t,Dt)},r.prototype.flipBit=function(t){return this.changeBit(t,Et)},r.prototype.add=function(t){var e=S();return this.addTo(t,e),e},r.prototype.subtract=function(t){var e=S();return this.subTo(t,e),e},r.prototype.multiply=function(t){var e=S();return this.multiplyTo(t,e),e},r.prototype.divide=function(t){var e=S();return this.divRemTo(t,e,null),e},r.prototype.remainder=function(t){var e=S();return this.divRemTo(t,null,e),e},r.prototype.divideAndRemainder=function(t){var e=S(),i=S();return this.divRemTo(t,e,i),[e,i]},r.prototype.modPow=function(t,e){var i=t.bitLength(),n,s=j(1),o;if(i<=0)return s;i<18?n=1:i<48?n=3:i<144?n=4:i<768?n=5:n=6,i<8?o=new Bt(e):e.isEven()?o=new ee(e):o=new It(e);var a=[],h=3,f=n-1,l=(1<<n)-1;if(a[1]=o.convert(this),n>1){var c=S();for(o.sqrTo(a[1],c);h<=l;)a[h]=S(),o.mulTo(c,a[h-2],a[h]),h+=2}var v=t.t-1,p,T=!0,b=S(),R;for(i=st(t[v])-1;v>=0;){for(i>=f?p=t[v]>>i-f&l:(p=(t[v]&(1<<i+1)-1)<<f-i,v>0&&(p|=t[v-1]>>this.DB+i-f)),h=n;(p&1)==0;)p>>=1,--h;if((i-=h)<0&&(i+=this.DB,--v),T)a[p].copyTo(s),T=!1;else{for(;h>1;)o.sqrTo(s,b),o.sqrTo(b,s),h-=2;h>0?o.sqrTo(s,b):(R=s,s=b,b=R),o.mulTo(b,a[p],s)}for(;v>=0&&(t[v]&1<<i)==0;)o.sqrTo(s,b),R=s,s=b,b=R,--i<0&&(i=this.DB-1,--v)}return o.revert(s)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return r.ZERO;for(var i=t.clone(),n=this.clone(),s=j(1),o=j(0),a=j(0),h=j(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),e?((!s.isEven()||!o.isEven())&&(s.addTo(this,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!h.isEven())&&(a.addTo(this,a),h.subTo(t,h)),a.rShiftTo(1,a)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);i.compareTo(n)>=0?(i.subTo(n,i),e&&s.subTo(a,s),o.subTo(h,o)):(n.subTo(i,n),e&&a.subTo(s,a),h.subTo(o,h))}if(n.compareTo(r.ONE)!=0)return r.ZERO;if(h.compareTo(t)>=0)return h.subtract(t);if(h.signum()<0)h.addTo(t,h);else return h;return h.signum()<0?h.add(t):h},r.prototype.pow=function(t){return this.exp(t,new te)},r.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 n=e;e=i,i=n}var s=e.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return e;for(s<o&&(o=s),o>0&&(e.rShiftTo(o,e),i.rShiftTo(o,i));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,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},r.prototype.isProbablePrime=function(t){var e,i=this.abs();if(i.t==1&&i[0]<=A[A.length-1]){for(e=0;e<A.length;++e)if(i[0]==A[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<A.length;){for(var n=A[e],s=e+1;s<A.length&&n<Qt;)n*=A[s++];for(n=i.modInt(n);e<s;)if(n%A[e++]==0)return!1}return i.millerRabin(t)},r.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},r.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},r.prototype.fromString=function(t,e){var i;if(e==16)i=4;else if(e==8)i=3;else if(e==256)i=8;else if(e==2)i=1;else if(e==32)i=5;else if(e==4)i=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,s=!1,o=0;--n>=0;){var a=i==8?+t[n]&255:Ot(t,n);if(a<0){t.charAt(n)=="-"&&(s=!0);continue}s=!1,o==0?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=i,o>=this.DB&&(o-=this.DB)}i==8&&(+t[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.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},r.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},r.prototype.lShiftTo=function(t,e){for(var i=t%this.DB,n=this.DB-i,s=(1<<n)-1,o=Math.floor(t/this.DB),a=this.s<<i&this.DM,h=this.t-1;h>=0;--h)e[h+o+1]=this[h]>>n|a,a=(this[h]&s)<<i;for(var h=o-1;h>=0;--h)e[h]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()},r.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t){e.t=0;return}var n=t%this.DB,s=this.DB-n,o=(1<<n)-1;e[0]=this[i]>>n;for(var a=i+1;a<this.t;++a)e[a-i-1]|=(this[a]&o)<<s,e[a-i]=this[a]>>n;n>0&&(e[this.t-i-1]|=(this.s&o)<<s),e.t=this.t-i,e.clamp()},r.prototype.subTo=function(t,e){for(var i=0,n=0,s=Math.min(t.t,this.t);i<s;)n+=this[i]-t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n-=t[i],e[i++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:n>0&&(e[i++]=n),e.t=i,e.clamp()},r.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),s=i.t;for(e.t=s+n.t;--s>=0;)e[s]=0;for(s=0;s<n.t;++s)e[s+i.t]=i.am(0,n[s],e,s,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.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 n=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,n,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()},r.prototype.divRemTo=function(t,e,i){var n=t.abs();if(!(n.t<=0)){var s=this.abs();if(s.t<n.t){e?.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=S());var o=S(),a=this.s,h=t.s,f=this.DB-st(n[n.t-1]);f>0?(n.lShiftTo(f,o),s.lShiftTo(f,i)):(n.copyTo(o),s.copyTo(i));var l=o.t,c=o[l-1];if(c!=0){var v=c*(1<<this.F1)+(l>1?o[l-2]>>this.F2:0),p=this.FV/v,T=(1<<this.F1)/v,b=1<<this.F2,R=i.t,q=R-l,I=e??S();for(o.dlShiftTo(q,I),i.compareTo(I)>=0&&(i[i.t++]=1,i.subTo(I,i)),r.ONE.dlShiftTo(l,I),I.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--q>=0;){var F=i[--R]==c?this.DM:Math.floor(i[R]*p+(i[R-1]+b)*T);if((i[R]+=o.am(0,F,i,q,0,l))<F)for(o.dlShiftTo(q,I),i.subTo(I,i);i[R]<--F;)i.subTo(I,i)}e!=null&&(i.drShiftTo(l,e),a!=h&&r.ZERO.subTo(e,e)),i.t=l,i.clamp(),f>0&&i.rShiftTo(f,i),a<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e},r.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},r.prototype.exp=function(t,e){if(t>4294967295||t<1)return r.ONE;var i=S(),n=S(),s=e.convert(this),o=st(t)-1;for(s.copyTo(i);--o>=0;)if(e.sqrTo(i,n),(t&1<<o)>0)e.mulTo(n,s,i);else{var a=i;i=n,n=a}return e.revert(i)},r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),n=j(i),s=S(),o=S(),a="";for(this.divRemTo(n,s,o);s.signum()>0;)a=(i+o.intValue()).toString(t).substring(1)+a,s.divRemTo(n,s,o);return o.intValue().toString(t)+a},r.prototype.fromRadix=function(t,e){this.fromInt(0),e==null&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),s=!1,o=0,a=0,h=0;h<t.length;++h){var f=Ot(t,h);if(f<0){t.charAt(h)=="-"&&this.signum()==0&&(s=!0);continue}a=e*a+f,++o>=i&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),s&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,i){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),nt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var n=[],s=t&7;n.length=(t>>3)+1,e.nextBytes(n),s>0?n[0]&=(1<<s)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(t,e,i){var n,s,o=Math.min(t.t,this.t);for(n=0;n<o;++n)i[n]=e(this[n],t[n]);if(t.t<this.t){for(s=t.s&this.DM,n=o;n<this.t;++n)i[n]=e(this[n],s);i.t=this.t}else{for(s=this.s&this.DM,n=o;n<t.t;++n)i[n]=e(s,t[n]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},r.prototype.changeBit=function(t,e){var i=r.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},r.prototype.addTo=function(t,e){for(var i=0,n=0,s=Math.min(t.t,this.t);i<s;)n+=this[i]+t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n+=t[i],e[i++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[i++]=n:n<-1&&(e[i++]=this.DV+n),e.t=i,e.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,e){if(t!=0){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]}},r.prototype.multiplyLowerTo=function(t,e,i){var n=Math.min(this.t+t.t,e);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(var s=i.t-this.t;n<s;++n)i[n+this.t]=this.am(0,t[n],i,n,0,this.t);for(var s=Math.min(t.t,e);n<s;++n)this.am(0,t[n],i,n,0,e-n);i.clamp()},r.prototype.multiplyUpperTo=function(t,e,i){--e;var n=i.t=this.t+t.t-e;for(i.s=0;--n>=0;)i[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)i[this.t+n-e]=this.am(e-n,t[n],i,0,0,this.t+n-e);i.clamp(),i.drShiftTo(1,i)},r.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(e==0)i=this[0]%t;else for(var n=this.t-1;n>=0;--n)i=(e*i+this[n])%t;return i},r.prototype.millerRabin=function(t){var e=this.subtract(r.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var n=e.shiftRight(i);t=t+1>>1,t>A.length&&(t=A.length);for(var s=S(),o=0;o<t;++o){s.fromInt(A[Math.floor(Math.random()*A.length)]);var a=s.modPow(n,this);if(a.compareTo(r.ONE)!=0&&a.compareTo(e)!=0){for(var h=1;h++<i&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(r.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0},r.prototype.square=function(){var t=S();return this.squareTo(t),t},r.prototype.gcda=function(t,e){var i=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(i.compareTo(n)<0){var s=i;i=n,n=s}var o=i.getLowestSetBit(),a=n.getLowestSetBit();if(a<0){e(i);return}o<a&&(a=o),a>0&&(i.rShiftTo(a,i),n.rShiftTo(a,n));var h=function(){(o=i.getLowestSetBit())>0&&i.rShiftTo(o,i),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),i.compareTo(n)>=0?(i.subTo(n,i),i.rShiftTo(1,i)):(n.subTo(i,n),n.rShiftTo(1,n)),i.signum()>0?setTimeout(h,0):(a>0&&n.lShiftTo(a,n),setTimeout(function(){e(n)},0))};setTimeout(h,10)},r.prototype.fromNumberAsync=function(t,e,i,n){if(typeof e=="number")if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),nt,this),this.isEven()&&this.dAddOffset(1,0);var s=this,o=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(r.ONE.shiftLeft(t-1),s),s.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var a=[],h=t&7;a.length=(t>>3)+1,e.nextBytes(a),h>0?a[0]&=(1<<h)-1:a[0]=0,this.fromString(a,256)}},r})(),te=(function(){function r(){}return r.prototype.convert=function(t){return t},r.prototype.revert=function(t){return t},r.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},r.prototype.sqrTo=function(t,e){t.squareTo(e)},r})(),Bt=(function(){function r(t){this.m=t}return r.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},r.prototype.revert=function(t){return t},r.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},r.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},r.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},r})(),It=(function(){function r(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return r.prototype.convert=function(t){var e=S();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(g.ZERO)>0&&this.m.subTo(e,e),e},r.prototype.revert=function(t){var e=S();return t.copyTo(e),this.reduce(e),e},r.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=t[e]&32767,n=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,n,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)},r.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},r.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},r})(),ee=(function(){function r(t){this.m=t,this.r2=S(),this.q3=S(),g.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return r.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=S();return t.copyTo(e),this.reduce(e),e},r.prototype.revert=function(t){return t},r.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)},r.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},r.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},r})();function S(){return new g(null)}function w(r,t){return new g(r,t)}var Vt=typeof navigator<"u";Vt&&At&&navigator.appName=="Microsoft Internet Explorer"?(g.prototype.am=function(t,e,i,n,s,o){for(var a=e&32767,h=e>>15;--o>=0;){var f=this[t]&32767,l=this[t++]>>15,c=h*f+l*a;f=a*f+((c&32767)<<15)+i[n]+(s&1073741823),s=(f>>>30)+(c>>>15)+h*l+(s>>>30),i[n++]=f&1073741823}return s},U=30):Vt&&At&&navigator.appName!="Netscape"?(g.prototype.am=function(t,e,i,n,s,o){for(;--o>=0;){var a=e*this[t++]+i[n]+s;s=Math.floor(a/67108864),i[n++]=a&67108863}return s},U=26):(g.prototype.am=function(t,e,i,n,s,o){for(var a=e&16383,h=e>>14;--o>=0;){var f=this[t]&16383,l=this[t++]>>14,c=h*f+l*a;f=a*f+((c&16383)<<14)+i[n]+s,s=(f>>28)+(c>>14)+h*l,i[n++]=f&268435455}return s},U=28);g.prototype.DB=U;g.prototype.DM=(1<<U)-1;g.prototype.DV=1<<U;var bt=52;g.prototype.FV=Math.pow(2,bt);g.prototype.F1=bt-U;g.prototype.F2=2*U-bt;var pt=[],X,O;X=48;for(O=0;O<=9;++O)pt[X++]=O;X=97;for(O=10;O<36;++O)pt[X++]=O;X=65;for(O=10;O<36;++O)pt[X++]=O;function Ot(r,t){var e=pt[r.charCodeAt(t)];return e??-1}function j(r){var t=S();return t.fromInt(r),t}function st(r){var t=1,e;return(e=r>>>16)!=0&&(r=e,t+=16),(e=r>>8)!=0&&(r=e,t+=8),(e=r>>4)!=0&&(r=e,t+=4),(e=r>>2)!=0&&(r=e,t+=2),(e=r>>1)!=0&&(r=e,t+=1),t}g.ZERO=j(0);g.ONE=j(1);var ie=(function(){function r(){this.i=0,this.j=0,this.S=[]}return r.prototype.init=function(t){var e,i,n;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,n=this.S[e],this.S[e]=this.S[i],this.S[i]=n;this.i=0,this.j=0},r.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]},r})();function re(){return new ie}var Ft=256,ot,K=null,_;if(K==null){K=[],_=0;var at=void 0;if(typeof window<"u"&&self.crypto&&self.crypto.getRandomValues){var gt=new Uint32Array(256);for(self.crypto.getRandomValues(gt),at=0;at<gt.length;++at)K[_++]=gt[at]&255}var ht=0,ut=function(r){if(ht=ht||0,ht>=256||_>=Ft){self.removeEventListener?self.removeEventListener("mousemove",ut,!1):self.detachEvent&&self.detachEvent("onmousemove",ut);return}try{var t=r.x+r.y;K[_++]=t&255,ht+=1}catch{}};typeof window<"u"&&(self.addEventListener?self.addEventListener("mousemove",ut,!1):self.attachEvent&&self.attachEvent("onmousemove",ut))}function ne(){if(ot==null){for(ot=re();_<Ft;){var r=Math.floor(65536*Math.random());K[_++]=r&255}for(ot.init(K),_=0;_<K.length;++_)K[_]=0;_=0}return ot.next()}var ct=(function(){function r(){}return r.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=ne()},r})();function Tt(r){return oe(de(se(r),r.length*8))}function Nt(r){for(var t="0123456789abcdef",e="",i=0;i<r.length;i++){var n=r.charCodeAt(i);e+=t.charAt(n>>>4&15)+t.charAt(n&15)}return e}function se(r){for(var t=Array(r.length>>2),e=0;e<t.length;e++)t[e]=0;for(var e=0;e<r.length*8;e+=8)t[e>>5]|=(r.charCodeAt(e/8)&255)<<24-e%32;return t}function oe(r){for(var t="",e=0;e<r.length*32;e+=8)t+=String.fromCharCode(r[e>>5]>>>24-e%32&255);return t}function C(r,t){return r>>>t|r<<32-t}function kt(r,t){return r>>>t}function ae(r,t,e){return r&t^~r&e}function he(r,t,e){return r&t^r&e^t&e}function ue(r){return C(r,2)^C(r,13)^C(r,22)}function fe(r){return C(r,6)^C(r,11)^C(r,25)}function le(r){return C(r,7)^C(r,18)^kt(r,3)}function ce(r){return C(r,17)^C(r,19)^kt(r,10)}var pe=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function de(r,t){var e=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),i=new Array(64),n,s,o,a,h,f,l,c,v,p,T,b;for(r[t>>5]|=128<<24-t%32,r[(t+64>>9<<4)+15]=t,v=0;v<r.length;v+=16){for(n=e[0],s=e[1],o=e[2],a=e[3],h=e[4],f=e[5],l=e[6],c=e[7],p=0;p<64;p++)p<16?i[p]=r[p+v]:i[p]=x(x(x(ce(i[p-2]),i[p-7]),le(i[p-15])),i[p-16]),T=x(x(x(x(c,fe(h)),ae(h,f,l)),pe[p]),i[p]),b=x(ue(n),he(n,s,o)),c=l,l=f,f=h,h=x(a,T),a=o,o=s,s=n,n=x(T,b);e[0]=x(n,e[0]),e[1]=x(s,e[1]),e[2]=x(o,e[2]),e[3]=x(a,e[3]),e[4]=x(h,e[4]),e[5]=x(f,e[5]),e[6]=x(l,e[6]),e[7]=x(c,e[7])}return e}function x(r,t){var e=(r&65535)+(t&65535),i=(r>>16)+(t>>16)+(e>>16);return i<<16|e&65535}function ve(r,t){if(t<r.length+22)return console.error("Message too long for RSA"),null;for(var e=t-r.length-6,i="",n=0;n<e;n+=2)i+="ff";var s="0001"+i+"00"+r;return w(s,16)}function ge(r,t){if(t<r.length+11)return console.error("Message too long for RSA"),null;for(var e=[],i=r.length-1;i>=0&&t>0;){var n=r.charCodeAt(i--);n<128?e[--t]=n:n>127&&n<2048?(e[--t]=n&63|128,e[--t]=n>>6|192):(e[--t]=n&63|128,e[--t]=n>>6&63|128,e[--t]=n>>12|224)}e[--t]=0;for(var s=new ct,o=[];t>2;){for(o[0]=0;o[0]==0;)s.nextBytes(o);e[--t]=o[0]}return e[--t]=2,e[--t]=0,new g(e)}function Pt(r,t,e){for(var i="",n=0;i.length<t;)i+=e(String.fromCharCode.apply(String,r.concat([(n&4278190080)>>24,(n&16711680)>>16,(n&65280)>>8,n&255]))),n+=1;return i}var ye=32;function me(r,t){var e=ye,i=Tt;if(r.length+2*e+2>t)throw"Message too long for RSA";var n="",s;for(s=0;s<t-r.length-2*e-2;s+=1)n+="\0";var o=i("")+n+""+r,a=new Array(e);new ct().nextBytes(a);var h=Pt(a,o.length,i),f=[];for(s=0;s<o.length;s+=1)f[s]=o.charCodeAt(s)^h.charCodeAt(s);var l=Pt(f,a.length,i),c=[0];for(s=0;s<a.length;s+=1)c[s+1]=a[s]^l.charCodeAt(s);return new g(c.concat(f))}var Se=(function(){function r(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return r.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},r.prototype.doPrivate=function(t){if(this.p==null||this.q==null)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},r.prototype.setPublic=function(t,e){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=w(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},r.prototype.encrypt=function(t,e){typeof e>"u"&&(e=ge);var i=this.n.bitLength()+7>>3,n=e(t,i);if(n==null)return null;var s=this.doPublic(n);if(s==null)return null;for(var o=s.toString(16),a=o.length,h=0;h<i*2-a;h++)o="0"+o;return o},r.prototype.setPrivate=function(t,e,i){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=w(t,16),this.e=parseInt(e,16),this.d=w(i,16)):console.error("Invalid RSA private key")},r.prototype.setPrivateEx=function(t,e,i,n,s,o,a,h){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=w(t,16),this.e=parseInt(e,16),this.d=w(i,16),this.p=w(n,16),this.q=w(s,16),this.dmp1=w(o,16),this.dmq1=w(a,16),this.coeff=w(h,16)):console.error("Invalid RSA private key")},r.prototype.generate=function(t,e){var i=new ct,n=t>>1;this.e=parseInt(e,16);for(var s=new g(e,16);;){for(;this.p=new g(t-n,1,i),!(this.p.subtract(g.ONE).gcd(s).compareTo(g.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new g(n,1,i),!(this.q.subtract(g.ONE).gcd(s).compareTo(g.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(g.ONE),h=this.q.subtract(g.ONE),f=a.multiply(h);if(f.gcd(s).compareTo(g.ONE)==0){this.n=this.p.multiply(this.q),this.d=s.modInverse(f),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},r.prototype.decrypt=function(t){var e=w(t,16),i=this.doPrivate(e);return i==null?null:Te(i,this.n.bitLength()+7>>3)},r.prototype.generateAsync=function(t,e,i){var n=new ct,s=t>>1;this.e=parseInt(e,16);var o=new g(e,16),a=this,h=function(){var f=function(){if(a.p.compareTo(a.q)<=0){var v=a.p;a.p=a.q,a.q=v}var p=a.p.subtract(g.ONE),T=a.q.subtract(g.ONE),b=p.multiply(T);b.gcd(o).compareTo(g.ONE)==0?(a.n=a.p.multiply(a.q),a.d=o.modInverse(b),a.dmp1=a.d.mod(p),a.dmq1=a.d.mod(T),a.coeff=a.q.modInverse(a.p),setTimeout(function(){i()},0)):setTimeout(h,0)},l=function(){a.q=S(),a.q.fromNumberAsync(s,1,n,function(){a.q.subtract(g.ONE).gcda(o,function(v){v.compareTo(g.ONE)==0&&a.q.isProbablePrime(10)?setTimeout(f,0):setTimeout(l,0)})})},c=function(){a.p=S(),a.p.fromNumberAsync(t-s,1,n,function(){a.p.subtract(g.ONE).gcda(o,function(v){v.compareTo(g.ONE)==0&&a.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(h,0)},r.prototype.sign=function(t,e,i){var n=be(i),s=n+e(t).toString(),o=this.n.bitLength()/4,a=ve(s,o);if(a==null)return null;var h=this.doPrivate(a);if(h==null)return null;for(var f=h.toString(16),l=f.length,c=0;c<o-l;c++)f="0"+f;return f},r.prototype.verify=function(t,e,i){var n=w(e,16),s=this.doPublic(n);if(s==null)return null;var o=s.toString(16).replace(/^1f+00/,""),a=we(o);return a==i(t).toString()},r})();function Te(r,t){for(var e=r.toByteArray(),i=0;i<e.length&&e[i]==0;)++i;if(e.length-i!=t-1||e[i]!=2)return null;for(++i;e[i]!=0;)if(++i>=e.length)return null;for(var n="";++i<e.length;){var s=e[i]&255;s<128?n+=String.fromCharCode(s):s>191&&s<224?(n+=String.fromCharCode((s&31)<<6|e[i+1]&63),++i):(n+=String.fromCharCode((s&15)<<12|(e[i+1]&63)<<6|e[i+2]&63),i+=2)}return n}var lt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function be(r){return lt[r]||""}function we(r){for(var t in lt)if(lt.hasOwnProperty(t)){var e=lt[t],i=e.length;if(r.substring(0,i)==e)return r.substring(i)}return r}function D(r,t,e){if(!t||!r)throw new Error("extend failed, please check that all dependencies are included.");var i=function(){};i.prototype=t.prototype,r.prototype=new i,r.prototype.constructor=r,r.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}var u={};(typeof u.asn1>"u"||!u.asn1)&&(u.asn1={});u.asn1.ASN1Util=new function(){this.integerToByteHex=function(r){var t=r.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(r){var t=r.toString(16);if(t.substring(0,1)!="-")t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var e=t.substring(1),i=e.length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var n="",s=0;s<i;s++)n+="f";var o=new g(n,16),a=o.xor(r).add(g.ONE);t=a.toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(r,t){return hextopem(r,t)},this.newObject=function(r){var t=u,e=t.asn1,i=e.DERBoolean,n=e.DERInteger,s=e.DERBitString,o=e.DEROctetString,a=e.DERNull,h=e.DERObjectIdentifier,f=e.DEREnumerated,l=e.DERUTF8String,c=e.DERNumericString,v=e.DERPrintableString,p=e.DERTeletexString,T=e.DERIA5String,b=e.DERUTCTime,R=e.DERGeneralizedTime,q=e.DERSequence,I=e.DERSet,F=e.DERTaggedObject,N=e.ASN1Util.newObject,rt=Object.keys(r);if(rt.length!=1)throw"key of param shall be only one.";var y=rt[0];if(":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+y+":")==-1)throw"undefined key: "+y;if(y=="bool")return new i(r[y]);if(y=="int")return new n(r[y]);if(y=="bitstr")return new s(r[y]);if(y=="octstr")return new o(r[y]);if(y=="null")return new a(r[y]);if(y=="oid")return new h(r[y]);if(y=="enum")return new f(r[y]);if(y=="utf8str")return new l(r[y]);if(y=="numstr")return new c(r[y]);if(y=="prnstr")return new v(r[y]);if(y=="telstr")return new p(r[y]);if(y=="ia5str")return new T(r[y]);if(y=="utctime")return new b(r[y]);if(y=="gentime")return new R(r[y]);if(y=="seq"){for(var k=r[y],L=[],M=0;M<k.length;M++){var J=N(k[M]);L.push(J)}return new q({array:L})}if(y=="set"){for(var k=r[y],L=[],M=0;M<k.length;M++){var J=N(k[M]);L.push(J)}return new I({array:L})}if(y=="tag"){var V=r[y];if(Object.prototype.toString.call(V)==="[object Array]"&&V.length==3){var dt=N(V[2]);return new F({tag:V[0],explicit:V[1],obj:dt})}else{var P={};if(V.explicit!==void 0&&(P.explicit=V.explicit),V.tag!==void 0&&(P.tag=V.tag),V.obj===void 0)throw"obj shall be specified for 'tag'.";return P.obj=N(V.obj),new F(P)}}},this.jsonToASN1HEX=function(r){var t=this.newObject(r);return t.getEncodedHex()}};u.asn1.ASN1Util.oidHexToInt=function(r){for(var n="",t=parseInt(r.substring(0,2),16),e=Math.floor(t/40),i=t%40,n=e+"."+i,s="",o=2;o<r.length;o+=2){var a=parseInt(r.substring(o,o+2),16),h=("00000000"+a.toString(2)).slice(-8);if(s=s+h.substring(1,8),h.substring(0,1)=="0"){var f=new g(s,2);n=n+"."+f.toString(10),s=""}}return n};u.asn1.ASN1Util.oidIntToHex=function(r){var t=function(a){var h=a.toString(16);return h.length==1&&(h="0"+h),h},e=function(a){var h="",f=new g(a,10),l=f.toString(2),c=7-l.length%7;c==7&&(c=0);for(var v="",p=0;p<c;p++)v+="0";l=v+l;for(var p=0;p<l.length-1;p+=7){var T=l.substring(p,p+7);p!=l.length-7&&(T="1"+T),h+=t(parseInt(T,2))}return h};if(!r.match(/^[0-9.]+$/))throw"malformed oid string: "+r;var i="",n=r.split("."),s=parseInt(n[0])*40+parseInt(n[1]);i+=t(s),n.splice(0,2);for(var o=0;o<n.length;o++)i+=e(n[o]);return i};u.asn1.ASN1Object=function(){var r="";this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+r.length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var i=e.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);var n=128+i;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};u.asn1.DERAbstractString=function(r){u.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof r<"u"&&(typeof r=="string"?this.setString(r):typeof r.str<"u"?this.setString(r.str):typeof r.hex<"u"&&this.setStringHex(r.hex))};D(u.asn1.DERAbstractString,u.asn1.ASN1Object);u.asn1.DERAbstractTime=function(r){u.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){utc=t.getTime()+t.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(t,e,i){var n=this.zeroPadding,s=this.localDateToUTC(t),o=String(s.getFullYear());e=="utc"&&(o=o.substring(2,4));var a=n(String(s.getMonth()+1),2),h=n(String(s.getDate()),2),f=n(String(s.getHours()),2),l=n(String(s.getMinutes()),2),c=n(String(s.getSeconds()),2),v=o+a+h+f+l+c;if(i===!0){var p=s.getMilliseconds();if(p!=0){var T=n(String(p),3);T=T.replace(/[0]+$/,""),v=v+"."+T}}return v+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,n,s,o){var a=new Date(Date.UTC(t,e-1,i,n,s,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}};D(u.asn1.DERAbstractTime,u.asn1.ASN1Object);u.asn1.DERAbstractStructured=function(r){u.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,typeof r<"u"&&typeof r.array<"u"&&(this.asn1Array=r.array)};D(u.asn1.DERAbstractStructured,u.asn1.ASN1Object);u.asn1.DERBoolean=function(){u.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};D(u.asn1.DERBoolean,u.asn1.ASN1Object);u.asn1.DERInteger=function(r){u.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=u.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new g(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof r<"u"&&(typeof r.bigint<"u"?this.setByBigInteger(r.bigint):typeof r.int<"u"?this.setByInteger(r.int):typeof r=="number"?this.setByInteger(r):typeof r.hex<"u"&&this.setValueHex(r.hex))};D(u.asn1.DERInteger,u.asn1.ASN1Object);u.asn1.DERBitString=function(r){if(r!==void 0&&typeof r.obj<"u"){var t=u.asn1.ASN1Util.newObject(r.obj);r.hex="00"+t.getEncodedHex()}u.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,i){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+i},this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var i=8-e.length%8;i==8&&(i=0);for(var n=0;n<=i;n++)e+="0";for(var s="",n=0;n<e.length-1;n+=8){var o=e.substring(n,n+8),a=parseInt(o,2).toString(16);a.length==1&&(a="0"+a),s+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+i+s},this.setByBooleanArray=function(e){for(var i="",n=0;n<e.length;n++)e[n]==!0?i+="1":i+="0";this.setByBinaryString(i)},this.newFalseArray=function(e){for(var i=new Array(e),n=0;n<e;n++)i[n]=!1;return i},this.getFreshValueHex=function(){return this.hV},typeof r<"u"&&(typeof r=="string"&&r.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(r):typeof r.hex<"u"?this.setHexValueIncludingUnusedBits(r.hex):typeof r.bin<"u"?this.setByBinaryString(r.bin):typeof r.array<"u"&&this.setByBooleanArray(r.array))};D(u.asn1.DERBitString,u.asn1.ASN1Object);u.asn1.DEROctetString=function(r){if(r!==void 0&&typeof r.obj<"u"){var t=u.asn1.ASN1Util.newObject(r.obj);r.hex=t.getEncodedHex()}u.asn1.DEROctetString.superclass.constructor.call(this,r),this.hT="04"};D(u.asn1.DEROctetString,u.asn1.DERAbstractString);u.asn1.DERNull=function(){u.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};D(u.asn1.DERNull,u.asn1.ASN1Object);u.asn1.DERObjectIdentifier=function(r){var t=function(i){var n=i.toString(16);return n.length==1&&(n="0"+n),n},e=function(i){var n="",s=new g(i,10),o=s.toString(2),a=7-o.length%7;a==7&&(a=0);for(var h="",f=0;f<a;f++)h+="0";o=h+o;for(var f=0;f<o.length-1;f+=7){var l=o.substring(f,f+7);f!=o.length-7&&(l="1"+l),n+=t(parseInt(l,2))}return n};u.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(i){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueOidString=function(i){if(!i.match(/^[0-9.]+$/))throw"malformed oid string: "+i;var n="",s=i.split("."),o=parseInt(s[0])*40+parseInt(s[1]);n+=t(o),s.splice(0,2);for(var a=0;a<s.length;a++)n+=e(s[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(i){var n=u.asn1.x509.OID.name2oid(i);if(n!=="")this.setValueOidString(n);else throw"DERObjectIdentifier oidName undefined: "+i},this.getFreshValueHex=function(){return this.hV},r!==void 0&&(typeof r=="string"?r.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(r):this.setValueName(r):r.oid!==void 0?this.setValueOidString(r.oid):r.hex!==void 0?this.setValueHex(r.hex):r.name!==void 0&&this.setValueName(r.name))};D(u.asn1.DERObjectIdentifier,u.asn1.ASN1Object);u.asn1.DEREnumerated=function(r){u.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=u.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new g(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof r<"u"&&(typeof r.int<"u"?this.setByInteger(r.int):typeof r=="number"?this.setByInteger(r):typeof r.hex<"u"&&this.setValueHex(r.hex))};D(u.asn1.DEREnumerated,u.asn1.ASN1Object);u.asn1.DERUTF8String=function(r){u.asn1.DERUTF8String.superclass.constructor.call(this,r),this.hT="0c"};D(u.asn1.DERUTF8String,u.asn1.DERAbstractString);u.asn1.DERNumericString=function(r){u.asn1.DERNumericString.superclass.constructor.call(this,r),this.hT="12"};D(u.asn1.DERNumericString,u.asn1.DERAbstractString);u.asn1.DERPrintableString=function(r){u.asn1.DERPrintableString.superclass.constructor.call(this,r),this.hT="13"};D(u.asn1.DERPrintableString,u.asn1.DERAbstractString);u.asn1.DERTeletexString=function(r){u.asn1.DERTeletexString.superclass.constructor.call(this,r),this.hT="14"};D(u.asn1.DERTeletexString,u.asn1.DERAbstractString);u.asn1.DERIA5String=function(r){u.asn1.DERIA5String.superclass.constructor.call(this,r),this.hT="16"};D(u.asn1.DERIA5String,u.asn1.DERAbstractString);u.asn1.DERUTCTime=function(r){u.asn1.DERUTCTime.superclass.constructor.call(this,r),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return typeof this.date>"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},r!==void 0&&(r.str!==void 0?this.setString(r.str):typeof r=="string"&&r.match(/^[0-9]{12}Z$/)?this.setString(r):r.hex!==void 0?this.setStringHex(r.hex):r.date!==void 0&&this.setByDate(r.date))};D(u.asn1.DERUTCTime,u.asn1.DERAbstractTime);u.asn1.DERGeneralizedTime=function(r){u.asn1.DERGeneralizedTime.superclass.constructor.call(this,r),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},r!==void 0&&(r.str!==void 0?this.setString(r.str):typeof r=="string"&&r.match(/^[0-9]{14}Z$/)?this.setString(r):r.hex!==void 0?this.setStringHex(r.hex):r.date!==void 0&&this.setByDate(r.date),r.millis===!0&&(this.withMillis=!0))};D(u.asn1.DERGeneralizedTime,u.asn1.DERAbstractTime);u.asn1.DERSequence=function(r){u.asn1.DERSequence.superclass.constructor.call(this,r),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t+=i.getEncodedHex()}return this.hV=t,this.hV}};D(u.asn1.DERSequence,u.asn1.DERAbstractStructured);u.asn1.DERSet=function(r){u.asn1.DERSet.superclass.constructor.call(this,r),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof r<"u"&&typeof r.sortflag<"u"&&r.sortflag==!1&&(this.sortFlag=!1)};D(u.asn1.DERSet,u.asn1.DERAbstractStructured);u.asn1.DERTaggedObject=function(r){u.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},typeof r<"u"&&(typeof r.tag<"u"&&(this.hT=r.tag),typeof r.explicit<"u"&&(this.isExplicit=r.explicit),typeof r.obj<"u"&&(this.asn1Object=r.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))};D(u.asn1.DERTaggedObject,u.asn1.ASN1Object);var Ee=(function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),_t=(function(r){Ee(t,r);function t(e){var i=r.call(this)||this;return e&&(typeof e=="string"?i.parseKey(e):(t.hasPrivateKeyProperty(e)||t.hasPublicKeyProperty(e))&&i.parsePropertiesFrom(e)),i}return t.prototype.parseKey=function(e){try{var i=0,n=0,s=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,o=s.test(e)?Gt.decode(e):St.unarmor(e),a=Yt.decode(o);if(a.sub.length===3&&(a=a.sub[2].sub[0]),a.sub.length===9){i=a.sub[1].getHexStringValue(),this.n=w(i,16),n=a.sub[2].getHexStringValue(),this.e=parseInt(n,16);var h=a.sub[3].getHexStringValue();this.d=w(h,16);var f=a.sub[4].getHexStringValue();this.p=w(f,16);var l=a.sub[5].getHexStringValue();this.q=w(l,16);var c=a.sub[6].getHexStringValue();this.dmp1=w(c,16);var v=a.sub[7].getHexStringValue();this.dmq1=w(v,16);var p=a.sub[8].getHexStringValue();this.coeff=w(p,16)}else if(a.sub.length===2)if(a.sub[0].sub){var T=a.sub[1],b=T.sub[0];i=b.sub[0].getHexStringValue(),this.n=w(i,16),n=b.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else i=a.sub[0].getHexStringValue(),this.n=w(i,16),n=a.sub[1].getHexStringValue(),this.e=parseInt(n,16);else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new u.asn1.DERInteger({int:0}),new u.asn1.DERInteger({bigint:this.n}),new u.asn1.DERInteger({int:this.e}),new u.asn1.DERInteger({bigint:this.d}),new u.asn1.DERInteger({bigint:this.p}),new u.asn1.DERInteger({bigint:this.q}),new u.asn1.DERInteger({bigint:this.dmp1}),new u.asn1.DERInteger({bigint:this.dmq1}),new u.asn1.DERInteger({bigint:this.coeff})]},i=new u.asn1.DERSequence(e);return i.getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return et(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new u.asn1.DERSequence({array:[new u.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new u.asn1.DERNull]}),i=new u.asn1.DERSequence({array:[new u.asn1.DERInteger({bigint:this.n}),new u.asn1.DERInteger({int:this.e})]}),n=new u.asn1.DERBitString({hex:"00"+i.getEncodedHex()}),s=new u.asn1.DERSequence({array:[e,n]});return s.getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return et(this.getPublicBaseKey())},t.wordwrap=function(e,i){if(i=i||64,!e)return e;var n="(.{1,"+i+`})( +|$
|
|
9
|
-
?)|(.{1,`+i+"})";return
|
|
10
|
-
`)},
|
|
11
|
-
`;return e
|
|
12
|
-
`,
|
|
13
|
-
`;return e
|
|
14
|
-
`,e+="-----END PUBLIC KEY-----",e},t.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t})(Se),yt,De=typeof process<"u"?(yt=process.env)===null||yt===void 0?void 0:yt.npm_package_version:void 0,xe=(function(){function r(t){t===void 0&&(t={}),this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=t.key||null}return r.prototype.setKey=function(t){t?(this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new _t(t)):!this.key&&this.log&&console.error("A key was not set.")},r.prototype.setPrivateKey=function(t){this.setKey(t)},r.prototype.setPublicKey=function(t){this.setKey(t)},r.prototype.decrypt=function(t){try{return this.getKey().decrypt(xt(t))}catch{return!1}},r.prototype.encrypt=function(t){try{return et(this.getKey().encrypt(t))}catch{return!1}},r.prototype.encryptOAEP=function(t){try{return et(this.getKey().encrypt(t,me))}catch{return!1}},r.prototype.sign=function(t,e,i){e===void 0&&(e=function(n){return n}),i===void 0&&(i="");try{return et(this.getKey().sign(t,e,i))}catch{return!1}},r.prototype.signSha256=function(t){return this.sign(t,function(e){return Nt(Tt(e))},"sha256")},r.prototype.verify=function(t,e,i){i===void 0&&(i=function(n){return n});try{return this.getKey().verify(t,xt(e),i)}catch{return!1}},r.prototype.verifySha256=function(t,e){return this.verify(t,e,function(i){return Nt(Tt(i))})},r.prototype.getKey=function(t){if(!this.key){if(this.key=new _t,t&&{}.toString.call(t)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},r.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},r.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},r.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},r.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},r.version=De,r})();const Re={id:"playWnd",class:"playWnd"},Mt=3,Ct=3e3,mt="插件未启动,正在尝试启动,请稍候...",ft="插件启动失败,请检查插件是否安装!",it=Object.assign({name:"GPluginVideo"},{__name:"index",props:{isPlayVideo:{type:Boolean,default:!1},isFullScreen:{type:Boolean,default:!1},cameraIndexCode:{type:String,default:""},currentPlayType:{type:Number,default:0},baseUrl:{type:String,default:"http://92.97.137.81:48181"},usefullData:{type:Object,default:()=>({appkey:"24460774",secret:"vphyI4pTqEVk4lT67jVe",ip:"61.27.16.15",port:443})},size:{type:Object,default:()=>({windowWidth:300,windowHeight:200})},isMulTip:{type:Boolean,default:!1},multipPointsArr:{type:Array,default:()=>[]},happenedTime:{type:String,default:""}},emits:["closeVideoEmit"],setup(r,{expose:t,emit:e}){const i=r,n=e,s=E.ref(null),o=E.ref(0),a=E.ref(""),h=E.ref(""),f=E.ref("1x1"),l=E.ref(0),c=E.ref([]),v=E.ref(1),p=E.ref([]),T=E.ref(0);function b(){return new Promise((m,d)=>{if(window.WebControl){m();return}Promise.resolve().then(()=>require("../web-control.esm.min-DLrkEUOV.js")).then(B=>{window.WebControl=B.WebControl,console.log("web-control.esm.min.js加载成功"),m()}).catch(B=>{console.error("web-control.esm.min.js加载失败",B),d(new Error("加载web-control.esm.min.js失败"))})})}function R(m){const d=new Date(Number(m));return d.setMinutes(d.getMinutes()-1),d.getTime()}function q(m){const d=new Date(Number(m));return d.setMinutes(d.getMinutes()+1),d.getTime()}function I(m,d){const B=[];for(let W=0;W<m.length;W+=d)B.push(m.slice(W,W+d));return B}function F(m){const d=new xe;return d.setPublicKey(a.value),d.encrypt(m)}function N(){n("closeVideoEmit"),s.value!==null&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_Disconnect().then(()=>{},()=>{}))}function rt(){s.value&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_RequestInterface({funcName:"destroyWnd"}))}function y(m){s.value.JS_RequestInterface({funcName:"getRSAPubKey",argument:JSON.stringify({keyLength:1024})}).then(d=>{d.responseMsg.data&&(a.value=d.responseMsg.data,m())})}function k(){let m=i.cameraIndexCode.trim();s.value.JS_RequestInterface({funcName:"startPreview",argument:JSON.stringify({cameraIndexCode:m,streamMode:0,transMode:1,gpuMode:0,wndId:-1})})}function L(){let m=i.cameraIndexCode,d="",B="";i.happenedTime?(d=R(i.happenedTime),B=q(i.happenedTime)):(d=Date.now()-1440*60*1e3,B=Date.now()),s.value.JS_RequestInterface({funcName:"startPlayback",argument:JSON.stringify({cameraIndexCode:m,startTimeStamp:Math.floor(d/1e3).toString(),endTimeStamp:Math.floor(B/1e3).toString(),recordLocation:1,transMode:1,gpuMode:0,wndId:-1})})}function M(){const m=p.value.map((d,B)=>({cameraIndexCode:d.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:B+1}));s.value.JS_RequestInterface({funcName:"startMultiPreviewByCameraIndexCode",argument:JSON.stringify({list:m})})}function J(){let m="",d="";i.happenedTime?(m=R(i.happenedTime),d=q(i.happenedTime)):(m=Date.now()-1440*60*1e3,d=Date.now());const B=p.value.map((W,Kt)=>({startTimeStamp:Math.floor(m/1e3).toString(),endTimeStamp:Math.floor(d/1e3).toString(),cameraIndexCode:W.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:Kt+1}));s.value.JS_RequestInterface({funcName:"startMultiPlaybackByCameraIndexCode",argument:JSON.stringify({list:B})})}function V(){y(()=>{s.value.JS_RequestInterface({funcName:"init",argument:JSON.stringify({appkey:i.usefullData.appkey,secret:F(i.usefullData.secret),ip:i.usefullData.ip,playMode:i.currentPlayType,port:i.usefullData.port,snapDir:"D:\\SnapDir",videoDir:"D:\\VideoDir",layout:f.value,enableHTTPS:1,encryptedFields:"secret",showToolbar:1,showSmart:0,buttonIDs:"0,256,257,258,259,260,512,513,514,515,516,517,768,769"})}).then(()=>{s.value.JS_Resize(i.size.windowWidth,i.size.windowHeight),i.isMulTip?i.currentPlayType===1?J():M():i.currentPlayType===1?L():k()}),i.isFullScreen&&s.value.JS_RequestInterface({funcName:"setFullScreen"})})}function dt(m){const{responseMsg:d}=m;d.type===6&&(l.value=i.multipPointsArr.length,v.value=1,c.value=i.multipPointsArr,f.value=d.msg.layout,T.value=d.msg.wndNum,c.value=I(c.value,d.msg.wndNum),p.value=[...c.value[v.value-1]],s.value.JS_Disconnect().then(()=>{P()},()=>{})),d.type===7&&N()}function P(){s.value=new window.WebControl({szPluginContainer:"playWnd",iServicePortStart:15900,iServicePortEnd:15900,szClassId:"23BF3B0A-2C56-4D97-9C03-0CB103AA8F11",cbConnectSuccess:()=>{s.value.JS_StartService("window",{dllPath:"./VideoPluginConnect.dll"}).then(()=>{s.value.JS_SetWindowControlCallback({cbIntegrationCallBack:dt}),s.value.JS_CreateWnd("playWnd",i.size.windowWidth,i.size.windowHeight).then(()=>{V()})})},cbConnectError:()=>{s.value=null,Q.ElMessage.error(mt),h.value=mt,window.WebControl.JS_WakeUp("VideoWebPlugin://"),o.value++,o.value<Mt?setTimeout(()=>P(),Ct):(Q.ElMessage.error(ft),h.value=ft)},cbConnectClose:m=>{m||(s.value=null,h.value=mt,o.value++,o.value<Mt?setTimeout(()=>P(),Ct):(Q.ElMessage.error(ft),h.value=ft))}})}function wt(){Q.ElMessageBox.alert("播放视频需要下载插件","提示",{confirmButtonText:"下载插件",cancelButtonText:"取消",type:"info",showCancelButton:!0}).then(()=>{Lt(),Q.ElMessage({type:"success",message:"下载插件成功"})}).catch(()=>{N()})}function Lt(){try{const m=i.baseUrl+"static/VideoWebPlugin.exe",d=document.createElement("a");d.href=m,d.download="VideoWebPlugin.exe",d.style.display="none",document.body.appendChild(d),d.click(),setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d),N()},100)}catch{N()}}function jt(){i.isMulTip&&(T.value=4,l.value=i.multipPointsArr.length,f.value=l.value<=1?"1x1":"2x2",c.value=I(i.multipPointsArr,4),p.value=[...c.value[v.value-1]])}return E.watch(()=>i.isPlayVideo,m=>{m===!1&&N()}),E.watch(()=>i.happenedTime,()=>{J()}),E.watch(()=>i.cameraIndexCode,(m,d)=>{m!==d&&(rt(),s.value.JS_Disconnect().then(()=>{P()},()=>{}))}),E.watch(h,m=>{m!==""&&wt()}),E.onMounted(()=>{jt(),b().then(()=>{i.isPlayVideo&&P()}).catch(()=>{wt()})}),E.onBeforeUnmount(()=>{s.value&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_RequestInterface({funcName:"destroyWnd"}))}),t({closeVideo:N,initPlugin:P,startPlay:k,startPlayback:L,startMultiPreview:M,startMultiPlayback:J}),(m,d)=>E.withDirectives((E.openBlock(),E.createElementBlock("div",Re,null,512)),[[E.vShow,!r.isFullScreen]])}});it.install=r=>{r.component(it.name,it)};exports.GPluginVideo=it;exports.default=it;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("vue"),Tt=require("element-plus");var Ln="0123456789abcdefghijklmnopqrstuvwxyz";function X(t){return Ln.charAt(t)}function Jn(t,e){return t&e}function zt(t,e){return t|e}function Pe(t,e){return t^e}function xe(t,e){return t&~e}function Hn(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}function jn(t){for(var e=0;t!=0;)t&=t-1,++e;return e}var yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cn="=";function xt(t){var e,n,i="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),i+=yt.charAt(n>>6)+yt.charAt(n&63);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),i+=yt.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),i+=yt.charAt(n>>2)+yt.charAt((n&3)<<4));(i.length&3)>0;)i+=cn;return i}function ke(t){var e="",n,i=0,r=0;for(n=0;n<t.length&&t.charAt(n)!=cn;++n){var s=yt.indexOf(t.charAt(n));s<0||(i==0?(e+=X(s>>2),r=s&3,i=1):i==1?(e+=X(r<<2|s>>4),r=s&15,i=2):i==2?(e+=X(r),e+=X(s>>2),r=s&3,i=3):(e+=X(r<<2|s>>4),e+=X(s&15),i=0))}return i==1&&(e+=X(r<<2)),e}var mt,Zn={decode:function(t){var e;if(mt===void 0){var n="0123456789ABCDEF",i=` \f
|
|
2
|
+
\r \u2028\u2029`;for(mt={},e=0;e<16;++e)mt[n.charAt(e)]=e;for(n=n.toLowerCase(),e=10;e<16;++e)mt[n.charAt(e)]=e;for(e=0;e<i.length;++e)mt[i.charAt(e)]=-1}var r=[],s=0,a=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if(o=="=")break;if(o=mt[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+e);s|=o,++a>=2?(r[r.length]=s,s=0,a=0):s<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return r}},dt,ye={decode:function(t){var e;if(dt===void 0){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=`= \f
|
|
3
|
+
\r \u2028\u2029`;for(dt=Object.create(null),e=0;e<64;++e)dt[n.charAt(e)]=e;for(dt["-"]=62,dt._=63,e=0;e<i.length;++e)dt[i.charAt(e)]=-1}var r=[],s=0,a=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if(o=="=")break;if(o=dt[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+e);s|=o,++a>=4?(r[r.length]=s>>16,r[r.length]=s>>8&255,r[r.length]=s&255,s=0,a=0):s<<=6}}switch(a){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=s>>10;break;case 3:r[r.length]=s>>16,r[r.length]=s>>8&255;break}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=ye.re.exec(t);if(e)if(e[1])t=e[1];else if(e[2])t=e[2];else throw new Error("RegExp out of sync");return ye.decode(t)}},bt=1e13,qt=(function(){function t(e){this.buf=[+e||0]}return t.prototype.mulAdd=function(e,n){var i=this.buf,r=i.length,s,a;for(s=0;s<r;++s)a=i[s]*e+n,a<bt?n=0:(n=0|a/bt,a-=n*bt),i[s]=a;n>0&&(i[s]=n)},t.prototype.sub=function(e){var n=this.buf,i=n.length,r,s;for(r=0;r<i;++r)s=n[r]-e,s<0?(s+=bt,e=1):e=0,n[r]=s;for(;n[n.length-1]===0;)n.pop()},t.prototype.toString=function(e){if((e||10)!=10)throw new Error("only base 10 is supported");for(var n=this.buf,i=n[n.length-1].toString(),r=n.length-2;r>=0;--r)i+=(bt+n[r]).toString().substring(1);return i},t.prototype.valueOf=function(){for(var e=this.buf,n=0,i=e.length-1;i>=0;--i)n=n*bt+e[i];return n},t.prototype.simplify=function(){var e=this.buf;return e.length==1?e[0]:this},t})(),dn="…",$n=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Kn=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function St(t,e){return t.length>e&&(t=t.substring(0,e)+dn),t}var re=(function(){function t(e,n){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}return t.prototype.get=function(e){if(e===void 0&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(e):this.enc[e]},t.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(e&15)},t.prototype.hexDump=function(e,n,i){for(var r="",s=e;s<n;++s)if(r+=this.hexByte(this.get(s)),i!==!0)switch(s&15){case 7:r+=" ";break;case 15:r+=`
|
|
4
|
+
`;break;default:r+=" "}return r},t.prototype.isASCII=function(e,n){for(var i=e;i<n;++i){var r=this.get(i);if(r<32||r>176)return!1}return!0},t.prototype.parseStringISO=function(e,n){for(var i="",r=e;r<n;++r)i+=String.fromCharCode(this.get(r));return i},t.prototype.parseStringUTF=function(e,n){for(var i="",r=e;r<n;){var s=this.get(r++);s<128?i+=String.fromCharCode(s):s>191&&s<224?i+=String.fromCharCode((s&31)<<6|this.get(r++)&63):i+=String.fromCharCode((s&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return i},t.prototype.parseStringBMP=function(e,n){for(var i="",r,s,a=e;a<n;)r=this.get(a++),s=this.get(a++),i+=String.fromCharCode(r<<8|s);return i},t.prototype.parseTime=function(e,n,i){var r=this.parseStringISO(e,n),s=(i?$n:Kn).exec(r);return s?(i&&(s[1]=+s[1],s[1]+=+s[1]<70?2e3:1900),r=s[1]+"-"+s[2]+"-"+s[3]+" "+s[4],s[5]&&(r+=":"+s[5],s[6]&&(r+=":"+s[6],s[7]&&(r+="."+s[7]))),s[8]&&(r+=" UTC",s[8]!="Z"&&(r+=s[8],s[9]&&(r+=":"+s[9]))),r):"Unrecognized time: "+r},t.prototype.parseInteger=function(e,n){for(var i=this.get(e),r=i>127,s=r?255:0,a,o="";i==s&&++e<n;)i=this.get(e);if(a=n-e,a===0)return r?-1:0;if(a>4){for(o=i,a<<=3;((+o^s)&128)==0;)o=+o<<1,--a;o="("+a+` bit)
|
|
5
|
+
`}r&&(i=i-256);for(var l=new qt(i),u=e+1;u<n;++u)l.mulAdd(256,this.get(u));return o+l.toString()},t.prototype.parseBitString=function(e,n,i){for(var r=this.get(e),s=(n-e-1<<3)-r,a="("+s+` bit)
|
|
6
|
+
`,o="",l=e+1;l<n;++l){for(var u=this.get(l),h=l==n-1?r:0,d=7;d>=h;--d)o+=u>>d&1?"1":"0";if(o.length>i)return a+St(o,i)}return a+o},t.prototype.parseOctetString=function(e,n,i){if(this.isASCII(e,n))return St(this.parseStringISO(e,n),i);var r=n-e,s="("+r+` byte)
|
|
7
|
+
`;i/=2,r>i&&(n=e+i);for(var a=e;a<n;++a)s+=this.hexByte(this.get(a));return r>i&&(s+=dn),s},t.prototype.parseOID=function(e,n,i){for(var r="",s=new qt,a=0,o=e;o<n;++o){var l=this.get(o);if(s.mulAdd(128,l&127),a+=7,!(l&128)){if(r==="")if(s=s.simplify(),s instanceof qt)s.sub(80),r="2."+s.toString();else{var u=s<80?s<40?0:1:2;r=u+"."+(s-u*40)}else r+="."+s.toString();if(r.length>i)return St(r,i);s=new qt,a=0}}return a>0&&(r+=".incomplete"),r},t})(),Gn=(function(){function t(e,n,i,r,s){if(!(r instanceof Ae))throw new Error("Invalid tag value.");this.stream=e,this.header=n,this.length=i,this.tag=r,this.sub=s}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(e){if(this.tag===void 0)return null;e===void 0&&(e=1/0);var n=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+i,e);switch(this.tag.tagNumber){case 1:return this.stream.get(n)===0?"false":"true";case 2:return this.stream.parseInteger(n,n+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(n,n+i,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+i,e);case 6:return this.stream.parseOID(n,n+i,e);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return St(this.stream.parseStringUTF(n,n+i),e);case 18:case 19:case 20:case 21:case 22:case 26:return St(this.stream.parseStringISO(n,n+i),e);case 30:return St(this.stream.parseStringBMP(n,n+i),e);case 23:case 24:return this.stream.parseTime(n,n+i,this.tag.tagNumber==23)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(e){e===void 0&&(e="");var n=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(n+="+"),n+=this.length,this.tag.tagConstructed?n+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(n+=" (encapsulates)"),n+=`
|
|
8
|
+
`,this.sub!==null){e+=" ";for(var i=0,r=this.sub.length;i<r;++i)n+=this.sub[i].toPrettyString(e)}return n},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(e){var n=e.get(),i=n&127;if(i==n)return i;if(i>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(i===0)return null;n=0;for(var r=0;r<i;++r)n=n*256+e.get();return n},t.prototype.getHexStringValue=function(){var e=this.toHexString(),n=this.header*2,i=this.length*2;return e.substring(n,n+i)},t.decode=function(e){var n;e instanceof re?n=e:n=new re(e,0);var i=new re(n),r=new Ae(n),s=t.decodeLength(n),a=n.pos,o=a-i.pos,l=null,u=function(){var d=[];if(s!==null){for(var p=a+s;n.pos<p;)d[d.length]=t.decode(n);if(n.pos!=p)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var f=t.decode(n);if(f.tag.isEOC())break;d[d.length]=f}s=a-n.pos}catch(y){throw new Error("Exception while decoding undefined length content: "+y)}return d};if(r.tagConstructed)l=u();else if(r.isUniversal()&&(r.tagNumber==3||r.tagNumber==4))try{if(r.tagNumber==3&&n.get()!=0)throw new Error("BIT STRINGs with unused bits cannot encapsulate.");l=u();for(var h=0;h<l.length;++h)if(l[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch{l=null}if(l===null){if(s===null)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);n.pos=a+Math.abs(s)}return new t(i,o,s,r,l)},t})(),Ae=(function(){function t(e){var n=e.get();if(this.tagClass=n>>6,this.tagConstructed=(n&32)!==0,this.tagNumber=n&31,this.tagNumber==31){var i=new qt;do n=e.get(),i.mulAdd(128,n&127);while(n&128);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return this.tagClass===0},t.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},t})(),lt,Yn=0xdeadbeefcafe,Oe=(Yn&16777215)==15715070,U=[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],Xn=(1<<26)/U[U.length-1],S=(function(){function t(e,n,i){e!=null&&(typeof e=="number"?this.fromNumber(e,n,i):n==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,n))}return t.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var n;if(e==16)n=4;else if(e==8)n=3;else if(e==2)n=1;else if(e==32)n=5;else if(e==4)n=2;else return this.toRadix(e);var i=(1<<n)-1,r,s=!1,a="",o=this.t,l=this.DB-o*this.DB%n;if(o-- >0)for(l<this.DB&&(r=this[o]>>l)>0&&(s=!0,a=X(r));o>=0;)l<n?(r=(this[o]&(1<<l)-1)<<n-l,r|=this[--o]>>(l+=this.DB-n)):(r=this[o]>>(l-=n)&i,l<=0&&(l+=this.DB,--o)),r>0&&(s=!0),s&&(a+=X(r));return s?a:"0"},t.prototype.negate=function(){var e=_();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(e){var n=this.s-e.s;if(n!=0)return n;var i=this.t;if(n=i-e.t,n!=0)return this.s<0?-n:n;for(;--i>=0;)if((n=this[i]-e[i])!=0)return n;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Ft(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var n=_();return this.abs().divRemTo(e,null,n),this.s<0&&n.compareTo(t.ZERO)>0&&e.subTo(n,n),n},t.prototype.modPowInt=function(e,n){var i;return e<256||n.isEven()?i=new Be(n):i=new Ue(n),this.exp(e,i)},t.prototype.clone=function(){var e=_();return this.copyTo(e),e},t.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var e=this.t,n=[];n[0]=this.s;var i=this.DB-e*this.DB%8,r,s=0;if(e-- >0)for(i<this.DB&&(r=this[e]>>i)!=(this.s&this.DM)>>i&&(n[s++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this[e]&(1<<i)-1)<<8-i,r|=this[--e]>>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),(r&128)!=0&&(r|=-256),s==0&&(this.s&128)!=(r&128)&&++s,(s>0||r!=this.s)&&(n[s++]=r);return n},t.prototype.equals=function(e){return this.compareTo(e)==0},t.prototype.min=function(e){return this.compareTo(e)<0?this:e},t.prototype.max=function(e){return this.compareTo(e)>0?this:e},t.prototype.and=function(e){var n=_();return this.bitwiseTo(e,Jn,n),n},t.prototype.or=function(e){var n=_();return this.bitwiseTo(e,zt,n),n},t.prototype.xor=function(e){var n=_();return this.bitwiseTo(e,Pe,n),n},t.prototype.andNot=function(e){var n=_();return this.bitwiseTo(e,xe,n),n},t.prototype.not=function(){for(var e=_(),n=0;n<this.t;++n)e[n]=this.DM&~this[n];return e.t=this.t,e.s=~this.s,e},t.prototype.shiftLeft=function(e){var n=_();return e<0?this.rShiftTo(-e,n):this.lShiftTo(e,n),n},t.prototype.shiftRight=function(e){var n=_();return e<0?this.lShiftTo(-e,n):this.rShiftTo(e,n),n},t.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+Hn(this[e]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var e=0,n=this.s&this.DM,i=0;i<this.t;++i)e+=jn(this[i]^n);return e},t.prototype.testBit=function(e){var n=Math.floor(e/this.DB);return n>=this.t?this.s!=0:(this[n]&1<<e%this.DB)!=0},t.prototype.setBit=function(e){return this.changeBit(e,zt)},t.prototype.clearBit=function(e){return this.changeBit(e,xe)},t.prototype.flipBit=function(e){return this.changeBit(e,Pe)},t.prototype.add=function(e){var n=_();return this.addTo(e,n),n},t.prototype.subtract=function(e){var n=_();return this.subTo(e,n),n},t.prototype.multiply=function(e){var n=_();return this.multiplyTo(e,n),n},t.prototype.divide=function(e){var n=_();return this.divRemTo(e,n,null),n},t.prototype.remainder=function(e){var n=_();return this.divRemTo(e,null,n),n},t.prototype.divideAndRemainder=function(e){var n=_(),i=_();return this.divRemTo(e,n,i),[n,i]},t.prototype.modPow=function(e,n){var i=e.bitLength(),r,s=nt(1),a;if(i<=0)return s;i<18?r=1:i<48?r=3:i<144?r=4:i<768?r=5:r=6,i<8?a=new Be(n):n.isEven()?a=new ti(n):a=new Ue(n);var o=[],l=3,u=r-1,h=(1<<r)-1;if(o[1]=a.convert(this),r>1){var d=_();for(a.sqrTo(o[1],d);l<=h;)o[l]=_(),a.mulTo(d,o[l-2],o[l]),l+=2}var p=e.t-1,f,y=!0,b=_(),R;for(i=Ft(e[p])-1;p>=0;){for(i>=u?f=e[p]>>i-u&h:(f=(e[p]&(1<<i+1)-1)<<u-i,p>0&&(f|=e[p-1]>>this.DB+i-u)),l=r;(f&1)==0;)f>>=1,--l;if((i-=l)<0&&(i+=this.DB,--p),y)o[f].copyTo(s),y=!1;else{for(;l>1;)a.sqrTo(s,b),a.sqrTo(b,s),l-=2;l>0?a.sqrTo(s,b):(R=s,s=b,b=R),a.mulTo(b,o[f],s)}for(;p>=0&&(e[p]&1<<i)==0;)a.sqrTo(s,b),R=s,s=b,b=R,--i<0&&(i=this.DB-1,--p)}return a.revert(s)},t.prototype.modInverse=function(e){var n=e.isEven();if(this.isEven()&&n||e.signum()==0)return t.ZERO;for(var i=e.clone(),r=this.clone(),s=nt(1),a=nt(0),o=nt(0),l=nt(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),n?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),n?((!o.isEven()||!l.isEven())&&(o.addTo(this,o),l.subTo(e,l)),o.rShiftTo(1,o)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);i.compareTo(r)>=0?(i.subTo(r,i),n&&s.subTo(o,s),a.subTo(l,a)):(r.subTo(i,r),n&&o.subTo(s,o),l.subTo(a,l))}if(r.compareTo(t.ONE)!=0)return t.ZERO;if(l.compareTo(e)>=0)return l.subtract(e);if(l.signum()<0)l.addTo(e,l);else return l;return l.signum()<0?l.add(e):l},t.prototype.pow=function(e){return this.exp(e,new Qn)},t.prototype.gcd=function(e){var n=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(n.compareTo(i)<0){var r=n;n=i,i=r}var s=n.getLowestSetBit(),a=i.getLowestSetBit();if(a<0)return n;for(s<a&&(a=s),a>0&&(n.rShiftTo(a,n),i.rShiftTo(a,i));n.signum()>0;)(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),n.compareTo(i)>=0?(n.subTo(i,n),n.rShiftTo(1,n)):(i.subTo(n,i),i.rShiftTo(1,i));return a>0&&i.lShiftTo(a,i),i},t.prototype.isProbablePrime=function(e){var n,i=this.abs();if(i.t==1&&i[0]<=U[U.length-1]){for(n=0;n<U.length;++n)if(i[0]==U[n])return!0;return!1}if(i.isEven())return!1;for(n=1;n<U.length;){for(var r=U[n],s=n+1;s<U.length&&r<Xn;)r*=U[s++];for(r=i.modInt(r);n<s;)if(r%U[n++]==0)return!1}return i.millerRabin(e)},t.prototype.copyTo=function(e){for(var n=this.t-1;n>=0;--n)e[n]=this[n];e.t=this.t,e.s=this.s},t.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},t.prototype.fromString=function(e,n){var i;if(n==16)i=4;else if(n==8)i=3;else if(n==256)i=8;else if(n==2)i=1;else if(n==32)i=5;else if(n==4)i=2;else{this.fromRadix(e,n);return}this.t=0,this.s=0;for(var r=e.length,s=!1,a=0;--r>=0;){var o=i==8?+e[r]&255:ze(e,r);if(o<0){e.charAt(r)=="-"&&(s=!0);continue}s=!1,a==0?this[this.t++]=o:a+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=i,a>=this.DB&&(a-=this.DB)}i==8&&(+e[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),s&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},t.prototype.dlShiftTo=function(e,n){var i;for(i=this.t-1;i>=0;--i)n[i+e]=this[i];for(i=e-1;i>=0;--i)n[i]=0;n.t=this.t+e,n.s=this.s},t.prototype.drShiftTo=function(e,n){for(var i=e;i<this.t;++i)n[i-e]=this[i];n.t=Math.max(this.t-e,0),n.s=this.s},t.prototype.lShiftTo=function(e,n){for(var i=e%this.DB,r=this.DB-i,s=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<i&this.DM,l=this.t-1;l>=0;--l)n[l+a+1]=this[l]>>r|o,o=(this[l]&s)<<i;for(var l=a-1;l>=0;--l)n[l]=0;n[a]=o,n.t=this.t+a+1,n.s=this.s,n.clamp()},t.prototype.rShiftTo=function(e,n){n.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t){n.t=0;return}var r=e%this.DB,s=this.DB-r,a=(1<<r)-1;n[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)n[o-i-1]|=(this[o]&a)<<s,n[o-i]=this[o]>>r;r>0&&(n[this.t-i-1]|=(this.s&a)<<s),n.t=this.t-i,n.clamp()},t.prototype.subTo=function(e,n){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]-e[i],n[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],n[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],n[i++]=r&this.DM,r>>=this.DB;r-=e.s}n.s=r<0?-1:0,r<-1?n[i++]=this.DV+r:r>0&&(n[i++]=r),n.t=i,n.clamp()},t.prototype.multiplyTo=function(e,n){var i=this.abs(),r=e.abs(),s=i.t;for(n.t=s+r.t;--s>=0;)n[s]=0;for(s=0;s<r.t;++s)n[s+i.t]=i.am(0,r[s],n,s,0,i.t);n.s=0,n.clamp(),this.s!=e.s&&t.ZERO.subTo(n,n)},t.prototype.squareTo=function(e){for(var n=this.abs(),i=e.t=2*n.t;--i>=0;)e[i]=0;for(i=0;i<n.t-1;++i){var r=n.am(i,n[i],e,2*i,0,1);(e[i+n.t]+=n.am(i+1,2*n[i],e,2*i+1,r,n.t-i-1))>=n.DV&&(e[i+n.t]-=n.DV,e[i+n.t+1]=1)}e.t>0&&(e[e.t-1]+=n.am(i,n[i],e,2*i,0,1)),e.s=0,e.clamp()},t.prototype.divRemTo=function(e,n,i){var r=e.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t){n?.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=_());var a=_(),o=this.s,l=e.s,u=this.DB-Ft(r[r.t-1]);u>0?(r.lShiftTo(u,a),s.lShiftTo(u,i)):(r.copyTo(a),s.copyTo(i));var h=a.t,d=a[h-1];if(d!=0){var p=d*(1<<this.F1)+(h>1?a[h-2]>>this.F2:0),f=this.FV/p,y=(1<<this.F1)/p,b=1<<this.F2,R=i.t,P=R-h,T=n??_();for(a.dlShiftTo(P,T),i.compareTo(T)>=0&&(i[i.t++]=1,i.subTo(T,i)),t.ONE.dlShiftTo(h,T),T.subTo(a,a);a.t<h;)a[a.t++]=0;for(;--P>=0;){var M=i[--R]==d?this.DM:Math.floor(i[R]*f+(i[R-1]+b)*y);if((i[R]+=a.am(0,M,i,P,0,h))<M)for(a.dlShiftTo(P,T),i.subTo(T,i);i[R]<--M;)i.subTo(T,i)}n!=null&&(i.drShiftTo(h,n),o!=l&&t.ZERO.subTo(n,n)),i.t=h,i.clamp(),u>0&&i.rShiftTo(u,i),o<0&&t.ZERO.subTo(i,i)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var n=e&3;return n=n*(2-(e&15)*n)&15,n=n*(2-(e&255)*n)&255,n=n*(2-((e&65535)*n&65535))&65535,n=n*(2-e*n%this.DV)%this.DV,n>0?this.DV-n:-n},t.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},t.prototype.exp=function(e,n){if(e>4294967295||e<1)return t.ONE;var i=_(),r=_(),s=n.convert(this),a=Ft(e)-1;for(s.copyTo(i);--a>=0;)if(n.sqrTo(i,r),(e&1<<a)>0)n.mulTo(r,s,i);else{var o=i;i=r,r=o}return n.revert(i)},t.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},t.prototype.toRadix=function(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var n=this.chunkSize(e),i=Math.pow(e,n),r=nt(i),s=_(),a=_(),o="";for(this.divRemTo(r,s,a);s.signum()>0;)o=(i+a.intValue()).toString(e).substring(1)+o,s.divRemTo(r,s,a);return a.intValue().toString(e)+o},t.prototype.fromRadix=function(e,n){this.fromInt(0),n==null&&(n=10);for(var i=this.chunkSize(n),r=Math.pow(n,i),s=!1,a=0,o=0,l=0;l<e.length;++l){var u=ze(e,l);if(u<0){e.charAt(l)=="-"&&this.signum()==0&&(s=!0);continue}o=n*o+u,++a>=i&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(n,a)),this.dAddOffset(o,0)),s&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,n,i){if(typeof n=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),zt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var r=[],s=e&7;r.length=(e>>3)+1,n.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},t.prototype.bitwiseTo=function(e,n,i){var r,s,a=Math.min(e.t,this.t);for(r=0;r<a;++r)i[r]=n(this[r],e[r]);if(e.t<this.t){for(s=e.s&this.DM,r=a;r<this.t;++r)i[r]=n(this[r],s);i.t=this.t}else{for(s=this.s&this.DM,r=a;r<e.t;++r)i[r]=n(s,e[r]);i.t=e.t}i.s=n(this.s,e.s),i.clamp()},t.prototype.changeBit=function(e,n){var i=t.ONE.shiftLeft(e);return this.bitwiseTo(i,n,i),i},t.prototype.addTo=function(e,n){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]+e[i],n[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],n[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],n[i++]=r&this.DM,r>>=this.DB;r+=e.s}n.s=r<0?-1:0,r>0?n[i++]=r:r<-1&&(n[i++]=this.DV+r),n.t=i,n.clamp()},t.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(e,n){if(e!=0){for(;this.t<=n;)this[this.t++]=0;for(this[n]+=e;this[n]>=this.DV;)this[n]-=this.DV,++n>=this.t&&(this[this.t++]=0),++this[n]}},t.prototype.multiplyLowerTo=function(e,n,i){var r=Math.min(this.t+e.t,n);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(var s=i.t-this.t;r<s;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(var s=Math.min(e.t,n);r<s;++r)this.am(0,e[r],i,r,0,n-r);i.clamp()},t.prototype.multiplyUpperTo=function(e,n,i){--n;var r=i.t=this.t+e.t-n;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(n-this.t,0);r<e.t;++r)i[this.t+r-n]=this.am(n-r,e[r],i,0,0,this.t+r-n);i.clamp(),i.drShiftTo(1,i)},t.prototype.modInt=function(e){if(e<=0)return 0;var n=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(n==0)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(n*i+this[r])%e;return i},t.prototype.millerRabin=function(e){var n=this.subtract(t.ONE),i=n.getLowestSetBit();if(i<=0)return!1;var r=n.shiftRight(i);e=e+1>>1,e>U.length&&(e=U.length);for(var s=_(),a=0;a<e;++a){s.fromInt(U[Math.floor(Math.random()*U.length)]);var o=s.modPow(r,this);if(o.compareTo(t.ONE)!=0&&o.compareTo(n)!=0){for(var l=1;l++<i&&o.compareTo(n)!=0;)if(o=o.modPowInt(2,this),o.compareTo(t.ONE)==0)return!1;if(o.compareTo(n)!=0)return!1}}return!0},t.prototype.square=function(){var e=_();return this.squareTo(e),e},t.prototype.gcda=function(e,n){var i=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(i.compareTo(r)<0){var s=i;i=r,r=s}var a=i.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){n(i);return}a<o&&(o=a),o>0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var l=function(){(a=i.getLowestSetBit())>0&&i.rShiftTo(a,i),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(l,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){n(r)},0))};setTimeout(l,10)},t.prototype.fromNumberAsync=function(e,n,i,r){if(typeof n=="number")if(e<2)this.fromInt(1);else{this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),zt,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>e&&s.subTo(t.ONE.shiftLeft(e-1),s),s.isProbablePrime(n)?setTimeout(function(){r()},0):setTimeout(a,0)};setTimeout(a,0)}else{var o=[],l=e&7;o.length=(e>>3)+1,n.nextBytes(o),l>0?o[0]&=(1<<l)-1:o[0]=0,this.fromString(o,256)}},t})(),Qn=(function(){function t(){}return t.prototype.convert=function(e){return e},t.prototype.revert=function(e){return e},t.prototype.mulTo=function(e,n,i){e.multiplyTo(n,i)},t.prototype.sqrTo=function(e,n){e.squareTo(n)},t})(),Be=(function(){function t(e){this.m=e}return t.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},t.prototype.revert=function(e){return e},t.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},t.prototype.mulTo=function(e,n,i){e.multiplyTo(n,i),this.reduce(i)},t.prototype.sqrTo=function(e,n){e.squareTo(n),this.reduce(n)},t})(),Ue=(function(){function t(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return t.prototype.convert=function(e){var n=_();return e.abs().dlShiftTo(this.m.t,n),n.divRemTo(this.m,null,n),e.s<0&&n.compareTo(S.ZERO)>0&&this.m.subTo(n,n),n},t.prototype.revert=function(e){var n=_();return e.copyTo(n),this.reduce(n),n},t.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var n=0;n<this.m.t;++n){var i=e[n]&32767,r=i*this.mpl+((i*this.mph+(e[n]>>15)*this.mpl&this.um)<<15)&e.DM;for(i=n+this.m.t,e[i]+=this.m.am(0,r,e,n,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},t.prototype.mulTo=function(e,n,i){e.multiplyTo(n,i),this.reduce(i)},t.prototype.sqrTo=function(e,n){e.squareTo(n),this.reduce(n)},t})(),ti=(function(){function t(e){this.m=e,this.r2=_(),this.q3=_(),S.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return t.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var n=_();return e.copyTo(n),this.reduce(n),n},t.prototype.revert=function(e){return e},t.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},t.prototype.mulTo=function(e,n,i){e.multiplyTo(n,i),this.reduce(i)},t.prototype.sqrTo=function(e,n){e.squareTo(n),this.reduce(n)},t})();function _(){return new S(null)}function I(t,e){return new S(t,e)}var Me=typeof navigator<"u";Me&&Oe&&navigator.appName=="Microsoft Internet Explorer"?(S.prototype.am=function(e,n,i,r,s,a){for(var o=n&32767,l=n>>15;--a>=0;){var u=this[e]&32767,h=this[e++]>>15,d=l*u+h*o;u=o*u+((d&32767)<<15)+i[r]+(s&1073741823),s=(u>>>30)+(d>>>15)+l*h+(s>>>30),i[r++]=u&1073741823}return s},lt=30):Me&&Oe&&navigator.appName!="Netscape"?(S.prototype.am=function(e,n,i,r,s,a){for(;--a>=0;){var o=n*this[e++]+i[r]+s;s=Math.floor(o/67108864),i[r++]=o&67108863}return s},lt=26):(S.prototype.am=function(e,n,i,r,s,a){for(var o=n&16383,l=n>>14;--a>=0;){var u=this[e]&16383,h=this[e++]>>14,d=l*u+h*o;u=o*u+((d&16383)<<14)+i[r]+s,s=(u>>28)+(d>>14)+l*h,i[r++]=u&268435455}return s},lt=28);S.prototype.DB=lt;S.prototype.DM=(1<<lt)-1;S.prototype.DV=1<<lt;var Te=52;S.prototype.FV=Math.pow(2,Te);S.prototype.F1=Te-lt;S.prototype.F2=2*lt-Te;var ne=[],_t,J;_t=48;for(J=0;J<=9;++J)ne[_t++]=J;_t=97;for(J=10;J<36;++J)ne[_t++]=J;_t=65;for(J=10;J<36;++J)ne[_t++]=J;function ze(t,e){var n=ne[t.charCodeAt(e)];return n??-1}function nt(t){var e=_();return e.fromInt(t),e}function Ft(t){var e=1,n;return(n=t>>>16)!=0&&(t=n,e+=16),(n=t>>8)!=0&&(t=n,e+=8),(n=t>>4)!=0&&(t=n,e+=4),(n=t>>2)!=0&&(t=n,e+=2),(n=t>>1)!=0&&(t=n,e+=1),e}S.ZERO=nt(0);S.ONE=nt(1);var ei=(function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(e){var n,i,r;for(n=0;n<256;++n)this.S[n]=n;for(i=0,n=0;n<256;++n)i=i+this.S[n]+e[n%e.length]&255,r=this.S[n],this.S[n]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},t})();function ni(){return new ei}var fn=256,Wt,ot=null,Z;if(ot==null){ot=[],Z=0;var Nt=void 0;if(typeof window<"u"&&self.crypto&&self.crypto.getRandomValues){var se=new Uint32Array(256);for(self.crypto.getRandomValues(se),Nt=0;Nt<se.length;++Nt)ot[Z++]=se[Nt]&255}var Vt=0,Lt=function(t){if(Vt=Vt||0,Vt>=256||Z>=fn){self.removeEventListener?self.removeEventListener("mousemove",Lt,!1):self.detachEvent&&self.detachEvent("onmousemove",Lt);return}try{var e=t.x+t.y;ot[Z++]=e&255,Vt+=1}catch{}};typeof window<"u"&&(self.addEventListener?self.addEventListener("mousemove",Lt,!1):self.attachEvent&&self.attachEvent("onmousemove",Lt))}function ii(){if(Wt==null){for(Wt=ni();Z<fn;){var t=Math.floor(65536*Math.random());ot[Z++]=t&255}for(Wt.init(ot),Z=0;Z<ot.length;++Z)ot[Z]=0;Z=0}return Wt.next()}var Yt=(function(){function t(){}return t.prototype.nextBytes=function(e){for(var n=0;n<e.length;++n)e[n]=ii()},t})();function Se(t){return si(fi(ri(t),t.length*8))}function Fe(t){for(var e="0123456789abcdef",n="",i=0;i<t.length;i++){var r=t.charCodeAt(i);n+=e.charAt(r>>>4&15)+e.charAt(r&15)}return n}function ri(t){for(var e=Array(t.length>>2),n=0;n<e.length;n++)e[n]=0;for(var n=0;n<t.length*8;n+=8)e[n>>5]|=(t.charCodeAt(n/8)&255)<<24-n%32;return e}function si(t){for(var e="",n=0;n<t.length*32;n+=8)e+=String.fromCharCode(t[n>>5]>>>24-n%32&255);return e}function Y(t,e){return t>>>e|t<<32-e}function pn(t,e){return t>>>e}function oi(t,e,n){return t&e^~t&n}function ai(t,e,n){return t&e^t&n^e&n}function li(t){return Y(t,2)^Y(t,13)^Y(t,22)}function ui(t){return Y(t,6)^Y(t,11)^Y(t,25)}function hi(t){return Y(t,7)^Y(t,18)^pn(t,3)}function ci(t){return Y(t,17)^Y(t,19)^pn(t,10)}var di=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function fi(t,e){var n=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),i=new Array(64),r,s,a,o,l,u,h,d,p,f,y,b;for(t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e,p=0;p<t.length;p+=16){for(r=n[0],s=n[1],a=n[2],o=n[3],l=n[4],u=n[5],h=n[6],d=n[7],f=0;f<64;f++)f<16?i[f]=t[f+p]:i[f]=x(x(x(ci(i[f-2]),i[f-7]),hi(i[f-15])),i[f-16]),y=x(x(x(x(d,ui(l)),oi(l,u,h)),di[f]),i[f]),b=x(li(r),ai(r,s,a)),d=h,h=u,u=l,l=x(o,y),o=a,a=s,s=r,r=x(y,b);n[0]=x(r,n[0]),n[1]=x(s,n[1]),n[2]=x(a,n[2]),n[3]=x(o,n[3]),n[4]=x(l,n[4]),n[5]=x(u,n[5]),n[6]=x(h,n[6]),n[7]=x(d,n[7])}return n}function x(t,e){var n=(t&65535)+(e&65535),i=(t>>16)+(e>>16)+(n>>16);return i<<16|n&65535}function pi(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var n=e-t.length-6,i="",r=0;r<n;r+=2)i+="ff";var s="0001"+i+"00"+t;return I(s,16)}function gi(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var n=[],i=t.length-1;i>=0&&e>0;){var r=t.charCodeAt(i--);r<128?n[--e]=r:r>127&&r<2048?(n[--e]=r&63|128,n[--e]=r>>6|192):(n[--e]=r&63|128,n[--e]=r>>6&63|128,n[--e]=r>>12|224)}n[--e]=0;for(var s=new Yt,a=[];e>2;){for(a[0]=0;a[0]==0;)s.nextBytes(a);n[--e]=a[0]}return n[--e]=2,n[--e]=0,new S(n)}function We(t,e,n){for(var i="",r=0;i.length<e;)i+=n(String.fromCharCode.apply(String,t.concat([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255]))),r+=1;return i}var mi=32;function bi(t,e){var n=mi,i=Se;if(t.length+2*n+2>e)throw"Message too long for RSA";var r="",s;for(s=0;s<e-t.length-2*n-2;s+=1)r+="\0";var a=i("")+r+""+t,o=new Array(n);new Yt().nextBytes(o);var l=We(o,a.length,i),u=[];for(s=0;s<a.length;s+=1)u[s]=a.charCodeAt(s)^l.charCodeAt(s);var h=We(u,o.length,i),d=[0];for(s=0;s<o.length;s+=1)d[s+1]=o[s]^h.charCodeAt(s);return new S(d.concat(u))}var vi=(function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var n=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);n.compareTo(i)<0;)n=n.add(this.p);return n.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},t.prototype.setPublic=function(e,n){e!=null&&n!=null&&e.length>0&&n.length>0?(this.n=I(e,16),this.e=parseInt(n,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(e,n){typeof n>"u"&&(n=gi);var i=this.n.bitLength()+7>>3,r=n(e,i);if(r==null)return null;var s=this.doPublic(r);if(s==null)return null;for(var a=s.toString(16),o=a.length,l=0;l<i*2-o;l++)a="0"+a;return a},t.prototype.setPrivate=function(e,n,i){e!=null&&n!=null&&e.length>0&&n.length>0?(this.n=I(e,16),this.e=parseInt(n,16),this.d=I(i,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(e,n,i,r,s,a,o,l){e!=null&&n!=null&&e.length>0&&n.length>0?(this.n=I(e,16),this.e=parseInt(n,16),this.d=I(i,16),this.p=I(r,16),this.q=I(s,16),this.dmp1=I(a,16),this.dmq1=I(o,16),this.coeff=I(l,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(e,n){var i=new Yt,r=e>>1;this.e=parseInt(n,16);for(var s=new S(n,16);;){for(;this.p=new S(e-r,1,i),!(this.p.subtract(S.ONE).gcd(s).compareTo(S.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new S(r,1,i),!(this.q.subtract(S.ONE).gcd(s).compareTo(S.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(S.ONE),l=this.q.subtract(S.ONE),u=o.multiply(l);if(u.gcd(s).compareTo(S.ONE)==0){this.n=this.p.multiply(this.q),this.d=s.modInverse(u),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(e){var n=I(e,16),i=this.doPrivate(n);return i==null?null:yi(i,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(e,n,i){var r=new Yt,s=e>>1;this.e=parseInt(n,16);var a=new S(n,16),o=this,l=function(){var u=function(){if(o.p.compareTo(o.q)<=0){var p=o.p;o.p=o.q,o.q=p}var f=o.p.subtract(S.ONE),y=o.q.subtract(S.ONE),b=f.multiply(y);b.gcd(a).compareTo(S.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(b),o.dmp1=o.d.mod(f),o.dmq1=o.d.mod(y),o.coeff=o.q.modInverse(o.p),setTimeout(function(){i()},0)):setTimeout(l,0)},h=function(){o.q=_(),o.q.fromNumberAsync(s,1,r,function(){o.q.subtract(S.ONE).gcda(a,function(p){p.compareTo(S.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(u,0):setTimeout(h,0)})})},d=function(){o.p=_(),o.p.fromNumberAsync(e-s,1,r,function(){o.p.subtract(S.ONE).gcda(a,function(p){p.compareTo(S.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(d,0)})})};setTimeout(d,0)};setTimeout(l,0)},t.prototype.sign=function(e,n,i){var r=Si(i),s=r+n(e).toString(),a=this.n.bitLength()/4,o=pi(s,a);if(o==null)return null;var l=this.doPrivate(o);if(l==null)return null;for(var u=l.toString(16),h=u.length,d=0;d<a-h;d++)u="0"+u;return u},t.prototype.verify=function(e,n,i){var r=I(n,16),s=this.doPublic(r);if(s==null)return null;var a=s.toString(16).replace(/^1f+00/,""),o=wi(a);return o==i(e).toString()},t})();function yi(t,e){for(var n=t.toByteArray(),i=0;i<n.length&&n[i]==0;)++i;if(n.length-i!=e-1||n[i]!=2)return null;for(++i;n[i]!=0;)if(++i>=n.length)return null;for(var r="";++i<n.length;){var s=n[i]&255;s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((s&31)<<6|n[i+1]&63),++i):(r+=String.fromCharCode((s&15)<<12|(n[i+1]&63)<<6|n[i+2]&63),i+=2)}return r}var Zt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function Si(t){return Zt[t]||""}function wi(t){for(var e in Zt)if(Zt.hasOwnProperty(e)){var n=Zt[e],i=n.length;if(t.substring(0,i)==n)return t.substring(i)}return t}function D(t,e,n){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}var c={};(typeof c.asn1>"u"||!c.asn1)&&(c.asn1={});c.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if(e.substring(0,1)!="-")e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substring(1),i=n.length;i%2==1?i+=1:e.match(/^[0-7]/)||(i+=2);for(var r="",s=0;s<i;s++)r+="f";var a=new S(r,16),o=a.xor(t).add(S.ONE);e=o.toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=c,n=e.asn1,i=n.DERBoolean,r=n.DERInteger,s=n.DERBitString,a=n.DEROctetString,o=n.DERNull,l=n.DERObjectIdentifier,u=n.DEREnumerated,h=n.DERUTF8String,d=n.DERNumericString,p=n.DERPrintableString,f=n.DERTeletexString,y=n.DERIA5String,b=n.DERUTCTime,R=n.DERGeneralizedTime,P=n.DERSequence,T=n.DERSet,M=n.DERTaggedObject,E=n.ASN1Util.newObject,H=Object.keys(t);if(H.length!=1)throw"key of param shall be only one.";var g=H[0];if(":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+g+":")==-1)throw"undefined key: "+g;if(g=="bool")return new i(t[g]);if(g=="int")return new r(t[g]);if(g=="bitstr")return new s(t[g]);if(g=="octstr")return new a(t[g]);if(g=="null")return new o(t[g]);if(g=="oid")return new l(t[g]);if(g=="enum")return new u(t[g]);if(g=="utf8str")return new h(t[g]);if(g=="numstr")return new d(t[g]);if(g=="prnstr")return new p(t[g]);if(g=="telstr")return new f(t[g]);if(g=="ia5str")return new y(t[g]);if(g=="utctime")return new b(t[g]);if(g=="gentime")return new R(t[g]);if(g=="seq"){for(var F=t[g],N=[],B=0;B<F.length;B++){var ct=E(F[B]);N.push(ct)}return new P({array:N})}if(g=="set"){for(var F=t[g],N=[],B=0;B<F.length;B++){var ct=E(F[B]);N.push(ct)}return new T({array:N})}if(g=="tag"){var W=t[g];if(Object.prototype.toString.call(W)==="[object Array]"&&W.length==3){var ie=E(W[2]);return new M({tag:W[0],explicit:W[1],obj:ie})}else{var j={};if(W.explicit!==void 0&&(j.explicit=W.explicit),W.tag!==void 0&&(j.tag=W.tag),W.obj===void 0)throw"obj shall be specified for 'tag'.";return j.obj=E(W.obj),new M(j)}}},this.jsonToASN1HEX=function(t){var e=this.newObject(t);return e.getEncodedHex()}};c.asn1.ASN1Util.oidHexToInt=function(t){for(var r="",e=parseInt(t.substring(0,2),16),n=Math.floor(e/40),i=e%40,r=n+"."+i,s="",a=2;a<t.length;a+=2){var o=parseInt(t.substring(a,a+2),16),l=("00000000"+o.toString(2)).slice(-8);if(s=s+l.substring(1,8),l.substring(0,1)=="0"){var u=new S(s,2);r=r+"."+u.toString(10),s=""}}return r};c.asn1.ASN1Util.oidIntToHex=function(t){var e=function(o){var l=o.toString(16);return l.length==1&&(l="0"+l),l},n=function(o){var l="",u=new S(o,10),h=u.toString(2),d=7-h.length%7;d==7&&(d=0);for(var p="",f=0;f<d;f++)p+="0";h=p+h;for(var f=0;f<h.length-1;f+=7){var y=h.substring(f,f+7);f!=h.length-7&&(y="1"+y),l+=e(parseInt(y,2))}return l};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var i="",r=t.split("."),s=parseInt(r[0])*40+parseInt(r[1]);i+=e(s),r.splice(0,2);for(var a=0;a<r.length;a++)i+=n(r[a]);return i};c.asn1.ASN1Object=function(){var t="";this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+t.length+",v="+this.hV;var e=this.hV.length/2,n=e.toString(16);if(n.length%2==1&&(n="0"+n),e<128)return n;var i=n.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);var r=128+i;return r.toString(16)+n},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};c.asn1.DERAbstractString=function(t){c.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t=="string"?this.setString(t):typeof t.str<"u"?this.setString(t.str):typeof t.hex<"u"&&this.setStringHex(t.hex))};D(c.asn1.DERAbstractString,c.asn1.ASN1Object);c.asn1.DERAbstractTime=function(t){c.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){utc=e.getTime()+e.getTimezoneOffset()*6e4;var n=new Date(utc);return n},this.formatDate=function(e,n,i){var r=this.zeroPadding,s=this.localDateToUTC(e),a=String(s.getFullYear());n=="utc"&&(a=a.substring(2,4));var o=r(String(s.getMonth()+1),2),l=r(String(s.getDate()),2),u=r(String(s.getHours()),2),h=r(String(s.getMinutes()),2),d=r(String(s.getSeconds()),2),p=a+o+l+u+h+d;if(i===!0){var f=s.getMilliseconds();if(f!=0){var y=r(String(f),3);y=y.replace(/[0]+$/,""),p=p+"."+y}}return p+"Z"},this.zeroPadding=function(e,n){return e.length>=n?e:new Array(n-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,n,i,r,s,a){var o=new Date(Date.UTC(e,n-1,i,r,s,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}};D(c.asn1.DERAbstractTime,c.asn1.ASN1Object);c.asn1.DERAbstractStructured=function(t){c.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,typeof t<"u"&&typeof t.array<"u"&&(this.asn1Array=t.array)};D(c.asn1.DERAbstractStructured,c.asn1.ASN1Object);c.asn1.DERBoolean=function(){c.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};D(c.asn1.DERBoolean,c.asn1.ASN1Object);c.asn1.DERInteger=function(t){c.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var n=new S(String(e),10);this.setByBigInteger(n)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t.bigint<"u"?this.setByBigInteger(t.bigint):typeof t.int<"u"?this.setByInteger(t.int):typeof t=="number"?this.setByInteger(t):typeof t.hex<"u"&&this.setValueHex(t.hex))};D(c.asn1.DERInteger,c.asn1.ASN1Object);c.asn1.DERBitString=function(t){if(t!==void 0&&typeof t.obj<"u"){var e=c.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}c.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(n){this.hTLV=null,this.isModified=!0,this.hV=n},this.setUnusedBitsAndHexValue=function(n,i){if(n<0||7<n)throw"unused bits shall be from 0 to 7: u = "+n;var r="0"+n;this.hTLV=null,this.isModified=!0,this.hV=r+i},this.setByBinaryString=function(n){n=n.replace(/0+$/,"");var i=8-n.length%8;i==8&&(i=0);for(var r=0;r<=i;r++)n+="0";for(var s="",r=0;r<n.length-1;r+=8){var a=n.substring(r,r+8),o=parseInt(a,2).toString(16);o.length==1&&(o="0"+o),s+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+i+s},this.setByBooleanArray=function(n){for(var i="",r=0;r<n.length;r++)n[r]==!0?i+="1":i+="0";this.setByBinaryString(i)},this.newFalseArray=function(n){for(var i=new Array(n),r=0;r<n;r++)i[r]=!1;return i},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t=="string"&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):typeof t.hex<"u"?this.setHexValueIncludingUnusedBits(t.hex):typeof t.bin<"u"?this.setByBinaryString(t.bin):typeof t.array<"u"&&this.setByBooleanArray(t.array))};D(c.asn1.DERBitString,c.asn1.ASN1Object);c.asn1.DEROctetString=function(t){if(t!==void 0&&typeof t.obj<"u"){var e=c.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}c.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"};D(c.asn1.DEROctetString,c.asn1.DERAbstractString);c.asn1.DERNull=function(){c.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};D(c.asn1.DERNull,c.asn1.ASN1Object);c.asn1.DERObjectIdentifier=function(t){var e=function(i){var r=i.toString(16);return r.length==1&&(r="0"+r),r},n=function(i){var r="",s=new S(i,10),a=s.toString(2),o=7-a.length%7;o==7&&(o=0);for(var l="",u=0;u<o;u++)l+="0";a=l+a;for(var u=0;u<a.length-1;u+=7){var h=a.substring(u,u+7);u!=a.length-7&&(h="1"+h),r+=e(parseInt(h,2))}return r};c.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(i){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueOidString=function(i){if(!i.match(/^[0-9.]+$/))throw"malformed oid string: "+i;var r="",s=i.split("."),a=parseInt(s[0])*40+parseInt(s[1]);r+=e(a),s.splice(0,2);for(var o=0;o<s.length;o++)r+=n(s[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(i){var r=c.asn1.x509.OID.name2oid(i);if(r!=="")this.setValueOidString(r);else throw"DERObjectIdentifier oidName undefined: "+i},this.getFreshValueHex=function(){return this.hV},t!==void 0&&(typeof t=="string"?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):t.oid!==void 0?this.setValueOidString(t.oid):t.hex!==void 0?this.setValueHex(t.hex):t.name!==void 0&&this.setValueName(t.name))};D(c.asn1.DERObjectIdentifier,c.asn1.ASN1Object);c.asn1.DEREnumerated=function(t){c.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var n=new S(String(e),10);this.setByBigInteger(n)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t.int<"u"?this.setByInteger(t.int):typeof t=="number"?this.setByInteger(t):typeof t.hex<"u"&&this.setValueHex(t.hex))};D(c.asn1.DEREnumerated,c.asn1.ASN1Object);c.asn1.DERUTF8String=function(t){c.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"};D(c.asn1.DERUTF8String,c.asn1.DERAbstractString);c.asn1.DERNumericString=function(t){c.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"};D(c.asn1.DERNumericString,c.asn1.DERAbstractString);c.asn1.DERPrintableString=function(t){c.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"};D(c.asn1.DERPrintableString,c.asn1.DERAbstractString);c.asn1.DERTeletexString=function(t){c.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"};D(c.asn1.DERTeletexString,c.asn1.DERAbstractString);c.asn1.DERIA5String=function(t){c.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"};D(c.asn1.DERIA5String,c.asn1.DERAbstractString);c.asn1.DERUTCTime=function(t){c.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return typeof this.date>"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},t!==void 0&&(t.str!==void 0?this.setString(t.str):typeof t=="string"&&t.match(/^[0-9]{12}Z$/)?this.setString(t):t.hex!==void 0?this.setStringHex(t.hex):t.date!==void 0&&this.setByDate(t.date))};D(c.asn1.DERUTCTime,c.asn1.DERAbstractTime);c.asn1.DERGeneralizedTime=function(t){c.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},t!==void 0&&(t.str!==void 0?this.setString(t.str):typeof t=="string"&&t.match(/^[0-9]{14}Z$/)?this.setString(t):t.hex!==void 0?this.setStringHex(t.hex):t.date!==void 0&&this.setByDate(t.date),t.millis===!0&&(this.withMillis=!0))};D(c.asn1.DERGeneralizedTime,c.asn1.DERAbstractTime);c.asn1.DERSequence=function(t){c.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var e="",n=0;n<this.asn1Array.length;n++){var i=this.asn1Array[n];e+=i.getEncodedHex()}return this.hV=e,this.hV}};D(c.asn1.DERSequence,c.asn1.DERAbstractStructured);c.asn1.DERSet=function(t){c.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,n=0;n<this.asn1Array.length;n++){var i=this.asn1Array[n];e.push(i.getEncodedHex())}return this.sortFlag==!0&&e.sort(),this.hV=e.join(""),this.hV},typeof t<"u"&&typeof t.sortflag<"u"&&t.sortflag==!1&&(this.sortFlag=!1)};D(c.asn1.DERSet,c.asn1.DERAbstractStructured);c.asn1.DERTaggedObject=function(t){c.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,n,i){this.hT=n,this.isExplicit=e,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,n),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t.tag<"u"&&(this.hT=t.tag),typeof t.explicit<"u"&&(this.isExplicit=t.explicit),typeof t.obj<"u"&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))};D(c.asn1.DERTaggedObject,c.asn1.ASN1Object);var _i=(function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function i(){this.constructor=e}e.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}})(),Ne=(function(t){_i(e,t);function e(n){var i=t.call(this)||this;return n&&(typeof n=="string"?i.parseKey(n):(e.hasPrivateKeyProperty(n)||e.hasPublicKeyProperty(n))&&i.parsePropertiesFrom(n)),i}return e.prototype.parseKey=function(n){try{var i=0,r=0,s=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,a=s.test(n)?Zn.decode(n):ye.unarmor(n),o=Gn.decode(a);if(o.sub.length===3&&(o=o.sub[2].sub[0]),o.sub.length===9){i=o.sub[1].getHexStringValue(),this.n=I(i,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var l=o.sub[3].getHexStringValue();this.d=I(l,16);var u=o.sub[4].getHexStringValue();this.p=I(u,16);var h=o.sub[5].getHexStringValue();this.q=I(h,16);var d=o.sub[6].getHexStringValue();this.dmp1=I(d,16);var p=o.sub[7].getHexStringValue();this.dmq1=I(p,16);var f=o.sub[8].getHexStringValue();this.coeff=I(f,16)}else if(o.sub.length===2)if(o.sub[0].sub){var y=o.sub[1],b=y.sub[0];i=b.sub[0].getHexStringValue(),this.n=I(i,16),r=b.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else i=o.sub[0].getHexStringValue(),this.n=I(i,16),r=o.sub[1].getHexStringValue(),this.e=parseInt(r,16);else return!1;return!0}catch{return!1}},e.prototype.getPrivateBaseKey=function(){var n={array:[new c.asn1.DERInteger({int:0}),new c.asn1.DERInteger({bigint:this.n}),new c.asn1.DERInteger({int:this.e}),new c.asn1.DERInteger({bigint:this.d}),new c.asn1.DERInteger({bigint:this.p}),new c.asn1.DERInteger({bigint:this.q}),new c.asn1.DERInteger({bigint:this.dmp1}),new c.asn1.DERInteger({bigint:this.dmq1}),new c.asn1.DERInteger({bigint:this.coeff})]},i=new c.asn1.DERSequence(n);return i.getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return xt(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var n=new c.asn1.DERSequence({array:[new c.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new c.asn1.DERNull]}),i=new c.asn1.DERSequence({array:[new c.asn1.DERInteger({bigint:this.n}),new c.asn1.DERInteger({int:this.e})]}),r=new c.asn1.DERBitString({hex:"00"+i.getEncodedHex()}),s=new c.asn1.DERSequence({array:[n,r]});return s.getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return xt(this.getPublicBaseKey())},e.wordwrap=function(n,i){if(i=i||64,!n)return n;var r="(.{1,"+i+`})( +|$
|
|
9
|
+
?)|(.{1,`+i+"})";return n.match(RegExp(r,"g")).join(`
|
|
10
|
+
`)},e.prototype.getPrivateKey=function(){var n=`-----BEGIN RSA PRIVATE KEY-----
|
|
11
|
+
`;return n+=e.wordwrap(this.getPrivateBaseKeyB64())+`
|
|
12
|
+
`,n+="-----END RSA PRIVATE KEY-----",n},e.prototype.getPublicKey=function(){var n=`-----BEGIN PUBLIC KEY-----
|
|
13
|
+
`;return n+=e.wordwrap(this.getPublicBaseKeyB64())+`
|
|
14
|
+
`,n+="-----END PUBLIC KEY-----",n},e.hasPublicKeyProperty=function(n){return n=n||{},n.hasOwnProperty("n")&&n.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(n){return n=n||{},n.hasOwnProperty("n")&&n.hasOwnProperty("e")&&n.hasOwnProperty("d")&&n.hasOwnProperty("p")&&n.hasOwnProperty("q")&&n.hasOwnProperty("dmp1")&&n.hasOwnProperty("dmq1")&&n.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(n){this.n=n.n,this.e=n.e,n.hasOwnProperty("d")&&(this.d=n.d,this.p=n.p,this.q=n.q,this.dmp1=n.dmp1,this.dmq1=n.dmq1,this.coeff=n.coeff)},e})(vi),oe,Ci=typeof process<"u"?(oe=process.env)===null||oe===void 0?void 0:oe.npm_package_version:void 0,Ri=(function(){function t(e){e===void 0&&(e={}),this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=e.key||null}return t.prototype.setKey=function(e){e?(this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Ne(e)):!this.key&&this.log&&console.error("A key was not set.")},t.prototype.setPrivateKey=function(e){this.setKey(e)},t.prototype.setPublicKey=function(e){this.setKey(e)},t.prototype.decrypt=function(e){try{return this.getKey().decrypt(ke(e))}catch{return!1}},t.prototype.encrypt=function(e){try{return xt(this.getKey().encrypt(e))}catch{return!1}},t.prototype.encryptOAEP=function(e){try{return xt(this.getKey().encrypt(e,bi))}catch{return!1}},t.prototype.sign=function(e,n,i){n===void 0&&(n=function(r){return r}),i===void 0&&(i="");try{return xt(this.getKey().sign(e,n,i))}catch{return!1}},t.prototype.signSha256=function(e){return this.sign(e,function(n){return Fe(Se(n))},"sha256")},t.prototype.verify=function(e,n,i){i===void 0&&(i=function(r){return r});try{return this.getKey().verify(e,ke(n),i)}catch{return!1}},t.prototype.verifySha256=function(e,n){return this.verify(e,n,function(i){return Fe(Se(i))})},t.prototype.getKey=function(e){if(!this.key){if(this.key=new Ne,e&&{}.toString.call(e)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=Ci,t})(),ae,Ti=new Uint8Array(16);function Ei(){if(!ae&&!(ae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(Ti)}var Ii=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function qi(t){return typeof t=="string"&&Ii.test(t)}for(var k=[],le=0;le<256;++le)k.push((le+256).toString(16).substr(1));function at(t,e,n){var i=(t=t||{}).random||(t.rng||Ei)();return i[6]=15&i[6]|64,i[8]=63&i[8]|128,(function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=(k[r[s+0]]+k[r[s+1]]+k[r[s+2]]+k[r[s+3]]+"-"+k[r[s+4]]+k[r[s+5]]+"-"+k[r[s+6]]+k[r[s+7]]+"-"+k[r[s+8]]+k[r[s+9]]+"-"+k[r[s+10]]+k[r[s+11]]+k[r[s+12]]+k[r[s+13]]+k[r[s+14]]+k[r[s+15]]).toLowerCase();if(!qi(a))throw TypeError("Stringified UUID is invalid");return a})(i)}const Di=typeof atob=="function",Pi=typeof btoa=="function",Ct=typeof Buffer=="function",Ve=typeof TextDecoder=="function"?new TextDecoder:void 0,Le=typeof TextEncoder=="function"?new TextEncoder:void 0,Dt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Jt=(t=>{let e={};return Dt.forEach(((n,i)=>e[n]=i)),e})(),xi=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,A=String.fromCharCode.bind(String),Je=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(t,e=(n=>n))=>new Uint8Array(Array.prototype.slice.call(t,0).map(e)),gn=t=>t.replace(/=/g,"").replace(/[+\/]/g,(e=>e=="+"?"-":"_")),mn=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),bn=t=>{let e,n,i,r,s="";const a=t.length%3;for(let o=0;o<t.length;){if((n=t.charCodeAt(o++))>255||(i=t.charCodeAt(o++))>255||(r=t.charCodeAt(o++))>255)throw new TypeError("invalid character found");e=n<<16|i<<8|r,s+=Dt[e>>18&63]+Dt[e>>12&63]+Dt[e>>6&63]+Dt[63&e]}return a?s.slice(0,a-3)+"===".substring(a):s},Ee=Pi?t=>btoa(t):Ct?t=>Buffer.from(t,"binary").toString("base64"):bn,we=Ct?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let n=0,i=t.length;n<i;n+=4096)e.push(A.apply(null,t.subarray(n,n+4096)));return Ee(e.join(""))},$t=(t,e=!1)=>e?gn(we(t)):we(t),ki=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?A(192|e>>>6)+A(128|63&e):A(224|e>>>12&15)+A(128|e>>>6&63)+A(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return A(240|e>>>18&7)+A(128|e>>>12&63)+A(128|e>>>6&63)+A(128|63&e)},Ai=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,vn=t=>t.replace(Ai,ki),He=Ct?t=>Buffer.from(t,"utf8").toString("base64"):Le?t=>we(Le.encode(t)):t=>Ee(vn(t)),wt=(t,e=!1)=>e?gn(He(t)):He(t),je=t=>wt(t,!0),Oi=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Bi=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return A(55296+(e>>>10))+A(56320+(1023&e));case 3:return A((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return A((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},yn=t=>t.replace(Oi,Bi),Sn=t=>{if(t=t.replace(/\s+/g,""),!xi.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,n,i,r="";for(let s=0;s<t.length;)e=Jt[t.charAt(s++)]<<18|Jt[t.charAt(s++)]<<12|(n=Jt[t.charAt(s++)])<<6|(i=Jt[t.charAt(s++)]),r+=n===64?A(e>>16&255):i===64?A(e>>16&255,e>>8&255):A(e>>16&255,e>>8&255,255&e);return r},Ie=Di?t=>atob(mn(t)):Ct?t=>Buffer.from(t,"base64").toString("binary"):Sn,wn=Ct?t=>Je(Buffer.from(t,"base64")):t=>Je(Ie(t),(e=>e.charCodeAt(0))),_n=t=>wn(Cn(t)),Ui=Ct?t=>Buffer.from(t,"base64").toString("utf8"):Ve?t=>Ve.decode(wn(t)):t=>yn(Ie(t)),Cn=t=>mn(t.replace(/[-_]/g,(e=>e=="-"?"+":"/"))),_e=t=>Ui(Cn(t)),Rn=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),Ze=function(){const t=(e,n)=>Object.defineProperty(String.prototype,e,Rn(n));t("fromBase64",(function(){return _e(this)})),t("toBase64",(function(e){return wt(this,e)})),t("toBase64URI",(function(){return wt(this,!0)})),t("toBase64URL",(function(){return wt(this,!0)})),t("toUint8Array",(function(){return _n(this)}))},$e=function(){const t=(e,n)=>Object.defineProperty(Uint8Array.prototype,e,Rn(n));t("toBase64",(function(e){return $t(this,e)})),t("toBase64URI",(function(){return $t(this,!0)})),t("toBase64URL",(function(){return $t(this,!0)}))},Mi={version:"3.7.2",VERSION:"3.7.2",atob:Ie,atobPolyfill:Sn,btoa:Ee,btoaPolyfill:bn,fromBase64:_e,toBase64:wt,encode:wt,encodeURI:je,encodeURL:je,utob:vn,btou:yn,decode:_e,isValid:t=>{if(typeof t!="string")return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:$t,toUint8Array:_n,extendString:Ze,extendUint8Array:$e,extendBuiltins:()=>{Ze(),$e()}},m=new class{constructor(){this.oBase64=Mi}browser(){const t=navigator.userAgent.toLowerCase(),e=/(edge)[/]([\w.]+)/.exec(t)||/(chrome)[/]([\w.]+)/.exec(t)||/(safari)[/]([\w.]+)/.exec(t)||/(opera)(?:.*version)?[/]([\w.]+)/.exec(t)||/(trident.*rv:)([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(t)||["unknow","0"];e.length>0&&e[1].indexOf("trident")>-1&&(e[1]="msie");const n={};return n[e[1]]=!0,n.version=e[2],n}getCreateWndMode(){const t=navigator.userAgent,e=navigator.platform,n=e==="Win64"||e==="Win32"||e==="Windows",i=this.browser();let r=!0;return window.top!==window?r=!1:n?(t.indexOf("Windows NT 10.0")>-1&&i.mozilla&&(r=!1),i.edge&&(r=!1)):r=!1,r}getWndPostion(t,e,n,i){let r=0,s=0;const a=t.ownerDocument.defaultView,o=t.getBoundingClientRect(),l=window.getComputedStyle(t),u={top:o.top+parseInt(l["border-top-width"].slice(0,-2),10),left:o.left+parseInt(l["border-left-width"].slice(0,-2),10)},h=this.getDevicePixelRatio(),d=this.browser().chrome?a.outerWidth/h:a.outerWidth,p=this.browser().chrome?a.outerHeight/h:a.outerHeight;if(e)if(this.browser().msie){const f=a.outerWidth-a.innerWidth-(a.screenLeft-a.screenX);r=u.left+(a.screenLeft-a.screenX)-f,s=u.top+(a.screenTop-a.screenY)}else{let f=0,y=0;const b=Math.round((d-a.innerWidth)/2);this.isWindows()&&this.browser().chrome&&(b===-8||a.screen.height-a.outerHeight==0?b===-8&&(f=8,y=8):b===8?f=-5:b===0&&(y=8)),this.browser().mozilla&&(b===7||b===6?f=-6:b===8&&(f=-8)),r=u.left+b+f,s=u.top+(p-a.innerHeight-b)+y}else{const f=window.top;let y=0,b=0,R=0,P=0;try{y=d-f.innerWidth,b=p-f.innerHeight,R=f.screenLeft-f.screenX,P=f.screenTop-f.screenY}catch{y=n.outerWidth-n.innerWidth,b=n.outerHeight-n.innerHeight,R=n.screenLeft-n.screenX,P=n.screenTop-n.screenY}if(this.browser().msie){let T=y-R;T=0,r=u.left+R-T,s=u.top+P}else{const T=y/2;r=u.left+T,s=u.top+(b-T),this.isWindows()&&this.browser().chrome&&T===0&&(r+=8,s+=8)}r+=i.left,s+=i.top}return this.isWindows()&&(this.browser().chrome||this.browser().safari)&&(r=u.left,s=u.top,r+=i.left,s+=i.top),this.browser().msie&&this.browser().version==="10.0"&&(r+=a.pageXOffset,s+=a.pageYOffset),r=Math.round(r*h),s=Math.round(s*h),{left:r,top:s}}detectPort(t,e,n){if(t===e)return void n.success(t);const i=`HikCentralWebControlPort:${t}-${e}`,r=this;let s=0,a=!1,o=null;sessionStorage&&(o=sessionStorage.getItem(i),o!==null&&(o=parseInt(o,10)));const l=[];for(let b=t;b<=e;b++)b!==o&&l.push(b);o!==null&&l.unshift(o);const u=[],h=function(){s>0&&clearTimeout(s)},d=function(){for(let b=0,R=u.length;b<R;b++)delete u[b]};let p=0;const f=function(b){sessionStorage&&sessionStorage.setItem(i,b),!a&&n.success&&(h(),d(),n.success(b))},y=new Date().getTime();for(let b=0,R=l.length;b<R;b++)setTimeout((()=>{u.push(r.createImageHttp(l[b],{timeStamp:y+b,success(P){f(P)},error(){p++,l.length===p&&!a&&n.error&&(h(),d(),n.error())}}))}),100);s=setTimeout((()=>{a=!0,n.error&&(d(),n.error())}),6e4)}createImageHttp(t,e){const n=new Image;return n.crossOrigin="anonymous",n.onload=function(){e.success&&e.success(t)},n.onerror=function(){e.error&&e.error()},n.onabort=function(){e.abort&&e.abort()},n.src=`http://127.0.0.1:${t}/imghttp/local?update=${e.timeStamp}`,n}utf8to16(t){let e="",n=0;const i=t.length;let r,s,a;for(;n<i;)switch(r=t.charCodeAt(n++),r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=t.charAt(n-1);break;case 12:case 13:s=t.charCodeAt(n++),e+=String.fromCharCode((31&r)<<6|63&s);break;case 14:s=t.charCodeAt(n++),a=t.charCodeAt(n++),e+=String.fromCharCode((15&r)<<12|(63&s)<<6|(63&a)<<0)}return e}createEventScript(t,e,n){const i=document.createElement("script");i.htmlFor=t,i.event=e,i.innerHTML=n,document.getElementById(t).appendChild(i)}isMacOS(){return navigator.platform==="MacIntel"}isWindows(){return navigator.platform.indexOf("Win")>-1}getDevicePixelRatio(){let t=1;return this.isMacOS()||(t=window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),t}Base64(){return this.oBase64||{}}},Tn=" ";function zi(t){window.top.document.title=window.top.document.title+Tn+t}function Fi(t){window.top.document.title=window.top.document.title.replace(Tn+t,"")}function ue(t,e){(e||zi)(t)}function Et(t,e){(e||Fi)(t)}const he=class{constructor(t){this.oOptions=Object.assign({iPort:-1,cbConnectSuccess:null,cbConnectError:null,cbConnectClose:null},t),this.oWebSocket=null,this.szUUID="",this.szVersion="",this.oRequestList={},this.bNormalClose=!1,this.oWindowControlCallback={},this.oSadpCallback={},this.oSliceCallback={},this.oSerialCallback={},this.oUIControlCallback={},this.oUpgradeCallback={},this.init()}init(){const t=this,e=function(){t.oOptions.cbConnectClose&&t.oOptions.cbConnectClose(t.bNormalClose),t.bNormalClose=!1};t.oWebSocket=new WebSocket(`ws://127.0.0.1:${t.oOptions.iPort}`),t.oWebSocket.onerror=function(){},t.oWebSocket.onopen=function(){const n={sequence:at(),cmd:"system.connect"},i=JSON.stringify(n);t.oWebSocket.send(i)},t.oWebSocket.onmessage=function(n){const i=n.data,r=JSON.parse(i),s=r.sequence;s===void 0&&r.cmd===void 0?(t.szUUID=r.uuid,t.szVersion=r.version,t.oOptions.cbConnectSuccess&&t.oOptions.cbConnectSuccess()):r.cmd!==void 0?t.parseCmd(r):t.oRequestList[s]!==void 0&&(r.errorModule===0&&r.errorCode===0?t.oRequestList[s].resolve(r):t.oRequestList[s].reject(r),delete t.oRequestList[s])},t.oWebSocket.onclose=function(){t.oWebSocket=null,m.browser().mozilla?setTimeout((()=>{e()}),100):e()}}setWindowControlCallback(t){this.oWindowControlCallback=t}setSadpCallback(t){this.oSadpCallback=t}setSliceCallback(t){this.oSliceCallback=t}setSerialCallback(t){this.oSerialCallback=t}setUIControlCallback(t){this.oUIControlCallback=t}setUpgradeCallback(t){this.oUpgradeCallback=t}getServiceVersion(){return this.szVersion}getRequestUUID(){return this.szUUID}disconnect(){this.bNormalClose=!0,this.oWebSocket&&WebSocket.OPEN===this.oWebSocket.readyState&&(this.oWebSocket.close(),delete this.oWebSocket)}sendRequest(t){const e=this;return new Promise(((n,i)=>{const r=at();t.sequence=r,e.oRequestList[r]={resolve:n,reject:i},t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const s=JSON.stringify(t);e.oWebSocket&&WebSocket.OPEN===e.oWebSocket.readyState?e.oWebSocket.send(s):i()}))}parseCmd(t){const e=t.cmd.split("."),n=e[1].replace(/^[a-z]{1}/g,(i=>i.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${n}`]&&this.oWindowControlCallback[`cb${n}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${n}`]&&this.oSadpCallback[`cb${n}`](t):e[0]==="serial"?this.oSerialCallback[`cb${n}`]&&this.oSerialCallback[`cb${n}`](t):e[0]==="slice"?this.oSliceCallback[`cb${n}`]&&this.oSliceCallback[`cb${n}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${n}`]&&this.oUIControlCallback[`cb${n}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${n}`]&&this.oUpgradeCallback[`cb${n}`](t)}};function Rt(t){let e=t.length;for(;--e>=0;)t[e]=0}const Ce=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Kt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Wi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ke=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Q=new Array(576);Rt(Q);const kt=new Array(60);Rt(kt);const Ut=new Array(512);Rt(Ut);const At=new Array(256);Rt(At);const qe=new Array(29);Rt(qe);const Xt=new Array(30);function ce(t,e,n,i,r){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=t&&t.length}let Ge,Ye,Xe;function de(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}Rt(Xt);const En=t=>t<256?Ut[t]:Ut[256+(t>>>7)],Mt=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},z=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,Mt(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},G=(t,e,n)=>{z(t,n[2*e],n[2*e+1])},In=(t,e)=>{let n=0;do n|=1&t,t>>>=1,n<<=1;while(--e>0);return n>>>1},qn=(t,e,n)=>{const i=new Array(16);let r,s,a=0;for(r=1;r<=15;r++)i[r]=a=a+n[r-1]<<1;for(s=0;s<=e;s++){let o=t[2*s+1];o!==0&&(t[2*s]=In(i[o]++,o))}},Dn=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},Pn=t=>{t.bi_valid>8?Mt(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Qe=(t,e,n,i)=>{const r=2*e,s=2*n;return t[r]<t[s]||t[r]===t[s]&&i[e]<=i[n]},fe=(t,e,n)=>{const i=t.heap[n];let r=n<<1;for(;r<=t.heap_len&&(r<t.heap_len&&Qe(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!Qe(e,i,t.heap[r],t.depth));)t.heap[n]=t.heap[r],n=r,r<<=1;t.heap[n]=i},tn=(t,e,n)=>{let i,r,s,a,o=0;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],r=t.pending_buf[t.l_buf+o],o++,i===0?G(t,r,e):(s=At[r],G(t,s+256+1,e),a=Ce[s],a!==0&&(r-=qe[s],z(t,r,a)),i--,s=En(i),G(t,s,n),a=Kt[s],a!==0&&(i-=Xt[s],z(t,i,a)));while(o<t.last_lit);G(t,256,e)},pe=(t,e)=>{const n=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.elems;let a,o,l,u=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<s;a++)n[2*a]!==0?(t.heap[++t.heap_len]=u=a,t.depth[a]=0):n[2*a+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=u<2?++u:0,n[2*l]=1,t.depth[l]=0,t.opt_len--,r&&(t.static_len-=i[2*l+1]);for(e.max_code=u,a=t.heap_len>>1;a>=1;a--)fe(t,n,a);l=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],fe(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,n[2*l]=n[2*a]+n[2*o],t.depth[l]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,n[2*a+1]=n[2*o+1]=l,t.heap[1]=l++,fe(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((h,d)=>{const p=d.dyn_tree,f=d.max_code,y=d.stat_desc.static_tree,b=d.stat_desc.has_stree,R=d.stat_desc.extra_bits,P=d.stat_desc.extra_base,T=d.stat_desc.max_length;let M,E,H,g,F,N,B=0;for(g=0;g<=15;g++)h.bl_count[g]=0;for(p[2*h.heap[h.heap_max]+1]=0,M=h.heap_max+1;M<573;M++)E=h.heap[M],g=p[2*p[2*E+1]+1]+1,g>T&&(g=T,B++),p[2*E+1]=g,E>f||(h.bl_count[g]++,F=0,E>=P&&(F=R[E-P]),N=p[2*E],h.opt_len+=N*(g+F),b&&(h.static_len+=N*(y[2*E+1]+F)));if(B!==0){do{for(g=T-1;h.bl_count[g]===0;)g--;h.bl_count[g]--,h.bl_count[g+1]+=2,h.bl_count[T]--,B-=2}while(B>0);for(g=T;g!==0;g--)for(E=h.bl_count[g];E!==0;)H=h.heap[--M],H>f||(p[2*H+1]!==g&&(h.opt_len+=(g-p[2*H+1])*p[2*H],p[2*H+1]=g),E--)}})(t,e),qn(n,u,t.bl_count)},en=(t,e,n)=>{let i,r,s=-1,a=e[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)r=a,a=e[2*(i+1)+1],++o<l&&r===a||(o<u?t.bl_tree[2*r]+=o:r!==0?(r!==s&&t.bl_tree[2*r]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=r,a===0?(l=138,u=3):r===a?(l=6,u=3):(l=7,u=4))},nn=(t,e,n)=>{let i,r,s=-1,a=e[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),i=0;i<=n;i++)if(r=a,a=e[2*(i+1)+1],!(++o<l&&r===a)){if(o<u)do G(t,r,t.bl_tree);while(--o!=0);else r!==0?(r!==s&&(G(t,r,t.bl_tree),o--),G(t,16,t.bl_tree),z(t,o-3,2)):o<=10?(G(t,17,t.bl_tree),z(t,o-3,3)):(G(t,18,t.bl_tree),z(t,o-11,7));o=0,s=r,a===0?(l=138,u=3):r===a?(l=6,u=3):(l=7,u=4)}};let rn=!1;const xn=(t,e,n,i)=>{z(t,0+(i?1:0),3),((r,s,a,o)=>{Pn(r),Mt(r,a),Mt(r,~a),r.pending_buf.set(r.window.subarray(s,s+a),r.pending),r.pending+=a})(t,e,n)};var Ni=(t,e,n,i)=>{let r,s,a=0;t.level>0?(t.strm.data_type===2&&(t.strm.data_type=(o=>{let l,u=4093624447;for(l=0;l<=31;l++,u>>>=1)if(1&u&&o.dyn_ltree[2*l]!==0)return 0;if(o.dyn_ltree[18]!==0||o.dyn_ltree[20]!==0||o.dyn_ltree[26]!==0)return 1;for(l=32;l<256;l++)if(o.dyn_ltree[2*l]!==0)return 1;return 0})(t)),pe(t,t.l_desc),pe(t,t.d_desc),a=(o=>{let l;for(en(o,o.dyn_ltree,o.l_desc.max_code),en(o,o.dyn_dtree,o.d_desc.max_code),pe(o,o.bl_desc),l=18;l>=3&&o.bl_tree[2*Ke[l]+1]===0;l--);return o.opt_len+=3*(l+1)+5+5+4,l})(t),r=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=r&&(r=s)):r=s=n+5,n+4<=r&&e!==-1?xn(t,e,n,i):t.strategy===4||s===r?(z(t,2+(i?1:0),3),tn(t,Q,kt)):(z(t,4+(i?1:0),3),((o,l,u,h)=>{let d;for(z(o,l-257,5),z(o,u-1,5),z(o,h-4,4),d=0;d<h;d++)z(o,o.bl_tree[2*Ke[d]+1],3);nn(o,o.dyn_ltree,l-1),nn(o,o.dyn_dtree,u-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),tn(t,t.dyn_ltree,t.dyn_dtree)),Dn(t),i&&Pn(t)},Vi={_tr_init:t=>{rn||((()=>{let e,n,i,r,s;const a=new Array(16);for(i=0,r=0;r<28;r++)for(qe[r]=i,e=0;e<1<<Ce[r];e++)At[i++]=r;for(At[i-1]=r,s=0,r=0;r<16;r++)for(Xt[r]=s,e=0;e<1<<Kt[r];e++)Ut[s++]=r;for(s>>=7;r<30;r++)for(Xt[r]=s<<7,e=0;e<1<<Kt[r]-7;e++)Ut[256+s++]=r;for(n=0;n<=15;n++)a[n]=0;for(e=0;e<=143;)Q[2*e+1]=8,e++,a[8]++;for(;e<=255;)Q[2*e+1]=9,e++,a[9]++;for(;e<=279;)Q[2*e+1]=7,e++,a[7]++;for(;e<=287;)Q[2*e+1]=8,e++,a[8]++;for(qn(Q,287,a),e=0;e<30;e++)kt[2*e+1]=5,kt[2*e]=In(e,5);Ge=new ce(Q,Ce,257,286,15),Ye=new ce(kt,Kt,0,30,15),Xe=new ce(new Array(0),Wi,0,19,7)})(),rn=!0),t.l_desc=new de(t.dyn_ltree,Ge),t.d_desc=new de(t.dyn_dtree,Ye),t.bl_desc=new de(t.bl_tree,Xe),t.bi_buf=0,t.bi_valid=0,Dn(t)},_tr_stored_block:xn,_tr_flush_block:Ni,_tr_tally:(t,e,n)=>(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,e===0?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(At[n]+256+1)]++,t.dyn_dtree[2*En(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{z(t,2,3),G(t,256,Q),(e=>{e.bi_valid===16?(Mt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(t)}},kn=(t,e,n,i)=>{let r=65535&t|0,s=t>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do r=r+e[i++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const Li=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var tt=(t,e,n,i)=>{const r=Li,s=i+n;t^=-1;for(let a=i;a<s;a++)t=t>>>8^r[255&(t^e[a])];return-1^t},Qt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},An={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ji,_tr_stored_block:Hi,_tr_flush_block:ji,_tr_tally:ut,_tr_align:Zi}=Vi,{Z_NO_FLUSH:pt,Z_PARTIAL_FLUSH:$i,Z_FULL_FLUSH:Ki,Z_FINISH:rt,Z_BLOCK:sn,Z_OK:K,Z_STREAM_END:on,Z_STREAM_ERROR:L,Z_DATA_ERROR:Gi,Z_BUF_ERROR:ge,Z_DEFAULT_COMPRESSION:Yi,Z_FILTERED:Xi,Z_HUFFMAN_ONLY:Ht,Z_RLE:Qi,Z_FIXED:tr,Z_DEFAULT_STRATEGY:er,Z_UNKNOWN:nr,Z_DEFLATED:te}=An,it=(t,e)=>(t.msg=Qt[e],e),an=t=>(t<<1)-(t>4?9:0),st=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let ht=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask;const et=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))},O=(t,e)=>{ji(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,et(t.strm)},C=(t,e)=>{t.pending_buf[t.pending++]=e},It=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},ir=(t,e,n,i)=>{let r=t.avail_in;return r>i&&(r=i),r===0?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),n),t.state.wrap===1?t.adler=kn(t.adler,e,r,n):t.state.wrap===2&&(t.adler=tt(t.adler,e,r,n)),t.next_in+=r,t.total_in+=r,r)},On=(t,e)=>{let n,i,r=t.max_chain_length,s=t.strstart,a=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,u=t.window,h=t.w_mask,d=t.prev,p=t.strstart+258;let f=u[s+a-1],y=u[s+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(n=e,u[n+a]===y&&u[n+a-1]===f&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do;while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<p);if(i=258-(p-s),s=p-258,i>a){if(t.match_start=e,a=i,i>=o)break;f=u[s+a-1],y=u[s+a]}}while((e=d[e&h])>l&&--r!=0);return a<=t.lookahead?a:t.lookahead},ft=t=>{const e=t.w_size;let n,i,r,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,n=i;do r=t.head[--n],t.head[n]=r>=e?r-e:0;while(--i);i=e,n=i;do r=t.prev[--n],t.prev[n]=r>=e?r-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=ir(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=ht(t,t.ins_h,t.window[a+1]);t.insert&&(t.ins_h=ht(t,t.ins_h,t.window[a+3-1]),t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&t.strm.avail_in!==0)},me=(t,e)=>{let n,i;for(;;){if(t.lookahead<262){if(ft(t),t.lookahead<262&&e===pt)return 1;if(t.lookahead===0)break}if(n=0,t.lookahead>=3&&(t.ins_h=ht(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-262&&(t.match_length=On(t,n)),t.match_length>=3)if(i=ut(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do t.strstart++,t.ins_h=ht(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!=0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ht(t,t.ins_h,t.window[t.strstart+1]);else i=ut(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(O(t,!1),t.strm.avail_out===0))return 1}return t.insert=t.strstart<2?t.strstart:2,e===rt?(O(t,!0),t.strm.avail_out===0?3:4):t.last_lit&&(O(t,!1),t.strm.avail_out===0)?1:2},vt=(t,e)=>{let n,i,r;for(;;){if(t.lookahead<262){if(ft(t),t.lookahead<262&&e===pt)return 1;if(t.lookahead===0)break}if(n=0,t.lookahead>=3&&(t.ins_h=ht(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-262&&(t.match_length=On(t,n),t.match_length<=5&&(t.strategy===Xi||t.match_length===3&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,i=ut(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=r&&(t.ins_h=ht(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!=0);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(O(t,!1),t.strm.avail_out===0))return 1}else if(t.match_available){if(i=ut(t,0,t.window[t.strstart-1]),i&&O(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=ut(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===rt?(O(t,!0),t.strm.avail_out===0?3:4):t.last_lit&&(O(t,!1),t.strm.avail_out===0)?1:2};function $(t,e,n,i,r){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=r}const Pt=[new $(0,0,0,0,((t,e)=>{let n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ft(t),t.lookahead===0&&e===pt)return 1;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;const i=t.block_start+n;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,O(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-262&&(O(t,!1),t.strm.avail_out===0))return 1}return t.insert=0,e===rt?(O(t,!0),t.strm.avail_out===0?3:4):(t.strstart>t.block_start&&(O(t,!1),t.strm.avail_out),1)})),new $(4,4,8,4,me),new $(4,5,16,8,me),new $(4,6,32,32,me),new $(4,4,16,16,vt),new $(8,16,32,32,vt),new $(8,16,128,128,vt),new $(8,32,128,256,vt),new $(32,128,258,1024,vt),new $(32,258,258,4096,vt)];function rr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=te,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),st(this.dyn_ltree),st(this.dyn_dtree),st(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),st(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),st(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Bn=t=>{if(!t||!t.state)return it(t,L);t.total_in=t.total_out=0,t.data_type=nr;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=e.wrap===2?0:1,e.last_flush=pt,Ji(e),K},Un=t=>{const e=Bn(t);var n;return e===K&&((n=t.state).window_size=2*n.w_size,st(n.head),n.max_lazy_match=Pt[n.level].max_lazy,n.good_match=Pt[n.level].good_length,n.nice_match=Pt[n.level].nice_length,n.max_chain_length=Pt[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},ln=(t,e,n,i,r,s)=>{if(!t)return L;let a=1;if(e===Yi&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||n!==te||i<8||i>15||e<0||e>9||s<0||s>tr)return it(t,L);i===8&&(i=9);const o=new rr;return t.state=o,o.strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=s,o.method=n,Un(t)};var Ot={deflateInit:(t,e)=>ln(t,e,te,15,8,er),deflateInit2:ln,deflateReset:Un,deflateResetKeep:Bn,deflateSetHeader:(t,e)=>t&&t.state?t.state.wrap!==2?L:(t.state.gzhead=e,K):L,deflate:(t,e)=>{let n,i;if(!t||!t.state||e>sn||e<0)return t?it(t,L):L;const r=t.state;if(!t.output||!t.input&&t.avail_in!==0||r.status===666&&e!==rt)return it(t,t.avail_out===0?ge:L);r.strm=t;const s=r.last_flush;if(r.last_flush=e,r.status===42)if(r.wrap===2)t.adler=0,C(r,31),C(r,139),C(r,8),r.gzhead?(C(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),C(r,255&r.gzhead.time),C(r,r.gzhead.time>>8&255),C(r,r.gzhead.time>>16&255),C(r,r.gzhead.time>>24&255),C(r,r.level===9?2:r.strategy>=Ht||r.level<2?4:0),C(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(C(r,255&r.gzhead.extra.length),C(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=tt(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(C(r,0),C(r,0),C(r,0),C(r,0),C(r,0),C(r,r.level===9?2:r.strategy>=Ht||r.level<2?4:0),C(r,3),r.status=113);else{let a=te+(r.w_bits-8<<4)<<8,o=-1;o=r.strategy>=Ht||r.level<2?0:r.level<6?1:r.level===6?2:3,a|=o<<6,r.strstart!==0&&(a|=32),a+=31-a%31,r.status=113,It(r,a),r.strstart!==0&&(It(r,t.adler>>>16),It(r,65535&t.adler)),t.adler=1}if(r.status===69)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),et(t),n=r.pending,r.pending!==r.pending_buf_size));)C(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(r.status===73)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),et(t),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}i=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,C(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),i===0&&(r.gzindex=0,r.status=91)}else r.status=91;if(r.status===91)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),et(t),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}i=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,C(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=tt(t.adler,r.pending_buf,r.pending-n,n)),i===0&&(r.status=103)}else r.status=103;if(r.status===103&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&et(t),r.pending+2<=r.pending_buf_size&&(C(r,255&t.adler),C(r,t.adler>>8&255),t.adler=0,r.status=113)):r.status=113),r.pending!==0){if(et(t),t.avail_out===0)return r.last_flush=-1,K}else if(t.avail_in===0&&an(e)<=an(s)&&e!==rt)return it(t,ge);if(r.status===666&&t.avail_in!==0)return it(t,ge);if(t.avail_in!==0||r.lookahead!==0||e!==pt&&r.status!==666){let a=r.strategy===Ht?((o,l)=>{let u;for(;;){if(o.lookahead===0&&(ft(o),o.lookahead===0)){if(l===pt)return 1;break}if(o.match_length=0,u=ut(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,u&&(O(o,!1),o.strm.avail_out===0))return 1}return o.insert=0,l===rt?(O(o,!0),o.strm.avail_out===0?3:4):o.last_lit&&(O(o,!1),o.strm.avail_out===0)?1:2})(r,e):r.strategy===Qi?((o,l)=>{let u,h,d,p;const f=o.window;for(;;){if(o.lookahead<=258){if(ft(o),o.lookahead<=258&&l===pt)return 1;if(o.lookahead===0)break}if(o.match_length=0,o.lookahead>=3&&o.strstart>0&&(d=o.strstart-1,h=f[d],h===f[++d]&&h===f[++d]&&h===f[++d])){p=o.strstart+258;do;while(h===f[++d]&&h===f[++d]&&h===f[++d]&&h===f[++d]&&h===f[++d]&&h===f[++d]&&h===f[++d]&&h===f[++d]&&d<p);o.match_length=258-(p-d),o.match_length>o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=3?(u=ut(o,1,o.match_length-3),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(u=ut(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),u&&(O(o,!1),o.strm.avail_out===0))return 1}return o.insert=0,l===rt?(O(o,!0),o.strm.avail_out===0?3:4):o.last_lit&&(O(o,!1),o.strm.avail_out===0)?1:2})(r,e):Pt[r.level].func(r,e);if(a!==3&&a!==4||(r.status=666),a===1||a===3)return t.avail_out===0&&(r.last_flush=-1),K;if(a===2&&(e===$i?Zi(r):e!==sn&&(Hi(r,0,0,!1),e===Ki&&(st(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),et(t),t.avail_out===0))return r.last_flush=-1,K}return e!==rt?K:r.wrap<=0?on:(r.wrap===2?(C(r,255&t.adler),C(r,t.adler>>8&255),C(r,t.adler>>16&255),C(r,t.adler>>24&255),C(r,255&t.total_in),C(r,t.total_in>>8&255),C(r,t.total_in>>16&255),C(r,t.total_in>>24&255)):(It(r,t.adler>>>16),It(r,65535&t.adler)),et(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?K:on)},deflateEnd:t=>{if(!t||!t.state)return L;const e=t.state.status;return e!==42&&e!==69&&e!==73&&e!==91&&e!==103&&e!==113&&e!==666?it(t,L):(t.state=null,e===113?it(t,Gi):K)},deflateSetDictionary:(t,e)=>{let n=e.length;if(!t||!t.state)return L;const i=t.state,r=i.wrap;if(r===2||r===1&&i.status!==42||i.lookahead)return L;if(r===1&&(t.adler=kn(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){r===0&&(st(i.head),i.strstart=0,i.block_start=0,i.insert=0);let l=new Uint8Array(i.w_size);l.set(e.subarray(n-i.w_size,n),0),e=l,n=i.w_size}const s=t.avail_in,a=t.next_in,o=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,ft(i);i.lookahead>=3;){let l=i.strstart,u=i.lookahead-2;do i.ins_h=ht(i,i.ins_h,i.window[l+3-1]),i.prev[l&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=l,l++;while(--u);i.strstart=l,i.lookahead=2,ft(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=a,t.input=o,t.avail_in=s,i.wrap=r,K},deflateInfo:"pako deflate (from Nodeca project)"};const sr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var or=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const i in n)sr(n,i)&&(t[i]=n[i])}}return t},ar=t=>{let e=0;for(let i=0,r=t.length;i<r;i++)e+=t[i].length;const n=new Uint8Array(e);for(let i=0,r=0,s=t.length;i<s;i++){let a=t[i];n.set(a,r),r+=a.length}return n};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const Re=new Uint8Array(256);for(let t=0;t<256;t++)Re[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Re[254]=Re[254]=1;var Mn=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,i,r,s,a=t.length,o=0;for(r=0;r<a;r++)n=t.charCodeAt(r),(64512&n)==55296&&r+1<a&&(i=t.charCodeAt(r+1),(64512&i)==56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(o),s=0,r=0;s<o;r++)n=t.charCodeAt(r),(64512&n)==55296&&r+1<a&&(i=t.charCodeAt(r+1),(64512&i)==56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},lr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const zn=Object.prototype.toString,{Z_NO_FLUSH:ur,Z_SYNC_FLUSH:hr,Z_FULL_FLUSH:cr,Z_FINISH:dr,Z_OK:ee,Z_STREAM_END:fr,Z_DEFAULT_COMPRESSION:pr,Z_DEFAULT_STRATEGY:gr,Z_DEFLATED:mr}=An;function Gt(t){this.options=or({level:pr,method:mr,chunkSize:16384,windowBits:15,memLevel:8,strategy:gr},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new lr,this.strm.avail_out=0;let n=Ot.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==ee)throw new Error(Qt[n]);if(e.header&&Ot.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(i=typeof e.dictionary=="string"?Mn(e.dictionary):zn.call(e.dictionary)==="[object ArrayBuffer]"?new Uint8Array(e.dictionary):e.dictionary,n=Ot.deflateSetDictionary(this.strm,i),n!==ee)throw new Error(Qt[n]);this._dict_set=!0}}function br(t,e){const n=new Gt(e);if(n.push(t,!0),n.err)throw n.msg||Qt[n.err];return n.result}Gt.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(s=e===~~e?e:e===!0?dr:ur,typeof t=="string"?n.input=Mn(t):zn.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(n.avail_out===0&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(s===hr||s===cr)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(r=Ot.deflate(n,s),r===fr)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=Ot.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ee;if(n.avail_out!==0){if(s>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(n.avail_in===0)break}else this.onData(n.output)}return!0},Gt.prototype.onData=function(t){this.chunks.push(t)},Gt.prototype.onEnd=function(t){t===ee&&(this.result=ar(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var vr={deflate:br};const{deflate:yr}=vr;var Sr=yr;const be=class{constructor(t){this.oOptions=Object.assign({iPort:-1,cbConnectSuccess:null,cbConnectError:null,cbConnectClose:null},t),this.szHost="http://127.0.0.1",this.szUUID="",this.szVersion="",this.bNormalClose=!1,this.bConnected=!1,this.bInitConnect=!0,this.iGetErrorCount=0,this.oWindowControlCallback={},this.oSadpCallback={},this.oSliceCallback={},this.oSerialCallback={},this.oUIControlCallback={},this.oUpgradeCallback={},this.init()}init(){const t=this,e=at(),n={sequence:e,cmd:"system.connect"},i=JSON.stringify(n);t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,i,e,{success(r){const s=JSON.parse(r);t.szUUID=s.uuid,t.szVersion=s.version,t.bConnected=!0,t.bInitConnect=!1,setTimeout((()=>{t.imageHttpPolling()}),100),t.oOptions.cbConnectSuccess&&t.oOptions.cbConnectSuccess()},error(){}})}sendImageHttp(t,e,n,i){const r=this;i=Object.assign({success:null,error:null,abort:null},i);let s=Sr(e);new Uint8Array().toString()!==""&&(m.isMacOS()||m.browser().msie)&&(s=Array.prototype.slice.call(s));const a=encodeURIComponent(btoa(s)),o=this.splitStr(a),l=[];let u="";for(let h=0,d=o.length;h<d;h++)u=h===d-1?`update=${new Date().getTime()}&isLast=true&data=${o[h]}&sequence=${n}`:`update=${new Date().getTime()}&isLast=false&data=${o[h]}&sequence=${n}`,l.push(u);if(l.length>0){const h=function(){r.imageHttp(`${t}?${l[0]}`,{success(d){l.shift(),l.length>0?(r.bInitConnect||r.bConnected)&&h():i.success&&i.success(d)},error(){i.error&&i.error()},abort(){i.abort&&i.abort()}})};h()}}splitStr(t){const e=this.getByteLen(t),n=[],i=1500;for(let r=0,s=Math.ceil(e/i);r<s;r++)n[r]=t.slice(i*r,i*(r+1));return n}getByteLen(t){let e=0,n="";for(let i=0,r=t.length;i<r;i++)n=t.charAt(i),/[^\x00-\xff]/.test(n)?e+=2:e+=1;return e}imageHttp(t,e){e=Object.assign({success:null,error:null,abort:null},e);const n=new Image;n.onload=function(){if(e.success){const i=document.createElement("canvas"),r=i.getContext("2d"),s=n.width,a=n.height;i.width=s,i.height=a;try{r.drawImage(n,0,0);const o=r.getImageData(0,0,s,a).data;let l="",u=-1;for(let h=a-1;h>=0;h--)for(let d=0;d<4*s&&(u=h*s*4+d,o[u]!==0);d++)o[u]!==255&&(l+=String.fromCharCode(o[u]));e.success(m.utf8to16(l))}catch{e.error&&e.error()}}},n.onerror=function(){e.error&&e.error()},n.onabort=function(){e.abort&&e.abort()},n.crossOrigin="anonymous",n.src=t}setWindowControlCallback(t){this.oWindowControlCallback=t}setSadpCallback(t){this.oSadpCallback=t}setSliceCallback(t){this.oSliceCallback=t}setSerialCallback(t){this.oSerialCallback=t}setUIControlCallback(t){this.oUIControlCallback=t}setUpgradeCallback(t){this.oUpgradeCallback=t}getServiceVersion(){return this.szVersion}getRequestUUID(){return this.szUUID}disconnect(){const t=this,e=at(),n={sequence:e,uuid:t.szUUID,cmd:"system.disconnect"},i=JSON.stringify(n);t.bConnected&&t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,i,e,{success(){t.bNormalClose=!0,t.bConnected=!1,t.oOptions.cbConnectClose&&t.oOptions.cbConnectClose(t.bNormalClose)},error(){t.bConnected=!1}})}imageHttpPolling(){const t=this,e=at(),n={sequence:e,uuid:t.szUUID,cmd:"system.get"},i=JSON.stringify(n);t.bConnected&&t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,i,e,{success(r){if(t.iGetErrorCount=0,r==="timeout")setTimeout((()=>{t.imageHttpPolling()}),100);else if(r==="invalid")t.bConnected=!1,t.oOptions.cbConnectError&&t.oOptions.cbConnectError();else if(r==="closed")console.log("connected is disconnected");else{const s=JSON.parse(r);s.cmd!==void 0?t.parseCmd(s):console.log(`[jsWebControl]imgHttpPolling push message error:${r}`),setTimeout((()=>{t.imageHttpPolling()}),100)}},error(){t.iGetErrorCount===5?(console.log("[jsWebControl]imageHttpPolling get polling finished"),t.bNormalClose=!1,t.bConnected=!1,t.oOptions.cbConnectClose&&t.oOptions.cbConnectClose(t.bNormalClose)):setTimeout((()=>{console.log("[jsWebControl]imgHttpPolling get polling failed"),t.iGetErrorCount++,t.imageHttpPolling()}),100)}})}sendRequest(t){const e=this;return new Promise(((n,i)=>{const r=t.cmd.split(".");let s="";r.length>1?s=r[0]==="laputa"?"laputa":"local":i();const a=at();t.sequence=a,t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const o=JSON.stringify(t);e.bConnected?e.sendImageHttp(`${e.szHost}:${e.oOptions.iPort}/imghttp/${s}`,o,a,{success(l){const u=JSON.parse(l);u.errorModule===0&&u.errorCode===0?n(u):i(u)},error(){i()}}):i()}))}parseCmd(t){const e=t.cmd.split("."),n=e[1].replace(/^[a-z]{1}/g,(i=>i.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${n}`]&&this.oWindowControlCallback[`cb${n}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${n}`]&&this.oSadpCallback[`cb${n}`](t):e[0]==="serial"?this.oSerialCallback[`cb${n}`]&&this.oSerialCallback[`cb${n}`](t):e[0]==="slice"?this.oSliceCallback[`cb${n}`]&&this.oSliceCallback[`cb${n}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${n}`]&&this.oUIControlCallback[`cb${n}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${n}`]&&this.oUpgradeCallback[`cb${n}`](t)}},wr=class{constructor(t){this.oOptions=Object.assign({szPluginContainer:"",iPort:-1,cbConnectSuccess:null,cbConnectError:null,cbConnectClose:null,szClassId:""},t),this.oPlugin=null,this.szPluginId="",this.szUUID="",this.szVersion="",this.oRequestList={},this.bNormalClose=!1,this.aMessage=[],this.oWindowControlCallback={},this.oSadpCallback={},this.oSliceCallback={},this.oSerialCallback={},this.oUIControlCallback={},this.oUpgradeCallback={},this.init()}init(){const t=this;t.initPlugin(),t.oPlugin.object&&t.oPlugin.createSocket(`ws://127.0.0.1:${t.oOptions.iPort}`)}initPlugin(){const t=this;this.szPluginId=`webActiveX_${new Date().getTime()}`;const e=`<object id='${this.szPluginId}' classid='clsid:${t.oOptions.szClassId}' codebase='' standby='Waiting...' width='100%' height='100%' align='center' ></object>`;let{szPluginContainer:n}=t.oOptions;if(n===""){n=`${this.szPluginId}_div`;const i=document.createElement("div");i.id=n,document.body.parentNode.appendChild(i)}document.getElementById(n).innerHTML=e,t.oPlugin=document.getElementById(this.szPluginId),window.onConnectMessage=function(i,r){r?(t.aMessage.push(i),t.onConnectMessage(t.aMessage.join("")),t.aMessage.length=0):t.aMessage.push(i)},window.onConnectClose=function(){t.onConnectClose()},window.onConnectError=function(){t.onConnectError()},window.onConnectCloseException=function(){t.onConnectCloseException()},window.onConnectOpen=function(){t.onConnectOpen()},m.createEventScript(this.szPluginId,"onConnectMessage(szData, bLast)","onConnectMessage(szData, bLast);"),m.createEventScript(this.szPluginId,"onConnectClose()","onConnectClose();"),m.createEventScript(this.szPluginId,"onConnectError()","onConnectError();"),m.createEventScript(this.szPluginId,"onConnectCloseException()","onConnectCloseException();"),m.createEventScript(this.szPluginId,"onConnectOpen()","onConnectOpen();")}onConnectMessage(t){const e=this;if(t){const n=JSON.parse(t),i=n.sequence;i===void 0&&n.cmd===void 0?(e.szUUID=n.uuid,e.szVersion=n.version,e.oOptions.cbConnectSuccess&&e.oOptions.cbConnectSuccess()):n.cmd!==void 0?e.parseCmd(n):e.oRequestList[i]!==void 0&&(n.errorModule===0&&n.errorCode===0?e.oRequestList[i].resolve(n):e.oRequestList[i].reject(n),delete e.oRequestList[i])}}onConnectClose(){if(this.oPlugin=null,this.szPluginId!==""){const t=document.getElementById(this.szPluginId);t.parentNode.removeChild(t);const e=document.getElementById(`${this.szPluginId}_div`);e!==null&&e.parentNode.removeChild(e)}this.oOptions.cbConnectClose&&this.oOptions.cbConnectClose(this.bNormalClose)}onConnectCloseException(){const t=this;setTimeout((()=>{t.oPlugin.object&&t.oPlugin.closeSocket()}),1e3)}onConnectOpen(){const t={sequence:at(),cmd:"system.connect"},e=JSON.stringify(t);this.oPlugin.object&&this.oPlugin.sendRequest(e)}onConnectError(){}setWindowControlCallback(t){this.oWindowControlCallback=t}setSadpCallback(t){this.oSadpCallback=t}setSliceCallback(t){this.oSliceCallback=t}setSerialCallback(t){this.oSerialCallback=t}setUIControlCallback(t){this.oUIControlCallback=t}setUpgradeCallback(t){this.oUpgradeCallback=t}getServiceVersion(){return this.szVersion}getRequestUUID(){return this.szUUID}disconnect(){this.bNormalClose=!0,this.oPlugin&&this.oPlugin.object&&this.oPlugin.closeSocket()}sendRequest(t){const e=this;return t.cmd==="window.hideWnd"?e.oPlugin&&e.oPlugin.object&&(e.oPlugin.style.visibility="hidden"):t.cmd==="window.showWnd"&&e.oPlugin&&e.oPlugin.object&&(e.oPlugin.style.visibility="visible"),new Promise(((n,i)=>{const r=at();t.sequence=r,e.oRequestList[r]={resolve:n,reject:i},t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const s=JSON.stringify(t);e.oPlugin&&e.oPlugin.object?e.oPlugin.sendRequest(s):i()}))}parseCmd(t){const e=t.cmd.split("."),n=e[1].replace(/^[a-z]{1}/g,(i=>i.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${n}`]&&this.oWindowControlCallback[`cb${n}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${n}`]&&this.oSadpCallback[`cb${n}`](t):e[0]==="serial"?this.oSerialCallback[`cb${n}`]&&this.oSerialCallback[`cb${n}`](t):e[0]==="slice"?this.oSliceCallback[`cb${n}`]&&this.oSliceCallback[`cb${n}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${n}`]&&this.oUIControlCallback[`cb${n}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${n}`]&&this.oUpgradeCallback[`cb${n}`](t)}},_r=class{constructor(t){this.oOptions=Object.assign({szPluginContainer:"",cbConnectSuccess:null,cbConnectError:null,cbConnectClose:null,iServicePortStart:-1,iServicePortEnd:-1,szClassId:""},t),this.iPort=-1,this.oRequest=null,this.bInit=!1,this.oCallbacks={},this.init()}init(){const t=this;m.detectPort(t.oOptions.iServicePortStart,t.oOptions.iServicePortEnd,{success(e){if(t.iPort=e,m.browser().msie)m.browser().version==="11.0"?window.location.protocol==="https:"?t.oRequest=new be({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}):t.oRequest=new he({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}):t.oRequest=new wr({szPluginContainer:t.oOptions.szPluginContainer,iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose,szClassId:t.oOptions.szClassId});else if(window.location.protocol==="https:")if(m.browser().chrome||m.browser().mozilla)try{t.oRequest=new he({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose})}catch{t.oRequest=new be({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose})}else t.oRequest=new be({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose});else"WebSocket"in window&&(t.oRequest=new he({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}));t.bInit=!0;for(const n in t.oCallbacks)t.oRequest[n](t.oCallbacks[n])},error(){t.oOptions.cbConnectError&&t.oOptions.cbConnectError()}})}setWindowControlCallback(t){this.bInit?this.oRequest.setWindowControlCallback(t):this.oCallbacks.setWindowControlCallback=t}setSadpCallback(t){this.bInit?this.oRequest.setSadpCallback(t):this.oCallbacks.setSadpCallback=t}setSliceCallback(t){this.bInit?this.oRequest.setSliceCallback(t):this.oCallbacks.setSliceCallback=t}setSerialCallback(t){this.bInit?this.oRequest.setSerialCallback(t):this.oCallbacks.setSerialCallback=t}setUIControlCallback(t){this.bInit?this.oRequest.setUIControlCallback(t):this.oCallbacks.setUIControlCallback=t}setUpgradeCallback(t){this.bInit?this.oRequest.setUpgradeCallback(t):this.oCallbacks.setUpgradeCallback=t}getServiceVersion(){return this.oRequest.getServiceVersion()}getRequestUUID(){return this.oRequest.getRequestUUID()}startService(t,e){const n={cmd:"system.startService",type:t};return e!==void 0&&(n.options=e),this.oRequest.sendRequest(n)}stopService(t){const e=this;return new Promise(((n,i)=>{e.oRequest!==null?e.oRequest.sendRequest({cmd:"system.stopService",type:t}).then((r=>{n(r)}),(r=>{i(r)})):i()}))}disconnect(){const t=this;return new Promise(((e,n)=>{t.oRequest!==null?(t.oRequest.disconnect(),e("cbConnectClose callback is really success")):n()}))}openDirectory(t){return this.oRequest.sendRequest({cmd:"system.openDirectory",path:t})}openFile(t,e,n){return this.oRequest.sendRequest({cmd:"system.openFile",path:t,relative:e,version:n})}selectDirectory(t,e){const n=this;return new Promise(((i,r)=>{n.oRequest!==null?n.oRequest.sendRequest({cmd:"system.selectDirectory",caption:t!==void 0&&t!==""?m.Base64().encode(t):"",dir:e!==void 0&&e!==""?m.Base64().encode(e):""}).then((s=>{s.path!==""&&(s.path=m.Base64().decode(s.path)),i(s)}),(s=>{r(s)})):r()}))}selectFile(t,e,n){const i=this;return new Promise(((r,s)=>{i.oRequest!==null?i.oRequest.sendRequest({cmd:"system.selectFile",caption:t!==""?m.Base64().encode(t):"",dir:e!==""?m.Base64().encode(e):"",filter:n}).then((a=>{a.path!==""&&(a.path=m.Base64().decode(a.path)),r(a)}),(a=>{s(a)})):s()}))}getLocalConfig(t){return this.oRequest.sendRequest({cmd:"system.getLocalConfig",default:t})}setLocalConfig(t){return t.cmd="system.setLocalConfig",this.oRequest.sendRequest(t)}createWnd(t,e,n,i,r,s,a,o=""){return this.oRequest.sendRequest({cmd:"window.createWnd",rect:{left:t,top:e,width:n,height:i},className:r,embed:s,activeXParentWnd:a,HWND:o})}showWnd(){return this.oRequest.sendRequest({cmd:"window.showWnd"})}hideWnd(){return this.oRequest.sendRequest({cmd:"window.hideWnd"})}destroyWnd(){const t=this;return new Promise(((e,n)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"window.destroyWnd"}).then((i=>{e(i)}),(i=>{n(i)})):n()}))}setWndGeometry(t,e,n,i){return this.oRequest.sendRequest({cmd:"window.setWndGeometry",rect:{left:t,top:e,width:n,height:i}})}setWndCover(t,e){const n=this;return new Promise(((i,r)=>{n.oRequest!==null?n.oRequest.sendRequest({cmd:"window.setWndCover",position:t,size:e}).then((s=>{i(s)}),(s=>{r(s)})):r()}))}cuttingPartWindow(t,e,n,i,r){const s=this;return new Promise(((a,o)=>{s.oRequest!==null?s.oRequest.sendRequest({cmd:"window.cuttingPartWindow",rect:{left:t,top:e,width:n,height:i},round:r}).then((l=>{a(l)}),(l=>{o(l)})):o()}))}repairPartWindow(t,e,n,i,r){const s=this;return new Promise(((a,o)=>{s.oRequest!==null?s.oRequest.sendRequest({cmd:"window.repairPartWindow",rect:{left:t,top:e,width:n,height:i},round:r}).then((l=>{a(l)}),(l=>{o(l)})):o()}))}setWndZOrder(t){return this.oRequest.sendRequest({cmd:"window.setWndZOrder",flag:t})}changePlayMode(t){return this.oRequest.sendRequest({cmd:"window.changePlayMode",type:t})}setLanguageType(t){return this.oRequest.sendRequest({cmd:"window.setLanguageType",type:t})}initLoginInfo(t){return this.oRequest.sendRequest({cmd:"window.initLoginInfo",vsmAddress:t.vsmAddress,vsmPort:t.vsmPort,sessionID:t.sessionID,loginModel:t.loginModel,userType:t.userType,networkType:t.networkType})}setTranslateFile(t){return this.oRequest.sendRequest({cmd:"window.setTranslateFile",url:t})}switchToSimple(t){return this.oRequest.sendRequest({cmd:"window.switchToSimple",simple:t})}setVsmToken(t){return this.oRequest.sendRequest({cmd:"play.setVsmToken",token:t})}startPlay(t,e,n,i,r,s,a,o,l){const u={cmd:"play.startPlay",url:t,username:e,password:n,siteID:i,areaName:m.Base64().encode(r),cameraName:m.Base64().encode(s),permission:a,wndIndex:o};return l!==void 0&&(u.options=l,u.options.siteName!==void 0&&(u.options.siteName=m.Base64().encode(u.options.siteName))),this.oRequest.sendRequest(u)}setPreview3DPosition(t){return this.oRequest.sendRequest({cmd:"play.setPreview3DPosition",open:t})}stopTotal(){const t=this;return new Promise(((e,n)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"play.stopTotal"}).then((i=>{e(i)}),(i=>{n(i)})):n()}))}setDragMode(t){return this.oRequest.sendRequest({cmd:"play.setDragMode",drag:t})}showErrorInfoInFullScreen(t){return this.oRequest.sendRequest({cmd:"play.showErrorInfoInFullScreen",error:m.Base64().encode(t)})}setNumberOfWindows(t){return this.oRequest.sendRequest({cmd:"play.setNumberOfWindows",number:t})}initCardReader(t){return this.oRequest.sendRequest({cmd:"serial.ACSInitCardReader",param:t})}unInitCardReader(){return this.oRequest.sendRequest({cmd:"serial.ACSUnInitCardReader"})}startAutoMode(){return this.oRequest.sendRequest({cmd:"serial.ACSStartAutoMode"})}stopAutoMode(){return this.oRequest.sendRequest({cmd:"serial.ACSStopAutoMode"})}initFingerprint(t){return this.oRequest.sendRequest({cmd:"serial.ACSInitFingerprint",param:t})}unInitFingerprint(){return this.oRequest.sendRequest({cmd:"serial.ACSUnInitFingerprint"})}startCollectFingerprint(){return this.oRequest.sendRequest({cmd:"serial.ACSStartCollectFingerprint"})}stopCollectFingerprint(){return this.oRequest.sendRequest({cmd:"serial.ACSStopCollectFingerprint"})}isCollectingFingerprint(){return this.oRequest.sendRequest({cmd:"serial.ACSIsCollectingFingerprint"})}initVideocapture(t){return t.majorTitle=m.Base64().encode(t.majorTitle),t.tip=m.Base64().encode(t.tip),t.captureBtnTxt=m.Base64().encode(t.captureBtnTxt),t.USBRemovedTip=m.Base64().encode(t.USBRemovedTip),this.oRequest.sendRequest({cmd:"serial.ACSStartCollectImage",param:t})}unInitVideocapture(){return this.oRequest.sendRequest({cmd:"serial.ACSStopCollectImage"})}registerDeviceType(t){return this.oRequest.sendRequest({cmd:"sadp.registDeviceType",deviceType:t})}activeOnlineDevice(t,e){return this.oRequest.sendRequest({cmd:"sadp.activeDevice",serialNumber:t,password:e})}refreshDeviceList(){return this.oRequest.sendRequest({cmd:"sadp.refreshDeviceList"})}modifyDeviceNetParam(t,e,n,i,r,s,a){return this.oRequest.sendRequest({cmd:"sadp.modifyDeviceParam",macAddress:t,password:e,ipv4Address:n,ipv4Gateway:i,ipv4SubnetMask:r,port:s,httpPort:a})}exportKeyFile(t){return this.oRequest.sendRequest({cmd:"sadp.exportKeyFile",serialNumber:t})}importKeyFile(){return this.oRequest.sendRequest({cmd:"sadp.importKeyFile"})}resetPassword(t,e,n,i){return this.oRequest.sendRequest({cmd:"sadp.resetPassword",serialNumber:t,password:e,importFileData:n,szCode:i})}uploadPicture(t){return this.oRequest.sendRequest({cmd:"slice.uploadPicture",path:m.Base64().encode(t)})}showSelectMenu(t,e,n,i,r){return this.oRequest.sendRequest({cmd:"ui.showSelectMenu",items:r,rect:{left:t,top:e,width:n,height:i}})}hideSelectMenu(){return this.oRequest.sendRequest({cmd:"ui.hideSelectMenu"})}destroySelectMenu(){const t=this;return new Promise(((e,n)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"ui.destroySelectMenu"}).then((i=>{e(i)}),(i=>{n(i)})):n()}))}deviceConfig(t){return this.oRequest.sendRequest({cmd:"laputa.encodingDevice",param:t})}cloudStorageConfig(t){return this.oRequest.sendRequest({cmd:"laputa.cloudStorage",param:t})}ezvizRemoteConfig(t){return this.oRequest.sendRequest({cmd:"laputa.ezvizRemote",param:t})}showAlarmInfoInFullScreen(t,e,n){return this.oRequest.sendRequest({cmd:"window.showAlarmInfoInFullScreen",alarmTitle:t,alarmMessage:e,alarmId:n})}updateParentWnd(){return this.oRequest.sendRequest({cmd:"window.updateParentWnd"})}restoreWnd(){return this.oRequest.sendRequest({cmd:"window.restoreWnd"})}setImmediatePlaybackTime(t){return this.oRequest.sendRequest({cmd:"play.setImmediatePlaybackTime",specifyTime:t})}setDrawStatus(t){return this.oRequest.sendRequest({cmd:"draw.setDrawStatus",enable:t})}clearRegion(){return this.oRequest.sendRequest({cmd:"draw.clearRegion"})}setDrawShapeInfo(t,e){return this.oRequest.sendRequest({cmd:"draw.setDrawShapeInfo",drawType:t,drawInfo:e})}setGridInfo(t){return this.oRequest.sendRequest({cmd:"draw.setGridInfo",gridInfo:t})}getGridInfo(){return this.oRequest.sendRequest({cmd:"draw.getGridInfo"})}setPolygonInfo(t){return this.oRequest.sendRequest({cmd:"draw.setPolygonInfo",polygonInfo:t})}getPolygonInfo(){return this.oRequest.sendRequest({cmd:"draw.getPolygonInfo"})}setLineInfo(t){return this.oRequest.sendRequest({cmd:"draw.setLineInfo",lineInfo:t})}getLineInfo(){return this.oRequest.sendRequest({cmd:"draw.getLineInfo"})}setRectInfo(t){return this.oRequest.sendRequest({cmd:"draw.setRectInfo",rectInfo:t})}getRectInfo(){return this.oRequest.sendRequest({cmd:"draw.getRectInfo"})}clearShapeByType(t){return this.oRequest.sendRequest({cmd:"draw.clearShapeByType",type:t})}sensitiveEncrypt(t,e,n){const i={cmd:"laputa.sensitiveEncrypt",encryptType:t,encryptField:e};return n!==void 0&&(i.options=n),this.oRequest.sendRequest(i)}sendRequest(t){return this.oRequest.sendRequest(t)}requestInterface(t){const e={cmd:"window.requestInterface"};return e.requestParams=t,this.oRequest.sendRequest(e)}stopPlay(t){return t===void 0&&(t=-1),this.oRequest.sendRequest({cmd:"play.stopPlay",wndIndex:t})}showRemoteConfig(t){const e=this;return t.cmd="config.showRemoteConfig",new Promise(((n,i)=>{e.oRequest!==null?e.oRequest.sendRequest(t).then((r=>{n(r)}),(r=>{i(r)})):i()}))}video2Picture(){const t={cmd:"window.video2Picture"};return this.oRequest.sendRequest(t)}picture2Video(){const t={cmd:"window.picture2Video"};return this.oRequest.sendRequest(t)}ptzControl(t){return this.oRequest.sendRequest({cmd:"laputa.ptzControl",param:t})}simMouseClickEvent(t,e){return this.oRequest.sendRequest({cmd:"window.simMouseClickEvent",pointX:t,pointY:e})}us_SetMaxJobCount(t){return this.oRequest.sendRequest({cmd:"upgrade.setMaxJobCount",xml:t})}us_GetMaxJobCount(){return this.oRequest.sendRequest({cmd:"upgrade.getMaxJobCount"})}us_AddSchedule(t){return this.oRequest.sendRequest({cmd:"upgrade.addSchedule",xml:m.Base64().encode(t)})}us_DelSchedule(t){return this.oRequest.sendRequest({cmd:"upgrade.delSchedule",scheduleId:t})}us_GetScheduleList(t){const e=this;return new Promise(((n,i)=>{e.oRequest!==null?e.oRequest.sendRequest({cmd:"upgrade.getScheduleList",xml:t}).then((r=>{r.xml!==""&&(r.xml=m.Base64().decode(r.xml)),n(r)}),(r=>{i(r)})):i()}))}us_GetSchedule(t,e){const n=this;return new Promise(((i,r)=>{n.oRequest!==null?n.oRequest.sendRequest({cmd:"upgrade.getSchedule",xml:e,scheduleId:t}).then((s=>{s.xml!==""&&(s.xml=m.Base64().decode(s.xml)),i(s)}),(s=>{r(s)})):r()}))}us_UpgradeAction(t,e){return this.oRequest.sendRequest({cmd:"upgrade.upgradeAction",xml:e,scheduleId:t})}us_CheckUpgradeableDevice(t){return this.oRequest.sendRequest({cmd:"upgrade.checkUpgradeableDevice",param:t})}us_CheckUpgradeableDeviceList(t){return this.oRequest.sendRequest({cmd:"upgrade.checkUpgradeableDeviceList",param:t})}us_IsRunningAsyCheckUpgradeable(){return this.oRequest.sendRequest({cmd:"upgrade.isRunningAsyCheckUpgradeable"})}us_StopAsyCheckUpgradeable(){return this.oRequest.sendRequest({cmd:"upgrade.stopAsyCheckUpgradeable"})}getFishEyePTZPreset(t){return this.oRequest.sendRequest({cmd:"play.getFishEyePTZPreset",wndIndex:t})}setFishEyePTZPreset(t,e,n){return this.oRequest.sendRequest({cmd:"play.setFishEyePTZPreset",wndIndex:t,command:e,presetInfo:n})}controlFishEyePTZ(t,e,n,i){return this.oRequest.sendRequest({cmd:"play.controlFishEyePTZ",wndIndex:t,command:e,stop:n,speed:i})}controlFishEyeParol(t,e,n){return this.oRequest.sendRequest({cmd:"play.controlFishEyeParol",wndIndex:t,command:e,cruisePointList:n})}setFirstDayOfWeek(t){return this.oRequest.sendRequest({cmd:"window.setFirstDayOfWeek",firstDay:t})}setEhomePlayInfo(t,e,n,i,r,s){return this.oRequest.sendRequest({cmd:"play.setEhomePlayInfo",guid:t,protocal:e,session:n,token:i,ip:r,port:s})}startPlayPatch(t){if(t.length>0)for(let e=0,n=t.length;e<n;e++)t[e].areaName=m.Base64().encode(t[e].areaName),t[e].cameraName=m.Base64().encode(t[e].cameraName);return this.oRequest.sendRequest({cmd:"play.startPlayPatch",params:t})}grabOpen(){const t=this;return new Promise(((e,n)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"window.grabOpen"}).then((i=>{e(i)}),(i=>{n(i)})):n()}))}setWndAutoPanState(t,e){return this.oRequest.sendRequest({cmd:"play.setWndAutoPanState",wndIndex:t,open:e})}enablePrivileges(){return this.oRequest.sendRequest({cmd:"system.enablePrivileges"})}},Fn=class{constructor(t){const e=this;this.oOptions=Object.assign({szPluginContainer:"",cbConnectSuccess:null,cbConnectError:null,cbConnectClose:null,iServicePortStart:16960,iServicePortEnd:16969,szClassId:"55A7329E-FAAD-439a-87BC-75BAB3332E7C"},t),this.bFreeze=!1,this.bFocus=!0,this.bEmbed=m.getCreateWndMode(),this.szWndId="",this.iCreateWndTimer=-1,this.iUpdateParentWndTimer=-1,this.bDevTool=!1,this.iVCTimeStart=-1,this.iVCTimeEnd=-1,this.oWndCover={left:0,top:0,right:0,bottom:0},this.oDocOffset={left:0,top:0},this.szTitle="",this.oWindowAttr={outerWidth:0,innerWidth:0,outerHeight:0,innerHeight:0,screenTop:0,screenLeft:0,screenX:0,screenY:0},this.iFixedResizeTimer=-1,this.fVisibilityChange=function(){if(m.isMacOS())document.hidden?e.fHideWnd():e.fShowWnd();else if(document.hidden)e.iVCTimeStart=new Date().getTime(),e.fHideWnd();else{e.iVCTimeEnd=new Date().getTime();const n=m.browser();if(n.chrome||n.mozilla)if(e.iUpdateParentWndTimer>0&&(clearTimeout(e.iUpdateParentWndTimer),e.iUpdateParentWndTimer=-1),e.iVCTimeEnd-e.iVCTimeStart<100){const i=e.oRequest.getRequestUUID();ue(i,e.oOptions.cbSetDocTitle),e.iUpdateParentWndTimer=setTimeout((()=>{e.oRequest.updateParentWnd().then((()=>{Et(i,e.oOptions.cbUnsetDocTitle),e.bFreeze||e.bDevTool||e.fShowWnd()}),(()=>{Et(i,e.oOptions.cbUnsetDocTitle)}))}),100)}else e.bFreeze||e.bDevTool||e.fShowWnd();else e.bFreeze||e.bDevTool||e.fShowWnd()}},this.fHideWnd=function(){e.oRequest.hideWnd().then((()=>{}),(()=>{}))},this.fShowWnd=function(){e.oRequest.showWnd().then((()=>{}),(()=>{}))},this.fFocus=function(){e.bFocus=!0,setTimeout((()=>{e.removeGrabImage(),document.hidden||e.bFreeze||e.bDevTool||e.fShowWnd()}),200)},this.fBlur=function(){e.bFocus=!1},this.removeGrabImage=function(){if(!m.isMacOS()){let n=null;if(e.szWndId!==""&&(n=document.getElementById(e.szWndId),n)){const i=n.querySelectorAll('[data-name="wc-grab-open-image"]');Array.prototype.slice.call(i).forEach((r=>{r.parentNode.removeChild(r)}))}}},this.oRequest=new _r({szPluginContainer:this.oOptions.szPluginContainer,cbConnectSuccess:this.oOptions.cbConnectSuccess,cbConnectError:this.oOptions.cbConnectError,cbConnectClose(n){e.iCreateWndTimer>0&&(clearTimeout(e.iCreateWndTimer),e.iCreateWndTimer=-1),e.removeGrabImage(),e.oOptions.cbConnectClose&&e.oOptions.cbConnectClose(n)},iServicePortStart:this.oOptions.iServicePortStart,iServicePortEnd:this.oOptions.iServicePortEnd,szClassId:this.oOptions.szClassId})}JS_SetWindowControlCallback(t){const e=this,n={cbSelectWnd(i){t.cbSelectWnd&&t.cbSelectWnd(parseInt(i.wndIndex,10),i.cameraID,i.siteID,i.opendFisheye)},cbTogglePTZ(i){t.cbTogglePTZ&&t.cbTogglePTZ(i.cameraID,i.siteID)},cbUpdateCameraIcon(i){t.cbUpdateCameraIcon&&t.cbUpdateCameraIcon(i.cameraID,parseInt(i.playing,10),i.siteID)},cbGetLastError(i){t.cbGetLastError&&t.cbGetLastError(i.error,parseInt(i.type,10))},cbTalkUrlEmpty(i){t.cbTalkUrlEmpty&&t.cbTalkUrlEmpty(i.cameraID)},cbGotoPlayback(i){t.cbGotoPlayback&&t.cbGotoPlayback(i.cameraID,i.siteID)},cbShowDisplayInfo(i){t.cbShowDisplayInfo&&t.cbShowDisplayInfo(parseInt(i.videoWidth,10),parseInt(i.videoHeight,10),parseInt(i.frameRate,10))},cbPreviewWnd3DPostion(i){t.cbPreviewWnd3DPostion&&t.cbPreviewWnd3DPostion(parseInt(i.startX,10),parseInt(i.startY,10),parseInt(i.endX,10),parseInt(i.endY,10))},cbStopPlayAll(){t.cbStopPlayAll&&t.cbStopPlayAll()},cbWheelEvent(i){t.cbWheelEvent&&t.cbWheelEvent(parseInt(i.delta,10))},cbAlarmDetail(i){t.cbAlarmDetail&&t.cbAlarmDetail(i.alarmId)},cbQuitedFullScreen(){setTimeout((()=>{e.fShowWnd()}),100)},cbManuallyClose(i){t.cbManuallyClose&&t.cbManuallyClose(i.cameraID,i.siteID,parseInt(i.wndIndex,10))},cbIntegrationCallBack(i){t.cbIntegrationCallBack&&t.cbIntegrationCallBack(i)},cbChangeStorage(i){t.cbChangeStorage&&t.cbChangeStorage(parseInt(i.storageType,10),i.cameraID,i.siteID)},cbFisheyeExpandChanged(i){t.cbFisheyeExpandChanged&&t.cbFisheyeExpandChanged(i.cameraID,i.siteID,parseInt(i.wndIndex,10),i.open)},cbGetEhomePlayInfo(i){t.cbGetEhomePlayInfo&&t.cbGetEhomePlayInfo(i.siteID,i.guid)},cbWndPtzControl(i){t.cbWndPtzControl&&t.cbWndPtzControl(parseInt(i.wndIndex,10),i.cameraID,i.command,i.speed,i.stop)},cbMessageCallBack(i){i=i.data;const r=e.oRequest.getRequestUUID();i.type==="menuOpen"?e.szWndId!==""&&(document.getElementById(e.szWndId).innerHTML=`<img data-name='wc-grab-open-image' src='data:image/png;base64,${i.message.image}' width='100%' height='100%' />`):i.type==="changeTitle"?document.title.indexOf(r)===-1&&(e.szTitle=document.title,ue(r,e.oOptions.cbSetDocTitle),setTimeout((()=>{i.message==="updateParentWnd"?e.oRequest.updateParentWnd():i.message==="restoreWnd"&&e.oRequest.restoreWnd()}),300)):i.type==="changeTitleDone"?e.szTitle!==""&&Et(r,e.oOptions.cbUnsetDocTitle):i.type==="splitChange"?t.cbSplitChange&&t.cbSplitChange(i.message.splitType):i.type==="showMaximized"&&t.cbShowMaximized&&t.cbShowMaximized(i.message.showMax)}};this.oRequest.setWindowControlCallback(n)}JS_SetSadpCallback(t){const e={cbDeviceFind:null};Object.assign(e,t),this.oRequest.setSadpCallback(e)}JS_SetSliceCallback(t){const e={cbImageSliced(n){t.cbImageSliced&&(n.picName!==""&&(n.picName=m.Base64().decode(n.picName)),t.cbImageSliced(n))}};this.oRequest.setSliceCallback(e)}JS_SetSerialCallback(t){const e={cbCardFind(n){t.cbCardFind&&t.cbCardFind(n)},cbFingerFind(n){t.cbFingerFind&&t.cbFingerFind(n.fingerPrint,n.fingerQuality)},cbImageFind(n){t.cbImageFind&&t.cbImageFind(n.image)},cbImageErrorFind(n){t.cbImageErrorFind&&t.cbImageErrorFind(n.errorModule,n.errorCode)},cbImageWndVisibleFind(n){t.cbImageWndVisibleFind&&t.cbImageWndVisibleFind(n.visible)}};this.oRequest.setSerialCallback(e)}JS_SetUIControlCallback(t){const e={cbClickMenuItem(n){t.cbClickMenuItem&&t.cbClickMenuItem(n.itemIndex)},cbMenuMouseIn(){t.cbMenuMouseIn&&t.cbMenuMouseIn()},cbMenuMouseOut(){t.cbMenuMouseOut&&t.cbMenuMouseOut()}};this.oRequest.setUIControlCallback(e)}JS_SetUpgradeCallback(t){const e={cbCheckUpgrade(n){t.cbCheckUpgrade&&t.cbCheckUpgrade(n)}};this.oRequest.setUpgradeCallback(e)}JS_CheckVersion(t){let e=this.oRequest.getServiceVersion(),n=[],i=[];e!==""&&(e=e.replace(/,[\s]*/g,"."),n=e.split(".")),t!==""&&(i=(t=t.replace(/,[\s]*/g,".")).split("."));let r=!1;if(i.length===n.length){for(let s=0,a=n.length;s<a;s++)if(parseInt(i[s],10)!==parseInt(n[s],10)){if(parseInt(i[s],10)>parseInt(n[s],10)){r=!0;break}break}}return r}JS_StartService(t,e){return this.oRequest.startService(t,e)}JS_StopService(t){return this.oRequest.stopService(t)}JS_Disconnect(){return this.oRequest.disconnect()}JS_OpenDirectory(t){return this.oRequest.openDirectory(t)}JS_OpenFile(t,e,n){return this.oRequest.openFile(t,e,n)}JS_SelectDirectory(t,e){return this.oRequest.selectDirectory(t,e)}JS_SelectFile(t,e,n){return this.oRequest.selectFile(t,e,n)}JS_GetLocalConfig(t){return this.oRequest.getLocalConfig(t)}JS_SetLocalConfig(t){return this.oRequest.setLocalConfig(t)}JS_SetDocOffset(t){return t&&(this.oDocOffset=t),!0}JS_SetWindowAttr(t){return t&&(this.oWindowAttr=t),!0}JS_CreateWnd(t,e,n,i){const r=this;this.szWndId=t,(i=i||{}).bEmbed!==void 0&&(this.bEmbed=i.bEmbed);let s=!0;return i.bActiveXParentWnd!==void 0&&(s=i.bActiveXParentWnd),new Promise(((a,o)=>{const l=document.getElementById(t);if(l){let u="";m.browser().msie?u="IEFrame":m.browser().chrome?u="Chrome":m.browser().safari&&(u=window.top.document.title),i.cbSetDocTitle&&(r.oOptions.cbSetDocTitle=i.cbSetDocTitle),i.cbUnsetDocTitle&&(r.oOptions.cbUnsetDocTitle=i.cbUnsetDocTitle);const h=r.oRequest.getRequestUUID();ue(h,i.cbSetDocTitle),r.iCreateWndTimer=setTimeout((()=>{if(!r.bDevTool){const d=m.getDevicePixelRatio(),p=m.getWndPostion(l,r.bEmbed,r.oWindowAttr,r.oDocOffset);e=Math.round(e*d),n=Math.round(n*d),r.oRequest.createWnd(p.left,p.top,e,n,u,r.bEmbed,s,i.HWND||"").then((()=>{Et(h,i.cbUnsetDocTitle),a()}),(f=>{Et(h,i.cbUnsetDocTitle),f.errorCode===5001?(document.hidden||r.bFreeze||!r.bFocus||r.fShowWnd(),a()):o(f)}))}}),300),document.addEventListener("visibilitychange",r.fVisibilityChange,!1),window.addEventListener("focus",r.fFocus),window.addEventListener("blur",r.fBlur)}else o()}))}JS_ShowWnd(){this.bFreeze=!1,document.hidden||this.bDevTool||this.fShowWnd()}JS_HideWnd(){this.bFreeze=!0,this.fHideWnd()}JS_DestroyWnd(){return document.removeEventListener("visibilitychange",this.fVisibilityChange,!1),window.removeEventListener("focus",this.fFocus),window.removeEventListener("blur",this.fBlur),this.oRequest.destroyWnd()}JS_Resize(t,e,n){let i=null;const r=t,s=e;if(this.szWndId!==""&&(i=document.getElementById(this.szWndId)),i){const a=m.getWndPostion(i,this.bEmbed,this.oWindowAttr,this.oDocOffset),o=m.getDevicePixelRatio();(!m.browser().msie||m.browser().msie&&m.browser().version==="11.0")&&(this.oWndCover.left>0&&(a.left+=Math.round(this.oWndCover.left*o),t-=this.oWndCover.left),this.oWndCover.top>0&&(a.top+=Math.round(this.oWndCover.top*o),e-=this.oWndCover.top),this.oWndCover.right>0&&(t-=this.oWndCover.right),this.oWndCover.bottom>0&&(e-=this.oWndCover.bottom)),t=Math.round(t*o),e=Math.round(e*o),this.oRequest.setWndGeometry(a.left,a.top,t,e),(m.browser().msie&&m.browser().version==="11.0"||!m.isWindows())&&(n&&n.bFixed?this.iFixedResizeTimer=-1:(this.iFixedResizeTimer>-1&&(clearTimeout(this.iFixedResizeTimer),this.iFixedResizeTimer=-1),this.iFixedResizeTimer=setTimeout((()=>{this.JS_Resize(r,s,{bFixed:!0})}),300)))}}JS_SetWndCover(t,e){const n=m.getDevicePixelRatio();return(!m.browser().msie||m.browser().msie&&m.browser().version==="11.0")&&(t==="left"?this.oWndCover.left=e:t==="top"?this.oWndCover.top=e:t==="right"?this.oWndCover.right=e:t==="bottom"&&(this.oWndCover.bottom=e)),e=Math.round(e*n),this.oRequest.setWndCover(t,e)}JS_CuttingPartWindow(t,e,n,i,r){const s=m.getDevicePixelRatio();return t=Math.round(t*s),e=Math.round(e*s),n=Math.round(n*s),i=Math.round(i*s),r=Math.round(r*s),this.oRequest.cuttingPartWindow(t,e,n,i,r)}JS_RepairPartWindow(t,e,n,i,r){const s=m.getDevicePixelRatio();return t=Math.round(t*s),e=Math.round(e*s),n=Math.round(n*s),i=Math.round(i*s),r=Math.round(r*s),this.oRequest.repairPartWindow(t,e,n,i,r)}JS_ChangePlayMode(t){return this.oRequest.changePlayMode(t)}JS_SetLanguageType(t){return this.oRequest.setLanguageType(t)}JS_InitLoginInfo(t){return this.oRequest.initLoginInfo(t)}JS_SetTranslateFile(t){return this.oRequest.setTranslateFile(t)}JS_SwitchToSimple(t){return this.oRequest.switchToSimple(t)}JS_SetVsmToken(t){return this.oRequest.setVsmToken(t)}JS_Play(t,e,n,i,r,s,a,o,l){return this.oRequest.startPlay(t,e,n,i,r,s,a,o,l)}JS_Enable3DZoom(t){return this.oRequest.setPreview3DPosition(t)}JS_StopTotal(){return this.oRequest.stopTotal()}JS_SetDragMode(t){return this.oRequest.setDragMode(t)}JS_ShowErrorInfoInFullScreen(t){return this.oRequest.showErrorInfoInFullScreen(t)}JS_SetNumberOfWindows(t){return this.oRequest.setNumberOfWindows(t)}JS_InitCardReader(t){return this.oRequest.initCardReader(t)}JS_UnInitCardReader(){return this.oRequest.unInitCardReader()}JS_StartAutoMode(){return this.oRequest.startAutoMode()}JS_StopAutoMode(){return this.oRequest.stopAutoMode()}JS_InitFingerprint(t){return this.oRequest.initFingerprint(t)}JS_UnInitFingerprint(){return this.oRequest.unInitFingerprint()}JS_StartCollectFingerprint(){return this.oRequest.startCollectFingerprint()}JS_StopCollectFingerprint(){return this.oRequest.stopCollectFingerprint()}JS_IsCollectingFingerprint(){return this.oRequest.isCollectingFingerprint()}JS_InitVideocapture(t){return this.oRequest.initVideocapture(t)}JS_UnInitVideocapture(){return this.oRequest.unInitVideocapture()}JS_RegisterDeviceType(t){return this.oRequest.registerDeviceType(t)}JS_ActiveOnlineDevice(t,e){return this.oRequest.activeOnlineDevice(t,e)}JS_RefreshDeviceList(){return this.oRequest.refreshDeviceList()}JS_ModifyDeviceNetParam(t,e,n,i,r,s,a){return this.oRequest.modifyDeviceNetParam(t,e,n,i,r,s,a)}JS_ExportKeyFile(t){return this.oRequest.exportKeyFile(t)}JS_ImportKeyFile(){return this.oRequest.importKeyFile()}JS_ResetPassword(t,e,n,i){return this.oRequest.resetPassword(t,e,n,i)}JS_UploadPicture(t){return this.oRequest.uploadPicture(t)}JS_ShowSelectMenu(t,e,n,i,r){const s=document.getElementById(t);if(s){const a=m.getWndPostion(s,!1,this.oWindowAttr,this.oDocOffset);r==="center"?a.left-=Math.round((e-s.offsetWidth)/2):r==="right"&&(a.left-=Math.round(e-s.offsetWidth));const o=m.getDevicePixelRatio();e=Math.round(e*o),n=Math.round(n*o);const l=1*window.getComputedStyle(s).height.slice(0,-2),u=Math.round(l*o);this.oRequest.showSelectMenu(a.left,a.top+u,e,n,i)}}JS_HideSelectMenu(){this.oRequest.hideSelectMenu()}JS_DestroySelectMenu(){return this.oRequest.destroySelectMenu()}JS_DeviceConfig(t){return this.oRequest.deviceConfig(t)}JS_CloudStorageConfig(t){return this.oRequest.cloudStorageConfig(t)}JS_EzvizRemoteConfig(t){return this.oRequest.ezvizRemoteConfig(t)}JS_ShowAlarmInfoInFullScreen(t,e,n){return this.oRequest.showAlarmInfoInFullScreen(t,e,n)}JS_SetImmediatePlaybackTime(t){return this.oRequest.setImmediatePlaybackTime(t)}JS_SetDrawStatus(t){return this.oRequest.setDrawStatus(t)}JS_ClearRegion(){return this.oRequest.clearRegion()}JS_SetDrawShapeInfo(t,e){return this.oRequest.setDrawShapeInfo(t,e)}JS_SetGridInfo(t){return this.oRequest.setGridInfo(t)}JS_GetGridInfo(){return this.oRequest.getGridInfo()}JS_SetPolygonInfo(t){return this.oRequest.setPolygonInfo(t)}JS_GetPolygonInfo(){return this.oRequest.getPolygonInfo()}JS_SetLineInfo(t){return this.oRequest.setLineInfo(t)}JS_GetLineInfo(){return this.oRequest.getLineInfo()}JS_SetRectInfo(t){return this.oRequest.setRectInfo(t)}JS_GetRectInfo(){return this.oRequest.getRectInfo()}JS_ClearShapeByType(t){return this.oRequest.clearShapeByType(t)}JS_SensitiveEncrypt(t,e,n){return this.oRequest.sensitiveEncrypt(t,e,n)}JS_SendRequest(t){return this.oRequest.sendRequest(t)}JS_RequestInterface(t){return this.oRequest.requestInterface(t)}JS_StopPlay(t){return this.oRequest.stopPlay(t)}JS_ShowRemoteConfig(t){return this.oRequest.showRemoteConfig(t)}static JS_WakeUp(t){const e=document.createElement("iframe");e.style.display="none",e.src=t,document.body.appendChild(e),setTimeout((()=>{document.body.removeChild(e)}),3e3)}JS_Video2Picture(){return this.oRequest.video2Picture()}JS_Picture2Video(){return this.oRequest.picture2Video()}JS_PtzControl(t){return this.oRequest.ptzControl(t)}JS_SimMouseClickEvent(t,e){return this.oRequest.simMouseClickEvent(t,e)}JS_US_SetMaxJobCount(t){return this.oRequest.us_SetMaxJobCount(t)}JS_US_GetMaxJobCount(){return this.oRequest.us_GetMaxJobCount()}JS_US_AddSchedule(t){return this.oRequest.us_AddSchedule(t)}JS_US_DelSchedule(t){return this.oRequest.us_DelSchedule(t)}JS_US_GetScheduleList(t){return this.oRequest.us_GetScheduleList(t)}JS_US_GetSchedule(t,e){return this.oRequest.us_GetSchedule(t,e)}JS_US_UpgradeAction(t,e){return this.oRequest.us_UpgradeAction(t,e)}JS_US_CheckUpgradeableDevice(t){return this.oRequest.us_CheckUpgradeableDevice(t)}JS_US_CheckUpgradeableDeviceList(t){return this.oRequest.us_CheckUpgradeableDeviceList(t)}JS_US_IsRunningAsyCheckUpgradeable(){return this.oRequest.us_IsRunningAsyCheckUpgradeable()}JS_US_StopAsyCheckUpgradeable(){return this.oRequest.us_StopAsyCheckUpgradeable()}JS_GetFishEyePTZPreset(t){return this.oRequest.getFishEyePTZPreset(t)}JS_SetFishEyePTZPreset(t,e,n){return this.oRequest.setFishEyePTZPreset(t,e,n)}JS_ControlFishEyePTZ(t,e,n,i){return this.oRequest.controlFishEyePTZ(t,e,n,i)}JS_ControlFishEyeParol(t,e,n){return this.oRequest.controlFishEyeParol(t,e,n)}JS_SetFirstDayOfWeek(t){return this.oRequest.setFirstDayOfWeek(t)}JS_SetEhomePlayInfo(t,e,n,i,r,s){return this.oRequest.setEhomePlayInfo(t,e,n,i,r,s)}JS_PlayPatch(t){return this.oRequest.startPlayPatch(t)}JS_SetWndAutoPanState(t,e){return this.oRequest.setWndAutoPanState(t,e)}JS_EnablePrivileges(){return this.oRequest.enablePrivileges()}};Fn.version="1.2.7";const Cr={id:"playWnd",class:"playWnd"},un=3,hn=3e3,ve="插件未启动,正在尝试启动,请稍候...",jt="插件启动失败,请检查插件是否安装!",Bt=Object.assign({name:"GPluginVideo"},{__name:"index",props:{isPlayVideo:{type:Boolean,default:!1},isFullScreen:{type:Boolean,default:!1},cameraIndexCode:{type:String,default:""},currentPlayType:{type:Number,default:0},baseUrl:{type:String,default:"http://92.97.137.81:48181"},usefullData:{type:Object,default:()=>({appkey:"24460774",secret:"vphyI4pTqEVk4lT67jVe",ip:"61.27.16.15",port:443})},size:{type:Object,default:()=>({windowWidth:300,windowHeight:200})},isMulTip:{type:Boolean,default:!1},multipPointsArr:{type:Array,default:()=>[]},happenedTime:{type:String,default:""}},emits:["closeVideoEmit"],setup(t,{expose:e,emit:n}){const i=t,r=n,s=q.ref(null),a=q.ref(0),o=q.ref(""),l=q.ref(""),u=q.ref("1x1"),h=q.ref(0),d=q.ref([]),p=q.ref(1),f=q.ref([]),y=q.ref(0);function b(){return new Promise((w,v)=>{if(window.WebControl){w();return}try{window.WebControl=Fn,console.log("web-control.esm.min.js加载成功"),w()}catch(V){console.error("web-control.esm.min.js加载失败",V),v(new Error("加载web-control.esm.min.js失败"))}})}function R(w){const v=new Date(Number(w));return v.setMinutes(v.getMinutes()-1),v.getTime()}function P(w){const v=new Date(Number(w));return v.setMinutes(v.getMinutes()+1),v.getTime()}function T(w,v){const V=[];for(let gt=0;gt<w.length;gt+=v)V.push(w.slice(gt,gt+v));return V}function M(w){const v=new Ri;return v.setPublicKey(o.value),v.encrypt(w)}function E(){r("closeVideoEmit"),s.value!==null&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_Disconnect().then(()=>{},()=>{}))}function H(){s.value&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_RequestInterface({funcName:"destroyWnd"}))}function g(w){s.value.JS_RequestInterface({funcName:"getRSAPubKey",argument:JSON.stringify({keyLength:1024})}).then(v=>{v.responseMsg.data&&(o.value=v.responseMsg.data,w())})}function F(){let w=i.cameraIndexCode.trim();s.value.JS_RequestInterface({funcName:"startPreview",argument:JSON.stringify({cameraIndexCode:w,streamMode:0,transMode:1,gpuMode:0,wndId:-1})})}function N(){let w=i.cameraIndexCode,v="",V="";i.happenedTime?(v=R(i.happenedTime),V=P(i.happenedTime)):(v=Date.now()-1440*60*1e3,V=Date.now()),s.value.JS_RequestInterface({funcName:"startPlayback",argument:JSON.stringify({cameraIndexCode:w,startTimeStamp:Math.floor(v/1e3).toString(),endTimeStamp:Math.floor(V/1e3).toString(),recordLocation:1,transMode:1,gpuMode:0,wndId:-1})})}function B(){const w=f.value.map((v,V)=>({cameraIndexCode:v.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:V+1}));s.value.JS_RequestInterface({funcName:"startMultiPreviewByCameraIndexCode",argument:JSON.stringify({list:w})})}function ct(){let w="",v="";i.happenedTime?(w=R(i.happenedTime),v=P(i.happenedTime)):(w=Date.now()-1440*60*1e3,v=Date.now());const V=f.value.map((gt,Vn)=>({startTimeStamp:Math.floor(w/1e3).toString(),endTimeStamp:Math.floor(v/1e3).toString(),cameraIndexCode:gt.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:Vn+1}));s.value.JS_RequestInterface({funcName:"startMultiPlaybackByCameraIndexCode",argument:JSON.stringify({list:V})})}function W(){g(()=>{s.value.JS_RequestInterface({funcName:"init",argument:JSON.stringify({appkey:i.usefullData.appkey,secret:M(i.usefullData.secret),ip:i.usefullData.ip,playMode:i.currentPlayType,port:i.usefullData.port,snapDir:"D:\\SnapDir",videoDir:"D:\\VideoDir",layout:u.value,enableHTTPS:1,encryptedFields:"secret",showToolbar:1,showSmart:0,buttonIDs:"0,256,257,258,259,260,512,513,514,515,516,517,768,769"})}).then(()=>{s.value.JS_Resize(i.size.windowWidth,i.size.windowHeight),i.isMulTip?i.currentPlayType===1?ct():B():i.currentPlayType===1?N():F()}),i.isFullScreen&&s.value.JS_RequestInterface({funcName:"setFullScreen"})})}function ie(w){const{responseMsg:v}=w;v.type===6&&(h.value=i.multipPointsArr.length,p.value=1,d.value=i.multipPointsArr,u.value=v.msg.layout,y.value=v.msg.wndNum,d.value=T(d.value,v.msg.wndNum),f.value=[...d.value[p.value-1]],s.value.JS_Disconnect().then(()=>{j()},()=>{})),v.type===7&&E()}function j(){s.value=new window.WebControl({szPluginContainer:"playWnd",iServicePortStart:15900,iServicePortEnd:15900,szClassId:"23BF3B0A-2C56-4D97-9C03-0CB103AA8F11",cbConnectSuccess:()=>{s.value.JS_StartService("window",{dllPath:"./VideoPluginConnect.dll"}).then(()=>{s.value.JS_SetWindowControlCallback({cbIntegrationCallBack:ie}),s.value.JS_CreateWnd("playWnd",i.size.windowWidth,i.size.windowHeight).then(()=>{W()})})},cbConnectError:()=>{s.value=null,Tt.ElMessage.error(ve),l.value=ve,window.WebControl.JS_WakeUp("VideoWebPlugin://"),a.value++,a.value<un?setTimeout(()=>j(),hn):(Tt.ElMessage.error(jt),l.value=jt)},cbConnectClose:w=>{w||(s.value=null,l.value=ve,a.value++,a.value<un?setTimeout(()=>j(),hn):(Tt.ElMessage.error(jt),l.value=jt))}})}function De(){Tt.ElMessageBox.alert("播放视频需要下载插件","提示",{confirmButtonText:"下载插件",cancelButtonText:"取消",type:"info",showCancelButton:!0}).then(()=>{Wn(),Tt.ElMessage({type:"success",message:"下载插件成功"})}).catch(()=>{E()})}function Wn(){try{const w=i.baseUrl+"static/VideoWebPlugin.exe",v=document.createElement("a");v.href=w,v.download="VideoWebPlugin.exe",v.style.display="none",document.body.appendChild(v),v.click(),setTimeout(()=>{v.parentNode&&v.parentNode.removeChild(v),E()},100)}catch{E()}}function Nn(){i.isMulTip&&(y.value=4,h.value=i.multipPointsArr.length,u.value=h.value<=1?"1x1":"2x2",d.value=T(i.multipPointsArr,4),f.value=[...d.value[p.value-1]])}return q.watch(()=>i.isPlayVideo,w=>{w===!1&&E()}),q.watch(()=>i.happenedTime,()=>{ct()}),q.watch(()=>i.cameraIndexCode,(w,v)=>{w!==v&&(H(),s.value.JS_Disconnect().then(()=>{j()},()=>{}))}),q.watch(l,w=>{w!==""&&De()}),q.onMounted(()=>{Nn(),b().then(()=>{i.isPlayVideo&&j()}).catch(()=>{De()})}),q.onBeforeUnmount(()=>{s.value&&(s.value.JS_RequestInterface({funcName:"stopAllPreview"}),s.value.JS_HideWnd(),s.value.JS_RequestInterface({funcName:"destroyWnd"}))}),e({closeVideo:E,initPlugin:j,startPlay:F,startPlayback:N,startMultiPreview:B,startMultiPlayback:ct}),(w,v)=>q.withDirectives((q.openBlock(),q.createElementBlock("div",Cr,null,512)),[[q.vShow,!t.isFullScreen]])}});Bt.install=t=>{t.component(Bt.name,Bt)};exports.GPluginVideo=Bt;exports.default=Bt;
|