export const __rspack_esm_id="27800";export const __rspack_esm_ids=["27800"];export const __webpack_modules__={4423(e,t,n){n.d(t,{B:()=>c,r:()=>r});n(44114),n(18111),n(13579),n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698);var i=n(44537),o=n(71727),s=n(28455);const a=e=>{if(void 0!==e)return null===e?new Set([null]):new Set((0,i.e)(e))},r=(e,t)=>{const n=t.domain?new Set((0,i.e)(t.domain)):void 0,r=t.hidden_domains?new Set((0,i.e)(t.hidden_domains)):void 0,c=t.device_class?new Set((0,i.e)(t.device_class)):void 0,d=a(t.floor),l=a(t.area),u=a(t.device),p=t.entity_category?new Set((0,i.e)(t.entity_category)):void 0,_=t.label?new Set((0,i.e)(t.label)):void 0,f=t.hidden_platform?new Set((0,i.e)(t.hidden_platform)):void 0;return t=>{const i=e.states[t];if(!i)return!1;if(n||r){const e=(0,o.m)(t);if(n&&!n.has(e))return!1;if(r&&r.has(e))return!1}if(c){const e=i.attributes.device_class||"none";if(!c.has(e))return!1}const{area:a,floor:h,device:m,entity:v}=(0,s.l)(i,e.entities,e.devices,e.areas,e.floors);if(v&&v.hidden)return!1;if(d){const e=h?.floor_id??null;if(!d.has(e))return!1}if(l){const e=a?.area_id??null;if(!l.has(e))return!1}if(u){const e=m?.id??null;if(!u.has(e))return!1}if(_){if(!v)return!1;if(!v.labels.some(e=>_.has(e)))return!1}if(p){if(!v)return!1;const e=v?.entity_category||"none";if(!p.has(e))return!1}if(f){if(!v)return!1;if(v.platform&&f.has(v.platform))return!1}return!0}},c=(e,t)=>{const n=new Set,i=[];for(const o of t)for(const t of e)o(t)&&!n.has(t)&&(n.add(t),i.push(t));return i}},63004(e,t,n){n.d(t,{O:()=>o,q:()=>i});const i=(e,t,n)=>Math.min(Math.max(e,t),n),o=(e,t,n)=>{let i;return i=null!=t?Math.max(e,t):e,i=null!=n?Math.min(i,n):i,i}},24367(e,t,n){n.d(t,{L:()=>o,z:()=>s});var i=n(23832);const o=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],s=(0,i.g)(o)},48441(e,t,n){n.d(t,{B:()=>i});const i=[{area:null,hidden_platform:["automation","script","hassio","backup","mobile_app","zone","person"],hidden_domains:["ai_task","automation","configurator","device_tracker","event","geo_location","notify","persistent_notification","script","sun","tag","todo","zone",...n(46190).gt]}]},78859(e,t,n){n.r(t),n.d(t,{HomeOtherDevicesViewStrategy:()=>_});n(44114),n(18111),n(22489),n(61701);var i=n(62826),o=n(96196),s=n(44457),a=n(79),r=n(71727),c=n(28455),d=n(4423),l=n(63004),u=n(24367),p=n(48441);class _ extends o.mN{static async generate(e,t){const n=Object.keys(t.states),i=p.B.map(e=>(0,d.r)(t,e)),o=(0,d.B)(n,i),s=[],_={},f=[];for(const e of o){const n=t.states[e];if(!n)continue;const{device:i}=(0,c.l)(n,t.entities,t.devices,t.areas,t.floors);i?(i.id in _||(_[i.id]=[]),_[i.id].push(e)):f.push(e)}const h=Object.entries(_).map(([e,t])=>({device_id:e,entities:t})),m=f.filter(e=>{const t=(0,r.m)(e);return(0,u.z)(t)}),v=f.filter(e=>{const t=(0,r.m)(e);return!(0,u.z)(t)}),g=(0,d.r)(t,{domain:"sensor",device_class:"battery"}),y=(0,d.r)(t,{domain:"sensor",device_class:["energy","power"]}),b=(0,d.r)(t,{entity_category:"none"});for(const e of h){if(0===e.entities.length)continue;const n=e.entities.filter(e=>g(e)),i=e.entities.filter(e=>!g(e)&&!y(e)&&b(e));if(0===i.length)continue;const o=e.device_id,r=t.devices[o];let c="";r&&(c=(0,a.xn)(r)||t.localize("ui.panel.lovelace.strategy.home.unamed_device")),s.push({type:"grid",cards:[{type:"heading",heading:c,tap_action:r&&t.user?.is_admin?{action:"navigate",navigation_path:`/config/devices/device/${r.id}`}:{action:"none"},badges:[...n.slice(0,1).map(e=>({entity:e,type:"entity",tap_action:{action:"more-info"}}))]},...i.map(e=>({type:"tile",entity:e,name:{type:"entity"}}))]})}const w=(0,l.q)(s.length,2,3);return m.length&&s.push({type:"grid",column_span:w,cards:[{type:"heading",heading:t.localize("ui.panel.lovelace.strategy.other_devices.helpers")},...m.map(e=>({type:"tile",entity:e}))]}),v.length&&s.push({type:"grid",column_span:w,cards:[{type:"heading",heading:t.localize("ui.panel.lovelace.strategy.other_devices.entities")},...v.map(e=>({type:"tile",entity:e}))]}),1===s.length&&(s[0].column_span=2),{type:"sections",header:{badges_position:"bottom"},max_columns:w,sections:s}}}_=(0,i.Cg)([(0,s.EM)("home-other-devices-view-strategy")],_)}};
//# sourceMappingURL=27800.80c02f6f1042b272.js.map