"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[71931],{19106:function(t,e,a){a(74423),a(27495),a(21699),a(5746);var n,o=window.externalAppV2||window.externalApp||(null===(n=window.webkit)||void 0===n||null===(n=n.messageHandlers)||void 0===n?void 0:n.getExternalAuth)||location.search.includes("external_auth=1"),i=window.externalApp||window.externalAppV2;a.d(e,{B:function(){return i},g:function(){return o}})},40310:function(t,e,a){a.a(t,async function(t,n){try{a.r(e);var o,i,r=a(36854),s=a(98117),c=a(28430),l=a(57567),d=a(25979),h=a(12463),u=a(16472),p=a(92297),w=(a(16280),a(28706),a(23792),a(26099),a(3362),a(47764),a(62953),a(3296),a(27208),a(48408),a(14603),a(47566),a(98721),a(15697)),_=a(358),f=a(57527),g=a(51209),b=a(49938),v=a(32651),y=a(61615),k=a(40389),m=a(80189),A=a(96682),x=a(36158),C=a(95678),j=t([y,k]);[y,k]=j.then?(await j)():j;var O=function(t){function e(){var t;(0,l.A)(this,e);for(var a=arguments.length,n=new Array(a),o=0;o<a;o++)n[o]=arguments[o];return(t=(0,u.A)(this,e,[].concat(n)))._attached=!1,t._waiting=!1,t}return(0,h.A)(e,t),(0,d.A)(e,[{key:"connectedCallback",value:function(){(0,p.A)(e,"connectedCallback",this,3)([]),this._attached=!0}},{key:"disconnectedCallback",value:function(){(0,p.A)(e,"disconnectedCallback",this,3)([]),this._attached=!1}},{key:"render",value:function(){return this._attached&&this.stateObj&&this._localize?(0,f.qy)(o||(o=(0,c.A)([" <ha-camera-stream .stateObj=",' allow-exoplayer controls></ha-camera-stream> <div class="actions"> <ha-progress-button @click='," .progress="," .disabled=",' appearance="filled"> '," </ha-progress-button> </div> "])),this.stateObj,this._downloadSnapshot,this._waiting,this.stateObj.state===A.Hh,this._localize("ui.dialogs.more_info_control.camera.download_snapshot")):f.s6}},{key:"_downloadSnapshot",value:(a=(0,s.A)((0,r.A)().m(function t(e){var a,n,o,i,s,c,l,d;return(0,r.A)().w(function(t){for(;;)switch(t.p=t.n){case 0:return a=e.currentTarget,this._waiting=!0,t.p=1,t.n=2,this._api.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,v.Y)(this.stateObj.entity_id),"_").concat(s,".").concat(i),t.n=4,n.blob();case 4:l=t.v,d=window.URL.createObjectURL(l),(0,x.R)(d,c),t.n=6;break;case 5:return t.p=5,t.v,this._waiting=!1,a.actionError(),(0,C.P)(this,{message:this._localize("ui.dialogs.more_info_control.camera.failed_to_download")}),t.a(2);case 6:this._waiting=!1,a.actionSuccess();case 7:return t.a(2)}},t,this,[[1,5]])})),function(t){return a.apply(this,arguments)})}]);var a}(f.WF);O.styles=(0,f.AH)(i||(i=(0,c.A)([":host{display:block}.actions{box-sizing:border-box;width:100%;padding:var(--ha-space-4);z-index:1;justify-content:flex-end;gap:var(--ha-space-2);flex-flow:wrap;display:flex}"]))),(0,w.Cg)([(0,g.wk)(),(0,b.IW)()],O.prototype,"_localize",void 0),(0,w.Cg)([(0,g.wk)(),(0,_.Fg)({context:m.Ie,subscribe:!0})],O.prototype,"_api",void 0),(0,w.Cg)([(0,g.MZ)({attribute:!1})],O.prototype,"stateObj",void 0),(0,w.Cg)([(0,g.wk)()],O.prototype,"_attached",void 0),(0,w.Cg)([(0,g.wk)()],O.prototype,"_waiting",void 0),O=(0,w.Cg)([(0,g.EM)("more-info-camera")],O),n()}catch(R){n(R)}})},36158:function(t,e,a){a(23792),a(26099),a(47764),a(11392),a(62953),a(3296),a(27208),a(48408),a(14603),a(47566),a(98721);var n=a(19106),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=document.createElement("a");a.target="_blank",a.href=t,a.download=e,a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),t.startsWith("blob:")&&(n.B?setTimeout(function(){return URL.revokeObjectURL(t)},1e4):URL.revokeObjectURL(t))};a.d(e,{R:function(){return o}})}}]);
//# sourceMappingURL=71931.4de755201ae33525.js.map