PageSourceSearch

https://ross146.com/frontend_latest/16367.c66b0cb49614898d.js

js ross146.com collected 2026-09-28 01:53:26 UTC 25,373 bytes, 2 lines download raw bytes

1export const __webpack_ids__=["16367"];export const __webpack_modules__={39800:function(t,e,i){i.d(e,{Z:()=>s});const a=t=>{const e=parseFloat(t);if(isNaN(e))throw new Error(`${t} is not a number`);return e};function s(t){if(!t)return null;try{if(t.endsWith("%"))return{w:100,h:a(t.substr(0,t.length-1))};const e=t.replace(":","x").split("x");return 0===e.length?null:1===e.length?{w:a(e[0]),h:1}:{w:a(e[0]),h:a(e[1])}}catch(t){}return null}},3370:function(t,e,i){var a=i(73742),s=i(59048),o=i(26292),r=i(88245),n=i(20480),d=i(28105),h=i(15459),l=i(36590),c=i(36925),_=(i(71150),i(2394),i(81738),i(22960),i(25191)),p=i(39884);i(12942);class y extends s.oi{render(){return this._error?s.dy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.dy` <video id="remote-stream" ?autoplay="${this.autoPlay}" .muted="${this.muted}" ?playsinline="${this.playsInline}" ?controls="${this.controls}" poster="${(0,_.o)(this.posterUrl)}" @loadeddata="${this._loadedData}" style="${(0,n.V)({height:null==this.aspectRatio?"100%":"auto",aspectRatio:this.aspectRatio,objectFit:this.fitMode})}"></video> `}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.entityid&&this._startWebRtc()}disconnectedCallback(){super.disconnectedCallback(),this._cleanUp()}willUpdate(t){super.willUpdate(t),t.has("entityid")&&this._startWebRtc()}async _startWebRtc(){if(this._cleanUp(),"undefined"==typeof RTCPeerConnection)return this._error="WebRTC is not supported in this browser",void(0,p.B)(this,"streams",{hasAudio:!1,hasVideo:!1});this.hass&&this.entityid&&(this._error=void 0,this._startTimer(),this._logEvent("start clientConfig"),this._clientConfig=await(0,c.z9)(this.hass,this.entityid),this._logEvent("end clientConfig",this._clientConfig),this._peerConnection=new RTCPeerConnection(this._clientConfig.configuration),this._clientConfig.dataChannel&&this._peerConnection.createDataChannel(this._clientConfig.dataChannel),this._peerConnection.onnegotiationneeded=this._startNegotiation,this._peerConnection.onicecandidate=this._handleIceCandidate,this._peerConnection.oniceconnectionstatechange=this._iceConnectionStateChanged,this._peerConnection.onsignalingstatechange=t=>{if("stable"===t.target.signalingState)this._logEvent("ICE negotiation complete");else this._logEvent("Signaling state changed",t.target.signalingState)},this._remoteStream=new MediaStream,this._peerConnection.ontrack=this._addTrack,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}))}async _handleOfferEvent(t){if(this.entityid){if("session"===t.type&&(this._sessionId=t.session_id,this._candidatesList.forEach(e=>(0,c.r)(this.hass,this.entityid,t.session_id,e.toJSON())),this._candidatesList=[]),"answer"===t.type&&(this._logEvent("answer",t.answer),this._handleAnswer(t)),"candidate"===t.type){this._logEvent("remote ice candidate",t.candidate);try{const e=t.candidate.sdpMid||null!=t.candidate.sdpMLineIndex?new RTCIceCandidate(t.candidate):new RTCIceCandidate({candidate:t.candidate.candidate,sdpMid:"0"});await(this._peerConnection?.addIceCandidate(e))}catch(t){console.error(t)}}"error"===t.type&&(this._error="Failed to start WebRTC stream: "+t.message,this._cleanUp())}}async _handleAnswer(t){if(!this._peerConnection?.signalingState||["stable","closed"].includes(this._peerConnection.signalingState))return;const e=new RTCSessionDescription({type:"answer",sdp:t.answer});try{this._logEvent("start setRemoteDescription",e),await this._peerConnection.setRemoteDescription(e)}catch(t){this._error="Failed to connect WebRTC stream: "+t.message,this._cleanUp()}this._logEvent("end setRemoteDescription")}_cleanUp(){this._remoteStream&&(this._remoteStream.getTracks().forEach(t=>{t.stop()}),this._remoteStream=void 0);const t=this._videoEl;t&&(t.removeAttribute("src"),t.load()),this._peerConnection&&(this._peerConnection.close(),this._peerConnection.onnegotiationneeded=null,this._peerConnection.onicecandidate=null,this._peerConnection.oniceconnectionstatechange=null,this._peerConnection.onicegatheringstatechange=null,this._peerConnection.ontrack=null,this._peerConnection.onsignalingstatechange=null,this._peerConnection=void 0,this._logEvent("stopped"),this._stopTimer()),this._unsub?.then(t=>t()),this._unsub=void 0,this._sessionId=void 0,this._candidatesList=[]}_loadedData(){const t=this._videoEl.srcObject,e={hasAudio:Boolean(t?.getAudioTracks().length),hasVideo:Boolean(t?.getVideoTracks().length)};(0,p.B)(this,"load"),(0,p.B)(this,"streams",e),this._logEvent("loadedData",e),this._stopTimer()}_startTimer(){}_stopTimer(){}_logEvent(t,...e){}constructor(...t){super(...t),this.controls=!1,this.muted=!1,this.autoPlay=!1,this.playsInl
1ine=!1,this._candidatesList=[],this._startNegotiation=async()=>{if(!this._peerConnection)return;const t={offerToReceiveAudio:!0,offerToReceiveVideo:!0};this._logEvent("start createOffer",t);const e=await this._peerConnection.createOffer(t);if(!this._peerConnection)return;if(this._logEvent("end createOffer",e),this._logEvent("start setLocalDescription"),await this._peerConnection.setLocalDescription(e),!this._peerConnection||!this.entityid)return;this._logEvent("end setLocalDescription");let i="";for(;this._candidatesList.length;){const t=this._candidatesList.pop();t&&(i+=`a=${t}\r\n`)}const a=e.sdp+i;this._logEvent("start webRtcOffer",a);try{this._unsub=(0,c.T9)(this.hass,this.entityid,a,t=>this._handleOfferEvent(t))}catch(t){this._error="Failed to start WebRTC stream: "+t.message,this._cleanUp()}},this._iceConnectionStateChanged=()=>{this._logEvent("ice connection state change",this._peerConnection?.iceConnectionState),"failed"===this._peerConnection?.iceConnectionState&&this._peerConnection.restartIce()},this._handleIceCandidate=t=>{this.entityid&&t.candidate?.candidate&&(this._logEvent("local ice candidate",t.candidate?.candidate,t.candidate?.sdpMLineIndex),this._sessionId?(0,c.r)(this.hass,this.entityid,this._sessionId,t.candidate.toJSON()):this._candidatesList.push(t.candidate))},this._addTrack=async t=>{this._remoteStream&&(this._remoteStream.addTrack(t.track),this.hasUpdated||await this.updateComplete,this._videoEl.srcObject=this._remoteStream)}}}y.styles=s.iv`:host,video{display:block}video{width:100%;max-height:var(--video-max-height,calc(100vh - 97px))}`,(0,a.__decorate)([(0,o.Cb)({attribute:!1})],y.prototype,"hass",void 0),(0,a.__decorate)([(0,o.Cb)()],y.prototype,"entityid",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],y.prototype,"aspectRatio",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],y.prototype,"fitMode",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"controls"})],y.prototype,"controls",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"muted"})],y.prototype,"muted",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"autoplay"})],y.prototype,"autoPlay",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"playsinline"})],y.prototype,"playsInline",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:"poster-url"})],y.prototype,"posterUrl",void 0),(0,a.__decorate)([(0,o.SB)()],y.prototype,"_error",void 0),(0,a.__decorate)([(0,o.IO)("#remote-stream")],y.prototype,"_videoEl",void 0),y=(0,a.__decorate)([(0,o.Mo)("ha-web-rtc-player")],y);const m="mjpeg";class u extends s.oi{willUpdate(t){t.has("stateObj")&&this.stateObj&&t.get("stateObj")?.entity_id!==this.stateObj.entity_id&&(this._getCapabilities(),this._getPosterUrl())}connectedCallback(){super.connectedCallback(),this._connected=!0}disconnectedCallback(){super.disconnectedCallback(),this._connected=!1}render(){if(!this.stateObj)return s.Ld;const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams);return s.dy`${(0,r.r)(t,t=>t.type+this.stateObj.entity_id,t=>this._renderStream(t))}`}_renderStream(t){return this.stateObj?t.type===m?s.dy`<img .src="${this._connected?(0,c.nk)(this.stateObj):this._posterUrl||""}" style="${(0,n.V)({aspectRatio:this.aspectRatio,objectFit:this.fitMode})}" alt="${`Preview of the ${(0,h.C)(this.stateObj)} camera.`}">`:t.type===c.kU?s.dy`<ha-hls-player autoplay playsinline .allowExoPlayer="${this.allowExoPlayer}" .muted="${this.muted}" .controls="${this.controls}" .hass="${this.hass}" .entityid="${this.stateObj.entity_id}" .posterUrl="${this._posterUrl}" @streams="${this._handleHlsStreams}" class="${t.visible?"":"hidden"}" .aspectRatio="${this.aspectRatio}" .fitMode="${this.fitMode}"></ha-hls-player>`:t.type===c.jU?s.dy`<ha-web-rtc-player autoplay playsinline .muted="${this.muted}" .controls="${this.controls}" .hass="${this.hass}" .entityid="${this.stateObj.entity_id}" .posterUrl="${this._posterUrl}" @streams="${this._handleWebRtcStreams}" class="${t.visible?"":"hidden"}" .aspectRatio="${this.aspectRatio}" .fitMode="${this.fitMode}"></ha-web-rtc-player>`:s.Ld:s.Ld}async _getCapabilities(){this._capabilities=void 0,this._hlsStreams=void 0,this._webRtcStreams=void 0,(0,l.e)(this.stateObj,c.qW)?this._capabilities=await(0,c.ou)(this.hass,this.stateObj.entity_id):this._capabilities={frontend_stream_types:[]}}async _getPosterUrl(){try{this._posterUrl=await(0,c.i4)(this.hass,this.stateObj.entity_id,this.clientWidth,this.clientHeight)}catch(t){this._posterUrl=void 0}}_handleHlsStreams(t){this._hlsStreams=t.detail}_handleWebRtcStreams(t){this._webRtcStreams=t.detail}constructor(...t){super(...t),this.controls=!1,this.muted=!1,this.allowExoPlayer=!1,this._connected=!1,this._streams=(0,d.Z)((t,e,i)=>{if(!t)return[];if(0===t.length)return[{type:m,visible:!0}];if(1===t.length)return t[0]===c.kU&&!1===e?.hasVideo||t[0]===c.jU&&!1===i?.hasVideo?[{type:m,visible:!0}]:[{type:t[0],visible:!0}];if(e&&i)return e.hasVideo&&e.hasAudio&&!i.hasAudio?[{type:c.kU,visible:!0}]:i.hasVideo?[{type:c.jU,visible:!0}]:[{type:m,visible:!0}];if(e?.hasVideo!==i?.hasVideo){if(e?.hasVideo)return[{type:c.kU,visible:!0},{type:c.jU,visible:!1}];if(!1===e?.hasVideo)return[{type:c.jU,visible:!0}];if(i?.hasVideo)return[{type:c.jU,visible:!0},{type:c.kU,visible:!1}];if(!1===i?.hasVideo)return[{type:c.kU,visible:!0}]}return[{type:c.kU,visible:!0},{type:c.jU,visible:!1}]})}}u.styles=s.iv`:host,img{display:block}img{width:100%}ha-web-rtc-player{width:100%;height:100%}ha-hls-player{width:100%;height:100%}.hidden{display:none}`,(0,a.__decorate)([(0,o.Cb)({attribute:!1})],u.prototype,"hass",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],u.prototype,"stateObj",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1}
1)],u.prototype,"aspectRatio",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],u.prototype,"fitMode",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"controls"})],u.prototype,"controls",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"muted"})],u.prototype,"muted",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"allow-exoplayer"})],u.prototype,"allowExoPlayer",void 0),(0,a.__decorate)([(0,o.SB)()],u.prototype,"_posterUrl",void 0),(0,a.__decorate)([(0,o.SB)()],u.prototype,"_connected",void 0),(0,a.__decorate)([(0,o.SB)()],u.prototype,"_capabilities",void 0),(0,a.__decorate)([(0,o.SB)()],u.prototype,"_hlsStreams",void 0),(0,a.__decorate)([(0,o.SB)()],u.prototype,"_webRtcStreams",void 0),u=(0,a.__decorate)([(0,o.Mo)("ha-camera-stream")],u)},71150:function(t,e,i){i(36330),i(38221),i(75863);var a=i(73742),s=i(59048),o=i(26292),r=i(20480),n=i(37528),d=i(39884),h=i(65863),l=i(36925);i(12942);class c extends s.oi{connectedCallback(){super.connectedCallback(),c.streamCount+=1,this.hasUpdated&&(this._resetError(),this._startHls())}disconnectedCallback(){super.disconnectedCallback(),c.streamCount-=1,this._cleanUp()}render(){return s.dy` ${this._error?s.dy`<ha-alert alert-type="error" class="${this._errorIsFatal?"fatal":"retry"}"> ${this._error} </ha-alert>`:""} ${this._errorIsFatal?"":s.dy`<video .poster="${this.posterUrl}" ?autoplay="${this.autoPlay}" .muted="${this.muted}" ?playsinline="${this.playsInline}" ?controls="${this.controls}" @loadeddata="${this._loadedData}" style="${(0,r.V)({height:null==this.aspectRatio?"100%":"auto",aspectRatio:this.aspectRatio,objectFit:this.fitMode})}"></video>`} `}updated(t){super.updated(t);const e=t.has("entityid"),i=t.has("url");e?this._getStreamUrlFromEntityId():i&&this.url&&(this._cleanUp(),this._resetError(),this._url=this.url,this._startHls())}async _getStreamUrlFromEntityId(){if(this._cleanUp(),this._resetError(),(0,n.p)(this.hass,"stream")){if(this.entityid)try{const{url:t}=await(0,l.Lr)(this.hass,this.entityid);this._url=this.hass.hassUrl(t),this._cleanUp(),this._resetError(),this._startHls()}catch(t){console.error(t),(0,d.B)(this,"streams",{hasAudio:!1,hasVideo:!1})}}else this._setFatalError("Streaming component is not loaded.")}async _startHls(){const t=fetch(this._url),e=(await Promise.all([i.e("63873"),i.e("36724")]).then(i.bind(i,89914))).default;if(!this.isConnected)return;let a=e.isSupported();if(a||(a=""!==this._videoEl.canPlayType("application/vnd.apple.mpegurl")),!a)return void this._setFatalError(this.hass.localize("ui.components.media-browser.video_not_supported"));const s=this.allowExoPlayer&&this.hass.auth.external?.config.hasExoPlayer,o=await(await t).text();if(!this.isConnected)return;const r=/#EXT-X-STREAM-INF:.*?(?:CODECS=".*?([^.]*)?\..*?,([^.]*)?\..*?".*?)?(?:\n|\r\n)(.+)/g,n=r.exec(o),d=r.exec(o);let h;h=null!==n&&null===d?new URL(n[3],this._url).href:this._url;const l=n?`${n[1]},${n[2]}`:void 0;this._reportStreams(l),s&&(l?.includes("hevc")||l?.includes("hev1"))?this._renderHLSExoPlayer(h):e.isSupported()?this._renderHLSPolyfill(this._videoEl,e,h):this._renderHLSNative(this._videoEl,h)}async _renderHLSExoPlayer(t){this._exoPlayer=!0,window.addEventListener("resize",this._resizeExoPlayer),this.updateComplete.then(()=>(0,h.y)()).then(this._resizeExoPlayer),this._videoEl.style.visibility="hidden",await this.hass.auth.external.fireMessage({type:"exoplayer/play_hls",payload:{url:t,muted:this.muted}})}_isLLHLSSupported(){if(c.streamCount<=2)return!0;if(!("performance"in window)||0===performance.getEntriesByType("resource").length)return!1;const t=performance.getEntriesByType("resource")[0];return"nextHopProtocol"in t&&"h2"===t.nextHopProtocol}async _renderHLSPolyfill(t,e,i){const a=new e({backBufferLength:60,fragLoadingTimeOut:3e4,manifestLoadingTimeOut:3e4,levelLoadingTimeOut:3e4,maxLiveSyncPlaybackRate:2,lowLatencyMode:this._isLLHLSSupported()});this._hlsPolyfillInstance=a,a.attachMedia(t),a.on(e.Events.MEDIA_ATTACHED,()=>{this._resetError(),a.loadSource(i)}),a.on(e.Events.FRAG_LOADED,(t,e)=>{this._resetError()}),a.on(e.Events.ERROR,(t,i)=>
1{if(i.fatal)if(i.type===e.ErrorTypes.NETWORK_ERROR){switch(i.details){case e.ErrorDetails.MANIFEST_LOAD_ERROR:{let t="Error starting stream, see logs for details";void 0!==i.response&&void 0!==i.response.code&&(i.response.code>=500?t+=" (Server failure)":i.response.code>=400?t+=" (Stream never started)":t+=" ("+i.response.code+")"),this._setRetryableError(t);break}case e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:this._setRetryableError("Timeout while starting stream");break;default:this._setRetryableError("Stream network error")}a.startLoad()}else i.type===e.ErrorTypes.MEDIA_ERROR?(this._setRetryableError("Error with media stream contents"),a.recoverMediaError()):this._setFatalError("Error playing stream")})}async _renderHLSNative(t,e){t.src=e,t.addEventListener("loadedmetadata",()=>{t.play()})}_cleanUp(){this._hlsPolyfillInstance&&(this._hlsPolyfillInstance.destroy(),this._hlsPolyfillInstance=void 0),this._exoPlayer&&(window.removeEventListener("resize",this._resizeExoPlayer),this.hass.auth.external.fireMessage({type:"exoplayer/stop"}),this._exoPlayer=!1),this._videoEl&&(this._videoEl.removeAttribute("src"),this._videoEl.load())}_resetError(){this._error=void 0,this._errorIsFatal=!1}_setFatalError(t){this._error=t,this._errorIsFatal=!0,(0,d.B)(this,"streams",{hasAudio:!1,hasVideo:!1})}_setRetryableError(t){this._error=t,this._errorIsFatal=!1,(0,d.B)(this,"streams",{hasAudio:!1,hasVideo:!1})}_reportStreams(t){const e=t?.split(",");(0,d.B)(this,"streams",{hasAudio:e?.includes("mp4a")??!1,hasVideo:e?.includes("mp4a")?e?.length>1:Boolean(e?.length)})}_loadedData(){(0,d.B)(this,"load")}constructor(...t){super(...t),this.controls=!1,this.muted=!1,this.autoPlay=!1,this.playsInline=!1,this.allowExoPlayer=!1,this._errorIsFatal=!1,this._exoPlayer=!1,this._resizeExoPlayer=()=>{if(!this._videoEl)return;const t=this._videoEl.getBoundingClientRect();this.hass.auth.external.fireMessage({type:"exoplayer/resize",payload:{left:t.left,top:t.top,right:t.right,bottom:t.bottom}})}}}c.streamCount=0,c.styles=s.iv`:host,video{display:block}video{width:100%;max-height:var(--video-max-height,calc(100vh - 97px))}.fatal{display:block;padding:100px 16px}.retry{display:block}`,(0,a.__decorate)([(0,o.Cb)({attribute:!1})],c.prototype,"hass",void 0),(0,a.__decorate)([(0,o.Cb)()],c.prototype,"entityid",void 0),(0,a.__decorate)([(0,o.Cb)()],c.prototype,"url",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:"poster-url"})],c.prototype,"posterUrl",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],c.prototype,"aspectRatio",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],c.prototype,"fitMode",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"controls"})],c.prototype,"controls",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"muted"})],c.prototype,"muted",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"autoplay"})],c.prototype,"autoPlay",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"playsinline"})],c.prototype,"playsInline",void 0),(0,a.__decorate)([(0,o.Cb)({type:Boolean,attribute:"allow-exoplayer"})],c.prototype,"allowExoPlayer",void 0),(0,a.__decorate)([(0,o.IO)("video")],c.prototype,"_videoEl",void 0),(0,a.__decorate)([(0,o.SB)()],c.prototype,"_error",void 0),(0,a.__decorate)([(0,o.SB)()],c.prototype,"_errorIsFatal",void 0),(0,a.__decorate)([(0,o.SB)()],c.prototype,"_url",void 0),c=(0,a.__decorate)([(0,o.Mo)("ha-hls-player")],c)},42236:function(t,e,i){i.d(e,{U:()=>a});const a=t=>`/api/image_proxy/${t.entity_id}?token=${t.attributes.access_token}&state=${t.state}`},12723:function(t,e,i){i.a(t,async function(t,e){try{i(81738),i(94814);var a=i(73742),s=i(59048),o=i(26292),r=i(31733),n=i(20480),d=i(40141),h=i(44272),l=i(39800),c=(i(3370),i(6514)),_=i(36925),p=i(16230),y=i(42236),m=t([c]);c=(m.then?(await m)():m)[0];const u=1e4,v="grayscale(100%)",g=640,b=9/16;class C extends s.oi{connectedCallback(){super.connectedCallback(),void 0===this._loadState&&(this._loadState=1),this.cameraImage&&"live"!==this.cameraView&&this._startIntersectionObserverOrUpdates()}disconnectedCallback(){super.disconnectedCallback(),this._stopUpdateCameraInterval(),this._stopIntersectionObserver(),this._imageVisible=void 0}handleIntersectionCallback(t){this._imageVisible=t[0].isIntersecting}willUpdate(t){if(t.has("hass")){const e=t.get("hass");this._shouldStartCameraUpdates(e)?this._startIntersectionObserverOrUpd
1ates():this.hass.connected||(this._stopUpdateCameraInterval(),this._stopIntersectionObserver(),this._loadState=1,this._cameraImageSrc=void 0,this._loadedImageSrc=void 0)}t.has("_imageVisible")&&(this._imageVisible?this._shouldStartCameraUpdates()&&this._startUpdateCameraInterval():this._stopUpdateCameraInterval()),t.has("aspectRatio")&&(this._ratio=this.aspectRatio?(0,l.Z)(this.aspectRatio):null),1!==this._loadState||this.cameraImage||(this._loadState=2)}render(){if(!this.hass)return s.Ld;const t=Boolean(this._ratio&&this._ratio.w>0&&this._ratio.h>0),e=this.entity?this.hass.states[this.entity]:void 0,i=e?e.state:p.nZ;let a,o,l=!this.stateImage;if(this.cameraImage)"live"===this.cameraView?o=this.hass.states[this.cameraImage]:a=this._cameraImageSrc;else if(this.stateImage){const t=this.stateImage[i];t?a=t:(a=this.image,l=!0)}else a=this.darkModeImage&&this.hass.themes.darkMode?this.darkModeImage:e&&"image"===(0,h.M)(e.entity_id)?(0,y.U)(e):this.image;a&&(a=this.hass.hassUrl(a));let c=this.filter||"";if(this.hass.themes.darkMode&&this.darkModeFilter&&(c+=this.darkModeFilter),this.stateFilter&&this.stateFilter[i]&&(c+=this.stateFilter[i]),!c&&this.entity){c=(!e||d.tj.includes(i))&&l?v:""}return s.dy` <div style="${(0,n.V)({paddingBottom:t?`${(100*this._ratio.h/this._ratio.w).toFixed(2)}%`:void 0===this._lastImageHeight?"56.25%":void 0,backgroundImage:t&&this._loadedImageSrc?`url("${this._loadedImageSrc}")`:void 0,filter:2===this._loadState||"live"===this.cameraView?c:void 0})}" class="container ${(0,r.$)({ratio:t||void 0===this._lastImageHeight,contain:"contain"===this.fitMode,fill:"fill"===this.fitMode})}"> ${this.cameraImage&&"live"===this.cameraView?s.dy` <ha-camera-stream muted .hass="${this.hass}" .stateObj="${o}" .fitMode="${this.fitMode}" .aspectRatio="${this._ratio?this._ratio.w/this._ratio.h:void 0}" @load="${this._onVideoLoad}"></ha-camera-stream> `:void 0===a?s.Ld:s.dy` <img id="image" src="${a}" alt="${this.entity||""}" @error="${this._onImageError}" @load="${this._onImageLoad}" style="${(0,n.V)({display:t||2===this._loadState?"block":"none"})}"> `} ${3===this._loadState?s.dy`<div id="brokenImage" style="${(0,n.V)({height:t?void 0:`${this._lastImageHeight}px`||"100%"})}"></div>`:"live"===this.cameraView||void 0!==a&&1!==this._loadState?"":s.dy`<div class="progress-container" style="${(0,n.V)({height:t?void 0:`${this._lastImageHeight}px`||"100%"})}"> <ha-spinner class="render-spinner" size="small"></ha-spinner> </div>`} </div> `}_shouldStartCameraUpdates(t){return!(t&&t.connected===this.hass.connected||!this.hass.connected||"live"===this.cameraView)}_startIntersectionObserverOrUpdates(){"IntersectionObserver"in window?(this._intersectionObserver||(this._intersectionObserver=new IntersectionObserver(this.handleIntersectionCallback.bind(this))),this._intersectionObserver.observe(this)):(this._imageVisible=!0,this._startUpdateCameraInterval())}_stopIntersectionObserver(){this._intersectionObserver&&this._intersectionObserver.disconnect()}
1_startUpdateCameraInterval(){this._stopUpdateCameraInterval(),this._updateCameraImageSrc(),this.cameraImage&&this.isConnected&&(this._cameraUpdater=window.setInterval(()=>this._updateCameraImageSrcAtInterval(),u))}_stopUpdateCameraInterval(){this._cameraUpdater&&(clearInterval(this._cameraUpdater),this._cameraUpdater=void 0)}_onImageError(){this._loadState=3}async _onImageLoad(t){this._loadState=2;const e=t.target;this._ratio&&this._ratio.w>0&&this._ratio.h>0&&(this._loadedImageSrc=e.src),await this.updateComplete,this._lastImageHeight=e.offsetHeight}async _onVideoLoad(t){this._loadState=2;const e=t.currentTarget;await this.updateComplete,this._lastImageHeight=e.offsetHeight}async _updateCameraImageSrcAtInterval(){return 1===this._loadState&&this._onImageError(),this._updateCameraImageSrc()}async _updateCameraImageSrc(){if(!this.hass||!this.cameraImage)return;if(!this.hass.states[this.cameraImage])return void this._onImageError();const t=this.clientWidth||g;let e,i=Math.ceil(t*devicePixelRatio);this._lastImageHeight?e=Math.ceil(this._lastImageHeight*devicePixelRatio):this._ratio&&this._ratio.w>0&&this._ratio.h>0?e=Math.ceil(i*(this._ratio.h/this._ratio.w)):(i*=2,e=Math.ceil(i*b)),this._cameraImageSrc=await(0,_.i4)(this.hass,this.cameraImage,i,e),void 0===this._cameraImageSrc&&this._onImageError()}constructor(...t){super(...t),this._imageVisible=!1,this._ratio=null}}C.styles=s.iv`:host{display:block}.container{transition:filter .2s linear;height:100%}img{display:block;height:100%;width:100%;object-fit:cover}ha-camera-stream{display:block;height:100%;width:100%}.progress-container{display:flex;justify-content:center;align-items:center}.ratio{position:relative;width:100%;height:0;background-position:center;background-size:cover}.ratio.fill{background-size:100% 100%}.ratio.contain{background-size:contain;background-repeat:no-repeat}.fill img{object-fit:fill}.contain img{object-fit:contain}.ratio div,.ratio img{position:absolute;top:0;left:0;width:100%;height:100%}.ratio img{visibility:hidden}#brokenImage{background:grey url("/static/images/image-broken.svg") center/36px no-repeat}`,(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"hass",void 0),(0,a.__decorate)([(0,o.Cb)()],C.prototype,"entity",void 0),(0,a.__decorate)([(0,o.Cb)()],C.prototype,"image",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"stateImage",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"cameraImage",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"cameraView",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"aspectRatio",void 0),(0,a.__decorate)([(0,o.Cb)()],C.prototype,"filter",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"stateFilter",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"darkModeImage",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:!1})],C.prototype,"darkModeFilter",void 0),(0,a.__decorate)([(0,o.Cb)({attribute:"fit-mode",type:String})],C.prototype,"fitMode",void 0),(0,a.__decorate)([(0,o.SB)()],C.prototype,"_imageVisible",void 0),(0,a.__decorate)([(0,o.SB)()],C.prototype,"_loadState",void 0),(0,a.__decorate)([(0,o.SB)()],C.prototype,"_cameraImageSrc",void 0),(0,a.__decorate)([(0,o.SB)()],C.prototype,"_loadedImageSrc",void 0),(0,a.__decorate)([(0,o.SB)()],C.prototype,"_lastImageHeight",void 0),C=(0,a.__decorate)([(0,o.Mo)("hui-image")],C),e()}catch(t){e(t)}})}};
2//# sourceMappingURL=16367.c66b0cb49614898d.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.