"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[38759],{89645:function(t,o,i){i(16280),i(34782),i(27495),i(99449),i(25440);var n=function(t){var o=parseFloat(t);if(isNaN(o))throw new Error("".concat(t," is not a number"));return o};function r(t){if(!t)return null;try{if(t.endsWith("%"))return{w:100,h:n(t.slice(0,-1))};var o=t.replace(":","x").split("x");return 0===o.length?null:1===o.length?{w:n(o[0]),h:1}:{w:n(o[0]),h:n(o[1])}}catch(i){}return null}i.d(o,{A:function(){return r}})},80442:function(t,o,i){i.a(t,async function(t,n){try{i.r(o);var r,e,a,c=i(36854),l=i(98117),s=i(28430),u=i(57567),h=i(25979),f=i(12463),d=i(16472),p=(i(16280),i(28706),i(23792),i(2892),i(26099),i(3362),i(27495),i(38781),i(47764),i(25440),i(62953),i(3296),i(27208),i(48408),i(14603),i(47566),i(98721),i(15697)),g=i(57527),w=i(51209),_=i(48612),v=i(77811),m=i(6947),y=i(89645),b=i(88457),k=(i(75041),i(15977)),A=t([b]);b=(A.then?(await A)():A)[0];var C=function(t){function o(){return(0,u.A)(this,o),(0,d.A)(this,o,arguments)}return(0,f.A)(o,t),(0,h.A)(o,[{key:"getCardSize",value:function(){return this._config?1+(this._config.aspect_ratio?Number(this._config.aspect_ratio.replace("%","")):50)/25:5}},{key:"setConfig",value:function(t){if(!t.url)throw new Error("URL required");this._config=t}},{key:"render",value:function(){var t;if(!this._config||!this.hass)return g.s6;var o="";if(!("panel"===this.layout||"grid"===this.layout))if(this._config.aspect_ratio){var i=(0,y.A)(this._config.aspect_ratio);i&&i.w>0&&i.h>0&&(o="".concat((100*i.h/i.w).toFixed(2),"%"))}else o="50%";var n=new URL(this._config.url,location.toString()).protocol;if("https:"===location.protocol&&"https:"!==n)return(0,g.qy)(r||(r=(0,s.A)([' <ha-alert alert-type="error"> '," </ha-alert> "])),this.hass.localize("ui.panel.lovelace.cards.iframe.error_secure_context",{target_protocol:n,context_protocol:location.protocol}));var a="";this._config.allow_open_top_navigation&&(a+="allow-top-navigation-by-user-activation");var c=this._config.disable_sandbox?void 0:"".concat(a," ").concat(k.D);return(0,g.qy)(e||(e=(0,s.A)([" <ha-card class="," .header=",'> <div id="root" style=',";> <iframe title="," src="," sandbox="," allow=","></iframe> </div> </ha-card> "])),(0,_.H)({"hide-background":this._config.hide_background}),this._config.title,(0,m.W)({"padding-top":o}),(0,v.J)(this._config.title),this._config.url,(0,v.J)(c),null!==(t=this._config.allow)&&void 0!==t?t:"fullscreen")}},{key:"getGridOptions",value:function(){return{columns:"full",rows:4,min_columns:3,min_rows:2}}}],[{key:"getConfigElement",value:(n=(0,l.A)((0,c.A)().m(function t(){return(0,c.A)().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i.e(15816).then(i.bind(i,69019));case 1:return t.a(2,document.createElement("hui-iframe-card-editor"))}},t)})),function(){return n.apply(this,arguments)})},{key:"getStubConfig",value:function(){return{type:"iframe",url:"https://www.home-assistant.io",aspect_ratio:"50%"}}}]);var n}(g.WF);C.styles=(0,g.AH)(a||(a=(0,s.A)(["ha-card{flex-direction:column;width:100%;height:100%;display:flex;overflow:hidden}ha-card.hide-background{box-shadow:none;background:0 0;border:none}#root{width:100%;height:100%;position:relative}iframe{border:none;width:100%;height:100%;position:absolute;top:0;left:0}"]))),(0,p.Cg)([(0,w.MZ)({attribute:!1})],C.prototype,"layout",void 0),(0,p.Cg)([(0,w.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,p.Cg)([(0,w.wk)()],C.prototype,"_config",void 0),C=(0,p.Cg)([(0,w.EM)("hui-iframe-card")],C),i.d(o,{HuiIframeCard:function(){return C}}),n()}catch(x){n(x)}})},15977:function(t,o,i){i.d(o,{D:function(){return"allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts allow-modals allow-downloads"}})}}]);
//# sourceMappingURL=38759.b38b343ec6bc857d.js.map