@camstack/addon-admin-ui 1.1.26 → 1.1.27
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/dist/assets/{AddLocationWizard-BLLOWMqU.js → AddLocationWizard-CINm21H1.js} +1 -1
- package/dist/assets/{AddonCollectionPage-DkFc3EyC.js → AddonCollectionPage-BkUO0Tru.js} +1 -1
- package/dist/assets/{Addons-DDSoi3Du.js → Addons-6GwyCrFZ.js} +1 -1
- package/dist/assets/{AdminTabs-CdgYb0ow.js → AdminTabs-mgvEpBDZ.js} +1 -1
- package/dist/assets/{BrokerForm-DUfRi9ps.js → BrokerForm-1o4dgBsn.js} +1 -1
- package/dist/assets/{Capabilities-DFnvlplf.js → Capabilities-Hll85kIK.js} +1 -1
- package/dist/assets/{CapabilityBadges-9yltt4Fp.js → CapabilityBadges-D7EsQrNT.js} +1 -1
- package/dist/assets/{Cluster-aXNH3Hn_.js → Cluster-J7bWxCyF.js} +1 -1
- package/dist/assets/{Dashboard-BnShjVgK.js → Dashboard-CJnGC7ye.js} +1 -1
- package/dist/assets/{Data-CoQK3ysi.js → Data-CcoeTmaj.js} +1 -1
- package/dist/assets/{DetectionIntelligence-DsnrlJl7.js → DetectionIntelligence-DV0-5hhZ.js} +1 -1
- package/dist/assets/{DeviceDetail-BE0DmclC.js → DeviceDetail-Cg4_si18.js} +1 -1
- package/dist/assets/{Devices-CS42SuEX.js → Devices-BetTA0QM.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CanuO_TA.js → EmbedPlayerPage-DC8HQG9A.js} +1 -1
- package/dist/assets/{FormBuilder-BYpwuMQM.js → FormBuilder-CL6dlXwQ.js} +1 -1
- package/dist/assets/{Identity-BjbacBt4.js → Identity-Cnr-q0hs.js} +1 -1
- package/dist/assets/{IntegrationDetail-DT8sJvMf.js → IntegrationDetail-CyVsgPEp.js} +1 -1
- package/dist/assets/{Integrations-DoZeK5Ie.js → Integrations-B9NKf_18.js} +1 -1
- package/dist/assets/{Integrations-UyRVYFuF.js → Integrations-m0TAjBFs.js} +1 -1
- package/dist/assets/{Logs-t2ZIKJm-.js → Logs-NBZRysED.js} +1 -1
- package/dist/assets/{MotionZonesSettings-Cr5A0bd3.js → MotionZonesSettings-XX_gd-OU.js} +1 -1
- package/dist/assets/{MyAccess-BkfQKq0X.js → MyAccess-MnFNVCPV.js} +1 -1
- package/dist/assets/{Network-DB7Bb_49.js → Network-BnuGSw90.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-2bieWYkX.js → NodeAddonsSettingsPanel-5OLeCWWK.js} +1 -1
- package/dist/assets/{NotificationTargets-vsJ_Dnl4.js → NotificationTargets-DcnKusHA.js} +1 -1
- package/dist/assets/{Pipeline-D3Zh7_DC.js → Pipeline-Dl9S29Wb.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-DYFTw_Gn.js → PrivacyMaskSettings-BdV7p1W_.js} +1 -1
- package/dist/assets/{ProviderIcon-BHDS5Z0G.js → ProviderIcon-AXlCHsTd.js} +1 -1
- package/dist/assets/{ScanNetworkModal-BMkqK2zC.js → ScanNetworkModal-tDFKEL2L.js} +1 -1
- package/dist/assets/{Settings-BBFPupkN.js → Settings-Cq9lEA2q.js} +1 -1
- package/dist/assets/{Showroom-CkG5E4ny.js → Showroom-Bgf-mV2W.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DTfChhSB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CUYaV0wb.js} +1 -1
- package/dist/assets/circle-check-big-6ez5bWMa.js +1 -0
- package/dist/assets/{copy-BmhRdhEP.js → copy-BwY737s-.js} +1 -1
- package/dist/assets/{dist-DBwmv4oI.js → dist-7sVMyhkP.js} +1 -1
- package/dist/assets/dist-Bp7iSHw-.js +7 -0
- package/dist/assets/{download-BBBdRPko.js → download-CDTSR7Xa.js} +1 -1
- package/dist/assets/{hostInit-BGdKqsfs.js → hostInit-C_DOKr_T.js} +1 -1
- package/dist/assets/{index-CB8rHudv.js → index-Da6GKRLl.js} +3 -3
- package/dist/assets/{key-round-C6sHSGAY.js → key-round-CRs7h4JP.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-0a971570.js → mf-entry-bootstrap-0-f15090ce.js} +2 -2
- package/dist/assets/{pencil-CTMhFkjD.js → pencil-DR7yGacK.js} +1 -1
- package/dist/assets/{player-overlays-CpxC1ZVd.js → player-overlays-CqpHdvYF.js} +1 -1
- package/dist/assets/plus-CekuJPnw.js +1 -0
- package/dist/assets/{radio-DhJBlJcG.js → radio-Bzq_SNgq.js} +1 -1
- package/dist/assets/{refresh-cw-4PFnjcCn.js → refresh-cw-DH7JcsAT.js} +1 -1
- package/dist/assets/remoteEntry-DCvysifo.js +1 -0
- package/dist/assets/{rotate-ccw-V8i9NHCh.js → rotate-ccw-C9Gcb3tJ.js} +1 -1
- package/dist/assets/rotate-cw-CTrqUHcp.js +1 -0
- package/dist/assets/search-B5TMrljD.js +1 -0
- package/dist/assets/{server-DIdemqSW.js → server-Crr45iTm.js} +1 -1
- package/dist/assets/{sparkles-CyW8l4Z-.js → sparkles-C5A0sFZJ.js} +1 -1
- package/dist/assets/{square-check-big-DknZIVfm.js → square-check-big-B8Q-LJXA.js} +1 -1
- package/dist/assets/square-jObXvdFU.js +1 -0
- package/dist/assets/{src-ypI5eXyJ.js → src-9Nw_7MUt.js} +10 -10
- package/dist/assets/src-DYcadIAu.js +7 -0
- package/dist/assets/{upload-ChN3wzau.js → upload-BWN1zN1a.js} +1 -1
- package/dist/assets/{use-persisted-flow-layout-CuTJbVd3.js → use-persisted-flow-layout-DuQZXkHq.js} +1 -1
- package/dist/assets/{useDevice-CAFOrYD_.js → useDevice-LyxwBrYX.js} +1 -1
- package/dist/assets/{useEventInvalidation-CJ7VfCpl.js → useEventInvalidation-CoNLHhyv.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-D--9iyFd.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BMXZuPDZ.js} +2 -2
- package/dist/assets/{wifi-C1TF0nps.js → wifi-G6nDQGOi.js} +1 -1
- package/dist/assets/{zap-B3Ch0kb4.js → zap-JlTWX6I9.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +39 -2
- package/package.json +1 -1
- package/dist/assets/circle-check-big-CFZgrxz8.js +0 -1
- package/dist/assets/dist-BBSYPQfM.js +0 -7
- package/dist/assets/plus-B6B4NTpl.js +0 -1
- package/dist/assets/remoteEntry-DWYulF9l.js +0 -1
- package/dist/assets/rotate-cw-Ds_lhjJG.js +0 -1
- package/dist/assets/search-lmDzeAc6.js +0 -1
- package/dist/assets/square-BzGlGJec.js +0 -1
- package/dist/assets/src-BB7sQJiE.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{An as e,En as t,Kt as n,Xt as r,Zt as i,gn as a,mn as o,on as s}from"./src-ypI5eXyJ.js";import{I as c,K as l,Q as u,S as d,W as f,b as p,q as m,x as h,z as g}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as _}from"./download-BBBdRPko.js";import{t as v}from"./refresh-cw-4PFnjcCn.js";import{D as y,F as b,N as x,V as S,i as C,o as w,x as T}from"./index-CB8rHudv.js";import{t as E}from"./FormBuilder-BYpwuMQM.js";import{t as D}from"./BrokerForm-DUfRi9ps.js";var O=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);u();var k=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],A=`/addon/import-alexa`,j=2e3;function M(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function N(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function P(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function F(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function I(e,t,n){let r=await fetch(`${A}${e}`,{method:`POST`,headers:F(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function L(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${A}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!N(i))throw Error(`Unexpected status response from server`);return i}async function R(e){try{await fetch(`${A}/login/cancel`,{method:`POST`,headers:F(),body:JSON.stringify({sessionId:e})})}catch{}}function z({brokerId:e,onResolved:t,onCancel:n}){let[r,i]=m(`amazon.it`),[a,o]=m(`Alexa account`),[s,u]=m({kind:`idle`}),f=l(!0);g(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=l(null),_=l(null),b=c(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),x=c(async n=>{b(),f.current&&u({kind:`committing`,sessionId:n});try{let r=await I(`/login/commit`,{sessionId:n,name:a.trim().length>0?a.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},P);p.current=null,t(r.brokerId)}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u({kind:`error`,message:t,sessionId:n})}},[e,a,t,b]),S=c((e,t)=>{b();let n=async()=>{try{let n=await L(e);if(n.phase===`captured`){b(),x(e);return}if(n.phase===`error`){b(),f.current&&u({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){b(),f.current&&u({kind:`idle`});return}f.current&&u({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},j)},[b,x]);g(()=>()=>{b(),p.current!==null&&R(p.current)},[b]);let C=async()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`starting`});try{let e=await I(`/login/start`,{amazonDomain:r},M);p.current=e.sessionId,u({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){u({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`idle`})},D=()=>{E()},O=s.kind===`idle`,A=s.kind===`starting`,N=s.kind===`polling`,F=s.kind===`committing`,z=s.kind===`error`,B=A||N||F,V=s.kind===`polling`?s.phase:null,H=s.kind===`polling`?s.loginUrl:null,U=N&&V===`awaiting-login`,W=N&&(V===`starting`||V===null);return d(`div`,{className:`space-y-4`,children:[(O||z)&&d(`div`,{className:`space-y-3`,children:[e===void 0&&d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),h(`input`,{id:`alexa-account-name`,type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),h(`select`,{id:`alexa-amazon-region`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:k.map(e=>h(`option`,{value:e,children:e},e))})]})]}),z&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[h(w,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),h(`span`,{children:s.message})]}),A&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),F&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[h(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),d(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[h(y,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),d(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[h(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,h(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),d(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[h(T,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),d(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[h(`button`,{type:`button`,onClick:B?E:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:B?`Cancel login`:`Back`}),d(`div`,{className:`flex items-center gap-2`,children:[z&&d(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[h(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&h(`button`,{type:`button`,onClick:()=>{C()},disabled:e===void 0&&a.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}u();var B=`alexa`;function V(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function H(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var U={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function W({kind:e,onResolved:t,onBack:a}){let[o,s]=m(e===B?`alexa-login`:`existing`),c=r({kind:e}),l=f(()=>V(c.data).filter(t=>t.kind===e),[c.data,e]),u=i(),p=f(()=>{for(let t of H(u.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[u.data,e]),[g,_]=m(null),[v,y]=m(``),b=n({}),S=()=>{g&&t(g)},C=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},w=e=>{e===`new`?_(null):b.reset(),s(e)};return d(`div`,{className:`space-y-4`,children:[d(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[h(x,{className:`h-3.5 w-3.5`}),` Back`]}),d(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===B&&h(`button`,{type:`button`,onClick:()=>w(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),h(`button`,{type:`button`,onClick:()=>w(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),h(`button`,{type:`button`,onClick:()=>w(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===B?`Paste cookie`:`Create new`})]}),o===`alexa-login`&&h(z,{onResolved:t,onCancel:a}),o===`existing`&&d(`div`,{className:`space-y-3`,children:[c.isLoading&&d(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[h(T,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),c.isError&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),!c.isLoading&&!c.isError&&l.length===0&&d(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,h(`span`,{className:`font-medium text-foreground`,children:e===B?`Login interactively`:`Create new`}),` `,`to register one.`]}),h(`div`,{className:`space-y-2`,children:l.map(e=>d(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[h(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),h(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${U[e.status]}`,children:e.status})]},e.id))}),l.length>0&&h(`div`,{className:`flex justify-end pt-1`,children:h(`button`,{type:`button`,onClick:S,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),o===`new`&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`space-y-1`,children:[h(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),h(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&h(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),h(D,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{C(e).catch(()=>{})},onCancel:a,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}u();function G({open:e,onClose:n,scope:r}){let i=s(),[a,o]=m(new Set),[l,u]=m(new Set),{data:p}=t({}),g=f(()=>new Set((p??[]).map(e=>e.stableId)),[p]),v=c(async(e,t)=>{u(e=>new Set(e).add(t.stableId));try{await i.mutateAsync({addonId:e,candidate:t}),o(e=>new Set(e).add(t.stableId))}catch{}finally{u(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[i]),y=c((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=g.has(t.stableId),i=a.has(t.stableId)||r,o=l.has(t.stableId);return d(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[d(`div`,{className:`min-w-0`,children:[h(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&h(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?d(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[h(b,{className:`h-3.5 w-3.5`}),` `,r?`Already added`:`Added`]}):d(`button`,{type:`button`,onClick:()=>void v(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(_,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[a,l,g,v]);if(!e)return null;let x=r?`Scan network — ${r.label}`:`Scan network for devices`;return d(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[h(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),d(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl`,children:[d(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(O,{className:`h-4 w-4 text-primary`}),h(`h2`,{className:`text-sm font-semibold text-foreground`,children:x})]}),h(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:h(C,{className:`h-4 w-4`})})]}),r?h(q,{scope:r,onAdopt:y,onReset:()=>o(new Set)}):h(K,{onAdopt:y,onReset:()=>o(new Set)})]})]})}function K({onAdopt:e,onReset:t}){let n=o(),r=c(()=>{t(),n.mutate({})},[n,t]);g(()=>{!n.isPending&&!n.data&&r()},[]);let i=f(()=>(n.data?.groups??[]).filter(e=>e.candidates.length>0),[n.data]),a=f(()=>i.reduce((e,t)=>e+t.candidates.length,0),[i]);return d(p,{children:[h(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:d(`button`,{onClick:r,disabled:n.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[h(v,{className:`h-3.5 w-3.5 ${n.isPending?`animate-spin`:``}`}),`Re-scan`]})}),d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[n.isPending&&h(J,{label:`Scanning the local network…`}),!n.isPending&&n.isError&&h(Y,{}),!n.isPending&&n.data&&i.length===0&&h(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!n.isPending&&i.length>0&&d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,a,` device`,a===1?``:`s`,` on the network.`]}),!n.isPending&&i.map(t=>d(`div`,{className:`space-y-1.5`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),d(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function q({scope:t,onAdopt:n,onReset:r}){let i=e({addonId:t.addonId}).data??null,[o,s]=m({}),l=a(),u=c(()=>{r(),l.mutate({addonId:t.addonId,params:o})},[l,t.addonId,o,r]),f=l.data?.candidates??[];return h(p,{children:d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[i&&h(E,{schema:i,values:o,onChange:s}),d(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[l.isPending?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(O,{className:`h-3.5 w-3.5`}),l.isPending?`Scanning…`:`Scan`]}),l.isError&&h(Y,{}),!l.isPending&&l.data&&f.length===0&&h(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!l.isPending&&f.length>0&&d(`div`,{className:`space-y-1.5`,children:[d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f.length,` device`,f.length===1?``:`s`,`.`]}),f.map(e=>n(t.addonId,e))]})]})})}function J({label:e}){return d(`div`,{className:`flex flex-col items-center py-12`,children:[h(T,{className:`h-6 w-6 animate-spin text-primary`}),h(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function Y(){return d(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[h(w,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),h(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{W as n,O as r,G as t};
|
|
1
|
+
import{An as e,En as t,Kt as n,Xt as r,Zt as i,gn as a,mn as o,on as s}from"./src-9Nw_7MUt.js";import{I as c,K as l,Q as u,S as d,W as f,b as p,q as m,x as h,z as g}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as _}from"./download-CDTSR7Xa.js";import{t as v}from"./refresh-cw-DH7JcsAT.js";import{D as y,F as b,N as x,V as S,i as C,o as w,x as T}from"./index-Da6GKRLl.js";import{t as E}from"./FormBuilder-CL6dlXwQ.js";import{t as D}from"./BrokerForm-1o4dgBsn.js";var O=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);u();var k=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],A=`/addon/import-alexa`,j=2e3;function M(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function N(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function P(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function F(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function I(e,t,n){let r=await fetch(`${A}${e}`,{method:`POST`,headers:F(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function L(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${A}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!N(i))throw Error(`Unexpected status response from server`);return i}async function R(e){try{await fetch(`${A}/login/cancel`,{method:`POST`,headers:F(),body:JSON.stringify({sessionId:e})})}catch{}}function z({brokerId:e,onResolved:t,onCancel:n}){let[r,i]=m(`amazon.it`),[a,o]=m(`Alexa account`),[s,u]=m({kind:`idle`}),f=l(!0);g(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=l(null),_=l(null),b=c(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),x=c(async n=>{b(),f.current&&u({kind:`committing`,sessionId:n});try{let r=await I(`/login/commit`,{sessionId:n,name:a.trim().length>0?a.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},P);p.current=null,t(r.brokerId)}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u({kind:`error`,message:t,sessionId:n})}},[e,a,t,b]),S=c((e,t)=>{b();let n=async()=>{try{let n=await L(e);if(n.phase===`captured`){b(),x(e);return}if(n.phase===`error`){b(),f.current&&u({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){b(),f.current&&u({kind:`idle`});return}f.current&&u({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},j)},[b,x]);g(()=>()=>{b(),p.current!==null&&R(p.current)},[b]);let C=async()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`starting`});try{let e=await I(`/login/start`,{amazonDomain:r},M);p.current=e.sessionId,u({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){u({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`idle`})},D=()=>{E()},O=s.kind===`idle`,A=s.kind===`starting`,N=s.kind===`polling`,F=s.kind===`committing`,z=s.kind===`error`,B=A||N||F,V=s.kind===`polling`?s.phase:null,H=s.kind===`polling`?s.loginUrl:null,U=N&&V===`awaiting-login`,W=N&&(V===`starting`||V===null);return d(`div`,{className:`space-y-4`,children:[(O||z)&&d(`div`,{className:`space-y-3`,children:[e===void 0&&d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),h(`input`,{id:`alexa-account-name`,type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),h(`select`,{id:`alexa-amazon-region`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:k.map(e=>h(`option`,{value:e,children:e},e))})]})]}),z&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[h(w,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),h(`span`,{children:s.message})]}),A&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),F&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[h(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),d(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[h(y,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),d(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[h(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,h(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),d(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[h(T,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),d(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[h(`button`,{type:`button`,onClick:B?E:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:B?`Cancel login`:`Back`}),d(`div`,{className:`flex items-center gap-2`,children:[z&&d(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[h(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&h(`button`,{type:`button`,onClick:()=>{C()},disabled:e===void 0&&a.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}u();var B=`alexa`;function V(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function H(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var U={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function W({kind:e,onResolved:t,onBack:a}){let[o,s]=m(e===B?`alexa-login`:`existing`),c=r({kind:e}),l=f(()=>V(c.data).filter(t=>t.kind===e),[c.data,e]),u=i(),p=f(()=>{for(let t of H(u.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[u.data,e]),[g,_]=m(null),[v,y]=m(``),b=n({}),S=()=>{g&&t(g)},C=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},w=e=>{e===`new`?_(null):b.reset(),s(e)};return d(`div`,{className:`space-y-4`,children:[d(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[h(x,{className:`h-3.5 w-3.5`}),` Back`]}),d(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===B&&h(`button`,{type:`button`,onClick:()=>w(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),h(`button`,{type:`button`,onClick:()=>w(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),h(`button`,{type:`button`,onClick:()=>w(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===B?`Paste cookie`:`Create new`})]}),o===`alexa-login`&&h(z,{onResolved:t,onCancel:a}),o===`existing`&&d(`div`,{className:`space-y-3`,children:[c.isLoading&&d(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[h(T,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),c.isError&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),!c.isLoading&&!c.isError&&l.length===0&&d(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,h(`span`,{className:`font-medium text-foreground`,children:e===B?`Login interactively`:`Create new`}),` `,`to register one.`]}),h(`div`,{className:`space-y-2`,children:l.map(e=>d(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[h(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),h(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${U[e.status]}`,children:e.status})]},e.id))}),l.length>0&&h(`div`,{className:`flex justify-end pt-1`,children:h(`button`,{type:`button`,onClick:S,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),o===`new`&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`space-y-1`,children:[h(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),h(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&h(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),h(D,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{C(e).catch(()=>{})},onCancel:a,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}u();function G({open:e,onClose:n,scope:r}){let i=s(),[a,o]=m(new Set),[l,u]=m(new Set),{data:p}=t({}),g=f(()=>new Set((p??[]).map(e=>e.stableId)),[p]),v=c(async(e,t)=>{u(e=>new Set(e).add(t.stableId));try{await i.mutateAsync({addonId:e,candidate:t}),o(e=>new Set(e).add(t.stableId))}catch{}finally{u(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[i]),y=c((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=g.has(t.stableId),i=a.has(t.stableId)||r,o=l.has(t.stableId);return d(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[d(`div`,{className:`min-w-0`,children:[h(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&h(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?d(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[h(b,{className:`h-3.5 w-3.5`}),` `,r?`Already added`:`Added`]}):d(`button`,{type:`button`,onClick:()=>void v(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(_,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[a,l,g,v]);if(!e)return null;let x=r?`Scan network — ${r.label}`:`Scan network for devices`;return d(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[h(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),d(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl`,children:[d(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(O,{className:`h-4 w-4 text-primary`}),h(`h2`,{className:`text-sm font-semibold text-foreground`,children:x})]}),h(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:h(C,{className:`h-4 w-4`})})]}),r?h(q,{scope:r,onAdopt:y,onReset:()=>o(new Set)}):h(K,{onAdopt:y,onReset:()=>o(new Set)})]})]})}function K({onAdopt:e,onReset:t}){let n=o(),r=c(()=>{t(),n.mutate({})},[n,t]);g(()=>{!n.isPending&&!n.data&&r()},[]);let i=f(()=>(n.data?.groups??[]).filter(e=>e.candidates.length>0),[n.data]),a=f(()=>i.reduce((e,t)=>e+t.candidates.length,0),[i]);return d(p,{children:[h(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:d(`button`,{onClick:r,disabled:n.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[h(v,{className:`h-3.5 w-3.5 ${n.isPending?`animate-spin`:``}`}),`Re-scan`]})}),d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[n.isPending&&h(J,{label:`Scanning the local network…`}),!n.isPending&&n.isError&&h(Y,{}),!n.isPending&&n.data&&i.length===0&&h(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!n.isPending&&i.length>0&&d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,a,` device`,a===1?``:`s`,` on the network.`]}),!n.isPending&&i.map(t=>d(`div`,{className:`space-y-1.5`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),d(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function q({scope:t,onAdopt:n,onReset:r}){let i=e({addonId:t.addonId}).data??null,[o,s]=m({}),l=a(),u=c(()=>{r(),l.mutate({addonId:t.addonId,params:o})},[l,t.addonId,o,r]),f=l.data?.candidates??[];return h(p,{children:d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[i&&h(E,{schema:i,values:o,onChange:s}),d(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[l.isPending?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(O,{className:`h-3.5 w-3.5`}),l.isPending?`Scanning…`:`Scan`]}),l.isError&&h(Y,{}),!l.isPending&&l.data&&f.length===0&&h(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!l.isPending&&f.length>0&&d(`div`,{className:`space-y-1.5`,children:[d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f.length,` device`,f.length===1?``:`s`,`.`]}),f.map(e=>n(t.addonId,e))]})]})})}function J({label:e}){return d(`div`,{className:`flex flex-col items-center py-12`,children:[h(T,{className:`h-6 w-6 animate-spin text-primary`}),h(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function Y(){return d(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[h(w,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),h(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{W as n,O as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fr as e}from"./src-
|
|
1
|
+
import{Fr as e}from"./src-9Nw_7MUt.js";import{S as t,x as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{f as r}from"./index-Da6GKRLl.js";import{t as i}from"./AdminPage-BwmGKnRf.js";import{t as a}from"./NodeAddonsSettingsPanel-5OLeCWWK.js";function o(){let{data:o,isLoading:s}=e(void 0),c=(o??[]).find(e=>e.isHub&&e.isOnline),l=c?.addons.map(e=>e.id)??[];return n(i,{children:s?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):c?l.length===0?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):n(a,{nodeId:c.id,addonIds:l,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[n(r,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:`No online hub node found.`}),n(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})})}export{o as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-9yltt4Fp.js";import{t as a}from"./ProviderIcon-BHDS5Z0G.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-BYpwuMQM.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={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 d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{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...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{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`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{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:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{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`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{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})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`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=>r(`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))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(o,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`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:e,label:n,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`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(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:r(`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{d as ShowroomPage};
|
|
1
|
+
import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-D7EsQrNT.js";import{t as a}from"./ProviderIcon-AXlCHsTd.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-CL6dlXwQ.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={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 d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`}),r(`button`,{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`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{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...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{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`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{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:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{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`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{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})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`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=>r(`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))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(o,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`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:e,label:n,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`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(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:r(`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{d as ShowroomPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-
|
|
1
|
+
import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BMXZuPDZ.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-7sVMyhkP.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-Bp7iSHw-.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-9Nw_7MUt.js`).then(e=>e.t),[]),"@tanstack/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.y),[]),"@trpc/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js`).then(e=>e.A),[]),"@trpc/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DkcC9IVF.js`).then(e=>e.r),[]),konva:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__konva__loadShare__.js-B7XYY0cV.js`).then(e=>e.n),[]),react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>(e.et(),e.$)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.js`).then(e=>(e.a(),e.i)),[]),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DstpX0yz.js`).then(e=>e.r),[]),"react-konva":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-BBBrLLEa.js`).then(e=>e.u),[]),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.1.16`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/sdk`].loaded=!0;let{"@camstack/sdk":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.16`}},"@camstack/types":{name:`@camstack/types`,version:`1.1.25`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/types`].loaded=!0;let{"@camstack/types":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.25`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.1.21`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/ui-library`].loaded=!0;let{"@camstack/ui-library":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.21`}},"@tanstack/react-query":{name:`@tanstack/react-query`,version:`5.101.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@tanstack/react-query`].loaded=!0;let{"@tanstack/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^5.101.0`}},"@trpc/client":{name:`@trpc/client`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/client`].loaded=!0;let{"@trpc/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},"@trpc/react-query":{name:`@trpc/react-query`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/react-query`].loaded=!0;let{"@trpc/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},konva:{name:`konva`,version:`10.3.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.konva.loaded=!0;let{konva:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^10.3.0`}},react:{name:`react`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.react.loaded=!0;let{react:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom":{name:`react-dom`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom`].loaded=!0;let{"react-dom":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom/client":{name:`react-dom/client`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom/client`].loaded=!0;let{"react-dom/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-konva":{name:`react-konva`,version:`19.2.5`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-konva`].loaded=!0;let{"react-konva":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.5`}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}}},r=[];export{r as usedRemotes,n as usedShared};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as e}from"./index-Da6GKRLl.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as e}from"./index-
|
|
1
|
+
import{V as e}from"./index-Da6GKRLl.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,f as t}from"./src-BB7sQJiE.js";import{T as n,b as r,o as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js";var o=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},s=class{constructor(e){this.generateIdentifier=e,this.kv=new o}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},c=class extends s{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function l(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function u(e,t){let n=l(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function d(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function f(e,t){return e.indexOf(t)!==-1}function p(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var m=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return u(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},ee=e=>Object.prototype.toString.call(e).slice(8,-1),h=e=>e===void 0,te=e=>e===null,g=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,_=e=>g(e)&&Object.keys(e).length===0,v=e=>Array.isArray(e),ne=e=>typeof e==`string`,re=e=>typeof e==`number`&&!isNaN(e),ie=e=>typeof e==`boolean`,ae=e=>e instanceof RegExp,y=e=>e instanceof Map,b=e=>e instanceof Set,oe=e=>ee(e)===`Symbol`,se=e=>e instanceof Date&&!isNaN(e.valueOf()),ce=e=>e instanceof Error,le=e=>typeof e==`number`&&isNaN(e),ue=e=>ie(e)||te(e)||h(e)||re(e)||ne(e)||oe(e),de=e=>typeof e==`bigint`,fe=e=>e===1/0||e===-1/0,pe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),me=e=>e instanceof URL,x=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),S=e=>e.map(String).map(x).join(`.`),C=(e,t)=>{let n=[],r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(!t&&a===`\\`){let t=e.charAt(i+1);if(t===`\\`){r+=`\\`,i++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(a===`\\`&&e.charAt(i+1)===`.`){r+=`.`,i++;continue}if(a===`.`){n.push(r),r=``;continue}r+=a}let i=r;return n.push(i),n};function w(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var he=[w(h,`undefined`,()=>null,()=>void 0),w(de,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),w(se,`Date`,e=>e.toISOString(),e=>new Date(e)),w(ce,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),w(ae,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),w(b,`set`,e=>[...e.values()],e=>new Set(e)),w(y,`map`,e=>[...e.entries()],e=>new Map(e)),w(e=>le(e)||fe(e),`number`,e=>le(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),w(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),w(me,`URL`,e=>e.toString(),e=>new URL(e))];function T(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var ge=T((e,t)=>oe(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),_e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),ve=T(pe,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=_e[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function ye(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var be=T(ye,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),xe=T((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),Se=[be,ge,xe,ve],E=(e,t)=>{let n=p(Se,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=p(he,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},D={};he.forEach(e=>{D[e.annotation]=e});var Ce=(e,t,n)=>{if(v(t))switch(t[0]){case`symbol`:return ge.untransform(e,t,n);case`class`:return be.untransform(e,t,n);case`custom`:return xe.untransform(e,t,n);case`typed-array`:return ve.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=D[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},O=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function k(e){if(f(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(f(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(f(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var we=(e,t)=>{k(t);for(let n=0;n<t.length;n++){let r=t[n];if(b(e))e=O(e,+r);else if(y(e)){let i=+r,a=+t[++n]==0?`key`:`value`,o=O(e,i);switch(a){case`key`:e=o;break;case`value`:e=e.get(o);break}}else e=e[r]}return e},A=(e,t,n)=>{if(k(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(v(r)){let e=+n;r=r[e]}else if(g(r))r=r[n];else if(b(r)){let e=+n;r=O(r,e)}else if(y(r)){if(e===t.length-2)break;let i=+n,a=+t[++e]==0?`key`:`value`,o=O(r,i);switch(a){case`key`:r=o;break;case`value`:r=r.get(o);break}}}let i=t[t.length-1];if(v(r)?r[+i]=n(r[+i]):g(r)&&(r[i]=n(r[i])),b(r)){let e=O(r,+i),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(y(r)){let e=+t[t.length-2],a=O(r,e);switch(+i==0?`key`:`value`){case`key`:{let e=n(a);r.set(e,r.get(a)),e!==a&&r.delete(a);break}case`value`:r.set(a,n(r.get(a)));break}}return e},j=e=>e<1;function M(e,t,n,r=[]){if(!e)return;let i=j(n);if(!v(e)){d(e,(e,a)=>M(e,t,n,[...r,...C(a,i)]));return}let[a,o]=e;o&&d(o,(e,a)=>{M(e,t,n,[...r,...C(a,i)])}),t(a,r)}function Te(e,t,n,r){return M(t,(t,n)=>{e=A(e,n,e=>Ce(e,t,r))},n),e}function Ee(e,t,n){let r=j(n);function i(t,n){let i=we(e,C(n,r));t.map(e=>C(e,r)).forEach(t=>{e=A(e,t,()=>i)})}if(v(t)){let[n,a]=t;n.forEach(t=>{e=A(e,C(t,r),()=>e)}),a&&d(a,i)}else d(t,i);return e}var De=(e,t)=>g(e)||v(e)||y(e)||b(e)||ce(e)||ye(e,t);function Oe(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function ke(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[i,...a]=e;i.length===0?r=a.map(S):n[S(i)]=a.map(S)}),r?_(n)?[r]:[r,n]:_(n)?void 0:n}var N=(e,t,n,r,i=[],a=[],o=new Map)=>{let s=ue(e);if(!s){Oe(e,i,t);let n=o.get(e);if(n)return r?{transformedValue:null}:n}if(!De(e,n)){let t=E(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return s||o.set(e,r),r}if(f(a,e))return{transformedValue:null};let c=E(e,n),l=c?.value??e,u=v(l)?[]:{},p={};d(l,(s,c)=>{if(c===`__proto__`||c===`constructor`||c===`prototype`)throw Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`);let l=N(s,t,n,r,[...i,c],[...a,e],o);u[c]=l.transformedValue,v(l.annotations)?p[x(c)]=l.annotations:g(l.annotations)&&d(l.annotations,(e,t)=>{p[x(c)+`.`+t]=e})});let m=_(p)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,p]:p};return s||o.set(e,m),m};function P(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ae(e){return P(e)===`Array`}function je(e){if(P(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Me(e,t,n,r,i){let a={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;a===`enumerable`&&(e[t]=n),i&&a===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function F(e,t={}){if(Ae(e))return e.map(e=>F(e,t));if(!je(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||Ae(t.props)&&!t.props.includes(r))return n;let i=e[r];return Me(n,r,F(i,t),e,t.nonenumerable),n},{})}var I=class{constructor({dedupe:e=!1}={}){this.classRegistry=new c,this.symbolRegistry=new s(e=>e.description??``),this.customTransformerRegistry=new m,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=N(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let i=ke(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,i=t?.inPlace?n:F(n);return r?.values&&(i=Te(i,r.values,r.v??0,this)),r?.referentialEqualities&&(i=Ee(i,r.referentialEqualities,r.v??0)),i}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};I.defaultInstance=new I,I.serialize=I.defaultInstance.serialize.bind(I.defaultInstance),I.deserialize=I.defaultInstance.deserialize.bind(I.defaultInstance),I.stringify=I.defaultInstance.stringify.bind(I.defaultInstance),I.parse=I.defaultInstance.parse.bind(I.defaultInstance),I.registerClass=I.defaultInstance.registerClass.bind(I.defaultInstance),I.registerSymbol=I.defaultInstance.registerSymbol.bind(I.defaultInstance),I.registerCustom=I.defaultInstance.registerCustom.bind(I.defaultInstance),I.allowErrorProps=I.defaultInstance.allowErrorProps.bind(I.defaultInstance),I.serialize,I.deserialize,I.stringify,I.parse,I.registerClass,I.registerCustom,I.registerSymbol,I.allowErrorProps;var Ne=1e4,Pe=6e3,Fe=2e3,Ie=3e4,L=class{_serverUrl;useWs;baseRetryMs;maxRetryMs;onConnectionChange;token;_trpcClient;_wsClient=null;mirror=null;mirrorInit=null;connected=!1;connectedPromise=null;_systemProxy;_connectionVersion=0;connectionListeners=new Set;constructor(e){this._serverUrl=e.serverUrl.replace(/\/+$/,``),this.token=e.token;let n=typeof window<`u`;this.useWs=e.useWebSocket??n,this.onConnectionChange=e.onConnectionChange,this.baseRetryMs=e.retryDelayMs??Fe,this.maxRetryMs=e.maxRetryDelayMs??Ie,this._trpcClient=this.buildTrpcClient(),this._systemProxy=t(this._trpcClient)}get serverUrl(){return this._serverUrl}get connectionVersion(){return this._connectionVersion}subscribeConnectionEvents(e){return this.connectionListeners.add(e),()=>{this.connectionListeners.delete(e)}}emitConnectionEvent(e){try{this.onConnectionChange?.(e)}catch{}for(let t of this.connectionListeners)try{t(e,this._connectionVersion)}catch{}}async awaitConnected(e){if(this.connected)return;if(this.connectedPromise)return this.connectedPromise;let t=e??15e3;this.connectedPromise=(async()=>{let e=this._trpcClient.auth.me.query();Number.isFinite(t)?await new Promise((n,r)=>{let i=setTimeout(()=>r(Error(`System.awaitConnected: probe timed out after ${t}ms`)),t);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})}):await e,this.connected=!0})();try{await this.connectedPromise}finally{this.connectedPromise=null}}async init(t){if(this.mirror?.isReady())return;if(this.mirrorInit)return this.mirrorInit;let n=new e(this._trpcClient);return this.mirror=n,this.mirrorInit=(async()=>{await this.awaitConnected(t),await n.init(t)})().finally(()=>{this.mirrorInit=null}),this.mirrorInit}async awaitReady(){if(!this.mirror?.isReady())return this.mirrorInit?this.mirrorInit:this.init()}isReady(){return this.mirror?.isReady()??!1}isConnected(){return this.connected}reconnect(){this.useWs&&(this.emitConnectionEvent(`connecting`),this._wsClient?.close(),this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._trpcClient=this.buildTrpcClient(),this._systemProxy=t(this._trpcClient))}switchServerUrl(e){let t=e.replace(/\/+$/,``);t!==this._serverUrl&&(this._serverUrl=t,this.reconnect())}async raceConnectionEndpoints(e){let t=e?.perCandidateTimeoutMs??1500,n=(()=>{try{return new URL(this._serverUrl)}catch{return null}})(),r=n?.port?Number(n.port):n?.protocol===`https:`?443:80,i=n?.protocol===`https:`?`https`:`http`,a=this._trpcClient.localNetwork?.getConnectionEndpoints;if(!a)return{winner:this._serverUrl,switched:!1};let o;try{o=(await a.query({port:r,ipv4Only:e?.ipv4Only,scheme:i})).endpoints}catch{return{winner:this._serverUrl,switched:!1}}if(o.length===0)return{winner:this._serverUrl,switched:!1};let s=await Re(o.map(e=>e.baseUrl),t);return!s||s===this._serverUrl?{winner:s??this._serverUrl,switched:!1}:(this.switchServerUrl(s),{winner:s,switched:!0})}close(){this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._wsClient?.close()}disposeMirror(){this.mirror?.dispose(),this.mirror=null,this.mirrorInit=null}async login(e,t){let n=await this._trpcClient.auth.login.mutate({username:e,password:t});if(typeof n==`object`&&n&&`token`in n){let e=n,t=e.token;typeof t==`string`&&e.requiresTotp!==!0&&this.setToken(t)}return n}async loginVerifyTotp(e,t){let n=await this._trpcClient.auth.loginVerifyTotp.mutate({challengeToken:e,code:t});if(typeof n==`object`&&n&&`token`in n){let e=n.token;typeof e==`string`&&this.setToken(e)}return n}async logout(){await this._trpcClient.auth.logout.mutate()}async getMe(){return await this._trpcClient.auth.me.query()}async changeOwnPassword(e){return await this._trpcClient.auth.changeOwnPassword.mutate(e)}async setupOwnTotp(){return await this._trpcClient.auth.setupOwnTotp.mutate()}async confirmOwnTotp(e){return await this._trpcClient.auth.confirmOwnTotp.mutate(e)}async disableOwnTotp(){return await this._trpcClient.auth.disableOwnTotp.mutate()}async getOwnTotpStatus(){return await this._trpcClient.auth.getOwnTotpStatus.query()}setToken(e){this.token=e}listDevices(e){return this.mirror?(e?this.mirror.query(e):this.mirror.getAllDevices()).map(e=>this.attachBinding(e)):[]}getDeviceInfo(e){return this.mirror?.getDeviceInfo(e)??null}listDeviceInfos(e){let t=this.mirror;if(!t)return[];let n=e?t.query(e):t.getAllDevices(),r=[];for(let e of n){let n=t.getDeviceInfo(e.deviceId);n&&r.push(n)}return r}getDevice(e){let t=this.mirror?.getDeviceById(e)??null;return t?this.attachBinding(t):null}getDeviceByName(e){let t=this.mirror?.getDeviceByName(e)??null;return t?this.attachBinding(t):null}getDeviceByStableId(e){let t=this.mirror?.getDeviceByStableId(e)??null;return t?this.attachBinding(t):null}async waitForDevice(e,t){this.mirror||await this.init();let n=await this.mirror.waitForDevice(e,t??3e4);return this.attachBinding(n)}onDeviceAdded(e){if(!this.mirror)throw Error(`System.onDeviceAdded: call init() before subscribing`);return this.mirror.onDeviceAdded(e)}onDeviceRemoved(e){if(!this.mirror)throw Error(`System.onDeviceRemoved: call init() before subscribing`);return this.mirror.onDeviceRemoved(e)}attachBinding(e){let t=this.lookupBinding(e.deviceId);if(t===e.binding)return e;let n=e;return n.binding=t,e}lookupBinding(e){return this.mirror?this.mirror.getDeviceById(e)?.binding??null:null}get addonPages(){return this._systemProxy.addonPages}get addonSettings(){return this._systemProxy.addonSettings}get alerts(){return this._systemProxy.alerts}get audioAnalyzer(){return this._systemProxy.audioAnalyzer}get audioCodec(){return this._systemProxy.audioCodec}get backup(){return this._systemProxy.backup}get decoder(){return this._systemProxy.decoder}get deviceManager(){return this._systemProxy.deviceManager}get deviceProvider(){return this._systemProxy.deviceProvider}get deviceState(){return this._systemProxy.deviceState}get metricsProvider(){return this._systemProxy.metricsProvider}get notificationOutput(){return this._systemProxy.notificationOutput}get pipelineExecutor(){return this._systemProxy.pipelineExecutor}get pipelineOrchestrator(){return this._systemProxy.pipelineOrchestrator}get pipelineRunner(){return this._systemProxy.pipelineRunner}get settingsStore(){return this._systemProxy.settingsStore}get storage(){return this._systemProxy.storage}get streamBroker(){return this._systemProxy.streamBroker}get turnProvider(){return this._systemProxy.turnProvider}get userManagement(){return this._systemProxy.userManagement}subscribeEvent(e,t){let n=this._trpcClient.live.onEvent.subscribe({category:e},{onData:e=>{try{t(e)}catch{}}});return()=>{try{n.unsubscribe()}catch{}}}get trpcClient(){return this._trpcClient}get wsClient(){return this._wsClient}buildTrpcClient(){let e=()=>{let e={};return this.token&&(e.Authorization=`Bearer ${this.token}`),e};if(this.useWs){let e=this._serverUrl.replace(/^http/,`ws`)+`/trpc`,t=this.baseRetryMs,i=this.maxRetryMs;return this._wsClient=n({url:e,connectionParams:()=>({token:this.token}),retryDelayMs:e=>Math.min(t*2**e,i),keepAlive:{enabled:!0,intervalMs:Ne,pongTimeoutMs:Pe},onOpen:()=>{this._connectionVersion+=1,this.emitConnectionEvent(`connected`)},onClose:()=>{this.emitConnectionEvent(`disconnected`)}}),a({links:[r({client:this._wsClient,transformer:I})]})}return this._wsClient=null,a({links:[i({url:`${this._serverUrl}/trpc`,headers:e,transformer:I})]})}};function Le(e){return new L(e)}async function Re(e,t){if(e.length===0)return null;if(typeof fetch!=`function`)return e[0]??null;let n=typeof window<`u`&&window.location!==void 0&&window.location.protocol===`https:`?e.filter(e=>e.toLowerCase().startsWith(`https://`)):e;if(n.length===0)return null;let r=n.map(()=>new AbortController),i=n.map(async(e,n)=>{let i=r[n],a=setTimeout(()=>i.abort(),t);try{let t=await fetch(`${e.replace(/\/+$/,``)}/trpc/health`,{method:`GET`,signal:i.signal,credentials:`omit`});if(!t.ok)throw Error(`${t.status}`);return e}finally{clearTimeout(a)}});try{let e=await Promise.any(i);for(let e of r)try{e.abort()}catch{}return e}catch{return null}}var ze=function(e){return e.Motion=`motion`,e.Person=`person`,e.Vehicle=`vehicle`,e.Animal=`animal`,e.Audio=`audio`,e.Face=`face`,e.Plate=`plate`,e.Package=`package`,e.Doorbell=`doorbell`,e.Sensor=`sensor`,e}({}),R=`animal.dog_cat.dog.cat.horse.sheep.cow.elephant.bear.zebra.giraffe.mouse.rabbit.deer.lion.tiger.bird.eagle.owl.pigeon.fish.whale.dolphin.snake.turtle.lizard`.split(`.`),z=[`person`,`people`,`pedestrian`,`rider`,`driver`,`cyclist`,`skier`,`skateboarder`,`face`,`hand`,`head`,`body`],B=[`vehicle`,`car`,`truck`,`bus`,`motorcycle`,`bicycle`,`van`,`ambulance`,`police_car`,`fire_truck`,`train`,`subway`,`tram`,`airplane`,`boat`,`ship`,`helicopter`],V=`face.eyes.nose.mouth.ears.eyebrows.left_eye.right_eye.pupil.iris.eyelid.eye_corner.upper_lip.lower_lip.teeth.chin.cheek.forehead.jaw.glasses.sunglasses.facial_hair.beard.mustache.facial_landmark.facial_keypoint`.split(`.`),H=[`plate`,`license_plate`,`front_plate`,`rear_plate`,`motorcycle_plate`,`temporary_plate`,`dealer_plate`,`licensePlate`,`plate_number`,`plate_character`,`plate_digit`,`plate_letter`,`plate_symbol`,`plate_region`,`plate_country_identifier`,`plate_frame`,`plate_bolt`,`plate_sticker`,`plate_validation_tag`,`damaged_plate`,`obscured_plate`,`dirty_plate`],U=[`motion`,`movement`,`other`],W=[`package`,`packet`],G=[`audio`],K=`speech.scream.babbling.yell.bellow.whoop.whispering.laughter.snicker.crying.cry.sigh.singing.choir.chant.mantra.child_singing.rapping.humming.groan.grunt.whistling.breathing.wheeze.snoring.gasp.pant.snort.cough.throat_clearing.sneeze.sniff.cheering.applause.chatter.crowd.children_playing.bark.yip.howl.bow-wow.growling.whimper_dog.purr.meow.hiss.caterwaul.pets.livestock.doorbell.ding-dong.door.slam.knock.alarm.telephone.music.dog.dogs`.split(`.`),q=[`doorbell`,`ring`],J=[`lock`,`binary`,`flood`,`entry`,`door`,`leak`,`door_open`,`flooded`,`entry_open`],Y={...R.reduce((e,t)=>({...e,[t]:`animal`}),{}),...z.reduce((e,t)=>({...e,[t]:`person`}),{}),...B.reduce((e,t)=>({...e,[t]:`vehicle`}),{}),...U.reduce((e,t)=>({...e,[t]:`motion`}),{}),...W.reduce((e,t)=>({...e,[t]:`package`}),{}),...V.reduce((e,t)=>({...e,[t]:`face`}),{}),...H.reduce((e,t)=>({...e,[t]:`plate`}),{}),...G.reduce((e,t)=>({...e,[t]:`audio`}),{}),...K.reduce((e,t)=>({...e,[t]:`audio`}),{}),...q.reduce((e,t)=>({...e,[t]:`doorbell`}),{}),...J.reduce((e,t)=>({...e,[t]:`sensor`}),{})},Be=e=>V.includes(e),Ve=e=>H.includes(e),He=e=>R.includes(e),Ue=e=>z.includes(e),We=e=>B.includes(e),Ge=e=>U.includes(e),Ke=e=>q.includes(e),qe=e=>W.includes(e),Je=e=>G.includes(e)||K.includes(e),Ye=e=>J.includes(e),Xe=e=>Be(e)||Ve(e),Ze=e=>Y[e],Qe=e=>{let{className:t}=e,n={face:`person`,plate:`vehicle`},r=Y[t];return r&&r!==t?r:n[t]},$e=Object.values(ze),X=$e.filter(e=>e!==`motion`),Z=[`person`,`doorbell`,`package`],et=[...Z,`vehicle`,`animal`,`audio`,`face`,`plate`],tt=[...X];function nt(e,t){switch(e){case`critical`:return Z;case`important`:return et;case`all`:return tt;case`custom`:return t?.length?t:X;default:return X}}var Q={Light:`light`,Switch:`switch`,WindowCovering:`cover`,Lock:`lock`,SecuritySystem:`alarm`,Buttons:`button`,Select:`select`,Siren:`siren`,Sensor:`sensor`,Entry:`entry`,Program:`script`,MediaPlayer:`media_player`,Outlet:`switch`,light:`light`,switch:`switch`,input_boolean:`switch`,cover:`cover`,lock:`lock`,alarm_control_panel:`alarm`,input_button:`button`,button:`button`,input_select:`select`,select:`select`,siren:`siren`,sensor:`sensor`,media_player:`media_player`,script:`script`},rt={light:`light`,switch:`switch`,input_boolean:`switch`,cover:`cover`,lock:`lock`,alarm_control_panel:`alarm`,input_button:`button`,button:`button`,input_select:`select`,select:`select`,siren:`siren`,sensor:`sensor`,binary_sensor:`sensor`,media_player:`media_player`,script:`script`,climate:`climate`,camera:`camera`,fan:`fan`,vacuum:`vacuum`,automation:`automation`,scene:`scene`,input_number:`sensor`,person:`person`,device_tracker:`tracker`,weather:`weather`,water_heater:`climate`},it={Light:`light`,Switch:`switch`,WindowCovering:`cover`,Lock:`lock`,SecuritySystem:`alarm`,Buttons:`button`,Select:`select`,Siren:`siren`,Sensor:`sensor`,Entry:`entry`,Program:`script`,MediaPlayer:`media_player`,Camera:`camera`,Doorbell:`doorbell`,Fan:`fan`,Outlet:`switch`};function at(e){return Q[e]||(Q[e.toLowerCase()]??null)}var ot=[`Entry`,`Light`,`Switch`,`Lock`,`SecuritySystem`,`Buttons`,`WindowCovering`,`Siren`,`Sensor`,`Select`,`Program`],st=new Set(ot),ct=[`light`,`switch`,`input_boolean`,`cover`,`lock`,`alarm_control_panel`,`input_button`,`button`,`input_select`,`select`,`siren`,`media_player`,`script`],lt=new Set(ct),$=[{id:`liveStream`,label:`Live Stream`,sources:{frigate:!0,scrypted:!0,rtsp:!0},adapterMethod:`getLiveStream`},{id:`multiResolution`,label:`Multi-Resolution`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getResolutions`},{id:`motion`,label:`Motion Detection`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getMotion`},{id:`objectDetection`,label:`Object Detection`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getObjectDetections`},{id:`audioVolume`,label:`Audio Level`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getAudioVolume`},{id:`audioVolumes`,label:`Audio Volumes (dBFS)`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getAudioVolumes`},{id:`ptz`,label:`PTZ Control`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getPTZ`},{id:`intercom`,label:`Intercom (Mic)`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getIntercomSupport`},{id:`deviceStatus`,label:`Device Status`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getStatus`},{id:`timeline`,label:`Detection Timeline`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getCameraDayData`},{id:`clusteredTimeline`,label:`Clustered Timeline`,sources:{frigate:!0,scrypted:!0,rtsp:!1},requiresBackend:!0,adapterMethod:`getClusteredDayData`},{id:`detectionClasses`,label:`Detection Classes`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getDetectionClasses`},{id:`videoClips`,label:`Video Clips`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getVideoClips`},{id:`nvrPlayback`,label:`NVR Playback`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getNvrPlaybackSupported`},{id:`nvrScrub`,label:`NVR Scrub/Seek`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`seekRecordingStream`},{id:`recordingThumbnail`,label:`Recording Thumbnails`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getRecordingStreamThumbnail`},{id:`nvrSeekToLive`,label:`Seek to Live`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`seekNvrToLive`}];function ut(e,t,n){let r=$.find(t=>t.id===e);return!(!r||!r.sources[t]||r.platforms&&r.platforms[n]===!1)}function dt(e){return $.filter(t=>t.sources[e])}function ft(){return $.filter(e=>e.requiresBackend)}export{X as DEFAULT_ENABLED_CLASSES,ze as DetectionClass,ct as ELIGIBLE_HA_DOMAINS,lt as ELIGIBLE_HA_DOMAINS_SET,ot as ELIGIBLE_SCRYPTED_DEVICE_TYPES,st as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET,$ as FEATURE_MATRIX,rt as HA_DOMAIN_TYPE_MAP,Q as RAW_TO_CANONICAL,it as SCRYPTED_TYPE_TO_CANONICAL,L as System,tt as TIMELINE_PRESET_ALL,Z as TIMELINE_PRESET_CRITICAL,et as TIMELINE_PRESET_IMPORTANT,R as animalClasses,G as audioClasses,K as audioLabelClasses,Le as createSystem,$e as defaultDetectionClasses,Y as detectionClassesDefaultMap,q as doorbellClasses,V as faceClasses,ft as getBackendRequiredFeatures,at as getCanonicalDeviceType,nt as getClassesForTimelinePreset,Ze as getParentClass,Qe as getParentDetectionClass,dt as getSourceFeatures,He as isAnimalClassname,Je as isAudioClassname,Ke as isDoorbellClassname,Be as isFaceClassname,ut as isFeatureAvailable,Xe as isLabelDetection,Ge as isMotionClassname,qe as isPackageClassname,Ue as isPersonClassname,Ve as isPlateClassname,Ye as isSensorLabelClassname,We as isVehicleClassname,H as licensePlateClasses,U as motionClasses,W as packageClasses,z as personClasses,Re as raceFastestEndpoint,J as sensorLabelClasses,B as vehicleClasses};
|
|
1
|
+
import{d as e,f as t}from"./src-DYcadIAu.js";import{T as n,b as r,o as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js";var o=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},s=class{constructor(e){this.generateIdentifier=e,this.kv=new o}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},c=class extends s{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function l(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function u(e,t){let n=l(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function d(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function f(e,t){return e.indexOf(t)!==-1}function p(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var m=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return u(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},ee=e=>Object.prototype.toString.call(e).slice(8,-1),h=e=>e===void 0,te=e=>e===null,g=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,_=e=>g(e)&&Object.keys(e).length===0,v=e=>Array.isArray(e),ne=e=>typeof e==`string`,re=e=>typeof e==`number`&&!isNaN(e),ie=e=>typeof e==`boolean`,ae=e=>e instanceof RegExp,y=e=>e instanceof Map,b=e=>e instanceof Set,oe=e=>ee(e)===`Symbol`,se=e=>e instanceof Date&&!isNaN(e.valueOf()),ce=e=>e instanceof Error,le=e=>typeof e==`number`&&isNaN(e),ue=e=>ie(e)||te(e)||h(e)||re(e)||ne(e)||oe(e),de=e=>typeof e==`bigint`,fe=e=>e===1/0||e===-1/0,pe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),me=e=>e instanceof URL,x=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),S=e=>e.map(String).map(x).join(`.`),C=(e,t)=>{let n=[],r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(!t&&a===`\\`){let t=e.charAt(i+1);if(t===`\\`){r+=`\\`,i++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(a===`\\`&&e.charAt(i+1)===`.`){r+=`.`,i++;continue}if(a===`.`){n.push(r),r=``;continue}r+=a}let i=r;return n.push(i),n};function w(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var he=[w(h,`undefined`,()=>null,()=>void 0),w(de,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),w(se,`Date`,e=>e.toISOString(),e=>new Date(e)),w(ce,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),w(ae,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),w(b,`set`,e=>[...e.values()],e=>new Set(e)),w(y,`map`,e=>[...e.entries()],e=>new Map(e)),w(e=>le(e)||fe(e),`number`,e=>le(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),w(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),w(me,`URL`,e=>e.toString(),e=>new URL(e))];function T(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var ge=T((e,t)=>oe(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),_e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),ve=T(pe,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=_e[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function ye(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var be=T(ye,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),xe=T((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),Se=[be,ge,xe,ve],E=(e,t)=>{let n=p(Se,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=p(he,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},D={};he.forEach(e=>{D[e.annotation]=e});var Ce=(e,t,n)=>{if(v(t))switch(t[0]){case`symbol`:return ge.untransform(e,t,n);case`class`:return be.untransform(e,t,n);case`custom`:return xe.untransform(e,t,n);case`typed-array`:return ve.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=D[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},O=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function k(e){if(f(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(f(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(f(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var we=(e,t)=>{k(t);for(let n=0;n<t.length;n++){let r=t[n];if(b(e))e=O(e,+r);else if(y(e)){let i=+r,a=+t[++n]==0?`key`:`value`,o=O(e,i);switch(a){case`key`:e=o;break;case`value`:e=e.get(o);break}}else e=e[r]}return e},A=(e,t,n)=>{if(k(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(v(r)){let e=+n;r=r[e]}else if(g(r))r=r[n];else if(b(r)){let e=+n;r=O(r,e)}else if(y(r)){if(e===t.length-2)break;let i=+n,a=+t[++e]==0?`key`:`value`,o=O(r,i);switch(a){case`key`:r=o;break;case`value`:r=r.get(o);break}}}let i=t[t.length-1];if(v(r)?r[+i]=n(r[+i]):g(r)&&(r[i]=n(r[i])),b(r)){let e=O(r,+i),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(y(r)){let e=+t[t.length-2],a=O(r,e);switch(+i==0?`key`:`value`){case`key`:{let e=n(a);r.set(e,r.get(a)),e!==a&&r.delete(a);break}case`value`:r.set(a,n(r.get(a)));break}}return e},j=e=>e<1;function M(e,t,n,r=[]){if(!e)return;let i=j(n);if(!v(e)){d(e,(e,a)=>M(e,t,n,[...r,...C(a,i)]));return}let[a,o]=e;o&&d(o,(e,a)=>{M(e,t,n,[...r,...C(a,i)])}),t(a,r)}function Te(e,t,n,r){return M(t,(t,n)=>{e=A(e,n,e=>Ce(e,t,r))},n),e}function Ee(e,t,n){let r=j(n);function i(t,n){let i=we(e,C(n,r));t.map(e=>C(e,r)).forEach(t=>{e=A(e,t,()=>i)})}if(v(t)){let[n,a]=t;n.forEach(t=>{e=A(e,C(t,r),()=>e)}),a&&d(a,i)}else d(t,i);return e}var De=(e,t)=>g(e)||v(e)||y(e)||b(e)||ce(e)||ye(e,t);function Oe(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function ke(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[i,...a]=e;i.length===0?r=a.map(S):n[S(i)]=a.map(S)}),r?_(n)?[r]:[r,n]:_(n)?void 0:n}var N=(e,t,n,r,i=[],a=[],o=new Map)=>{let s=ue(e);if(!s){Oe(e,i,t);let n=o.get(e);if(n)return r?{transformedValue:null}:n}if(!De(e,n)){let t=E(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return s||o.set(e,r),r}if(f(a,e))return{transformedValue:null};let c=E(e,n),l=c?.value??e,u=v(l)?[]:{},p={};d(l,(s,c)=>{if(c===`__proto__`||c===`constructor`||c===`prototype`)throw Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`);let l=N(s,t,n,r,[...i,c],[...a,e],o);u[c]=l.transformedValue,v(l.annotations)?p[x(c)]=l.annotations:g(l.annotations)&&d(l.annotations,(e,t)=>{p[x(c)+`.`+t]=e})});let m=_(p)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,p]:p};return s||o.set(e,m),m};function P(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ae(e){return P(e)===`Array`}function je(e){if(P(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Me(e,t,n,r,i){let a={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;a===`enumerable`&&(e[t]=n),i&&a===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function F(e,t={}){if(Ae(e))return e.map(e=>F(e,t));if(!je(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||Ae(t.props)&&!t.props.includes(r))return n;let i=e[r];return Me(n,r,F(i,t),e,t.nonenumerable),n},{})}var I=class{constructor({dedupe:e=!1}={}){this.classRegistry=new c,this.symbolRegistry=new s(e=>e.description??``),this.customTransformerRegistry=new m,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=N(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let i=ke(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,i=t?.inPlace?n:F(n);return r?.values&&(i=Te(i,r.values,r.v??0,this)),r?.referentialEqualities&&(i=Ee(i,r.referentialEqualities,r.v??0)),i}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};I.defaultInstance=new I,I.serialize=I.defaultInstance.serialize.bind(I.defaultInstance),I.deserialize=I.defaultInstance.deserialize.bind(I.defaultInstance),I.stringify=I.defaultInstance.stringify.bind(I.defaultInstance),I.parse=I.defaultInstance.parse.bind(I.defaultInstance),I.registerClass=I.defaultInstance.registerClass.bind(I.defaultInstance),I.registerSymbol=I.defaultInstance.registerSymbol.bind(I.defaultInstance),I.registerCustom=I.defaultInstance.registerCustom.bind(I.defaultInstance),I.allowErrorProps=I.defaultInstance.allowErrorProps.bind(I.defaultInstance),I.serialize,I.deserialize,I.stringify,I.parse,I.registerClass,I.registerCustom,I.registerSymbol,I.allowErrorProps;var Ne=1e4,Pe=6e3,Fe=2e3,Ie=3e4,L=class{_serverUrl;useWs;baseRetryMs;maxRetryMs;onConnectionChange;token;_trpcClient;_wsClient=null;mirror=null;mirrorInit=null;connected=!1;connectedPromise=null;_systemProxy;_connectionVersion=0;connectionListeners=new Set;constructor(e){this._serverUrl=e.serverUrl.replace(/\/+$/,``),this.token=e.token;let n=typeof window<`u`;this.useWs=e.useWebSocket??n,this.onConnectionChange=e.onConnectionChange,this.baseRetryMs=e.retryDelayMs??Fe,this.maxRetryMs=e.maxRetryDelayMs??Ie,this._trpcClient=this.buildTrpcClient(),this._systemProxy=t(this._trpcClient)}get serverUrl(){return this._serverUrl}get connectionVersion(){return this._connectionVersion}subscribeConnectionEvents(e){return this.connectionListeners.add(e),()=>{this.connectionListeners.delete(e)}}emitConnectionEvent(e){try{this.onConnectionChange?.(e)}catch{}for(let t of this.connectionListeners)try{t(e,this._connectionVersion)}catch{}}async awaitConnected(e){if(this.connected)return;if(this.connectedPromise)return this.connectedPromise;let t=e??15e3;this.connectedPromise=(async()=>{let e=this._trpcClient.auth.me.query();Number.isFinite(t)?await new Promise((n,r)=>{let i=setTimeout(()=>r(Error(`System.awaitConnected: probe timed out after ${t}ms`)),t);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})}):await e,this.connected=!0})();try{await this.connectedPromise}finally{this.connectedPromise=null}}async init(t){if(this.mirror?.isReady())return;if(this.mirrorInit)return this.mirrorInit;let n=new e(this._trpcClient);return this.mirror=n,this.mirrorInit=(async()=>{await this.awaitConnected(t),await n.init(t)})().finally(()=>{this.mirrorInit=null}),this.mirrorInit}async awaitReady(){if(!this.mirror?.isReady())return this.mirrorInit?this.mirrorInit:this.init()}isReady(){return this.mirror?.isReady()??!1}isConnected(){return this.connected}reconnect(){this.useWs&&(this.emitConnectionEvent(`connecting`),this._wsClient?.close(),this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._trpcClient=this.buildTrpcClient(),this._systemProxy=t(this._trpcClient))}switchServerUrl(e){let t=e.replace(/\/+$/,``);t!==this._serverUrl&&(this._serverUrl=t,this.reconnect())}async raceConnectionEndpoints(e){let t=e?.perCandidateTimeoutMs??1500,n=(()=>{try{return new URL(this._serverUrl)}catch{return null}})(),r=n?.port?Number(n.port):n?.protocol===`https:`?443:80,i=n?.protocol===`https:`?`https`:`http`,a=this._trpcClient.localNetwork?.getConnectionEndpoints;if(!a)return{winner:this._serverUrl,switched:!1};let o;try{o=(await a.query({port:r,ipv4Only:e?.ipv4Only,scheme:i})).endpoints}catch{return{winner:this._serverUrl,switched:!1}}if(o.length===0)return{winner:this._serverUrl,switched:!1};let s=await Re(o.map(e=>e.baseUrl),t);return!s||s===this._serverUrl?{winner:s??this._serverUrl,switched:!1}:(this.switchServerUrl(s),{winner:s,switched:!0})}close(){this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._wsClient?.close()}disposeMirror(){this.mirror?.dispose(),this.mirror=null,this.mirrorInit=null}async login(e,t){let n=await this._trpcClient.auth.login.mutate({username:e,password:t});if(typeof n==`object`&&n&&`token`in n){let e=n,t=e.token;typeof t==`string`&&e.requiresTotp!==!0&&this.setToken(t)}return n}async loginVerifyTotp(e,t){let n=await this._trpcClient.auth.loginVerifyTotp.mutate({challengeToken:e,code:t});if(typeof n==`object`&&n&&`token`in n){let e=n.token;typeof e==`string`&&this.setToken(e)}return n}async logout(){await this._trpcClient.auth.logout.mutate()}async getMe(){return await this._trpcClient.auth.me.query()}async changeOwnPassword(e){return await this._trpcClient.auth.changeOwnPassword.mutate(e)}async setupOwnTotp(){return await this._trpcClient.auth.setupOwnTotp.mutate()}async confirmOwnTotp(e){return await this._trpcClient.auth.confirmOwnTotp.mutate(e)}async disableOwnTotp(){return await this._trpcClient.auth.disableOwnTotp.mutate()}async getOwnTotpStatus(){return await this._trpcClient.auth.getOwnTotpStatus.query()}setToken(e){this.token=e}listDevices(e){return this.mirror?(e?this.mirror.query(e):this.mirror.getAllDevices()).map(e=>this.attachBinding(e)):[]}getDeviceInfo(e){return this.mirror?.getDeviceInfo(e)??null}listDeviceInfos(e){let t=this.mirror;if(!t)return[];let n=e?t.query(e):t.getAllDevices(),r=[];for(let e of n){let n=t.getDeviceInfo(e.deviceId);n&&r.push(n)}return r}getDevice(e){let t=this.mirror?.getDeviceById(e)??null;return t?this.attachBinding(t):null}getDeviceByName(e){let t=this.mirror?.getDeviceByName(e)??null;return t?this.attachBinding(t):null}getDeviceByStableId(e){let t=this.mirror?.getDeviceByStableId(e)??null;return t?this.attachBinding(t):null}async waitForDevice(e,t){this.mirror||await this.init();let n=await this.mirror.waitForDevice(e,t??3e4);return this.attachBinding(n)}onDeviceAdded(e){if(!this.mirror)throw Error(`System.onDeviceAdded: call init() before subscribing`);return this.mirror.onDeviceAdded(e)}onDeviceRemoved(e){if(!this.mirror)throw Error(`System.onDeviceRemoved: call init() before subscribing`);return this.mirror.onDeviceRemoved(e)}attachBinding(e){let t=this.lookupBinding(e.deviceId);if(t===e.binding)return e;let n=e;return n.binding=t,e}lookupBinding(e){return this.mirror?this.mirror.getDeviceById(e)?.binding??null:null}get addonPages(){return this._systemProxy.addonPages}get addonSettings(){return this._systemProxy.addonSettings}get alerts(){return this._systemProxy.alerts}get audioAnalyzer(){return this._systemProxy.audioAnalyzer}get audioCodec(){return this._systemProxy.audioCodec}get backup(){return this._systemProxy.backup}get decoder(){return this._systemProxy.decoder}get deviceManager(){return this._systemProxy.deviceManager}get deviceProvider(){return this._systemProxy.deviceProvider}get deviceState(){return this._systemProxy.deviceState}get metricsProvider(){return this._systemProxy.metricsProvider}get notificationOutput(){return this._systemProxy.notificationOutput}get pipelineExecutor(){return this._systemProxy.pipelineExecutor}get pipelineOrchestrator(){return this._systemProxy.pipelineOrchestrator}get pipelineRunner(){return this._systemProxy.pipelineRunner}get settingsStore(){return this._systemProxy.settingsStore}get storage(){return this._systemProxy.storage}get streamBroker(){return this._systemProxy.streamBroker}get turnProvider(){return this._systemProxy.turnProvider}get userManagement(){return this._systemProxy.userManagement}subscribeEvent(e,t){let n=this._trpcClient.live.onEvent.subscribe({category:e},{onData:e=>{try{t(e)}catch{}}});return()=>{try{n.unsubscribe()}catch{}}}get trpcClient(){return this._trpcClient}get wsClient(){return this._wsClient}buildTrpcClient(){let e=()=>{let e={};return this.token&&(e.Authorization=`Bearer ${this.token}`),e};if(this.useWs){let e=this._serverUrl.replace(/^http/,`ws`)+`/trpc`,t=this.baseRetryMs,i=this.maxRetryMs;return this._wsClient=n({url:e,connectionParams:()=>({token:this.token}),retryDelayMs:e=>Math.min(t*2**e,i),keepAlive:{enabled:!0,intervalMs:Ne,pongTimeoutMs:Pe},onOpen:()=>{this._connectionVersion+=1,this.emitConnectionEvent(`connected`)},onClose:()=>{this.emitConnectionEvent(`disconnected`)}}),a({links:[r({client:this._wsClient,transformer:I})]})}return this._wsClient=null,a({links:[i({url:`${this._serverUrl}/trpc`,headers:e,transformer:I})]})}};function Le(e){return new L(e)}async function Re(e,t){if(e.length===0)return null;if(typeof fetch!=`function`)return e[0]??null;let n=typeof window<`u`&&window.location!==void 0&&window.location.protocol===`https:`?e.filter(e=>e.toLowerCase().startsWith(`https://`)):e;if(n.length===0)return null;let r=n.map(()=>new AbortController),i=n.map(async(e,n)=>{let i=r[n],a=setTimeout(()=>i.abort(),t);try{let t=await fetch(`${e.replace(/\/+$/,``)}/trpc/health`,{method:`GET`,signal:i.signal,credentials:`omit`});if(!t.ok)throw Error(`${t.status}`);return e}finally{clearTimeout(a)}});try{let e=await Promise.any(i);for(let e of r)try{e.abort()}catch{}return e}catch{return null}}var ze=function(e){return e.Motion=`motion`,e.Person=`person`,e.Vehicle=`vehicle`,e.Animal=`animal`,e.Audio=`audio`,e.Face=`face`,e.Plate=`plate`,e.Package=`package`,e.Doorbell=`doorbell`,e.Sensor=`sensor`,e}({}),R=`animal.dog_cat.dog.cat.horse.sheep.cow.elephant.bear.zebra.giraffe.mouse.rabbit.deer.lion.tiger.bird.eagle.owl.pigeon.fish.whale.dolphin.snake.turtle.lizard`.split(`.`),z=[`person`,`people`,`pedestrian`,`rider`,`driver`,`cyclist`,`skier`,`skateboarder`,`face`,`hand`,`head`,`body`],B=[`vehicle`,`car`,`truck`,`bus`,`motorcycle`,`bicycle`,`van`,`ambulance`,`police_car`,`fire_truck`,`train`,`subway`,`tram`,`airplane`,`boat`,`ship`,`helicopter`],V=`face.eyes.nose.mouth.ears.eyebrows.left_eye.right_eye.pupil.iris.eyelid.eye_corner.upper_lip.lower_lip.teeth.chin.cheek.forehead.jaw.glasses.sunglasses.facial_hair.beard.mustache.facial_landmark.facial_keypoint`.split(`.`),H=[`plate`,`license_plate`,`front_plate`,`rear_plate`,`motorcycle_plate`,`temporary_plate`,`dealer_plate`,`licensePlate`,`plate_number`,`plate_character`,`plate_digit`,`plate_letter`,`plate_symbol`,`plate_region`,`plate_country_identifier`,`plate_frame`,`plate_bolt`,`plate_sticker`,`plate_validation_tag`,`damaged_plate`,`obscured_plate`,`dirty_plate`],U=[`motion`,`movement`,`other`],W=[`package`,`packet`],G=[`audio`],K=`speech.scream.babbling.yell.bellow.whoop.whispering.laughter.snicker.crying.cry.sigh.singing.choir.chant.mantra.child_singing.rapping.humming.groan.grunt.whistling.breathing.wheeze.snoring.gasp.pant.snort.cough.throat_clearing.sneeze.sniff.cheering.applause.chatter.crowd.children_playing.bark.yip.howl.bow-wow.growling.whimper_dog.purr.meow.hiss.caterwaul.pets.livestock.doorbell.ding-dong.door.slam.knock.alarm.telephone.music.dog.dogs`.split(`.`),q=[`doorbell`,`ring`],J=[`lock`,`binary`,`flood`,`entry`,`door`,`leak`,`door_open`,`flooded`,`entry_open`],Y={...R.reduce((e,t)=>({...e,[t]:`animal`}),{}),...z.reduce((e,t)=>({...e,[t]:`person`}),{}),...B.reduce((e,t)=>({...e,[t]:`vehicle`}),{}),...U.reduce((e,t)=>({...e,[t]:`motion`}),{}),...W.reduce((e,t)=>({...e,[t]:`package`}),{}),...V.reduce((e,t)=>({...e,[t]:`face`}),{}),...H.reduce((e,t)=>({...e,[t]:`plate`}),{}),...G.reduce((e,t)=>({...e,[t]:`audio`}),{}),...K.reduce((e,t)=>({...e,[t]:`audio`}),{}),...q.reduce((e,t)=>({...e,[t]:`doorbell`}),{}),...J.reduce((e,t)=>({...e,[t]:`sensor`}),{})},Be=e=>V.includes(e),Ve=e=>H.includes(e),He=e=>R.includes(e),Ue=e=>z.includes(e),We=e=>B.includes(e),Ge=e=>U.includes(e),Ke=e=>q.includes(e),qe=e=>W.includes(e),Je=e=>G.includes(e)||K.includes(e),Ye=e=>J.includes(e),Xe=e=>Be(e)||Ve(e),Ze=e=>Y[e],Qe=e=>{let{className:t}=e,n={face:`person`,plate:`vehicle`},r=Y[t];return r&&r!==t?r:n[t]},$e=Object.values(ze),X=$e.filter(e=>e!==`motion`),Z=[`person`,`doorbell`,`package`],et=[...Z,`vehicle`,`animal`,`audio`,`face`,`plate`],tt=[...X];function nt(e,t){switch(e){case`critical`:return Z;case`important`:return et;case`all`:return tt;case`custom`:return t?.length?t:X;default:return X}}var Q={Light:`light`,Switch:`switch`,WindowCovering:`cover`,Lock:`lock`,SecuritySystem:`alarm`,Buttons:`button`,Select:`select`,Siren:`siren`,Sensor:`sensor`,Entry:`entry`,Program:`script`,MediaPlayer:`media_player`,Outlet:`switch`,light:`light`,switch:`switch`,input_boolean:`switch`,cover:`cover`,lock:`lock`,alarm_control_panel:`alarm`,input_button:`button`,button:`button`,input_select:`select`,select:`select`,siren:`siren`,sensor:`sensor`,media_player:`media_player`,script:`script`},rt={light:`light`,switch:`switch`,input_boolean:`switch`,cover:`cover`,lock:`lock`,alarm_control_panel:`alarm`,input_button:`button`,button:`button`,input_select:`select`,select:`select`,siren:`siren`,sensor:`sensor`,binary_sensor:`sensor`,media_player:`media_player`,script:`script`,climate:`climate`,camera:`camera`,fan:`fan`,vacuum:`vacuum`,automation:`automation`,scene:`scene`,input_number:`sensor`,person:`person`,device_tracker:`tracker`,weather:`weather`,water_heater:`climate`},it={Light:`light`,Switch:`switch`,WindowCovering:`cover`,Lock:`lock`,SecuritySystem:`alarm`,Buttons:`button`,Select:`select`,Siren:`siren`,Sensor:`sensor`,Entry:`entry`,Program:`script`,MediaPlayer:`media_player`,Camera:`camera`,Doorbell:`doorbell`,Fan:`fan`,Outlet:`switch`};function at(e){return Q[e]||(Q[e.toLowerCase()]??null)}var ot=[`Entry`,`Light`,`Switch`,`Lock`,`SecuritySystem`,`Buttons`,`WindowCovering`,`Siren`,`Sensor`,`Select`,`Program`],st=new Set(ot),ct=[`light`,`switch`,`input_boolean`,`cover`,`lock`,`alarm_control_panel`,`input_button`,`button`,`input_select`,`select`,`siren`,`media_player`,`script`],lt=new Set(ct),$=[{id:`liveStream`,label:`Live Stream`,sources:{frigate:!0,scrypted:!0,rtsp:!0},adapterMethod:`getLiveStream`},{id:`multiResolution`,label:`Multi-Resolution`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getResolutions`},{id:`motion`,label:`Motion Detection`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getMotion`},{id:`objectDetection`,label:`Object Detection`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getObjectDetections`},{id:`audioVolume`,label:`Audio Level`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getAudioVolume`},{id:`audioVolumes`,label:`Audio Volumes (dBFS)`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getAudioVolumes`},{id:`ptz`,label:`PTZ Control`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getPTZ`},{id:`intercom`,label:`Intercom (Mic)`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getIntercomSupport`},{id:`deviceStatus`,label:`Device Status`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`getStatus`},{id:`timeline`,label:`Detection Timeline`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getCameraDayData`},{id:`clusteredTimeline`,label:`Clustered Timeline`,sources:{frigate:!0,scrypted:!0,rtsp:!1},requiresBackend:!0,adapterMethod:`getClusteredDayData`},{id:`detectionClasses`,label:`Detection Classes`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getDetectionClasses`},{id:`videoClips`,label:`Video Clips`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getVideoClips`},{id:`nvrPlayback`,label:`NVR Playback`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getNvrPlaybackSupported`},{id:`nvrScrub`,label:`NVR Scrub/Seek`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`seekRecordingStream`},{id:`recordingThumbnail`,label:`Recording Thumbnails`,sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:`getRecordingStreamThumbnail`},{id:`nvrSeekToLive`,label:`Seek to Live`,sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:`seekNvrToLive`}];function ut(e,t,n){let r=$.find(t=>t.id===e);return!(!r||!r.sources[t]||r.platforms&&r.platforms[n]===!1)}function dt(e){return $.filter(t=>t.sources[e])}function ft(){return $.filter(e=>e.requiresBackend)}export{X as DEFAULT_ENABLED_CLASSES,ze as DetectionClass,ct as ELIGIBLE_HA_DOMAINS,lt as ELIGIBLE_HA_DOMAINS_SET,ot as ELIGIBLE_SCRYPTED_DEVICE_TYPES,st as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET,$ as FEATURE_MATRIX,rt as HA_DOMAIN_TYPE_MAP,Q as RAW_TO_CANONICAL,it as SCRYPTED_TYPE_TO_CANONICAL,L as System,tt as TIMELINE_PRESET_ALL,Z as TIMELINE_PRESET_CRITICAL,et as TIMELINE_PRESET_IMPORTANT,R as animalClasses,G as audioClasses,K as audioLabelClasses,Le as createSystem,$e as defaultDetectionClasses,Y as detectionClassesDefaultMap,q as doorbellClasses,V as faceClasses,ft as getBackendRequiredFeatures,at as getCanonicalDeviceType,nt as getClassesForTimelinePreset,Ze as getParentClass,Qe as getParentDetectionClass,dt as getSourceFeatures,He as isAnimalClassname,Je as isAudioClassname,Ke as isDoorbellClassname,Be as isFaceClassname,ut as isFeatureAvailable,Xe as isLabelDetection,Ge as isMotionClassname,qe as isPackageClassname,Ue as isPersonClassname,Ve as isPlateClassname,Ye as isSensorLabelClassname,We as isVehicleClassname,H as licensePlateClasses,U as motionClasses,W as packageClasses,z as personClasses,Re as raceFastestEndpoint,J as sensorLabelClasses,B as vehicleClasses};
|