export const __rspack_esm_id="87764";export const __rspack_esm_ids=["87764"];export const __webpack_modules__={5023(t,i,o){o.r(i),o.d(i,{HuiToggleGroupCard:()=>g});o(18111),o(22489),o(61701);var e=o(62826),n=o(96196),s=o(97735),r=o(29485),c=o(78870),a=o(71727),h=o(47129),l=o(27120),_=(o(76776),o(22573),o(80933),o(32248),o(88360));class g extends n.WF{setConfig(t){if(!t.entities?.length)throw new Error("Entities are required");this._config=t}getCardSize(){return this._config?.vertical?2:1}getGridOptions(){let t=1,i=6;return this._config?.vertical&&(t++,i=3),{columns:6,rows:t,min_columns:i,min_rows:t}}_getOnEntities(){return this.hass&&this._config?this._config.entities.map(t=>this.hass.states[t]).filter(t=>void 0!==t&&(0,h.a)(t)):[]}_computeColor(){if(!this._config||!this.hass)return;const t=this._getOnEntities();return 0!==t.length?this._config.color?(0,c.MP)(this._config.color):(0,l.Se)(t[0]):void 0}_computeLabel(){if(!this.hass||!this._config)return"";const t=this._getOnEntities().length,i=this._config.entities.length;return 0===t?this.hass.localize("ui.card.toggle-group.all_off"):t===i?this.hass.localize("ui.card.toggle-group.all_on"):this.hass.localize("ui.card.toggle-group.some_on",{on_count:t,total_count:i})}_handleTap(){if(!this.hass||!this._config)return;const t=this._getOnEntities(),i=(0,a.m)(this._config.entities[0]);let o;o="cover"===i?t.length>0?"close_cover":"open_cover":t.length>0?"turn_off":"turn_on",this.hass.callService(i,o,{entity_id:this._config.entities}),(0,_.j)(this,"light")}render(){if(!this._config||!this.hass)return n.s6;const t={"--tile-color":this._computeColor()},i=this._computeLabel(),o=this._config.title||i,e=this._config.title?i:void 0;return n.qy` <ha-card style="${(0,r.W)(t)}"> <ha-tile-container .vertical="${Boolean(this._config.vertical)}"> <ha-tile-icon slot="icon" icon="mdi:power" .interactive="${!0}" @action="${this._handleTap}"></ha-tile-icon> <ha-tile-info slot="info" .primary="${o}" .secondary="${e}"></ha-tile-info> </ha-tile-container> </ha-card> `}}g.styles=n.AH`:host{--tile-color:var(--state-inactive-color)}ha-card{background:0 0;backdrop-filter:none;-webkit-backdrop-filter:none;border:none;box-shadow:none;height:100%}ha-tile-icon{--tile-icon-color:var(--tile-color)}`,(0,e.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,e.Cg)([(0,s.wk)()],g.prototype,"_config",void 0),g=(0,e.Cg)([(0,s.EM)("hui-toggle-group-card")],g)}};
//# sourceMappingURL=87764.e3b651e48e90ea2b.js.map