geekin-devtoys 0.2.5 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +265 -101
- package/lib/GDialog/style.css +1 -1
- package/lib/GPluginVideo/index.js +14 -14
- package/lib/GPluginVideo/index.mjs +3460 -1526
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1 -1
- package/lib/index-BVvzBt8u.mjs +53 -0
- package/lib/index-CC5ivGYd.js +1 -0
- package/package.json +1 -1
- package/lib/GPluginVideo/web-control_1.2.5.min.js +0 -2
- package/lib/index-B86xv9Xx.js +0 -1
- package/lib/index-DSzb017c.mjs +0 -98
- package/lib/web-control.esm.min-BC66rx6c.mjs +0 -1938
- package/lib/web-control.esm.min-DLrkEUOV.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var gt,qe=new Uint8Array(16);function ve(){if(!gt&&!(gt=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 gt(qe)}var Ie=/^(?:[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 ke(t){return typeof t=="string"&&Ie.test(t)}for(var f=[],mt=0;mt<256;++mt)f.push((mt+256).toString(16).substr(1));function O(t,e,s){var o=(t=t||{}).random||(t.rng||ve)();return o[6]=15&o[6]|64,o[8]=63&o[8]|128,(function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=(f[n[r+0]]+f[n[r+1]]+f[n[r+2]]+f[n[r+3]]+"-"+f[n[r+4]]+f[n[r+5]]+"-"+f[n[r+6]]+f[n[r+7]]+"-"+f[n[r+8]]+f[n[r+9]]+"-"+f[n[r+10]]+f[n[r+11]]+f[n[r+12]]+f[n[r+13]]+f[n[r+14]]+f[n[r+15]]).toLowerCase();if(!ke(a))throw TypeError("Stringified UUID is invalid");return a})(o)}const Pe=typeof atob=="function",ze=typeof btoa=="function",Z=typeof Buffer=="function",Et=typeof TextDecoder=="function"?new TextDecoder:void 0,Tt=typeof TextEncoder=="function"?new TextEncoder:void 0,X=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),rt=(t=>{let e={};return X.forEach(((s,o)=>e[s]=o)),e})(),Ue=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,C=String.fromCharCode.bind(String),At=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(t,e=(s=>s))=>new Uint8Array(Array.prototype.slice.call(t,0).map(e)),Qt=t=>t.replace(/=/g,"").replace(/[+\/]/g,(e=>e=="+"?"-":"_")),te=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),ee=t=>{let e,s,o,n,r="";const a=t.length%3;for(let i=0;i<t.length;){if((s=t.charCodeAt(i++))>255||(o=t.charCodeAt(i++))>255||(n=t.charCodeAt(i++))>255)throw new TypeError("invalid character found");e=s<<16|o<<8|n,r+=X[e>>18&63]+X[e>>12&63]+X[e>>6&63]+X[63&e]}return a?r.slice(0,a-3)+"===".substring(a):r},Ut=ze?t=>btoa(t):Z?t=>Buffer.from(t,"binary").toString("base64"):ee,It=Z?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let s=0,o=t.length;s<o;s+=4096)e.push(C.apply(null,t.subarray(s,s+4096)));return Ut(e.join(""))},at=(t,e=!1)=>e?Qt(It(t)):It(t),We=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?C(192|e>>>6)+C(128|63&e):C(224|e>>>12&15)+C(128|e>>>6&63)+C(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return C(240|e>>>18&7)+C(128|e>>>12&63)+C(128|e>>>6&63)+C(128|63&e)},De=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,se=t=>t.replace(De,We),xt=Z?t=>Buffer.from(t,"utf8").toString("base64"):Tt?t=>It(Tt.encode(t)):t=>Ut(se(t)),$=(t,e=!1)=>e?Qt(xt(t)):xt(t),Ot=t=>$(t,!0),Ee=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Te=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 C(55296+(e>>>10))+C(56320+(1023&e));case 3:return C((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return C((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},ne=t=>t.replace(Ee,Te),oe=t=>{if(t=t.replace(/\s+/g,""),!Ue.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,s,o,n="";for(let r=0;r<t.length;)e=rt[t.charAt(r++)]<<18|rt[t.charAt(r++)]<<12|(s=rt[t.charAt(r++)])<<6|(o=rt[t.charAt(r++)]),n+=s===64?C(e>>16&255):o===64?C(e>>16&255,e>>8&255):C(e>>16&255,e>>8&255,255&e);return n},Wt=Pe?t=>atob(te(t)):Z?t=>Buffer.from(t,"base64").toString("binary"):oe,re=Z?t=>At(Buffer.from(t,"base64")):t=>At(Wt(t),(e=>e.charCodeAt(0))),ie=t=>re(ae(t)),Ae=Z?t=>Buffer.from(t,"base64").toString("utf8"):Et?t=>Et.decode(re(t)):t=>ne(Wt(t)),ae=t=>te(t.replace(/[-_]/g,(e=>e=="-"?"+":"/"))),kt=t=>Ae(ae(t)),le=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),Ft=function(){const t=(e,s)=>Object.defineProperty(String.prototype,e,le(s));t("fromBase64",(function(){return kt(this)})),t("toBase64",(function(e){return $(this,e)})),t("toBase64URI",(function(){return $(this,!0)})),t("toBase64URL",(function(){return $(this,!0)})),t("toUint8Array",(function(){return ie(this)}))},Mt=function(){const t=(e,s)=>Object.defineProperty(Uint8Array.prototype,e,le(s));t("toBase64",(function(e){return at(this,e)})),t("toBase64URI",(function(){return at(this,!0)})),t("toBase64URL",(function(){return at(this,!0)}))},xe={version:"3.7.2",VERSION:"3.7.2",atob:Wt,atobPolyfill:oe,btoa:Ut,btoaPolyfill:ee,fromBase64:kt,toBase64:$,encode:$,encodeURI:Ot,encodeURL:Ot,utob:se,btou:ne,decode:kt,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:at,toUint8Array:ie,extendString:Ft,extendUint8Array:Mt,extendBuiltins:()=>{Ft(),Mt()}},d=new class{constructor(){this.oBase64=xe}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 s={};return s[e[1]]=!0,s.version=e[2],s}getCreateWndMode(){const t=navigator.userAgent,e=navigator.platform,s=e==="Win64"||e==="Win32"||e==="Windows",o=this.browser();let n=!0;return window.top!==window?n=!1:s?(t.indexOf("Windows NT 10.0")>-1&&o.mozilla&&(n=!1),o.edge&&(n=!1)):n=!1,n}getWndPostion(t,e,s,o){let n=0,r=0;const a=t.ownerDocument.defaultView,i=t.getBoundingClientRect(),c=window.getComputedStyle(t),l={top:i.top+parseInt(c["border-top-width"].slice(0,-2),10),left:i.left+parseInt(c["border-left-width"].slice(0,-2),10)},u=this.getDevicePixelRatio(),h=this.browser().chrome?a.outerWidth/u:a.outerWidth,m=this.browser().chrome?a.outerHeight/u:a.outerHeight;if(e)if(this.browser().msie){const p=a.outerWidth-a.innerWidth-(a.screenLeft-a.screenX);n=l.left+(a.screenLeft-a.screenX)-p,r=l.top+(a.screenTop-a.screenY)}else{let p=0,S=0;const b=Math.round((h-a.innerWidth)/2);this.isWindows()&&this.browser().chrome&&(b===-8||a.screen.height-a.outerHeight==0?b===-8&&(p=8,S=8):b===8?p=-5:b===0&&(S=8)),this.browser().mozilla&&(b===7||b===6?p=-6:b===8&&(p=-8)),n=l.left+b+p,r=l.top+(m-a.innerHeight-b)+S}else{const p=window.top;let S=0,b=0,I=0,W=0;try{S=h-p.innerWidth,b=m-p.innerHeight,I=p.screenLeft-p.screenX,W=p.screenTop-p.screenY}catch{S=s.outerWidth-s.innerWidth,b=s.outerHeight-s.innerHeight,I=s.screenLeft-s.screenX,W=s.screenTop-s.screenY}if(this.browser().msie){let y=S-I;y=0,n=l.left+I-y,r=l.top+W}else{const y=S/2;n=l.left+y,r=l.top+(b-y),this.isWindows()&&this.browser().chrome&&y===0&&(n+=8,r+=8)}n+=o.left,r+=o.top}return this.isWindows()&&(this.browser().chrome||this.browser().safari)&&(n=l.left,r=l.top,n+=o.left,r+=o.top),this.browser().msie&&this.browser().version==="10.0"&&(n+=a.pageXOffset,r+=a.pageYOffset),n=Math.round(n*u),r=Math.round(r*u),{left:n,top:r}}detectPort(t,e,s){if(t===e)return void s.success(t);const o=`HikCentralWebControlPort:${t}-${e}`,n=this;let r=0,a=!1,i=null;sessionStorage&&(i=sessionStorage.getItem(o),i!==null&&(i=parseInt(i,10)));const c=[];for(let b=t;b<=e;b++)b!==i&&c.push(b);i!==null&&c.unshift(i);const l=[],u=function(){r>0&&clearTimeout(r)},h=function(){for(let b=0,I=l.length;b<I;b++)delete l[b]};let m=0;const p=function(b){sessionStorage&&sessionStorage.setItem(o,b),!a&&s.success&&(u(),h(),s.success(b))},S=new Date().getTime();for(let b=0,I=c.length;b<I;b++)setTimeout((()=>{l.push(n.createImageHttp(c[b],{timeStamp:S+b,success(W){p(W)},error(){m++,c.length===m&&!a&&s.error&&(u(),h(),s.error())}}))}),100);r=setTimeout((()=>{a=!0,s.error&&(h(),s.error())}),6e4)}createImageHttp(t,e){const s=new Image;return s.crossOrigin="anonymous",s.onload=function(){e.success&&e.success(t)},s.onerror=function(){e.error&&e.error()},s.onabort=function(){e.abort&&e.abort()},s.src=`http://127.0.0.1:${t}/imghttp/local?update=${e.timeStamp}`,s}utf8to16(t){let e="",s=0;const o=t.length;let n,r,a;for(;s<o;)switch(n=t.charCodeAt(s++),n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=t.charAt(s-1);break;case 12:case 13:r=t.charCodeAt(s++),e+=String.fromCharCode((31&n)<<6|63&r);break;case 14:r=t.charCodeAt(s++),a=t.charCodeAt(s++),e+=String.fromCharCode((15&n)<<12|(63&r)<<6|(63&a)<<0)}return e}createEventScript(t,e,s){const o=document.createElement("script");o.htmlFor=t,o.event=e,o.innerHTML=s,document.getElementById(t).appendChild(o)}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||{}}},ce=" ";function Oe(t){window.top.document.title=window.top.document.title+ce+t}function Fe(t){window.top.document.title=window.top.document.title.replace(ce+t,"")}function _t(t,e){(e||Oe)(t)}function G(t,e){(e||Fe)(t)}const ft=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 s={sequence:O(),cmd:"system.connect"},o=JSON.stringify(s);t.oWebSocket.send(o)},t.oWebSocket.onmessage=function(s){const o=s.data,n=JSON.parse(o),r=n.sequence;r===void 0&&n.cmd===void 0?(t.szUUID=n.uuid,t.szVersion=n.version,t.oOptions.cbConnectSuccess&&t.oOptions.cbConnectSuccess()):n.cmd!==void 0?t.parseCmd(n):t.oRequestList[r]!==void 0&&(n.errorModule===0&&n.errorCode===0?t.oRequestList[r].resolve(n):t.oRequestList[r].reject(n),delete t.oRequestList[r])},t.oWebSocket.onclose=function(){t.oWebSocket=null,d.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(((s,o)=>{const n=O();t.sequence=n,e.oRequestList[n]={resolve:s,reject:o},t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const r=JSON.stringify(t);e.oWebSocket&&WebSocket.OPEN===e.oWebSocket.readyState?e.oWebSocket.send(r):o()}))}parseCmd(t){const e=t.cmd.split("."),s=e[1].replace(/^[a-z]{1}/g,(o=>o.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${s}`]&&this.oWindowControlCallback[`cb${s}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${s}`]&&this.oSadpCallback[`cb${s}`](t):e[0]==="serial"?this.oSerialCallback[`cb${s}`]&&this.oSerialCallback[`cb${s}`](t):e[0]==="slice"?this.oSliceCallback[`cb${s}`]&&this.oSliceCallback[`cb${s}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${s}`]&&this.oUIControlCallback[`cb${s}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${s}`]&&this.oUpgradeCallback[`cb${s}`](t)}};function H(t){let e=t.length;for(;--e>=0;)t[e]=0}const Pt=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]),lt=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]),Me=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Jt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),U=new Array(576);H(U);const Y=new Array(60);H(Y);const et=new Array(512);H(et);const Q=new Array(256);H(Q);const Dt=new Array(29);H(Dt);const dt=new Array(30);function Ct(t,e,s,o,n){this.static_tree=t,this.extra_bits=e,this.extra_base=s,this.elems=o,this.max_length=n,this.has_stree=t&&t.length}let Lt,Bt,Nt;function wt(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}H(dt);const de=t=>t<256?et[t]:et[256+(t>>>7)],st=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},R=(t,e,s)=>{t.bi_valid>16-s?(t.bi_buf|=e<<t.bi_valid&65535,st(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=s-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=s)},z=(t,e,s)=>{R(t,s[2*e],s[2*e+1])},ue=(t,e)=>{let s=0;do s|=1&t,t>>>=1,s<<=1;while(--e>0);return s>>>1},he=(t,e,s)=>{const o=new Array(16);let n,r,a=0;for(n=1;n<=15;n++)o[n]=a=a+s[n-1]<<1;for(r=0;r<=e;r++){let i=t[2*r+1];i!==0&&(t[2*r]=ue(o[i]++,i))}},pe=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},be=t=>{t.bi_valid>8?st(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},$t=(t,e,s,o)=>{const n=2*e,r=2*s;return t[n]<t[r]||t[n]===t[r]&&o[e]<=o[s]},St=(t,e,s)=>{const o=t.heap[s];let n=s<<1;for(;n<=t.heap_len&&(n<t.heap_len&&$t(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!$t(e,o,t.heap[n],t.depth));)t.heap[s]=t.heap[n],s=n,n<<=1;t.heap[s]=o},Zt=(t,e,s)=>{let o,n,r,a,i=0;if(t.last_lit!==0)do o=t.pending_buf[t.d_buf+2*i]<<8|t.pending_buf[t.d_buf+2*i+1],n=t.pending_buf[t.l_buf+i],i++,o===0?z(t,n,e):(r=Q[n],z(t,r+256+1,e),a=Pt[r],a!==0&&(n-=Dt[r],R(t,n,a)),o--,r=de(o),z(t,r,s),a=lt[r],a!==0&&(o-=dt[r],R(t,o,a)));while(i<t.last_lit);z(t,256,e)},Rt=(t,e)=>{const s=e.dyn_tree,o=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let a,i,c,l=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<r;a++)s[2*a]!==0?(t.heap[++t.heap_len]=l=a,t.depth[a]=0):s[2*a+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=l<2?++l:0,s[2*c]=1,t.depth[c]=0,t.opt_len--,n&&(t.static_len-=o[2*c+1]);for(e.max_code=l,a=t.heap_len>>1;a>=1;a--)St(t,s,a);c=r;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],St(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=i,s[2*c]=s[2*a]+s[2*i],t.depth[c]=(t.depth[a]>=t.depth[i]?t.depth[a]:t.depth[i])+1,s[2*a+1]=s[2*i+1]=c,t.heap[1]=c++,St(t,s,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((u,h)=>{const m=h.dyn_tree,p=h.max_code,S=h.stat_desc.static_tree,b=h.stat_desc.has_stree,I=h.stat_desc.extra_bits,W=h.stat_desc.extra_base,y=h.stat_desc.max_length;let V,v,B,_,nt,bt,ot=0;for(_=0;_<=15;_++)u.bl_count[_]=0;for(m[2*u.heap[u.heap_max]+1]=0,V=u.heap_max+1;V<573;V++)v=u.heap[V],_=m[2*m[2*v+1]+1]+1,_>y&&(_=y,ot++),m[2*v+1]=_,v>p||(u.bl_count[_]++,nt=0,v>=W&&(nt=I[v-W]),bt=m[2*v],u.opt_len+=bt*(_+nt),b&&(u.static_len+=bt*(S[2*v+1]+nt)));if(ot!==0){do{for(_=y-1;u.bl_count[_]===0;)_--;u.bl_count[_]--,u.bl_count[_+1]+=2,u.bl_count[y]--,ot-=2}while(ot>0);for(_=y;_!==0;_--)for(v=u.bl_count[_];v!==0;)B=u.heap[--V],B>p||(m[2*B+1]!==_&&(u.opt_len+=(_-m[2*B+1])*m[2*B],m[2*B+1]=_),v--)}})(t,e),he(s,l,t.bl_count)},Ht=(t,e,s)=>{let o,n,r=-1,a=e[1],i=0,c=7,l=4;for(a===0&&(c=138,l=3),e[2*(s+1)+1]=65535,o=0;o<=s;o++)n=a,a=e[2*(o+1)+1],++i<c&&n===a||(i<l?t.bl_tree[2*n]+=i:n!==0?(n!==r&&t.bl_tree[2*n]++,t.bl_tree[32]++):i<=10?t.bl_tree[34]++:t.bl_tree[36]++,i=0,r=n,a===0?(c=138,l=3):n===a?(c=6,l=3):(c=7,l=4))},Vt=(t,e,s)=>{let o,n,r=-1,a=e[1],i=0,c=7,l=4;for(a===0&&(c=138,l=3),o=0;o<=s;o++)if(n=a,a=e[2*(o+1)+1],!(++i<c&&n===a)){if(i<l)do z(t,n,t.bl_tree);while(--i!=0);else n!==0?(n!==r&&(z(t,n,t.bl_tree),i--),z(t,16,t.bl_tree),R(t,i-3,2)):i<=10?(z(t,17,t.bl_tree),R(t,i-3,3)):(z(t,18,t.bl_tree),R(t,i-11,7));i=0,r=n,a===0?(c=138,l=3):n===a?(c=6,l=3):(c=7,l=4)}};let Gt=!1;const ge=(t,e,s,o)=>{R(t,0+(o?1:0),3),((n,r,a,i)=>{be(n),st(n,a),st(n,~a),n.pending_buf.set(n.window.subarray(r,r+a),n.pending),n.pending+=a})(t,e,s)};var Je=(t,e,s,o)=>{let n,r,a=0;t.level>0?(t.strm.data_type===2&&(t.strm.data_type=(i=>{let c,l=4093624447;for(c=0;c<=31;c++,l>>>=1)if(1&l&&i.dyn_ltree[2*c]!==0)return 0;if(i.dyn_ltree[18]!==0||i.dyn_ltree[20]!==0||i.dyn_ltree[26]!==0)return 1;for(c=32;c<256;c++)if(i.dyn_ltree[2*c]!==0)return 1;return 0})(t)),Rt(t,t.l_desc),Rt(t,t.d_desc),a=(i=>{let c;for(Ht(i,i.dyn_ltree,i.l_desc.max_code),Ht(i,i.dyn_dtree,i.d_desc.max_code),Rt(i,i.bl_desc),c=18;c>=3&&i.bl_tree[2*Jt[c]+1]===0;c--);return i.opt_len+=3*(c+1)+5+5+4,c})(t),n=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=n&&(n=r)):n=r=s+5,s+4<=n&&e!==-1?ge(t,e,s,o):t.strategy===4||r===n?(R(t,2+(o?1:0),3),Zt(t,U,Y)):(R(t,4+(o?1:0),3),((i,c,l,u)=>{let h;for(R(i,c-257,5),R(i,l-1,5),R(i,u-4,4),h=0;h<u;h++)R(i,i.bl_tree[2*Jt[h]+1],3);Vt(i,i.dyn_ltree,c-1),Vt(i,i.dyn_dtree,l-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),Zt(t,t.dyn_ltree,t.dyn_dtree)),pe(t),o&&be(t)},Le={_tr_init:t=>{Gt||((()=>{let e,s,o,n,r;const a=new Array(16);for(o=0,n=0;n<28;n++)for(Dt[n]=o,e=0;e<1<<Pt[n];e++)Q[o++]=n;for(Q[o-1]=n,r=0,n=0;n<16;n++)for(dt[n]=r,e=0;e<1<<lt[n];e++)et[r++]=n;for(r>>=7;n<30;n++)for(dt[n]=r<<7,e=0;e<1<<lt[n]-7;e++)et[256+r++]=n;for(s=0;s<=15;s++)a[s]=0;for(e=0;e<=143;)U[2*e+1]=8,e++,a[8]++;for(;e<=255;)U[2*e+1]=9,e++,a[9]++;for(;e<=279;)U[2*e+1]=7,e++,a[7]++;for(;e<=287;)U[2*e+1]=8,e++,a[8]++;for(he(U,287,a),e=0;e<30;e++)Y[2*e+1]=5,Y[2*e]=ue(e,5);Lt=new Ct(U,Pt,257,286,15),Bt=new Ct(Y,lt,0,30,15),Nt=new Ct(new Array(0),Me,0,19,7)})(),Gt=!0),t.l_desc=new wt(t.dyn_ltree,Lt),t.d_desc=new wt(t.dyn_dtree,Bt),t.bl_desc=new wt(t.bl_tree,Nt),t.bi_buf=0,t.bi_valid=0,pe(t)},_tr_stored_block:ge,_tr_flush_block:Je,_tr_tally:(t,e,s)=>(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&s,t.last_lit++,e===0?t.dyn_ltree[2*s]++:(t.matches++,e--,t.dyn_ltree[2*(Q[s]+256+1)]++,t.dyn_dtree[2*de(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{R(t,2,3),z(t,256,U),(e=>{e.bi_valid===16?(st(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)}},me=(t,e,s,o)=>{let n=65535&t|0,r=t>>>16&65535|0,a=0;for(;s!==0;){a=s>2e3?2e3:s,s-=a;do n=n+e[o++]|0,r=r+n|0;while(--a);n%=65521,r%=65521}return n|r<<16|0};const Be=new Uint32Array((()=>{let t,e=[];for(var s=0;s<256;s++){t=s;for(var o=0;o<8;o++)t=1&t?3988292384^t>>>1:t>>>1;e[s]=t}return e})());var D=(t,e,s,o)=>{const n=Be,r=o+s;t^=-1;for(let a=o;a<r;a++)t=t>>>8^n[255&(t^e[a])];return-1^t},ut={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"},_e={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:Ne,_tr_stored_block:$e,_tr_flush_block:Ze,_tr_tally:F,_tr_align:He}=Le,{Z_NO_FLUSH:L,Z_PARTIAL_FLUSH:Ve,Z_FULL_FLUSH:Ge,Z_FINISH:A,Z_BLOCK:jt,Z_OK:P,Z_STREAM_END:Xt,Z_STREAM_ERROR:q,Z_DATA_ERROR:je,Z_BUF_ERROR:yt,Z_DEFAULT_COMPRESSION:Xe,Z_FILTERED:Ke,Z_HUFFMAN_ONLY:it,Z_RLE:Ye,Z_FIXED:Qe,Z_DEFAULT_STRATEGY:ts,Z_UNKNOWN:es,Z_DEFLATED:ht}=_e,T=(t,e)=>(t.msg=ut[e],e),Kt=t=>(t<<1)-(t>4?9:0),x=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let M=(t,e,s)=>(e<<t.hash_shift^s)&t.hash_mask;const E=t=>{const e=t.state;let s=e.pending;s>t.avail_out&&(s=t.avail_out),s!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+s),t.next_out),t.next_out+=s,e.pending_out+=s,t.total_out+=s,t.avail_out-=s,e.pending-=s,e.pending===0&&(e.pending_out=0))},w=(t,e)=>{Ze(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,E(t.strm)},g=(t,e)=>{t.pending_buf[t.pending++]=e},j=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},ss=(t,e,s,o)=>{let n=t.avail_in;return n>o&&(n=o),n===0?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),s),t.state.wrap===1?t.adler=me(t.adler,e,n,s):t.state.wrap===2&&(t.adler=D(t.adler,e,n,s)),t.next_in+=n,t.total_in+=n,n)},fe=(t,e)=>{let s,o,n=t.max_chain_length,r=t.strstart,a=t.prev_length,i=t.nice_match;const c=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,l=t.window,u=t.w_mask,h=t.prev,m=t.strstart+258;let p=l[r+a-1],S=l[r+a];t.prev_length>=t.good_match&&(n>>=2),i>t.lookahead&&(i=t.lookahead);do if(s=e,l[s+a]===S&&l[s+a-1]===p&&l[s]===l[r]&&l[++s]===l[r+1]){r+=2,s++;do;while(l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&r<m);if(o=258-(m-r),r=m-258,o>a){if(t.match_start=e,a=o,o>=i)break;p=l[r+a-1],S=l[r+a]}}while((e=h[e&u])>c&&--n!=0);return a<=t.lookahead?a:t.lookahead},J=t=>{const e=t.w_size;let s,o,n,r,a;do{if(r=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,o=t.hash_size,s=o;do n=t.head[--s],t.head[s]=n>=e?n-e:0;while(--o);o=e,s=o;do n=t.prev[--s],t.prev[s]=n>=e?n-e:0;while(--o);r+=e}if(t.strm.avail_in===0)break;if(o=ss(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=o,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=M(t,t.ins_h,t.window[a+1]);t.insert&&(t.ins_h=M(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)},qt=(t,e)=>{let s,o;for(;;){if(t.lookahead<262){if(J(t),t.lookahead<262&&e===L)return 1;if(t.lookahead===0)break}if(s=0,t.lookahead>=3&&(t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),s=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),s!==0&&t.strstart-s<=t.w_size-262&&(t.match_length=fe(t,s)),t.match_length>=3)if(o=F(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=M(t,t.ins_h,t.window[t.strstart+3-1]),s=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=M(t,t.ins_h,t.window[t.strstart+1]);else o=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(o&&(w(t,!1),t.strm.avail_out===0))return 1}return t.insert=t.strstart<2?t.strstart:2,e===A?(w(t,!0),t.strm.avail_out===0?3:4):t.last_lit&&(w(t,!1),t.strm.avail_out===0)?1:2},N=(t,e)=>{let s,o,n;for(;;){if(t.lookahead<262){if(J(t),t.lookahead<262&&e===L)return 1;if(t.lookahead===0)break}if(s=0,t.lookahead>=3&&(t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),s=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,s!==0&&t.prev_length<t.max_lazy_match&&t.strstart-s<=t.w_size-262&&(t.match_length=fe(t,s),t.match_length<=5&&(t.strategy===Ke||t.match_length===3&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,o=F(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),s=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++,o&&(w(t,!1),t.strm.avail_out===0))return 1}else if(t.match_available){if(o=F(t,0,t.window[t.strstart-1]),o&&w(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&&(o=F(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===A?(w(t,!0),t.strm.avail_out===0?3:4):t.last_lit&&(w(t,!1),t.strm.avail_out===0)?1:2};function k(t,e,s,o,n){this.good_length=t,this.max_lazy=e,this.nice_length=s,this.max_chain=o,this.func=n}const K=[new k(0,0,0,0,((t,e)=>{let s=65535;for(s>t.pending_buf_size-5&&(s=t.pending_buf_size-5);;){if(t.lookahead<=1){if(J(t),t.lookahead===0&&e===L)return 1;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;const o=t.block_start+s;if((t.strstart===0||t.strstart>=o)&&(t.lookahead=t.strstart-o,t.strstart=o,w(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-262&&(w(t,!1),t.strm.avail_out===0))return 1}return t.insert=0,e===A?(w(t,!0),t.strm.avail_out===0?3:4):(t.strstart>t.block_start&&(w(t,!1),t.strm.avail_out),1)})),new k(4,4,8,4,qt),new k(4,5,16,8,qt),new k(4,6,32,32,qt),new k(4,4,16,16,N),new k(8,16,32,32,N),new k(8,16,128,128,N),new k(8,32,128,256,N),new k(32,128,258,1024,N),new k(32,258,258,4096,N)];function ns(){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=ht,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),x(this.dyn_ltree),x(this.dyn_dtree),x(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),x(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),x(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 Ce=t=>{if(!t||!t.state)return T(t,q);t.total_in=t.total_out=0,t.data_type=es;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=L,Ne(e),P},we=t=>{const e=Ce(t);var s;return e===P&&((s=t.state).window_size=2*s.w_size,x(s.head),s.max_lazy_match=K[s.level].max_lazy,s.good_match=K[s.level].good_length,s.nice_match=K[s.level].nice_length,s.max_chain_length=K[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=2,s.match_available=0,s.ins_h=0),e},Yt=(t,e,s,o,n,r)=>{if(!t)return q;let a=1;if(e===Xe&&(e=6),o<0?(a=0,o=-o):o>15&&(a=2,o-=16),n<1||n>9||s!==ht||o<8||o>15||e<0||e>9||r<0||r>Qe)return T(t,q);o===8&&(o=9);const i=new ns;return t.state=i,i.strm=t,i.wrap=a,i.gzhead=null,i.w_bits=o,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=n+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+3-1)/3),i.window=new Uint8Array(2*i.w_size),i.head=new Uint16Array(i.hash_size),i.prev=new Uint16Array(i.w_size),i.lit_bufsize=1<<n+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new Uint8Array(i.pending_buf_size),i.d_buf=1*i.lit_bufsize,i.l_buf=3*i.lit_bufsize,i.level=e,i.strategy=r,i.method=s,we(t)};var tt={deflateInit:(t,e)=>Yt(t,e,ht,15,8,ts),deflateInit2:Yt,deflateReset:we,deflateResetKeep:Ce,deflateSetHeader:(t,e)=>t&&t.state?t.state.wrap!==2?q:(t.state.gzhead=e,P):q,deflate:(t,e)=>{let s,o;if(!t||!t.state||e>jt||e<0)return t?T(t,q):q;const n=t.state;if(!t.output||!t.input&&t.avail_in!==0||n.status===666&&e!==A)return T(t,t.avail_out===0?yt:q);n.strm=t;const r=n.last_flush;if(n.last_flush=e,n.status===42)if(n.wrap===2)t.adler=0,g(n,31),g(n,139),g(n,8),n.gzhead?(g(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),g(n,255&n.gzhead.time),g(n,n.gzhead.time>>8&255),g(n,n.gzhead.time>>16&255),g(n,n.gzhead.time>>24&255),g(n,n.level===9?2:n.strategy>=it||n.level<2?4:0),g(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(g(n,255&n.gzhead.extra.length),g(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=D(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(g(n,0),g(n,0),g(n,0),g(n,0),g(n,0),g(n,n.level===9?2:n.strategy>=it||n.level<2?4:0),g(n,3),n.status=113);else{let a=ht+(n.w_bits-8<<4)<<8,i=-1;i=n.strategy>=it||n.level<2?0:n.level<6?1:n.level===6?2:3,a|=i<<6,n.strstart!==0&&(a|=32),a+=31-a%31,n.status=113,j(n,a),n.strstart!==0&&(j(n,t.adler>>>16),j(n,65535&t.adler)),t.adler=1}if(n.status===69)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),E(t),s=n.pending,n.pending!==n.pending_buf_size));)g(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(n.status===73)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),E(t),s=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,g(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),o===0&&(n.gzindex=0,n.status=91)}else n.status=91;if(n.status===91)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),E(t),s=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,g(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>s&&(t.adler=D(t.adler,n.pending_buf,n.pending-s,s)),o===0&&(n.status=103)}else n.status=103;if(n.status===103&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&E(t),n.pending+2<=n.pending_buf_size&&(g(n,255&t.adler),g(n,t.adler>>8&255),t.adler=0,n.status=113)):n.status=113),n.pending!==0){if(E(t),t.avail_out===0)return n.last_flush=-1,P}else if(t.avail_in===0&&Kt(e)<=Kt(r)&&e!==A)return T(t,yt);if(n.status===666&&t.avail_in!==0)return T(t,yt);if(t.avail_in!==0||n.lookahead!==0||e!==L&&n.status!==666){let a=n.strategy===it?((i,c)=>{let l;for(;;){if(i.lookahead===0&&(J(i),i.lookahead===0)){if(c===L)return 1;break}if(i.match_length=0,l=F(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,l&&(w(i,!1),i.strm.avail_out===0))return 1}return i.insert=0,c===A?(w(i,!0),i.strm.avail_out===0?3:4):i.last_lit&&(w(i,!1),i.strm.avail_out===0)?1:2})(n,e):n.strategy===Ye?((i,c)=>{let l,u,h,m;const p=i.window;for(;;){if(i.lookahead<=258){if(J(i),i.lookahead<=258&&c===L)return 1;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=3&&i.strstart>0&&(h=i.strstart-1,u=p[h],u===p[++h]&&u===p[++h]&&u===p[++h])){m=i.strstart+258;do;while(u===p[++h]&&u===p[++h]&&u===p[++h]&&u===p[++h]&&u===p[++h]&&u===p[++h]&&u===p[++h]&&u===p[++h]&&h<m);i.match_length=258-(m-h),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=3?(l=F(i,1,i.match_length-3),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(l=F(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),l&&(w(i,!1),i.strm.avail_out===0))return 1}return i.insert=0,c===A?(w(i,!0),i.strm.avail_out===0?3:4):i.last_lit&&(w(i,!1),i.strm.avail_out===0)?1:2})(n,e):K[n.level].func(n,e);if(a!==3&&a!==4||(n.status=666),a===1||a===3)return t.avail_out===0&&(n.last_flush=-1),P;if(a===2&&(e===Ve?He(n):e!==jt&&($e(n,0,0,!1),e===Ge&&(x(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),E(t),t.avail_out===0))return n.last_flush=-1,P}return e!==A?P:n.wrap<=0?Xt:(n.wrap===2?(g(n,255&t.adler),g(n,t.adler>>8&255),g(n,t.adler>>16&255),g(n,t.adler>>24&255),g(n,255&t.total_in),g(n,t.total_in>>8&255),g(n,t.total_in>>16&255),g(n,t.total_in>>24&255)):(j(n,t.adler>>>16),j(n,65535&t.adler)),E(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?P:Xt)},deflateEnd:t=>{if(!t||!t.state)return q;const e=t.state.status;return e!==42&&e!==69&&e!==73&&e!==91&&e!==103&&e!==113&&e!==666?T(t,q):(t.state=null,e===113?T(t,je):P)},deflateSetDictionary:(t,e)=>{let s=e.length;if(!t||!t.state)return q;const o=t.state,n=o.wrap;if(n===2||n===1&&o.status!==42||o.lookahead)return q;if(n===1&&(t.adler=me(t.adler,e,s,0)),o.wrap=0,s>=o.w_size){n===0&&(x(o.head),o.strstart=0,o.block_start=0,o.insert=0);let c=new Uint8Array(o.w_size);c.set(e.subarray(s-o.w_size,s),0),e=c,s=o.w_size}const r=t.avail_in,a=t.next_in,i=t.input;for(t.avail_in=s,t.next_in=0,t.input=e,J(o);o.lookahead>=3;){let c=o.strstart,l=o.lookahead-2;do o.ins_h=M(o,o.ins_h,o.window[c+3-1]),o.prev[c&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=c,c++;while(--l);o.strstart=c,o.lookahead=2,J(o)}return o.strstart+=o.lookahead,o.block_start=o.strstart,o.insert=o.lookahead,o.lookahead=0,o.match_length=o.prev_length=2,o.match_available=0,t.next_in=a,t.input=i,t.avail_in=r,o.wrap=n,P},deflateInfo:"pako deflate (from Nodeca project)"};const os=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var rs=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const s=e.shift();if(s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(const o in s)os(s,o)&&(t[o]=s[o])}}return t},is=t=>{let e=0;for(let o=0,n=t.length;o<n;o++)e+=t[o].length;const s=new Uint8Array(e);for(let o=0,n=0,r=t.length;o<r;o++){let a=t[o];s.set(a,n),n+=a.length}return s};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const zt=new Uint8Array(256);for(let t=0;t<256;t++)zt[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;zt[254]=zt[254]=1;var Se=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,s,o,n,r,a=t.length,i=0;for(n=0;n<a;n++)s=t.charCodeAt(n),(64512&s)==55296&&n+1<a&&(o=t.charCodeAt(n+1),(64512&o)==56320&&(s=65536+(s-55296<<10)+(o-56320),n++)),i+=s<128?1:s<2048?2:s<65536?3:4;for(e=new Uint8Array(i),r=0,n=0;r<i;n++)s=t.charCodeAt(n),(64512&s)==55296&&n+1<a&&(o=t.charCodeAt(n+1),(64512&o)==56320&&(s=65536+(s-55296<<10)+(o-56320),n++)),s<128?e[r++]=s:s<2048?(e[r++]=192|s>>>6,e[r++]=128|63&s):s<65536?(e[r++]=224|s>>>12,e[r++]=128|s>>>6&63,e[r++]=128|63&s):(e[r++]=240|s>>>18,e[r++]=128|s>>>12&63,e[r++]=128|s>>>6&63,e[r++]=128|63&s);return e},as=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 Re=Object.prototype.toString,{Z_NO_FLUSH:ls,Z_SYNC_FLUSH:cs,Z_FULL_FLUSH:ds,Z_FINISH:us,Z_OK:pt,Z_STREAM_END:hs,Z_DEFAULT_COMPRESSION:ps,Z_DEFAULT_STRATEGY:bs,Z_DEFLATED:gs}=_e;function ct(t){this.options=rs({level:ps,method:gs,chunkSize:16384,windowBits:15,memLevel:8,strategy:bs},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 as,this.strm.avail_out=0;let s=tt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(s!==pt)throw new Error(ut[s]);if(e.header&&tt.deflateSetHeader(this.strm,e.header),e.dictionary){let o;if(o=typeof e.dictionary=="string"?Se(e.dictionary):Re.call(e.dictionary)==="[object ArrayBuffer]"?new Uint8Array(e.dictionary):e.dictionary,s=tt.deflateSetDictionary(this.strm,o),s!==pt)throw new Error(ut[s]);this._dict_set=!0}}function ms(t,e){const s=new ct(e);if(s.push(t,!0),s.err)throw s.msg||ut[s.err];return s.result}ct.prototype.push=function(t,e){const s=this.strm,o=this.options.chunkSize;let n,r;if(this.ended)return!1;for(r=e===~~e?e:e===!0?us:ls,typeof t=="string"?s.input=Se(t):Re.call(t)==="[object ArrayBuffer]"?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;;)if(s.avail_out===0&&(s.output=new Uint8Array(o),s.next_out=0,s.avail_out=o),(r===cs||r===ds)&&s.avail_out<=6)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else{if(n=tt.deflate(s,r),n===hs)return s.next_out>0&&this.onData(s.output.subarray(0,s.next_out)),n=tt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===pt;if(s.avail_out!==0){if(r>0&&s.next_out>0)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else if(s.avail_in===0)break}else this.onData(s.output)}return!0},ct.prototype.onData=function(t){this.chunks.push(t)},ct.prototype.onEnd=function(t){t===pt&&(this.result=is(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var _s={deflate:ms};const{deflate:fs}=_s;var Cs=fs;const vt=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=O(),s={sequence:e,cmd:"system.connect"},o=JSON.stringify(s);t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,o,e,{success(n){const r=JSON.parse(n);t.szUUID=r.uuid,t.szVersion=r.version,t.bConnected=!0,t.bInitConnect=!1,setTimeout((()=>{t.imageHttpPolling()}),100),t.oOptions.cbConnectSuccess&&t.oOptions.cbConnectSuccess()},error(){}})}sendImageHttp(t,e,s,o){const n=this;o=Object.assign({success:null,error:null,abort:null},o);let r=Cs(e);new Uint8Array().toString()!==""&&(d.isMacOS()||d.browser().msie)&&(r=Array.prototype.slice.call(r));const a=encodeURIComponent(btoa(r)),i=this.splitStr(a),c=[];let l="";for(let u=0,h=i.length;u<h;u++)l=u===h-1?`update=${new Date().getTime()}&isLast=true&data=${i[u]}&sequence=${s}`:`update=${new Date().getTime()}&isLast=false&data=${i[u]}&sequence=${s}`,c.push(l);if(c.length>0){const u=function(){n.imageHttp(`${t}?${c[0]}`,{success(h){c.shift(),c.length>0?(n.bInitConnect||n.bConnected)&&u():o.success&&o.success(h)},error(){o.error&&o.error()},abort(){o.abort&&o.abort()}})};u()}}splitStr(t){const e=this.getByteLen(t),s=[],o=1500;for(let n=0,r=Math.ceil(e/o);n<r;n++)s[n]=t.slice(o*n,o*(n+1));return s}getByteLen(t){let e=0,s="";for(let o=0,n=t.length;o<n;o++)s=t.charAt(o),/[^\x00-\xff]/.test(s)?e+=2:e+=1;return e}imageHttp(t,e){e=Object.assign({success:null,error:null,abort:null},e);const s=new Image;s.onload=function(){if(e.success){const o=document.createElement("canvas"),n=o.getContext("2d"),r=s.width,a=s.height;o.width=r,o.height=a;try{n.drawImage(s,0,0);const i=n.getImageData(0,0,r,a).data;let c="",l=-1;for(let u=a-1;u>=0;u--)for(let h=0;h<4*r&&(l=u*r*4+h,i[l]!==0);h++)i[l]!==255&&(c+=String.fromCharCode(i[l]));e.success(d.utf8to16(c))}catch{e.error&&e.error()}}},s.onerror=function(){e.error&&e.error()},s.onabort=function(){e.abort&&e.abort()},s.crossOrigin="anonymous",s.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=O(),s={sequence:e,uuid:t.szUUID,cmd:"system.disconnect"},o=JSON.stringify(s);t.bConnected&&t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,o,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=O(),s={sequence:e,uuid:t.szUUID,cmd:"system.get"},o=JSON.stringify(s);t.bConnected&&t.sendImageHttp(`${t.szHost}:${t.oOptions.iPort}/imghttp/local`,o,e,{success(n){if(t.iGetErrorCount=0,n==="timeout")setTimeout((()=>{t.imageHttpPolling()}),100);else if(n==="invalid")t.bConnected=!1,t.oOptions.cbConnectError&&t.oOptions.cbConnectError();else if(n==="closed")console.log("connected is disconnected");else{const r=JSON.parse(n);r.cmd!==void 0?t.parseCmd(r):console.log(`[jsWebControl]imgHttpPolling push message error:${n}`),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(((s,o)=>{const n=t.cmd.split(".");let r="";n.length>1?r=n[0]==="laputa"?"laputa":"local":o();const a=O();t.sequence=a,t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const i=JSON.stringify(t);e.bConnected?e.sendImageHttp(`${e.szHost}:${e.oOptions.iPort}/imghttp/${r}`,i,a,{success(c){const l=JSON.parse(c);l.errorModule===0&&l.errorCode===0?s(l):o(l)},error(){o()}}):o()}))}parseCmd(t){const e=t.cmd.split("."),s=e[1].replace(/^[a-z]{1}/g,(o=>o.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${s}`]&&this.oWindowControlCallback[`cb${s}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${s}`]&&this.oSadpCallback[`cb${s}`](t):e[0]==="serial"?this.oSerialCallback[`cb${s}`]&&this.oSerialCallback[`cb${s}`](t):e[0]==="slice"?this.oSliceCallback[`cb${s}`]&&this.oSliceCallback[`cb${s}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${s}`]&&this.oUIControlCallback[`cb${s}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${s}`]&&this.oUpgradeCallback[`cb${s}`](t)}},ws=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:s}=t.oOptions;if(s===""){s=`${this.szPluginId}_div`;const o=document.createElement("div");o.id=s,document.body.parentNode.appendChild(o)}document.getElementById(s).innerHTML=e,t.oPlugin=document.getElementById(this.szPluginId),window.onConnectMessage=function(o,n){n?(t.aMessage.push(o),t.onConnectMessage(t.aMessage.join("")),t.aMessage.length=0):t.aMessage.push(o)},window.onConnectClose=function(){t.onConnectClose()},window.onConnectError=function(){t.onConnectError()},window.onConnectCloseException=function(){t.onConnectCloseException()},window.onConnectOpen=function(){t.onConnectOpen()},d.createEventScript(this.szPluginId,"onConnectMessage(szData, bLast)","onConnectMessage(szData, bLast);"),d.createEventScript(this.szPluginId,"onConnectClose()","onConnectClose();"),d.createEventScript(this.szPluginId,"onConnectError()","onConnectError();"),d.createEventScript(this.szPluginId,"onConnectCloseException()","onConnectCloseException();"),d.createEventScript(this.szPluginId,"onConnectOpen()","onConnectOpen();")}onConnectMessage(t){const e=this;if(t){const s=JSON.parse(t),o=s.sequence;o===void 0&&s.cmd===void 0?(e.szUUID=s.uuid,e.szVersion=s.version,e.oOptions.cbConnectSuccess&&e.oOptions.cbConnectSuccess()):s.cmd!==void 0?e.parseCmd(s):e.oRequestList[o]!==void 0&&(s.errorModule===0&&s.errorCode===0?e.oRequestList[o].resolve(s):e.oRequestList[o].reject(s),delete e.oRequestList[o])}}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:O(),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(((s,o)=>{const n=O();t.sequence=n,e.oRequestList[n]={resolve:s,reject:o},t.uuid=e.szUUID,t.timestamp=`${new Date().getTime()}`;const r=JSON.stringify(t);e.oPlugin&&e.oPlugin.object?e.oPlugin.sendRequest(r):o()}))}parseCmd(t){const e=t.cmd.split("."),s=e[1].replace(/^[a-z]{1}/g,(o=>o.toUpperCase()));e[0]==="window"||e[0]==="play"?this.oWindowControlCallback[`cb${s}`]&&this.oWindowControlCallback[`cb${s}`](t):e[0]==="sadp"?this.oSadpCallback[`cb${s}`]&&this.oSadpCallback[`cb${s}`](t):e[0]==="serial"?this.oSerialCallback[`cb${s}`]&&this.oSerialCallback[`cb${s}`](t):e[0]==="slice"?this.oSliceCallback[`cb${s}`]&&this.oSliceCallback[`cb${s}`](t):e[0]==="ui"?this.oUIControlCallback[`cb${s}`]&&this.oUIControlCallback[`cb${s}`](t):e[0]==="upgrade"&&this.oUpgradeCallback[`cb${s}`]&&this.oUpgradeCallback[`cb${s}`](t)}},Ss=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;d.detectPort(t.oOptions.iServicePortStart,t.oOptions.iServicePortEnd,{success(e){if(t.iPort=e,d.browser().msie)d.browser().version==="11.0"?window.location.protocol==="https:"?t.oRequest=new vt({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}):t.oRequest=new ft({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}):t.oRequest=new ws({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(d.browser().chrome||d.browser().mozilla)try{t.oRequest=new ft({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose})}catch{t.oRequest=new vt({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose})}else t.oRequest=new vt({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose});else"WebSocket"in window&&(t.oRequest=new ft({iPort:t.iPort,cbConnectSuccess:t.oOptions.cbConnectSuccess,cbConnectError:t.oOptions.cbConnectError,cbConnectClose:t.oOptions.cbConnectClose}));t.bInit=!0;for(const s in t.oCallbacks)t.oRequest[s](t.oCallbacks[s])},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 s={cmd:"system.startService",type:t};return e!==void 0&&(s.options=e),this.oRequest.sendRequest(s)}stopService(t){const e=this;return new Promise(((s,o)=>{e.oRequest!==null?e.oRequest.sendRequest({cmd:"system.stopService",type:t}).then((n=>{s(n)}),(n=>{o(n)})):o()}))}disconnect(){const t=this;return new Promise(((e,s)=>{t.oRequest!==null?(t.oRequest.disconnect(),e("cbConnectClose callback is really success")):s()}))}openDirectory(t){return this.oRequest.sendRequest({cmd:"system.openDirectory",path:t})}openFile(t,e,s){return this.oRequest.sendRequest({cmd:"system.openFile",path:t,relative:e,version:s})}selectDirectory(t,e){const s=this;return new Promise(((o,n)=>{s.oRequest!==null?s.oRequest.sendRequest({cmd:"system.selectDirectory",caption:t!==void 0&&t!==""?d.Base64().encode(t):"",dir:e!==void 0&&e!==""?d.Base64().encode(e):""}).then((r=>{r.path!==""&&(r.path=d.Base64().decode(r.path)),o(r)}),(r=>{n(r)})):n()}))}selectFile(t,e,s){const o=this;return new Promise(((n,r)=>{o.oRequest!==null?o.oRequest.sendRequest({cmd:"system.selectFile",caption:t!==""?d.Base64().encode(t):"",dir:e!==""?d.Base64().encode(e):"",filter:s}).then((a=>{a.path!==""&&(a.path=d.Base64().decode(a.path)),n(a)}),(a=>{r(a)})):r()}))}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,s,o,n,r,a,i=""){return this.oRequest.sendRequest({cmd:"window.createWnd",rect:{left:t,top:e,width:s,height:o},className:n,embed:r,activeXParentWnd:a,HWND:i})}showWnd(){return this.oRequest.sendRequest({cmd:"window.showWnd"})}hideWnd(){return this.oRequest.sendRequest({cmd:"window.hideWnd"})}destroyWnd(){const t=this;return new Promise(((e,s)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"window.destroyWnd"}).then((o=>{e(o)}),(o=>{s(o)})):s()}))}setWndGeometry(t,e,s,o){return this.oRequest.sendRequest({cmd:"window.setWndGeometry",rect:{left:t,top:e,width:s,height:o}})}setWndCover(t,e){const s=this;return new Promise(((o,n)=>{s.oRequest!==null?s.oRequest.sendRequest({cmd:"window.setWndCover",position:t,size:e}).then((r=>{o(r)}),(r=>{n(r)})):n()}))}cuttingPartWindow(t,e,s,o,n){const r=this;return new Promise(((a,i)=>{r.oRequest!==null?r.oRequest.sendRequest({cmd:"window.cuttingPartWindow",rect:{left:t,top:e,width:s,height:o},round:n}).then((c=>{a(c)}),(c=>{i(c)})):i()}))}repairPartWindow(t,e,s,o,n){const r=this;return new Promise(((a,i)=>{r.oRequest!==null?r.oRequest.sendRequest({cmd:"window.repairPartWindow",rect:{left:t,top:e,width:s,height:o},round:n}).then((c=>{a(c)}),(c=>{i(c)})):i()}))}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,s,o,n,r,a,i,c){const l={cmd:"play.startPlay",url:t,username:e,password:s,siteID:o,areaName:d.Base64().encode(n),cameraName:d.Base64().encode(r),permission:a,wndIndex:i};return c!==void 0&&(l.options=c,l.options.siteName!==void 0&&(l.options.siteName=d.Base64().encode(l.options.siteName))),this.oRequest.sendRequest(l)}setPreview3DPosition(t){return this.oRequest.sendRequest({cmd:"play.setPreview3DPosition",open:t})}stopTotal(){const t=this;return new Promise(((e,s)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"play.stopTotal"}).then((o=>{e(o)}),(o=>{s(o)})):s()}))}setDragMode(t){return this.oRequest.sendRequest({cmd:"play.setDragMode",drag:t})}showErrorInfoInFullScreen(t){return this.oRequest.sendRequest({cmd:"play.showErrorInfoInFullScreen",error:d.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=d.Base64().encode(t.majorTitle),t.tip=d.Base64().encode(t.tip),t.captureBtnTxt=d.Base64().encode(t.captureBtnTxt),t.USBRemovedTip=d.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,s,o,n,r,a){return this.oRequest.sendRequest({cmd:"sadp.modifyDeviceParam",macAddress:t,password:e,ipv4Address:s,ipv4Gateway:o,ipv4SubnetMask:n,port:r,httpPort:a})}exportKeyFile(t){return this.oRequest.sendRequest({cmd:"sadp.exportKeyFile",serialNumber:t})}importKeyFile(){return this.oRequest.sendRequest({cmd:"sadp.importKeyFile"})}resetPassword(t,e,s,o){return this.oRequest.sendRequest({cmd:"sadp.resetPassword",serialNumber:t,password:e,importFileData:s,szCode:o})}uploadPicture(t){return this.oRequest.sendRequest({cmd:"slice.uploadPicture",path:d.Base64().encode(t)})}showSelectMenu(t,e,s,o,n){return this.oRequest.sendRequest({cmd:"ui.showSelectMenu",items:n,rect:{left:t,top:e,width:s,height:o}})}hideSelectMenu(){return this.oRequest.sendRequest({cmd:"ui.hideSelectMenu"})}destroySelectMenu(){const t=this;return new Promise(((e,s)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"ui.destroySelectMenu"}).then((o=>{e(o)}),(o=>{s(o)})):s()}))}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,s){return this.oRequest.sendRequest({cmd:"window.showAlarmInfoInFullScreen",alarmTitle:t,alarmMessage:e,alarmId:s})}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,s){const o={cmd:"laputa.sensitiveEncrypt",encryptType:t,encryptField:e};return s!==void 0&&(o.options=s),this.oRequest.sendRequest(o)}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(((s,o)=>{e.oRequest!==null?e.oRequest.sendRequest(t).then((n=>{s(n)}),(n=>{o(n)})):o()}))}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:d.Base64().encode(t)})}us_DelSchedule(t){return this.oRequest.sendRequest({cmd:"upgrade.delSchedule",scheduleId:t})}us_GetScheduleList(t){const e=this;return new Promise(((s,o)=>{e.oRequest!==null?e.oRequest.sendRequest({cmd:"upgrade.getScheduleList",xml:t}).then((n=>{n.xml!==""&&(n.xml=d.Base64().decode(n.xml)),s(n)}),(n=>{o(n)})):o()}))}us_GetSchedule(t,e){const s=this;return new Promise(((o,n)=>{s.oRequest!==null?s.oRequest.sendRequest({cmd:"upgrade.getSchedule",xml:e,scheduleId:t}).then((r=>{r.xml!==""&&(r.xml=d.Base64().decode(r.xml)),o(r)}),(r=>{n(r)})):n()}))}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,s){return this.oRequest.sendRequest({cmd:"play.setFishEyePTZPreset",wndIndex:t,command:e,presetInfo:s})}controlFishEyePTZ(t,e,s,o){return this.oRequest.sendRequest({cmd:"play.controlFishEyePTZ",wndIndex:t,command:e,stop:s,speed:o})}controlFishEyeParol(t,e,s){return this.oRequest.sendRequest({cmd:"play.controlFishEyeParol",wndIndex:t,command:e,cruisePointList:s})}setFirstDayOfWeek(t){return this.oRequest.sendRequest({cmd:"window.setFirstDayOfWeek",firstDay:t})}setEhomePlayInfo(t,e,s,o,n,r){return this.oRequest.sendRequest({cmd:"play.setEhomePlayInfo",guid:t,protocal:e,session:s,token:o,ip:n,port:r})}startPlayPatch(t){if(t.length>0)for(let e=0,s=t.length;e<s;e++)t[e].areaName=d.Base64().encode(t[e].areaName),t[e].cameraName=d.Base64().encode(t[e].cameraName);return this.oRequest.sendRequest({cmd:"play.startPlayPatch",params:t})}grabOpen(){const t=this;return new Promise(((e,s)=>{t.oRequest!==null?t.oRequest.sendRequest({cmd:"window.grabOpen"}).then((o=>{e(o)}),(o=>{s(o)})):s()}))}setWndAutoPanState(t,e){return this.oRequest.sendRequest({cmd:"play.setWndAutoPanState",wndIndex:t,open:e})}enablePrivileges(){return this.oRequest.sendRequest({cmd:"system.enablePrivileges"})}},ye=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=d.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(d.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 s=d.browser();if(s.chrome||s.mozilla)if(e.iUpdateParentWndTimer>0&&(clearTimeout(e.iUpdateParentWndTimer),e.iUpdateParentWndTimer=-1),e.iVCTimeEnd-e.iVCTimeStart<100){const o=e.oRequest.getRequestUUID();_t(o,e.oOptions.cbSetDocTitle),e.iUpdateParentWndTimer=setTimeout((()=>{e.oRequest.updateParentWnd().then((()=>{G(o,e.oOptions.cbUnsetDocTitle),e.bFreeze||e.bDevTool||e.fShowWnd()}),(()=>{G(o,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(!d.isMacOS()){let s=null;if(e.szWndId!==""&&(s=document.getElementById(e.szWndId),s)){const o=s.querySelectorAll('[data-name="wc-grab-open-image"]');Array.prototype.slice.call(o).forEach((n=>{n.parentNode.removeChild(n)}))}}},this.oRequest=new Ss({szPluginContainer:this.oOptions.szPluginContainer,cbConnectSuccess:this.oOptions.cbConnectSuccess,cbConnectError:this.oOptions.cbConnectError,cbConnectClose(s){e.iCreateWndTimer>0&&(clearTimeout(e.iCreateWndTimer),e.iCreateWndTimer=-1),e.removeGrabImage(),e.oOptions.cbConnectClose&&e.oOptions.cbConnectClose(s)},iServicePortStart:this.oOptions.iServicePortStart,iServicePortEnd:this.oOptions.iServicePortEnd,szClassId:this.oOptions.szClassId})}JS_SetWindowControlCallback(t){const e=this,s={cbSelectWnd(o){t.cbSelectWnd&&t.cbSelectWnd(parseInt(o.wndIndex,10),o.cameraID,o.siteID,o.opendFisheye)},cbTogglePTZ(o){t.cbTogglePTZ&&t.cbTogglePTZ(o.cameraID,o.siteID)},cbUpdateCameraIcon(o){t.cbUpdateCameraIcon&&t.cbUpdateCameraIcon(o.cameraID,parseInt(o.playing,10),o.siteID)},cbGetLastError(o){t.cbGetLastError&&t.cbGetLastError(o.error,parseInt(o.type,10))},cbTalkUrlEmpty(o){t.cbTalkUrlEmpty&&t.cbTalkUrlEmpty(o.cameraID)},cbGotoPlayback(o){t.cbGotoPlayback&&t.cbGotoPlayback(o.cameraID,o.siteID)},cbShowDisplayInfo(o){t.cbShowDisplayInfo&&t.cbShowDisplayInfo(parseInt(o.videoWidth,10),parseInt(o.videoHeight,10),parseInt(o.frameRate,10))},cbPreviewWnd3DPostion(o){t.cbPreviewWnd3DPostion&&t.cbPreviewWnd3DPostion(parseInt(o.startX,10),parseInt(o.startY,10),parseInt(o.endX,10),parseInt(o.endY,10))},cbStopPlayAll(){t.cbStopPlayAll&&t.cbStopPlayAll()},cbWheelEvent(o){t.cbWheelEvent&&t.cbWheelEvent(parseInt(o.delta,10))},cbAlarmDetail(o){t.cbAlarmDetail&&t.cbAlarmDetail(o.alarmId)},cbQuitedFullScreen(){setTimeout((()=>{e.fShowWnd()}),100)},cbManuallyClose(o){t.cbManuallyClose&&t.cbManuallyClose(o.cameraID,o.siteID,parseInt(o.wndIndex,10))},cbIntegrationCallBack(o){t.cbIntegrationCallBack&&t.cbIntegrationCallBack(o)},cbChangeStorage(o){t.cbChangeStorage&&t.cbChangeStorage(parseInt(o.storageType,10),o.cameraID,o.siteID)},cbFisheyeExpandChanged(o){t.cbFisheyeExpandChanged&&t.cbFisheyeExpandChanged(o.cameraID,o.siteID,parseInt(o.wndIndex,10),o.open)},cbGetEhomePlayInfo(o){t.cbGetEhomePlayInfo&&t.cbGetEhomePlayInfo(o.siteID,o.guid)},cbWndPtzControl(o){t.cbWndPtzControl&&t.cbWndPtzControl(parseInt(o.wndIndex,10),o.cameraID,o.command,o.speed,o.stop)},cbMessageCallBack(o){o=o.data;const n=e.oRequest.getRequestUUID();o.type==="menuOpen"?e.szWndId!==""&&(document.getElementById(e.szWndId).innerHTML=`<img data-name='wc-grab-open-image' src='data:image/png;base64,${o.message.image}' width='100%' height='100%' />`):o.type==="changeTitle"?document.title.indexOf(n)===-1&&(e.szTitle=document.title,_t(n,e.oOptions.cbSetDocTitle),setTimeout((()=>{o.message==="updateParentWnd"?e.oRequest.updateParentWnd():o.message==="restoreWnd"&&e.oRequest.restoreWnd()}),300)):o.type==="changeTitleDone"?e.szTitle!==""&&G(n,e.oOptions.cbUnsetDocTitle):o.type==="splitChange"?t.cbSplitChange&&t.cbSplitChange(o.message.splitType):o.type==="showMaximized"&&t.cbShowMaximized&&t.cbShowMaximized(o.message.showMax)}};this.oRequest.setWindowControlCallback(s)}JS_SetSadpCallback(t){const e={cbDeviceFind:null};Object.assign(e,t),this.oRequest.setSadpCallback(e)}JS_SetSliceCallback(t){const e={cbImageSliced(s){t.cbImageSliced&&(s.picName!==""&&(s.picName=d.Base64().decode(s.picName)),t.cbImageSliced(s))}};this.oRequest.setSliceCallback(e)}JS_SetSerialCallback(t){const e={cbCardFind(s){t.cbCardFind&&t.cbCardFind(s)},cbFingerFind(s){t.cbFingerFind&&t.cbFingerFind(s.fingerPrint,s.fingerQuality)},cbImageFind(s){t.cbImageFind&&t.cbImageFind(s.image)},cbImageErrorFind(s){t.cbImageErrorFind&&t.cbImageErrorFind(s.errorModule,s.errorCode)},cbImageWndVisibleFind(s){t.cbImageWndVisibleFind&&t.cbImageWndVisibleFind(s.visible)}};this.oRequest.setSerialCallback(e)}JS_SetUIControlCallback(t){const e={cbClickMenuItem(s){t.cbClickMenuItem&&t.cbClickMenuItem(s.itemIndex)},cbMenuMouseIn(){t.cbMenuMouseIn&&t.cbMenuMouseIn()},cbMenuMouseOut(){t.cbMenuMouseOut&&t.cbMenuMouseOut()}};this.oRequest.setUIControlCallback(e)}JS_SetUpgradeCallback(t){const e={cbCheckUpgrade(s){t.cbCheckUpgrade&&t.cbCheckUpgrade(s)}};this.oRequest.setUpgradeCallback(e)}JS_CheckVersion(t){let e=this.oRequest.getServiceVersion(),s=[],o=[];e!==""&&(e=e.replace(/,[\s]*/g,"."),s=e.split(".")),t!==""&&(o=(t=t.replace(/,[\s]*/g,".")).split("."));let n=!1;if(o.length===s.length){for(let r=0,a=s.length;r<a;r++)if(parseInt(o[r],10)!==parseInt(s[r],10)){if(parseInt(o[r],10)>parseInt(s[r],10)){n=!0;break}break}}return n}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,s){return this.oRequest.openFile(t,e,s)}JS_SelectDirectory(t,e){return this.oRequest.selectDirectory(t,e)}JS_SelectFile(t,e,s){return this.oRequest.selectFile(t,e,s)}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,s,o){const n=this;this.szWndId=t,(o=o||{}).bEmbed!==void 0&&(this.bEmbed=o.bEmbed);let r=!0;return o.bActiveXParentWnd!==void 0&&(r=o.bActiveXParentWnd),new Promise(((a,i)=>{const c=document.getElementById(t);if(c){let l="";d.browser().msie?l="IEFrame":d.browser().chrome?l="Chrome":d.browser().safari&&(l=window.top.document.title),o.cbSetDocTitle&&(n.oOptions.cbSetDocTitle=o.cbSetDocTitle),o.cbUnsetDocTitle&&(n.oOptions.cbUnsetDocTitle=o.cbUnsetDocTitle);const u=n.oRequest.getRequestUUID();_t(u,o.cbSetDocTitle),n.iCreateWndTimer=setTimeout((()=>{if(!n.bDevTool){const h=d.getDevicePixelRatio(),m=d.getWndPostion(c,n.bEmbed,n.oWindowAttr,n.oDocOffset);e=Math.round(e*h),s=Math.round(s*h),n.oRequest.createWnd(m.left,m.top,e,s,l,n.bEmbed,r,o.HWND||"").then((()=>{G(u,o.cbUnsetDocTitle),a()}),(p=>{G(u,o.cbUnsetDocTitle),p.errorCode===5001?(document.hidden||n.bFreeze||!n.bFocus||n.fShowWnd(),a()):i(p)}))}}),300),document.addEventListener("visibilitychange",n.fVisibilityChange,!1),window.addEventListener("focus",n.fFocus),window.addEventListener("blur",n.fBlur)}else i()}))}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,s){let o=null;const n=t,r=e;if(this.szWndId!==""&&(o=document.getElementById(this.szWndId)),o){const a=d.getWndPostion(o,this.bEmbed,this.oWindowAttr,this.oDocOffset),i=d.getDevicePixelRatio();(!d.browser().msie||d.browser().msie&&d.browser().version==="11.0")&&(this.oWndCover.left>0&&(a.left+=Math.round(this.oWndCover.left*i),t-=this.oWndCover.left),this.oWndCover.top>0&&(a.top+=Math.round(this.oWndCover.top*i),e-=this.oWndCover.top),this.oWndCover.right>0&&(t-=this.oWndCover.right),this.oWndCover.bottom>0&&(e-=this.oWndCover.bottom)),t=Math.round(t*i),e=Math.round(e*i),this.oRequest.setWndGeometry(a.left,a.top,t,e),(d.browser().msie&&d.browser().version==="11.0"||!d.isWindows())&&(s&&s.bFixed?this.iFixedResizeTimer=-1:(this.iFixedResizeTimer>-1&&(clearTimeout(this.iFixedResizeTimer),this.iFixedResizeTimer=-1),this.iFixedResizeTimer=setTimeout((()=>{this.JS_Resize(n,r,{bFixed:!0})}),300)))}}JS_SetWndCover(t,e){const s=d.getDevicePixelRatio();return(!d.browser().msie||d.browser().msie&&d.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*s),this.oRequest.setWndCover(t,e)}JS_CuttingPartWindow(t,e,s,o,n){const r=d.getDevicePixelRatio();return t=Math.round(t*r),e=Math.round(e*r),s=Math.round(s*r),o=Math.round(o*r),n=Math.round(n*r),this.oRequest.cuttingPartWindow(t,e,s,o,n)}JS_RepairPartWindow(t,e,s,o,n){const r=d.getDevicePixelRatio();return t=Math.round(t*r),e=Math.round(e*r),s=Math.round(s*r),o=Math.round(o*r),n=Math.round(n*r),this.oRequest.repairPartWindow(t,e,s,o,n)}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,s,o,n,r,a,i,c){return this.oRequest.startPlay(t,e,s,o,n,r,a,i,c)}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,s,o,n,r,a){return this.oRequest.modifyDeviceNetParam(t,e,s,o,n,r,a)}JS_ExportKeyFile(t){return this.oRequest.exportKeyFile(t)}JS_ImportKeyFile(){return this.oRequest.importKeyFile()}JS_ResetPassword(t,e,s,o){return this.oRequest.resetPassword(t,e,s,o)}JS_UploadPicture(t){return this.oRequest.uploadPicture(t)}JS_ShowSelectMenu(t,e,s,o,n){const r=document.getElementById(t);if(r){const a=d.getWndPostion(r,!1,this.oWindowAttr,this.oDocOffset);n==="center"?a.left-=Math.round((e-r.offsetWidth)/2):n==="right"&&(a.left-=Math.round(e-r.offsetWidth));const i=d.getDevicePixelRatio();e=Math.round(e*i),s=Math.round(s*i);const c=1*window.getComputedStyle(r).height.slice(0,-2),l=Math.round(c*i);this.oRequest.showSelectMenu(a.left,a.top+l,e,s,o)}}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,s){return this.oRequest.showAlarmInfoInFullScreen(t,e,s)}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,s){return this.oRequest.sensitiveEncrypt(t,e,s)}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,s){return this.oRequest.setFishEyePTZPreset(t,e,s)}JS_ControlFishEyePTZ(t,e,s,o){return this.oRequest.controlFishEyePTZ(t,e,s,o)}JS_ControlFishEyeParol(t,e,s){return this.oRequest.controlFishEyeParol(t,e,s)}JS_SetFirstDayOfWeek(t){return this.oRequest.setFirstDayOfWeek(t)}JS_SetEhomePlayInfo(t,e,s,o,n,r){return this.oRequest.setEhomePlayInfo(t,e,s,o,n,r)}JS_PlayPatch(t){return this.oRequest.startPlayPatch(t)}JS_SetWndAutoPanState(t,e){return this.oRequest.setWndAutoPanState(t,e)}JS_EnablePrivileges(){return this.oRequest.enablePrivileges()}};ye.version="1.2.7";exports.WebControl=ye;
|