var f=Object.defineProperty;var y=(r,e,t)=>e in r?f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var c=(r,e,t)=>(y(r,typeof e!="symbol"?e+"":e,t),t);import{P as p,W as u,V as g,R as b,C as d}from"./index-7a0f6c6e.js";var P=Object.defineProperty,v=Object.getOwnPropertyDescriptor,l=(r,e,t,n)=>{for(var a=n>1?void 0:n?v(e,t):e,s=r.length-1,i;s>=0;s--)(i=r[s])&&(a=(n?i(e,t,a):i(a))||a);return n&&a&&P(e,t,a),a};let m=class extends g{constructor(){super(...arguments);c(this,"camera");c(this,"crossorigin");c(this,"streamingElement");c(this,"cameraTransformStyle","");c(this,"animating",!1)}onCamera(){this.stopPlayback(),this.checkPlayback()}get apiUrl(){return this.$store.state.config.apiUrl}get cameraStyle(){return{transform:this.cameraTransformStyle||void 0}}createTransform(){const e=this.streamingElement,{rotation:t,flipX:n,flipY:a}=this.camera,s=[],{clientWidth:i,clientHeight:h}=e,o=t===0||t===180||h===0||i===0?1:h<i?h/i:i/h;return(o!==1||n)&&s.push(`scaleX(${n?-o:o})`),(o!==1||a)&&s.push(`scaleY(${a?-o:o})`),t!==0&&s.push(`rotate(${t}deg`),s.join(" ")}updateCameraTransformStyle(){requestAnimationFrame(()=>{this.animating&&(this.streamingElement&&(this.cameraTransformStyle=this.createTransform()),this.updateCameraTransformStyle())})}created(){this.animating=!0,this.updateCameraTransformStyle()}mounted(){document.addEventListener("visibilitychange",this.checkPlayback,!1),this.checkPlayback()}beforeDestroy(){this.animating=!1,document.removeEventListener("visibilitychange",this.checkPlayback),this.stopPlayback()}checkPlayback(){document.hidden?this.stopPlayback():this.startPlayback()}buildAbsoluteUrl(e){const{origin:t}=new URL(document.URL);return new URL(e,t)}startPlayback(){}stopPlayback(){}};l([p({type:Object,required:!0})],m.prototype,"camera",2);l([p({type:String})],m.prototype,"crossorigin",2);l([b("streamingElement")],m.prototype,"streamingElement",2);l([u("camera")],m.prototype,"onCamera",1);m=l([d],m);export{m as C};
