var nt=Object.defineProperty;var it=(f,e,t)=>e in f?nt(f,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):f[e]=t;var ae=(f,e,t)=>it(f,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const S of o.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&n(S)}).observe(document,{childList:!0,subtree:!0});function t(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=t(i);fetch(i.href,o)}})();var _e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rt(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var qe={},De={},X={};Object.defineProperty(X,"__esModule",{value:!0});X.NOISEREDUCTION3D_MODE=X.WIDEDYNAMICRANGE_MODE=X.WHITEBALANCE_MODE=X.ANTIFLICKER=X.IRIS=X.GAIN=X.SHUTTER=X.EXPOSURE_MODE=X.FOCUS_MODE=X.FOCUS_COMMAND=X.ZOOM_COMMAND=X.HOME_COMMAND=X.MOVE_COMMAND=void 0;X.MOVE_COMMAND={up:{on:1,off:0},down:{on:2,off:0},left:{on:3,off:0},right:{on:4,off:0}};X.HOME_COMMAND=5;X.ZOOM_COMMAND={in:{on:1,off:0},out:{on:2,off:0}};X.FOCUS_COMMAND={near:{on:1,off:0},far:{on:2,off:0}};X.FOCUS_MODE=["auto","manual"];X.EXPOSURE_MODE=["auto","manual","iris priority","shutter priority","brightness priority"];X.SHUTTER={"1/25":5,"1/50":6,"1/75":7,"1/100":8,"1/120":9,"1/150":10,"1/215":11,"1/300":12,"1/425":13,"1/600":14,"1/1000":15,"1/1250":16,"1/1750":17,"1/2500":18,"1/3500":19,"1/6000":20,"1/10000":21};X.GAIN={"0dB":0,"2dB":1,"4dB":2,"6dB":3,"8dB":4,"10dB":5,"12dB":6,"14dB":7,"16dB":8,"18dB":9,"20dB":10,"22dB":11,"24dB":12,"26dB":13,"28dB":14,"30dB":15};X.IRIS={Close:0,"F14.0":1,"F11.0":2,"F9.6":3,"F8.0":4,"F6.8":5,"F5.6":6,"F4.8":7,"F4.0":8,"F3.4":9,"F2.8":10,"F2.4":11,"F2.0":12,"F1.8":13};X.ANTIFLICKER={Off:0,"50Hz":1,"60Hz":2};X.WHITEBALANCE_MODE=["auto","indoor","outdoor","one push","auto tracking","manual","temperature"];X.WIDEDYNAMICRANGE_MODE=["Off",1,2,3,4,5,6];X.NOISEREDUCTION3D_MODE={Off:5,Auto:0,1:1,2:2,3:3,4:4};var Ie={},st=_e&&_e.__awaiter||function(f,e,t,n){function i(o){return o instanceof t?o:new t(function(S){S(o)})}return new(t||(t=Promise))(function(o,S){function E(m){try{x(n.next(m))}catch(h){S(h)}}function y(m){try{x(n.throw(m))}catch(h){S(h)}}function x(m){m.done?o(m.value):i(m.value).then(E,y)}x((n=n.apply(f,e||[])).next())})},ot=_e&&_e.__generator||function(f,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,S;return S={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function E(x){return function(m){return y([x,m])}}function y(x){if(n)throw new TypeError("Generator is already executing.");for(;S&&(S=0,x[0]&&(t=0)),t;)try{if(n=1,i&&(o=x[0]&2?i.return:x[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,x[1])).done)return o;switch(i=0,o&&(x=[x[0]&2,o.value]),x[0]){case 0:case 1:o=x;break;case 4:return t.label++,{value:x[1],done:!1};case 5:t.label++,i=x[1],x=[0];continue;case 7:x=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(x[0]===6||x[0]===2)){t=0;continue}if(x[0]===3&&(!o||x[1]>o[0]&&x[1]0&&o[o.length-1])&&(x[0]===6||x[0]===2)){t=0;continue}if(x[0]===3&&(!o||x[1]>o[0]&&x[1]1e4)&&this.throwError(new Error("Color temperature must be between 1800 and 10000")),n={image:{color_temperature:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.color_temperature)===e]}})})},f.prototype.getColorTemperature=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{color_temperature:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.color_temperature]}})})},f.prototype.setMirror=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{mirror:e?1:0}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.mirror)===(e?1:0)]}})})},f.prototype.getMirror=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{mirror:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,((e=n==null?void 0:n.image)===null||e===void 0?void 0:e.mirror)===1]}})})},f.prototype.setFlip=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{flip:e?1:0}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.flip)===(e?1:0)]}})})},f.prototype.getFlip=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{flip:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,((e=n==null?void 0:n.image)===null||e===void 0?void 0:e.flip)===1]}})})},f.prototype.setBacklightCompensation=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{backlight_compensation:e?1:0}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.backlight_compensation)===(e?1:0)]}})})},f.prototype.getBacklightCompensation=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{backlight_compensation:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,((e=n==null?void 0:n.image)===null||e===void 0?void 0:e.backlight_compensation)===1]}})})},f.prototype.setGamma=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{gamma:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.gamma)===e]}})})},f.prototype.getGamma=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{gamma:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.gamma]}})})},f.prototype.setWideDynamicRange=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:e=="Off"?{WDR_enable:0,WDR_level:1}:{WDR_enable:1,WDR_level:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.WDR_mode)===e]}})})},f.prototype.getWideDynamicRange=function(){var e,t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{WDR_enable:!0,WDR_level:!0}},[4,this.request("get",n)];case 1:return i=o.sent(),((e=i==null?void 0:i.image)===null||e===void 0?void 0:e.WDR_enable)===0?[2,"Off"]:[2,(t=i==null?void 0:i.image)===null||t===void 0?void 0:t.WDR_level]}})})},f.prototype.setBrightness=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{brightness:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.brightness)===e]}})})},f.prototype.getBrightness=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{brightness:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.brightness]}})})},f.prototype.setSharpness=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{sharpness:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.sharpness)===e]}})})},f.prototype.getSharpness=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{sharpness:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.sharpness]}})})},f.prototype.setContrast=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{contrast:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.contrast)===e]}})})},f.prototype.getContrast=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{contrast:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.contrast]}})})},f.prototype.setSaturation=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{saturation:e}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.saturation)===e]}})})},f.prototype.getSaturation=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{saturation:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,(e=n==null?void 0:n.image)===null||e===void 0?void 0:e.saturation]}})})},f.prototype.set2dNoiseReduction=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{noise_reduction_2D:e?1:0}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.noise_reduction_2D)===(e?1:0)]}})})},f.prototype.get2dNoiseReduction=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{noise_reduction_2D:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),[2,((e=n==null?void 0:n.image)===null||e===void 0?void 0:e.noise_reduction_2D)===1]}})})},f.prototype.set3dNoiseReduction=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{noise_reduction_3D:ee.NOISEREDUCTION3D_MODE[e]}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.noise_reduction_3D)===ee.NOISEREDUCTION3D_MODE[e]]}})})},f.prototype.get3dNoiseReduction=function(){var e;return F(this,void 0,void 0,function(){var t,n;return U(this,function(i){switch(i.label){case 0:return t={image:{noise_reduction_3D:!0}},[4,this.request("get",t)];case 1:return n=i.sent(),isNaN((e=n==null?void 0:n.image)===null||e===void 0?void 0:e.noise_reduction_3D)?[2,null]:[2,Object.keys(ee.NOISEREDUCTION3D_MODE).find(function(o){return ee.NOISEREDUCTION3D_MODE[o]===n.image.noise_reduction_3D})]}})})},f.prototype.getRTSPUrl=function(e){var t,n;return e===void 0&&(e="main"),F(this,void 0,void 0,function(){var i,o;return U(this,function(S){switch(S.label){case 0:return i={venc:{main:e==="main",sub:e==="sub"}},[4,this.request("get",i)];case 1:return o=S.sent(),[2,(n=(t=o==null?void 0:o.venc)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.rtspUrl]}})})},f.prototype.getRTMPUrl=function(e){var t,n;return e===void 0&&(e="main"),F(this,void 0,void 0,function(){var i,o;return U(this,function(S){switch(S.label){case 0:return i={venc:{main:e==="main",sub:e==="sub"}},[4,this.request("get",i)];case 1:return o=S.sent(),[2,(n=(t=o==null?void 0:o.venc)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.rtmpUrl]}})})},f.prototype.getFLVUrl=function(e){var t,n;return e===void 0&&(e="main"),F(this,void 0,void 0,function(){var i,o;return U(this,function(S){switch(S.label){case 0:return i={venc:{main:e==="main",sub:e==="sub"}},[4,this.request("get",i)];case 1:return o=S.sent(),[2,(n=(t=o==null?void 0:o.venc)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.httpFlvUrl]}})})},f.prototype.getWebRTCUrl=function(e){var t,n;return e===void 0&&(e="main"),F(this,void 0,void 0,function(){var i,o;return U(this,function(S){switch(S.label){case 0:return i={venc:{main:e==="main",sub:e==="sub"}},[4,this.request("get",i)];case 1:return o=S.sent(),[2,(n=(t=o==null?void 0:o.venc)===null||t===void 0?void 0:t[e])===null||n===void 0?void 0:n.webRtcUrl]}})})},f.prototype.recallPreset=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{preset:{call:e}}},[4,this.request("set",n)];case 1:return i=o.sent(),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.preset)===!0]}})})},f.prototype.setPreset=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{preset:{add:e}}},[4,this.request("set",n)];case 1:return i=o.sent(),console.log("Set preset response:",i),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.preset)===!0]}})})},f.prototype.clearPreset=function(e){var t;return F(this,void 0,void 0,function(){var n,i;return U(this,function(o){switch(o.label){case 0:return n={image:{preset:{del:e}}},[4,this.request("set",n)];case 1:return i=o.sent(),console.log("Set preset response:",i),[2,((t=i==null?void 0:i.image)===null||t===void 0?void 0:t.preset)===!0]}})})},f.prototype.throwError=function(e){if(typeof this._onError=="function")return this._onError(e);throw e},f.prototype.onError=function(e){return F(this,void 0,void 0,function(){return U(this,function(t){return this._onError=e,[2]})})},f.prototype.whenReady=function(){return F(this,void 0,void 0,function(){var e=this;return U(this,function(t){return this.ready?[2]:[2,new Promise(function(n){var i=setInterval(function(){e.ready&&(clearInterval(i),n())},100)})]})})},f.prototype.request=function(e,t){return F(this,void 0,void 0,function(){var n,i,o,S;return U(this,function(E){switch(E.label){case 0:return E.trys.push([0,3,,4]),n="http://".concat(this.ip,"/cgi-bin/web.fcgi?func=").concat(e),i=Ne({key:this.token},t),[4,fetch(n,{method:"POST",body:JSON.stringify(i)})];case 1:return o=E.sent(),[4,o.json()];case 2:return[2,E.sent()];case 3:return S=E.sent(),this.throwError(S),[2,null];case 4:return[2]}})})},f}();De.EveretPTZ=ut;(function(f){Object.defineProperty(f,"__esModule",{value:!0}),f.EveretPTZ=void 0;var e=De;Object.defineProperty(f,"EveretPTZ",{enumerable:!0,get:function(){return e.EveretPTZ}})})(qe);const Me=(f,e)=>{const t=e.x-f.x,n=e.y-f.y;return Math.sqrt(t*t+n*n)},ct=(f,e)=>{const t=e.x-f.x,n=e.y-f.y;return ft(Math.atan2(n,t))},dt=(f,e,t)=>{const n={x:0,y:0};return t=je(t),n.x=f.x-e*Math.cos(t),n.y=f.y-e*Math.sin(t),n},je=f=>f*(Math.PI/180),ft=f=>f*(180/Math.PI),ht=f=>isNaN(f.buttons)?f.pressure!==0:f.buttons!==0,Fe=new Map,We=f=>{Fe.has(f)&&clearTimeout(Fe.get(f)),Fe.set(f,setTimeout(f,100))},Pe=(f,e,t)=>{const n=e.split(/[ ,]+/g);let i;for(let o=0;o{const n=e.split(/[ ,]+/g);let i;for(let o=0;o(f.preventDefault(),f.type.match(/^touch/)?f.changedTouches:f),Ke=()=>{const f=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,e=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:f,y:e}},ze=(f,e)=>{e.top||e.right||e.bottom||e.left?(f.style.top=e.top,f.style.right=e.right,f.style.bottom=e.bottom,f.style.left=e.left):(f.style.left=e.x+"px",f.style.top=e.y+"px")},Ge=(f,e,t)=>{const n=Ye(f);for(let i in n)if(n.hasOwnProperty(i))if(typeof e=="string")n[i]=e+" "+t;else{let o="";for(let S=0,E=e.length;S{const t=Ye(f);for(let n in t)t.hasOwnProperty(n)&&(t[n]=e);return t},Ye=f=>{const e={};return e[f]="",["webkit","Moz","o"].forEach(function(n){e[n+f.charAt(0).toUpperCase()+f.slice(1)]=""}),e},Ue=(f,e)=>{for(let t in e)e.hasOwnProperty(t)&&(f[t]=e[t]);return f},_t=(f,e)=>{const t={};for(let n in f)f.hasOwnProperty(n)&&e.hasOwnProperty(n)?t[n]=e[n]:f.hasOwnProperty(n)&&(t[n]=f[n]);return t},$e=(f,e)=>{if(f.length)for(let t=0,n=f.length;t({x:Math.min(Math.max(f.x,e.x-t),e.x+t),y:Math.min(Math.max(f.y,e.y-t),e.y+t)});var vt="ontouchstart"in window,gt=!!window.PointerEvent,yt=!!window.MSPointerEvent,Ce={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},Le,Oe={};gt?Le=Ce.pointer:yt?Le=Ce.MSPointer:vt?(Le=Ce.touch,Oe=Ce.mouse):Le=Ce.mouse;function ge(){}ge.prototype.on=function(f,e){var t=this,n=f.split(/[ ,]+/g),i;t._handlers_=t._handlers_||{};for(var o=0;o=0&&t._handlers_[f].splice(t._handlers_[f].indexOf(e),1),t};ge.prototype.trigger=function(f,e){var t=this,n=f.split(/[ ,]+/g),i;t._handlers_=t._handlers_||{};for(var o=0;ot&&e-t&&e<=t&&!f.lockY?i="left":e>-t*3&&e<=-t&&!f.lockX?i="down":f.lockY||(i="right"),f.lockY||(e>-n&&e0?S="up":S="down"),f.force>this.options.threshold){var E={},y;for(y in this.direction)this.direction.hasOwnProperty(y)&&(E[y]=this.direction[y]);var x={};this.direction={x:o,y:S,angle:i},f.direction=this.direction;for(y in E)E[y]===this.direction[y]&&(x[y]=!0);if(x.x&&x.y&&x.angle)return f;(!x.x||!x.y)&&this.trigger("plain",f),x.x||this.trigger("plain:"+o,f),x.y||this.trigger("plain:"+S,f),x.angle||this.trigger("dir dir:"+i,f)}else this.resetDirection();return f};function te(f,e){var t=this;t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.pressureIntervals={},t.manager=f,t.id=te.id,te.id+=1,t.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},t.config(e),(t.options.mode==="static"||t.options.mode==="semi")&&(t.options.multitouch=!1),t.options.multitouch||(t.options.maxNumberOfNipples=1);const n=getComputedStyle(t.options.zone.parentElement);return n&&n.display==="flex"&&(t.parentIsFlex=!0),t.updateBox(),t.prepareNipples(),t.bindings(),t.begin(),t.nipples}te.prototype=new ge;te.constructor=te;te.id=0;te.prototype.prepareNipples=function(){var f=this,e=f.nipples;e.on=f.on.bind(f),e.off=f.off.bind(f),e.options=f.options,e.destroy=f.destroy.bind(f),e.ids=f.ids,e.id=f.id,e.processOnMove=f.processOnMove.bind(f),e.processOnEnd=f.processOnEnd.bind(f),e.get=function(t){if(t===void 0)return e[0];for(var n=0,i=e.length;n