export const __rspack_esm_id=71931;export const __rspack_esm_ids=[71931];export const __webpack_modules__={19106(t,e,a){a(74423);const o=window.externalAppV2||window.externalApp||window.webkit?.messageHandlers?.getExternalAuth||location.search.includes("external_auth=1"),s=window.externalApp||window.externalAppV2;a.d(e,{},{B:s,g:o})},40310(t,e,a){a.a(t,async function(t,o){try{a.r(e);a(14603),a(47566),a(98721);var s=a(15697),i=a(358),n=a(57527),r=a(79224),c=a(49938),d=a(32651),l=a(61615),p=a(40389),h=a(80189),_=a(96682),w=a(36158),b=a(95678),g=t([l,p]);[l,p]=g.then?(await g)():g;class u extends n.WF{connectedCallback(){super.connectedCallback(),this._attached=!0}disconnectedCallback(){super.disconnectedCallback(),this._attached=!1}render(){return this._attached&&this.stateObj&&this._localize?n.qy` <ha-camera-stream .stateObj=${this.stateObj} allow-exoplayer controls></ha-camera-stream> <div class="actions"> <ha-progress-button @click=${this._downloadSnapshot} .progress=${this._waiting} .disabled=${this.stateObj.state===_.Hh} appearance="filled"> ${this._localize("ui.dialogs.more_info_control.camera.download_snapshot")} </ha-progress-button> </div> `:n.s6}async _downloadSnapshot(t){const e=t.currentTarget;this._waiting=!0;try{const t=await this._api.callApiRaw("GET",`camera_proxy/${this.stateObj.entity_id}`);if(!t)throw new Error("No response from API");const e="image/png"===t.headers.get("content-type")?"png":"jpg",a=(new Date).toLocaleString(),o=`snapshot_${(0,d.Y)(this.stateObj.entity_id)}_${a}.${e}`,s=await t.blob(),i=window.URL.createObjectURL(s);(0,w.R)(i,o)}catch(t){return this._waiting=!1,e.actionError(),void(0,b.P)(this,{message:this._localize("ui.dialogs.more_info_control.camera.failed_to_download")})}this._waiting=!1,e.actionSuccess()}constructor(...t){super(...t),this._attached=!1,this._waiting=!1}}u.styles=n.AH`: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,s.Cg)([(0,r.wk)(),(0,c.IW)()],u.prototype,"_localize",void 0),(0,s.Cg)([(0,r.wk)(),(0,i.Fg)({context:h.Ie,subscribe:!0})],u.prototype,"_api",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"stateObj",void 0),(0,s.Cg)([(0,r.wk)()],u.prototype,"_attached",void 0),(0,s.Cg)([(0,r.wk)()],u.prototype,"_waiting",void 0),u=(0,s.Cg)([(0,r.EM)("more-info-camera")],u),o()}catch(t){o(t)}})},36158(t,e,a){a(14603),a(47566),a(98721);var o=a(19106);a.d(e,{},{R:(t,e="")=>{const 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:")&&(o.B?setTimeout(()=>URL.revokeObjectURL(t),1e4):URL.revokeObjectURL(t))}})}};
//# sourceMappingURL=71931.55401eeed1ad079a.js.map