export const __rspack_esm_id="85030";export const __rspack_esm_ids=["85030"];export const __webpack_modules__={67013(t,i,e){e.d(i,{e:()=>s});const s=t=>`/api/image_proxy/${t.entity_id}?token=${t.attributes.access_token}&state=${t.state}`},17022(t,i,e){e.d(i,{A1:()=>s,CY:()=>n,Fn:()=>a,Jz:()=>h,St:()=>c,VA:()=>_,WI:()=>g,iY:()=>r,xw:()=>o});const s=(t,i)=>t.callWS({type:"media_source/resolve_media",media_content_id:i}),a=(t,i)=>t.callWS({type:"media_source/browse_media",media_content_id:i}),o="__MANUAL_ENTRY__",n=t=>t.startsWith(o),c=t=>t.startsWith("media-source://"),h=t=>t.startsWith("media-source://media_source"),r=t=>t.startsWith("media-source://image_upload"),_=async(t,i,e)=>{const s=new FormData;s.append("media_content_id",i),s.append("file",e);const a=await t.fetchWithAuth("/api/media_source/local_source/upload",{method:"POST",body:s});if(413===a.status)throw new Error(`Uploaded file is too large (${e.name})`);if(200!==a.status)throw new Error("Unknown error");return a.json()},g=async(t,i)=>t.callWS({type:"media_source/local_source/remove",media_content_id:i})},30789(t,i,e){e.a(t,async function(t,s){try{e.r(i),e.d(i,{HuiPictureCard:()=>w});var a=e(62826),o=e(96196),n=e(97735),c=e(94333),h=e(32288),r=e(42372),_=e(71727),g=(e(76776),e(67013)),d=e(19037),m=e(37544),l=e(97176),f=e(784),u=e(85979),p=e(17022),y=t([u]);u=(y.then?(await y)():y)[0];class w extends o.WF{static async getConfigElement(){return await e.e("87367").then(e.bind(e,75930)),document.createElement("hui-picture-card-editor")}static getStubConfig(){return{type:"picture",image:"https://demo.home-assistant.io/stub_config/t-shirt-promo.png"}}getCardSize(){return 5}setConfig(t){if(!t||!t.image&&!t.image_entity)throw new Error("Image required");this._config={tap_action:{action:"more-info"},...t}}shouldUpdate(t){if(!this._config||(0,f.xP)(this,t)||t.has("_resolvedImage"))return!0;if(this._config.image_entity&&t.has("hass")){const i=t.get("hass");if(!i||i.states[this._config.image_entity]!==this.hass.states[this._config.image_entity])return!0}return!1}willUpdate(t){if(super.willUpdate(t),!this._config||!this.hass)return;const i=t.has("hass")&&void 0===t.get("hass"),e=t.has("_config")&&t.get("_config")?.image!==this._config?.image,s="object"==typeof this._config?.image&&this._config.image.media_content_id||this._config.image;(i||e)&&"string"==typeof s&&(0,p.St)(s)?(this._resolvedImage=void 0,(0,p.A1)(this.hass,s).then(t=>{this._resolvedImage=t.url})):e&&(this._resolvedImage=s)}updated(t){if(super.updated(t),!this._config||!this.hass)return;const i=t.get("hass"),e=t.get("_config");i&&e&&i.themes===this.hass.themes&&e.theme===this._config.theme||(0,r.Q)(this,this.hass.themes,this._config.theme)}render(){if(!this._config||!this.hass)return o.s6;let t;if(this._config.image_entity&&(t=this.hass.states[this._config.image_entity],!t))return o.qy`<hui-warning .hass="${this.hass}"> ${(0,u.j)(this.hass,this._config.image_entity)} </hui-warning>`;let i=this._resolvedImage;if(this._config.image_entity){switch((0,_.m)(this._config.image_entity)){case"image":i=(0,g.e)(t);break;case"person":t.attributes.entity_picture&&(i=t.attributes.entity_picture)}}return void 0===i?o.s6:o.qy` <ha-card @action="${this._handleAction}" .actionHandler="${(0,d.T)({hasHold:(0,l.h)(this._config.hold_action),hasDoubleClick:(0,l.h)(this._config.double_tap_action)})}" tabindex="${(0,h.J)((0,l.h)(this._config.tap_action)||this._config.image_entity?"0":void 0)}" class="${(0,c.H)({clickable:Boolean(this._config.image_entity&&!this._config.tap_action||this._config.tap_action&&"none"!==this._config.tap_action.action||this._config.hold_action&&"none"!==this._config.hold_action.action||this._config.double_tap_action&&"none"!==this._config.double_tap_action.action)})}"> <img alt="${(0,h.J)(this._config.alt_text||t?.attributes.friendly_name)}" src="${this.hass.hassUrl(i)}"> </ha-card> `}_handleAction(t){(0,m.$)(this,this.hass,this._config,t.detail.action)}}w.styles=o.AH`ha-card{overflow:hidden;height:100%}ha-card.clickable{cursor:pointer}img{display:block;width:100%}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],w.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],w.prototype,"_resolvedImage",void 0),w=(0,a.Cg)([(0,n.EM)("hui-picture-card")],w),s()}catch(t){s(t)}})}};
//# sourceMappingURL=85030.1b55b21c5bdf2e33.js.map