@camstack/addon-admin-ui 1.2.652 → 1.2.653
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 +8 -0
- package/dist/assets/Addons-B-UM6GSX.js +5 -0
- package/dist/assets/{AdminPage-2H7qegiH.js → AdminPage-IHC_FLB8.js} +1 -1
- package/dist/assets/AdminSectionedPage-Ch-ZRoVJ.js +1 -0
- package/dist/assets/AiProfiles-B4SUJQ9G.js +3 -0
- package/dist/assets/{BootstrapSettingsForm-DJLxKYKT.js → BootstrapSettingsForm-BIJKJjHp.js} +1 -1
- package/dist/assets/Build-BHR9T6UJ.js +40 -0
- package/dist/assets/{Calendars-BrFMMXU3.js → Calendars-GKfsLcqY.js} +1 -1
- package/dist/assets/{CameraGrids-7RfsBtg8.js → CameraGrids-MUUhy0x2.js} +1 -1
- package/dist/assets/{Cluster-qdUn0ZWi.js → Cluster-DxEZYSF0.js} +1 -1
- package/dist/assets/CompositionBlockEditor-BFBeiHR4.js +2 -0
- package/dist/assets/{CompositionEditorPage-BdKITJdB.js → CompositionEditorPage-Dz7XI_eP.js} +1 -1
- package/dist/assets/{Data-Dq99cYIc.js → Data-BaAuEhoW.js} +2 -2
- package/dist/assets/DeviceDetail-C0SC_4iD.js +2 -0
- package/dist/assets/{Devices-B4o5FkKs.js → Devices-Bf4nCnel.js} +1 -1
- package/dist/assets/{EmbedDevicePage-BCz48kwT.js → EmbedDevicePage-C3NGsRrc.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DROVGJUa.js → EmbedPlayerPage-BBY-Sx6F.js} +1 -1
- package/dist/assets/History-DCTkD2C5.js +1 -0
- package/dist/assets/Identity-nbJoxA5E.js +1 -0
- package/dist/assets/InstancesTable-D2eTsMze.js +1 -0
- package/dist/assets/IntegrationDetail-DL_jE7Ho.js +1 -0
- package/dist/assets/IntegrationWizard-BeAKGqkD.js +1 -0
- package/dist/assets/Integrations-B6dYn6fd.js +1 -0
- package/dist/assets/{Integrations-Dx5lzGGq.js → Integrations-Cj6uWWN_.js} +2 -2
- package/dist/assets/{Library-kH7Xd3gC.js → Library-DZE79diS.js} +1 -1
- package/dist/assets/Locations-CqKj6DUZ.js +3 -0
- package/dist/assets/{Logs-BCSHF0Hz.js → Logs-BhqOgQ6e.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-g7yAssct.js → MaskShapeCanvas-LlW1oTr3.js} +1 -1
- package/dist/assets/{MotionZonesSettings-BvqGObrA.js → MotionZonesSettings-Dw3DU6pD.js} +1 -1
- package/dist/assets/{MyAccess-Bfdi856H.js → MyAccess-D-Cz_u-P.js} +1 -1
- package/dist/assets/{Network-CmZhSVsi.js → Network-B1Tex5sO.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-DwqvYEao.js → NodeAddonsSettingsPanel-BaDE0Pex.js} +2 -2
- package/dist/assets/Notifications-DhTbXKSI.js +1 -0
- package/dist/assets/Pipeline-DdOSXsJd.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-C43hww2R.js → PrivacyMaskSettings-DCVqX841.js} +1 -1
- package/dist/assets/Recordings-Clozl5li.js +1 -0
- package/dist/assets/{RemoteGrid-Dv8u1cRv.js → RemoteGrid--NiAHBK3.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-lUmamDRT.js → ScanSubnetEditor-Dp0E5C1_.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-DA76cNih.js → SceneMonitorEditor-Djr3jYA7.js} +1 -1
- package/dist/assets/SessionsList-GT-Vu8fp.js +2 -0
- package/dist/assets/{Showroom-YNNYBt4x.js → Showroom-l4vJyL2_.js} +1 -1
- package/dist/assets/StorageLocationsTable-BnmqVIjs.js +1 -0
- package/dist/assets/System-XHHHEn1g.js +1 -0
- package/dist/assets/{Templates-B6Nl1xgU.js → Templates-DdfynSCT.js} +1 -1
- package/dist/assets/{Terminal-CdDnVDQl.js → Terminal-CSQtVQmE.js} +3 -3
- package/dist/assets/{TrainingProviders-DJ09cRpJ.js → TrainingProviders-De81MhS-.js} +1 -1
- package/dist/assets/{Viewer-UkANt4yY.js → Viewer-FR0LH5M7.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Brm6yYA2.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BBA_NCm-.js} +1 -1
- package/dist/assets/action-draft-BUIf6miK.js +1 -0
- package/dist/assets/{ai-page.helpers-D6ZZMriu.js → ai-page.helpers-CowRsr4f.js} +1 -1
- package/dist/assets/{assignment-candidates-D-v7rj2f.js → assignment-candidates-DNvncHM2.js} +1 -1
- package/dist/assets/{authed-media-CYJ67W1F.js → authed-media-DQUbrVb4.js} +1 -1
- package/dist/assets/{board-model-Bk9dOlXr.js → board-model-YFLbUrn6.js} +1 -1
- package/dist/assets/client-BPycW7-C.js +1115 -0
- package/dist/assets/command-vocab-tdjzfkdy.js +1 -0
- package/dist/assets/create-composition-DLzarGQj.js +1 -0
- package/dist/assets/device-detail-CLGID6OK.js +1 -0
- package/dist/assets/{device-integration-icon-96PtuBb0.js → device-integration-icon-BT-_hxIF.js} +1 -1
- package/dist/assets/device-picker-model-Dp5rCpVe.js +1 -0
- package/dist/assets/{dist-Dur6bHcC.js → dist-BGrtxcme.js} +1 -1
- package/dist/assets/dist-D_CJWYmG.js +1115 -0
- package/dist/assets/{format-BxjElxwq.js → format--HuC16nb.js} +1 -1
- package/dist/assets/{hostInit-BopdhKYk.js → hostInit-3uCgRlGz.js} +1 -1
- package/dist/assets/i18n-DMi5B3uV.js +1 -0
- package/dist/assets/{icons-Djs5qMrO.js → icons-Q-ksrnyT.js} +1 -1
- package/dist/assets/index-CfI8I1jw.css +2 -0
- package/dist/assets/index-D4P9-tQo.js +4 -0
- package/dist/assets/{linked-devices-model-Bb6B3YVg.js → linked-devices-model-JZgr5Mkd.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-207caf94.js → mf-entry-bootstrap-0-01002c42.js} +2 -2
- package/dist/assets/mount-Dp5rCpVe.js +1 -0
- package/dist/assets/{notification-rule-status-DEk79oDE.js → notification-rule-status-DIIXoVdn.js} +1 -1
- package/dist/assets/{player-overlays-DilQz9uf.js → player-overlays-DuVrpJ5X.js} +1 -1
- package/dist/assets/remoteEntry-Cll_F6YF.js +1 -0
- package/dist/assets/src-CDP4x5TP.js +253 -0
- package/dist/assets/{step-inspector-model-Ce7VAyE-.js → step-inspector-model-C76V4MWJ.js} +1 -1
- package/dist/assets/{use-scenes-feed-0Xrve4u9.js → use-scenes-feed-cmZKGNSW.js} +1 -1
- package/dist/assets/{use-stationary-objects-DY7wIMD2.js → use-stationary-objects-BoUGi1JO.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-CPedVydD.js → useAdminDeviceRemoval-DLI0kLAU.js} +1 -1
- package/dist/assets/useEventInvalidation-Dp5rCpVe.js +1 -0
- package/dist/assets/{useNodeUrlSelection-CIiBKiPN.js → useNodeUrlSelection-DMmVYpSE.js} +1 -1
- package/dist/assets/useTemplateSave-j5OtpDNQ.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CMPo2XXm.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-6S8fCuje.js} +2 -2
- package/dist/index.html +8 -8
- package/dist/server/addon.js +536 -347
- package/package.json +2 -2
- package/dist/assets/Addons-DFygon8k.js +0 -5
- package/dist/assets/AdminSectionedPage-CWRY6TXK.js +0 -1
- package/dist/assets/AiProfiles-Ct9zcHWG.js +0 -3
- package/dist/assets/Build-_MNk-gsH.js +0 -40
- package/dist/assets/CompositionBlockEditor-tW-fi9fY.js +0 -2
- package/dist/assets/DeviceDetail-DZKwQsDf.js +0 -2
- package/dist/assets/History-DjSpw_q0.js +0 -1
- package/dist/assets/Identity-DRR4EhOw.js +0 -1
- package/dist/assets/InstancesTable-fZ0yNacw.js +0 -1
- package/dist/assets/IntegrationDetail-BWYrpCeb.js +0 -1
- package/dist/assets/IntegrationWizard-DyIJiQjm.js +0 -1
- package/dist/assets/Integrations-BzdMNme3.js +0 -1
- package/dist/assets/Locations-CPNRVIjp.js +0 -3
- package/dist/assets/Notifications-DA1lIKUt.js +0 -1
- package/dist/assets/Pipeline-r-8l7hZO.js +0 -1
- package/dist/assets/Recordings-B50SML_Q.js +0 -1
- package/dist/assets/SessionsList-CSmzdfK6.js +0 -2
- package/dist/assets/StorageLocationsTable-CIQLMsJC.js +0 -1
- package/dist/assets/System-r539bm4J.js +0 -1
- package/dist/assets/action-draft-B0YtvIK8.js +0 -1
- package/dist/assets/client-CxoliObn.js +0 -1114
- package/dist/assets/command-vocab-Xm353Fi-.js +0 -1
- package/dist/assets/create-composition-BEPdO8PM.js +0 -1
- package/dist/assets/device-detail-DUYt5dz3.js +0 -1
- package/dist/assets/device-picker-model-CIZB_MPl.js +0 -1
- package/dist/assets/dist-_n5SMWsj.js +0 -1114
- package/dist/assets/i18n-C__Kv-sS.js +0 -1
- package/dist/assets/index-SyR6jUqA.css +0 -2
- package/dist/assets/index-hhTXvvOB.js +0 -4
- package/dist/assets/mount-CIZB_MPl.js +0 -1
- package/dist/assets/remoteEntry-PV_ZlxYI.js +0 -1
- package/dist/assets/src-BgJM3bf_.js +0 -252
- package/dist/assets/useEventInvalidation-CIZB_MPl.js +0 -1
- package/dist/assets/useTemplateSave-Cfew9nvB.js +0 -1
|
@@ -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{ka as i}from"./player-overlays-DilQz9uf.js";import{Ar as a,Ca as o,Mr as s,Or as c,Sa as l,Ur as u,Wr as d,jr as f,kr as p,va as m,ya as h}from"./client-CxoliObn.js";import{t as g}from"./grip-vertical-C89CQZwo.js";import{Df as _,nf as ee}from"./src-BgJM3bf_.js";import{t as v}from"./useTranslation-BJr-n0es.js";r();function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=d;function w(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 T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function te(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function ne(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 re(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(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function ie(e,t){if(e.buttons.length>=200)return b(`outside`);let n=re(e);if(n===null)return b(`outside`);let r=O(e,{id:ne(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function oe(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`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 x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ce(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,showLegend:o,...s}=r,c=n.shape===void 0?r.shape:n.shape??void 0,l=n.tone===void 0?r.tone:n.tone??void 0,u=n.showLegend===void 0?r.showLegend:n.showLegend,d={...s,...c===void 0?{}:{shape:c},...l===void 0?{}:{tone:l},...u===!0?{showLegend:u}:{}};return x({...e,buttons:e.buttons.map(e=>e.id===t?d:e)})}function le(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function ue(e,t,n,r){return N(c(e,t,{row:n,col:r}))}function de(e,t,n){return N(p(e,t,{keepButtons:n}))}function fe(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function pe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!pe(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 F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`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 x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=u.safeParse(e);return t.success?t.data:null}function z(e){let t=u.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function me(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 he(e){return m.filter(t=>me(t)===e)}function ge(e){let t=h(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function _e(e){return h(e)!==null&&!l(e)}function ve(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},...e.tone===void 0?{}:{tone:e.tone},...e.showLegend===!0?{showLegend:!0}:{}},n=k(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 V=`"/></svg>`,ye={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+V},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`},be={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+V},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`},xe={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+V},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`},Se={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+V},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`},Ce={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+V},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`},we={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+V},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`},Te={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+V},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`},Ee={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+V},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`},De={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+V},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`},Oe={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+V},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`},ke={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+V},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`},Ae={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+V},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`},je={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+V},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`},Me={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+V},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`},Ne={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+V},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`},Pe=`app:`,H=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),U=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),W=[H(`netflix`,`Netflix`,Te),H(`youtube`,`YouTube`,Me),U(`primevideo`,`Prime Video`,`prime`),U(`disneyplus`,`Disney+`,`D+`),H(`spotify`,`Spotify`,Ae),H(`plex`,`Plex`,Oe),H(`appletv`,`Apple TV`,be),H(`dazn`,`DAZN`,Se),U(`raiplay`,`RaiPlay`,`Rai`),U(`mediasetinfinity`,`Mediaset Infinity`,`MI`),H(`now`,`NOW`,Ee),H(`twitch`,`Twitch`,je),H(`max`,`Max`,we),H(`paramountplus`,`Paramount+`,De),H(`crunchyroll`,`Crunchyroll`,xe),H(`sky`,`Sky`,ke),H(`youtubemusic`,`YouTube Music`,Ne),H(`applemusic`,`Apple Music`,ye),H(`kodi`,`Kodi`,Ce)],Fe=new Map(W.map(e=>[e.key,e]));function Ie(e){return`${Pe}${e}`}function G(e){if(!(e===void 0||!e.startsWith(`app:`)))return Fe.get(e.slice(4))}function Le(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 Re=.011,ze=.91,K=2.2;function q(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Be(e){if(e.kind!==`glyph`)return null;let t=Le(e.hex);return t===null?null:q(t,Re)>=K&&q(t,ze)>=K?`#${e.hex}`:null}function Ve({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=Be(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 He(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function J(e,t){return f(e,He(t))}function Y(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 X(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 Ue(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 We(e){return e===`divider`}function Ge(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 Ke=`2.75rem`,Z=`1.25rem`,qe=`1rem`;function Je(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 Q=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??G(e.icon)?.label??t}function Xe(e){return e.label===void 0||G(e.icon)!==void 0?!1:e.showLegend===!0||e.tone===void 0||!Q.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Q.has(e.tone)))return a(e.role)}function Qe({button:t,compact:r}){let i=_(),a=G(t.icon),o=Ze(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=Xe(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(Ve,{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||t.showLegend===!0)&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:t,selected:r,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=v(),f=We(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:i(`relative -m-0.5 flex`,Ue(t.frame),a&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(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(g,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:r,label:a,selectedId:s=null,onSelect:c,boundRoles:l,showEmptyCells:u=!1,compact:d=!1,gridRef:f,selectedGroupId:p=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null,renderWidget:y}){let{i18n:b}=v(),x=h!==void 0,S=_!==null,C=Je(r),w=P(r),T=[];if(u||S)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(S||!C.has(`${e}:${t}`)&&!w.has(e))&&T.push({row:e,col:t});let E=_?.preview??null;return e(`div`,{role:`group`,"aria-label":a,"data-testid":`remote-grid`,ref:f,className:i(`grid gap-1.5`,d?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...w.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>w.has(t)?qe:d?Z:Ke).join(` `)}},children:[T.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:i(`rounded-md border border-dashed`,S?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n($e,{group:e,selected:e.id===p,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:d,editable:x,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(y!==void 0&&o(e.role))return n(t,{children:y(e,$(e))},e.id);let r=e.id===s,a=l===void 0||l.has(e.role),u=_?.item.kind===`button`&&_.item.id===e.id,f={kind:`button`,id:e.id},p=Ye(e,J(e.role,b.language));return n(ee,{type:`button`,size:`sm`,variant:a?`secondary`:`outline`,"aria-pressed":c===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:i(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,d&&`px-0`,Y(e.shape),X(e.tone),x&&`touch-none`,u&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(e),onClick:c===void 0?void 0:()=>c(e.id),onPointerDown:h===void 0?void 0:e=>h(f,e),onKeyDown:g===void 0?void 0:e=>g(f,e),children:n(Qe,{button:e,compact:d})},e.id)}),E!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":E.valid,className:i(`pointer-events-none z-30 rounded-md border-2 border-dashed`,E.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Ge(r,E.rect))})]})}export{ae as A,oe as C,ce as D,se as E,fe as O,le as S,F as T,he as _,W as a,M as b,B as c,R as d,de as f,_e as g,ge as h,J as i,I as k,ie as l,E as m,Y as n,Ie as o,y as p,X as r,G as s,et as t,ve as u,z as v,L as w,ue as x,te 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{ka as i}from"./player-overlays-DuVrpJ5X.js";import{Cr as a,Er as o,Lr as s,Rr as c,Sr as l,Tr as u,ca as d,da as f,fa as p,sa as m,wr as h}from"./client-BPycW7-C.js";import{t as g}from"./grip-vertical-C89CQZwo.js";import{Of as _,rf as ee}from"./src-CDP4x5TP.js";import{t as v}from"./useTranslation-BJr-n0es.js";r();function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=c;function w(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 T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function te(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function ne(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 re(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(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function ie(e,t){if(e.buttons.length>=200)return b(`outside`);let n=re(e);if(n===null)return b(`outside`);let r=O(e,{id:ne(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function oe(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`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 x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ce(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,showLegend:o,...s}=r,c=n.shape===void 0?r.shape:n.shape??void 0,l=n.tone===void 0?r.tone:n.tone??void 0,u=n.showLegend===void 0?r.showLegend:n.showLegend,d={...s,...c===void 0?{}:{shape:c},...l===void 0?{}:{tone:l},...u===!0?{showLegend:u}:{}};return x({...e,buttons:e.buttons.map(e=>e.id===t?d:e)})}function le(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function ue(e,t,n,r){return N(l(e,t,{row:n,col:r}))}function de(e,t,n){return N(a(e,t,{keepButtons:n}))}function fe(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function pe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!pe(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 F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`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 x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=s.safeParse(e);return t.success?t.data:null}function z(e){let t=s.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function me(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 he(e){return m.filter(t=>me(t)===e)}function ge(e){let t=d(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function _e(e){return d(e)!==null&&!f(e)}function ve(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},...e.tone===void 0?{}:{tone:e.tone},...e.showLegend===!0?{showLegend:!0}:{}},n=k(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 V=`"/></svg>`,ye={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+V},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`},be={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+V},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`},xe={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+V},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`},Se={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+V},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`},Ce={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+V},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`},we={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+V},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`},Te={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+V},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`},Ee={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+V},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`},De={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+V},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`},Oe={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+V},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`},ke={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+V},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`},Ae={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+V},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`},je={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+V},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`},Me={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+V},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`},Ne={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+V},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`},Pe=`app:`,H=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),U=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),W=[H(`netflix`,`Netflix`,Te),H(`youtube`,`YouTube`,Me),U(`primevideo`,`Prime Video`,`prime`),U(`disneyplus`,`Disney+`,`D+`),H(`spotify`,`Spotify`,Ae),H(`plex`,`Plex`,Oe),H(`appletv`,`Apple TV`,be),H(`dazn`,`DAZN`,Se),U(`raiplay`,`RaiPlay`,`Rai`),U(`mediasetinfinity`,`Mediaset Infinity`,`MI`),H(`now`,`NOW`,Ee),H(`twitch`,`Twitch`,je),H(`max`,`Max`,we),H(`paramountplus`,`Paramount+`,De),H(`crunchyroll`,`Crunchyroll`,xe),H(`sky`,`Sky`,ke),H(`youtubemusic`,`YouTube Music`,Ne),H(`applemusic`,`Apple Music`,ye),H(`kodi`,`Kodi`,Ce)],Fe=new Map(W.map(e=>[e.key,e]));function Ie(e){return`${Pe}${e}`}function G(e){if(!(e===void 0||!e.startsWith(`app:`)))return Fe.get(e.slice(4))}function Le(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 Re=.011,ze=.91,K=2.2;function q(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Be(e){if(e.kind!==`glyph`)return null;let t=Le(e.hex);return t===null?null:q(t,Re)>=K&&q(t,ze)>=K?`#${e.hex}`:null}function Ve({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=Be(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 He(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function J(e,t){return u(e,He(t))}function Y(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 X(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 Ue(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 We(e){return e===`divider`}function Ge(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 Ke=`2.75rem`,Z=`1.25rem`,qe=`1rem`;function Je(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 Q=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??G(e.icon)?.label??t}function Xe(e){return e.label===void 0||G(e.icon)!==void 0?!1:e.showLegend===!0||e.tone===void 0||!Q.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Q.has(e.tone)))return h(e.role)}function Qe({button:t,compact:r}){let i=_(),a=G(t.icon),s=Ze(t),c=t.icon===void 0?o(t.role):void 0,l=s===void 0||a!==void 0||c!==void 0?void 0:i(s),u=Xe(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(Ve,{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||t.showLegend===!0)&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:t,selected:r,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=v(),f=We(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:i(`relative -m-0.5 flex`,Ue(t.frame),a&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(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(g,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:r,label:a,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:y}){let{i18n:b}=v(),x=h!==void 0,S=_!==null,C=Je(r),w=P(r),T=[];if(l||S)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(S||!C.has(`${e}:${t}`)&&!w.has(e))&&T.push({row:e,col:t});let E=_?.preview??null;return e(`div`,{role:`group`,"aria-label":a,"data-testid":`remote-grid`,ref:d,className:i(`grid gap-1.5`,u?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...w.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>w.has(t)?qe:u?Z:Ke).join(` `)}},children:[T.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:i(`rounded-md border border-dashed`,S?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n($e,{group:e,selected:e.id===f,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:u,editable:x,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(y!==void 0&&p(e.role))return n(t,{children:y(e,$(e))},e.id);let r=e.id===o,a=c===void 0||c.has(e.role),l=_?.item.kind===`button`&&_.item.id===e.id,d={kind:`button`,id:e.id},f=Ye(e,J(e.role,b.language));return n(ee,{type:`button`,size:`sm`,variant:a?`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:i(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,u&&`px-0`,Y(e.shape),X(e.tone),x&&`touch-none`,l&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(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(Qe,{button:e,compact:u})},e.id)}),E!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":E.valid,className:i(`pointer-events-none z-30 rounded-md border-2 border-dashed`,E.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Ge(r,E.rect))})]})}export{ae as A,oe as C,ce as D,se as E,fe as O,le as S,F as T,he as _,W as a,M as b,B as c,R as d,de as f,_e as g,ge as h,J as i,I as k,ie as l,E as m,Y as n,Ie as o,y as p,X as r,G as s,et as t,ve as u,z as v,L as w,ue as x,te as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,Y 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{V as i,Yn as a}from"./player-overlays-
|
|
1
|
+
import{C as e,S as t,Y 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{V as i,Yn as a}from"./player-overlays-DuVrpJ5X.js";import{a as o}from"./client-BPycW7-C.js";import{$d as s,Cc as c,df as l,mc as u,rf as d}from"./src-CDP4x5TP.js";import{t as f}from"./useTranslation-BJr-n0es.js";function p(e){let t=new Map;for(let n of e)t.set(n.stableId,n);let n=e=>{let n=e.parentStableId;if(n===void 0||n===e.stableId)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.stableId]),a=r;for(;a!==void 0;){if(i.has(a.stableId))return null;i.add(a.stableId),a=a.parentStableId===void 0?void 0:t.get(a.parentStableId)}return r},r=new Map,i=[];for(let t of e){let e=n(t);if(e===null){i.push(t);continue}let a=r.get(e.stableId)??[];a.push(t),r.set(e.stableId,a)}let a=e=>({candidate:e,children:(r.get(e.stableId)??[]).map(a)});return i.map(a)}function m(e){return e.flatMap(e=>[e.candidate,...m(e.children)])}function h(e){return e.setupIntegration===!0||e.prefilledConfig.setupIntegration===!0}function g(e,t,n){let r={};for(let[e,n]of Object.entries(t.prefilledConfig))e!==`setupIntegration`&&(r[e]=typeof n==`string`&&e===`host`?n.trim():n);let i=n?.trim()??``;return{addonId:e,name:i.length>0?o(i):t.suggestedName,config:r,...t.stableId===void 0?{}:{originStableId:t.stableId}}}function _(e,t,n){return h(t)?g(e,t,n):null}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){if(!v(e)||!v(e.integrationSeed))return null;let t=e.integrationSeed,n=t.addonId,r=t.name,i=t.config;if(typeof n!=`string`||n.length===0||typeof r!=`string`||!v(i))return null;let a={};for(let[e,t]of Object.entries(i))a[e]=t;let o=t.originStableId;return{addonId:n,name:r,config:a,...typeof o==`string`&&o.length>0?{originStableId:o}:{}}}r();var b=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/;function x(e){let t=b.exec(e.trim());if(t===null)return{ok:!1,reason:`format`};let n=[t[1],t[2],t[3],t[4]].map(e=>Number(e));if(n.some(e=>e>255))return{ok:!1,reason:`format`};let r=Number(t[5]);return r>32?{ok:!1,reason:`format`}:r<22?{ok:!1,reason:`prefix`}:{ok:!0,cidr:`${n.join(`.`)}/${r}`}}function S(){let{t:r}=f(),o=u(),p=c({onSuccess:()=>void o.refetch()}),[m,h]=n(``),[g,_]=n(null),v=o.data?.subnets??[],y=async e=>{try{return await p.mutateAsync({subnets:[...e]}),!0}catch{return _(r(`integrations.scanNetworkModal.subnets.saveFailed`,`The network list could not be saved.`)),!1}},b=async()=>{let e=x(m);if(!e.ok){_(e.reason===`prefix`?r(`integrations.scanNetworkModal.subnets.errorPrefix`,`A network larger than a /22 cannot be scanned.`):r(`integrations.scanNetworkModal.subnets.errorFormat`,`Enter a network like 192.0.2.0/24.`));return}if(v.includes(e.cidr)){_(r(`integrations.scanNetworkModal.subnets.errorDuplicate`,`Already in the list.`));return}_(null),await y([...v,e.cidr])&&h(``)};return e(`section`,{className:`space-y-2`,"data-testid":`scan-subnets`,children:[t(`h3`,{className:i,children:r(`integrations.scanNetworkModal.subnets.title`,`Extra networks to scan`)}),t(`p`,{className:`text-xs text-foreground-muted`,children:v.length===0?r(`integrations.scanNetworkModal.subnets.none`,`Only this hub's own networks are scanned.`):r(`integrations.scanNetworkModal.subnets.hint`,`Every scan covers this hub's own networks and these.`)}),v.length>0&&t(`div`,{className:`flex flex-wrap gap-1.5`,children:v.map(e=>t(s,{label:e,testId:`scan-subnet-${e}`,onRemove:()=>void y(v.filter(t=>t!==e))},e))}),e(`div`,{className:`flex items-start gap-2`,children:[e(`div`,{className:`min-w-0 flex-1`,children:[t(l,{value:m,onChange:e=>{h(e.target.value),_(null)},onKeyDown:e=>{e.key===`Enter`&&b()},placeholder:`192.0.2.0/24`,state:g===null?`default`:`error`,"aria-label":r(`integrations.scanNetworkModal.subnets.title`,`Extra networks to scan`),"data-testid":`scan-subnet-input`}),g!==null&&t(`p`,{className:`mt-1 text-xs text-danger`,children:g})]}),e(d,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p.isPending||m.trim().length===0,"data-testid":`scan-subnet-add`,children:[t(a,{className:`h-3.5 w-3.5`}),r(`integrations.scanNetworkModal.subnets.add`,`Add network`)]})]})]})}export{g as a,y as i,_ as n,p as o,h as r,m as s,S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Da as l,Fa as u,G as d,Ir as f,J as p,K as m,Ma as h,Oa as g,Q as _,U as v,Yt as y,c as b,ct as x,d as ee,f as S,gt as C,l as te,p as w,qi as ne,s as re,ut as T,z as E,zn as D}from"./player-overlays-DilQz9uf.js";import{t as O}from"./settings-2-BIrKVPOG.js";import{MaskShapeCanvas as ie}from"./MaskShapeCanvas-g7yAssct.js";s();var k=_(`/addon/pipeline-analytics/event-media`);function A(e){return`${k}/m/${e}`}function j(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function M(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var N=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function P({monitor:t,disabled:n,onDelete:r}){let a=u(),o=j(t),s=M(t),c=x();return o.length===0?i(`p`,{className:`${E} leading-relaxed`,children:a(`uiLibrary.sceneReferenceGallery.empty`,`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`)}):i(`div`,{className:`flex flex-col gap-2`,children:o.map(t=>e(`div`,{className:`flex flex-col gap-1`,children:[e(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[w(t.condition,a),` · `,t.tiles.length]}),i(`ul`,{className:`flex flex-wrap gap-1.5`,children:t.tiles.map(o=>{let l=`${o.stateId}:${String(o.index)}`,u=s===1;return e(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[i(F,{reference:o.reference}),i(`span`,{className:`${E} tabular-nums`,children:I(o.reference.capturedAt)}),e(`button`,{type:`button`,className:N,disabled:n,"aria-label":a(`uiLibrary.sceneReferenceGallery.deleteLabel`,`Delete the {{variant}} photograph from {{date}}`,{variant:w(t.condition,a).toLowerCase(),date:I(o.reference.capturedAt)}),onClick:()=>{(async()=>{u&&!await c({title:a(`uiLibrary.sceneReferenceGallery.deleteTitle`,`Delete the only photograph?`),message:a(`uiLibrary.sceneReferenceGallery.lastWarning`,`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`),confirmLabel:a(`uiLibrary.sceneReferenceGallery.delete`,`Delete`),variant:`danger`})||r({stateId:o.stateId,index:o.index})})()},children:[i(y,{className:`mr-1 inline h-3 w-3`}),a(`uiLibrary.sceneReferenceGallery.delete`,`Delete`)]})]},l)})})]},t.condition))})}function F({reference:t}){let n=u(),[r,a]=o(!1),s=t.thumbnailMediaId;return s===void 0||r?e(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:n(`uiLibrary.sceneReferenceGallery.missingPicture`,`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`),children:[i(f,{className:`h-4 w-4`}),i(`span`,{className:`text-[9px]`,children:n(`uiLibrary.sceneReferenceGallery.noPicture`,`no picture`)})]}):i(`img`,{src:A(s),alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>a(!0)})}function I(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}s();var L=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,R=`text-[10px] font-medium text-foreground-subtle`,z=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,B=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,V=5,H=3600;function U(e,t){switch(e){case`periodic`:return t(`uiLibrary.sceneSettingsForm.triggerHintPeriodic`,`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`);case`on-motion`:return t(`uiLibrary.sceneSettingsForm.triggerHintOnMotion`,`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`);case`both`:return t(`uiLibrary.sceneSettingsForm.triggerHintBoth`,`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`)}}function W(e,t){switch(e){case`skip`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintSkip`,`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`);case`judge-anyway`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintJudge`,`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`)}}function G(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function K({monitor:t,disabled:n,onPatch:r}){let s=u(),[d,f]=o(()=>G(t)),[p,m]=o(!1);a(()=>{p||f(G(t))},[t,p]);let _=e=>{m(!1),r(e)},v=e=>t.check.mode===`similarity`?{mode:`similarity`,threshold:e.threshold??t.check.threshold,hysteresisCount:e.hysteresisCount??t.check.hysteresisCount}:{...t.check,hysteresisCount:e.hysteresisCount??t.check.hysteresisCount},y=t.confirm?.enabled===!0,b=t.check.mode===`similarity`?t.check.threshold:null;return e(`div`,{className:`flex flex-col gap-2`,children:[e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.whatItWatches`,`What it watches`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.name`,`Name`)}),i(`input`,{type:`text`,value:d.label,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,label:e.target.value})),onBlur:()=>{let e=d.label.trim();e.length>0&&e!==t.label?_({label:e}):m(!1)}})]}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:t.enabled,disabled:n,onChange:e=>_({enabled:e.target.checked})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.watching`,`Watching`)})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.watchingHint`,`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.whenToLook`,`When to look`)}),e(T,{value:t.triggerMode,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&_({triggerMode:t})},children:[i(`option`,{value:`both`,children:s(`uiLibrary.sceneSettingsForm.triggerBoth`,`On the clock and after motion settles`)}),i(`option`,{value:`periodic`,children:s(`uiLibrary.sceneSettingsForm.triggerPeriodic`,`On the clock only`)}),i(`option`,{value:`on-motion`,children:s(`uiLibrary.sceneSettingsForm.triggerOnMotion`,`After motion settles only`)})]})]}),i(`p`,{className:E,children:U(t.triggerMode,s)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.checkEvery`,`Check every (seconds)`)}),i(`input`,{type:`number`,min:V,max:H,value:d.checkIntervalSec,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.checkIntervalSec,V,H);e===t.checkIntervalSec?m(!1):_({checkIntervalSec:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.intervalHint`,`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.howSure`,`How sure it has to be`)}),t.check.mode===`similarity`&&e(c,{children:[e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:i(h,{uiKey:`uiLibrary.sceneSettingsForm.matchThreshold`,fallback:`Match threshold — <0>{{value}}</0>`,components:[i(`span`,{className:`tabular-nums`},`value`)],values:{value:d.threshold.toFixed(2)}})}),i(g,{min:.3,max:.99,step:.01,value:d.threshold,disabled:n,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{d.threshold===b?m(!1):_({check:v({threshold:d.threshold})})},onBlur:()=>{d.threshold===b?m(!1):_({check:v({threshold:d.threshold})})}})]}),i(`p`,{className:`text-[10px] text-foreground-subtle`,children:s(`uiLibrary.sceneSettingsForm.thresholdHint`,`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`)})]}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.agreeingChecks`,`Agreeing checks before it changes its mind`)}),i(`input`,{type:`number`,min:1,max:10,value:d.hysteresisCount,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let e=q(d.hysteresisCount,1,10);e===t.check.hysteresisCount?m(!1):_({check:v({hysteresisCount:e})})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.agreeingHint`,`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.quietFor`,`Quiet for (seconds) before a check counts`)}),i(`input`,{type:`number`,min:0,max:3600,value:d.quietSeconds,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.quietSeconds,0,3600);e===t.quietSeconds?m(!1):_({quietSeconds:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.quietHint`,`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.minGap`,`Minimum gap between counted checks (seconds)`)}),i(`input`,{type:`number`,min:0,max:3600,value:d.minObservationSpacingSec,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.minObservationSpacingSec,0,3600);e===t.minObservationSpacingSec?m(!1):_({minObservationSpacingSec:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.minGapHint`,`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.lighting`,`Lighting`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.noReference`,`When a light has no reference of its own`)}),e(T,{value:t.onUncoveredCondition,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&_({onUncoveredCondition:t})},children:[i(`option`,{value:`skip`,children:s(`uiLibrary.sceneSettingsForm.uncoveredSkip`,`Skip the check (recommended)`)}),i(`option`,{value:`judge-anyway`,children:s(`uiLibrary.sceneSettingsForm.uncoveredJudge`,`Judge against the other light anyway`)})]})]}),i(`p`,{className:E,children:W(t.onUncoveredCondition,s)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.whatYouGetTold`,`What you get told`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.notificationsFollow`,`Notifications follow`)}),e(T,{value:t.emit,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&_({emit:t})},children:[i(`option`,{value:`latched`,children:s(`uiLibrary.sceneSettingsForm.emitLatched`,`The flag — told once, still visible at breakfast`)}),i(`option`,{value:`live`,children:s(`uiLibrary.sceneSettingsForm.emitLive`,`The live state — follows the region as it changes`)})]})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.emitHint`,`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`)}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:t.autoRestore,disabled:n,onChange:e=>_({autoRestore:e.target.checked})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.autoRestore`,`Clear the flag by itself when things look normal again`)})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.autoRestoreHint`,`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.aiDoubleCheck`,`AI double-check`)}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:y,disabled:n||d.confirmPrompt.trim().length===0,onChange:e=>_(e.target.checked?{confirm:{...J(d.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.askVision`,`Ask a vision model before changing the answer`)})]}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.question`,`The question to ask`)}),i(`input`,{type:`text`,value:d.confirmPrompt,placeholder:s(`uiLibrary.sceneSettingsForm.questionPlaceholder`,`e.g. Is the wheelie bin still there?`),disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let e=d.confirmPrompt.trim();e.length>0&&e!==t.confirm?.prompt?_({confirm:{...J(e),enabled:y}}):m(!1)}})]}),i(`p`,{className:E,children:i(h,{uiKey:`uiLibrary.sceneSettingsForm.confirmHint`,fallback:`The model is asked <0>only</0> when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`,components:[i(`strong`,{},`only`)]})})]})]})}function q(e,t,n){return Math.min(n,Math.max(t,e))}function J(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}s();var Y=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,X=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`,ae=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,oe={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},se=.8,ce=3;function Z({deviceId:s}){let l=u(),f=m(C().trpcClient,s),h=p(f?.state.sceneMonitor),g=d(s,{width:640}),[_,x]=o(null),[T,k]=o(!1),[A,j]=o(null),[M,N]=o(null),[F,I]=o(null),[L,R]=o(null),[z,B]=o(!1),[V,H]=o(null),[U,W]=o(``),G=t(!0);a(()=>(G.current=!0,()=>{G.current=!1}),[]);let q=r(async()=>{if(f)try{let e=await f.sceneMonitor?.listScenes({});if(!G.current)return;e&&x(e)}catch(e){if(!G.current)return;v(e)?k(!0):N(e instanceof Error?e.message:String(e))}},[f]);a(()=>{x(null),k(!1),N(null),q()},[q]);let J=h?.monitors??_?.monitors??[],Z=Date.now(),Q=r(async(e,t)=>{j(e),N(null);try{await t(),await q()}catch(e){G.current&&N(e instanceof Error?e.message:String(e))}finally{G.current&&j(null)}},[q]),le=n(()=>{let e=J.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return V===null?e:[...e,{id:`__draft__`,shape:V,label:l(`uiLibrary.sceneMonitor.newSceneLabel`,`New scene`)}]},[J,V,l]),$=r((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){H(t);return}Q(`roi-${String(e)}`,async()=>f?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[f,Q]),ue=r(e=>{e.kind===`rect`&&H(e)},[]),de=r(async()=>{V===null||U.trim().length===0||(await Q(`create`,async()=>{await f?.sceneMonitor?.createScene({label:U.trim(),roi:V,check:{mode:`similarity`,threshold:se,hysteresisCount:ce}})}),H(null),W(``),B(!1))},[f,V,U,Q]);return f?i(`div`,{className:`flex flex-col gap-3`,children:T?i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.unsupported`,`Scene monitoring is not available for this camera.`)}):e(c,{children:[i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.intro`,`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`)}),i(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:i(ie,{items:le,supportedShapes:[`rect`],selectedId:F??(V===null?null:`__draft__`),onSelect:e=>I(e===null?null:String(e)),onShapeChange:$,onDrawComplete:ue,drawingKind:z&&V===null?`rect`:null,backdrop:g.src===null?null:i(`img`,{src:g.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i(`button`,{type:`button`,className:z?X:Y,"aria-pressed":z,onClick:()=>{B(e=>!e),H(null)},disabled:A!==null,children:z?l(`uiLibrary.sceneMonitor.cancel`,`Cancel`):l(`uiLibrary.sceneMonitor.newScene`,`+ New scene`)}),i(`button`,{type:`button`,className:Y,onClick:g.refresh,disabled:A!==null,children:l(`uiLibrary.sceneMonitor.refresh`,`Refresh frame`)})]}),z&&e(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[i(`p`,{className:`text-[10px] text-foreground-subtle`,children:V===null?l(`uiLibrary.sceneMonitor.draftHint`,`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`):l(`uiLibrary.sceneMonitor.nameHint`,`Name it, then create. You capture what “normal” looks like next.`)}),V!==null&&ee(V)&&i(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:l(`uiLibrary.sceneMonitor.tooLarge`,`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`)}),e(`div`,{className:`flex items-center gap-2`,children:[i(`input`,{type:`text`,value:U,onChange:e=>W(e.target.value),placeholder:l(`uiLibrary.sceneMonitor.placeholder`,`e.g. Immondizia prelevata`),className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),i(`button`,{type:`button`,className:X,onClick:()=>void de(),disabled:V===null||U.trim().length===0||A!==null,children:l(`uiLibrary.sceneMonitor.create`,`Create`)})]})]}),M!==null&&i(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:M}),J.length===0?i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.empty`,`No scenes on this camera yet.`)}):i(`ul`,{className:`flex flex-col gap-2`,children:J.map(t=>{let n=b(t,l);return e(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${F===t.id?`border-primary/50`:`border-border`}`,children:[e(`div`,{className:`flex items-center gap-2`,children:[i(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>I(t.id),children:t.label}),i(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${oe[n.tone]}`,children:n.text})]}),i(`p`,{className:`${E} leading-relaxed`,children:S(t,Z,l)}),i(`p`,{className:`${E} tabular-nums`,children:te(t,l)}),i(P,{monitor:t,disabled:A!==null,onDelete:({stateId:e,index:n})=>void Q(`refdel-${t.id}-${e}-${String(n)}`,async()=>f.sceneMonitor?.deleteReference({monitorId:t.id,stateId:e,index:n}))}),e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[re.map(n=>{let r=n===`ir`;return e(`button`,{type:`button`,className:Y,disabled:A!==null,title:r?l(`uiLibrary.sceneMonitor.optionalTitle`,`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`):l(`uiLibrary.sceneMonitor.captureTitle`,`Take a fresh photo now and store it as the {{variant}} reference`,{variant:w(n,l).toLowerCase()}),onClick:()=>void Q(`cap-${t.id}-${n}`,async()=>f.sceneMonitor?.captureReference({monitorId:t.id,condition:n})),children:[i(ne,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.capture`,`Capture {{variant}}`,{variant:w(n,l).toLowerCase()}),r&&i(`span`,{className:`ml-1 text-foreground-subtle/70`,children:l(`uiLibrary.sceneMonitor.optional`,`(optional)`)})]},n)}),e(`button`,{type:`button`,className:X,disabled:A!==null||t.states.length===0,title:l(`uiLibrary.sceneMonitor.resetTitle`,`Clear the flag and re-photograph what normal looks like right now`),onClick:()=>void Q(`reset-${t.id}`,async()=>f.sceneMonitor?.resetScene({monitorId:t.id})),children:[i(D,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.reset`,`Reset`)]}),i(`button`,{type:`button`,className:Y,disabled:A!==null,onClick:()=>void Q(`check-${t.id}`,async()=>f.sceneMonitor?.recheckNow({monitorId:t.id})),children:l(`uiLibrary.sceneMonitor.checkNow`,`Check now`)}),e(`button`,{type:`button`,className:L===t.id?X:Y,"aria-pressed":L===t.id,"aria-label":l(`uiLibrary.sceneMonitor.settingsFor`,`Settings for {{label}}`,{label:t.label}),disabled:A!==null,onClick:()=>R(e=>e===t.id?null:t.id),children:[i(O,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.settings`,`Settings`)]}),i(`button`,{type:`button`,className:ae,disabled:A!==null,onClick:()=>void Q(`del-${t.id}`,async()=>f.sceneMonitor?.deleteScene({monitorId:t.id})),children:i(y,{className:`h-3 w-3`})})]}),L===t.id&&i(K,{monitor:t,disabled:A!==null,onPatch:e=>void Q(`tune-${t.id}`,async()=>f.sceneMonitor?.updateScene({monitorId:t.id,patch:e}))})]},t.id)})})]})}):null}export{Z as SceneMonitorEditor};
|
|
1
|
+
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Da as l,Fa as u,G as d,Ir as f,J as p,K as m,Ma as h,Oa as g,Q as _,U as v,Yt as y,c as b,ct as x,d as ee,f as S,gt as C,l as te,p as w,qi as ne,s as re,ut as T,z as E,zn as D}from"./player-overlays-DuVrpJ5X.js";import{t as O}from"./settings-2-BIrKVPOG.js";import{MaskShapeCanvas as ie}from"./MaskShapeCanvas-LlW1oTr3.js";s();var k=_(`/addon/pipeline-analytics/event-media`);function A(e){return`${k}/m/${e}`}function j(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function M(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var N=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function P({monitor:t,disabled:n,onDelete:r}){let a=u(),o=j(t),s=M(t),c=x();return o.length===0?i(`p`,{className:`${E} leading-relaxed`,children:a(`uiLibrary.sceneReferenceGallery.empty`,`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`)}):i(`div`,{className:`flex flex-col gap-2`,children:o.map(t=>e(`div`,{className:`flex flex-col gap-1`,children:[e(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[w(t.condition,a),` · `,t.tiles.length]}),i(`ul`,{className:`flex flex-wrap gap-1.5`,children:t.tiles.map(o=>{let l=`${o.stateId}:${String(o.index)}`,u=s===1;return e(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[i(F,{reference:o.reference}),i(`span`,{className:`${E} tabular-nums`,children:I(o.reference.capturedAt)}),e(`button`,{type:`button`,className:N,disabled:n,"aria-label":a(`uiLibrary.sceneReferenceGallery.deleteLabel`,`Delete the {{variant}} photograph from {{date}}`,{variant:w(t.condition,a).toLowerCase(),date:I(o.reference.capturedAt)}),onClick:()=>{(async()=>{u&&!await c({title:a(`uiLibrary.sceneReferenceGallery.deleteTitle`,`Delete the only photograph?`),message:a(`uiLibrary.sceneReferenceGallery.lastWarning`,`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`),confirmLabel:a(`uiLibrary.sceneReferenceGallery.delete`,`Delete`),variant:`danger`})||r({stateId:o.stateId,index:o.index})})()},children:[i(y,{className:`mr-1 inline h-3 w-3`}),a(`uiLibrary.sceneReferenceGallery.delete`,`Delete`)]})]},l)})})]},t.condition))})}function F({reference:t}){let n=u(),[r,a]=o(!1),s=t.thumbnailMediaId;return s===void 0||r?e(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:n(`uiLibrary.sceneReferenceGallery.missingPicture`,`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`),children:[i(f,{className:`h-4 w-4`}),i(`span`,{className:`text-[9px]`,children:n(`uiLibrary.sceneReferenceGallery.noPicture`,`no picture`)})]}):i(`img`,{src:A(s),alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>a(!0)})}function I(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}s();var L=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,R=`text-[10px] font-medium text-foreground-subtle`,z=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,B=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,V=5,H=3600;function U(e,t){switch(e){case`periodic`:return t(`uiLibrary.sceneSettingsForm.triggerHintPeriodic`,`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`);case`on-motion`:return t(`uiLibrary.sceneSettingsForm.triggerHintOnMotion`,`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`);case`both`:return t(`uiLibrary.sceneSettingsForm.triggerHintBoth`,`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`)}}function W(e,t){switch(e){case`skip`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintSkip`,`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`);case`judge-anyway`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintJudge`,`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`)}}function G(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function K({monitor:t,disabled:n,onPatch:r}){let s=u(),[d,f]=o(()=>G(t)),[p,m]=o(!1);a(()=>{p||f(G(t))},[t,p]);let _=e=>{m(!1),r(e)},v=e=>t.check.mode===`similarity`?{mode:`similarity`,threshold:e.threshold??t.check.threshold,hysteresisCount:e.hysteresisCount??t.check.hysteresisCount}:{...t.check,hysteresisCount:e.hysteresisCount??t.check.hysteresisCount},y=t.confirm?.enabled===!0,b=t.check.mode===`similarity`?t.check.threshold:null;return e(`div`,{className:`flex flex-col gap-2`,children:[e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.whatItWatches`,`What it watches`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.name`,`Name`)}),i(`input`,{type:`text`,value:d.label,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,label:e.target.value})),onBlur:()=>{let e=d.label.trim();e.length>0&&e!==t.label?_({label:e}):m(!1)}})]}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:t.enabled,disabled:n,onChange:e=>_({enabled:e.target.checked})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.watching`,`Watching`)})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.watchingHint`,`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.whenToLook`,`When to look`)}),e(T,{value:t.triggerMode,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&_({triggerMode:t})},children:[i(`option`,{value:`both`,children:s(`uiLibrary.sceneSettingsForm.triggerBoth`,`On the clock and after motion settles`)}),i(`option`,{value:`periodic`,children:s(`uiLibrary.sceneSettingsForm.triggerPeriodic`,`On the clock only`)}),i(`option`,{value:`on-motion`,children:s(`uiLibrary.sceneSettingsForm.triggerOnMotion`,`After motion settles only`)})]})]}),i(`p`,{className:E,children:U(t.triggerMode,s)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.checkEvery`,`Check every (seconds)`)}),i(`input`,{type:`number`,min:V,max:H,value:d.checkIntervalSec,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.checkIntervalSec,V,H);e===t.checkIntervalSec?m(!1):_({checkIntervalSec:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.intervalHint`,`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.howSure`,`How sure it has to be`)}),t.check.mode===`similarity`&&e(c,{children:[e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:i(h,{uiKey:`uiLibrary.sceneSettingsForm.matchThreshold`,fallback:`Match threshold — <0>{{value}}</0>`,components:[i(`span`,{className:`tabular-nums`},`value`)],values:{value:d.threshold.toFixed(2)}})}),i(g,{min:.3,max:.99,step:.01,value:d.threshold,disabled:n,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{d.threshold===b?m(!1):_({check:v({threshold:d.threshold})})},onBlur:()=>{d.threshold===b?m(!1):_({check:v({threshold:d.threshold})})}})]}),i(`p`,{className:`text-[10px] text-foreground-subtle`,children:s(`uiLibrary.sceneSettingsForm.thresholdHint`,`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`)})]}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.agreeingChecks`,`Agreeing checks before it changes its mind`)}),i(`input`,{type:`number`,min:1,max:10,value:d.hysteresisCount,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let e=q(d.hysteresisCount,1,10);e===t.check.hysteresisCount?m(!1):_({check:v({hysteresisCount:e})})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.agreeingHint`,`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.quietFor`,`Quiet for (seconds) before a check counts`)}),i(`input`,{type:`number`,min:0,max:3600,value:d.quietSeconds,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.quietSeconds,0,3600);e===t.quietSeconds?m(!1):_({quietSeconds:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.quietHint`,`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.minGap`,`Minimum gap between counted checks (seconds)`)}),i(`input`,{type:`number`,min:0,max:3600,value:d.minObservationSpacingSec,disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let e=q(d.minObservationSpacingSec,0,3600);e===t.minObservationSpacingSec?m(!1):_({minObservationSpacingSec:e})}})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.minGapHint`,`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.lighting`,`Lighting`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.noReference`,`When a light has no reference of its own`)}),e(T,{value:t.onUncoveredCondition,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&_({onUncoveredCondition:t})},children:[i(`option`,{value:`skip`,children:s(`uiLibrary.sceneSettingsForm.uncoveredSkip`,`Skip the check (recommended)`)}),i(`option`,{value:`judge-anyway`,children:s(`uiLibrary.sceneSettingsForm.uncoveredJudge`,`Judge against the other light anyway`)})]})]}),i(`p`,{className:E,children:W(t.onUncoveredCondition,s)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.whatYouGetTold`,`What you get told`)}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.notificationsFollow`,`Notifications follow`)}),e(T,{value:t.emit,disabled:n,className:L,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&_({emit:t})},children:[i(`option`,{value:`latched`,children:s(`uiLibrary.sceneSettingsForm.emitLatched`,`The flag — told once, still visible at breakfast`)}),i(`option`,{value:`live`,children:s(`uiLibrary.sceneSettingsForm.emitLive`,`The live state — follows the region as it changes`)})]})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.emitHint`,`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`)}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:t.autoRestore,disabled:n,onChange:e=>_({autoRestore:e.target.checked})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.autoRestore`,`Clear the flag by itself when things look normal again`)})]}),i(`p`,{className:E,children:s(`uiLibrary.sceneSettingsForm.autoRestoreHint`,`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`)})]}),e(`div`,{className:z,children:[i(`p`,{className:B,children:s(`uiLibrary.sceneSettingsForm.aiDoubleCheck`,`AI double-check`)}),e(`label`,{className:`flex items-center gap-2`,children:[i(l,{checked:y,disabled:n||d.confirmPrompt.trim().length===0,onChange:e=>_(e.target.checked?{confirm:{...J(d.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.askVision`,`Ask a vision model before changing the answer`)})]}),e(`label`,{className:`flex flex-col gap-1`,children:[i(`span`,{className:R,children:s(`uiLibrary.sceneSettingsForm.question`,`The question to ask`)}),i(`input`,{type:`text`,value:d.confirmPrompt,placeholder:s(`uiLibrary.sceneSettingsForm.questionPlaceholder`,`e.g. Is the wheelie bin still there?`),disabled:n,className:L,onFocus:()=>m(!0),onChange:e=>f(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let e=d.confirmPrompt.trim();e.length>0&&e!==t.confirm?.prompt?_({confirm:{...J(e),enabled:y}}):m(!1)}})]}),i(`p`,{className:E,children:i(h,{uiKey:`uiLibrary.sceneSettingsForm.confirmHint`,fallback:`The model is asked <0>only</0> when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`,components:[i(`strong`,{},`only`)]})})]})]})}function q(e,t,n){return Math.min(n,Math.max(t,e))}function J(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}s();var Y=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,X=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`,ae=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,oe={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},se=.8,ce=3;function Z({deviceId:s}){let l=u(),f=m(C().trpcClient,s),h=p(f?.state.sceneMonitor),g=d(s,{width:640}),[_,x]=o(null),[T,k]=o(!1),[A,j]=o(null),[M,N]=o(null),[F,I]=o(null),[L,R]=o(null),[z,B]=o(!1),[V,H]=o(null),[U,W]=o(``),G=t(!0);a(()=>(G.current=!0,()=>{G.current=!1}),[]);let q=r(async()=>{if(f)try{let e=await f.sceneMonitor?.listScenes({});if(!G.current)return;e&&x(e)}catch(e){if(!G.current)return;v(e)?k(!0):N(e instanceof Error?e.message:String(e))}},[f]);a(()=>{x(null),k(!1),N(null),q()},[q]);let J=h?.monitors??_?.monitors??[],Z=Date.now(),Q=r(async(e,t)=>{j(e),N(null);try{await t(),await q()}catch(e){G.current&&N(e instanceof Error?e.message:String(e))}finally{G.current&&j(null)}},[q]),le=n(()=>{let e=J.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return V===null?e:[...e,{id:`__draft__`,shape:V,label:l(`uiLibrary.sceneMonitor.newSceneLabel`,`New scene`)}]},[J,V,l]),$=r((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){H(t);return}Q(`roi-${String(e)}`,async()=>f?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[f,Q]),ue=r(e=>{e.kind===`rect`&&H(e)},[]),de=r(async()=>{V===null||U.trim().length===0||(await Q(`create`,async()=>{await f?.sceneMonitor?.createScene({label:U.trim(),roi:V,check:{mode:`similarity`,threshold:se,hysteresisCount:ce}})}),H(null),W(``),B(!1))},[f,V,U,Q]);return f?i(`div`,{className:`flex flex-col gap-3`,children:T?i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.unsupported`,`Scene monitoring is not available for this camera.`)}):e(c,{children:[i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.intro`,`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`)}),i(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:i(ie,{items:le,supportedShapes:[`rect`],selectedId:F??(V===null?null:`__draft__`),onSelect:e=>I(e===null?null:String(e)),onShapeChange:$,onDrawComplete:ue,drawingKind:z&&V===null?`rect`:null,backdrop:g.src===null?null:i(`img`,{src:g.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i(`button`,{type:`button`,className:z?X:Y,"aria-pressed":z,onClick:()=>{B(e=>!e),H(null)},disabled:A!==null,children:z?l(`uiLibrary.sceneMonitor.cancel`,`Cancel`):l(`uiLibrary.sceneMonitor.newScene`,`+ New scene`)}),i(`button`,{type:`button`,className:Y,onClick:g.refresh,disabled:A!==null,children:l(`uiLibrary.sceneMonitor.refresh`,`Refresh frame`)})]}),z&&e(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[i(`p`,{className:`text-[10px] text-foreground-subtle`,children:V===null?l(`uiLibrary.sceneMonitor.draftHint`,`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`):l(`uiLibrary.sceneMonitor.nameHint`,`Name it, then create. You capture what “normal” looks like next.`)}),V!==null&&ee(V)&&i(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:l(`uiLibrary.sceneMonitor.tooLarge`,`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`)}),e(`div`,{className:`flex items-center gap-2`,children:[i(`input`,{type:`text`,value:U,onChange:e=>W(e.target.value),placeholder:l(`uiLibrary.sceneMonitor.placeholder`,`e.g. Immondizia prelevata`),className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),i(`button`,{type:`button`,className:X,onClick:()=>void de(),disabled:V===null||U.trim().length===0||A!==null,children:l(`uiLibrary.sceneMonitor.create`,`Create`)})]})]}),M!==null&&i(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:M}),J.length===0?i(`p`,{className:`${E} leading-relaxed`,children:l(`uiLibrary.sceneMonitor.empty`,`No scenes on this camera yet.`)}):i(`ul`,{className:`flex flex-col gap-2`,children:J.map(t=>{let n=b(t,l);return e(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${F===t.id?`border-primary/50`:`border-border`}`,children:[e(`div`,{className:`flex items-center gap-2`,children:[i(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>I(t.id),children:t.label}),i(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${oe[n.tone]}`,children:n.text})]}),i(`p`,{className:`${E} leading-relaxed`,children:S(t,Z,l)}),i(`p`,{className:`${E} tabular-nums`,children:te(t,l)}),i(P,{monitor:t,disabled:A!==null,onDelete:({stateId:e,index:n})=>void Q(`refdel-${t.id}-${e}-${String(n)}`,async()=>f.sceneMonitor?.deleteReference({monitorId:t.id,stateId:e,index:n}))}),e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[re.map(n=>{let r=n===`ir`;return e(`button`,{type:`button`,className:Y,disabled:A!==null,title:r?l(`uiLibrary.sceneMonitor.optionalTitle`,`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`):l(`uiLibrary.sceneMonitor.captureTitle`,`Take a fresh photo now and store it as the {{variant}} reference`,{variant:w(n,l).toLowerCase()}),onClick:()=>void Q(`cap-${t.id}-${n}`,async()=>f.sceneMonitor?.captureReference({monitorId:t.id,condition:n})),children:[i(ne,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.capture`,`Capture {{variant}}`,{variant:w(n,l).toLowerCase()}),r&&i(`span`,{className:`ml-1 text-foreground-subtle/70`,children:l(`uiLibrary.sceneMonitor.optional`,`(optional)`)})]},n)}),e(`button`,{type:`button`,className:X,disabled:A!==null||t.states.length===0,title:l(`uiLibrary.sceneMonitor.resetTitle`,`Clear the flag and re-photograph what normal looks like right now`),onClick:()=>void Q(`reset-${t.id}`,async()=>f.sceneMonitor?.resetScene({monitorId:t.id})),children:[i(D,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.reset`,`Reset`)]}),i(`button`,{type:`button`,className:Y,disabled:A!==null,onClick:()=>void Q(`check-${t.id}`,async()=>f.sceneMonitor?.recheckNow({monitorId:t.id})),children:l(`uiLibrary.sceneMonitor.checkNow`,`Check now`)}),e(`button`,{type:`button`,className:L===t.id?X:Y,"aria-pressed":L===t.id,"aria-label":l(`uiLibrary.sceneMonitor.settingsFor`,`Settings for {{label}}`,{label:t.label}),disabled:A!==null,onClick:()=>R(e=>e===t.id?null:t.id),children:[i(O,{className:`mr-1 inline h-3 w-3`}),l(`uiLibrary.sceneMonitor.settings`,`Settings`)]}),i(`button`,{type:`button`,className:ae,disabled:A!==null,onClick:()=>void Q(`del-${t.id}`,async()=>f.sceneMonitor?.deleteScene({monitorId:t.id})),children:i(y,{className:`h-3 w-3`})})]}),L===t.id&&i(K,{monitor:t,disabled:A!==null,onPatch:e=>void Q(`tune-${t.id}`,async()=>f.sceneMonitor?.updateScene({monitorId:t.id,patch:e}))})]},t.id)})})]})}):null}export{Z as SceneMonitorEditor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,et as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{D as o,Da as s,Dn as c,En as l,Er as u,Fa as d,Mi as f,St as p,Yt as m,ct as h,ka as g,lt as _,ni as v,ut as y}from"./player-overlays-DuVrpJ5X.js";import{us as b}from"./client-BPycW7-C.js";import{a as x,d as S,o as C,s as w}from"./video-De6y5yax.js";import{$ as ee,$r as te,Fn as T,Gd as E,Gn as D,Gr as O,Hf as k,Id as A,In as j,J as M,Jr as N,Kn as P,Kr as F,Ln as I,Mi as L,Q as ne,Qr as R,Ro as z,Un as B,Wr as V,Xr as H,Yr as U,df as re,ff as W,lr as ie,q as ae,qd as G,rf as K,sr as oe,ur as se,ut as ce,vr as q}from"./src-CDP4x5TP.js";import{t as J}from"./i18n-DMi5B3uV.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import{I as le,Kr as ue,n as de}from"./index-D4P9-tQo.js";a();function X({id:t,title:r,icon:i,description:a,actions:s,tone:c=`default`,notice:l=null,onDismissNotice:u,children:d}){return n(B,{headingId:`access-${t}`,title:r,icon:i,actions:s,testId:`access-${t}`,children:e(`div`,{className:`${o} space-y-3`,children:[n(`div`,{className:g(`text-[11px] leading-relaxed`,c===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:a}),l!==null&&n(Z,{notice:l,onDismiss:u}),d]})})}var fe={success:{icon:f,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:x,line:`border-danger/40 text-danger`,mark:`text-danger`}};function Z({notice:t,onDismiss:r}){let{t:i}=Y(),a=fe[t.tone],o=a.icon;return e(`div`,{role:t.tone===`danger`?`alert`:`status`,className:g(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,a.line),children:[n(o,{className:g(`mt-0.5 h-3.5 w-3.5 shrink-0`,a.mark),"aria-hidden":!0}),n(`span`,{className:`min-w-0 flex-1`,children:t.message}),r!==void 0&&n(W,{type:`button`,variant:`ghost`,size:`sm`,icon:p,"aria-label":i(`access.accessSection.dismiss`,`Dismiss`),onClick:r,className:`-my-1 h-5 w-5`})]})}function pe(){let{data:e}=A();return t(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function me(e,t=null){return e===null?t:{tone:`danger`,message:e}}var he={active:`access.credentialColumns.statusActive`,expired:`access.credentialColumns.statusExpired`,revoked:`access.credentialColumns.statusRevoked`,current:`access.credentialColumns.statusCurrent`};function ge(e){return J.t(he[e])}var _e={active:`success`,expired:`warning`,revoked:`default`,current:`info`},ve={current:0,active:1,expired:2,revoked:3};function ye(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function be({status:e}){return n(G,{variant:_e[e],className:`text-[10px]`,children:ge(e)})}function xe({row:t,action:r}){if(!r.isAvailable(t))return null;let i=r.icon,a=r.busyId===t.id;return e(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r.onRun(t),disabled:r.disabled,"aria-label":J.t(`access.credentialColumns.actionOn`,{action:r.label,name:t.name}),className:r.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[a?n(u,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(i,{className:`h-3 w-3`,"aria-hidden":!0}),r.label]})}function Se(t){return[{key:`name`,header:J.t(`access.credentialColumns.name`,`Name`),sortValue:e=>e.name.toLowerCase(),render:t=>e(`div`,{className:`min-w-0 max-w-[18rem]`,children:[n(`div`,{className:`truncate font-medium text-foreground`,title:t.name,children:t.name}),t.detail!==null&&n(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:t.detail,children:t.detail})]})},t.hideOwner?null:{key:`owner`,header:J.t(`access.credentialColumns.owner`,`Owner`),sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:J.t(`access.credentialColumns.kindScope`,`Kind / scope`),sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:t=>e(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[n(`div`,{className:`text-foreground`,children:t.kind}),t.scope!==null&&n(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:t.scope,children:t.scope})]})},{key:`status`,header:J.t(`access.credentialColumns.status`,`Status`),sortValue:e=>ve[e.status],render:e=>n(be,{status:e.status})},{key:`created`,header:J.t(`access.credentialColumns.created`,`Created`),sortValue:e=>e.createdAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ye(e.createdAt,`—`)})},{key:`lastUsed`,header:J.t(`access.credentialColumns.lastUsed`,`Last used`),sortValue:e=>e.lastUsedAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ye(e.lastUsedAt,J.t(`access.credentialColumns.never`))})},{key:`expires`,header:J.t(`access.credentialColumns.expires`,`Expires`),sortValue:e=>e.expiresAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ye(e.expiresAt,t.expiresNone)})},t.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:J.t(`access.credentialColumns.actionsHeader`),render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[...t.extraActions??[],t.action].map(t=>t===null?null:n(xe,{row:e,action:t},t.label))})}].filter(e=>e!==null)}a();var Ce=6,we={"current-session":`access.bulk.skipCurrentSession`,"not-active":`access.bulk.skipNotActive`};function Te(e){let t=we[e];return t===void 0?e:J.t(t)}function Ee(e,t){return J.t(t.key,{count:e})}function Q(e,t){return J.t(`access.bulk.countOf`,{count:e,noun:Ee(e,t)})}function De(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>J.t(`access.bulk.statusCount`,{count:t,status:ge(e).toLowerCase()})).join(`, `)}function Oe(e,t){let n=e.slice(0,Ce).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>Ce?[J.t(`access.bulk.previewMore`,{count:e.length-Ce})]:[];return[J.t(`access.bulk.previewIntro`,{what:Q(e.length,t),breakdown:De(e)}),``,...n,...r].join(`
|
|
2
|
+
`)}async function ke(e,t,n){let r=String(t.length),i=await e({title:J.t(`access.bulk.confirmTitle`,{what:Q(t.length,n)}),message:Oe(t,n),label:J.t(`access.bulk.confirmLabel`,{expected:r}),placeholder:r,confirmLabel:J.t(`access.bulk.confirmButton`,{expected:r}),variant:`danger`,validate:e=>e.trim()===r?null:J.t(`access.bulk.confirmMismatch`,{expected:r,noun:Ee(2,n)})});return i!==null&&i.trim()===r}function Ae(e,t){let n=_(),r=k.auth.revokeCredentials.useMutation(),[a,o]=i(null);return{run:async i=>{if(i.length===0||!await ke(n,i,e))return!1;o(null);try{let t=await r.mutateAsync({ids:i.map(e=>e.id),confirmCount:i.length}),n=t.skipped.map(e=>Te(e.reason));return o({tone:`success`,message:n.length>0?J.t(`access.bulk.revokedSkipped`,{what:Q(t.revoked.length,e),count:n.length,reasons:[...new Set(n)].join(`, `)}):J.t(`access.bulk.revoked`,{what:Q(t.revoked.length,e)})}),!0}catch(e){return o({tone:`danger`,message:J.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:J.t(`access.bulk.requestFailed`)})}),!1}finally{t()}},busy:r.isPending,outcome:a,dismiss:()=>o(null)}}function je(e,t,n){let r=_(),[a,o]=i(!1),[s,c]=i(null);return{run:async i=>{if(i.length===0||!await ke(r,i,e))return!1;c(null),o(!0);let a=[],s=0;for(let e of i)try{await t(e.id),s+=1}catch(t){a.push(`${e.name}: ${t instanceof Error?t.message:J.t(`access.bulk.requestFailed`)}`)}return o(!1),n(),a.length===0?(c({tone:`success`,message:J.t(`access.bulk.revoked`,{what:Q(s,e)})}),!0):(c({tone:`danger`,message:J.t(a.length>3?`access.bulk.eachPartialMore`:`access.bulk.eachPartial`,{what:Q(s,e),count:a.length,details:a.slice(0,3).join(`; `)})}),s>0)},busy:a,outcome:s,dismiss:()=>c(null)}}a();var Me={searchText:e=>[e.name,e.detail??``,e.ownerName,e.kind,e.scope??``],facetGroups:[{id:`status`,value:e=>e.status},{id:`owner`,value:e=>e.ownerName},{id:`kind`,value:e=>e.kind}]},Ne={status:`access.credentialTable.groupStatus`,owner:`access.credentialTable.groupOwner`,kind:`access.credentialTable.groupKind`},Pe=e=>e.status!==`current`,Fe=[`active`,`current`];function Ie({rows:r,label:a,isLoading:o,loadError:s,emptyText:c,hideOwner:l=!1,expiresNone:d,action:f,extraActions:p,bulk:m,defaultStatus:h=Fe}){let{t:g}=Y(),[_]=i(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),v=T(r,Me,_),[y,b]=i(()=>new Set),x=d??g(`access.credentialColumns.never`),S=t(()=>Se({hideOwner:l,expiresNone:x,action:f??null,...p===void 0?{}:{extraActions:p}}),[l,x,f,p,g]),C=t(()=>m===void 0?()=>!1:e=>Pe(e)&&m.isSelectable(e),[m]),w=t(()=>v.rows.filter(e=>y.has(e.id)&&C(e)),[v.rows,y,C]);return o?e(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[n(u,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),g(`access.credentialTable.loading`,{label:a})]}):s===null?e(`div`,{className:`space-y-3`,children:[n(j,{state:v.state,facets:v.facets,groups:v.groups.filter(e=>!(l&&e.id===`owner`)).map(e=>({...e,label:Ne[e.id]===void 0?e.id:g(Ne[e.id]),...e.id===`status`?{facetLabel:e=>ge(e)}:{}})),labels:{searchPlaceholder:g(`access.credentialTable.searchPlaceholder`,{label:a}),searchLabel:g(`access.credentialTable.searchLabel`,{label:a}),facetsLabel:g(`access.credentialTable.facetsLabel`,{label:a}),clearLabel:g(`access.credentialTable.clearFilters`)},onSearch:v.setSearch,onToggleFacet:v.toggleFacet,onToggleGroupFacet:v.toggleGroupFacet,onClear:v.clear}),m!==void 0&&n(Le,{bulk:m,shown:v.rows.filter(C),targets:w,onSelect:b}),n(D,{columns:S,rows:v.rows,rowKey:e=>e.id,minWidthPx:l?760:860,maxBodyHeight:P,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:g(`access.credentialTable.pagesLabel`,{label:a}),previous:g(`access.credentialTable.previousPage`),next:g(`access.credentialTable.nextPage`),range:(e,t,n)=>g(`access.credentialTable.range`,{from:e,to:t,total:n})},emptyMessage:v.active?g(`access.credentialTable.noMatchTheFilters`,`No {{label}} match the filters.`,{label:a}):c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...m===void 0?{}:{selection:{selected:y,onChange:b,isSelectable:C,rowLabel:e=>g(`access.credentialTable.rowLabel`,{name:e.name,owner:e.ownerName}),pageLabel:g(`access.credentialTable.pageLabel`,{noun:Ee(1,m.noun)})}}})]}):n(E,{title:g(`access.credentialTable.couldNotLoad`,`Could not load {{label}}`,{label:a}),message:s})}function Le({bulk:t,shown:r,targets:i,onSelect:a}){let{t:o}=Y(),{revoke:s,noun:c}=t,l=(t.quickSelect??[]).map(e=>({...e,rows:r.filter(e.match)})).filter(e=>e.rows.length>0),d=async()=>{await s.run(i)&&a(new Set)};return e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[r.length>0&&n(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(r.map(e=>e.id))),children:o(`access.credentialTable.selectAllShown`,{count:r.length})}),l.map(t=>e(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(t.rows.map(e=>e.id))),children:[t.label,` (`,String(t.rows.length),`)`]},t.label)),i.length>0&&e(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[n(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:o(`access.credentialTable.selectedLabel`,{what:Q(i.length,c)})}),e(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(new Set),children:[n(p,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.clearSelection`,`Clear selection`)]}),e(K,{type:`button`,variant:`danger`,size:`sm`,disabled:s.busy,onClick:()=>void d(),children:[s.busy?n(u,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(m,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.revoke`,{what:Q(i.length,c)})]})]})]})}var Re=(e,t)=>t===null?`—`:e.get(t)??t;function ze(e,t){return e!=null&&e<=t?`expired`:`active`}function Be(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:Re(t,e.userId),kind:n.method(e.method),scope:null,status:e.current?`current`:`active`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Ve(e,t){return{id:e.id,name:e.integrationId,detail:null,ownerId:e.userId,ownerName:e.username,kind:e.integrationId,scope:t,status:e.revokedAt===null?`active`:`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:null}}var He=`All permissions`,Ue=`View link`,We=`Scoped`,Ge={"grid-view":`Grid`,"events-view":`Events`};function Ke(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function qe(e){return e!==`*`&&e.type===`share-view`&&`grant`in e}function Je(e,t,n){return e===`*`?He:qe(e)?`${`${Ge[e.grant.kind]} view${e.grant.talk===!0?` + talk`:``}`}: ${Ke(e.grant.deviceIds,t)}`:n(e)}function Ye(e){return e.includes(`*`)?He:e.some(qe)?Ue:We}function Xe(e,t,n,r){return{id:e.id,name:e.label,detail:null,ownerId:e.subjectId,ownerName:Re(t,e.subjectId),kind:Ye(e.scopes),scope:n,status:e.revokedAt===null?ze(e.expiresAt,r):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Ze(e){return`${e.provider}\u0000${e.subject}`}function Qe(e,t){return{id:Ze(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:Re(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}var $e=40,et=[{test:/Electron\//,name:`CamStack desktop`},{test:/Edg(e|A|iOS)?\//,name:`Edge`},{test:/OPR\/|Opera/,name:`Opera`},{test:/Firefox\/|FxiOS\//,name:`Firefox`},{test:/Chrome\/|CriOS\//,name:`Chrome`},{test:/Version\/[\d.]+.*Safari\//,name:`Safari`}],tt=[{test:/iPhone/,name:`iPhone`},{test:/iPad/,name:`iPad`},{test:/Android/,name:`Android`},{test:/Mac OS X|Macintosh/,name:`macOS`},{test:/Windows/,name:`Windows`},{test:/CrOS/,name:`ChromeOS`},{test:/Linux/,name:`Linux`}],nt=[{test:/CFNetwork\/.*Darwin\//,name:`CamStack app on iOS`},{test:/^okhttp\//i,name:`CamStack app on Android`},{test:/^(node|undici)\b/i,name:`Script (Node.js)`},{test:/^curl\//i,name:`curl`}];function rt(e,t){return e.find(e=>e.test.test(t))?.name??null}function it(e){return e.length<=$e?e:`${e.slice(0,$e)}…`}function at(e){if(e===null||e.trim().length===0)return{label:J.t(`helpers.sessionClient.unknownDevice`),raw:null};let t=e.trim(),n=rt(nt,t);if(n!==null)return{label:n,raw:t};let r=rt(et,t),i=rt(tt,t);return r!==null&&i!==null?{label:J.t(`helpers.sessionClient.browserOnSystem`,{browser:r,system:i}),raw:t}:r===null?{label:it(t),raw:t}:{label:r,raw:t}}var ot={password:`helpers.sessionClient.method.password`,passkey:`helpers.sessionClient.method.passkey`,sso:`helpers.sessionClient.method.sso`,handoff:`helpers.sessionClient.method.handoff`,"cli-approval":`helpers.sessionClient.method.cliApproval`,exchange:`helpers.sessionClient.method.exchange`};function st(e){let t=ot[e];return t===void 0?e:J.t(t)}function ct(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}function lt({token:t,label:r,onClose:i}){let{t:a}=Y();return n(V,{open:!0,onOpenChange:e=>!e&&i(),children:e(F,{width:`md`,scroll:`body`,children:[n(U,{children:n(H,{children:a(`auth.tokenModals.token`,`Token: {{label}}`,{label:r})})}),e(O,{className:`space-y-3`,children:[n(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning`,children:a(`auth.tokenModals.copyThisTokenNowOnce`,`Copy this token now. Once you close this dialog the secret cannot be displayed again.`)}),n(`div`,{className:`select-all break-all rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t})]}),e(N,{children:[n(I,{value:t,label:a(`common.copy`,`Copy`),srLabel:`token`}),n(K,{type:`button`,variant:`primary`,size:`sm`,onClick:i,children:a(`auth.tokenModals.done`,`Done`)})]})]})})}var ut={token:`newToken`,scoped:`newScoped`,admin:`newAdmin`};a();var dt=80,$=86400,ft=[{value:`1`,seconds:$},{value:`7`,seconds:7*$},{value:`30`,seconds:30*$},{value:`90`,seconds:90*$},{value:`never`,seconds:`never`}],pt=[b.Camera],mt=64,ht={type:`capability`,target:``,access:[`view`,`create`]};function gt({open:a,users:o,onClose:f,onSubmit:p,submitting:m,formError:h,awaitingProof:g}){let{t:_}=Y(),b=d(),{user:x}=le(),C=x?.isAdmin===!0,w=C?null:x?.scopes??[],[T,E]=i(`scopes`),[D,O]=i(x?.id??``),[k,A]=i(``),[j,N]=i([ht]),[P,F]=i([]),[I,ne]=i(`grid-view`),[z,B]=i(!1),[V,H]=i(`30`);r(()=>{a||(E(`scopes`),O(x?.id??``),A(``),N([ht]),F([]),ne(`grid-view`),B(!1),H(`30`))},[a,x?.id]),r(()=>{T!==`view-link`&&V===`never`&&H(`30`)},[T,V]);let U=t(()=>ft.filter(e=>e.seconds!==`never`||T===`view-link`).map(e=>({value:e.value,label:e.seconds===`never`?_(`access.createTokenModal.never`,`Never (until revoked)`):_(`access.createTokenModal.days`,{count:Number(e.value)})})),[T,_]),W=k.trim(),G=T===`scopes`?M(j,b):null,ce=[...P],J=ft.find(e=>e.value===V)?.seconds??30*$,de=()=>T===`all`?[`*`]:T===`view-link`?[{type:`share-view`,grant:{kind:I,deviceIds:ce,...z?{talk:!0}:{}}}]:j,X=W.length>0&&W.length<=dt&&!m&&!g&&(T===`all`?C:T===`view-link`?ce.length>0:j.length>0&&G===null),fe=()=>{if(!X)return;let e=C&&T!==`all`&&D!==``&&D!==x?.id;p({scopes:de(),expiresIn:J,label:W,...e?{subjectId:D}:{}})},Z=T===`all`,pe=Z?c:l;return n(ee,{open:a,onClose:f,title:_(`access.createTokenModal.createToken`,`Create token`),icon:Z?c:S,error:h,width:`md`,testId:`create-token-dialog`,footer:e(K,{type:`button`,variant:Z?`danger`:`primary`,size:`sm`,onClick:fe,disabled:!X,"data-testid":`create-token-submit`,children:[m||g?n(u,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):n(pe,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),_(`access.createTokenModal.issueToken`,`Issue token`)]}),children:e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`space-y-1`,children:[n(q,{children:_(`access.createTokenModal.whatItMayDo`,`What it may do`)}),n(oe,{appearance:`pills`,value:T,onValueChange:e=>{(e===`scopes`||e===`view-link`||e===`all`)&&E(e)},children:e(ie,{"aria-label":_(`access.createTokenModal.whatItMayDo`,`What it may do`),children:[e(se,{value:`scopes`,"data-testid":`token-reach-scopes`,children:[n(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),_(`access.createTokenModal.reachScopes`,`Scopes`)]}),e(se,{value:`view-link`,"data-testid":`token-reach-view-link`,children:[n(v,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),_(`access.createTokenModal.reachViewLink`,`View link`)]}),C?e(se,{value:`all`,"data-testid":`token-reach-all`,children:[n(c,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),_(`access.createTokenModal.reachAll`,`All permissions`)]}):null]})})]}),Z?n(`div`,{className:`space-y-1 rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px] leading-relaxed text-foreground`,"data-testid":`admin-token-warning`,children:n(`p`,{children:n(ue,{i18nKey:`auth.adminTokenNoticeShort`,components:{strong:n(`strong`,{})}})})}):null,C&&T!==`all`&&o.length>1?e(`div`,{className:`space-y-1`,children:[n(q,{htmlFor:`token-user`,children:_(`access.createTokenModal.onBehalfOfUser`,`On behalf of user`)}),n(y,{id:`token-user`,value:D,onChange:e=>O(e.target.value),options:o.map(e=>({value:e.id,label:e.username}))})]}):null,e(`div`,{className:`space-y-1`,children:[n(q,{htmlFor:`token-name`,children:_(`access.createTokenModal.label`,`Label`)}),n(re,{id:`token-name`,value:k,maxLength:dt,required:!0,onChange:e=>A(e.target.value),placeholder:T===`view-link`?`kitchen-wall`:`nightly-backup`,autoFocus:!0})]}),T===`scopes`?e(`div`,{className:`space-y-1`,children:[n(q,{children:_(`access.createTokenModal.scopes`,`Scopes`)}),n(ae,{value:j,onChange:N,clampToParent:w}),G&&n(`p`,{className:`text-[10px] text-danger`,children:G}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:_(`access.createTokenModal.eachScopePicksACap`,`Each scope picks a (cap or addon) target + one or more access flavours. The token can access ONLY what's listed.`)})]}):null,T===`view-link`?e(`div`,{className:`space-y-2`,"data-testid":`token-view-link`,children:[e(`div`,{className:`space-y-1`,children:[n(q,{htmlFor:`token-view-cameras`,children:_(`access.createTokenModal.cameras`,`Cameras`)}),n(L,{id:`token-view-cameras`,multiple:!0,pick:`device`,noun:`camera`,fixedTypes:pt,maxItems:mt,recentKey:`token-view-cameras`,testId:`token-view-cameras`,value:te(P),onChange:e=>F(R(e))})]}),e(`div`,{className:`space-y-1`,children:[n(q,{htmlFor:`token-view-kind`,children:_(`access.createTokenModal.viewKind`,`Shows`)}),n(y,{id:`token-view-kind`,value:I,onChange:e=>ne(e.target.value===`events-view`?`events-view`:`grid-view`),options:[{value:`grid-view`,label:_(`access.createTokenModal.viewGrid`,`Live grid`)},{value:`events-view`,label:_(`access.createTokenModal.viewEvents`,`Events`)}]})]}),I===`grid-view`?e(`label`,{className:`flex items-start gap-2 text-sm text-foreground`,children:[n(s,{className:`mt-0.5`,checked:z,onChange:e=>B(e.target.checked),"data-testid":`token-view-talk`}),n(`span`,{children:_(`access.createTokenModal.talk`,`Allow talk-back on these cameras`)})]}):null]}):null,e(`div`,{className:`space-y-1`,children:[n(q,{htmlFor:`token-lifetime`,children:_(`access.createTokenModal.expires`,`Expires after`)}),n(y,{id:`token-lifetime`,value:V,onChange:e=>H(e.target.value),options:U})]})]})})}a();var _t={key:`access.nouns.token`};function vt(e){return typeof e==`object`&&!!e&&`kind`in e}function yt(e,t){let n=e.access===void 0?``:` [${e.access.join(`, `)}]`;return e.type===`device`?`device:[${vt(e.selector)?ce(e.selector,t):`?`}]${n}`:e.type===`addon-routes`?`${t(`access.tokensSection.everyAddonRoutes`,`every addon's routes`)}${n}`:`${e.type}:${e.target??``}${n}`}function bt({headerOwnsCreate:a=!1,createRequested:o=!1,onCreateConsumed:s,ownOnly:c=!1}){let{t:l}=Y(),u=d(),{user:f}=le(),p=h(),g=k.useUtils(),_=pe(),{data:v}=A(),y=t(()=>v??[],[v]),{data:b}=z({}),x=t(()=>{let e=new Map;for(let t of b??[])e.set(t.id,t.name);return e},[b]),C=k.auth.listTokens.useQuery(void 0),{requestProof:w,dialog:ee}=de(`Creating a token with all permissions`),{state:te,openNew:T,close:E}=ne({newKey:ut.token}),[D,O]=i(null),[j,M]=i(null),[N,P]=i(!1),[F,I]=i(null),[L,R]=i(null);r(()=>{o&&(T(),s?.())},[o,T,s]);let B=()=>{g.auth.listTokens.invalidate(),g.auth.listAuthAudit.invalidate()},V=k.auth.mintToken.useMutation({onSuccess:({token:e,record:t})=>{B(),E(),M(null),P(!1),I({token:e,label:t.label})},onError:e=>{M(`Create failed: ${e.message}`),P(!1)}}),H=k.auth.revokeToken.useMutation({onSuccess:()=>{R(null),B()},onError:e=>{R(null),O(`Revoke failed: ${e.message}`)}}),U=Ae(_t,B),re=Date.now(),W=(C.data??[]).filter(e=>!c||e.subjectId===f?.id).map(e=>Xe(e,_,e.scopes.includes(`*`)?null:e.scopes.map(e=>Je(e,x,e=>yt(e,u))).join(`, `),re)),ie=async e=>{await p({title:l(`access.tokensSection.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:e.kind===`All permissions`?l(`access.tokensSection.everyScriptUsingItLoses`,`Every script using it loses access immediately. This cannot be undone.`):l(`access.tokensSection.stopsWorking`,`Whoever holds it loses access immediately. This cannot be undone.`),confirmLabel:l(`access.tokensSection.revoke2`,`Revoke`),variant:`danger`})&&(O(null),R(e.id),H.mutate({id:e.id}))},ae=e=>{(async()=>{O(null),M(null);let t;if(e.scopes.includes(`*`)){P(!0);let e=await w();if(P(!1),e===null)return;t=e}V.mutate({scopes:[...e.scopes],expiresIn:e.expiresIn,label:e.label,...e.subjectId===void 0?{}:{subjectId:e.subjectId},...t===void 0?{}:{reauthToken:t}})})()};return e(`div`,{"data-testid":`tokens`,children:[ee,n(X,{notice:me(D,U.outcome),onDismissNotice:()=>{O(null),U.dismiss()},id:c?`my-tokens`:`tokens`,title:c?l(`access.tokensSection.myTokens`,`My tokens`):l(`access.tokensSection.tokens`,`Tokens`),icon:S,actions:a?void 0:e(K,{size:`sm`,type:`button`,"data-testid":`tokens-new`,onClick:T,children:[n(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),l(`system.access.newToken`,`New token`)]}),description:l(`access.tokensSection.oneFormat`,`Every token is its scopes: a few permissions for a script, all permissions for an admin script, or a view of some cameras for a share link. Revoking one stops it on its next use.`),children:n(Ie,{rows:W,label:l(`common.tokensLabel`),isLoading:C.isLoading,loadError:C.isError?C.error?.message??`Request failed`:null,emptyText:l(`access.tokensSection.noTokens`,`No tokens.`),action:{label:l(`access.tokensSection.revoke2`,`Revoke`),icon:m,isAvailable:e=>e.status===`active`,onRun:e=>void ie(e),busyId:L,disabled:U.busy||L!==null},...f?.isAdmin===!0?{bulk:{revoke:U,noun:_t,isSelectable:e=>e.status===`active`}}:{}})}),n(gt,{open:te.mode===`new`,users:y.map(e=>({id:e.id,username:e.username})),onClose:()=>{E(),M(null),P(!1)},submitting:V.isPending,formError:j,awaitingProof:N,onSubmit:ae}),F&&n(lt,{token:F.token,label:F.label,onClose:()=>I(null)})]})}var xt=864e5,St={qr:`QR (by an admin)`,self:`Self-enrolled`},Ct={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function wt(e){return e.status===`revoked`}function Tt(e){return e.status!==`revoked`}function Et(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function Dt(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/xt)}function Ot(e,t){let n=Dt(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function kt(e,t){let n=Dt(e,t);return n===null?J.t(`helpers.certificateModel.unknown`):n===0?J.t(`helpers.certificateModel.today`):n>0?J.t(`helpers.certificateModel.inDays`,{count:n}):J.t(`helpers.certificateModel.daysAgo`,{count:-n})}function At(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function jt(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function Mt(e){return e.length<=10?e:`${e.slice(0,10)}…`}function Nt(e){if(!e.online)return{allowed:!1,reason:J.t(`helpers.certificateModel.nodeOffline`)};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:J.t(`helpers.certificateModel.uploadedCert`)};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:J.t(`helpers.certificateModel.tlsDisabled`)}}return{allowed:!0,reason:null}}var Pt={prepare:`helpers.certificateModel.stage.prepare`,issue:`helpers.certificateModel.stage.issue`,install:`helpers.certificateModel.stage.install`,reconnect:`helpers.certificateModel.stage.reconnect`,confirm:`helpers.certificateModel.stage.confirm`};function Ft(e){if(e.ok)return{tone:`success`,message:J.t(`helpers.certificateModel.renewed`,{nodeId:e.nodeId,serial:Mt(e.newSerial)})};let t=e.keptPreviousLeaf?J.t(`helpers.certificateModel.keptPrevious`):J.t(`helpers.certificateModel.maybeNoCert`);return{tone:`danger`,message:J.t(`helpers.certificateModel.renewalFailed`,{nodeId:e.nodeId,stage:J.t(Pt[e.stage]),reason:e.reason,kept:t})}}function It(e,t){let n=Math.max(0,e-t),r=Math.ceil(n/1e3),i=Math.floor(r/60),a=r%60;return{expired:n===0,label:`${String(i)}:${String(a).padStart(2,`0`)}`}}var Lt=11;function Rt(e,t){let n=e.slice(0,Lt);return t===null?n:`${n} · ${t}`}function zt(e){return{id:e.id,name:e.deviceName,detail:Rt(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:Ct[e.platform],scope:St[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Bt(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:Ct[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Vt({sessions:t,isLoading:r,loadError:i,emptyText:a,onRevoke:o,revokingId:s}){let{t:c}=Y();return r?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(u,{className:`h-3.5 w-3.5 animate-spin`}),c(`auth.sessionsList.loadingSessions`,`Loading sessions…`)]}):i===null?t.length===0?n(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:a}):n(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.map(e=>n(Ht,{session:e,revoking:s===e.id,onRevoke:()=>o(e)},e.id))}):e(`div`,{className:`text-[11px] text-danger`,children:[c(`auth.sessionsList.couldNotLoadSessions`,`Could not load sessions:`),` `,i]})}function Ht({session:t,revoking:r,onRevoke:i}){let{t:a}=Y(),o=at(t.client);return e(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[n(C,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),e(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[n(`span`,{className:`font-medium text-foreground truncate`,title:o.raw??void 0,children:o.label}),t.current&&n(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:a(`auth.sessionsList.thisDevice`,`This device`)})]}),e(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:st(t.method)}),n(`span`,{className:`font-mono`,children:t.ip??a(`auth.sessionsList.ipUnknown`,`IP unknown`)}),n(`span`,{children:a(`auth.sessionsList.lastActive`,{when:ct(t.lastUsedAt)})}),n(`span`,{children:a(`auth.sessionsList.expires`,{when:ct(t.expiresAt)})})]})]}),!t.current&&e(K,{variant:`unstyled`,onClick:i,disabled:r,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[r?n(u,{className:`h-3 w-3 animate-spin`}):n(w,{className:`h-3 w-3`}),a(`auth.sessionsList.signOut`,`Sign out`)]})]})}export{Be as C,X as D,je as E,me as O,Ve as S,Ae as T,at as _,Tt as a,Ze as b,kt as c,Et as d,Nt as f,ut as g,bt as h,wt as i,pe as k,Ft as l,Mt as m,zt as n,It as o,jt as p,Bt as r,At as s,Vt as t,Ot as u,st as v,Ie as w,Qe as x,ct as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,Y 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{Da as i,Oa as a,ut as o}from"./player-overlays-DilQz9uf.js";import{W as s,_ as c,gr as l,nf as u,uf as d}from"./src-BgJM3bf_.js";import{K as f,W as p,dt as m}from"./index-hhTXvvOB.js";r();function h({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function g({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var _={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function v(){let[r,v]=n(!1),[b,x]=n(null),[S,C]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(h,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(h,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(g,{name:`primary`,cssVar:`--color-primary`}),t(g,{name:`background`,cssVar:`--color-background`}),t(g,{name:`surface`,cssVar:`--color-surface`}),t(g,{name:`foreground`,cssVar:`--color-foreground`}),t(g,{name:`success`,cssVar:`--color-success`}),t(g,{name:`warning`,cssVar:`--color-warning`}),t(g,{name:`danger`,cssVar:`--color-danger`}),t(g,{name:`info`,cssVar:`--color-info`}),t(g,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(g,{name:`onvif`,hex:`#3b82f6`}),t(g,{name:`hikvision`,hex:`#a855f7`}),t(g,{name:`reolink`,hex:`#06b6d4`}),t(g,{name:`ha`,hex:`#22d3ee`}),t(g,{name:`rtsp`,hex:`#78716c`})]})}),t(h,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(u,{variant:`unstyled`,disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(h,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(d,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(d,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(d,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(o,{className:`w-full`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(l,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(i,{className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(y,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(a,{className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),e(h,{title:`ConditionKindPicker`,children:[e(`div`,{className:`flex flex-wrap items-center gap-3`,children:[t(u,{variant:`outline`,onClick:()=>v(!0),children:`Add a condition`}),t(`span`,{className:`text-xs text-foreground-subtle`,children:b??`Nothing picked`})]}),t(c,{open:r,onOpenChange:v,title:`Add a condition`,context:`trigger`,underNot:!1,treeFull:!1,recentKey:`showroom`,textsOf:e=>({label:e,description:`A ${e} row`,example:e}),categoryLabelOf:e=>e,reasonOf:e=>e,onPick:e=>{x(e),v(!1)}})]}),t(h,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(s,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(f,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(h,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(h,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(p,{type:e,size:`lg`,showLabel:!0},e))})}),e(h,{title:`Form Builder Demo`,children:[t(m,{schema:_,values:S,onChange:C}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(S,null,2)})]})]}),t(h,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function y(){let[e,r]=n(!0);return t(u,{variant:`unstyled`,type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{v as ShowroomPage};
|
|
1
|
+
import{C as e,S as t,Y 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{Da as i,Oa as a,ut as o}from"./player-overlays-DuVrpJ5X.js";import{G as s,_ as c,_r as l,df as u,rf as d}from"./src-CDP4x5TP.js";import{K as f,W as p,dt as m}from"./index-D4P9-tQo.js";r();function h({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function g({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var _={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function v(){let[r,v]=n(!1),[b,x]=n(null),[S,C]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(h,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(h,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(g,{name:`primary`,cssVar:`--color-primary`}),t(g,{name:`background`,cssVar:`--color-background`}),t(g,{name:`surface`,cssVar:`--color-surface`}),t(g,{name:`foreground`,cssVar:`--color-foreground`}),t(g,{name:`success`,cssVar:`--color-success`}),t(g,{name:`warning`,cssVar:`--color-warning`}),t(g,{name:`danger`,cssVar:`--color-danger`}),t(g,{name:`info`,cssVar:`--color-info`}),t(g,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(g,{name:`onvif`,hex:`#3b82f6`}),t(g,{name:`hikvision`,hex:`#a855f7`}),t(g,{name:`reolink`,hex:`#06b6d4`}),t(g,{name:`ha`,hex:`#22d3ee`}),t(g,{name:`rtsp`,hex:`#78716c`})]})}),t(h,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(d,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(d,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(d,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(d,{variant:`unstyled`,disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(d,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(d,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(h,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(u,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(u,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(u,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(o,{className:`w-full`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(l,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(i,{className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(y,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(a,{className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),e(h,{title:`ConditionKindPicker`,children:[e(`div`,{className:`flex flex-wrap items-center gap-3`,children:[t(d,{variant:`outline`,onClick:()=>v(!0),children:`Add a condition`}),t(`span`,{className:`text-xs text-foreground-subtle`,children:b??`Nothing picked`})]}),t(c,{open:r,onOpenChange:v,title:`Add a condition`,context:`trigger`,underNot:!1,treeFull:!1,recentKey:`showroom`,textsOf:e=>({label:e,description:`A ${e} row`,example:e}),categoryLabelOf:e=>e,reasonOf:e=>e,onPick:e=>{x(e),v(!1)}})]}),t(h,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(s,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(f,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(h,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(h,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(p,{type:e,size:`lg`,showLabel:!0},e))})}),e(h,{title:`Form Builder Demo`,children:[t(m,{schema:_,values:S,onChange:C}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(S,null,2)})]})]}),t(h,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function y(){let[e,r]=n(!0);return t(d,{variant:`unstyled`,type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{v as ShowroomPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Er as s,Kn as c,St as l,Tn as u,Vr as d,ct as f,ri as p}from"./player-overlays-DuVrpJ5X.js";import{Ms as m}from"./client-BPycW7-C.js";import{t as h}from"./chevron-down-CBb-F8DT.js";import{t as g}from"./archive-ChKlYFY2.js";import{t as _}from"./eraser-B3lnG9yK.js";import{t as v}from"./hard-drive-download-C6N6tovA.js";import{Hs as y,Ju as b,Yu as x,ff as S,qd as C,qi as w,qu as ee,rf as T,vu as te}from"./src-CDP4x5TP.js";import{t as E}from"./i18n-DMi5B3uV.js";import{t as D}from"./useTranslation-BJr-n0es.js";import{X as O,ct as k}from"./index-D4P9-tQo.js";import{t as A}from"./format-size-DIxKXxtj.js";import{t as ne}from"./InstancesTable-D2eTsMze.js";a();var re=`forceDeleteLocation`;function ie({row:e}){let{t}=D(),r=f(),i=o(),a=w(),s=async()=>{if(await r({title:t(`system.storage.forceDeleteTitle`,`Force delete "{{name}}"?`,{name:e.name}),message:t(`system.storage.forceDeleteNote`,`Removes the record only, without checking what is on the location. Anything still stored there becomes unreachable — index rows naming it stop resolving, and playback of those segments goes silently black rather than erroring.`),confirmLabel:t(`system.storage.forceDelete`,`Force delete`),variant:`danger`}))try{await a.mutateAsync({addonId:e.addonId,action:re,input:{id:e.id}}),await i.invalidateQueries({queryKey:[O]}),await i.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}catch(n){k({title:t(`providerInstances.deleteFailed`,`Could not delete`),message:`${e.name}: ${n instanceof Error?n.message:String(n)}`,severity:`critical`})}};return n(S,{icon:u,variant:`ghost`,size:`sm`,disabled:a.isPending,"aria-label":t(`system.storage.forceDeleteRow`,`Force delete {{name}}`,{name:e.name}),onClick:()=>void s()})}function ae(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function oe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function se({drain:t}){let{t:r}=D();if(t.kind===`idle`)return null;if(t.kind===`unreported`)return n(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:r(`storage.drainProgressLine.thisLocationIsDrainingThe`,`This location is draining. The hub has not reported how much is left yet — either the drain has just been set, or this hub predates the drain-progress report.`),children:r(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(t.kind===`drained`)return n(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:r(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:r(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let i=t.drainedFraction===null?null:Math.round(t.drainedFraction*100);return e(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[i!==null&&n(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":r(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:n(`span`,{className:`block h-full bg-warning`,style:{width:`${i}%`}})}),e(`span`,{children:[r(`storage.drainProgressLine.left`,{size:ae(t.bytesRemaining)}),i!==null&&` · ${r(`storage.drainProgressLine.moved`,{percent:i})}`]}),t.estimatedEmptyAtMs===null?n(`span`,{"data-testid":`drain-eta-absent`,title:r(`storage.drainProgressLine.theDrainIsPacedBy`,`The drain is paced by how fast this class of data is still growing, and that has not been observed yet. There is no date to give.`),children:r(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):e(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,r(`storage.drainProgressLine.empty`,{when:oe(t.estimatedEmptyAtMs)})]})]})}var j=[`ok`,`warn`,`critical`];function M(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function N(e){return Math.min(1,Math.max(0,e))}function P(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=N((n-t)/n);return{fraction:r,severity:M(r),recordingsFraction:N(e.usedBytes/n),freeBytes:t,totalBytes:n}}function ce(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=P(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||j.indexOf(e.severity)>j.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}function F(e){return Math.min(1,Math.max(0,e))}function I(e){return Math.round(F(e)*1e3)/10}function L(e){return`${String(Math.round(F(e)*100))}%`}function le(e,t,n={}){let{totalBytes:r,availableBytes:i}=e;if(r===null||r<=0||i===null){let e=n.ownedBytes===void 0||n.ownedBytes===null||!Number.isFinite(n.ownedBytes)||n.ownedBytes<0?null:A(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?E.t(`helpers.locationCapacityBar.unknownSummary`):E.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}let a=Math.min(Math.max(i,0),r),o=r-a,s=t===null||t<=0?0:t,c=Math.min(s,a),l=s>a,u=a-c,d=n.ownedBytes,f=d==null||!Number.isFinite(d)||d<0?null:Math.min(d,o),p=o-(f??0),m=P({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?F(o/r):m.fraction,g=m===null?M(h):m.severity,_=f===null?null:m===null?F(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:F((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:A(r),freeTotal:A(a),freeTotalPercent:L(a/r),used:A(p),usedPercent:L(p/r),free:A(u),freePercent:L(u/r),reserve:s===0?null:E.t(`helpers.locationCapacityBar.reserveKept`,{size:A(s)}),owned:f===null||_===null?null:E.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:A(f),percent:L(_)}),cap:v===null?null:v.reason===`drain`?E.t(`helpers.locationCapacityBar.capDrain`,{size:A(v.bytes)}):E.t(`helpers.locationCapacityBar.capCap`,{size:A(v.bytes)})},S=[E.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:E.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?E.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?E.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:E.t(`helpers.locationCapacityBar.legendKeptFree`),value:A(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:E.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?E.t(`helpers.locationCapacityBar.legendUsed`):E.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:E.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?E.t(`helpers.locationCapacityBar.legendDrainTarget`):E.t(`helpers.locationCapacityBar.legendCap`),value:E.t(`helpers.locationCapacityBar.legendCapValue`,{size:A(v.bytes)}),alarming:b}),{kind:`known`,severity:g,legend:C,segments:{reservePercent:I(c/r),ownedPercent:f===null?null:I(f/r),usedPercent:I(p/r),freePercent:I(u/r),capPercent:y===null?null:I(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}function R(e){return m(e)}function z(e){return e===`active`}var B=[{mode:`active`,get label(){return E.t(`helpers.locationMode.activeLabel`)},get consequence(){return E.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return E.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return E.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return E.t(`helpers.locationMode.drainLabel`)},get consequence(){return E.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return E.t(`helpers.locationMode.disabledLabel`)},get consequence(){return E.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function V(e){return B.find(t=>t.mode===e)??B[0]}function ue(e){return V(e).requiresConfirmation}var de=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function H(e,t,n){return z(n)||!z(R(e))||t.some(t=>t.id!==e.id&&z(R(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:de}}function fe(e,t){return{active:H(e,t,`active`).reason,readonly:H(e,t,`readonly`).reason,drain:H(e,t,`drain`).reason,disabled:H(e,t,`disabled`).reason}}var pe=1024**3;function U(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function me(e){let t=U(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=U(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function he(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*pe;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function ge(e,t){let n=U(e.maxUsedGb);return n===null||n<0?null:{bytes:n*pe,reason:t===`drain`?`drain`:`legacy`}}var W={ok:`bg-primary`,warn:`bg-warning`,critical:`bg-danger`},G={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function _e(e,t){return e===`used`?W[t]:G[e]}function K({location:t,ownedBytes:r}){let{t:i}=D(),a=t.capacity??null,o=he(me(t.config),a?.totalBytes??null),s=le({totalBytes:a?.totalBytes??null,availableBytes:a?.availableBytes??null},o,{ownedBytes:r??null,cap:ge(t.config,R(t))});return s.kind===`unknown`?n(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:s.summary,children:s.owned===null?i(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):i(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:s.owned})}):e(`div`,{className:`mt-1 space-y-1`,title:s.summary,children:[e(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[s.segments.reservePercent>0&&n(`div`,{className:G.reserve,style:{width:`${String(s.segments.reservePercent)}%`}}),s.segments.ownedPercent!==null&&n(`div`,{className:G.owned,style:{width:`${String(s.segments.ownedPercent)}%`}}),n(`div`,{className:W[s.severity],style:{width:`${String(s.segments.usedPercent)}%`}}),n(`div`,{className:G.free,style:{width:`${String(s.segments.freePercent)}%`}}),s.segments.capPercent!==null&&n(`div`,{className:`absolute inset-y-0 w-px ${s.capBelowOwned?`bg-danger`:G.cap}`,style:{left:`${String(s.segments.capPercent)}%`}})]}),n(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:s.legend.map(t=>e(`li`,{className:`flex items-center gap-1`,children:[n(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${_e(t.segment,s.severity)}`}),e(`span`,{className:`text-[10px] tabular-nums ${t.alarming?`text-danger`:`text-foreground-subtle`}`,children:[t.label,` `,t.value]})]},t.segment))})]})}var ve={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},ye={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},be=`storage.discardLocation`,q=`storage.discardLocationStatus`,xe=`storage.discardLocationCancel`;function Se(e){return ve[e]??null}function Ce(e){return ye[e]??null}function we(e){return!z(R(e))}function Te(e,t){return Se(e.type)===null||!we(e)?!1:t.some(t=>t.id!==e.id&&z(R(t)))}var Ee=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function J(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Y(e){return typeof e==`string`?e:null}function X(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!Ee.has(n))return null;let r=J(t.camerasTotal),i=J(t.camerasDone),a=J(t.foldersRemoved),o=J(t.dbRowsDeleted),s=J(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:Y(t.locationId),jobId:Y(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:Y(t.detail)??``,startedAtMs:J(t.startedAtMs),finishedAtMs:J(t.finishedAtMs),error:Y(t.error)}}function De(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var Oe=2e3;function ke({location:e,siblings:t}){return Te(e,t)?n(Ae,{location:e}):null}function Ae({location:t}){let{t:a}=D(),o=f(),c=w(),u=Ce(t.type),[d,p]=i(null),[m,h]=i(null),[g,v]=i(!1);if(r(()=>{if(u===null)return;let e=!1,t=async()=>{try{let t=await c.mutateAsync({addonId:u,action:q,input:{}});if(e)return;p(X(t))}catch{}};t();let n=setInterval(()=>void t(),Oe);return()=>{e=!0,clearInterval(n)}},[u,t.id]),u===null)return null;let y=d!==null&&d.locationId===t.id,b=y&&d.running,x=y&&d.phase!==`idle`,S=async()=>{if(await o({title:a(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:t.displayName}),message:a(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){h(null),v(!0);try{await c.mutateAsync({addonId:u,action:be,input:{locationId:t.id}}),p(X(await c.mutateAsync({addonId:u,action:q,input:{}})))}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}},C=async()=>{try{await c.mutateAsync({addonId:u,action:xe,input:{}})}catch(e){h(e instanceof Error?e.message:String(e))}};return e(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[b?e(T,{variant:`unstyled`,type:`button`,onClick:()=>void C(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[n(l,{className:`h-3 w-3`}),a(`common.cancel`,`Cancel`)]}):e(T,{variant:`unstyled`,type:`button`,onClick:()=>void S(),disabled:g,title:a(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`Permanently delete leftover files on this location. Other locations are not affected.`),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[g?n(s,{className:`h-3 w-3 animate-spin`}):n(_,{className:`h-3 w-3`}),a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),x&&d!==null&&e(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:n(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${De(d)}%`}})}),e(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[d.phase,d.camerasTotal>0?` · ${a(`storage.locationDiscardControl.camsProgress`,{done:d.camerasDone,total:d.camerasTotal})}`:``,d.dbRowsDeleted>0?` · ${a(`storage.locationDiscardControl.rowsDeleted`,{count:d.dbRowsDeleted})}`:``,d.detail?` · ${d.detail}`:``]})]}),(m||y&&d?.error)&&n(`p`,{className:`text-[10px] text-danger leading-tight`,children:m??d?.error})]})}a();var Z={active:c,readonly:g,drain:v,disabled:p},je={active:`border-success/30 text-success hover:bg-success/10`,readonly:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`,drain:`border-warning/40 text-warning hover:bg-warning/10`,disabled:`border-danger/40 text-danger hover:bg-danger/10`};function Me({mode:t,open:r,onToggle:i}){let{t:a}=D(),o=V(t),s=Z[t];return e(T,{variant:`unstyled`,type:`button`,"aria-expanded":r,"aria-label":a(`storage.locationModeSelector.locationState`,`Location state`),onClick:i,title:o.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${je[t]}`,children:[n(s,{className:`h-3 w-3`}),o.label,n(h,{className:`h-3 w-3 ${r?`rotate-180`:``}`})]})}function Ne({mode:t,blockedReasons:i,onSelect:a,onDismiss:o}){let{t:s}=D();return r(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[o]),e(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":s(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[e(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[n(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:s(`storage.locationModeSelector.locationState`,`Location state`)}),n(T,{variant:`unstyled`,type:`button`,"aria-label":s(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:n(l,{className:`h-3 w-3`})})]}),B.map(r=>{let c=i[r.mode],l=c!==``,u=Z[r.mode],d=r.mode===t;return e(T,{variant:`unstyled`,type:`button`,role:`radio`,"aria-checked":d,"aria-label":r.label,disabled:l,onClick:()=>{l||(o(),d||a(r.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[e(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[n(u,{className:`h-3 w-3`}),r.label,d&&n(`span`,{className:`text-[9px] uppercase text-primary`,children:s(`common.current`)})]}),n(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:r.consequence}),l&&n(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},r.mode)})]})}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Fe(e){if(!Pe(e))return null;let t=e.locationId;if(typeof t!=`string`||t.length===0)return null;let n=Q(e.startedAtMs),r=Q(e.startBytes),i=Q(e.bytesRemaining);return n===null||r===null||i===null||typeof e.drained!=`boolean`?null:{locationId:t,startedAtMs:n,startBytes:r,bytesRemaining:i,drained:e.drained,estimatedEmptyAtMs:Q(e.estimatedEmptyAtMs)}}function Ie(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=Fe(n);e!==null&&t.set(e.locationId,e)}return t}function Le(e){if(e.startBytes<=0||e.bytesRemaining>e.startBytes)return null;let t=e.startBytes-e.bytesRemaining;return Math.min(1,Math.max(0,t/e.startBytes))}function Re(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:Le(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function ze(e){return e.mode===`drain`?!0:e.config.readOnly===!0}var Be=[`recordings`,`recordingsLow`];function Ve(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function He(e,t){if(t===void 0||!Be.includes(e.type))return null;let n=t.find(t=>Ve(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function Ue(e,t){let n=new Map;for(let r of e){let e=He(r,t);e!==null&&n.set(r.id,e)}return n}a();var We=[];function $(){let e=x({}),n=te({},{refetchOnWindowFocus:!1}),r=ee({},{refetchOnWindowFocus:!1}),i=e.data??We,a=t(()=>Ue(i,n.data?.locations),[i,n.data?.locations]),o=t(()=>Ie(r.data),[r.data]);return t(()=>({locations:i,ownedBytesById:a,drainOf:e=>Re(ze(e),o.get(e.id))}),[i,a,o])}a();function Ge({row:t}){let{t:r}=D(),a=f(),s=o(),c=$(),[l,u]=i(!1),d=y({onSuccess:()=>{s.invalidateQueries({queryKey:[O]}),s.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),u(!1)},onError:e=>k({title:r(`system.storage.modeFailed`,`Could not change the state`),message:`${t.name}: ${e.message}`,severity:`critical`})}),p=c.locations.find(e=>e.id===t.id);if(p===void 0)return null;let m=c.locations.filter(e=>e.type===p.type),h=R(p),g=c.drainOf(p),_=async e=>{ue(e)&&!await a({title:r(`system.storage.disable`,`Disable "{{displayName}}"?`,{displayName:p.displayName}),message:r(`system.storage.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:V(e).consequence}),confirmLabel:r(`common.disable`,`Disable`),variant:`danger`})||d.mutate({addonId:t.addonId,id:t.id,values:{mode:e}})};return e(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`min-w-0 flex-1 basis-60`,children:[n(K,{location:p,ownedBytes:c.ownedBytesById.get(p.id)??null}),g.kind!==`idle`&&n(se,{drain:g})]}),e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n(ke,{location:p,siblings:m}),n(Me,{mode:h,open:l,onToggle:()=>u(e=>!e)})]}),l&&n(Ne,{mode:h,blockedReasons:fe(p,m),onSelect:e=>void _(e),onDismiss:()=>u(!1)})]})}function Ke({row:t}){let r=$();if(t.kind!==`instance`)return null;let i=r.locations.find(e=>e.id===t.id);if(i===void 0)return null;let a=r.drainOf(i);return e(`div`,{className:`min-w-48`,children:[n(K,{location:i,ownedBytes:r.ownedBytesById.get(i.id)??null}),a.kind!==`idle`&&n(se,{drain:a})]})}function qe({row:e}){let t=$();if(e.kind!==`instance`)return null;let r=t.locations.find(t=>t.id===e.id);if(r===void 0)return null;let i=R(r);return n(C,{variant:i===`active`?`success`:i===`disabled`?`danger`:`default`,children:V(i).label})}function Je(e){return[{key:`capacity`,header:e.capacity,notSortableReason:e.capacity,render:e=>n(Ke,{row:e})},{key:`mode`,header:e.mode,nowrap:!0,notSortableReason:e.mode,render:e=>n(qe,{row:e})}]}function Ye(e,t,n){return!(n===`single`||t.length<=1||z(R(e))&&t.filter(e=>z(R(e))).length<=1)}a();var Xe=`storage`;function Ze({kinds:e}){let{t:r}=D(),{locations:i}=$(),a=b({}).data,o=e=>{let t=i.find(t=>t.id===e.id),n=a?.find(e=>e.id===t?.type);return t===void 0||n===void 0?!1:Ye(t,i.filter(e=>e.type===t.type),n.cardinality)},s=t(()=>Je({capacity:r(`system.storage.colCapacity`,`Capacity`),mode:r(`system.storage.colMode`,`State`)}),[r]),c=t(()=>e===void 0?void 0:t=>t.kind===`instance`&&t.kindId!==void 0&&e.includes(t.kindId),[e]);return n(ne,{functionCap:Xe,icon:d,title:r(`system.storage.title`,`Storage locations`),subtitle:r(`system.storage.subtitle`,`Where recordings, event media, artifacts and backups are kept. Each location is one kind on one provider; the state decides whether it takes writes, is only read, drains or is left alone.`),emptyTitle:r(`system.storage.emptyTitle`,`No storage locations yet`),emptyDescription:r(`system.storage.noStorageLocationsDeclaredBy`,`No storage locations declared by any installed addon.`),addLabel:r(`system.storage.addLocation`,`Add location`),extraColumns:s,lead:e=>n(Ge,{row:e}),canDelete:o,rowActions:e=>o(e)?n(ie,{row:e}):null,...c===void 0?{}:{rowFilter:c}})}export{P as n,ce as r,Ze as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,a,et as o,o as s,t as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Bn as u,Da as d,Er as f,Ni as p,Pi as m,_n as h,gt as g,kn as _,ut as v,xr as y}from"./player-overlays-DuVrpJ5X.js";import{Us as b}from"./client-BPycW7-C.js";import{n as x,t as S}from"./ruler-Buxogset.js";import{Ef as C,Gd as w,Lf as T,Tf as ee,Un as E,Ut as D,Wn as O,df as k,gd as A,oi as j,p as te,pd as ne,qd as M,rf as N,ti as P,ud as F,wf as I}from"./src-CDP4x5TP.js";import{t as L}from"./i18n-DMi5B3uV.js";import{t as R}from"./useTranslation-BJr-n0es.js";import{Jr as z,T as B,Yr as V,x as H}from"./index-D4P9-tQo.js";import{t as U}from"./AdminSectionedPage-Ch-ZRoVJ.js";import{t as W}from"./AdminPage-IHC_FLB8.js";import{t as G}from"./NodeAddonsSettingsPanel-BaDE0Pex.js";import{t as K}from"./BootstrapSettingsForm-BIJKJjHp.js";o();var q={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},J={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function re({entry:t,actions:r}){let i=t.name.toLowerCase(),a=q[i]??`border-primary`,o=J[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=r?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&n(f,{className:`h-3 w-3 animate-spin text-primary`})]}),n(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?n(Y,{entry:t,actions:r,activeProvider:s,isPending:c}):n(X,{entry:t,actions:r,isPending:c})]})}function Y({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=R();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(p,{className:`h-3 w-3 text-green-400 shrink-0`}),n(`span`,{className:`font-medium`,children:i.addonName}),n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[n(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(N,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>r.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&n(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?r.onClearNodeSingleton(t.name,i.nodeId):r.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&n(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let r=c===t.value;return e(N,{variant:`unstyled`,type:`button`,disabled:d||r,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${r?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${r?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:t.label}),r&&t.value!==s&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function X({entry:t,actions:r,isPending:i}){let{t:a}=R();if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!r)return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[n(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,n)=>{let i=n?[...new Set([...o,e])]:o.filter(t=>t!==e);r.onToggleCollection(t.name,i)};return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[n(d,{checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),n(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function Z({capabilities:e,actions:t}){let{t:r}=R();return e.length===0?n(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:r(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):n(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>n(re,{entry:e,actions:t},e.name))})}var ie=[`capabilities`,`listCapabilities`];function ae(e){return e===`singleton`||e===`collection`}function oe(e){let t=e.indexOf(`@`);return t===-1?L.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function se(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:oe(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ce(){let{t:r}=R(),o=g(),[s,l]=i(null),[u,d]=i(null),f=a({queryKey:ie,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),_=t(()=>{let e=(f.data??[]).flatMap(e=>ae(e.mode)?[se(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[f.data]),v=t(()=>_.filter(e=>e.mode===`singleton`),[_]),y=t(()=>_.filter(e=>e.mode===`collection`),[_]),b=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{l(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await f.refetch()},onError:(e,t)=>{d({kind:`error`,message:r(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),x=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await f.refetch()},onError:(e,t)=>{d({kind:`error`,message:r(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),S=c({mutationFn:e=>o.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await f.refetch()},onError:(e,t)=>{d({kind:`error`,message:r(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),C=c({mutationFn:e=>o.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{l(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await f.refetch()},onError:(e,t)=>{d({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),T={onSelectSingleton:(e,t)=>b.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>x.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>S.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>C.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(W,{embedded:!0,icon:h,title:r(`system.capabilities.capabilities`,`Capabilities`),subtitle:r(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[u&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${u.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[u.kind===`success`?n(p,{className:`h-3.5 w-3.5 shrink-0`}):n(m,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:u.message})]}),f.isLoading&&n(`div`,{className:`flex items-center justify-center py-16`,children:n(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),f.isError&&!f.isLoading&&n(w,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:f.error instanceof Error?f.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void f.refetch()}),!f.isLoading&&!f.isError&&_.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!f.isLoading&&!f.isError&&_.length>0&&e(`div`,{className:`space-y-6`,children:[v.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),n(Z,{capabilities:v,actions:T})]}),y.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),n(Z,{capabilities:y,actions:T})]})]})]})}var le={escape:`Esc`,enter:`Enter`};function ue(e,t){let n=C(e),r=le[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function de(){let{t}=R(),r=I(),i=ee();return n(E,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:x,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),r.length===0?n(j,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(O,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:n(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:ue(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var fe=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function pe(){let{t}=R(),a=s(),o=ne(),c=A(),l=F(),[d,f]=i(``),[p,m]=i(``),[h,g]=i(null),_=o.data?.location??null;r(()=>{f(_===null?``:Q(_.latitude)),m(_===null?``:Q(_.longitude))},[_]);let v=async()=>{await a.invalidateQueries({queryKey:fe})},b=async e=>{e.preventDefault();let t=Number(d),n=Number(p);if(d.trim()===``||p.trim()===``){g(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){g(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){g(`Longitude must be between -180 and 180 decimal degrees.`);return}g(null),await c.mutateAsync({latitude:t,longitude:n}),await v()},x=async()=>{g(null),await c.mutateAsync(null),await v()},S=async()=>{g(null),await l.mutateAsync(),await v()},C=c.isPending||l.isPending||o.isLoading;return e(P,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[n(y,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),n(`div`,{children:n(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),_===null?n(M,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(M,{variant:_.source===`operator-set`?`success`:`info`,children:_.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),_?.label!==void 0&&_.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:_.label})}):null,_===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),n(k,{className:`w-40`,value:d,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>f(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),n(k,{className:`w-40`,value:p,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>m(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(N,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(N,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[n(u,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),_===null?null:n(N,{type:`button`,variant:`ghost`,disabled:C,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),h===null?null:n(`p`,{className:`text-xs text-danger`,children:h}),n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}o();function $(e){return b.some(t=>t===e)}function me(e){return D.some(t=>t===e)}function he(){let{t}=R(),r=te(),[a,o]=i(!1),[s,c]=i(null),l=e=>{o(!0),c(null),r.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},u=r.status!==`ok`||!r.writable||a;return n(E,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:S,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),r.status===`error`&&n(w,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(w,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&n(w,{message:s}),n(O,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;me(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),n(O,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;$(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}var ge=`system-config`;function _e(){let{t}=R(),{nodes:r,isLoading:i}=T(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ge);return e(W,{embedded:!0,children:[n(pe,{}),i?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?e(l,{children:[n(K,{emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}),o.length===0?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):n(G,{nodeId:a.id,addonIds:o,level:`global`})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(_,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),n(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[n(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),n(he,{}),n(de,{})]})]})}function ve(){let{t:e}=R(),t=H(`/system/settings`,{t:e,isAdmin:!0})??{icon:_,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=V();return new URLSearchParams(r).get(`tab`)===`secrets`?n(z,{replace:!0,to:`${B(r)}${i}`}):n(U,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(_e,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ce,{})}]})}export{ve as SystemPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}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 s,Yt as c,ct as l,gi as u,ot as d,tr as f}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}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 s,Yt as c,ct as l,gi as u,ot as d,tr as f}from"./player-overlays-DuVrpJ5X.js";import{kr as p}from"./client-BPycW7-C.js";import{u as m}from"./video-De6y5yax.js";import{Gd as h,Gn as g,Jd as _,Kn as v,_d as y,oi as b,qd as x,rf as S,vd as C,yd as w,yn as T}from"./src-CDP4x5TP.js";import{t as E}from"./useTranslation-BJr-n0es.js";import{Qr as D}from"./index-D4P9-tQo.js";import{t as O}from"./AdminPage-IHC_FLB8.js";import{i as k,r as A,t as j}from"./useTemplateSave-j5OtpDNQ.js";a();var M=`edit`,N=p[0];function P(){let{t:a}=E(),p=o(),P=w({}),F=y(),I=j(),L=C(),R=l(),z=d(),[B,V]=i(null),[H,U]=D(),W=H.get(M);r(()=>{if(W===null||P.data===void 0)return;let e=P.data.find(e=>e.id===W);e!==void 0&&V({id:e.id,kind:e.kind,name:e.name,payload:e.payload}),U(e=>{let t=new URLSearchParams(e);return t.delete(M),t},{replace:!0})},[W,P.data,U]);let G=()=>void p.invalidateQueries({queryKey:[[`template`]]}),K=async e=>{await I.save(e)&&V(null)},q=async e=>{try{await F.mutateAsync({kind:e.kind,name:a(`remote.templates.copyName`,{name:e.name}),payload:e.payload}),G()}catch(e){await z({title:a(`remote.templates.duplicateFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},J=async e=>{if(await R({title:a(`remote.templates.deleteTitle`,{name:e.name}),message:a(`remote.templates.deleteMessage`),confirmLabel:a(`common.delete`),variant:`danger`}))try{let t=await L.mutateAsync({id:e.id});if(t.status===`in-use`){await z({title:a(`remote.templates.inUseTitle`,{name:e.name}),message:a(`remote.templates.inUseMessage`,{devices:t.devices.map(e=>e.name).join(`, `)}),variant:`warning`});return}G()}catch(e){await z({title:a(`remote.templates.deleteFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},Y=t(()=>[{key:`name`,header:a(`remote.templates.name`),sortValue:e=>e.name.toLowerCase(),render:e=>n(`span`,{className:`font-medium text-foreground`,children:e.name})},{key:`kind`,header:a(`remote.templates.kind.label`),sortValue:e=>e.kind,render:e=>n(x,{variant:`neutral`,children:k(e.kind).label(a)})},{key:`summary`,header:a(`remote.templates.summary`),notSortableReason:`A sentence built from the payload.`,render:e=>n(`span`,{className:`text-foreground-muted`,children:k(e.kind).summary(e.payload,a)})},{key:`updated`,header:a(`remote.templates.updated`),sortValue:e=>e.updatedAt,render:e=>n(`span`,{className:`text-foreground-muted`,children:new Date(e.updatedAt).toLocaleDateString()})},{key:`actions`,align:`right`,notSortableReason:`Row actions.`,render:e=>n(T,{title:a(`remote.templates.actionsFor`,{name:e.name}),items:[{id:`edit`,label:a(`common.edit`),icon:f,onClick:()=>{I.clearError(),V({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}},{id:`duplicate`,label:a(`remote.templates.duplicate`),icon:u,onClick:()=>void q(e)},{id:`delete`,label:a(`common.delete`),icon:c,danger:!0,onClick:()=>void J(e)}]})}],[a]),X=P.data??[],Z=()=>{I.clearError(),V({id:null,kind:N,name:``,payload:k(N).emptyPayload()})};return e(O,{icon:m,title:a(`remote.templates.title`),subtitle:a(`remote.templates.subtitle`),actions:e(S,{size:`sm`,onClick:Z,"data-testid":`template-new`,children:[n(s,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.templates.new`)]}),children:[P.status===`error`?n(h,{title:a(`remote.templates.loadFailed`),message:P.error.message,onRetry:()=>void P.refetch()}):P.data===void 0?n(_,{className:`h-32 w-full`}):X.length===0?n(b,{icon:m,title:a(`remote.templates.emptyTitle`),description:a(`remote.templates.emptyDescription`),action:n(S,{size:`sm`,onClick:Z,children:a(`remote.templates.new`)})}):n(g,{columns:Y,rows:X,rowKey:e=>e.id,maxBodyHeight:v,defaultSort:{columnKey:`name`,dir:`asc`},onRowClick:e=>{I.clearError(),V({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}}),n(A,{draft:B,saving:I.saving,error:I.error,onSave:e=>void K(e),onClose:()=>V(null)})]})}export{P as TemplatesPage};
|