@camstack/addon-admin-ui 1.2.617 → 1.2.618
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 +7 -0
- package/dist/assets/Addons-Bbo-IVJa.js +5 -0
- package/dist/assets/{AdminPage-Ebi_EBLO.js → AdminPage-D6TraYmz.js} +1 -1
- package/dist/assets/{AdminSectionedPage-DXlBTxH9.js → AdminSectionedPage-6q0cnCg7.js} +1 -1
- package/dist/assets/{AiProfiles-DJWCjPWB.js → AiProfiles-C1W-sAw_.js} +2 -2
- package/dist/assets/{Authentication-B9nMx-wk.js → Authentication-DoUXukS7.js} +1 -1
- package/dist/assets/Build-o1kjv3gG.js +39 -0
- package/dist/assets/{Calendars-DjJe7z4v.js → Calendars-rvuFIqxu.js} +1 -1
- package/dist/assets/{CameraGrids-XG38cjso.js → CameraGrids-BXXitZ_x.js} +1 -1
- package/dist/assets/{Cluster-3x1kCfVL.js → Cluster-CmLtZBvM.js} +1 -1
- package/dist/assets/CompositionBlockEditor-Cts_fQGP.js +2 -0
- package/dist/assets/{CompositionEditorPage-DvD76wlY.js → CompositionEditorPage-BoDoS8Ps.js} +1 -1
- package/dist/assets/{Data-Dg8bKUj_.js → Data-CIjiGbWi.js} +2 -2
- package/dist/assets/DeviceDetail-976JPXjw.js +2 -0
- package/dist/assets/{DeviceDoActionFields-C8cgbqM6.js → DeviceDoActionFields-D3rdyp8g.js} +1 -1
- package/dist/assets/{Devices-BYP2jABN.js → Devices-DqogfjEc.js} +1 -1
- package/dist/assets/EditTemplateButton-B8Tp_ZVT.js +1 -0
- package/dist/assets/{EmbedPlayerPage-Cc1XzE1D.js → EmbedPlayerPage-DahxVoqz.js} +1 -1
- package/dist/assets/History-Brgu6zTa.js +1 -0
- package/dist/assets/Identity-CXnwESs0.js +1 -0
- package/dist/assets/{InstancesTable-DSzBTz0U.js → InstancesTable-7jeKll4O.js} +1 -1
- package/dist/assets/IntegrationDetail-BWB0ToAO.js +1 -0
- package/dist/assets/{IntegrationHub-ppPk7tjJ.js → IntegrationHub-BeKd0u_7.js} +1 -1
- package/dist/assets/Integrations-Ckffv89K.js +2 -0
- package/dist/assets/{Integrations-DBGUeRV2.js → Integrations-TvY5kwLx.js} +1 -1
- package/dist/assets/{Library-BDjoD4G2.js → Library-CR6XN1YC.js} +1 -1
- package/dist/assets/{Locations-CofGYo_8.js → Locations-BrOyIobS.js} +2 -2
- package/dist/assets/{Logs-CVZ0O-In.js → Logs-B01-D_Ua.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-CFO8KzKy.js → MaskShapeCanvas-Cza87RmJ.js} +1 -1
- package/dist/assets/{MotionZonesSettings-Dpl0PFO-.js → MotionZonesSettings-DKlxpVn8.js} +1 -1
- package/dist/assets/{MyAccess-DWTndP83.js → MyAccess-BlzclNq-.js} +1 -1
- package/dist/assets/{Network-tLJKIS89.js → Network-DyHbZqp4.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-DVrIfoG4.js → NodeAddonsSettingsPanel-ISwiqwDO.js} +1 -1
- package/dist/assets/Notifications-ShthmpVF.js +1 -0
- package/dist/assets/Pipeline-CO7y6Eoh.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-Bp3YSXwO.js → PrivacyMaskSettings-Lv0IY9ez.js} +1 -1
- package/dist/assets/Recordings-Big48q2n.js +1 -0
- package/dist/assets/{ScanSubnetEditor-Di3ABTMO.js → ScanSubnetEditor-ygCwAKip.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-D5xYFHyj.js → SceneMonitorEditor-PsyMFXTc.js} +1 -1
- package/dist/assets/SessionsList-jm6C8uD_.js +2 -0
- package/dist/assets/{Showroom-Dl4wMm7l.js → Showroom-CkW6tyxt.js} +1 -1
- package/dist/assets/StorageLocationsTable-AgPIJSk_.js +1 -0
- package/dist/assets/System-C_Z19iNC.js +1 -0
- package/dist/assets/Templates-ZizUIArr.js +1 -0
- package/dist/assets/{Terminal-D3-EI4tI.js → Terminal-Isb6kp1R.js} +3 -3
- package/dist/assets/{TrainingProviders-D9B7raxR.js → TrainingProviders-D2jMAIon.js} +1 -1
- package/dist/assets/{Viewer-k1S5klMG.js → Viewer-DWidw3-t.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Dm2jyiKk.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-cUvuIdLC.js} +1 -1
- package/dist/assets/{addon-icons-context-CEvmVMB8.js → addon-icons-context-CNLz27sp.js} +1 -1
- package/dist/assets/{ai-page.helpers-Bg-z0Uki.js → ai-page.helpers-SZGcu2Qp.js} +1 -1
- package/dist/assets/{archive-B9JKxZbf.js → archive-D6vg-wI0.js} +1 -1
- package/dist/assets/{assignment-candidates-C6Db7rsq.js → assignment-candidates-D25v4Kp9.js} +1 -1
- package/dist/assets/{authed-media-CLS7sLxL.js → authed-media-DUmbblZ2.js} +1 -1
- package/dist/assets/{bell-off-CGwGfVLy.js → bell-off-CsL9MH7N.js} +1 -1
- package/dist/assets/{board-model-FH0yBwxy.js → board-model-CRqpael6.js} +1 -1
- package/dist/assets/{boxes-BwDtnr_I.js → boxes-DxmpmK5V.js} +1 -1
- package/dist/assets/{calendar-clock-BBAYU6NG.js → calendar-clock-7Nojs9mt.js} +1 -1
- package/dist/assets/circle-slash-BJcDFW8_.js +1 -0
- package/dist/assets/client-BXR6ajSS.js +809 -0
- package/dist/assets/{create-composition-DzLUvTdr.js → create-composition-BG3uDoPZ.js} +2 -2
- package/dist/assets/crop-CIor6VRO.js +1 -0
- package/dist/assets/{database-zap-C92A2T4h.js → database-zap-CxVxIBTn.js} +1 -1
- package/dist/assets/{device-integration-icon-FWR8hQj8.js → device-integration-icon-DtnomX4G.js} +1 -1
- package/dist/assets/device-picker-model-D_Q1xHkZ.js +1 -0
- package/dist/assets/dist-B6QbwLbn.js +809 -0
- package/dist/assets/{dist-BcRNHWsT.js → dist-BvYpsFO_.js} +1 -1
- package/dist/assets/{eraser-BOm8ihae.js → eraser-BzkE8iXt.js} +1 -1
- package/dist/assets/{file-up-BTyDLoIP.js → file-up-DqkBcPKT.js} +1 -1
- package/dist/assets/{format-DHGtO4KV.js → format-DU3bhEVG.js} +1 -1
- package/dist/assets/{grip-vertical-BFf74GGR.js → grip-vertical-0UEXYzmF.js} +1 -1
- package/dist/assets/{hard-drive-download-DpTgAq6c.js → hard-drive-download-CqttlO8X.js} +1 -1
- package/dist/assets/{hostInit-BTM7DI5p.js → hostInit-CsKrH6-y.js} +1 -1
- package/dist/assets/{i18n-CXvYtPOo.js → i18n-CI_T7hgw.js} +1 -1
- package/dist/assets/icons-Bbof9kyX.js +1 -0
- package/dist/assets/{index-BMAzrKSU.js → index-BH_RWw4e.js} +3 -3
- package/dist/assets/{key-8iheoLtp.js → key-CvT6AW9M.js} +1 -1
- package/dist/assets/{key-square-DKJPhigE.js → key-square-BAc1dSEo.js} +1 -1
- package/dist/assets/{layers-DVi5cI_Y.js → layers-DqTwg1W2.js} +1 -1
- package/dist/assets/{link-2-off-CwQB4-4V.js → link-2-off-ZsDUEngg.js} +1 -1
- package/dist/assets/{linked-devices-model-DZEklNai.js → linked-devices-model-DB1lOwSu.js} +1 -1
- package/dist/assets/{list-ordered-Dhw63KUG.js → list-ordered-Tk3PwAeK.js} +1 -1
- package/dist/assets/{memory-stick-DeU-41u3.js → memory-stick-CD-Oqkj-.js} +1 -1
- package/dist/assets/{message-square-plus-2tqmoqEA.js → message-square-plus-D4CYrw19.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-c42fb52f.js → mf-entry-bootstrap-0-06b0a145.js} +2 -2
- package/dist/assets/{mic-off-CIcF7IKl.js → mic-off-BWLk6zFX.js} +1 -1
- package/dist/assets/{monitor-off-Dm87tOM6.js → monitor-off-T2-4dddP.js} +1 -1
- package/dist/assets/{monitor-smartphone-ByazEVgs.js → monitor-smartphone-CVkdYv9h.js} +1 -1
- package/dist/assets/mount-D_Q1xHkZ.js +1 -0
- package/dist/assets/{notification-rule-status-CBlffLX_.js → notification-rule-status-B6-wJrto.js} +1 -1
- package/dist/assets/{player-overlays-DyXjVBGT.js → player-overlays-CwGwFZ72.js} +1 -1
- package/dist/assets/remoteEntry-B0oC-USP.js +1 -0
- package/dist/assets/{ruler-B__n3jg-.js → ruler-BkA262Z_.js} +1 -1
- package/dist/assets/{scissors-DjkxctyG.js → scissors-DrkuZ54s.js} +1 -1
- package/dist/assets/{search-x-DNUbomYQ.js → search-x-DK-VuUk-.js} +1 -1
- package/dist/assets/{send-CdJi-Jva.js → send-C-abBdEc.js} +1 -1
- package/dist/assets/{settings-2-Bcv2-p9v.js → settings-2-BI3FVudo.js} +1 -1
- package/dist/assets/{shapes-fSR3wuPN.js → shapes-DgKjCpym.js} +1 -1
- package/dist/assets/{sigma-C7e71nf1.js → sigma-KCXpAhXv.js} +1 -1
- package/dist/assets/{speaker-cS8JKFyy.js → speaker-Ck5eNYrC.js} +1 -1
- package/dist/assets/src-Dcjxk30r.js +100 -0
- package/dist/assets/{sso-popup-BO4Rklte.js → sso-popup-n62X0G6g.js} +1 -1
- package/dist/assets/{step-inspector-model-DqV7fK9R.js → step-inspector-model-DQeRB8Mx.js} +1 -1
- package/dist/assets/{table-2-D2sE5xkE.js → table-2-Cj7xaw73.js} +1 -1
- package/dist/assets/{timer-reset-DE-Saa8j.js → timer-reset-CEn9vyrj.js} +1 -1
- package/dist/assets/tv-KMz8pUGf.js +1 -0
- package/dist/assets/{unlink-3TXI314Y.js → unlink-CLQJUZlx.js} +1 -1
- package/dist/assets/{usb-CWAElu5P.js → usb-DpTZYpPf.js} +1 -1
- package/dist/assets/{use-device-bound-caps-BIuzkSfj.js → use-device-bound-caps-CwyejXhd.js} +1 -1
- package/dist/assets/{use-scenes-feed-sQn0LT8E.js → use-scenes-feed-jA7Un6uq.js} +1 -1
- package/dist/assets/{use-stationary-objects-zuSJz0rd.js → use-stationary-objects-Cp9nAfng.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-Q7d8gnj3.js → useAdminDeviceRemoval-CKXFkJGC.js} +1 -1
- package/dist/assets/useEventInvalidation-D_Q1xHkZ.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BZ8BBfPH.js → useNodeUrlSelection-CTXnn3YU.js} +1 -1
- package/dist/assets/user-round-CAZ5Tl1r.js +1 -0
- package/dist/assets/{user-x-BCwqcNgr.js → user-x-D83olJnj.js} +1 -1
- package/dist/assets/{variable-u95rJnH5.js → variable-RZa2sP45.js} +1 -1
- package/dist/assets/{video-DQe86s-A.js → video-Dat56_72.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B2r8ij_v.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BKMSuiP0.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +13283 -12425
- package/package.json +2 -2
- package/dist/assets/Addons-Bd-5BatZ.js +0 -5
- package/dist/assets/Build-qPFztpIB.js +0 -39
- package/dist/assets/CompositionBlockEditor-CpjYZdFX.js +0 -2
- package/dist/assets/DeviceDetail-DNQyvNrH.js +0 -2
- package/dist/assets/EditTemplateButton-iR843K_w.js +0 -1
- package/dist/assets/History-BMLNSubg.js +0 -1
- package/dist/assets/Identity-CRN5-7VC.js +0 -1
- package/dist/assets/IntegrationDetail-Ui5OhCTs.js +0 -1
- package/dist/assets/Integrations-BYr92i9g.js +0 -2
- package/dist/assets/Notifications-Cpnee7Z2.js +0 -1
- package/dist/assets/Pipeline-Bw1Lwph_.js +0 -1
- package/dist/assets/Recordings-Y8nK9dGu.js +0 -1
- package/dist/assets/SessionsList-O39g4S1S.js +0 -2
- package/dist/assets/StorageLocationsTable-lXXrMjlK.js +0 -1
- package/dist/assets/System-DeTfeI3k.js +0 -1
- package/dist/assets/Templates-BCkcoTz2.js +0 -1
- package/dist/assets/circle-slash-DPjC8AvW.js +0 -1
- package/dist/assets/client-CblKyG0c.js +0 -809
- package/dist/assets/crop-lsSXpLjg.js +0 -1
- package/dist/assets/device-picker-model-BUPtZml1.js +0 -1
- package/dist/assets/dist-BB33Dg-J.js +0 -809
- package/dist/assets/icons-DAPXM3vF.js +0 -1
- package/dist/assets/mount-BUPtZml1.js +0 -1
- package/dist/assets/remoteEntry-eivQS8Bf.js +0 -1
- package/dist/assets/scan-eye-FuXamKBY.js +0 -1
- package/dist/assets/src-CDmuXEWK.js +0 -100
- package/dist/assets/useEventInvalidation-BUPtZml1.js +0 -1
- package/dist/assets/user-round-7grs57O1.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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{$r as s,Bn as c,Fi as l,Ir as u,_n as d,br as f,bt as p,ct as m}from"./player-overlays-DyXjVBGT.js";import{Wo as h}from"./client-CblKyG0c.js";import{t as g}from"./archive-B9JKxZbf.js";import{t as _}from"./eraser-BOm8ihae.js";import{t as v}from"./hard-drive-download-DpTgAq6c.js";import{$u as y,Ei as b,Gs as x,Qu as S,Zi as C,Zu as w,af as ee,vi as T,wu as te}from"./src-CDmuXEWK.js";import{t as E}from"./i18n-CXvYtPOo.js";import{t as D}from"./useTranslation-BJr-n0es.js";import{J as O,st as k}from"./index-BMAzrKSU.js";import{t as A}from"./format-size-DIxKXxtj.js";import{t as ne}from"./InstancesTable-DSzBTz0U.js";a();var re=`forceDeleteLocation`;function ie({row:e}){let{t}=D(),r=m(),i=o(),a=C(),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(ee,{icon:d,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 j({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 M=[`ok`,`warn`,`critical`];function N(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function P(e){return Math.min(1,Math.max(0,e))}function F(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=P((n-t)/n);return{fraction:r,severity:N(r),recordingsFraction:P(e.usedBytes/n),freeBytes:t,totalBytes:n}}function se(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=F(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||M.indexOf(e.severity)>M.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}function I(e){return Math.min(1,Math.max(0,e))}function L(e){return Math.round(I(e)*1e3)/10}function R(e){return`${String(Math.round(I(e)*100))}%`}function ce(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=F({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?I(o/r):m.fraction,g=m===null?N(h):m.severity,_=f===null?null:m===null?I(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:I((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:A(r),freeTotal:A(a),freeTotalPercent:R(a/r),used:A(p),usedPercent:R(p/r),free:A(u),freePercent:R(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:R(_)}),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:L(c/r),ownedPercent:f===null?null:L(f/r),usedPercent:L(p/r),freePercent:L(u/r),capPercent:y===null?null:L(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}function z(e){return h(e)}function B(e){return e===`active`}var V=[{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 H(e){return V.find(t=>t.mode===e)??V[0]}function le(e){return H(e).requiresConfirmation}var ue=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function U(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:ue}}function de(e,t){return{active:U(e,t,`active`).reason,readonly:U(e,t,`readonly`).reason,drain:U(e,t,`drain`).reason,disabled:U(e,t,`disabled`).reason}}var W=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function fe(e){let t=G(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=G(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function pe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*W;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function me(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*W,reason:t===`drain`?`drain`:`legacy`}}var K={ok:`bg-primary`,warn:`bg-warning`,critical:`bg-danger`},q={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function he(e,t){return e===`used`?K[t]:q[e]}function J({location:t,ownedBytes:r}){let{t:i}=D(),a=t.capacity??null,o=pe(fe(t.config),a?.totalBytes??null),s=ce({totalBytes:a?.totalBytes??null,availableBytes:a?.availableBytes??null},o,{ownedBytes:r??null,cap:me(t.config,z(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:q.reserve,style:{width:`${String(s.segments.reservePercent)}%`}}),s.segments.ownedPercent!==null&&n(`div`,{className:q.owned,style:{width:`${String(s.segments.ownedPercent)}%`}}),n(`div`,{className:K[s.severity],style:{width:`${String(s.segments.usedPercent)}%`}}),n(`div`,{className:q.free,style:{width:`${String(s.segments.freePercent)}%`}}),s.segments.capPercent!==null&&n(`div`,{className:`absolute inset-y-0 w-px ${s.capBelowOwned?`bg-danger`:q.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 ${he(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 ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},_e={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},ve=`storage.discardLocation`,Y=`storage.discardLocationStatus`,ye=`storage.discardLocationCancel`;function be(e){return ge[e]??null}function xe(e){return _e[e]??null}function Se(e){return!B(z(e))}function Ce(e,t){return be(e.type)===null||!Se(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var we=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function X(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Z(e){return typeof e==`string`?e:null}function Te(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`||!we.has(n))return null;let r=X(t.camerasTotal),i=X(t.camerasDone),a=X(t.foldersRemoved),o=X(t.dbRowsDeleted),s=X(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:Z(t.locationId),jobId:Z(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:Z(t.detail)??``,startedAtMs:X(t.startedAtMs),finishedAtMs:X(t.finishedAtMs),error:Z(t.error)}}function Ee(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 De=2e3;function Oe({location:e,siblings:t}){return Ce(e,t)?n(ke,{location:e}):null}function ke({location:t}){let{t:a}=D(),o=m(),s=C(),c=xe(t.type),[l,u]=i(null),[d,h]=i(null),[g,v]=i(!1);if(r(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await s.mutateAsync({addonId:c,action:Y,input:{}});if(e)return;u(Te(t))}catch{}};t();let n=setInterval(()=>void t(),De);return()=>{e=!0,clearInterval(n)}},[c,t.id]),c===null)return null;let y=l!==null&&l.locationId===t.id,b=y&&l.running,x=y&&l.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 s.mutateAsync({addonId:c,action:ve,input:{locationId:t.id}}),u(Te(await s.mutateAsync({addonId:c,action:Y,input:{}})))}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}},w=async()=>{try{await s.mutateAsync({addonId:c,action:ye,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 w(),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(p,{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(f,{className:`h-3 w-3 animate-spin`}):n(_,{className:`h-3 w-3`}),a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),x&&l!==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:`${Ee(l)}%`}})}),e(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[l.phase,l.camerasTotal>0?` · ${a(`storage.locationDiscardControl.camsProgress`,{done:l.camerasDone,total:l.camerasTotal})}`:``,l.dbRowsDeleted>0?` · ${a(`storage.locationDiscardControl.rowsDeleted`,{count:l.dbRowsDeleted})}`:``,l.detail?` · ${l.detail}`:``]})]}),(d||y&&l?.error)&&n(`p`,{className:`text-[10px] text-danger leading-tight`,children:d??l?.error})]})}a();var Ae={active:c,readonly:g,drain:v,disabled:s},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=H(t),s=Ae[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(l,{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(p,{className:`h-3 w-3`})})]}),V.map(r=>{let c=i[r.mode],l=c!==``,u=Ae[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=y({}),n=te({},{refetchOnWindowFocus:!1}),r=w({},{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=m(),s=o(),c=$(),[l,u]=i(!1),d=x({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`})}),f=c.locations.find(e=>e.id===t.id);if(f===void 0)return null;let p=c.locations.filter(e=>e.type===f.type),h=z(f),g=c.drainOf(f),_=async e=>{le(e)&&!await a({title:r(`system.storage.disable`,`Disable "{{displayName}}"?`,{displayName:f.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:H(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(J,{location:f,ownedBytes:c.ownedBytesById.get(f.id)??null}),g.kind!==`idle`&&n(j,{drain:g})]}),e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n(Oe,{location:f,siblings:p}),n(Me,{mode:h,open:l,onToggle:()=>u(e=>!e)})]}),l&&n(Ne,{mode:h,blockedReasons:de(f,p),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(J,{location:i,ownedBytes:r.ownedBytesById.get(i.id)??null}),a.kind!==`idle`&&n(j,{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=z(r);return n(b,{variant:i===`active`?`success`:i===`disabled`?`danger`:`default`,children:H(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||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}a();var Xe=`storage`;function Ze({kinds:e}){let{t:r}=D(),{locations:i}=$(),a=S({}).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:u,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{F as n,se as r,Ze as t};
|
|
@@ -1 +0,0 @@
|
|
|
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{Oi as u,Pn as d,br as f,hr as p,ht as m,ki as h,un as g,ut as _,xn as v}from"./player-overlays-DyXjVBGT.js";import{ts as y}from"./client-CblKyG0c.js";import{n as b,t as x}from"./ruler-B__n3jg-.js";import{Df as S,Ei as C,In as w,Jr as T,Ln as E,Ur as ee,Yr as D,_d as O,_f as k,bd as A,gf as te,if as j,lr as ne,md as re,p as M,pn as N,vf as P,vi as F}from"./src-CDmuXEWK.js";import{t as I}from"./i18n-CXvYtPOo.js";import{t as L}from"./useTranslation-BJr-n0es.js";import{Ir as R,Lr as z,S as B,T as V}from"./index-BMAzrKSU.js";import{t as H}from"./AdminSectionedPage-DXlBTxH9.js";import{t as U}from"./AdminPage-Ebi_EBLO.js";import{t as W}from"./NodeAddonsSettingsPanel-DVrIfoG4.js";import{i as G,r as K,t as q}from"./Authentication-B9nMx-wk.js";o();var J={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`},Y={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 X({entry:t,actions:r}){let i=t.name.toLowerCase(),a=J[i]??`border-primary`,o=Y[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(ie,{entry:t,actions:r,activeProvider:s,isPending:c}):n(ae,{entry:t,actions:r,isPending:c})]})}function ie({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=L();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(u,{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(F,{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(F,{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 ae({entry:t,actions:r,isPending:i}){let{t:a}=L();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(ne,{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}=L();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(X,{entry:e,actions:t},e.name))})}var oe=[`capabilities`,`listCapabilities`];function se(e){return e===`singleton`||e===`collection`}function ce(e){let t=e.indexOf(`@`);return t===-1?I.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function le(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ce(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ue(){let{t:r}=L(),o=m(),[s,l]=i(null),[d,f]=i(null),p=a({queryKey:oe,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),_=t(()=>{let e=(p.data??[]).flatMap(e=>se(e.mode)?[le(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]},[p.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),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await p.refetch()},onError:(e,t)=>{f({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),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,t)=>{f({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),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await p.refetch()},onError:(e,t)=>{f({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),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),w={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(U,{embedded:!0,icon:g,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:[d&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${d.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[d.kind===`success`?n(u,{className:`h-3.5 w-3.5 shrink-0`}):n(h,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:d.message})]}),p.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`})}),p.isError&&!p.isLoading&&n(T,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&_.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.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:w})]}),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:w})]})]})]})}var de={escape:`Esc`,enter:`Enter`};function fe(e,t){let n=P(e),r=de[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 pe(){let{t}=L(),r=te(),i=k();return n(w,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:b,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(D,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(E,{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:fe(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var me=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function he(){let{t}=L(),a=s(),o=O(),c=A(),l=re(),[u,f]=i(``),[m,h]=i(``),[g,_]=i(null),v=o.data?.location??null;r(()=>{f(v===null?``:Q(v.latitude)),h(v===null?``:Q(v.longitude))},[v]);let y=async()=>{await a.invalidateQueries({queryKey:me})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(m);if(u.trim()===``||m.trim()===``){_(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){_(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){_(`Longitude must be between -180 and 180 decimal degrees.`);return}_(null),await c.mutateAsync({latitude:t,longitude:n}),await y()},x=async()=>{_(null),await c.mutateAsync(null),await y()},S=async()=>{_(null),await l.mutateAsync(),await y()},w=c.isPending||l.isPending||o.isLoading;return e(ee,{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(p,{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`)})})]}),v===null?n(C,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(C,{variant:v.source===`operator-set`?`success`:`info`,children:v.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),v?.label!==void 0&&v.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:v.label})}):null,v===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(j,{className:`w-40`,value:u,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(j,{className:`w-40`,value:m,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>h(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(F,{type:`submit`,disabled:w,children:t(`common.save`,`Save`)}),e(F,{type:`button`,variant:`ghost`,disabled:w,onClick:S,children:[n(d,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),v===null?null:n(F,{type:`button`,variant:`ghost`,disabled:w,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),g===null?null:n(`p`,{className:`text-xs text-danger`,children:g}),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 ge(e){return y.some(t=>t===e)}function $(e){return N.some(t=>t===e)}function _e(){let{t}=L(),r=M(),[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(w,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:x,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(T,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(T,{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(T,{message:s}),n(E,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;$(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(E,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;ge(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 ve=`system-config`;function ye(){let{t}=L(),{nodes:r,isLoading:i}=S(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ve);return e(U,{embedded:!0,children:[n(he,{}),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(G,{omitSectionIds:[q],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(W,{nodeId:a.id,addonIds:o,level:`global`,omitSectionIds:[q,K]})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(v,{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(_e,{}),n(pe,{})]})]})}function be(){let{t:e}=L(),t=B(`/system/settings`,{t:e,isAdmin:!0})??{icon:v,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=z();return new URLSearchParams(r).get(`tab`)===`secrets`?n(R,{replace:!0,to:`${V(r)}${i}`}):n(H,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(ye,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ue,{})}]})}export{be as SystemPage};
|
|
@@ -1 +0,0 @@
|
|
|
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,o as c,q as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Bt as d,Cn as f,Kt as p,Un as m,Yn as h,ct as g,da as _,di as v,la as y,ot as b,sa as x,ua as S,ut as C}from"./player-overlays-DyXjVBGT.js";import{Cr as w,Dr as T,Fr as E,Nr as D,Or as ee,Pr as te,Sr as ne,dr as re,fr as O,mo as ie,pr as k}from"./client-CblKyG0c.js";import{d as ae}from"./video-DQe86s-A.js";import{n as oe,t as se}from"./shapes-fSR3wuPN.js";import{t as ce}from"./unlink-3TXI314Y.js";import{Br as le,Cd as ue,Ei as de,Fr as fe,Ir as pe,Jr as me,Mt as he,Mu as ge,Pr as _e,Pt as A,Rn as ve,Rr as ye,Sd as be,Yr as xe,Zr as j,af as M,hf as Se,if as N,lr as Ce,mn as P,of as we,vi as F,wd as Te,xd as Ee,xi as De,zn as Oe,zr as ke}from"./src-CDmuXEWK.js";import{t as I}from"./useTranslation-BJr-n0es.js";import{Br as Ae}from"./index-BMAzrKSU.js";import{t as je}from"./AdminPage-Ebi_EBLO.js";import{A as L,C as Me,D as Ne,E as R,O as Pe,S as Fe,T as Ie,_ as Le,a as Re,b as ze,c as Be,d as Ve,f as He,g as Ue,i as We,k as Ge,l as Ke,m as z,n as qe,o as B,p as Je,r as Ye,s as Xe,u as V,v as H,w as Ze,x as Qe,y as $e}from"./EditTemplateButton-iR843K_w.js";s();function et(e){return{past:[],present:e,future:[]}}var tt=e=>e.past.length>0,nt=e=>e.future.length>0;function rt(e,t){switch(t.type){case`edit`:return Object.is(t.value,e.present)?e:{past:[...e.past,e.present].slice(-100),present:t.value,future:[]};case`undo`:{let t=e.past.at(-1);return t===void 0?e:{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}}case`redo`:{let[t,...n]=e.future;return t===void 0?e:{past:[...e.past,e.present],present:t,future:n}}}}var U=12,W=4,G=3,K=(e,t,n,r,i,a={})=>({id:e,role:t,row:n,col:r,colSpan:i,...a}),q=e=>`custom:${e}`;function J(e,t,n=[]){return t.map((t,r)=>K(`r${e}c${r}`,t,e,r*W,W,{...n[r]===void 0?{}:{label:n[r]}}))}function Y(e){return[K(`up`,`up`,e,W,W),K(`left`,`left`,e+1,0,W),K(`ok`,`ok`,e+1,W,W),K(`right`,`right`,e+1,2*W,W),K(`down`,`down`,e+2,W,W)]}function it(e,t){return t.map((t,n)=>K(`app_${t}`,q(`app_${t}`),e,n*G,G,{icon:B(t)}))}var X=(e,t)=>({id:`core:section-divider`,row:e,col:0,options:{scale:{cols:U},title:t}});function at(e,t,n){let r=V(U,e,t);for(let e of n){let t=k(r,re(e.id),{row:e.row,col:e.col},e.options);if(!t.ok)throw Error(`preset component ${e.id} at ${e.row}:${e.col}: ${t.reason}`);r=t.layout}return r}var Z={scale:{cols:W}},ot={scale:{rows:2,cols:W}},st=(e,t,n,r)=>({idSuffix:e,row:3,col:t,rowSpan:1,colSpan:1,role:n,label:r}),ct=at(23,[K(`input`,`input`,0,2*W,W),K(`mute`,`mute`,7,W,W),K(`ch_list`,q(`ch_list`),8,W,W,{label:`CH LIST`}),K(`settings`,q(`settings`),9,W,W,{label:`Settings`}),K(`home`,`home`,10,W,W),K(`guide`,`guide`,12,0,W),K(`e_manual`,q(`e_manual`),12,W,W,{label:`e-Manual`}),K(`info`,`info`,12,2*W,W),K(`back`,`back`,17,0,W),K(`exit`,`exit`,17,2*W,W),K(`color_a`,q(`color_a`),19,0,G,{label:`A`}),K(`color_b`,q(`color_b`),19,G,G,{label:`B`}),K(`color_c`,q(`color_c`),19,2*G,G,{label:`C`}),K(`color_d`,q(`color_d`),19,3*G,G,{label:`D`}),K(`pic_size`,q(`pic_size`),20,0,W,{label:`P.SIZE`}),K(`picture`,q(`picture`),20,W,W,{label:`Picture`}),K(`ad_subt`,q(`ad_subt`),20,2*W,W,{label:`AD/SUBT`})],[{id:`core:power`,row:0,col:0,options:{scale:{cols:2}}},X(1,`Numbers`),{id:`core:keypad`,row:2,col:0,options:{scale:Z.scale,extras:[st(`ttx`,0,q(`ttx_mix`),`TTX/MIX`),st(`prech`,2,q(`pre_ch`),`PRE-CH`)]}},X(6,`Volume and channels`),{id:`core:rocker-volume-v`,row:7,col:0,options:ot},{id:`core:rocker-channel-v`,row:7,col:2*W,options:ot},X(11,`Menus`),X(13,`Navigation`),{id:`core:dpad`,row:14,col:0,options:Z},X(18,`Colour and picture`),X(21,`Playback`),{id:`core:media-transport`,row:22,col:1,options:{scale:{cols:2}}}]),lt=[`netflix`,`youtube`,`primevideo`,`disneyplus`,`dazn`,`raiplay`],ut=at(20,[K(`input`,`input`,0,2*W,W),...J(4,[`menu`,`home`,`exit`]),K(`guide`,`guide`,6,0,W),K(`info`,`info`,6,2*W,W),K(`back`,`back`,10,0,W),K(`play_pause`,`play_pause`,10,2*W,W),K(`mute`,`mute`,12,W,W),K(`ch_list`,q(`ch_list`),13,W,W,{label:`CH.LIST`}),K(`subtitle`,q(`subtitle`),14,0,6,{label:`Subtitle`}),K(`text`,q(`text`),14,6,6,{label:`Text`})],[{id:`core:power`,row:0,col:0,options:{scale:{cols:2}}},{id:`core:panel`,row:1,col:0,options:{scale:Z.scale,title:`Apps`,extras:lt.map((e,t)=>({idSuffix:e,row:Math.floor(t/3),col:t%3,rowSpan:1,colSpan:1,role:q(`app_${e}`),icon:B(e)}))}},{id:`core:colour-keys`,row:3,col:0,options:{scale:{cols:G}}},X(5,`Navigation`),{id:`core:dpad`,row:7,col:0,options:Z},X(11,`Volume and channels`),{id:`core:rocker-volume-v`,row:12,col:0,options:Z},{id:`core:rocker-channel-v`,row:12,col:2*W,options:Z},X(15,`Numbers`),{id:`core:keypad`,row:16,col:0,options:Z}]),dt=V(U,8,[K(`power`,`power`,0,0,W),K(`input`,`input`,0,2*W,W),...Y(1),...J(4,[`back`,`home`,`play_pause`]),K(`vol_up`,`volume_up`,5,0,W),K(`mute`,`mute`,5,W,W,{rowSpan:2}),K(`ch_up`,`channel_up`,5,2*W,W),K(`vol_down`,`volume_down`,6,0,W),K(`ch_down`,`channel_down`,6,2*W,W),...it(7,[`netflix`,`primevideo`,`disneyplus`,`youtube`])]),ft=V(U,9,[K(`power`,`power`,0,0,W),K(`input`,`input`,0,2*W,W),K(`settings`,q(`settings`),1,0,W,{label:`Settings`}),K(`up`,`up`,1,W,W),K(`guide`,`guide`,1,2*W,W),K(`left`,`left`,2,0,W),K(`ok`,`ok`,2,W,W),K(`right`,`right`,2,2*W,W),K(`back`,`back`,3,0,W),K(`down`,`down`,3,W,W),K(`home`,`home`,3,2*W,W),K(`vol_up`,`volume_up`,4,0,W,{rowSpan:2}),K(`vol_down`,`volume_down`,6,0,W,{rowSpan:2}),K(`mute`,`mute`,4,W,W),K(`info`,`info`,5,W,W),K(`menu`,`menu`,6,W,W),K(`exit`,`exit`,7,W,W),K(`ch_up`,`channel_up`,4,2*W,W,{rowSpan:2}),K(`ch_down`,`channel_down`,6,2*W,W,{rowSpan:2}),...it(8,[`netflix`,`primevideo`,`disneyplus`,`youtube`])]),pt=V(U,8,[K(`assistant`,q(`assistant`),0,0,W,{label:`Assistant`}),K(`input`,`input`,0,W,W),K(`power`,`power`,0,2*W,W),...Y(1),...J(4,[`back`,`home`,`guide`]),K(`vol_up`,`volume_up`,5,0,W),K(`mute`,`mute`,5,W,W),K(`ch_up`,`channel_up`,5,2*W,W),K(`vol_down`,`volume_down`,6,0,W),K(`play_pause`,`play_pause`,6,W,W),K(`ch_down`,`channel_down`,6,2*W,W),...it(7,[`youtube`,`netflix`,`primevideo`,`disneyplus`])]),mt=V(U,7,[K(`siri`,q(`siri`),0,0,W,{label:`Siri`}),K(`power`,`power`,0,2*W,W),...Y(1),...J(4,[`back`,`play_pause`,`home`]),K(`vol_up`,`volume_up`,5,0,6),K(`vol_down`,`volume_down`,5,6,6),K(`mute`,`mute`,6,W,W)]);function ht(e){return J(e,[`digit_1`,`digit_2`,`digit_3`]).concat(J(e+1,[`digit_4`,`digit_5`,`digit_6`]),J(e+2,[`digit_7`,`digit_8`,`digit_9`]))}function gt(e){return[`a`,`b`,`c`,`d`].map((t,n)=>K(`color_${t}`,q(`color_${t}`),e,n*G,G,{label:t.toUpperCase()}))}var _t=V(U,18,[K(`power`,`power`,0,0,W),K(`input`,`input`,0,2*W,W),...ht(1),K(`ttx_mix`,q(`ttx_mix`),4,0,W,{label:`TTX/MIX`}),K(`digit_0`,`digit_0`,4,W,W),K(`pre_ch`,q(`pre_ch`),4,2*W,W,{label:`PRE-CH`}),K(`vol_up`,`volume_up`,5,0,W),K(`mute`,`mute`,5,W,W,{rowSpan:2}),K(`ch_up`,`channel_up`,5,2*W,W),K(`vol_down`,`volume_down`,6,0,W),K(`ch_down`,`channel_down`,6,2*W,W),K(`ch_list`,q(`ch_list`),7,W,W,{label:`CH LIST`}),K(`settings`,q(`settings`),8,0,W,{label:`Settings`}),K(`home`,`home`,8,W,W),K(`guide`,`guide`,8,2*W,W),...Y(9),K(`back`,`back`,12,0,W),K(`info`,`info`,12,W,W),K(`exit`,`exit`,12,2*W,W),...J(13,[`rewind`,`play`,`fast_forward`]),K(`pause`,`pause`,14,0,6),K(`stop`,`stop`,14,6,6),...gt(15),K(`ad_subt`,q(`ad_subt`),16,0,12,{label:`AD/SUBT`}),K(`app_netflix`,q(`netflix`),17,0,W,{icon:B(`netflix`)}),K(`app_prime`,q(`prime_video`),17,W,W,{icon:B(`primevideo`)}),K(`samsung_tv_plus`,q(`samsung_tv_plus`),17,2*W,W,{label:`TV Plus`})]),vt=V(U,18,[K(`power`,`power`,0,0,W),K(`input`,`input`,0,2*W,W),K(`app_youtube`,q(`youtube`),1,0,6,{icon:B(`youtube`)}),K(`app_netflix`,q(`netflix`),1,6,6,{icon:B(`netflix`)}),...J(2,[`menu`,`home`,`exit`]),K(`settings`,q(`settings`),3,0,W,{label:`Settings`}),K(`guide`,`guide`,3,W,W),K(`info`,`info`,3,2*W,W),...Y(4),K(`back`,`back`,7,0,W),K(`ch_list`,q(`ch_list`),7,W,W,{label:`CH.LIST`}),K(`media`,q(`media`),7,2*W,W,{label:`Media`}),K(`vol_up`,`volume_up`,8,0,W),K(`mute`,`mute`,8,W,W,{rowSpan:2}),K(`ch_up`,`channel_up`,8,2*W,W),K(`vol_down`,`volume_down`,9,0,W),K(`ch_down`,`channel_down`,9,2*W,W),...ht(10),K(`sleep`,q(`sleep`),13,0,W,{label:`Sleep`}),K(`digit_0`,`digit_0`,13,W,W),K(`subtitle`,q(`subtitle`),13,2*W,W,{label:`Subtitle`}),K(`txt`,q(`txt`),14,0,6,{label:`Text`}),K(`rec`,q(`rec`),14,6,6,{label:`Rec`}),...J(15,[`rewind`,`play`,`fast_forward`]),K(`pause`,`pause`,16,0,6),K(`stop`,`stop`,16,6,6),...gt(17)]),yt=[{id:`samsung-classic`,layout:ct},{id:`hisense-vidaa`,layout:ut},{id:`samsung-bn59-01315`,layout:_t},{id:`hisense-erf3-vidaa`,layout:vt},{id:`samsung-smart`,layout:dt},{id:`lg-magic`,layout:ft},{id:`google-tv`,layout:pt},{id:`apple-tv`,layout:mt}];function bt(e){let t=yt.find(t=>t.id===e);return t===void 0?null:{...t.layout,buttons:t.layout.buttons.map(e=>({...e}))}}function xt(e){let t=new Map;for(let n of e)for(let e of n)t.has(e.id)||t.set(e.id,e);let n=[...t.values()];return[...n.filter(e=>e.id.startsWith(`core:`)),...n.filter(e=>!e.id.startsWith(`core:`))]}function St(e,t){let n=e.nameI18n;return n===void 0?e.name:t.startsWith(`it`)?n.it:n.en}function Ct(e){let t=k({columns:e.size.cols,rows:e.size.rows,buttons:[]},e,{row:0,col:0});return t.ok?t.layout:null}function wt(e,t,n,r){let i=t.trim().toLowerCase();return i===``?[...e]:e.filter(e=>St(e,n).toLowerCase().includes(i)||r(e.category).toLowerCase().includes(i))}function Tt(e,t){let n=O(e,t);return n!==null&&n>1}function Et(e,t,n={}){let r=n.fillWidth===!0?O(e,t):null,i=r===null||r<2?{}:{scale:{cols:r}};if(n.at!==void 0)return k(e,t,n.at,i);let a=k(e,t,{row:0,col:0},i);if(a.ok||a.reason===`outside`||a.reason===`too-many`)return a;for(let n=0;n<e.rows;n+=1)for(let r=0;r<e.columns;r+=1){let a=k(e,t,{row:n,col:r},i);if(a.ok)return a}return a}function Dt({open:t,grid:n,onOpenChange:r,onPick:a}){let{t:o,i18n:s}=I();return i(_e,{open:t,onOpenChange:r,children:e(pe,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(ke,{children:i(le,{children:o(`remote.palette.title`)})}),i(fe,{children:t&&i(Ot,{grid:n,language:s.language,onPick:a})})]})})}function Ot({grid:t,language:r,onPick:a}){let{t:s}=I(),c=ge({}),[l,u]=o(``),[d,p]=o(!1),[m,h]=o(null),g=e=>s(`remote.palette.category.${e}`,e),_=wt(n(()=>xt(c.data===void 0?[]:[c.data]),[c.data]),l,r,g),v=_.some(e=>Tt(t,e));return c.isError?i(me,{title:s(`remote.palette.errorTitle`),message:c.error.message,onRetry:()=>void c.refetch()}):c.data===void 0?e(`div`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-loading`,children:[i(j,{className:`h-24`}),i(j,{className:`h-24`}),i(j,{className:`h-24`}),i(j,{className:`h-24`})]}):e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`relative`,children:[i(f,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(N,{value:l,className:`pl-8`,placeholder:s(`remote.palette.search`),"aria-label":s(`remote.palette.search`),onChange:e=>u(e.target.value),"data-testid":`palette-search`})]}),v&&e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-muted`,children:[i(Ce,{checked:d,onChange:e=>p(e.target.checked),"data-testid":`palette-fill-width`}),s(`remote.palette.fillWidth`)]}),m!==null&&i(`p`,{role:`status`,className:`text-xs text-success`,"data-testid":`palette-added`,children:s(`remote.palette.added`,{name:m})}),_.length===0?i(xe,{icon:se,title:s(`remote.palette.emptyTitle`),description:s(`remote.palette.emptyDescription`)}):i(`ul`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-list`,children:_.map(e=>i(`li`,{children:i(kt,{component:e,language:r,category:g(e.category),onPick:()=>{a(e,{fillWidth:d}),h(St(e,r))}})},e.id))})]})}function kt({component:t,language:r,category:a,onPick:o}){let{t:s}=I(),c=n(()=>Ct(t),[t]),l=St(t,r);return e(`button`,{type:`button`,className:`flex h-full w-full items-center gap-3 rounded-lg border border-border bg-surface p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"data-testid":`palette-item-${t.id}`,onClick:o,children:[i(`span`,{className:`w-20 shrink-0`,children:c!==null&&i(Ye,{grid:c,label:l,compact:!0})}),e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:l}),e(`span`,{className:`block truncate text-xs text-foreground-muted`,children:[a,` ·`,` `,s(`remote.palette.size`,{cols:t.size.cols,rows:t.size.rows})]})]})]})}function Q(e,t){let n=t.kind===`group`?z(e,t.id):e.buttons.find(e=>e.id===t.id);return n===void 0?void 0:{row:n.row,col:n.col,rowSpan:n.rowSpan,colSpan:n.colSpan}}function At(e,t,n,r,i){if(e.width<=0||e.height<=0)return{row:0,col:0};let a=Math.floor((n-e.left)/e.width*t.columns),o=(r-e.top)/e.height;if(i===void 0||i.length!==t.rows||o<0)return{col:a,row:Math.floor(o*t.rows)};let s=i.reduce((e,t)=>e+t,0),c=0;for(let[e,t]of i.entries())if(c+=t/s,o<c)return{col:a,row:e};return{col:a,row:Math.max(t.rows,Math.floor(o*t.rows))}}function jt(e,t,n){return{row:n.row-(t.row-e.row),col:n.col-(t.col-e.col)}}function Mt(e,t,n){return t.kind===`group`?Qe(e,t.id,n.row,n.col):ze(e,t.id,n.row,n.col)}function Nt(e,t,n){let r=Q(e,t);if(r===void 0)return null;let i=Mt(e,t,n);return{rect:{...r,row:n.row,col:n.col},valid:i.status===`ok`,reason:i.status===`ok`?null:i.reason}}function Pt(e){switch(e){case`ArrowUp`:return{dRow:-1,dCol:0};case`ArrowDown`:return{dRow:1,dCol:0};case`ArrowLeft`:return{dRow:0,dCol:-1};case`ArrowRight`:return{dRow:0,dCol:1};default:return null}}function Ft(e,t,n,r){let i=Q(e,t);return i===void 0?{status:`refused`,reason:`unknown-button`}:Mt(e,t,{row:i.row+n,col:i.col+r})}s();var It=4;function Lt(e,n,i){let[s,c]=o(null),l=t({grid:e,onDrop:i});l.current={grid:e,onDrop:i};let u=t(null),d=t(!1);return a(()=>()=>u.current?.(),[]),{drag:s,onItemPointerDown:r((e,t)=>{let r=n.current;if(r===null||t.button!==0)return;let i=r.getBoundingClientRect();if(Q(l.current.grid,e)===void 0)return;let a={item:e,startX:t.clientX,startY:t.clientY,grabbed:At(i,l.current.grid,t.clientX,t.clientY,Ie(l.current.grid)),active:!1,target:null},o=e=>{if(!a.active){if(Math.hypot(e.clientX-a.startX,e.clientY-a.startY)<It)return;a.active=!0}let t=l.current.grid,n=At(r.getBoundingClientRect(),t,e.clientX,e.clientY,Ie(t)),i=Q(t,a.item);i!==void 0&&(a.target=jt(i,a.grabbed,n),c({item:a.item,preview:Nt(t,a.item,a.target)}))},s=e=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,p),window.removeEventListener(`keydown`,m),u.current=null,c(null),a.active&&(d.current=!0,window.setTimeout(()=>{d.current=!1},0),e&&a.target!==null&&l.current.onDrop(Mt(l.current.grid,a.item,a.target)))},f=()=>s(!0),p=()=>s(!1),m=e=>{e.key===`Escape`&&s(!1)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,p),window.addEventListener(`keydown`,m),u.current=()=>s(!1)},[n]),consumeDragClick:r(()=>{let e=d.current;return d.current=!1,e},[])}}s();var Rt=`__custom__`;function zt({value:n,onChange:r}){let{t:a}=I(),[s,c]=o(null),[l,u]=o(null),[d,f]=o(!1),p=t(null),h=s?.kind===`button`?s.id:null,g=s?.kind===`group`?s.id:null,_=n.buttons.find(e=>e.id===h)??null,v=g===null?void 0:z(n,g),y=(e,t)=>{if(e.status===`ok`){u(null),r(e.grid),t?.(e.grid);return}u(a(`remote.layout.refusal.${e.reason}`))},b=Lt(n,p,e=>y(e));return e(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-2`,children:[i(A,{label:a(`remote.layout.columns`),children:i(P,{value:n.columns,onDelta:e=>y(Ze(n,n.columns+e,n.rows))})}),i(A,{label:a(`remote.layout.rows`),children:i(P,{value:n.rows,onDelta:e=>y(Ze(n,n.columns,n.rows+e))})})]}),i(Ye,{grid:n,label:a(`remote.layout.previewLabel`),selectedId:h,selectedGroupId:g,onSelect:e=>{b.consumeDragClick()||c({kind:`button`,id:e})},onSelectGroup:e=>{b.consumeDragClick()||c({kind:`group`,id:e})},showEmptyCells:!0,gridRef:p,drag:b.drag,onItemPointerDown:b.onItemPointerDown,onItemKeyDown:(e,t)=>{let r=Pt(t.key);r!==null&&(t.preventDefault(),y(Ft(n,e,r.dRow,r.dCol)))}}),i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.dragHint`)}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(F,{variant:`outline`,size:`sm`,onClick:()=>f(!0),"data-testid":`remote-add-component`,children:[i(se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addComponent`)]}),e(F,{variant:`outline`,size:`sm`,onClick:()=>y(Ke(n,`ok`),e=>{let t=e.buttons.at(-1);c(t===void 0?null:{kind:`button`,id:t.id})}),"data-testid":`remote-add-button`,children:[i(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addButton`)]})]}),l!==null&&i(`p`,{role:`alert`,className:`text-xs text-warning`,"data-testid":`remote-layout-refusal`,children:l})]}),i(`div`,{className:`min-w-0`,children:_===null?v===void 0?i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.selectHint`)}):i(Ht,{grid:n,groupId:v.id,apply:y,onGone:()=>c(null)}):i(Vt,{grid:n,buttonId:_.id,apply:y,onRemove:()=>{r(Fe(n,_.id)),c(null),u(null)}})}),i(Dt,{open:d,grid:n,onOpenChange:f,onPick:(e,t)=>{let i=Et(n,e,t);if(!i.ok){u(a(`remote.layout.refusal.${i.reason}`));return}u(null),r(i.layout);let o=i.buttonIds[0];c(i.groupId===null?o===void 0?null:{kind:`button`,id:o}:{kind:`group`,id:i.groupId})}})]})}function Bt(e,t){return[...Be.flatMap(n=>Le(n).map(r=>({value:r,label:We(r,t),group:e(`remote.roleGroup.${n}`)}))),{value:Rt,label:e(`remote.layout.customRole`),group:e(`remote.roleGroup.custom`)}]}function Vt({grid:t,buttonId:n,apply:r,onRemove:a}){let{t:s,i18n:c}=I(),l=t.buttons.find(e=>e.id===n),u=l===void 0?null:D(l.role),[d,f]=o(null);if(l===void 0)return null;let m=Ue(l.role)||d!==null,h=d??u??``,g=E(h),v={trigger:s(`remote.layout.pickIcon`),panel:s(`remote.layout.iconPanel`),searchPlaceholder:s(`deviceDisplay.iconSearchPlaceholder`),clear:s(`remote.layout.noIcon`),noMatches:s(`deviceDisplay.iconNoMatches`)},b=e=>s(`deviceDisplay.iconCategory.${e}`,{defaultValue:ie(e)});return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-inspector`,children:[i(De,{mode:`single`,singleDisplay:`field`,label:s(`remote.layout.role`),options:Bt((e,t)=>s(e,t??e),c.language),value:m?Rt:l.role,onChange:e=>{if(e===Rt){f(u??``);return}f(null),r(R(t,l.id,{role:e}))}}),m&&i(A,{label:s(`remote.layout.customKey`),...h!==``&&!g?{error:s(`remote.layout.customKeyInvalid`)}:{},children:i(N,{value:h,placeholder:`hdmi_1`,onChange:e=>{let n=e.target.value;f(n),E(n)&&r(R(t,l.id,{role:te(n)}))}})}),e(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-end gap-2`,children:[i(A,{label:s(`remote.layout.icon`),children:i(we,{value:l.icon??null,onPick:e=>r(R(t,l.id,{icon:e})),fallbackGlyph:se,categoryLabel:b,labels:v})}),i(A,{label:s(`remote.layout.label`),children:i(N,{value:l.label??``,maxLength:40,onChange:e=>r(R(t,l.id,{label:e.target.value}))})})]}),i(A,{label:s(`remote.layout.appIcon`),children:i(C,{value:Xe(l.icon)?.key??``,options:[{value:``,label:s(`remote.layout.noApp`)},...Re.map(e=>({value:e.key,label:e.label}))],onChange:e=>{let n=e.target.value;n===``?Xe(l.icon)!==void 0&&r(R(t,l.id,{icon:null})):r(R(t,l.id,{icon:B(n)}))},"data-testid":`remote-app-icon`})}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(A,{label:s(`remote.layout.shape`),children:i(C,{value:l.shape??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...T.map(e=>({value:e,label:s(`remote.layout.shapes.${e}`)}))],onChange:e=>{let n=T.find(t=>t===e.target.value);r(Ne(t,l.id,{shape:n??null}))},"data-testid":`remote-shape`})}),i(A,{label:s(`remote.layout.tone`),children:i(C,{value:l.tone??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...ee.map(e=>({value:e,label:s(`remote.layout.tones.${e}`)}))],onChange:e=>{let n=ee.find(t=>t===e.target.value);r(Ne(t,l.id,{tone:n??null}))},"data-testid":`remote-tone`})})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(A,{label:s(`remote.layout.move`),children:e(`div`,{className:`flex items-center gap-1`,children:[i(M,{icon:S,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveLeft`),onClick:()=>r(L(t,l.id,0,-1))}),i(M,{icon:x,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveUp`),onClick:()=>r(L(t,l.id,-1,0))}),i(M,{icon:_,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveDown`),onClick:()=>r(L(t,l.id,1,0))}),i(M,{icon:y,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveRight`),onClick:()=>r(L(t,l.id,0,1))})]})}),i(A,{label:s(`remote.layout.position`),children:i(`p`,{className:`text-xs text-foreground-muted`,"data-testid":`remote-position`,children:s(`remote.layout.positionValue`,{row:l.row+1,col:l.col+1})})}),i(A,{label:s(`remote.layout.height`),children:i(P,{value:l.rowSpan,onDelta:e=>r(Me(t,l.id,l.rowSpan+e,l.colSpan))})}),i(A,{label:s(`remote.layout.width`),children:i(P,{value:l.colSpan,onDelta:e=>r(Me(t,l.id,l.rowSpan,l.colSpan+e))})})]}),e(F,{variant:`danger`,size:`sm`,onClick:a,children:[i(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),s(`remote.layout.removeButton`)]})]})}function Ht({grid:t,groupId:n,apply:r,onGone:a}){let{t:o}=I(),s=z(t,n);if(s===void 0)return null;let c=$e(t,n).length;return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-group-inspector`,children:[i(`p`,{className:`text-xs text-foreground-muted`,children:o(`remote.layout.groupSummary`,{frame:o(`remote.layout.frames.${s.frame}`,s.frame),count:c,row:s.row+1,col:s.col+1})}),i(A,{label:o(`remote.layout.groupTitle`),children:i(N,{value:s.title??``,maxLength:40,onChange:e=>r(Pe(t,s.id,e.target.value)),"data-testid":`remote-group-title`})}),s.frame===`divider`&&e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(A,{label:o(`remote.layout.separatorSize`),children:i(C,{value:s.size??`compact`,options:[{value:`compact`,label:o(`remote.layout.separatorSizeCompact`)},{value:`normal`,label:o(`remote.layout.separatorSizeNormal`)}],onChange:e=>r(Ge(t,s.id,{size:e.target.value===`normal`?`normal`:`compact`})),"data-testid":`remote-separator-size`})}),e(`label`,{className:`flex items-center gap-2 self-end pb-2 text-xs text-foreground-muted`,children:[i(Ce,{checked:s.hideTitle===!0,onChange:e=>r(Ge(t,s.id,{hideTitle:e.target.checked})),"data-testid":`remote-separator-hide-title`}),o(`remote.layout.separatorHideLabel`)]})]}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(F,{variant:`outline`,size:`sm`,"data-testid":`remote-group-ungroup`,onClick:()=>{r(He(t,s.id,!0)),a()},children:[i(ce,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.ungroup`)]}),e(F,{variant:`danger`,size:`sm`,"data-testid":`remote-group-delete`,onClick:()=>{r(He(t,s.id,!1)),a()},children:[i(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.deleteGroup`)]})]})]})}var Ut={remote:{label:e=>e(`remote.templates.kind.remote`),emptyPayload:Je,summary:(e,t)=>{let n=H(e);return t(`remote.templates.layoutSummary`,{columns:n.columns,rows:n.rows,count:n.buttons.length})},renderEditor:(e,t)=>i(zt,{value:H(e),onChange:t}),isSavable:e=>Ve(H(e))!==null,presets:e=>yt.map(t=>({id:t.id,label:e(`remote.templates.preset.${t.id}`),payload:()=>bt(t.id)}))}};function $(e){return Ut[e]}var Wt=ne;function Gt(e,t){let n=w(e,t);return n.ok?n.payload:null}s();function Kt({draft:e,saving:t,error:n,onSave:r,onClose:a}){return i(_e,{open:e!==null,onOpenChange:e=>!e&&a(),children:i(pe,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&i(qt,{draft:e,saving:t,error:n,onSave:r,onClose:a},e.id??`new`)})})}function qt({draft:t,saving:n,error:r,onSave:a,onClose:s}){let{t:c}=I(),[f,p]=o(t.name),[m,h]=l(rt,{kind:t.kind,presetId:``,payload:t.payload},et),{kind:g,presetId:_,payload:v}=m.present,y=e=>h({type:`edit`,value:{...m.present,payload:e}}),b=()=>h({type:`undo`}),x=()=>h({type:`redo`});Se(`mod+z`,b,{allowInInput:!1,label:`Undo`}),Se(`mod+shift+z`,x,{allowInInput:!1,label:`Redo`});let S=$(g),w=S.presets(c),T=Gt(g,v),E=f.trim()!==``&&T!==null&&S.isSavable(v)&&!n;return e(u,{children:[e(ke,{className:`flex-row items-center justify-between gap-2`,children:[i(le,{children:t.id===null?c(`remote.templates.newTitle`):c(`remote.templates.editTitle`)}),e(`div`,{className:`flex shrink-0 items-center gap-1`,children:[i(M,{icon:d,size:`sm`,variant:`ghost`,"aria-label":c(`remote.history.undo`),title:c(`remote.history.undo`),disabled:!tt(m),onClick:b,"data-testid":`template-undo`}),i(M,{icon:oe,size:`sm`,variant:`ghost`,"aria-label":c(`remote.history.redo`),title:c(`remote.history.redo`),disabled:!nt(m),onClick:x,"data-testid":`template-redo`})]})]}),e(fe,{className:`space-y-4`,children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(A,{label:c(`remote.templates.name`),children:i(N,{value:f,maxLength:120,onChange:e=>p(e.target.value),"data-testid":`template-name`})}),t.id===null&&Wt.length>1&&i(A,{label:c(`remote.templates.kind.label`),children:i(C,{value:g,options:Wt.map(e=>({value:e,label:$(e).label(c)})),onChange:e=>{let t=Wt.find(t=>t===e.target.value);t!==void 0&&h({type:`edit`,value:{kind:t,presetId:``,payload:$(t).emptyPayload()}})}})}),t.id===null&&w.length>0&&i(A,{label:c(`remote.templates.startFrom`),children:i(C,{value:_,options:[{value:``,label:c(`remote.templates.startBlank`)},...w.map(e=>({value:e.id,label:e.label}))],onChange:e=>{let t=w.find(t=>t.id===e.target.value);h({type:`edit`,value:{kind:g,presetId:t?.id??``,payload:t===void 0?S.emptyPayload():t.payload()}}),t!==void 0&&f.trim()===``&&p(t.label)},"data-testid":`template-preset`})})]}),S.renderEditor(v,y),r!==null&&i(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]}),e(ye,{children:[i(F,{variant:`ghost`,onClick:s,children:c(`common.cancel`)}),i(F,{disabled:!E,onClick:()=>a({id:t.id,kind:g,name:f.trim(),payload:T}),"data-testid":`template-save`,children:c(`common.save`)})]})]})}s();var Jt=ne[0];function Yt(){let{t}=I(),r=c(),s=ue({}),l=Ee(),u=Te(),d=be(),f=g(),_=b(),[y,x]=o(null),[S,C]=o(null),[w,T]=Ae(),E=w.get(qe);a(()=>{if(E===null||s.data===void 0)return;let e=s.data.find(e=>e.id===E);e!==void 0&&x({id:e.id,kind:e.kind,name:e.name,payload:e.payload}),T(e=>{let t=new URLSearchParams(e);return t.delete(qe),t},{replace:!0})},[E,s.data,T]);let D=()=>void r.invalidateQueries({queryKey:[[`template`]]}),ee=async e=>{C(null);try{let t=e.id===null?await l.mutateAsync({kind:e.kind,name:e.name,payload:e.payload}):await u.mutateAsync({id:e.id,name:e.name,payload:e.payload});if(t.status===`refused`){C(t.detail);return}D(),x(null)}catch(e){C(e instanceof Error?e.message:String(e))}},te=async e=>{try{await l.mutateAsync({kind:e.kind,name:t(`remote.templates.copyName`,{name:e.name}),payload:e.payload}),D()}catch(e){await _({title:t(`remote.templates.duplicateFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},ne=async e=>{if(await f({title:t(`remote.templates.deleteTitle`,{name:e.name}),message:t(`remote.templates.deleteMessage`),confirmLabel:t(`common.delete`),variant:`danger`}))try{let n=await d.mutateAsync({id:e.id});if(n.status===`in-use`){await _({title:t(`remote.templates.inUseTitle`,{name:e.name}),message:t(`remote.templates.inUseMessage`,{devices:n.devices.map(e=>e.name).join(`, `)}),variant:`warning`});return}D()}catch(e){await _({title:t(`remote.templates.deleteFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},re=n(()=>[{key:`name`,header:t(`remote.templates.name`),sortValue:e=>e.name.toLowerCase(),render:e=>i(`span`,{className:`font-medium text-foreground`,children:e.name})},{key:`kind`,header:t(`remote.templates.kind.label`),sortValue:e=>e.kind,render:e=>i(de,{variant:`neutral`,children:$(e.kind).label(t)})},{key:`summary`,header:t(`remote.templates.summary`),notSortableReason:`A sentence built from the payload.`,render:e=>i(`span`,{className:`text-foreground-muted`,children:$(e.kind).summary(e.payload,t)})},{key:`updated`,header:t(`remote.templates.updated`),sortValue:e=>e.updatedAt,render:e=>i(`span`,{className:`text-foreground-muted`,children:new Date(e.updatedAt).toLocaleDateString()})},{key:`actions`,align:`right`,notSortableReason:`Row actions.`,render:e=>i(he,{title:t(`remote.templates.actionsFor`,{name:e.name}),items:[{id:`edit`,label:t(`common.edit`),icon:h,onClick:()=>{C(null),x({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}},{id:`duplicate`,label:t(`remote.templates.duplicate`),icon:v,onClick:()=>void te(e)},{id:`delete`,label:t(`common.delete`),icon:p,danger:!0,onClick:()=>void ne(e)}]})}],[t]),O=s.data??[],ie=()=>{C(null),x({id:null,kind:Jt,name:``,payload:$(Jt).emptyPayload()})};return e(je,{icon:ae,title:t(`remote.templates.title`),subtitle:t(`remote.templates.subtitle`),actions:e(F,{size:`sm`,onClick:ie,"data-testid":`template-new`,children:[i(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`remote.templates.new`)]}),children:[s.status===`error`?i(me,{title:t(`remote.templates.loadFailed`),message:s.error.message,onRetry:()=>void s.refetch()}):s.data===void 0?i(j,{className:`h-32 w-full`}):O.length===0?i(xe,{icon:ae,title:t(`remote.templates.emptyTitle`),description:t(`remote.templates.emptyDescription`),action:i(F,{size:`sm`,onClick:ie,children:t(`remote.templates.new`)})}):i(ve,{columns:re,rows:O,rowKey:e=>e.id,maxBodyHeight:Oe,defaultSort:{columnKey:`name`,dir:`asc`},onRowClick:e=>{C(null),x({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}}),i(Kt,{draft:y,saving:l.isPending||u.isPending,error:S,onSave:e=>void ee(e),onClose:()=>x(null)})]})}export{Yt as TemplatesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ga as e}from"./player-overlays-DyXjVBGT.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};
|