globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="c8d5c166e30a11241ef32c7e1dc70368632e84c448524a8340494350ec4d5fca";import{b as a,A as e}from"./houseplan-card-DXAxXz4t.js";import{s,n as t,a as l,m as r,b as o,c as i,d as u}from"./summary-panel-runtime-loaded-Cdo93NMV.js";const m=m=>{const{host:c,dialog:d,problems:n,t:b}=m,y=n.find(a=>"error"===a.kind),$=d.localShow!==d.baseLocalShow||!d.localOnly&&!s(t(d.draft),d.base),p=$&&!d.busy&&!y,v=a=>n.find(e=>e.path===a),h=a=>a?b(`summary.problem.${a.code}`):"",k=()=>m.close(),g=a``;return a`
m.closeSource()}> ${d.localOnly?a`

${b(d.localOnlyHint)}

`:e}

${b("summary.general_settings")}

${d.localOnly?e:a`
m.mutate(e=>{e.title=a.target.value})} /> ${v("title")?a`
${h(v("title"))}
`:e}
`} ${g} ${d.localOnly?e:a``}
${m.storageUnavailable?a`
${b("summary.storage_unavailable")}
`:e}
${d.localOnly?e:a`

${b("summary.blocks")}

${b("summary.blocks_hint")}

${b("summary.block_count").replace("{count}",String(d.draft.blocks.length)).replace("{limit}","10")}
${d.draft.blocks.map((s,t)=>{const u=`blocks.${t}`,n=v(`${u}.scope`);return a`
a.preventDefault()} @drop=${a=>m.drop(a,`block:${t}`)}>
m.dragStart(a,`block:${t}`)}>${l("grip")}
m.mutate(e=>{e.blocks[t].title=a.target.value})} /> ${v(`${u}.title`)?a`
${h(v(`${u}.title`))}
`:e}
${"space"===s.scope.type?a``:e}
${n?a`
${h(n)}
`:e}
${s.values.map((i,c)=>{const n=`${u}.values.${c}`,$=v(`${n}.source`),p=m.sourceToken(i.source),k=d.activeSource?.blockId===s.id&&d.activeSource.valueId===i.id,g="system"===i.source.type?b(`summary.system.${i.source.key}`):i.source.entity_id?m.entityIndex.labels.get(i.source.entity_id)||i.source.entity_id:b("summary.select_source"),_="system"===i.source.type?b("summary.system_source"):i.source.entity_id,f=k?o(m.entityIndex,d.entityFilter):null,w="entity"===i.source.type&&!!i.source.entity_id&&!m.entityIndex.labels.has(i.source.entity_id),S=`${s.id}\n${i.id}`;return a`
{a.preventDefault(),a.stopPropagation()}} @drop=${a=>m.drop(a,`value:${t}:${c}`)}> m.dragStart(a,`value:${t}:${c}`)}>${l("grip")}
m.mutate(e=>{e.blocks[t].values[c].label=a.target.value})} /> ${v(`${n}.label`)?a`
${h(v(`${n}.label`))}
`:e}
${k&&f?a`
a.stopPropagation()} @keydown=${a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),m.closeSource(!0))}}> m.setDialog({...d,entityFilter:a.target.value})} />
${b("summary.system_group")}
${["device_count","total_area","datetime"].map(e=>a` `)} ${w?a`
${b("summary.current_source")}
`:e}
${b("summary.entities_group")}
${f.entries.map(e=>a``)} ${f.total?e:a`
${b("summary.no_search_results")}
`} ${f.truncated?a`
${b("summary.refine_search")}
`:e}
`:e} ${$?a`
${h($)}
`:e}
`})}
`})}
${d.error?a``:e} ${d.conflict?a``:e} `}
`};export{m as renderSummaryPanelEditor};