@camstack/addon-admin-ui 1.2.620 → 1.2.622
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/assets/{Addons-DJdolmfq.js → Addons-B0-JHWDN.js} +1 -1
- package/dist/assets/{AdminPage-BHh-8_fU.js → AdminPage-C6Nfjqwk.js} +1 -1
- package/dist/assets/{AdminSectionedPage-iARsX8rZ.js → AdminSectionedPage-qDgtM4yK.js} +1 -1
- package/dist/assets/{AiProfiles-2tnlEWXz.js → AiProfiles-BuQvWBCk.js} +1 -1
- package/dist/assets/{Authentication-Bem8tvA5.js → Authentication-BgS7NhZX.js} +1 -1
- package/dist/assets/Build-Blu_Rek1.js +39 -0
- package/dist/assets/{Calendars-DNQrWvuF.js → Calendars-D1HqtZRO.js} +1 -1
- package/dist/assets/{CameraGrids-C-z7UM1y.js → CameraGrids-CTVWt5In.js} +1 -1
- package/dist/assets/{Cluster-VLE7u_Ba.js → Cluster-CiamsdEf.js} +1 -1
- package/dist/assets/CompositionBlockEditor-C-77HSpC.js +2 -0
- package/dist/assets/{CompositionEditorPage-CKETxShe.js → CompositionEditorPage-2bkol2ck.js} +1 -1
- package/dist/assets/{Data-B9Er0g9D.js → Data-BKLSNpfc.js} +1 -1
- package/dist/assets/DeviceDetail-GJkHbY0h.js +2 -0
- package/dist/assets/{DeviceDoActionFields-CZFlS0_-.js → DeviceDoActionFields-DeEzCG7W.js} +1 -1
- package/dist/assets/{Devices-CGx0wAxP.js → Devices-DnnB5-0E.js} +1 -1
- package/dist/assets/{EditTemplateButton-Bq1ffI4D.js → EditTemplateButton-BhYRcPAZ.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-4ehPr2TZ.js → EmbedPlayerPage-Fv2jvgXD.js} +1 -1
- package/dist/assets/{History-Bx1E735e.js → History-sL1i9hpN.js} +1 -1
- package/dist/assets/{Identity-CMUHSSqv.js → Identity-DWLT_K89.js} +1 -1
- package/dist/assets/{InstancesTable-gUkLAnsD.js → InstancesTable-Bd3Q_rDK.js} +1 -1
- package/dist/assets/{IntegrationDetail-Ehyor6u6.js → IntegrationDetail-Culq1Ni9.js} +1 -1
- package/dist/assets/{IntegrationHub-BG7cMJsk.js → IntegrationHub-dC2c-gZh.js} +1 -1
- package/dist/assets/Integrations-B1KxBrwc.js +2 -0
- package/dist/assets/{Integrations-DOCNqIar.js → Integrations-BSA9HPyd.js} +1 -1
- package/dist/assets/{Library-BrzsxvAz.js → Library-CDrsfdbN.js} +1 -1
- package/dist/assets/{Locations-CVrXgE35.js → Locations-8ETbKpeR.js} +2 -2
- package/dist/assets/{Logs-DsK5fRZR.js → Logs-DaigxSX8.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-Df0bxhWU.js → MaskShapeCanvas-CWvoDF7d.js} +1 -1
- package/dist/assets/{MotionZonesSettings-bzsZ9ORo.js → MotionZonesSettings-BGdLFhDm.js} +1 -1
- package/dist/assets/{MyAccess-DnTnl7UZ.js → MyAccess-yDg5ZUb3.js} +1 -1
- package/dist/assets/{Network-Bw36Tv36.js → Network-4RdFqBxG.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-R1b0cru-.js → NodeAddonsSettingsPanel-IP_pDLF5.js} +1 -1
- package/dist/assets/Notifications-nPHvnL47.js +1 -0
- package/dist/assets/{Pipeline-DC88azee.js → Pipeline-DrZixiLL.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-BSmAOhtT.js → PrivacyMaskSettings-DaxBCWbY.js} +1 -1
- package/dist/assets/{Recordings-BHU_meXJ.js → Recordings-xllrAH4z.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-DQvmvgy2.js → ScanSubnetEditor-CRSiRPeu.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-H8rTgYvL.js → SceneMonitorEditor-DGT86wag.js} +1 -1
- package/dist/assets/{SessionsList-CjmK3K2H.js → SessionsList-Dsi9j6a5.js} +1 -1
- package/dist/assets/{Showroom-BVvH3mP_.js → Showroom-Cy61Met3.js} +1 -1
- package/dist/assets/{StorageLocationsTable-DpJ7jfbm.js → StorageLocationsTable-BIWNuKSZ.js} +1 -1
- package/dist/assets/{System-D4Q2GWws.js → System-IFiHQlVG.js} +1 -1
- package/dist/assets/Templates-CI8sfkWl.js +1 -0
- package/dist/assets/{Terminal-DnA50N1m.js → Terminal-CLVwElWa.js} +1 -1
- package/dist/assets/{TrainingProviders-xT33i-sn.js → TrainingProviders-CGnhynXm.js} +1 -1
- package/dist/assets/{Viewer-BPoCOCf0.js → Viewer-DAzWPu1t.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CLO1yhFQ.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C0elo_dQ.js} +1 -1
- package/dist/assets/{addon-icons-context-BtBGiOr1.js → addon-icons-context-DqoJ5IMg.js} +1 -1
- package/dist/assets/{ai-page.helpers-SZGcu2Qp.js → ai-page.helpers-zhKHU1bv.js} +1 -1
- package/dist/assets/{archive-D0a0mcxB.js → archive-BeVgBgkN.js} +1 -1
- package/dist/assets/{assignment-candidates-XbaIjrZx.js → assignment-candidates-D8UC0IoK.js} +1 -1
- package/dist/assets/{authed-media-BNSpauA7.js → authed-media-C4mHNO6d.js} +1 -1
- package/dist/assets/{bell-off-DdK8iLZs.js → bell-off-DkGKDKAc.js} +1 -1
- package/dist/assets/{board-model-CRqpael6.js → board-model-D6ERqD8s.js} +1 -1
- package/dist/assets/{boxes-vsSDyvgc.js → boxes-BPVZkV90.js} +1 -1
- package/dist/assets/{calendar-clock-CoYYNqtJ.js → calendar-clock-CjQG8xEz.js} +1 -1
- package/dist/assets/circle-slash-CGfofQoY.js +1 -0
- package/dist/assets/client-Dee-0euI.js +809 -0
- package/dist/assets/{create-composition-DI5jt0R9.js → create-composition-mIiTaJQn.js} +2 -2
- package/dist/assets/crop-B2RwKMNG.js +1 -0
- package/dist/assets/{database-zap-D8coLqwx.js → database-zap-BuOgAYwR.js} +1 -1
- package/dist/assets/{device-integration-icon-BC_Avp9o.js → device-integration-icon-BiD2ooYo.js} +1 -1
- package/dist/assets/device-picker-model-CEFYlq6I.js +1 -0
- package/dist/assets/{dist-BtYGlWrp.js → dist-CVgm2V5y.js} +1 -1
- package/dist/assets/dist-DbWYJIOK.js +809 -0
- package/dist/assets/{eraser-Cen5rG9n.js → eraser-UP1ptJ_D.js} +1 -1
- package/dist/assets/{file-up-Dmdm3s-W.js → file-up-BejsNlHS.js} +1 -1
- package/dist/assets/{format-DU3bhEVG.js → format-DAm6he6w.js} +1 -1
- package/dist/assets/{grip-vertical-CfBM4Q2d.js → grip-vertical-DotKiQvj.js} +1 -1
- package/dist/assets/{hard-drive-download-A53Ir3u_.js → hard-drive-download-_b0JXZNX.js} +1 -1
- package/dist/assets/{hostInit-BZJ9ZClJ.js → hostInit-CWlv6NTe.js} +1 -1
- package/dist/assets/i18n-DFz3VmFc.js +1 -0
- package/dist/assets/icons-DiWpMBOB.js +1 -0
- package/dist/assets/{index-nTaq85cS.js → index-CrUUqNNL.js} +3 -3
- package/dist/assets/index-D4z5SYp_.css +2 -0
- package/dist/assets/{key-DAZ5__Cz.js → key-DRR-Ggvt.js} +1 -1
- package/dist/assets/{key-square-BYAGokh2.js → key-square-BlorbeI7.js} +1 -1
- package/dist/assets/{layers-QX48fc9O.js → layers-DQIEg2Bq.js} +1 -1
- package/dist/assets/{link-2-off-DJkRSf1H.js → link-2-off-HbwYwcoz.js} +1 -1
- package/dist/assets/{linked-devices-model-DkQyKUky.js → linked-devices-model-oxPM2lDe.js} +1 -1
- package/dist/assets/{list-ordered-D9rezt8U.js → list-ordered-D2_q30rO.js} +1 -1
- package/dist/assets/{memory-stick-B0y6xRLf.js → memory-stick-Kr65AHO7.js} +1 -1
- package/dist/assets/{message-square-plus-beuwcCJE.js → message-square-plus-CGcfLb4n.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-0b131bc2.js → mf-entry-bootstrap-0-aafe4c56.js} +2 -2
- package/dist/assets/{mic-off-JlShE5CX.js → mic-off-B-YLSqUh.js} +1 -1
- package/dist/assets/{monitor-off-D1aEAZKv.js → monitor-off-dhLiqvAE.js} +1 -1
- package/dist/assets/{monitor-smartphone-DuS3QmFu.js → monitor-smartphone-D68gh_0x.js} +1 -1
- package/dist/assets/mount-CEFYlq6I.js +1 -0
- package/dist/assets/{notification-rule-status-B6-wJrto.js → notification-rule-status-hT9lSvAp.js} +1 -1
- package/dist/assets/{player-overlays-D3s97s6y.js → player-overlays-DRXPDzoq.js} +1 -1
- package/dist/assets/remoteEntry-BClVE4J6.js +1 -0
- package/dist/assets/{ruler-Dm7ltXLY.js → ruler-CE2hOxvv.js} +1 -1
- package/dist/assets/{scissors-CscqL8Nh.js → scissors-BOlEHQ2s.js} +1 -1
- package/dist/assets/{search-x-C4gWSmgx.js → search-x-Basn6vad.js} +1 -1
- package/dist/assets/{send-J4jIQUsN.js → send-snsa07qR.js} +1 -1
- package/dist/assets/{settings-2-BeW9uEQI.js → settings-2-D42zZvIi.js} +1 -1
- package/dist/assets/{shapes-CKU3AF4Y.js → shapes-DzuZ0aqU.js} +1 -1
- package/dist/assets/{sigma-CTKfYM4-.js → sigma-BRwCaWxw.js} +1 -1
- package/dist/assets/{speaker-Ck8srje1.js → speaker-Oma9Nd4V.js} +1 -1
- package/dist/assets/{src-B-AT5yJl.js → src-CrkcMdUT.js} +12 -12
- package/dist/assets/{sso-popup-n62X0G6g.js → sso-popup-Cs85_JEB.js} +1 -1
- package/dist/assets/{step-inspector-model-RAXDboWD.js → step-inspector-model-Qusf3gxD.js} +1 -1
- package/dist/assets/{table-2-aZySB4V2.js → table-2-CLSgkWSh.js} +1 -1
- package/dist/assets/{timer-reset-cWJEUvVi.js → timer-reset-XJzcf-X9.js} +1 -1
- package/dist/assets/tv-DHoz7k2K.js +1 -0
- package/dist/assets/{unlink-BdyIoPhB.js → unlink-TvpkDUay.js} +1 -1
- package/dist/assets/{usb-BdbpQ7nA.js → usb-CYYF7-XT.js} +1 -1
- package/dist/assets/{use-device-bound-caps-DoqwAZY7.js → use-device-bound-caps-BmCkwmRR.js} +1 -1
- package/dist/assets/{use-scenes-feed-CZ2-F4pX.js → use-scenes-feed-B68kNFHc.js} +1 -1
- package/dist/assets/{use-stationary-objects-DGtrBOe7.js → use-stationary-objects-DMEbWObh.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-kKuk-Q3e.js → useAdminDeviceRemoval-B9K8nXpf.js} +1 -1
- package/dist/assets/useEventInvalidation-CEFYlq6I.js +1 -0
- package/dist/assets/{useNodeUrlSelection-Dj7g-m5p.js → useNodeUrlSelection-Be7DWORE.js} +1 -1
- package/dist/assets/user-round-JSt6qUOY.js +1 -0
- package/dist/assets/{user-x-DSMsu42n.js → user-x-B8bBQJXA.js} +1 -1
- package/dist/assets/{variable-CmpJWWUH.js → variable-BrE4WL4D.js} +1 -1
- package/dist/assets/{video-D4xSLzZ9.js → video-BM2xBahl.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-C-xMhgE3.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B08zgLKv.js} +2 -2
- package/dist/index.html +11 -11
- package/dist/server/addon.js +172 -48
- package/package.json +2 -2
- package/dist/assets/Build-Ds722tnb.js +0 -39
- package/dist/assets/CompositionBlockEditor-BbYo0Bux.js +0 -2
- package/dist/assets/DeviceDetail-B3RYtusL.js +0 -2
- package/dist/assets/Integrations-CUC8UK1M.js +0 -2
- package/dist/assets/Notifications-DM1II39L.js +0 -1
- package/dist/assets/Templates-BEjJmEOH.js +0 -1
- package/dist/assets/circle-slash-ay8YxPUj.js +0 -1
- package/dist/assets/client-BvmEgDNh.js +0 -809
- package/dist/assets/crop-BdvIrRYF.js +0 -1
- package/dist/assets/device-picker-model-Bjv-RXWx.js +0 -1
- package/dist/assets/dist-CHzqN6_y.js +0 -809
- package/dist/assets/i18n-CI_T7hgw.js +0 -1
- package/dist/assets/icons-DOpP4xQB.js +0 -1
- package/dist/assets/index-DkUsDe0n.css +0 -2
- package/dist/assets/mount-Bjv-RXWx.js +0 -1
- package/dist/assets/remoteEntry-DaudLd-K.js +0 -1
- package/dist/assets/tv-B5H99r1h.js +0 -1
- package/dist/assets/useEventInvalidation-Bjv-RXWx.js +0 -1
- package/dist/assets/user-round-D_ydbSej.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,Y as i,et as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Hn as c,Un as l,Ut as u,Vi as d,ht as f}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,R as n,S as r,Y as i,et as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Hn as c,Un as l,Ut as u,Vi as d,ht as f}from"./player-overlays-DRXPDzoq.js";import{Br as p,Fr as m,Go as h,Gt as g,Ir as _,Lo as v,Lr as y,Qr as b,Vr as x,Wt as S,Xr as C,Xs as w,Yr as T,Zs as E,jo as D,o as O,yi as k}from"./src-CrkcMdUT.js";import{t as A}from"./useTranslation-BJr-n0es.js";import{Rr as j,W as M}from"./index-CrUUqNNL.js";import{t as N}from"./AdminPage-C6Nfjqwk.js";import"./useEventInvalidation-CEFYlq6I.js";import{t as P}from"./useAdminDeviceRemoval-B9K8nXpf.js";import{t as F}from"./device-integration-icon-BiD2ooYo.js";import{n as I}from"./addon-kind-filter-CEGKkC1O.js";a();function L(e,t){return e.filter(e=>e.canAdd).map(e=>({addonId:e.addonId,name:e.name,instances:t.filter(t=>t.addonId===e.addonId&&t.enabled&&t.info?.fixed!==!0)})).filter(e=>e.instances.length>0||!t.some(t=>t.addonId===e.addonId&&t.info?.fixed===!0)).sort((e,t)=>e.name.localeCompare(t.name))}function R(e,t){return`/integrations/${encodeURIComponent(e)}?instance=${encodeURIComponent(t)}&add=1`}function z(e){return`/integrations?setup=${encodeURIComponent(e)}`}function B({open:n,onClose:i}){let{t:a}=A(),o=j(),s=w(void 0,{enabled:n}),l=E(void 0,{enabled:n}),u=t(()=>s.data===void 0||l.data===void 0?null:L(s.data,l.data),[s.data,l.data]),d=s.isError||l.isError,f=e=>{i(),o(e)};return r(m,{open:n,onOpenChange:e=>!e&&i(),children:e(y,{width:`md`,placement:`sheet-on-mobile`,children:[r(p,{children:r(x,{children:a(`devices.addDevice.title`,`Add device`)})}),r(_,{children:d?r(T,{message:a(`devices.addDevice.loadFailed`,`Integrations could not be loaded.`),onRetry:()=>{s.refetch(),l.refetch()}}):u===null?e(`div`,{className:`space-y-2`,"data-testid":`add-device-pending`,children:[r(b,{className:`h-10 w-full`}),r(b,{className:`h-10 w-full`})]}):u.length===0?r(C,{icon:c,title:a(`devices.addDevice.noneTitle`,`No integration installed`),description:a(`devices.addDevice.noneDescription`,`Install an integration first, then add devices from it.`),action:r(k,{onClick:()=>f(I),children:a(`devices.browseIntegrations`,`Browse integrations`)})}):r(`ul`,{className:`space-y-1.5`,children:u.map(t=>t.instances.length===0?r(`li`,{children:e(k,{variant:`outline`,className:`w-full justify-between`,onClick:()=>f(z(t.addonId)),children:[r(`span`,{className:`truncate`,children:t.name}),r(`span`,{className:`text-foreground-subtle`,children:a(`devices.addDevice.setUp`,`Set up`)})]})},t.addonId):t.instances.map(n=>r(`li`,{children:e(k,{variant:`outline`,className:`w-full justify-between`,onClick:()=>f(R(t.addonId,n.id)),children:[r(`span`,{className:`truncate`,children:t.name}),n.name!==t.name&&r(`span`,{className:`truncate text-foreground-subtle`,children:n.name})]})},n.id)))})})]})})}var V=32;function H(e,t){let n=e=>t(e).kind===`orphan`,r=new Set;for(let t of e)n(t)&&r.add(t.id);let i=new Map;for(let t of e)i.set(t.id,t);let a=(e,t=0)=>{if(t>V)return!1;if(r.has(e.id))return!0;if(e.parentDeviceId==null)return!1;let n=i.get(e.parentDeviceId);return n?a(n,t+1):!1},o=[],s=[];for(let t of e)a(t)?s.push(t):o.push(t);return{activeDevices:o,orphanDevices:s}}a();function U(){let{t:a}=A(),p=j(),[m,_]=i(!1),y=f(),b=o();O([`deviceManager`],[`device.registered`,`device.unregistered`,`device.online`,`device.offline`,`device.disabled`,`device.enabled`]),O([`integrations`],[`integration.enabled`,`integration.disabled`,`integration.deleted`,`provider.started`,`provider.stopped`,`addon.installed`,`addon.uninstalled`,`addon.started`,`addon.stopped`]);let{data:x}=h({projection:`slim`}),{data:C}=E(void 0),w=P(),T=D({onSuccess:()=>{b.invalidateQueries({queryKey:[[`deviceManager`]]})}}),L=v({onSuccess:()=>{b.invalidateQueries({queryKey:[[`deviceManager`]]})}}),R=t(()=>x??[],[x]),z=t(()=>g(C),[C]),{activeDevices:V,orphanDevices:U}=t(()=>H(R,z),[R,z]),W=t(()=>{let e=new Map;for(let t of R)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[R]),G=n(e=>W.get(e)??null,[W]),K=t(()=>(C??[]).map(e=>({id:e.id,name:e.name??e.addonId,icon:r(M,{type:e.addonId,size:`sm`})})),[C]),q=n(e=>p(`/devices/${String(e)}`),[p]);return e(N,{icon:d,title:a(`nav.devices`,`Devices`),actions:e(s,{children:[e(k,{variant:`outline`,size:`sm`,onClick:()=>p(I),children:[r(c,{className:`h-3.5 w-3.5`}),a(`devices.browseIntegrations`,`Browse integrations`)]}),e(k,{size:`sm`,onClick:()=>_(!0),children:[r(l,{className:`h-3.5 w-3.5`}),a(`devices.addDevice.title`,`Add device`)]})]}),children:[r(B,{open:m,onClose:()=>_(!1)}),r(S,{context:`devices`,devices:V,trpc:y.trpcClient,filters:{integrations:K},integrationOf:z,resolveIntegrationIcon:F,resolveParent:G,onNavigate:q,rowOperation:w.rowOperation,batchActions:{remove:w.remove,disable:T.mutate,enable:L.mutate}}),U.length>0&&e(`div`,{className:`mt-6 space-y-2`,children:[e(`div`,{className:`flex items-baseline gap-2`,children:[r(u,{className:`h-3.5 w-3.5 text-warning shrink-0`}),r(`h2`,{className:`text-sm font-semibold text-foreground`,children:a(`devices.orphanDevices`,`Orphan devices`)}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:a(`common.deviceOrphans`,{count:U.length})})]}),e(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 p-2`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle px-2 pb-2`,children:a(`devices.theseDevicesReferenceAnIntegration`,"These devices reference an integration that is no longer registered (their `integrationId`, or — for older devices without one — their `addonId`). Delete them, or re-install the missing integration to bring them back online. The provider badge beside each row is the addon that serves it.")}),r(S,{context:`devices`,devices:U,trpc:y.trpcClient,integrationOf:z,urlScope:`nested`,lsKey:`devices:orphan`,resolveIntegrationIcon:F,resolveParent:G,onNavigate:q})]})]})]})}export{U as DevicesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Yn as i,dt as a}from"./player-overlays-D3s97s6y.js";import{Nr as o,Pr as s,Qi as c,Sr as l,Zi as u,br as d,na as f,ta as p,vr as m,xr as h,yr as g}from"./client-BvmEgDNh.js";import{t as _}from"./grip-vertical-CfBM4Q2d.js";import{Cf as v,yi as y}from"./src-B-AT5yJl.js";import{t as b}from"./useTranslation-BJr-n0es.js";import{Rr as x}from"./index-nTaq85cS.js";r();function S(){return{columns:3,rows:4,buttons:[]}}var C=e=>({status:`refused`,reason:e}),w=e=>({status:`ok`,grid:e});function T(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var E=s;function D(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function O(e){return e.groups??[]}function k(e,t){return O(e).find(e=>e.id===t)}function ee(e,t){return e.buttons.filter(e=>e.groupId===t)}function A(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function j(e,t){let{groupId:n,...r}=t;for(let n of O(e))if(E(n,t))return n.frame===`divider`||!D(n,t)?`overlap`:{...r,groupId:n.id};return r}function M(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!T(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&E(e,t)))return`overlap`;let r=j(e,t);return typeof r==`string`?r:null}function N(e,t){let n=M(e,t,t.id);if(n!==null)return C(n);let r=j(e,t);return typeof r==`string`?C(r):w({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function P(e,t){return e.buttons.find(e=>e.id===t)}function te(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function ne(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!O(e).some(e=>E(e,r))&&M(e,r,null)===null)return{row:t,col:n}}return null}function re(e,t){if(e.buttons.length>=200)return C(`outside`);let n=ne(e);if(n===null)return C(`outside`);let r=j(e,{id:te(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?C(r):w({...e,buttons:[...e.buttons,r]})}function F(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):N(e,{...i,row:n,col:r})}function ie(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):F(e,t,i.row+n,i.col+r)}function ae(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):N(e,{...i,rowSpan:n,colSpan:r})}function oe(e,t,n){let r=P(e,t);if(r===void 0)return C(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return w({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function se(e,t,n){let r=P(e,t);if(r===void 0)return C(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return w({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ce(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var I=e=>e.ok?w(e.layout):C(e.reason);function le(e,t,n,r){return I(m(e,t,{row:n,col:r}))}function ue(e,t,n){return I(g(e,t,{keepButtons:n}))}function de(e,t,n){let r=k(e,t);if(r===void 0)return C(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return w(A(e,O(e).map(e=>e.id===t?o:e)))}function fe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function L(e){let t=new Set,n=O(e);for(let r of n){if(!fe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function pe(e){let t=L(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function me(e,t,n){let r=k(e,t);if(r===void 0)return C(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return w(A(e,O(e).map(e=>e.id===t?l:e)))}function R(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return C(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!T(i,e))||O(e).some(e=>!T(i,e))?C(`would-drop-buttons`):w(i)}function z(e){let t=o.safeParse(e);return t.success?t.data:null}function he(e){let t=o.safeParse(e);return t.success?t.data:S()}var ge=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function _e(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function ve(e){return u.filter(t=>_e(t)===e)}function ye(e){let t=c(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function be(e){return c(e)!==null&&!p(e)}function xe(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label}},n=M(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var B=`"/></svg>`,Se={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+B},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},Ce={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+B},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},we={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+B},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},Te={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+B},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},Ee={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+B},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},De={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+B},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Oe={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+B},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},ke={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+B},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},Ae={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+B},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},je={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+B},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},Me={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+B},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Ne={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+B},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},Pe={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+B},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Fe={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+B},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},Ie={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+B},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Le=`app:`,V=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),H=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),U=[V(`netflix`,`Netflix`,Oe),V(`youtube`,`YouTube`,Fe),H(`primevideo`,`Prime Video`,`prime`),H(`disneyplus`,`Disney+`,`D+`),V(`spotify`,`Spotify`,Ne),V(`plex`,`Plex`,je),V(`appletv`,`Apple TV`,Ce),V(`dazn`,`DAZN`,Te),H(`raiplay`,`RaiPlay`,`Rai`),H(`mediasetinfinity`,`Mediaset Infinity`,`MI`),V(`now`,`NOW`,ke),V(`twitch`,`Twitch`,Pe),V(`max`,`Max`,De),V(`paramountplus`,`Paramount+`,Ae),V(`crunchyroll`,`Crunchyroll`,we),V(`sky`,`Sky`,Me),V(`youtubemusic`,`YouTube Music`,Ie),V(`applemusic`,`Apple Music`,Se),V(`kodi`,`Kodi`,Ee)],Re=new Map(U.map(e=>[e.key,e]));function ze(e){return`${Le}${e}`}function W(e){if(!(e===void 0||!e.startsWith(`app:`)))return Re.get(e.slice(4))}function Be(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Ve=.011,He=.91,G=2.2;function K(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Ue(e){if(e.kind!==`glyph`)return null;let t=Be(e.hex);return t===null?null:K(t,Ve)>=G&&K(t,He)>=G?`#${e.hex}`:null}function We({brand:e}){if(e.mark.kind===`lettermark`)return n(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let t=Ue(e.mark);return n(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:t===null?void 0:{fill:t},children:n(`path`,{d:e.mark.path})})}function Ge(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function q(e,t){return h(e,Ge(t))}function J(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function Y(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ke(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function qe(e){return e===`divider`}function Je(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ye=`2.75rem`,Xe=`1.25rem`,Ze=`1rem`;function X(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Z=new Set([`red`,`green`,`yellow`,`blue`]);function Qe(e,t){return e.label??W(e.icon)?.label??t}function $e(e){return e.label===void 0||W(e.icon)!==void 0?!1:e.tone===void 0||!Z.has(e.tone)}function et(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Z.has(e.tone)))return d(e.role)}function tt({button:t,compact:r}){let i=v(),a=W(t.icon),o=et(t),s=t.icon===void 0?l(t.role):void 0,c=o===void 0||a!==void 0||s!==void 0?void 0:i(o),u=$e(t)?t.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&n(We,{brand:a}),c!==void 0&&n(c,{className:`h-4 w-4`,"aria-hidden":!0}),s!==void 0&&n(`span`,{className:`text-sm font-medium`,children:s}),u!==void 0&&!r&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function Q(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function nt({group:t,selected:r,dragging:i,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=b(),f=qe(t.frame),p=!s||o||t.hideTitle===!0?void 0:t.title;return e(`div`,{"data-testid":`remote-group-${t.id}`,"data-frame":t.frame,className:a(`relative -m-0.5 flex`,Ke(t.frame),i&&`opacity-40`,r&&`ring-2 ring-primary`),style:Q(t),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&n(`span`,{className:`truncate`,children:p}),p!==void 0&&n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&n(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&n(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:t.title??t.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${t.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:n(_,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function rt({grid:r,label:i,selectedId:o=null,onSelect:s,boundRoles:c,showEmptyCells:l=!1,compact:u=!1,gridRef:d,selectedGroupId:p=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null,renderWidget:v}){let{i18n:x}=b(),S=h!==void 0,C=_!==null,w=X(r),T=L(r),E=[];if(l||C)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(C||!w.has(`${e}:${t}`)&&!T.has(e))&&E.push({row:e,col:t});let D=_?.preview??null;return e(`div`,{role:`group`,"aria-label":i,"data-testid":`remote-grid`,ref:d,className:a(`grid gap-1.5`,u?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...T.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>T.has(t)?Ze:u?Xe:Ye).join(` `)}},children:[E.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:a(`rounded-md border border-dashed`,C?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n(nt,{group:e,selected:e.id===p,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:u,editable:S,onSelect:m===void 0?void 0:()=>m(e.id),onPointerDown:h===void 0?void 0:t=>h({kind:`group`,id:e.id},t),onKeyDown:g===void 0?void 0:t=>g({kind:`group`,id:e.id},t)},e.id)),r.buttons.map(e=>{if(v!==void 0&&f(e.role))return n(t,{children:v(e,Q(e))},e.id);let r=e.id===o,i=c===void 0||c.has(e.role),l=_?.item.kind===`button`&&_.item.id===e.id,d={kind:`button`,id:e.id},p=Qe(e,q(e.role,x.language));return n(y,{type:`button`,size:`sm`,variant:i?`secondary`:`outline`,"aria-pressed":s===void 0?void 0:r,"aria-label":p,title:p,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:a(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,u&&`px-0`,J(e.shape),Y(e.tone),S&&`touch-none`,l&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:Q(e),onClick:s===void 0?void 0:()=>s(e.id),onPointerDown:h===void 0?void 0:e=>h(d,e),onKeyDown:g===void 0?void 0:e=>g(d,e),children:n(tt,{button:e,compact:u})},e.id)}),D!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":D.valid,className:a(`pointer-events-none z-30 rounded-md border-2 border-dashed`,D.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:Q(Je(r,D.rect))})]})}var $=`edit`;function it(e){return`/system/templates?${$}=${encodeURIComponent(e)}`}function at({templateId:t,testId:r}){let{t:a}=b(),o=x();return e(y,{size:`sm`,variant:`ghost`,onClick:()=>o(it(t)),"data-testid":r??`remote-edit-template`,children:[n(i,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.editTemplate`)]})}export{de as A,le as C,pe as D,R as E,ie as M,oe as O,F as S,ae as T,ye as _,Y as a,he as b,ze as c,re as d,xe as f,k as g,S as h,J as i,me as j,se as k,W as l,ue as m,$ as n,q as o,z as p,rt as r,U as s,at as t,ge as u,be as v,ce as w,ee as x,ve as y};
|
|
1
|
+
import{C as e,H as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Yn as i,dt as a}from"./player-overlays-DRXPDzoq.js";import{$i as o,Cr as s,Fr as c,Pr as l,Sr as u,br as d,ea as f,ia as p,ra as m,xr as h,yr as g}from"./client-Dee-0euI.js";import{t as _}from"./grip-vertical-DotKiQvj.js";import{Cf as v,yi as y}from"./src-CrkcMdUT.js";import{t as b}from"./useTranslation-BJr-n0es.js";import{Rr as x}from"./index-CrUUqNNL.js";r();function S(){return{columns:3,rows:4,buttons:[]}}var C=e=>({status:`refused`,reason:e}),w=e=>({status:`ok`,grid:e});function T(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var E=c;function D(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function O(e){return e.groups??[]}function k(e,t){return O(e).find(e=>e.id===t)}function ee(e,t){return e.buttons.filter(e=>e.groupId===t)}function A(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function j(e,t){let{groupId:n,...r}=t;for(let n of O(e))if(E(n,t))return n.frame===`divider`||!D(n,t)?`overlap`:{...r,groupId:n.id};return r}function M(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!T(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&E(e,t)))return`overlap`;let r=j(e,t);return typeof r==`string`?r:null}function N(e,t){let n=M(e,t,t.id);if(n!==null)return C(n);let r=j(e,t);return typeof r==`string`?C(r):w({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function P(e,t){return e.buttons.find(e=>e.id===t)}function te(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function ne(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!O(e).some(e=>E(e,r))&&M(e,r,null)===null)return{row:t,col:n}}return null}function re(e,t){if(e.buttons.length>=200)return C(`outside`);let n=ne(e);if(n===null)return C(`outside`);let r=j(e,{id:te(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?C(r):w({...e,buttons:[...e.buttons,r]})}function F(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):N(e,{...i,row:n,col:r})}function ie(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):F(e,t,i.row+n,i.col+r)}function ae(e,t,n,r){let i=P(e,t);return i===void 0?C(`unknown-button`):N(e,{...i,rowSpan:n,colSpan:r})}function oe(e,t,n){let r=P(e,t);if(r===void 0)return C(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return w({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function se(e,t,n){let r=P(e,t);if(r===void 0)return C(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return w({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ce(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var I=e=>e.ok?w(e.layout):C(e.reason);function le(e,t,n,r){return I(g(e,t,{row:n,col:r}))}function ue(e,t,n){return I(d(e,t,{keepButtons:n}))}function de(e,t,n){let r=k(e,t);if(r===void 0)return C(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return w(A(e,O(e).map(e=>e.id===t?o:e)))}function fe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function L(e){let t=new Set,n=O(e);for(let r of n){if(!fe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function pe(e){let t=L(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function me(e,t,n){let r=k(e,t);if(r===void 0)return C(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return w(A(e,O(e).map(e=>e.id===t?l:e)))}function R(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return C(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!T(i,e))||O(e).some(e=>!T(i,e))?C(`would-drop-buttons`):w(i)}function z(e){let t=l.safeParse(e);return t.success?t.data:null}function he(e){let t=l.safeParse(e);return t.success?t.data:S()}var ge=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function _e(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function ve(e){return o.filter(t=>_e(t)===e)}function ye(e){let t=f(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function be(e){return f(e)!==null&&!m(e)}function xe(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label}},n=M(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var B=`"/></svg>`,Se={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+B},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},Ce={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+B},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},we={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+B},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},Te={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+B},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},Ee={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+B},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},De={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+B},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Oe={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+B},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},ke={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+B},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},Ae={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+B},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},je={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+B},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},Me={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+B},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Ne={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+B},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},Pe={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+B},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Fe={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+B},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},Ie={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+B},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Le=`app:`,V=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),H=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),U=[V(`netflix`,`Netflix`,Oe),V(`youtube`,`YouTube`,Fe),H(`primevideo`,`Prime Video`,`prime`),H(`disneyplus`,`Disney+`,`D+`),V(`spotify`,`Spotify`,Ne),V(`plex`,`Plex`,je),V(`appletv`,`Apple TV`,Ce),V(`dazn`,`DAZN`,Te),H(`raiplay`,`RaiPlay`,`Rai`),H(`mediasetinfinity`,`Mediaset Infinity`,`MI`),V(`now`,`NOW`,ke),V(`twitch`,`Twitch`,Pe),V(`max`,`Max`,De),V(`paramountplus`,`Paramount+`,Ae),V(`crunchyroll`,`Crunchyroll`,we),V(`sky`,`Sky`,Me),V(`youtubemusic`,`YouTube Music`,Ie),V(`applemusic`,`Apple Music`,Se),V(`kodi`,`Kodi`,Ee)],Re=new Map(U.map(e=>[e.key,e]));function ze(e){return`${Le}${e}`}function W(e){if(!(e===void 0||!e.startsWith(`app:`)))return Re.get(e.slice(4))}function Be(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Ve=.011,He=.91,G=2.2;function K(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Ue(e){if(e.kind!==`glyph`)return null;let t=Be(e.hex);return t===null?null:K(t,Ve)>=G&&K(t,He)>=G?`#${e.hex}`:null}function We({brand:e}){if(e.mark.kind===`lettermark`)return n(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let t=Ue(e.mark);return n(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:t===null?void 0:{fill:t},children:n(`path`,{d:e.mark.path})})}function Ge(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function q(e,t){return u(e,Ge(t))}function J(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function Y(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ke(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function qe(e){return e===`divider`}function Je(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ye=`2.75rem`,Xe=`1.25rem`,Ze=`1rem`;function X(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Z=new Set([`red`,`green`,`yellow`,`blue`]);function Qe(e,t){return e.label??W(e.icon)?.label??t}function $e(e){return e.label===void 0||W(e.icon)!==void 0?!1:e.tone===void 0||!Z.has(e.tone)}function et(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Z.has(e.tone)))return h(e.role)}function tt({button:t,compact:r}){let i=v(),a=W(t.icon),o=et(t),c=t.icon===void 0?s(t.role):void 0,l=o===void 0||a!==void 0||c!==void 0?void 0:i(o),u=$e(t)?t.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&n(We,{brand:a}),l!==void 0&&n(l,{className:`h-4 w-4`,"aria-hidden":!0}),c!==void 0&&n(`span`,{className:`text-sm font-medium`,children:c}),u!==void 0&&!r&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function Q(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function nt({group:t,selected:r,dragging:i,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=b(),f=qe(t.frame),p=!s||o||t.hideTitle===!0?void 0:t.title;return e(`div`,{"data-testid":`remote-group-${t.id}`,"data-frame":t.frame,className:a(`relative -m-0.5 flex`,Ke(t.frame),i&&`opacity-40`,r&&`ring-2 ring-primary`),style:Q(t),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&n(`span`,{className:`truncate`,children:p}),p!==void 0&&n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&n(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&n(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:t.title??t.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${t.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:n(_,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function rt({grid:r,label:i,selectedId:o=null,onSelect:s,boundRoles:c,showEmptyCells:l=!1,compact:u=!1,gridRef:d,selectedGroupId:f=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null,renderWidget:v}){let{i18n:x}=b(),S=h!==void 0,C=_!==null,w=X(r),T=L(r),E=[];if(l||C)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(C||!w.has(`${e}:${t}`)&&!T.has(e))&&E.push({row:e,col:t});let D=_?.preview??null;return e(`div`,{role:`group`,"aria-label":i,"data-testid":`remote-grid`,ref:d,className:a(`grid gap-1.5`,u?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...T.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>T.has(t)?Ze:u?Xe:Ye).join(` `)}},children:[E.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:a(`rounded-md border border-dashed`,C?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n(nt,{group:e,selected:e.id===f,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:u,editable:S,onSelect:m===void 0?void 0:()=>m(e.id),onPointerDown:h===void 0?void 0:t=>h({kind:`group`,id:e.id},t),onKeyDown:g===void 0?void 0:t=>g({kind:`group`,id:e.id},t)},e.id)),r.buttons.map(e=>{if(v!==void 0&&p(e.role))return n(t,{children:v(e,Q(e))},e.id);let r=e.id===o,i=c===void 0||c.has(e.role),l=_?.item.kind===`button`&&_.item.id===e.id,d={kind:`button`,id:e.id},f=Qe(e,q(e.role,x.language));return n(y,{type:`button`,size:`sm`,variant:i?`secondary`:`outline`,"aria-pressed":s===void 0?void 0:r,"aria-label":f,title:f,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:a(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,u&&`px-0`,J(e.shape),Y(e.tone),S&&`touch-none`,l&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:Q(e),onClick:s===void 0?void 0:()=>s(e.id),onPointerDown:h===void 0?void 0:e=>h(d,e),onKeyDown:g===void 0?void 0:e=>g(d,e),children:n(tt,{button:e,compact:u})},e.id)}),D!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":D.valid,className:a(`pointer-events-none z-30 rounded-md border-2 border-dashed`,D.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:Q(Je(r,D.rect))})]})}var $=`edit`;function it(e){return`/system/templates?${$}=${encodeURIComponent(e)}`}function at({templateId:t,testId:r}){let{t:a}=b(),o=x();return e(y,{size:`sm`,variant:`ghost`,onClick:()=>o(it(t)),"data-testid":r??`remote-edit-template`,children:[n(i,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.editTemplate`)]})}export{de as A,le as C,pe as D,R as E,ie as M,oe as O,F as S,ae as T,ye as _,Y as a,he as b,ze as c,re as d,xe as f,k as g,S as h,J as i,me as j,se as k,W as l,ue as m,$ as n,q as o,z as p,rt as r,U as s,at as t,ge as u,be as v,ce as w,ee as x,ve as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,d as a,et as o,u as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{pt as c}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,d as a,et as o,u as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{pt as c}from"./player-overlays-DRXPDzoq.js";import{cs as l}from"./client-Dee-0euI.js";import{D as u,F as d,N as f,O as p,T as m,y as h}from"./__vite-browser-external-BCAtXlNQ.js";import{Cn as g,Ff as _,Fn as v,Vn as y,yn as b}from"./src-CrkcMdUT.js";import{t as x}from"./useTranslation-BJr-n0es.js";o();var S=d([p({kind:m(`adaptive`)}),p({kind:m(`profile`),profile:l})]),C=p({serverUrl:f().min(1),token:f().min(1),deviceId:u().int().nonnegative(),target:S,muted:h()});function w(e,t){let n=t===void 0?{type:`state`,state:e}:{type:`state`,state:e,message:t};window.ReactNativeWebView?.postMessage(JSON.stringify(n))}function T(e){switch(e){case`playing`:return`playing`;case`error`:return`error`;case`connecting`:case`disconnected`:case`idle`:return`connecting`}}function E(e){return e.kind===`adaptive`?{kind:`adaptive`}:{kind:`profile`,profile:e.profile}}function D(e){return e.kind===`adaptive`?`embed:adaptive`:`embed:profile:${e.profile}`}function O(){let e=window.__CAMSTACK_EMBED__;if(e==null)return{ok:!1,error:`window.__CAMSTACK_EMBED__ is not set`};let t=C.safeParse(e);return t.success?{ok:!0,config:t.data}:{ok:!1,error:t.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `)}}function k({message:t}){let{t:n}=x();return r(()=>{w(`error`,t)},[t]),e(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#000`,color:`#f87171`,fontFamily:`system-ui, sans-serif`,fontSize:13,padding:16,textAlign:`center`},children:[n(`embedPlayerPage.embedConfigError`,`Embed config error:`),` `,t]})}function A({system:e,deviceId:a,initialTarget:o,initialMuted:s}){let[c,l]=i(o),[u,d]=i(s),{handleOffer:f,getIceServers:p,addIceCandidate:m,getIceCandidates:h,closeSession:g,getSessionState:_,getSessionDebug:b,applyDownlinkProbe:x}=v(e.trpcClient,a),C=t(()=>E(c),[c]),O=t(()=>(e,t)=>f(C,e,t),[f,C]),k=t(()=>(e,t,n)=>f(n,t,e),[f]);r(()=>(window.__camstackEmbed={setMuted:e=>d(e),setTarget:e=>{let t=S.safeParse(e);t.success&&l(t.data)}},()=>{window.__camstackEmbed&&delete window.__camstackEmbed}),[]);let A=D(c);return n(`div`,{style:{position:`fixed`,inset:0,width:`100vw`,height:`100vh`,background:`#000`},children:n(y,{serverUrl:e.serverUrl,streamKey:A,autoPlay:!0,muted:u,showControls:!1,className:`w-full h-full`,getSessionDebug:b,applyDownlinkProbe:x,handleOffer:O,reoffer:k,getSessionState:_,getIceServers:p,addIceCandidate:m,getIceCandidates:h,closeSession:g,onStateChange:e=>w(T(e)),onError:e=>w(`error`,e)},A)})}function j(){let{t:e}=x(),i=t(()=>O(),[]),o=t(()=>{if(!i.ok)return null;let e=g({serverUrl:i.config.serverUrl,token:i.config.token}),t=new a({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});return b(t),{system:e,queryClient:t}},[i]);return r(()=>{if(o)return()=>{o.system.close()}},[o]),i.ok?o?n(c,{system:o.system,children:n(s,{client:o.queryClient,children:n(_.Provider,{client:o.system.trpcClient,queryClient:o.queryClient,children:n(A,{system:o.system,deviceId:i.config.deviceId,initialTarget:i.config.target,initialMuted:i.config.muted})})})}):n(k,{message:e(`embedPlayerPage.failedToInitialiseTheEmbed`,`Failed to initialise the embed player`)}):n(k,{message:i.error})}export{j as EmbedPlayerPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,Y as r,et as i,i as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as s,Kt as c,Li as l,Nr as u,Pn as d,br as f,bt as p,ct as m,ht as h,lt as g,xa as _}from"./player-overlays-D3s97s6y.js";import{ko as v,qr as y}from"./client-BvmEgDNh.js";import{A as b,Af as x,An as S,B as C,Bn as w,Br as T,D as E,Di as D,Fr as O,Go as k,H as A,I as j,Ir as M,L as ee,Ln as N,Lr as te,M as ne,N as re,O as ie,P as ae,Qr as P,R as oe,S as se,T as ce,U as le,V as ue,Vr as de,W as fe,Xr as F,Yr as I,Zr as pe,b as me,di as L,ii as he,j as R,kn as ge,nd as _e,qr as ve,si as z,vo as ye,w as be,x as xe,yi as B,yo as Se,z as Ce,zn as V,zr as we}from"./src-B-AT5yJl.js";import{t as H}from"./useTranslation-BJr-n0es.js";import{Br as Te}from"./index-nTaq85cS.js";import{t as Ee}from"./AdminPage-BHh-8_fU.js";i();function U(e,t){return e.scope===``?e.displayName:`${e.displayName} · ${t?.(e)??e.scope}`}function De(e,t,n){let r=[];for(let{device:t,series:i}of e)for(let e of i){let i={subject:{kind:`device`,deviceId:t.id},key:e.key,scope:e.scope};r.push({id:R(i),ref:i,info:e,subjectName:t.name,location:t.location??``,nodeId:``,metric:U(e,n)})}for(let{node:e,series:i}of t)for(let t of i){let i={subject:{kind:`node`,nodeId:e.id},key:t.key,scope:t.scope};r.push({id:R(i),ref:i,info:t,subjectName:e.name,location:``,nodeId:e.id,metric:U(t,n)})}return r}function Oe(e){return[e.subjectName,e.location,e.metric,e.info.key,e.info.unit??``,e.nodeId].join(` `)}function W(e,t,n){if(e.ref.subject.kind!==`device`||t===null)return e.subjectName;let r=t.byId.get(e.ref.subject.deviceId);return r===void 0?e.subjectName:he(r,`compact`,t,n)}var ke=[`energy`,`temperatures`,`nodes`,`storage`],Ae=new Set([`cap:temperature-sensor.temperature`,`cap:climate-control.currentTemp`]),G=[`addon:metrics-native/node-cpu-percent`,`addon:metrics-native/node-memory-percent`],je=`addon:storage-orchestrator/location-used-percent`;function Me(e,t){let n=(e,n)=>{let r=t.filter(e);return b((n?[...r].sort(n):r).map(e=>e.ref))};switch(e){case`energy`:return n(e=>e.ref.subject.kind===`device`&&e.info.key===`derived:energy.kwh`);case`temperatures`:return n(e=>e.ref.subject.kind===`device`&&Ae.has(e.info.key)&&e.info.scope===``,(e,t)=>e.location.localeCompare(t.location)||e.subjectName.localeCompare(t.subjectName));case`nodes`:return n(e=>e.ref.subject.kind===`node`&&G.includes(e.info.key)&&e.info.scope===``,(e,t)=>G.indexOf(e.info.key)-G.indexOf(t.info.key)||e.subjectName.localeCompare(t.subjectName));case`storage`:return n(e=>e.ref.subject.kind===`node`&&e.info.key===je)}}function Ne(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=[],o=[];for(let t of b(e)){let e=n.get(R(t));if(e===void 0){o.push(t);continue}e.info.key===`derived:energy.kwh`?a.push(e):e.info.kind===`boolean`||e.info.kind===`enum`?i.push(e):r.push(e)}return{lines:r,states:i,energy:a,missing:o}}function K(e){return e.subject.kind===`device`?{deviceId:e.subject.deviceId,key:e.key,scope:e.scope}:{forNodeId:e.subject.nodeId,key:e.key,scope:e.scope}}var q=`history-page`;function Pe({part:r,window:i}){let{t:a}=H(),o=_(),s=L(),c=z(),u=e=>`${W(e,s,c)} · ${e.metric}`,d=t(()=>[...r.lines,...r.states,...r.energy],[r]),f=be(t(()=>d.map(e=>K(e.ref)),[d]),i,!1),p=e=>f.status===`ok`?f.data.current.get(se(K(e.ref))):void 0,m=e=>{let t=p(e);return t?.ok?t.result:void 0};if(d.length===0)return n(F,{icon:l,title:a(`history.page.emptyTitle`,`Pick series to compare`),description:a(`history.page.emptyHint`,`Choose up to 24 series on the left, or start from a panel above.`)});if(f.status===`error`)return n(I,{title:a(`history.page.readFailed`,`History could not be read`),message:f.error});let h=f.status===`pending`,g=d.map(e=>({c:e,e:p(e)})).filter(e=>e.e?.ok===!1),v=r.lines.map((e,t)=>{let n=m(e),r=ee(e.info,n,i.from);return{id:e.id,label:u(e),unit:e.info.unit,colorIndex:t,points:r.points,gapMs:r.gapMs,interpolation:r.held&&n?.resolution===`raw`?`step`:`linear`}}),y=r.states.map((e,t)=>{let n=oe(e.info,m(e),i.from,i.to),r=ae(e.info.key,o);return{id:e.id,label:u(e),kind:e.info.kind===`boolean`?`boolean`:`enum`,colorIndex:e.info.kind===`boolean`?t:0,states:n.states,segments:n.segments,totals:n.totals,stateLabel:e.info.kind===`boolean`?e=>e===`true`?r.on:r.off:void 0}}),b=r.energy.map(e=>({c:e,...j(m(e))})),x=b[0]?.bucketMs??36e5,S=[...new Set(b.flatMap(e=>e.buckets.map(e=>e.t)))].sort((e,t)=>e-t).map(e=>({t:e,values:b.map(t=>t.buckets.find(t=>t.t===e)?.values[0]??null)}));return e(`div`,{className:`space-y-5 min-w-0`,children:[g.length>0&&n(I,{title:a(`history.page.someFailed`,`Some series could not be read`),message:g.map(e=>`${u(e.c)}: ${e.e.error}`).join(` · `)}),v.length>0&&n(fe,{title:a(`history.page.lines`,`Measurements`),series:v,range:i,height:260,syncKey:q,pending:h}),b.length>0&&n(ve,{title:a(`history.page.energy`,`Energy`),layers:b.map((e,t)=>({id:e.c.id,label:W(e.c,s,c),colorIndex:t})),buckets:S,bucketMs:x,range:i,unit:`kWh`,showTotal:!0,height:160,syncKey:q,pending:h}),y.length>0&&n(le,{title:y.length===1?y[0]?.label??``:a(`history.page.states`,`States`),rows:y,range:i,syncKey:q,pending:h})]})}function Fe(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}async function Ie(e,t){let n=[];for(let r of Fe(e,50))try{let{results:e}=await t(r),i=new Map(e.map(e=>[e.seriesId,e]));for(let e of r)n.push(i.get(e)??{seriesId:e,ok:!1,reason:`not-found`})}catch(e){let t=e instanceof Error?e.message:String(e);for(let e of r)n.push({seriesId:e,ok:!1,reason:`request-failed`,message:t})}return n}function J(e){return e.raw+e[`5m`]+e[`1h`]+e[`1d`]}function Le(e){return e.reduce((e,t)=>t.ok?{...e,deleted:e.deleted+1,points:e.points+J(t.deleted)}:{...e,refused:e.refused+1},{deleted:0,refused:0,points:0})}function Re(e,t){let n=new Map(e.map(e=>[e.seriesId,e]));return t.flatMap(e=>{let t=n.get(e.seriesId);return t===void 0?[]:[{series:t,outcome:e}]})}var Y=e=>new Date(e).toLocaleDateString(void 0,{dateStyle:`short`});function X(e,t,n){let r=t.get(e.deviceId);return r===void 0?e.reason===`device-gone`?n(`history.orphans.deviceRemoved`,`#{{id}} (removed)`,{id:e.deviceId}):n(`history.orphans.deviceId`,`#{{id}}`,{id:e.deviceId}):r}function Z(e){let t=e.displayName??e.key;return e.scope===``?t:`${t} · ${e.scope}`}function Q(t,r,i){return{key:`series`,header:i(`history.orphans.colSeries`,`Series`),render:a=>{let o=t(a);return e(`div`,{className:`min-w-0 max-w-[16rem]`,children:[n(`div`,{className:`truncate text-foreground`,title:o.key,children:Z(o)}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:X(o,r,i)})]})},sortValue:e=>`${X(t(e),r,i)} ${Z(t(e))}`}}var ze=[`raw`,`5m`,`1h`,`1d`];function Be(e,t){return e===`raw`?t(`history.orphans.colRaw`,`Raw points`):e===`5m`?t(`history.orphans.col5m`,`5 min`):e===`1h`?t(`history.orphans.col1h`,`1 h`):t(`history.orphans.col1d`,`1 day`)}function Ve(t,r){return[Q(e=>e,t,r),{key:`reason`,header:r(`history.orphans.colReason`,`Reason`),render:t=>e(`div`,{className:`flex flex-col items-start gap-0.5`,children:[n(D,{variant:t.reason===`device-gone`?`warning`:`neutral`,className:`text-[10px]`,children:t.reason===`device-gone`?r(`history.orphans.deviceGone`,`Device removed`):r(`history.orphans.undeclared`,`No longer declared`)}),t.missingSince!==null&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:r(`history.orphans.since`,`since {{date}}`,{date:Y(t.missingSince)})})]}),sortValue:e=>e.reason},{key:`span`,header:r(`history.orphans.colSpan`,`Recorded`),render:t=>e(`span`,{className:`tabular-nums text-foreground-muted`,children:[Y(t.firstTs),` → `,Y(t.lastTs)]}),sortValue:e=>e.lastTs},...ze.map(e=>({key:`rows-${e}`,header:Be(e,r),align:`right`,render:t=>n(`span`,{className:`tabular-nums text-foreground-muted`,children:t.rows[e].toLocaleString()}),sortValue:t=>t.rows[e]}))]}function He(e,t){if(e.ok)return n(D,{variant:`success`,className:`text-[10px]`,children:t(`history.orphans.deleted`,{count:J(e.deleted),points:J(e.deleted).toLocaleString(),defaultValue_one:`Deleted · {{points}} point`,defaultValue_other:`Deleted · {{points}} points`})});let r=e.reason===`request-failed`?t(`history.orphans.requestFailed`,`Not sent: {{message}}`,{message:e.message}):e.reason===`not-orphan`?t(`history.orphans.refusedNotOrphan`,`Kept: no longer orphan`):e.reason===`not-found`?t(`history.orphans.refusedNotFound`,`Already gone`):t(`history.orphans.refusedFailed`,`The hub could not delete it`);return n(D,{variant:e.reason===`not-found`?`neutral`:`warning`,className:`text-[10px]`,children:r})}function Ue(e,t){return[Q(e=>e.series,e,t),{key:`result`,header:t(`history.orphans.colResult`,`Result`),render:e=>He(e.outcome,t),sortValue:e=>+!e.outcome.ok}]}i();function We({open:i,onClose:a,list:o,deviceNames:s,onDelete:l,onRefresh:u,refreshing:p}){let{t:h}=H(),g=m(),[_,v]=r(new Set),[y,b]=r(!1),[x,S]=r([]),C=t(()=>Ve(s,h),[s,h]),E=t(()=>Ue(s,h),[s,h]),D=t(()=>new Set(o.series.map(e=>String(e.seriesId))),[o.series]),k=[..._].filter(e=>D.has(e)).map(Number),A=Le(x.map(e=>e.outcome)),j=async()=>{if(await g({title:h(`history.orphans.confirmTitle`,{count:k.length,defaultValue_one:`Delete {{count}} series`,defaultValue_other:`Delete {{count}} series`}),message:h(`history.orphans.confirmMessage`,`Every recorded point of these series is removed from the hub. This cannot be undone.`),confirmLabel:h(`history.orphans.confirmLabel`,`Delete`),variant:`danger`})){b(!0);try{let e=await Ie(k,l);S(Re(o.series,e)),v(new Set)}finally{b(!1),u()}}};return n(O,{open:i,onOpenChange:e=>!e&&a(),children:e(te,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`orphan-series-dialog`,children:[n(T,{children:n(de,{children:h(`history.orphans.title`,`Series no longer linked to a device`)})}),e(M,{className:`space-y-3`,children:[n(`p`,{className:`text-xs text-foreground-muted`,children:h(`history.orphans.intro`,`Nothing records into these series any more: their device was removed, or no capability declares them now. Select the ones to delete.`)}),o.truncated&&e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`orphan-truncated`,children:[n(`p`,{className:`text-xs text-warning`,children:h(`history.orphans.truncated`,`More series are unlinked than are listed here. Delete these, then load the rest.`)}),e(B,{size:`sm`,variant:`outline`,onClick:u,disabled:p,children:[n(d,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.loadAgain`,`Load again`)]})]}),x.length>0&&e(`div`,{className:`space-y-2`,"data-testid":`orphan-outcomes`,children:[n(`p`,{className:`text-xs text-foreground`,"aria-live":`polite`,children:h(`history.orphans.summary`,{count:A.deleted,refused:A.refused,points:A.points.toLocaleString(),defaultValue_one:`{{count}} series deleted ({{points}} points), {{refused}} kept.`,defaultValue_other:`{{count}} series deleted ({{points}} points), {{refused}} kept.`})}),n(V,{columns:E,rows:x,rowKey:e=>String(e.series.seriesId),minWidthPx:420,maxBodyHeight:`max-h-[60vh]`,emptyMessage:``})]}),n(V,{columns:C,rows:o.series,rowKey:e=>String(e.seriesId),minWidthPx:760,maxBodyHeight:w,defaultSort:{columnKey:`series`,dir:`asc`},emptyMessage:h(`history.orphans.empty`,`Every series is linked to a device.`),selection:{selected:_,onChange:v,rowLabel:e=>`${Z(e)} — ${X(e,s,h)}`,pageLabel:h(`history.orphans.selectAll`,`Select every listed series`)}})]}),e(we,{children:[n(`span`,{className:`mr-auto text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:h(`history.orphans.selected`,{count:k.length,defaultValue_one:`{{count}} selected`,defaultValue_other:`{{count}} selected`})}),n(B,{variant:`ghost`,size:`sm`,onClick:a,children:h(`history.orphans.close`,`Close`)}),e(B,{variant:`danger`,size:`sm`,disabled:k.length===0||y,onClick:()=>void j(),children:[y?n(f,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(c,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.deleteSelected`,`Delete selected`)]})]})]})})}i();var Ge=5*6e4;function Ke({enabled:i}){let{t:a}=H(),[s,c]=r(!1),l=Se({},{enabled:i,staleTime:Ge}),u=k({projection:`slim`},{enabled:i}),d=ye(),f=t(()=>new Map((u.data??[]).map(e=>[e.id,e.name])),[u.data]),p=e=>d.mutateAsync({seriesIds:[...e]});if(!i||l.status===`pending`)return null;if(l.status===`error`)return n(I,{variant:`warning`,title:a(`history.orphans.checkFailedTitle`,`Could not check for unlinked series`),message:l.error.message,onRetry:()=>void l.refetch()});let m=l.data;if(m.series.length===0&&!s)return null;let h=m.series.length;return e(o,{children:[h>0&&n(I,{variant:`warning`,message:m.truncated?a(`history.orphans.noticeMore`,{count:h,defaultValue_one:`More than {{count}} series are no longer linked to a device.`,defaultValue_other:`More than {{count}} series are no longer linked to a device.`}):a(`history.orphans.notice`,{count:h,defaultValue_one:`{{count}} series is no longer linked to a device.`,defaultValue_other:`{{count}} series are no longer linked to a device.`}),action:n(B,{size:`sm`,variant:`outline`,onClick:()=>c(!0),children:a(`history.orphans.review`,`Review`)})}),n(We,{open:s,onClose:()=>c(!1),list:m,deviceNames:f,onDelete:p,onRefresh:()=>void l.refetch(),refreshing:l.isFetching})]})}i();var qe=`device`,Je=`node`;function Ye({catalog:r,selected:i,onChange:a,loading:o}){let{t:s}=H(),c=L(),l=z(),u=e=>W(e,c,l),d=ge(r,{searchText:e=>[Oe(e)],facetGroups:[{id:`subject`,value:e=>e.ref.subject.kind===`device`?qe:Je},{id:`room`,value:e=>e.location},{id:`unit`,value:e=>e.info.unit??``}]}),f=t(()=>[{key:`metric`,header:s(`history.picker.series`,`Series`),render:t=>e(`div`,{className:`min-w-0`,children:[n(`div`,{className:`truncate text-foreground`,children:t.metric}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.location===``?u(t):`${u(t)} · ${t.location}`})]}),sortValue:e=>`${e.subjectName} ${e.metric}`},{key:`unit`,header:s(`history.picker.unit`,`Unit`),render:e=>n(`span`,{className:`text-foreground-muted`,children:e.info.unit??`—`}),sortValue:e=>e.info.unit??``}],[s,c,l]),p=i.size>=24;return e(`div`,{className:`space-y-2 min-w-0`,children:[n(S,{state:d.state,facets:[],groups:[{...d.groups.find(e=>e.id===`subject`)??{id:`subject`,facets:[],selected:[]},label:s(`history.picker.subject`,`Source`),facetLabel:e=>e===qe?s(`history.picker.devices`,`Devices`):s(`history.picker.nodes`,`Nodes`)},{...d.groups.find(e=>e.id===`room`)??{id:`room`,facets:[],selected:[]},label:s(`history.picker.room`,`Room`),facetLabel:e=>e===``?s(`history.picker.noRoom`,`No room`):e},{...d.groups.find(e=>e.id===`unit`)??{id:`unit`,facets:[],selected:[]},label:s(`history.picker.metricType`,`Unit`),facetLabel:e=>e===``?s(`history.picker.noUnit`,`States & counts`):e}],labels:{searchPlaceholder:s(`history.picker.search`,`Search device, room, metric or node…`),searchLabel:s(`history.picker.searchLabel`,`Search series`),facetsLabel:s(`history.picker.facets`,`Filters`),clearLabel:s(`history.picker.clear`,`Clear`)},onSearch:d.setSearch,onToggleFacet:d.toggleFacet,onToggleGroupFacet:d.toggleGroupFacet,onClear:d.clear}),n(`p`,{className:`text-[10px] text-foreground-subtle`,"aria-live":`polite`,children:s(`history.picker.count`,`{{count}} of {{max}} selected`,{count:i.size,max:24})}),n(V,{columns:f,rows:d.rows,rowKey:e=>e.id,maxBodyHeight:w,pageSize:50,defaultSort:{columnKey:`metric`,dir:`asc`},emptyMessage:o?s(`history.picker.loading`,`Reading the series of every device…`):d.active?s(`history.picker.emptyFiltered`,`No series match these filters.`):s(`history.picker.empty`,`Nothing is recorded yet.`),selection:{selected:i,onChange:e=>{let t=[...e].filter(e=>i.has(e)),n=[...e].filter(e=>!i.has(e));a(new Set([...t,...n].slice(0,24)))},isSelectable:e=>i.has(e.id)||!p,rowLabel:e=>`${u(e)} · ${e.metric}`,pageLabel:s(`history.picker.selectPage`,`Select every series on this page`)}})]})}i();var Xe=new Set([v.Hub,v.Container]),$=5*6e4;function Ze(){let{t:r}=H(),i=pe(`device-history`),[a,o]=Te(),c=t(()=>b(a.getAll(`s`).flatMap(e=>{let t=E(e);return t===null?[]:[t]})),[a]),d=a.get(`window`),f=ue(d)?d:`7d`,h=Ce(a.get(`range`)),_=(e,t,n)=>{let r=new URLSearchParams;for(let t of b(e))r.append(`s`,ie(t));t!==`7d`&&r.set(`window`,t);let i=n===void 0?a.get(`range`):n;t===`custom`&&i&&r.set(`range`,i),o(r,{replace:!0})},v=Qe(i===`present`),y=A(f,Date.now(),h),x=A(f,xe(Date.now(),y.to-y.from),h),S=t(()=>Ne(c,v.candidates),[c,v.candidates]),w=t(()=>new Set(c.map(R)),[c]),T=me(),D=g(),O=m(),k=async()=>{let e=await D({title:r(`history.page.saveTitle`,`Save as panel`),label:r(`history.page.saveName`,`Panel name`),confirmLabel:r(`history.page.save`,`Save`)});e===null||e.trim()===``||await T.update(t=>ne(t,{id:`panel-${Date.now().toString(36)}`,name:e.trim().slice(0,80),window:f,selection:[...c]}))},j=async(e,t)=>{await O({title:r(`history.page.deleteTitle`,`Delete panel`),message:r(`history.page.deleteMessage`,`The panel "{{name}}" is removed from your account.`,{name:t}),confirmLabel:r(`history.page.delete`,`Delete`),variant:`danger`})&&await T.update(t=>re(t,e))},M=e=>e===`energy`?r(`history.panels.energy`,`Total energy`):e===`temperatures`?r(`history.panels.temperatures`,`Temperatures by room`):e===`nodes`?r(`history.panels.nodes`,`Cluster nodes`):r(`history.panels.storage`,`Storage locations`);return n(Ee,{icon:l,title:r(`history.page.title`,`History`),subtitle:r(`history.page.subtitle`,`What devices, nodes and storage recorded over time, side by side.`),actions:i===`present`?e(B,{size:`sm`,variant:`outline`,onClick:()=>void k(),disabled:c.length===0||!T.writable,children:[n(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),r(`history.page.saveTitle`,`Save as panel`)]}):void 0,children:i===`pending`?n(P,{className:`h-64 w-full`}):i===`unknown`?n(I,{title:r(`history.page.presenceUnknownTitle`,`Could not reach the hub`),message:r(`history.page.presenceUnknown`,`The hub did not say whether device history is installed. Try again in a moment.`)}):i===`absent`?n(F,{icon:u,title:r(`history.page.absentTitle`,`Device history is not running on this hub`),description:r(`history.page.absent`,`Nothing is recorded until the device-history system addon is enabled.`)}):e(`div`,{className:`space-y-3 sm:space-y-4`,children:[n(Ke,{enabled:i===`present`}),e(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":r(`history.page.panels`,`Panels`),children:[ke.map(e=>n(B,{size:`sm`,variant:`outline`,disabled:v.status!==`ok`,onClick:()=>_(Me(e,v.candidates),f),children:M(e)},e)),T.value.panels.map(t=>e(`span`,{className:`inline-flex items-center`,children:[n(B,{size:`sm`,variant:`secondary`,onClick:()=>_(t.selection,t.window,null),children:t.name}),n(B,{size:`sm`,variant:`ghost`,"aria-label":r(`history.page.deleteNamed`,`Delete panel {{name}}`,{name:t.name}),onClick:()=>void j(t.id,t.name),disabled:!T.writable,children:n(p,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},t.id))]}),e(`div`,{className:`grid grid-cols-1 gap-3 sm:gap-4 xl:grid-cols-5`,children:[n(`div`,{className:`min-w-0 xl:col-span-2`,children:n(N,{headingId:`history-picker`,title:r(`history.picker.title`,`Series`),children:n(`div`,{className:`p-2 sm:p-3`,children:v.status===`error`?n(I,{message:v.error}):n(Ye,{catalog:v.candidates,loading:v.status===`pending`,selected:w,onChange:e=>{let t=c.filter(t=>e.has(R(t))),n=v.candidates.filter(t=>e.has(t.id)&&!w.has(t.id)).map(e=>e.ref);_([...t,...n],f)}})})})}),n(`div`,{className:`min-w-0 xl:col-span-3`,children:n(N,{headingId:`history-overlay`,title:r(`history.page.overlay`,`Overlay`),actions:c.length>0?n(B,{size:`sm`,variant:`ghost`,onClick:()=>_([],f),children:r(`history.page.clear`,`Clear`)}):void 0,children:e(`div`,{className:`p-2 sm:p-3 space-y-3 min-w-0`,children:[n(ce,{value:f,onChange:e=>_(c,e),custom:h,onCustomChange:e=>_(c,`custom`,C(e))}),v.status===`pending`&&c.length>0?n(P,{className:`h-64 w-full`}):n(Pe,{part:S,window:x}),S.missing.length>0&&v.status===`ok`&&n(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`history.page.missing`,{count:S.missing.length,defaultValue_one:`{{count}} selected series is no longer recorded.`,defaultValue_other:`{{count}} selected series are no longer recorded.`})})]})})})]})]})})}function Qe(e){let{t:n}=H(),r=n(`history.picker.wholeFrame`,`Whole frame`),i=h().trpcClient,o=k({projection:`slim`},{enabled:e}),{nodes:s}=x(),c=t(()=>(o.data??[]).filter(e=>!Xe.has(String(e.type))),[o.data]),l=a({queries:c.map(t=>({queryKey:[`device-history`,`listSeries`,t.id],queryFn:()=>i.deviceHistory.listSeries.query({deviceId:t.id}),enabled:e,staleTime:$}))}),u=a({queries:s.map(t=>({queryKey:[`device-history`,`listNodeSeries`,t.id],queryFn:()=>i.deviceHistory.listNodeSeries.query({forNodeId:t.id}),enabled:e,staleTime:$}))}),d=_e({},{enabled:e,staleTime:$}),f=t(()=>new Map((d?.data??[]).map(e=>[e.id,e.displayName])),[d?.data]),p=l.map(e=>e.data),m=u.map(e=>e.data),g=t(()=>De(c.flatMap((e,t)=>{let n=p[t];return n===void 0?[]:[{device:{id:e.id,name:e.name,location:e.location??null},series:n}]}),s.flatMap((e,t)=>{let n=m[t];return n===void 0?[]:[{node:{id:e.id,name:e.name},series:n}]}),e=>{if(e.key!==`addon:pipeline-analytics/occupancy`)return f.get(e.scope)??e.scope;let{zoneId:t,className:n}=y(e.scope),i=t===``?r:t;return n===void 0?i:`${i} · ${n}`}),[c,s,f,[...l,...u].map(e=>e.dataUpdatedAt).join(`,`),r]);return o.status===`error`?{status:`error`,error:o.error.message,candidates:[]}:{status:o.status===`pending`||l.some(e=>e.isPending)||u.some(e=>e.isPending)?`pending`:`ok`,error:``,candidates:g}}export{Ze as HistoryPage};
|
|
1
|
+
import{C as e,K as t,S as n,Y as r,et as i,i as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as s,Kt as c,Li as l,Nr as u,Pn as d,br as f,bt as p,ct as m,ht as h,lt as g,xa as _}from"./player-overlays-DRXPDzoq.js";import{Jr as v,No as y}from"./client-Dee-0euI.js";import{A as b,Af as x,An as S,B as C,Bn as w,Br as T,D as E,Di as D,Fr as O,Go as k,H as A,I as j,Ir as M,L as ee,Ln as N,Lr as te,M as ne,N as re,O as ie,P as ae,Qr as P,R as oe,S as se,T as ce,U as le,V as ue,Vr as de,W as fe,Xr as F,Yr as I,Zr as pe,b as me,di as L,ii as he,j as R,kn as ge,nd as _e,qr as ve,si as z,vo as ye,w as be,x as xe,yi as B,yo as Se,z as Ce,zn as V,zr as we}from"./src-CrkcMdUT.js";import{t as H}from"./useTranslation-BJr-n0es.js";import{Br as Te}from"./index-CrUUqNNL.js";import{t as Ee}from"./AdminPage-C6Nfjqwk.js";i();function U(e,t){return e.scope===``?e.displayName:`${e.displayName} · ${t?.(e)??e.scope}`}function De(e,t,n){let r=[];for(let{device:t,series:i}of e)for(let e of i){let i={subject:{kind:`device`,deviceId:t.id},key:e.key,scope:e.scope};r.push({id:R(i),ref:i,info:e,subjectName:t.name,location:t.location??``,nodeId:``,metric:U(e,n)})}for(let{node:e,series:i}of t)for(let t of i){let i={subject:{kind:`node`,nodeId:e.id},key:t.key,scope:t.scope};r.push({id:R(i),ref:i,info:t,subjectName:e.name,location:``,nodeId:e.id,metric:U(t,n)})}return r}function Oe(e){return[e.subjectName,e.location,e.metric,e.info.key,e.info.unit??``,e.nodeId].join(` `)}function W(e,t,n){if(e.ref.subject.kind!==`device`||t===null)return e.subjectName;let r=t.byId.get(e.ref.subject.deviceId);return r===void 0?e.subjectName:he(r,`compact`,t,n)}var ke=[`energy`,`temperatures`,`nodes`,`storage`],Ae=new Set([`cap:temperature-sensor.temperature`,`cap:climate-control.currentTemp`]),G=[`addon:metrics-native/node-cpu-percent`,`addon:metrics-native/node-memory-percent`],je=`addon:storage-orchestrator/location-used-percent`;function Me(e,t){let n=(e,n)=>{let r=t.filter(e);return b((n?[...r].sort(n):r).map(e=>e.ref))};switch(e){case`energy`:return n(e=>e.ref.subject.kind===`device`&&e.info.key===`derived:energy.kwh`);case`temperatures`:return n(e=>e.ref.subject.kind===`device`&&Ae.has(e.info.key)&&e.info.scope===``,(e,t)=>e.location.localeCompare(t.location)||e.subjectName.localeCompare(t.subjectName));case`nodes`:return n(e=>e.ref.subject.kind===`node`&&G.includes(e.info.key)&&e.info.scope===``,(e,t)=>G.indexOf(e.info.key)-G.indexOf(t.info.key)||e.subjectName.localeCompare(t.subjectName));case`storage`:return n(e=>e.ref.subject.kind===`node`&&e.info.key===je)}}function Ne(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=[],o=[];for(let t of b(e)){let e=n.get(R(t));if(e===void 0){o.push(t);continue}e.info.key===`derived:energy.kwh`?a.push(e):e.info.kind===`boolean`||e.info.kind===`enum`?i.push(e):r.push(e)}return{lines:r,states:i,energy:a,missing:o}}function K(e){return e.subject.kind===`device`?{deviceId:e.subject.deviceId,key:e.key,scope:e.scope}:{forNodeId:e.subject.nodeId,key:e.key,scope:e.scope}}var q=`history-page`;function Pe({part:r,window:i}){let{t:a}=H(),o=_(),s=L(),c=z(),u=e=>`${W(e,s,c)} · ${e.metric}`,d=t(()=>[...r.lines,...r.states,...r.energy],[r]),f=be(t(()=>d.map(e=>K(e.ref)),[d]),i,!1),p=e=>f.status===`ok`?f.data.current.get(se(K(e.ref))):void 0,m=e=>{let t=p(e);return t?.ok?t.result:void 0};if(d.length===0)return n(F,{icon:l,title:a(`history.page.emptyTitle`,`Pick series to compare`),description:a(`history.page.emptyHint`,`Choose up to 24 series on the left, or start from a panel above.`)});if(f.status===`error`)return n(I,{title:a(`history.page.readFailed`,`History could not be read`),message:f.error});let h=f.status===`pending`,g=d.map(e=>({c:e,e:p(e)})).filter(e=>e.e?.ok===!1),v=r.lines.map((e,t)=>{let n=m(e),r=ee(e.info,n,i.from);return{id:e.id,label:u(e),unit:e.info.unit,colorIndex:t,points:r.points,gapMs:r.gapMs,interpolation:r.held&&n?.resolution===`raw`?`step`:`linear`}}),y=r.states.map((e,t)=>{let n=oe(e.info,m(e),i.from,i.to),r=ae(e.info.key,o);return{id:e.id,label:u(e),kind:e.info.kind===`boolean`?`boolean`:`enum`,colorIndex:e.info.kind===`boolean`?t:0,states:n.states,segments:n.segments,totals:n.totals,stateLabel:e.info.kind===`boolean`?e=>e===`true`?r.on:r.off:void 0}}),b=r.energy.map(e=>({c:e,...j(m(e))})),x=b[0]?.bucketMs??36e5,S=[...new Set(b.flatMap(e=>e.buckets.map(e=>e.t)))].sort((e,t)=>e-t).map(e=>({t:e,values:b.map(t=>t.buckets.find(t=>t.t===e)?.values[0]??null)}));return e(`div`,{className:`space-y-5 min-w-0`,children:[g.length>0&&n(I,{title:a(`history.page.someFailed`,`Some series could not be read`),message:g.map(e=>`${u(e.c)}: ${e.e.error}`).join(` · `)}),v.length>0&&n(fe,{title:a(`history.page.lines`,`Measurements`),series:v,range:i,height:260,syncKey:q,pending:h}),b.length>0&&n(ve,{title:a(`history.page.energy`,`Energy`),layers:b.map((e,t)=>({id:e.c.id,label:W(e.c,s,c),colorIndex:t})),buckets:S,bucketMs:x,range:i,unit:`kWh`,showTotal:!0,height:160,syncKey:q,pending:h}),y.length>0&&n(le,{title:y.length===1?y[0]?.label??``:a(`history.page.states`,`States`),rows:y,range:i,syncKey:q,pending:h})]})}function Fe(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}async function Ie(e,t){let n=[];for(let r of Fe(e,50))try{let{results:e}=await t(r),i=new Map(e.map(e=>[e.seriesId,e]));for(let e of r)n.push(i.get(e)??{seriesId:e,ok:!1,reason:`not-found`})}catch(e){let t=e instanceof Error?e.message:String(e);for(let e of r)n.push({seriesId:e,ok:!1,reason:`request-failed`,message:t})}return n}function J(e){return e.raw+e[`5m`]+e[`1h`]+e[`1d`]}function Le(e){return e.reduce((e,t)=>t.ok?{...e,deleted:e.deleted+1,points:e.points+J(t.deleted)}:{...e,refused:e.refused+1},{deleted:0,refused:0,points:0})}function Re(e,t){let n=new Map(e.map(e=>[e.seriesId,e]));return t.flatMap(e=>{let t=n.get(e.seriesId);return t===void 0?[]:[{series:t,outcome:e}]})}var Y=e=>new Date(e).toLocaleDateString(void 0,{dateStyle:`short`});function X(e,t,n){let r=t.get(e.deviceId);return r===void 0?e.reason===`device-gone`?n(`history.orphans.deviceRemoved`,`#{{id}} (removed)`,{id:e.deviceId}):n(`history.orphans.deviceId`,`#{{id}}`,{id:e.deviceId}):r}function Z(e){let t=e.displayName??e.key;return e.scope===``?t:`${t} · ${e.scope}`}function Q(t,r,i){return{key:`series`,header:i(`history.orphans.colSeries`,`Series`),render:a=>{let o=t(a);return e(`div`,{className:`min-w-0 max-w-[16rem]`,children:[n(`div`,{className:`truncate text-foreground`,title:o.key,children:Z(o)}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:X(o,r,i)})]})},sortValue:e=>`${X(t(e),r,i)} ${Z(t(e))}`}}var ze=[`raw`,`5m`,`1h`,`1d`];function Be(e,t){return e===`raw`?t(`history.orphans.colRaw`,`Raw points`):e===`5m`?t(`history.orphans.col5m`,`5 min`):e===`1h`?t(`history.orphans.col1h`,`1 h`):t(`history.orphans.col1d`,`1 day`)}function Ve(t,r){return[Q(e=>e,t,r),{key:`reason`,header:r(`history.orphans.colReason`,`Reason`),render:t=>e(`div`,{className:`flex flex-col items-start gap-0.5`,children:[n(D,{variant:t.reason===`device-gone`?`warning`:`neutral`,className:`text-[10px]`,children:t.reason===`device-gone`?r(`history.orphans.deviceGone`,`Device removed`):r(`history.orphans.undeclared`,`No longer declared`)}),t.missingSince!==null&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:r(`history.orphans.since`,`since {{date}}`,{date:Y(t.missingSince)})})]}),sortValue:e=>e.reason},{key:`span`,header:r(`history.orphans.colSpan`,`Recorded`),render:t=>e(`span`,{className:`tabular-nums text-foreground-muted`,children:[Y(t.firstTs),` → `,Y(t.lastTs)]}),sortValue:e=>e.lastTs},...ze.map(e=>({key:`rows-${e}`,header:Be(e,r),align:`right`,render:t=>n(`span`,{className:`tabular-nums text-foreground-muted`,children:t.rows[e].toLocaleString()}),sortValue:t=>t.rows[e]}))]}function He(e,t){if(e.ok)return n(D,{variant:`success`,className:`text-[10px]`,children:t(`history.orphans.deleted`,{count:J(e.deleted),points:J(e.deleted).toLocaleString(),defaultValue_one:`Deleted · {{points}} point`,defaultValue_other:`Deleted · {{points}} points`})});let r=e.reason===`request-failed`?t(`history.orphans.requestFailed`,`Not sent: {{message}}`,{message:e.message}):e.reason===`not-orphan`?t(`history.orphans.refusedNotOrphan`,`Kept: no longer orphan`):e.reason===`not-found`?t(`history.orphans.refusedNotFound`,`Already gone`):t(`history.orphans.refusedFailed`,`The hub could not delete it`);return n(D,{variant:e.reason===`not-found`?`neutral`:`warning`,className:`text-[10px]`,children:r})}function Ue(e,t){return[Q(e=>e.series,e,t),{key:`result`,header:t(`history.orphans.colResult`,`Result`),render:e=>He(e.outcome,t),sortValue:e=>+!e.outcome.ok}]}i();function We({open:i,onClose:a,list:o,deviceNames:s,onDelete:l,onRefresh:u,refreshing:p}){let{t:h}=H(),g=m(),[_,v]=r(new Set),[y,b]=r(!1),[x,S]=r([]),C=t(()=>Ve(s,h),[s,h]),E=t(()=>Ue(s,h),[s,h]),D=t(()=>new Set(o.series.map(e=>String(e.seriesId))),[o.series]),k=[..._].filter(e=>D.has(e)).map(Number),A=Le(x.map(e=>e.outcome)),j=async()=>{if(await g({title:h(`history.orphans.confirmTitle`,{count:k.length,defaultValue_one:`Delete {{count}} series`,defaultValue_other:`Delete {{count}} series`}),message:h(`history.orphans.confirmMessage`,`Every recorded point of these series is removed from the hub. This cannot be undone.`),confirmLabel:h(`history.orphans.confirmLabel`,`Delete`),variant:`danger`})){b(!0);try{let e=await Ie(k,l);S(Re(o.series,e)),v(new Set)}finally{b(!1),u()}}};return n(O,{open:i,onOpenChange:e=>!e&&a(),children:e(te,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`orphan-series-dialog`,children:[n(T,{children:n(de,{children:h(`history.orphans.title`,`Series no longer linked to a device`)})}),e(M,{className:`space-y-3`,children:[n(`p`,{className:`text-xs text-foreground-muted`,children:h(`history.orphans.intro`,`Nothing records into these series any more: their device was removed, or no capability declares them now. Select the ones to delete.`)}),o.truncated&&e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`orphan-truncated`,children:[n(`p`,{className:`text-xs text-warning`,children:h(`history.orphans.truncated`,`More series are unlinked than are listed here. Delete these, then load the rest.`)}),e(B,{size:`sm`,variant:`outline`,onClick:u,disabled:p,children:[n(d,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.loadAgain`,`Load again`)]})]}),x.length>0&&e(`div`,{className:`space-y-2`,"data-testid":`orphan-outcomes`,children:[n(`p`,{className:`text-xs text-foreground`,"aria-live":`polite`,children:h(`history.orphans.summary`,{count:A.deleted,refused:A.refused,points:A.points.toLocaleString(),defaultValue_one:`{{count}} series deleted ({{points}} points), {{refused}} kept.`,defaultValue_other:`{{count}} series deleted ({{points}} points), {{refused}} kept.`})}),n(V,{columns:E,rows:x,rowKey:e=>String(e.series.seriesId),minWidthPx:420,maxBodyHeight:`max-h-[60vh]`,emptyMessage:``})]}),n(V,{columns:C,rows:o.series,rowKey:e=>String(e.seriesId),minWidthPx:760,maxBodyHeight:w,defaultSort:{columnKey:`series`,dir:`asc`},emptyMessage:h(`history.orphans.empty`,`Every series is linked to a device.`),selection:{selected:_,onChange:v,rowLabel:e=>`${Z(e)} — ${X(e,s,h)}`,pageLabel:h(`history.orphans.selectAll`,`Select every listed series`)}})]}),e(we,{children:[n(`span`,{className:`mr-auto text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:h(`history.orphans.selected`,{count:k.length,defaultValue_one:`{{count}} selected`,defaultValue_other:`{{count}} selected`})}),n(B,{variant:`ghost`,size:`sm`,onClick:a,children:h(`history.orphans.close`,`Close`)}),e(B,{variant:`danger`,size:`sm`,disabled:k.length===0||y,onClick:()=>void j(),children:[y?n(f,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(c,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.deleteSelected`,`Delete selected`)]})]})]})})}i();var Ge=5*6e4;function Ke({enabled:i}){let{t:a}=H(),[s,c]=r(!1),l=Se({},{enabled:i,staleTime:Ge}),u=k({projection:`slim`},{enabled:i}),d=ye(),f=t(()=>new Map((u.data??[]).map(e=>[e.id,e.name])),[u.data]),p=e=>d.mutateAsync({seriesIds:[...e]});if(!i||l.status===`pending`)return null;if(l.status===`error`)return n(I,{variant:`warning`,title:a(`history.orphans.checkFailedTitle`,`Could not check for unlinked series`),message:l.error.message,onRetry:()=>void l.refetch()});let m=l.data;if(m.series.length===0&&!s)return null;let h=m.series.length;return e(o,{children:[h>0&&n(I,{variant:`warning`,message:m.truncated?a(`history.orphans.noticeMore`,{count:h,defaultValue_one:`More than {{count}} series are no longer linked to a device.`,defaultValue_other:`More than {{count}} series are no longer linked to a device.`}):a(`history.orphans.notice`,{count:h,defaultValue_one:`{{count}} series is no longer linked to a device.`,defaultValue_other:`{{count}} series are no longer linked to a device.`}),action:n(B,{size:`sm`,variant:`outline`,onClick:()=>c(!0),children:a(`history.orphans.review`,`Review`)})}),n(We,{open:s,onClose:()=>c(!1),list:m,deviceNames:f,onDelete:p,onRefresh:()=>void l.refetch(),refreshing:l.isFetching})]})}i();var qe=`device`,Je=`node`;function Ye({catalog:r,selected:i,onChange:a,loading:o}){let{t:s}=H(),c=L(),l=z(),u=e=>W(e,c,l),d=ge(r,{searchText:e=>[Oe(e)],facetGroups:[{id:`subject`,value:e=>e.ref.subject.kind===`device`?qe:Je},{id:`room`,value:e=>e.location},{id:`unit`,value:e=>e.info.unit??``}]}),f=t(()=>[{key:`metric`,header:s(`history.picker.series`,`Series`),render:t=>e(`div`,{className:`min-w-0`,children:[n(`div`,{className:`truncate text-foreground`,children:t.metric}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.location===``?u(t):`${u(t)} · ${t.location}`})]}),sortValue:e=>`${e.subjectName} ${e.metric}`},{key:`unit`,header:s(`history.picker.unit`,`Unit`),render:e=>n(`span`,{className:`text-foreground-muted`,children:e.info.unit??`—`}),sortValue:e=>e.info.unit??``}],[s,c,l]),p=i.size>=24;return e(`div`,{className:`space-y-2 min-w-0`,children:[n(S,{state:d.state,facets:[],groups:[{...d.groups.find(e=>e.id===`subject`)??{id:`subject`,facets:[],selected:[]},label:s(`history.picker.subject`,`Source`),facetLabel:e=>e===qe?s(`history.picker.devices`,`Devices`):s(`history.picker.nodes`,`Nodes`)},{...d.groups.find(e=>e.id===`room`)??{id:`room`,facets:[],selected:[]},label:s(`history.picker.room`,`Room`),facetLabel:e=>e===``?s(`history.picker.noRoom`,`No room`):e},{...d.groups.find(e=>e.id===`unit`)??{id:`unit`,facets:[],selected:[]},label:s(`history.picker.metricType`,`Unit`),facetLabel:e=>e===``?s(`history.picker.noUnit`,`States & counts`):e}],labels:{searchPlaceholder:s(`history.picker.search`,`Search device, room, metric or node…`),searchLabel:s(`history.picker.searchLabel`,`Search series`),facetsLabel:s(`history.picker.facets`,`Filters`),clearLabel:s(`history.picker.clear`,`Clear`)},onSearch:d.setSearch,onToggleFacet:d.toggleFacet,onToggleGroupFacet:d.toggleGroupFacet,onClear:d.clear}),n(`p`,{className:`text-[10px] text-foreground-subtle`,"aria-live":`polite`,children:s(`history.picker.count`,`{{count}} of {{max}} selected`,{count:i.size,max:24})}),n(V,{columns:f,rows:d.rows,rowKey:e=>e.id,maxBodyHeight:w,pageSize:50,defaultSort:{columnKey:`metric`,dir:`asc`},emptyMessage:o?s(`history.picker.loading`,`Reading the series of every device…`):d.active?s(`history.picker.emptyFiltered`,`No series match these filters.`):s(`history.picker.empty`,`Nothing is recorded yet.`),selection:{selected:i,onChange:e=>{let t=[...e].filter(e=>i.has(e)),n=[...e].filter(e=>!i.has(e));a(new Set([...t,...n].slice(0,24)))},isSelectable:e=>i.has(e.id)||!p,rowLabel:e=>`${u(e)} · ${e.metric}`,pageLabel:s(`history.picker.selectPage`,`Select every series on this page`)}})]})}i();var Xe=new Set([y.Hub,y.Container]),$=5*6e4;function Ze(){let{t:r}=H(),i=pe(`device-history`),[a,o]=Te(),c=t(()=>b(a.getAll(`s`).flatMap(e=>{let t=E(e);return t===null?[]:[t]})),[a]),d=a.get(`window`),f=ue(d)?d:`7d`,h=Ce(a.get(`range`)),_=(e,t,n)=>{let r=new URLSearchParams;for(let t of b(e))r.append(`s`,ie(t));t!==`7d`&&r.set(`window`,t);let i=n===void 0?a.get(`range`):n;t===`custom`&&i&&r.set(`range`,i),o(r,{replace:!0})},v=Qe(i===`present`),y=A(f,Date.now(),h),x=A(f,xe(Date.now(),y.to-y.from),h),S=t(()=>Ne(c,v.candidates),[c,v.candidates]),w=t(()=>new Set(c.map(R)),[c]),T=me(),D=g(),O=m(),k=async()=>{let e=await D({title:r(`history.page.saveTitle`,`Save as panel`),label:r(`history.page.saveName`,`Panel name`),confirmLabel:r(`history.page.save`,`Save`)});e===null||e.trim()===``||await T.update(t=>ne(t,{id:`panel-${Date.now().toString(36)}`,name:e.trim().slice(0,80),window:f,selection:[...c]}))},j=async(e,t)=>{await O({title:r(`history.page.deleteTitle`,`Delete panel`),message:r(`history.page.deleteMessage`,`The panel "{{name}}" is removed from your account.`,{name:t}),confirmLabel:r(`history.page.delete`,`Delete`),variant:`danger`})&&await T.update(t=>re(t,e))},M=e=>e===`energy`?r(`history.panels.energy`,`Total energy`):e===`temperatures`?r(`history.panels.temperatures`,`Temperatures by room`):e===`nodes`?r(`history.panels.nodes`,`Cluster nodes`):r(`history.panels.storage`,`Storage locations`);return n(Ee,{icon:l,title:r(`history.page.title`,`History`),subtitle:r(`history.page.subtitle`,`What devices, nodes and storage recorded over time, side by side.`),actions:i===`present`?e(B,{size:`sm`,variant:`outline`,onClick:()=>void k(),disabled:c.length===0||!T.writable,children:[n(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),r(`history.page.saveTitle`,`Save as panel`)]}):void 0,children:i===`pending`?n(P,{className:`h-64 w-full`}):i===`unknown`?n(I,{title:r(`history.page.presenceUnknownTitle`,`Could not reach the hub`),message:r(`history.page.presenceUnknown`,`The hub did not say whether device history is installed. Try again in a moment.`)}):i===`absent`?n(F,{icon:u,title:r(`history.page.absentTitle`,`Device history is not running on this hub`),description:r(`history.page.absent`,`Nothing is recorded until the device-history system addon is enabled.`)}):e(`div`,{className:`space-y-3 sm:space-y-4`,children:[n(Ke,{enabled:i===`present`}),e(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":r(`history.page.panels`,`Panels`),children:[ke.map(e=>n(B,{size:`sm`,variant:`outline`,disabled:v.status!==`ok`,onClick:()=>_(Me(e,v.candidates),f),children:M(e)},e)),T.value.panels.map(t=>e(`span`,{className:`inline-flex items-center`,children:[n(B,{size:`sm`,variant:`secondary`,onClick:()=>_(t.selection,t.window,null),children:t.name}),n(B,{size:`sm`,variant:`ghost`,"aria-label":r(`history.page.deleteNamed`,`Delete panel {{name}}`,{name:t.name}),onClick:()=>void j(t.id,t.name),disabled:!T.writable,children:n(p,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},t.id))]}),e(`div`,{className:`grid grid-cols-1 gap-3 sm:gap-4 xl:grid-cols-5`,children:[n(`div`,{className:`min-w-0 xl:col-span-2`,children:n(N,{headingId:`history-picker`,title:r(`history.picker.title`,`Series`),children:n(`div`,{className:`p-2 sm:p-3`,children:v.status===`error`?n(I,{message:v.error}):n(Ye,{catalog:v.candidates,loading:v.status===`pending`,selected:w,onChange:e=>{let t=c.filter(t=>e.has(R(t))),n=v.candidates.filter(t=>e.has(t.id)&&!w.has(t.id)).map(e=>e.ref);_([...t,...n],f)}})})})}),n(`div`,{className:`min-w-0 xl:col-span-3`,children:n(N,{headingId:`history-overlay`,title:r(`history.page.overlay`,`Overlay`),actions:c.length>0?n(B,{size:`sm`,variant:`ghost`,onClick:()=>_([],f),children:r(`history.page.clear`,`Clear`)}):void 0,children:e(`div`,{className:`p-2 sm:p-3 space-y-3 min-w-0`,children:[n(ce,{value:f,onChange:e=>_(c,e),custom:h,onCustomChange:e=>_(c,`custom`,C(e))}),v.status===`pending`&&c.length>0?n(P,{className:`h-64 w-full`}):n(Pe,{part:S,window:x}),S.missing.length>0&&v.status===`ok`&&n(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`history.page.missing`,{count:S.missing.length,defaultValue_one:`{{count}} selected series is no longer recorded.`,defaultValue_other:`{{count}} selected series are no longer recorded.`})})]})})})]})]})})}function Qe(e){let{t:n}=H(),r=n(`history.picker.wholeFrame`,`Whole frame`),i=h().trpcClient,o=k({projection:`slim`},{enabled:e}),{nodes:s}=x(),c=t(()=>(o.data??[]).filter(e=>!Xe.has(String(e.type))),[o.data]),l=a({queries:c.map(t=>({queryKey:[`device-history`,`listSeries`,t.id],queryFn:()=>i.deviceHistory.listSeries.query({deviceId:t.id}),enabled:e,staleTime:$}))}),u=a({queries:s.map(t=>({queryKey:[`device-history`,`listNodeSeries`,t.id],queryFn:()=>i.deviceHistory.listNodeSeries.query({forNodeId:t.id}),enabled:e,staleTime:$}))}),d=_e({},{enabled:e,staleTime:$}),f=t(()=>new Map((d?.data??[]).map(e=>[e.id,e.displayName])),[d?.data]),p=l.map(e=>e.data),m=u.map(e=>e.data),g=t(()=>De(c.flatMap((e,t)=>{let n=p[t];return n===void 0?[]:[{device:{id:e.id,name:e.name,location:e.location??null},series:n}]}),s.flatMap((e,t)=>{let n=m[t];return n===void 0?[]:[{node:{id:e.id,name:e.name},series:n}]}),e=>{if(e.key!==`addon:pipeline-analytics/occupancy`)return f.get(e.scope)??e.scope;let{zoneId:t,className:n}=v(e.scope),i=t===``?r:t;return n===void 0?i:`${i} · ${n}`}),[c,s,f,[...l,...u].map(e=>e.dataUpdatedAt).join(`,`),r]);return o.status===`error`?{status:`error`,error:o.error.message,candidates:[]}:{status:o.status===`pending`||l.some(e=>e.isPending)||u.some(e=>e.isPending)?`pending`:`ok`,error:``,candidates:g}}export{Ze as HistoryPage};
|