"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["65742"],{16349:function(t,a,e){e.a(t,async function(t,n){try{e.r(a);var o,i,r=e(61397),s=e(50264),c=e(72153),d=e(44734),h=e(43080),l=e(69683),u=e(6454),p=e(25460),f=(e(16280),e(28706),e(23792),e(26099),e(47764),e(62953),e(3296),e(27208),e(48408),e(14603),e(47566),e(98721),e(40445)),g=e(96196),v=e(77845),w=e(80880),b=e(89300),_=(e(55148),e(22675)),y=e(30039),m=e(81619),k=t([b]);b=(k.then?(await k)():k)[0];var A=function(t){function a(){var t;(0,d.A)(this,a);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return(t=(0,l.A)(this,a,[].concat(n)))._attached=!1,t._waiting=!1,t}return(0,u.A)(a,t),(0,h.A)(a,[{key:"connectedCallback",value:function(){(0,p.A)(a,"connectedCallback",this,3)([]),this._attached=!0}},{key:"disconnectedCallback",value:function(){(0,p.A)(a,"disconnectedCallback",this,3)([]),this._attached=!1}},{key:"render",value:function(){return this._attached&&this.stateObj?(0,g.qy)(o||(o=(0,c.A)([' <ha-camera-stream .hass="','" .stateObj="','" allow-exoplayer controls></ha-camera-stream> <div class="actions"> <ha-progress-button @click="','" .progress="','" .disabled="','" appearance="filled"> '," </ha-progress-button> </div> "])),this.hass,this.stateObj,this._downloadSnapshot,this._waiting,this.stateObj.state===_.Hh,this.hass.localize("ui.dialogs.more_info_control.camera.download_snapshot")):g.s6}},{key:"_downloadSnapshot",value:(e=(0,s.A)((0,r.A)().m(function t(a){var e,n,o,i,s,c,d,h;return(0,r.A)().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=a.currentTarget,this._waiting=!0,t.p=1,t.n=2,this.hass.callApiRaw("GET","camera_proxy/".concat(this.stateObj.entity_id));case 2:if(n=t.v){t.n=3;break}throw new Error("No response from API");case 3:return o=n.headers.get("content-type"),i="image/png"===o?"png":"jpg",s=(new Date).toLocaleString(),c="snapshot_".concat((0,w.Y)(this.stateObj.entity_id),"_").concat(s,".").concat(i),t.n=4,n.blob();case 4:d=t.v,h=window.URL.createObjectURL(d),(0,y.R)(h,c),t.n=6;break;case 5:return t.p=5,t.v,this._waiting=!1,e.actionError(),(0,m.P)(this,{message:this.hass.localize("ui.dialogs.more_info_control.camera.failed_to_download")}),t.a(2);case 6:this._waiting=!1,e.actionSuccess();case 7:return t.a(2)}},t,this,[[1,5]])})),function(t){return e.apply(this,arguments)})}]);var e}(g.WF);A.styles=(0,g.AH)(i||(i=(0,c.A)([":host{display:block}.actions{width:100%;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end;box-sizing:border-box;padding:var(--ha-space-4);z-index:1;gap:var(--ha-space-2)}"]))),(0,f.Cg)([(0,v.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,f.Cg)([(0,v.MZ)({attribute:!1})],A.prototype,"stateObj",void 0),(0,f.Cg)([(0,v.wk)()],A.prototype,"_attached",void 0),(0,f.Cg)([(0,v.wk)()],A.prototype,"_waiting",void 0),A=(0,f.Cg)([(0,v.EM)("more-info-camera")],A),n()}catch(C){n(C)}})},30039:function(t,a,e){e.d(a,{R:function(){return o},h:function(){return i}});var n=e(22348),o=function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=document.createElement("a");e.target="_blank",e.href=t,e.download=a,e.style.display="none",document.body.appendChild(e),e.dispatchEvent(new MouseEvent("click")),document.body.removeChild(e)},i=function(t){var a;return!(0,n.V)(t)||!(null===(a=t.auth.external)||void 0===a||!a.config.downloadFileSupported)}},22348:function(t,a,e){e.d(a,{V:function(){return o}});var n=e(37177),o=function(t){return!!t.auth.external&&n.n}},37177:function(t,a,e){e.d(a,{n:function(){return n}});e(27495),e(90906);var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}]);
//# sourceMappingURL=65742.273e7df1da6dd0b0.js.map