@camstack/addon-admin-ui 1.0.2 → 1.0.3
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-ty_4uW1H.js +1 -0
- package/dist/assets/AddonCollectionPage-CIvGYL8Z.js +1 -0
- package/dist/assets/Addons-CWtFT6QM.js +1 -0
- package/dist/assets/AdminPage-CN6ZMhf0.js +1 -0
- package/dist/assets/AdminTabs-7T1CldHN.js +1 -0
- package/dist/assets/BrokerForm-DzjaLHmG.js +1 -0
- package/dist/assets/BrokerStep-B3pEVZ2L.js +1 -0
- package/dist/assets/Capabilities-D2qn1TDV.js +1 -0
- package/dist/assets/CapabilityBadges-BWnECBvl.js +1 -0
- package/dist/assets/Cluster-BVUZdAyW.js +7 -0
- package/dist/assets/Dashboard-HorCsmCt.js +1 -0
- package/dist/assets/Data-hispFwBv.js +1 -0
- package/dist/assets/DetectionIntelligence-BtnTELA6.js +1 -0
- package/dist/assets/DeviceDetail-OXTiYiO9.js +2 -0
- package/dist/assets/Devices-XIivtEYO.js +1 -0
- package/dist/assets/EmbedPlayerPage-CIF0Ft1g.js +1 -0
- package/dist/assets/FormBuilder-DVLWBVys.js +1 -0
- package/dist/assets/Identity-8krGNqDO.js +1 -0
- package/dist/assets/IntegrationDetail-Dyg4wlgs.js +1 -0
- package/dist/assets/Integrations-CxFwUmeX.js +1 -0
- package/dist/assets/Integrations-CxuWXvnl.js +1 -0
- package/dist/assets/Logs-DYrcsFh9.js +1 -0
- package/dist/assets/MaskShapeCanvas-C5K6H6Th.js +1 -0
- package/dist/assets/MotionZonesSettings-CepMSlXn.js +1 -0
- package/dist/assets/MyAccess-C-zxwxTM.js +2 -0
- package/dist/assets/Network-D5ppyqPS.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-B4ru8rzf.js +1 -0
- package/dist/assets/Pipeline-CS6lN8Ww.js +1 -0
- package/dist/assets/PrivacyMaskSettings-Cut8tYhS.js +1 -0
- package/dist/assets/ProviderIcon-BpqSF3Hu.js +1 -0
- package/dist/assets/SchemaTabBar-ByWwzBUZ.js +1 -0
- package/dist/assets/Settings-CriiXyFu.js +1 -0
- package/dist/assets/Showroom-KHowYChm.js +1 -0
- package/dist/assets/StatusBadge-CkYubfRG.js +1 -0
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Cus-LW9c.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DEeasWo3.js +1 -0
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C2cB5JUo.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C1rR7FKs.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CXx5u_N6.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DQOBkcAT.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-B2sDsXg0.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PYw2UAZ_.js} +3 -3
- package/dist/assets/bell-C1jXqDWz.js +1 -0
- package/dist/assets/circle-check-big-is5GRKO9.js +1 -0
- package/dist/assets/copy-tH10joFB.js +1 -0
- package/dist/assets/download-DyMeaCfZ.js +1 -0
- package/dist/assets/format-size-CO9d3C3-.js +1 -0
- package/dist/assets/hls-IujbK-0_.js +40 -0
- package/dist/assets/{hostInit-BTTV3T99.js → hostInit-8PN225l2.js} +1 -1
- package/dist/assets/index-CAfPe666.js +4 -0
- package/dist/assets/key-round-eCBxaKT6.js +1 -0
- package/dist/assets/{mf-entry-bootstrap-0-2d3bf175.js → mf-entry-bootstrap-0-137d5c5b.js} +2 -2
- package/dist/assets/pencil-xW8n5CLs.js +1 -0
- package/dist/assets/player-overlays-DzZKARlk.js +1 -0
- package/dist/assets/plus-DVpT3Ja2.js +1 -0
- package/dist/assets/radio-CWnAI4na.js +1 -0
- package/dist/assets/refresh-cw-BKhUNMXQ.js +1 -0
- package/dist/assets/remoteEntry-BOZn_K50.js +1 -0
- package/dist/assets/rotate-ccw-BXu8SIv5.js +1 -0
- package/dist/assets/rotate-cw-BO4D9G2F.js +1 -0
- package/dist/assets/search-DyWYI0Yj.js +1 -0
- package/dist/assets/server-X3K4ldX4.js +1 -0
- package/dist/assets/sparkles-ChgPFrhX.js +1 -0
- package/dist/assets/square-Faey8y7b.js +1 -0
- package/dist/assets/square-check-big-Bzz95oCZ.js +1 -0
- package/dist/assets/src-C5tvi19O.js +34 -0
- package/dist/assets/upload-BeG8PyHB.js +1 -0
- package/dist/assets/useDevice-B7VwJa4X.js +1 -0
- package/dist/assets/useEventInvalidation-Cf9VIpDW.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bkv14Bzm.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BLisQvKo.js} +2 -2
- package/dist/assets/wifi-DYJHTrlD.js +1 -0
- package/dist/assets/zap-DLiiHws-.js +1 -0
- package/dist/index.html +4 -3
- package/dist/sw.js +1 -1
- package/package.json +1 -2
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BxNjjb9O.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-1rzf3QZV.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-CPJ7iclX.js +0 -1
- package/dist/assets/dist-q2poCTnb.js +0 -75
- package/dist/assets/index-BKoIXFjm.js +0 -82
- package/dist/assets/remoteEntry-DLAuLulq.js +0 -1
- package/dist/assets/src-BE2rTAMO.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e,G as t,R as n,W as r,X as i,b as a,j as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PYw2UAZ_.js";i();var g={rect:`#ef4444`,polygon:`#3b82f6`,grid:`#6366f1`,line:`#f59e0b`},_=`33`,v=`66`,y=`#6366f1`,b=3,x=2,S=12,C=16,w=9;function T(e,t,n){return{x:e.x*t,y:e.y*n}}function E(e,t,n){return{x:e.x/t,y:e.y/n}}function D(e,t,n){return e.flatMap(e=>[e.x*t,e.y*n])}function O(e){return!Number.isFinite(e)||e<0?0:e>1?1:e}function k(e){return e.color??g[e.shape.kind]}function A(e,t){let n=e[t],r=e[(t+1)%e.length];if(!n||!r)return[...e];let i={x:(n.x+r.x)/2,y:(n.y+r.y)/2};return[...e.slice(0,t+1),i,...e.slice(t+1)]}function j(e,t){return e.length===t.length?e.every((e,n)=>{let r=t[n];return Math.abs(e.x-r.x)<1e-6&&Math.abs(e.y-r.y)<1e-6}):!1}function M(e){return e.kind===`polygon`||e.kind===`line`}function N({items:i,selectedId:o,onSelect:d,onShapeChange:f,onDrawComplete:p,drawingKind:_,supportedShapes:v,transparent:A=!1,backdrop:N,polygonVertices:P,grid:F}){let z=r(null),[B,V]=t({w:800,h:450}),[H,U]=t([]),[W,G]=t(null),[ee,te]=t(null),[K,q]=t(null),J=_!==null&&v.includes(_);n(()=>{if(!K)return;let e=i.find(e=>e.id===K.itemId);if(!e||!M(e.shape)){q(null);return}j(e.shape.points,K.points)&&q(null)},[i,K]),n(()=>{let e=z.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];if(!t)return;let{width:n,height:r}=t.contentRect;V(A?{w:n,h:r}:{w:n,h:n*9/16})});return t.observe(e),()=>t.disconnect()},[A]),n(()=>{!J&&W!==null&&G(null)},[J,W]);let Y=e(e=>{p(e),U([])},[p]),X=e(e=>{if(!J||_===null){d(null);return}let t=e.target.getStage();if(!t)return;let n=t.getPointerPosition();if(!n)return;let r=E(n,B.w,B.h);if(_===`rect`){let e=O(r.x),t=O(r.y);Y({kind:`rect`,x:e,y:t,width:Math.min(.2,1-e),height:Math.min(.2,1-t)});return}if(_===`grid`){let e=F?.width??C,t=F?.height??w;Y({kind:`grid`,gridWidth:e,gridHeight:t,cells:Array.from({length:e*t},()=>!1)});return}if(_===`line`){if(H.length===0){U([r]);return}Y({kind:`line`,points:[...H,r]});return}if(_===`polygon`){if(H.length===0){U([r]);return}if(H.length>=b){let e=T(H[0],B.w,B.h);if(Math.hypot(n.x-e.x,n.y-e.y)<S){Y({kind:`polygon`,points:H});return}}U(e=>[...e,r])}},[J,_,H,B,F,Y,d]),ne=e(e=>{!J||_!==`polygon`||H.length<b||(e.cancelBubble=!0,Y({kind:`polygon`,points:H}))},[J,_,H,Y]),Z=r(null),Q=r(null);n(()=>()=>{Z.current!==null&&cancelAnimationFrame(Z.current)},[]);let re=e(e=>{if(!J)return;let t=e.target.getStage();t&&(Q.current=t.getPointerPosition()??null,Z.current===null&&(Z.current=requestAnimationFrame(()=>{Z.current=null,G(Q.current)})))},[J]),ie=r(!1),ae=r(!0),oe=r(new Set),se=e((e,t,n,r)=>{let i=t.gridWidth*t.gridHeight;if(n<0||n>=i||t.cells[n]===r)return;let a=[...t.cells];for(;a.length<i;)a.push(!1);a.length=i,a[n]=r,f(e,{...t,cells:a})},[f]),$=[];if(!A){for(let e=1;e<C;e++){let t=B.w/C*e;$.push(a(l,{points:[t,0,t,B.h],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gv-${e}`))}for(let e=1;e<w;e++){let t=B.h/w*e;$.push(a(l,{points:[0,t,B.w,t],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gh-${e}`))}}return s(`div`,{ref:z,className:A?`absolute inset-0`:`relative w-full bg-zinc-900 rounded-lg overflow-hidden`,style:{cursor:J?`crosshair`:`default`},children:[N&&!A?a(`div`,{className:`absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover`,style:{width:B.w,height:B.h},children:N}):null,s(c,{width:B.w,height:B.h,onClick:X,onDblClick:ne,onMouseMove:re,children:[s(h,{listening:!1,children:[a(l,{points:[0,0,B.w,0,B.w,B.h,0,B.h,0,0],stroke:`transparent`,strokeWidth:0}),$]}),a(h,{children:i.map(e=>{let t=e.id===o,n=e.enabled===!1,r=k(e),i=t&&!J&&!n;if(e.shape.kind===`rect`)return a(I,{item:e,shape:e.shape,color:r,selected:t,dimmed:n,editable:i,isDrawing:J,size:B,onSelect:d,onShapeChange:f},e.id);if(e.shape.kind===`grid`)return a(L,{item:e,shape:e.shape,color:r,dimmed:n,editable:i,size:B,onSelect:d,paintingRef:ie,paintValueRef:ae,paintedRef:oe,paintCell:se},e.id);let s=e.shape.kind===`line`,c=s?x:Math.max(b,P?.min??b),l=s?x:P?.max,u=K&&K.itemId===e.id?K.points:e.shape.points;return a(R,{item:e,shape:e.shape,color:r,selected:t,dimmed:n,editable:i,isLine:s,isDrawing:J,size:B,effectivePoints:u,minVertices:c,maxVertices:l,isDragging:ee===e.id,onSelect:d,onShapeChange:f,setDragOverride:q,setDraggingItemId:te},e.id)})}),a(h,{listening:!1,children:J&&H.length>0&&s(u,{children:[_===`polygon`&&H.length>=2&&a(l,{points:D(H,B.w,B.h),stroke:y,strokeWidth:1.5,dash:[6,3],opacity:.8}),_===`line`&&H.length===1&&W&&a(l,{points:[H[0].x*B.w,H[0].y*B.h,W.x,W.y],stroke:g.line,strokeWidth:1.5,dash:[6,3],opacity:.7}),_===`polygon`&&W&&H.length>=1&&a(l,{points:[H[H.length-1].x*B.w,H[H.length-1].y*B.h,W.x,W.y],stroke:y,strokeWidth:1,dash:[4,4],opacity:.5}),H.map((e,t)=>{let n=T(e,B.w,B.h),r=t===0&&_===`polygon`&&H.length>=b;return a(m,{x:n.x,y:n.y,radius:r?7:4,fill:r?y:`#ffffff`,stroke:y,strokeWidth:1.5,opacity:.9},t)})]})})]}),J?a(`div`,{className:`px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700`,children:_===`line`?`Click to set the start point, click again to complete the line`:_===`rect`?`Click to drop a rectangle, then drag the corner to resize`:_===`grid`?`Click to add the grid, then paint cells`:H.length<b?`Click to add points (min 3). Double-click or click the first point to close.`:`Continue adding points. Double-click or click the first point to close.`}):null]})}var P=.02;function F(e,t){return Math.abs(e.x-t.x)<1e-6&&Math.abs(e.y-t.y)<1e-6&&Math.abs(e.width-t.width)<1e-6&&Math.abs(e.height-t.height)<1e-6}function I({item:e,shape:r,color:i,selected:o,dimmed:c,editable:l,isDrawing:p,size:h,onSelect:g,onShapeChange:y}){let[b,x]=t(null),S={x:r.x,y:r.y,width:r.width,height:r.height};n(()=>{b&&F(S,b)&&x(null)},[r.x,r.y,r.width,r.height,b]);let C=b??S,w=C.x*h.w,T=C.y*h.h,E=C.width*h.w,D=C.height*h.h,k=c?.35:o?1:.85,A=t=>{x(t),y(e.id,{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height})};return a(u,{onClick:t=>{t.cancelBubble=!0,p||g(e.id)},children:s(u,{draggable:l,dragBoundFunc:l?e=>({x:Math.max(-w,Math.min(h.w-(w+E),e.x)),y:Math.max(-T,Math.min(h.h-(T+D),e.y))}):void 0,onDragEnd:l?e=>{let t=e.target,n=t.x()/h.w,r=t.y()/h.h;if(t.position({x:0,y:0}),n===0&&r===0)return;let i=Math.min(Math.max(0,C.x+n),Math.max(0,1-C.width)),a=Math.min(Math.max(0,C.y+r),Math.max(0,1-C.height));A({...C,x:i,y:a})}:void 0,onMouseEnter:e=>{if(!l)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!l)return;let t=e.target.getStage();t&&(t.container().style.cursor=p?`crosshair`:`default`)},children:[a(f,{x:w,y:T,width:E,height:D,fill:i+(o?v:_),stroke:i,strokeWidth:o?2.5:1.5,opacity:k}),e.label?a(d,{x:w,y:T-16,text:e.label,fontSize:12,fill:i,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1}):null,l?a(m,{x:w+E,y:T+D,radius:6,fill:i,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,dragBoundFunc:e=>({x:Math.min(h.w,Math.max(w,e.x)),y:Math.min(h.h,Math.max(T,e.y))}),onDragStart:e=>{e.cancelBubble=!0},onDragMove:e=>{let t=e.target,n=O(t.x()/h.w-C.x),r=O(t.y()/h.h-C.y);x({...C,width:Math.max(P,Math.min(n,1-C.x)),height:Math.max(P,Math.min(r,1-C.y))})},onDragEnd:e=>{let t=e.target,n=O(t.x()/h.w-C.x),r=O(t.y()/h.h-C.y);A({...C,width:Math.max(P,Math.min(n,1-C.x)),height:Math.max(P,Math.min(r,1-C.y))})},onMouseEnter:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`nwse-resize`)},onMouseLeave:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`default`)}}):null]})})}function L({item:e,shape:t,color:n,dimmed:r,editable:i,size:o,onSelect:s,paintingRef:c,paintValueRef:l,paintedRef:d,paintCell:p}){let{gridWidth:m,gridHeight:h,cells:g}=t,_=o.w/m,y=o.h/h,b=m*h,x=r?.3:1,S=n=>{if(!i){s(e.id);return}let r=g[n]!==!0;c.current=!0,l.current=r,d.current=new Set([n]),p(e.id,t,n,r)},C=n=>{!c.current||!i||d.current.has(n)||(d.current.add(n),p(e.id,t,n,l.current))},w=()=>{c.current&&(c.current=!1,d.current=new Set)};return a(u,{opacity:x,onMouseUp:w,onMouseLeave:w,children:Array.from({length:b},(e,t)=>{let r=t%m,i=Math.floor(t/m),o=g[t]===!0;return a(f,{x:r*_,y:i*y,width:_,height:y,fill:o?n+v:`#ffffff10`,stroke:o?n:`#ffffff40`,strokeWidth:.5,onMouseDown:e=>{e.cancelBubble=!0,S(t)},onMouseEnter:()=>C(t)},t)})})}function R({item:e,shape:t,color:n,selected:r,dimmed:i,editable:o,isLine:c,isDrawing:f,size:h,effectivePoints:g,minVertices:y,maxVertices:b,isDragging:x,onSelect:S,onShapeChange:C,setDragOverride:w,setDraggingItemId:O}){let k=D(g,h.w,h.h),j=i?.35:r?1:c?.8:.85,M=e=>c?{kind:`line`,points:[...e]}:{kind:`polygon`,points:[...e]},N=g.map(e=>e.x*h.w),P=g.map(e=>e.y*h.h),F=N.length>0?Math.min(...N):0,I=N.length>0?Math.max(...N):0,L=P.length>0?Math.min(...P):0,R=P.length>0?Math.max(...P):0,z=e=>({x:Math.max(-F,Math.min(h.w-I,e.x)),y:Math.max(-L,Math.min(h.h-R,e.y))}),B=n=>{let r=n.target,i=r.x()/h.w,a=r.y()/h.h;if(r.position({x:0,y:0}),O(null),i===0&&a===0)return;let o=t.points.map(e=>({x:e.x+i,y:e.y+a}));w({itemId:e.id,points:o}),C(e.id,M(o))},V=!c&&g.length>y,H=!c&&(b===void 0||g.length<b);return s(u,{onClick:t=>{t.cancelBubble=!0,f||S(e.id)},children:[s(u,{draggable:o,dragBoundFunc:o?z:void 0,onDragStart:o?()=>O(e.id):void 0,onDragEnd:o?B:void 0,onMouseEnter:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=f?`crosshair`:`default`)},children:[c?a(p,{points:k,stroke:n,strokeWidth:r?3:2,fill:n,pointerLength:10,pointerWidth:8,opacity:j}):a(l,{points:k,closed:!0,fill:n+(r?v:_),stroke:n,strokeWidth:r?2.5:1.5,opacity:j}),e.label&&g.length>0?(()=>{let t=T({x:g.reduce((e,t)=>e+t.x,0)/g.length,y:g.reduce((e,t)=>e+t.y,0)/g.length},h.w,h.h),r=Math.max(40,e.label.length*11*.62);return a(d,{x:t.x-r/2,y:t.y-7,width:r,align:`center`,text:e.label,fontSize:12,fill:n,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1})})():null]}),o&&!x&&g.map((r,i)=>{let o=T(r,h.w,h.h);return a(m,{x:o.x,y:o.y,radius:5,fill:n,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,onDragMove:n=>{let r=E({x:n.target.x(),y:n.target.y()},h.w,h.h);w(n=>{let a=n&&n.itemId===e.id?n.points:t.points;return{itemId:e.id,points:a.map((e,t)=>t===i?r:e)}})},onDragEnd:n=>{let r=E({x:n.target.x(),y:n.target.y()},h.w,h.h),a=t.points.map((e,t)=>t===i?r:e);w({itemId:e.id,points:a}),C(e.id,M(a))},onContextMenu:n=>{n.evt.preventDefault(),n.cancelBubble=!0,V&&C(e.id,M(t.points.filter((e,t)=>t!==i)))}},`pt-${i}`)}),o&&!x&&H&&g.length>=2&&g.map((r,i)=>{let o=g[(i+1)%g.length],s=T({x:(r.x+o.x)/2,y:(r.y+o.y)/2},h.w,h.h);return a(m,{x:s.x,y:s.y,radius:4,fill:`#ffffff`,stroke:n,strokeWidth:1.5,opacity:.6,onMouseEnter:e=>{let t=e.target;t.to({radius:6,opacity:1,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=`copy`)},onMouseLeave:e=>{let t=e.target;t.to({radius:4,opacity:.6,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=f?`crosshair`:`default`)},onClick:n=>{n.cancelBubble=!0,C(e.id,M(A(t.points,i)))}},`mid-${i}`)})]})}var z=o(N);export{z as MaskShapeCanvas};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e,G as t,R as n,U as r,W as i,X as a,b as o,x as s,y as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{L as l,V as u,c as ee,g as d,n as f,p,s as m}from"./player-overlays-DzZKARlk.js";import{MaskShapeCanvas as h}from"./MaskShapeCanvas-C5K6H6Th.js";var te=d(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]);a();var ne=110,g=`motion-zones`,_=0,re=[1,2,3],v=1,y=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,b=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function x(e,t,n){let r=t*n,i=Array(r);for(let t=0;t<r;t+=1)i[t]=e[t]===!0;return i}function S(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function C(e,t){return Math.ceil(e/t)}function w(e,t,n){return Math.min(n-1,Math.floor((e+.5)/t*n))}function T(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array(i*a).fill(!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)e[r*t+n]===!0&&(o[s*i+w(n,t,i)]=!0)}return o}function E(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array(t*n).fill(!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)o[r*t+n]=e[s*i+w(n,t,i)]===!0}return o}function D({deviceId:a}){let d=ee(p().trpcClient,a),[w,D]=t(null),[O,k]=t(!1),[A,j]=t(null),[M,N]=t(null),[P,F]=t(v),[I,L]=t(!1),[R,z]=t(!1),B=i(!1);n(()=>{if(!d)return;let e=!1;return B.current=!1,D(null),k(!1),j(null),N(null),F(v),z(!1),(async()=>{try{let t=await d.motionZones?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(D(t),B.current)return;let n=await d.motionZones?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);B.current=!0;let r=n.regions.find(e=>e.shape.kind===`grid`),i=x(r?r.shape.cells:[],t.grid.width,t.grid.height);N(i),j(T(i,t.grid.width,t.grid.height,v))}catch(t){if(e)return;u(t)?k(!0):console.error(`Motion Zones load failed`,t)}})(),()=>{e=!0}},[d]);let V=w?w.grid.width:0,H=w?w.grid.height:0,U=C(V,P),W=C(H,P),G=r(()=>A&&w?E(A,V,H,P):null,[A,w,V,H,P]),K=r(()=>G!==null&&M!==null&&!S(G,M),[G,M]),q=r(()=>G?G.reduce((e,t)=>t?e+1:e,0):0,[G]),J=V*H,Y=U*W,X=e(e=>{Y>0&&j(Array(Y).fill(e))},[Y]),Z=e(()=>{j(e=>e&&e.map(e=>!e))},[]),ie=e(()=>{M&&w&&j(T(M,V,H,P))},[M,w,V,H,P]),ae=e(e=>{e===P||!w||j(t=>{if(!t)return F(e),t;let n=T(E(t,V,H,P),V,H,e);return F(e),n})},[P,w,V,H]),Q=r(()=>w&&A?[{id:_,shape:{kind:`grid`,gridWidth:U,gridHeight:W,cells:[...A]}}]:[],[w,A,U,W]),$=e((e,t)=>{t.kind===`grid`&&j(t.cells)},[]),oe=e(async()=>{if(!(!d||!A||!w)){L(!0);try{let e=E(A,w.grid.width,w.grid.height,P),t={kind:`grid`,gridWidth:w.grid.width,gridHeight:w.grid.height,cells:e};await d.motionZones?.setZone({patch:{regions:[{id:_,enabled:!0,shape:t}]}});let n=await d.motionZones?.getStatus({});if(n){let e=n.regions.find(e=>e.shape.kind===`grid`),t=x(e?e.shape.cells:[],w.grid.width,w.grid.height);N(t),j(T(t,w.grid.width,w.grid.height,P))}}catch(e){console.error(`Motion Zones save failed`,e)}finally{L(!1)}}},[d,A,w,P]);return f(r(()=>R&&!O&&w&&A?{id:g,order:ne,node:o(h,{transparent:!0,items:Q,supportedShapes:[`grid`],grid:{width:U,height:W},selectedId:_,onSelect:()=>{},onShapeChange:$,onDrawComplete:()=>{},drawingKind:null})}:null,[R,O,w,A,Q,$,U,W])),d?o(m,{title:`Motion Zones`,icon:o(te,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:o(`div`,{className:`flex flex-col gap-3`,children:O?o(`p`,{className:`${l} leading-relaxed`,children:`This camera doesn't expose an on-board motion zones grid.`}):!O&&w!==null&&A!==null?s(c,{children:[s(`p`,{className:`${l} leading-relaxed`,children:[`Toggle `,o(`strong`,{className:`text-foreground`,children:`Edit grid`}),` to paint the region directly on the live frame, then `,o(`strong`,{className:`text-foreground`,children:`Save`}),` to push the mask to the camera. Pick a bigger`,` `,o(`strong`,{className:`text-foreground`,children:`Cell size`}),` for quicker, broad-stroke painting — it's resampled to the camera's native `,w.grid.width,`×`,w.grid.height,` grid on save (×1 is the finest).`]}),s(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[o(`button`,{type:`button`,onClick:()=>z(e=>!e),disabled:I,"aria-pressed":R,className:R?b:y,children:R?`Done editing`:`Edit grid`}),o(`button`,{type:`button`,onClick:()=>X(!0),disabled:I,className:y,children:`All on`}),o(`button`,{type:`button`,onClick:()=>X(!1),disabled:I,className:y,children:`All off`}),o(`button`,{type:`button`,onClick:Z,disabled:I,className:y,children:`Invert`}),s(`div`,{className:`flex items-center gap-1 ml-1`,role:`group`,"aria-label":`Cell size`,children:[o(`span`,{className:`${l} mr-0.5`,children:`Cell size`}),re.map(e=>s(`button`,{type:`button`,onClick:()=>ae(e),disabled:I,"aria-pressed":P===e,title:e===1?`Camera grid ${V}×${H} (finest)`:`${C(V,e)}×${C(H,e)} painting grid · cells ×${e} bigger`,className:P===e?b:y,children:[`×`,e]},e))]}),s(`span`,{className:`${l} ml-1 tabular-nums`,children:[q,` / `,J,` cells · `,w.grid.width,`×`,w.grid.height,P===1?``:` · paint ${U}×${W}`]}),o(`span`,{className:`flex-1`}),o(`button`,{type:`button`,onClick:ie,disabled:I||!K,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),o(`button`,{type:`button`,onClick:()=>void oe(),disabled:I||!K,className:b,children:I?`Saving…`:`Save`})]})]}):o(`p`,{className:`${l} leading-relaxed`,children:`Loading the camera's grid…`})})}):null}export{D as MotionZonesSettings};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-BHo8W_uH.js","assets/rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./vite-preload-helper-zJ_50EbN.js";import"./src-C5tvi19O.js";import{G as n,R as r,U as i,X as a,a as o,b as s,t as c,x as l,y as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as d}from"./player-overlays-DzZKARlk.js";import{t as f}from"./circle-check-big-is5GRKO9.js";import{t as p}from"./copy-tH10joFB.js";import{t as m}from"./key-round-eCBxaKT6.js";import{t as h}from"./pencil-xW8n5CLs.js";import{C as g,T as _,b as v,j as y,l as b,r as x,s as S,x as C,y as w}from"./index-CAfPe666.js";import{t as T}from"./AdminPage-CN6ZMhf0.js";a();function E({value:i,size:a=192}){let[o,c]=n(null),[u,d]=n(null);if(r(()=>{let n=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(n)return;let t=e.create;if(typeof t!=`function`){d(`qrcode.create() unavailable in installed version`);return}try{let e=t(i,{errorCorrectionLevel:`M`});n||c(e)}catch(e){n||d(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1])).catch(()=>{n||d(`qrcode library not installed`)}),()=>{n=!0}},[i]),u)return s(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:a,height:a},children:`QR rendering unavailable — use the secret below.`});if(!o)return s(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:a,height:a},children:`Generating…`});let f=o.modules.size,p=a/f,m=[];for(let e=0;e<f;e++)for(let t=0;t<f;t++)o.modules.data[e*f+t]&&m.push(s(`rect`,{x:t*p,y:e*p,width:p,height:p,fill:`currentColor`},`${t}-${e}`));return l(`svg`,{width:a,height:a,viewBox:`0 0 ${a} ${a}`,className:`text-black`,children:[s(`rect`,{x:0,y:0,width:a,height:a,fill:`white`}),m]})}a();var D={view:{icon:_,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:h,cls:`bg-primary/15 text-primary`},delete:{icon:S,cls:`bg-danger/15 text-danger`}};function O(){let{user:e,logout:t}=x();if(!e)return s(T,{children:s(`div`,{className:`text-xs text-foreground-subtle`,children:`Not signed in.`})});let n=e.isAdmin,r=e.scopes??[];return l(T,{children:[l(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[s(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:e.username.slice(0,1).toUpperCase()}),l(`div`,{className:`flex-1 min-w-0`,children:[s(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:e.username}),l(`div`,{className:`text-[11px] text-foreground-subtle`,children:[n?`Administrator`:`User`,` · session id`,` `,l(`span`,{className:`font-mono`,children:[e.id.slice(0,8),`…`]})]})]})]}),n&&l(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[s(g,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),l(`div`,{children:[s(`div`,{className:`font-semibold text-foreground`,children:`Unrestricted access`}),s(`p`,{className:`text-foreground-subtle mt-0.5`,children:`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`})]})]}),s(k,{}),s(j,{username:e.username}),r.length>0&&l(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[l(`div`,{className:`px-4 py-2 border-b border-border`,children:[s(`div`,{className:`text-xs font-semibold text-foreground`,children:`Granted scopes`}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Baked into your session token at login; sign out + back in to refresh after changes.`})]}),l(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[s(`div`,{children:`Type`}),s(`div`,{children:`Target`}),s(`div`,{children:`Access`})]}),s(`ul`,{className:`divide-y divide-border`,children:r.map((e,t)=>l(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[s(`span`,{className:`font-mono text-foreground-subtle`,children:e.type}),s(`span`,{className:`font-mono text-foreground`,children:e.type===`device`?e.targets.join(`, `):e.target}),s(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(t=>{let n=e.access.includes(t),{icon:r,cls:i}=D[t];return l(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n?i:`bg-transparent text-foreground-subtle/40 line-through`}`,title:n?`Can ${t}`:`Cannot ${t}`,children:[s(r,{className:`h-3 w-3`}),t]},t)})})]},t))})]}),s(`div`,{className:`flex justify-end`,children:l(`button`,{onClick:t,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-foreground-subtle/10 hover:text-foreground transition-colors`,children:[s(w,{className:`h-3 w-3`}),`Sign out`]})})]})}function k(){let e=d(),[t,r]=n(``),[i,a]=n(``),[o,u]=n(``),[p,h]=n(null),g=c({mutationFn:t=>e.changeOwnPassword(t),onSuccess:()=>{h({kind:`success`,msg:`Password updated.`}),r(``),a(``),u(``)},onError:e=>{h({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),_=i.length>0&&o.length>0&&i!==o,b=i.length>0&&i.length<8,x=t.length>=1&&i.length>=8&&i===o;return l(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[l(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[s(m,{className:`h-3.5 w-3.5 text-foreground-subtle`}),s(`div`,{className:`text-xs font-semibold text-foreground`,children:`Change password`})]}),l(`div`,{className:`p-4 space-y-3`,children:[s(A,{label:`Current password`,value:t,onChange:r,autoComplete:`current-password`}),s(A,{label:`New password`,value:i,onChange:a,autoComplete:`new-password`,hint:`At least 8 characters.`}),s(A,{label:`Confirm new password`,value:o,onChange:u,autoComplete:`new-password`}),(_||b)&&s(`div`,{className:`text-[11px] text-danger`,children:_?`Passwords do not match.`:`New password must be at least 8 characters.`}),p&&l(`div`,{className:`text-[11px] flex items-center gap-1 ${p.kind===`success`?`text-emerald-500`:`text-danger`}`,children:[p.kind===`success`?s(f,{className:`h-3 w-3`}):s(y,{className:`h-3 w-3`}),p.msg]}),s(`div`,{className:`flex justify-end`,children:l(`button`,{onClick:()=>{h(null),g.mutate({currentPassword:t,newPassword:i})},disabled:!x||g.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[g.isPending?s(C,{className:`h-3 w-3 animate-spin`}):s(v,{className:`h-3 w-3`}),`Update password`]})})]})]})}function A({label:e,value:t,onChange:n,autoComplete:r,hint:i}){return l(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),s(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:r,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`}),i&&s(`div`,{className:`text-[10px] text-foreground-subtle`,children:i})]})}function j({username:e}){let t=d(),a=o({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>t.getOwnTotpStatus()}),m=a.data,[h,g]=n(null),[_,v]=n(``),[x,S]=n(null),[w,T]=n(!1),D=c({mutationFn:()=>t.setupOwnTotp(),onSuccess:e=>{g({secret:e.secret,otpauthUrl:e.otpauthUrl}),v(``),S(null)},onError:e=>S(e instanceof Error?e.message:`Setup failed`)}),O=c({mutationFn:e=>t.confirmOwnTotp(e),onSuccess:()=>{g(null),v(``),S(null),a.refetch()},onError:e=>S(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),k=c({mutationFn:()=>t.disableOwnTotp(),onSuccess:()=>{S(null),a.refetch()},onError:e=>S(e instanceof Error?e.message:`Disable failed`)});r(()=>{if(!w)return;let e=setTimeout(()=>T(!1),1500);return()=>clearTimeout(e)},[w]);let A=i(()=>a.isLoading?`loading`:h?`setup_in_progress`:m?.enabled?`enrolled`:`not_enrolled`,[a.isLoading,m?.enabled,h]);return l(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[l(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[s(b,{className:`h-3.5 w-3.5 text-foreground-subtle`}),s(`div`,{className:`text-xs font-semibold text-foreground`,children:`Two-factor authentication`})]}),l(`div`,{className:`p-4 space-y-3`,children:[A===`loading`&&l(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[s(C,{className:`h-3.5 w-3.5 animate-spin`}),`Checking status…`]}),A===`not_enrolled`&&l(u,{children:[s(`div`,{className:`text-xs text-foreground-subtle`,children:`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`}),s(`div`,{className:`flex justify-end`,children:l(`button`,{onClick:()=>{S(null),D.mutate()},disabled:D.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[D.isPending?s(C,{className:`h-3 w-3 animate-spin`}):s(b,{className:`h-3 w-3`}),`Enable 2FA`]})})]}),A===`setup_in_progress`&&h&&l(u,{children:[l(`div`,{className:`text-[11px] text-foreground-subtle`,children:[`Scan the QR code (or enter the secret manually) into your authenticator app for`,` `,s(`span`,{className:`font-mono`,children:e}),`, then enter the 6-digit code below to confirm.`]}),l(`div`,{className:`flex flex-col items-center gap-3`,children:[s(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:s(E,{value:h.otpauthUrl,size:180})}),l(`div`,{className:`w-full`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:`Secret (manual entry)`}),l(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[s(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:h.secret}),l(`button`,{onClick:()=>{h&&navigator.clipboard.writeText(h.secret).then(()=>T(!0))},className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground`,children:[w?s(f,{className:`h-3 w-3 text-emerald-500`}):s(p,{className:`h-3 w-3`}),w?`Copied`:`Copy`]})]})]})]}),l(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),s(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:_,onChange:e=>v(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-md border border-border bg-surface px-3 py-2 text-center text-lg font-mono tracking-widest text-foreground focus:outline-none focus:ring-2 focus:ring-primary`})]}),x&&l(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[s(y,{className:`h-3 w-3`}),x]}),l(`div`,{className:`flex justify-end gap-2`,children:[s(`button`,{onClick:()=>{g(null),S(null),v(``)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),l(`button`,{onClick:()=>{S(null),O.mutate({code:_})},disabled:O.isPending||_.length!==6,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[O.isPending?s(C,{className:`h-3 w-3 animate-spin`}):s(f,{className:`h-3 w-3`}),`Confirm`]})]})]}),A===`enrolled`&&m&&l(u,{children:[l(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5 flex items-start gap-2.5`,children:[s(f,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),l(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[s(`div`,{className:`font-medium`,children:`2FA is active`}),l(`div`,{className:`text-foreground-subtle`,children:[`Enrolled on`,` `,m.confirmedAt?new Date(m.confirmedAt).toLocaleString():`—`]})]})]}),x&&l(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[s(y,{className:`h-3 w-3`}),x]}),s(`div`,{className:`flex justify-end`,children:l(`button`,{onClick:()=>{S(null),k.mutate()},disabled:k.isPending,className:`rounded bg-danger px-3 py-1.5 text-xs font-medium text-white hover:bg-danger/90 disabled:opacity-50 inline-flex items-center gap-1`,children:[k.isPending?s(C,{className:`h-3 w-3 animate-spin`}):s(b,{className:`h-3 w-3`}),`Disable 2FA`]})})]})]})]})}export{O as MyAccessPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$n as e,Pi as t,Qn as n,Xn as r,Yn as i,Zn as a,at as o,cr as s,da as c,er as l,fa as u,fi as d,ir as f,lr as p,nr as m,qi as h,rr as g,sr as _,st as v,tr as y,ua as b}from"./src-C5tvi19O.js";import{F as x,G as S,R as ee,U as C,X as w,b as T,o as E,x as D,y as O}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as k}from"./player-overlays-DzZKARlk.js";import{a as A,s as j}from"./src-CrhOk7JL.js";import{n as M,t as te}from"./rotate-ccw-BXu8SIv5.js";import{t as N}from"./copy-tH10joFB.js";import{n as ne,t as P}from"./AddonCollectionPage-CIvGYL8Z.js";import{t as re}from"./refresh-cw-BKhUNMXQ.js";import{t as F}from"./server-X3K4ldX4.js";import{t as ie}from"./sparkles-ChgPFrhX.js";import{t as ae}from"./square-Faey8y7b.js";import{t as oe}from"./wifi-DYJHTrlD.js";import{B as I,D as L,F as se,_ as R,b as ce,i as le,o as z,w as B,x as V,y as ue}from"./index-CAfPe666.js";import{t as H}from"./AdminPage-CN6ZMhf0.js";import{t as U}from"./AdminTabs-7T1CldHN.js";var de=I(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),fe=I(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),W=I(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]);w();var G=5e3,pe={connected:!1,endpoint:null};function me(e){let t=new Map;for(let n of e){let e=n?.manifest;e?.id&&t.set(e.id,e.packageDisplayName??e.name??e.id)}return t}function he(){let e=E(),t=v({capName:`network-access`},{refetchInterval:G}),n=o(void 0,{refetchInterval:G}),r=C(()=>me(n.data??[]),[n.data]),i=C(()=>(t.data??[]).map(e=>({addonId:e.addonId,displayName:r.get(e.addonId)??e.addonId,isActive:e.isActive})),[t.data,r]),[a,c]=S(null),[l,u]=S({}),d=(t,n)=>{let r=n?.addonId;e.invalidateQueries({queryKey:[[`networkAccess`,`getStatus`],{input:{addonId:r},type:`query`}]}),c(null),u(e=>{let t=n?.addonId;if(t===void 0||!(t in e))return e;let r={...e};return delete r[t],r})},f=(e,t)=>{c(null);let n=t?.addonId;if(n===void 0)return;let r=e instanceof Error?e.message:String(e);u(e=>({...e,[n]:r}))},m=s({onSuccess:d,onError:f}),h=p({onSuccess:d,onError:f});return T(P,{title:`Remote Access`,subtitle:`Public-facing tunnels that expose this hub to the internet (Cloudflare Tunnel, ngrok, …). Settings, Logs and Events are docked under every provider.`,pageIcon:B,itemIcon:B,capability:`network-access`,installButtonLabel:`Add tunnel`,items:i,isLoading:t.isLoading,emptyTitle:`No remote-access providers installed`,emptyDescription:`Install a tunnel addon (e.g. @camstack/addon-cloudflare) to expose this hub publicly.`,renderStatusBadges:e=>T(ge,{addonId:e.addonId}),itemError:e=>l[e.addonId]??null,renderPrimaryAction:e=>T(q,{addonId:e.addonId,busyId:a,onStart:e=>{c(e),m.mutate({addonId:e})},onStop:e=>{c(e),h.mutate({addonId:e})}})})}function K(e){let{data:t}=_({addonId:e},{refetchInterval:G,retry:!1}),n=t?j.safeParse(t):null;return n?.success?n.data:pe}function ge({addonId:e}){let t=K(e);return D(O,{children:[T(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.connected?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`}`,children:t.connected?`Connected`:`Disconnected`}),t.endpoint&&D(`a`,{href:t.endpoint.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`text-[10px] text-emerald-700 dark:text-emerald-300 hover:underline flex items-center gap-1`,children:[T(L,{className:`h-3 w-3`}),t.endpoint.url]})]})}function q({addonId:e,busyId:t,onStart:n,onStop:r}){let i=K(e),a=t===e;return i.connected?D(u,{size:`sm`,variant:`secondary`,disabled:a,onClick:()=>r(e),children:[a?T(V,{className:`h-3 w-3 animate-spin`}):T(ae,{className:`h-3 w-3`}),`Stop`]}):D(u,{size:`sm`,variant:`primary`,disabled:a,onClick:()=>n(e),children:[a?T(V,{className:`h-3 w-3 animate-spin`}):T(ne,{className:`h-3 w-3`}),`Start`]})}w();var J=3e4;function _e(e){let t=new Map;for(let n of e){let e=n?.manifest;e?.id&&t.set(e.id,e.packageDisplayName??e.name??e.id)}return t}function ve(e){let t=[];for(let n of e)typeof n.urls==`string`?t.push(n.urls):t.push(...n.urls);return t}function ye(){let e=v({capName:`turn-provider`},{refetchInterval:J}),t=o(void 0,{refetchInterval:J}),n=d(),r=n.data??[],i=C(()=>_e(t.data??[]),[t.data]);return T(P,{title:`TURN Servers`,subtitle:`ICE servers used for WebRTC NAT traversal. Multiple providers can coexist — the WebRTC layer concatenates servers from all enabled providers per session.`,pageIcon:R,itemIcon:R,capability:`turn-provider`,installButtonLabel:`Add provider`,items:C(()=>(e.data??[]).map(e=>({addonId:e.addonId,displayName:i.get(e.addonId)??e.addonId,isActive:e.isActive})),[e.data,i]),isLoading:e.isLoading,emptyTitle:`No TURN providers installed`,emptyDescription:`Install a TURN addon (e.g. @camstack/addon-cloudflare) to enable WebRTC behind restrictive NATs.`,renderExpandedPanel:e=>T(be,{addonId:e.addonId,enabled:e.isActive}),trailing:D(b,{children:[D(`div`,{className:`px-4 py-3 border-b border-border flex items-center justify-between`,children:[D(`div`,{children:[T(`div`,{className:`text-sm font-semibold`,children:`Combined ICE server list`}),T(`div`,{className:`text-xs text-foreground-subtle`,children:`What the WebRTC layer fetches per-session.`})]}),T(u,{size:`sm`,variant:`secondary`,onClick:()=>n.refetch(),disabled:n.isFetching,children:`Refresh`})]}),T(`div`,{className:`p-4`,children:r.length===0?T(`div`,{className:`text-xs text-foreground-subtle`,children:`No servers from enabled providers.`}):T(`div`,{className:`flex flex-col gap-3`,children:r.map((e,t)=>{let n=Array.isArray(e.urls)?e.urls:[e.urls];return D(`div`,{className:`rounded border border-border bg-surface`,children:[(e.username||e.credential)&&D(`div`,{className:`px-3 py-1.5 border-b border-border text-[10px] font-mono text-foreground-subtle flex items-center gap-3`,children:[e.username&&D(`span`,{children:[T(`span`,{className:`text-foreground-subtle`,children:`user:`}),` `,T(`span`,{className:`text-foreground`,children:e.username})]}),e.credential&&D(`span`,{children:[T(`span`,{className:`text-foreground-subtle`,children:`credential:`}),` `,T(`span`,{className:`text-foreground`,children:`••••••••`})]})]}),T(`ul`,{className:`divide-y divide-border`,children:n.map(e=>T(`li`,{className:`px-3 py-1.5 font-mono text-xs text-foreground break-all`,children:e},e))})]},t)})})})]})})}function be({addonId:e,enabled:t}){let n=d({addonId:e},{enabled:t,retry:!1}),r=C(()=>ve(n.data??[]),[n.data]);return!t||r.length===0?null:D(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:[D(`div`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Discovered ICE servers (`,r.length,`)`]}),T(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>T(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-[10px] font-mono bg-foreground-subtle/10 text-foreground`,children:e},e))})]})}w();var xe={lan:R,wifi:oe,docker:M,vpn:ce,loopback:F,other:F},Se={lan:`LAN`,wifi:`Wi-Fi`,docker:`Docker`,vpn:`VPN`,loopback:`Loopback`,other:`Other`},Ce=[`lan`,`wifi`,`vpn`,`docker`,`other`,`loopback`];function we(e){let{interfaces:t,disabled:n,hideLoopback:r,ipv4Only:i,emptyMessage:a}=e,o=C(()=>t.filter(e=>!(r&&e.kind===`loopback`||i&&e.family!==`IPv4`)),[t,r,i]),s=C(()=>{let e=new Map;for(let t of o){let n=e.get(t.kind)??[];n.push(t),e.set(t.kind,n)}return Ce.filter(t=>e.has(t)).map(t=>({kind:t,items:e.get(t)}))},[o]),c=t=>e.mode===`single`?e.value===t:e.value.includes(t),l=t=>{if(n||t.kind===`loopback`)return;if(e.mode===`single`){e.onChange(e.value===t.address?null:t.address);return}let r=new Set(e.value);r.has(t.address)?r.delete(t.address):r.add(t.address),e.onChange([...r])};return o.length===0?T(`div`,{className:`text-xs text-foreground-subtle italic`,children:a??`No addresses available.`}):T(`div`,{className:`flex flex-col gap-3`,children:s.map(({kind:t,items:r})=>D(`div`,{className:`rounded-md border border-border overflow-hidden`,children:[D(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-surface-hover/30 border-b border-border`,children:[T(xe[t]??F,{className:`h-3.5 w-3.5 text-foreground-subtle`}),T(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:Se[t]??t}),D(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`· `,r.length]})]}),T(`ul`,{className:`divide-y divide-border`,children:r.map(t=>{let r=c(t.address),i=t.kind===`loopback`,a=!t.plausible&&!i;return D(`li`,{className:`flex items-center gap-3 px-3 py-2 ${i?`opacity-60 cursor-not-allowed`:n?`opacity-60`:a?`cursor-pointer hover:bg-surface-hover/30 bg-amber-500/[0.04]`:`cursor-pointer hover:bg-surface-hover/30`}`,onClick:()=>l(t),children:[T(`span`,{className:`flex items-center justify-center h-4 w-4 rounded ${e.mode===`single`?`rounded-full`:`rounded`} border ${r?`border-primary bg-primary text-primary-foreground`:`border-border bg-surface`}`,children:r&&T(se,{className:`h-3 w-3`})}),D(`div`,{className:`flex-1 min-w-0 ${a?`text-foreground-subtle`:``}`,children:[D(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[T(`span`,{className:`font-mono text-xs font-semibold ${a?`text-foreground-subtle`:`text-foreground`}`,children:t.name}),T(`span`,{className:`text-[10px] rounded px-1.5 py-0.5 bg-foreground-subtle/10 text-foreground-subtle font-mono`,children:t.family}),t.preferred&&T(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-primary/15 text-primary`,children:`Auto-preferred`}),i&&T(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:`Always included`}),a&&D(`span`,{className:`inline-flex items-center gap-1 text-[10px] rounded-full px-2 py-0.5 font-medium bg-amber-500/15 text-amber-700 dark:text-amber-300`,title:t.plausibleReason||void 0,children:[T(z,{className:`h-2.5 w-2.5`}),`Unlikely usable`]})]}),D(`div`,{className:`text-xs text-foreground-subtle mt-0.5 font-mono break-all`,children:[t.address,t.cidr&&t.cidr!==t.address?` (${t.cidr})`:``]})]})]},`${t.name}-${t.family}-${t.address}`)})})]},t))})}w();var Y={"lan-ipv4":`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,"lan-ipv6":`bg-violet-500/15 text-violet-700 dark:text-violet-300`,public:`bg-blue-500/15 text-blue-700 dark:text-blue-300`,loopback:`bg-foreground-subtle/15 text-foreground-subtle`};function Te(){let t=E(),o=k(),s=a(void 0,{refetchInterval:3e4}),c=i(void 0),l=e({onSuccess:()=>{t.invalidateQueries({queryKey:[[`localNetwork`]]})}}),d=n({onSuccess:e=>{h(e.addresses),t.invalidateQueries({queryKey:[[`localNetwork`]]})}}),f=C(()=>s.data?.interfaces??[],[s.data]),p=r({port:typeof window<`u`?Number(window.location.port)||(window.location.protocol===`https:`?443:80):4e3,scheme:typeof window<`u`&&window.location.protocol===`https:`?`https`:`http`},{refetchInterval:3e4}),[m,h]=S([]),[g,_]=S(!1);ee(()=>{!g&&c.data&&(h(c.data.addresses),_(!0))},[c.data,g]);let v=c.data?.addresses??[],y=C(()=>{if(m.length!==v.length)return!0;let e=[...m].toSorted(),t=[...v].toSorted();return e.some((e,n)=>e!==t[n])},[m,v]),x=()=>{l.mutate({addresses:[...m]})},w=()=>{h(v)},O=()=>{h([])},A=()=>{s.refetch(),p.refetch(),c.refetch()},j=async()=>{try{let e=await o.raceConnectionEndpoints({perCandidateTimeoutMs:1500});console.info(`[network-addresses] race result`,e)}catch(e){console.warn(`[network-addresses] race failed`,e)}},M=p.data?.endpoints??[];return D(H,{children:[D(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[T(`p`,{className:`text-xs text-foreground-subtle max-w-2xl`,children:`Pick the local addresses SDK clients should race for the fastest path to this hub. Empty selection (auto) lets every non-loopback / non-link-local interface participate.`}),D(`div`,{className:`flex items-center gap-2 shrink-0`,children:[D(u,{size:`sm`,variant:`secondary`,onClick:A,disabled:s.isLoading,children:[T(re,{className:`h-3 w-3 ${s.isLoading?`animate-spin`:``}`}),`Refresh`]}),T(u,{size:`sm`,variant:`secondary`,onClick:j,children:`Probe race`})]})]}),D(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[D(b,{children:[D(`div`,{className:`px-4 py-3 border-b border-border flex items-center justify-between`,children:[D(`div`,{children:[T(`div`,{className:`text-sm font-semibold`,children:`Allowed addresses`}),T(`div`,{className:`text-xs text-foreground-subtle`,children:m.length===0?`Auto — every non-loopback / non-link-local interface participates.`:`${m.length} pinned`})]}),D(`div`,{className:`flex items-center gap-1`,children:[D(u,{size:`sm`,variant:`secondary`,onClick:()=>d.mutate(void 0),disabled:d.isPending||l.isPending,title:`Re-run the auto-detection heuristic + overwrite the current allowlist with the best matches.`,children:[T(ie,{className:`h-3 w-3`}),d.isPending?`Detecting…`:`Best match`]}),D(u,{size:`sm`,variant:`secondary`,onClick:O,disabled:m.length===0||l.isPending,children:[T(te,{className:`h-3 w-3`}),`Clear`]}),y&&T(u,{size:`sm`,variant:`secondary`,onClick:w,disabled:l.isPending,children:`Discard`}),D(u,{size:`sm`,variant:`primary`,onClick:x,disabled:!y||l.isPending,children:[T(fe,{className:`h-3 w-3`}),l.isPending?`Saving…`:`Save`]})]})]}),T(`div`,{className:`p-4`,children:T(we,{mode:`multiple`,interfaces:f,value:m,onChange:h,disabled:l.isPending,emptyMessage:s.isLoading?`Loading interfaces…`:`No interfaces detected.`})})]}),D(b,{children:[D(`div`,{className:`px-4 py-3 border-b border-border`,children:[T(`div`,{className:`text-sm font-semibold`,children:`Connection endpoints — priority order`}),T(`div`,{className:`text-xs text-foreground-subtle`,children:`Live preview of the ranked candidate list the SDK would race against. Updates with each Save.`})]}),T(`div`,{className:`p-4`,children:M.length===0?T(`div`,{className:`text-xs text-foreground-subtle italic`,children:p.isLoading?`Loading…`:`No endpoints available.`}):T(`ul`,{className:`space-y-1 text-xs`,children:M.map(e=>D(`li`,{className:`flex items-center gap-2 flex-wrap ${e.plausible?``:`opacity-80`}`,children:[T(`span`,{className:`font-mono text-[10px] w-10 text-foreground-subtle`,children:String(e.priority).padStart(4,`0`)}),T(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${Y[e.kind]??Y.loopback}`,children:e.kind}),e.interfaceKind!==`lan`&&e.interfaceKind!==`public`&&T(`span`,{className:`text-[10px] rounded px-1.5 py-0.5 bg-foreground-subtle/10 text-foreground-subtle font-medium uppercase`,children:e.interfaceKind}),!e.plausible&&e.interfaceKind!==`loopback`&&D(`span`,{className:`inline-flex items-center gap-1 text-[10px] rounded-full px-2 py-0.5 font-medium bg-amber-500/15 text-amber-700 dark:text-amber-300`,title:e.plausibleReason||void 0,children:[T(z,{className:`h-2.5 w-2.5`}),`Unlikely usable`]}),T(`span`,{className:`font-mono break-all ${e.plausible?`text-foreground`:`text-foreground-subtle`}`,children:e.baseUrl}),D(`span`,{className:`text-foreground-subtle`,children:[`— `,e.label]})]},`${e.priority}-${e.baseUrl}`))})})]})]})]})}w();var Ee={mesh:`bg-violet-500/15 text-violet-700 dark:text-violet-300`,public:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},X=5e3,De=3e4,Oe={joined:!1,meshIp:``,magicDnsHostname:``,peerCount:0,endpoints:[],tenantName:``,magicDnsSuffix:``,userLogin:null,controlPlaneUrl:``,keyExpiry:null};function ke(e){let t=new Map;for(let n of e){let e=n?.manifest;e?.id&&t.set(e.id,e.packageDisplayName??e.name??e.id)}return t}function Ae(){let e=v({capName:`mesh-network`},{refetchInterval:X}),t=o(void 0,{refetchInterval:X}),n=C(()=>ke(t.data??[]),[t.data]);return T(P,{title:`Mesh Networks`,subtitle:`Private VPN meshes that connect CamStack to your other devices (Tailscale, Headscale, …). Each provider can also expose this hub publicly via its ingress (Tailscale Funnel).`,pageIcon:M,itemIcon:R,capability:`mesh-network`,installButtonLabel:`Add mesh`,items:C(()=>(e.data??[]).map(e=>({addonId:e.addonId,displayName:n.get(e.addonId)??e.addonId,isActive:e.isActive})),[e.data,n]),isLoading:e.isLoading,emptyTitle:`No mesh-network providers installed`,emptyDescription:`Install a mesh addon (e.g. @camstack/addon-tailscale) to join this hub into a private VPN mesh.`,renderStatusBadges:e=>T(je,{addonId:e.addonId}),renderPrimaryAction:e=>T(Me,{addonId:e.addonId}),renderExpandedPanel:e=>T(Ne,{addonId:e.addonId})})}function Z(e){let{data:t,isLoading:n}=l({addonId:e},{refetchInterval:X,retry:!1}),r=t?A.safeParse(t):null;return{status:r?.success?r.data:Oe,isLoading:n}}function je({addonId:e}){let{status:t}=Z(e);return D(O,{children:[T(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.joined?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`}`,children:t.joined?`Joined`:`Not joined`}),t.joined&&D(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:[t.peerCount,` peer`,t.peerCount===1?``:`s`]})]})}function Me({addonId:e}){let t=E(),[n,r]=S(!1),[i,a]=S(null),o=k(),{status:s}=Z(e),c=x(()=>{t.invalidateQueries({queryKey:[[`meshNetwork`]]})},[t]),l=f(),d=y({onSuccess:c}),p=g({onSuccess:c}),m=x(async()=>{r(!0);let t={cancelled:!1};a(t);try{let n=await l.mutateAsync({addonId:e});if(t.cancelled)return;n.loginUrl&&window.open(n.loginUrl,`_blank`,`noopener,noreferrer`);let r=Date.now();for(;!t.cancelled&&(await Re(2e3),!t.cancelled);){let t=await o.trpcClient.meshNetwork.getStatus.query({addonId:e}).catch(()=>null),n=t?A.safeParse(t):null;if(n?.success&&n.data.joined){c();break}if(Date.now()-r>6e5)break}}finally{r(!1),a(null)}},[e,c,l,o]),h=x(()=>{i&&(i.cancelled=!0),r(!1),a(null)},[i]);return T(O,{children:s.joined?D(O,{children:[D(u,{size:`sm`,variant:`secondary`,disabled:d.isPending,onClick:()=>d.mutate({addonId:e}),children:[d.isPending?T(V,{className:`h-3 w-3 animate-spin`}):T(ue,{className:`h-3 w-3`}),`Disconnect`]}),D(u,{size:`sm`,variant:`ghost`,disabled:p.isPending,onClick:()=>p.mutate({addonId:e}),children:[p.isPending?T(V,{className:`h-3 w-3 animate-spin`}):T(W,{className:`h-3 w-3`}),`Log out`]})]}):n?D(u,{size:`sm`,variant:`ghost`,onClick:h,children:[T(le,{className:`h-3 w-3 mr-1`}),` Cancel`]}):D(O,{children:[D(u,{size:`sm`,variant:`primary`,onClick:()=>void m(),children:[T(de,{className:`h-3 w-3`}),`Connect`]}),D(u,{size:`sm`,variant:`ghost`,disabled:p.isPending,onClick:()=>p.mutate({addonId:e}),children:[p.isPending?T(V,{className:`h-3 w-3 animate-spin`}):T(W,{className:`h-3 w-3`}),`Log out`]})]})})}function Ne({addonId:e}){let{status:n}=Z(e),r=m({addonId:e},{refetchInterval:De,retry:!1});return D(`div`,{className:`rounded-lg border border-border bg-surface`,children:[D(`div`,{className:`p-4 space-y-4`,children:[n.error&&T(t,{message:n.error}),T(Pe,{status:n}),n.endpoints.length>0&&D(`div`,{className:`space-y-1.5`,children:[T(`div`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:`Endpoints`}),n.endpoints.map(e=>D(`div`,{className:`flex items-center gap-2 text-xs flex-wrap`,children:[D(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${Ee[e.scope]??`bg-foreground-subtle/15 text-foreground-subtle`}`,children:[e.scope===`public`?T(B,{className:`inline h-2.5 w-2.5 mr-0.5`}):null,e.label]}),D(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`text-emerald-700 dark:text-emerald-300 hover:underline break-all flex items-center gap-1`,children:[T(L,{className:`h-3 w-3 shrink-0`}),e.url]})]},e.id))]})]}),T(`div`,{className:`border-t border-border`,children:T(Ie,{peers:r.data?.peers??[],loading:r.isLoading})})]})}function Pe({status:e}){return T(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5`,children:[{label:`Tenant`,value:e.tenantName||`—`},{label:`User`,value:e.userLogin??`—`},{label:`Control plane`,value:e.controlPlaneUrl||`—`},{label:`Mesh IP`,value:e.meshIp||`—`,mono:!0},{label:`MagicDNS`,value:e.magicDnsHostname||`—`,mono:!0},{label:`DNS suffix`,value:e.magicDnsSuffix||`—`,mono:!0},{label:`Peers`,value:String(e.peerCount)},{label:`Key expiry`,value:e.keyExpiry?Fe(e.keyExpiry):`—`}].map(e=>D(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[T(`span`,{className:`text-foreground-subtle shrink-0`,children:e.label}),T(`span`,{className:`text-foreground truncate ${e.mono?`font-mono`:``}`,children:e.value})]},e.label))})}function Fe(e){let t=e-Date.now();if(t<0)return`Expired ${$(e)}`;let n=Math.floor(t/864e5);if(n>60)return new Date(e).toLocaleDateString();if(n>1)return`in ${n} days`;let r=Math.floor(t/36e5);return r>1?`in ${r}h`:`in ${Math.max(1,Math.floor(t/6e4))} min`}function Ie({peers:e,loading:t}){let n=C(()=>e.map(e=>({...e,_id:e.id})),[e]),r=x(e=>{e&&navigator.clipboard?.writeText(e)},[]),i=C(()=>[{key:`hostname`,header:`Hostname`,render:e=>D(`div`,{className:`flex flex-col`,children:[D(`div`,{className:`flex items-center gap-1.5`,children:[T(`span`,{className:`font-medium text-foreground`,children:e.hostname||`(unknown)`}),e.isSelf&&T(c,{variant:`info`,children:`self`}),e.exitNodeOption&&T(c,{variant:`warning`,children:`exit-node`})]}),e.userLogin&&T(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.userLogin})]})},{key:`magicDns`,header:`MagicDNS`,render:e=>e.magicDns?D(`div`,{className:`flex items-center gap-1`,children:[T(`span`,{className:`font-mono text-xs truncate`,children:e.magicDns}),T(`button`,{onClick:()=>r(e.magicDns),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":`Copy MagicDNS`,children:T(N,{className:`h-3 w-3 text-foreground-subtle`})})]}):T(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`addresses`,header:`IP`,render:e=>{let t=e.addresses[0]??``;return t?D(`div`,{className:`flex items-center gap-1`,children:[T(`span`,{className:`font-mono text-xs`,children:t}),T(`button`,{onClick:()=>r(t),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":`Copy IP`,children:T(N,{className:`h-3 w-3 text-foreground-subtle`})})]}):T(`span`,{className:`text-foreground-subtle`,children:`—`})}},{key:`connection`,header:`Connection`,render:e=>D(`div`,{className:`flex items-center gap-1.5`,children:[T(c,{variant:Le(e.connection),children:e.connection}),e.relay&&T(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.relay})]})},{key:`routes`,header:`Routes`,render:e=>e.advertisedRoutes.length>0?T(`span`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,children:e.advertisedRoutes.join(`, `)}):T(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`tx`,header:`TX / RX`,render:e=>D(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`↑ `,Q(e.txBytes),` · ↓ `,Q(e.rxBytes)]})},{key:`lastSeen`,header:`Last seen`,render:e=>T(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.lastSeenMs>0?$(e.lastSeenMs):`—`})}],[r]);return t&&e.length===0?D(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:[T(V,{className:`h-3 w-3 animate-spin inline mr-1`}),` Loading peers…`]}):e.length===0?T(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:`No peers visible — your tailnet may be empty or the host is not joined.`}):T(`div`,{className:`p-4`,children:T(h,{columns:i,rows:n,rowKey:e=>e._id,minWidthPx:820})})}function Le(e){return e===`direct`?`success`:e===`relay`?`warning`:`info`}function Q(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)}MB`:`${(e/1024/1024/1024).toFixed(2)}GB`}function $(e){let t=Date.now()-e;return t<6e4?`just now`:t<36e5?`${Math.round(t/6e4)}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}function Re(e){return new Promise(t=>setTimeout(t,e))}function ze(){return T(`div`,{className:`flex flex-col p-4`,children:T(U,{tabs:[{id:`addresses`,label:`Network Addresses`,icon:F,content:T(Te,{})},{id:`remote-access`,label:`Remote Access`,icon:B,content:T(he,{})},{id:`mesh`,label:`Mesh Networks`,icon:M,content:T(Ae,{})},{id:`turn`,label:`TURN Servers`,icon:R,content:T(ye,{})}]})})}export{ze as NetworkPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Dr as e,Kt as t,Tt as n,X as r,Y as i,at as a}from"./src-C5tvi19O.js";import{F as o,G as s,O as c,R as l,U as u,V as d,W as f,X as p,b as m,i as h,o as g,t as _,x as v}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as y}from"./player-overlays-DzZKARlk.js";import{E as b}from"./src-CrhOk7JL.js";import{n as ee,r as x,t as te}from"./SchemaTabBar-ByWwzBUZ.js";import{t as S}from"./FormBuilder-DVLWBVys.js";p();var C=c(function({addonId:e,schema:t,serverValues:n,onImmediateSave:r,onStateChange:i,onAction:a,disabled:s},c){let p=x({schema:t,serverValues:n,onImmediateSave:o(t=>r(e,t),[e,r]),onDeferredSave:o(()=>{},[])});d(c,()=>({flush:()=>{let e={};for(let t of p.pendingKeys)e[t]=p.values[t];return p.handleDiscard(p.pendingKeys),e},discard:()=>p.resetAll()}),[p]);let h=p.pendingKeys,g=h.join(`|`),_=u(()=>h.map(e=>`${e}=${JSON.stringify(p.values[e])}`).join(`,`),[h,p.values]),v=f(i);l(()=>{v.current=i},[i]),l(()=>{let t={};for(let e of h)t[e]=p.values[e];v.current({addonId:e,pendingKeys:h,pendingValues:t})},[e,g,_]);let y=u(()=>{if(a)return(t,n,r)=>a(e,t,n,r)},[e,a]);return m(S,{schema:t,values:p.values,onChange:p.handleChange,disabled:s,onAction:y})});p();function w(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>w(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function T(e,t){return{...e,fields:e.fields.map(e=>w(e,t))}}function ne(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>T(e,t))},values:t}}function E({nodeId:c,addonIds:l,level:d,deviceId:p,capability:x,sectionIds:S,sectionTab:C,extraTabs:w,title:T,description:E}){let D=g(),O=y().trpcClient,k=r(),A=i(),j=e(),M=t(),N=n(),P=!!(w&&w.length>0),[F,ie]=s(null);if(d===`device`&&!p)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);let I=c??`hub`,L=h({queries:l.map(e=>({queryKey:[[`addonSettings`,d===`global`?`getGlobalSettings`:`getDeviceSettings`],{addonId:e,nodeId:I,deviceId:p??null,cap:x??null}],queryFn:async()=>d===`global`?{addonId:e,result:await O.addonSettings.getGlobalSettings.query({addonId:e,nodeId:I,...x?{cap:x}:{}})}:{addonId:e,result:await O.addonSettings.getDeviceSettings.query({addonId:e,deviceId:p,nodeId:I})}}))}),R=L.some(e=>e.isLoading),z=L.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),B=u(()=>{let e=new Set;for(let t of L){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(t.tab??`general`)}return[...e]},[z+`::`+L.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),V=u(()=>new Map((w??[]).map(e=>[e.id,e])),[w]),H=u(()=>{if(!P)return[];let e=[...new Set([...B,...(w??[]).map(e=>e.id)])],t=e=>{let t=V.get(e);if(t?.order!==void 0)return t.order;let n=b[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[P,B,w,V]),ae=u(()=>{let e=new Map;for(let t of B){let n=b[t];e.set(t,n?.label??t.charAt(0).toUpperCase()+t.slice(1))}for(let t of w??[])e.set(t.id,t.label);return e},[B,w]),U=P?F&&H.includes(F)?F:H[0]??null:null,W=U!==null&&V.has(U),G=P?U&&!W?U:void 0:C,{data:K}=a(void 0),oe=u(()=>{let e=new Map;for(let t of K??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[K]),q=u(()=>{let e=S?new Set(S):null,t=[];for(let n of L){if(!n.data||n.data.result===null)continue;let{schema:r,values:i}=ne(n.data.result),a=r.sections.filter(t=>e?e.has(t.id):!0);if(a.length===0)continue;let o={...n.data.result,sections:n.data.result.sections.filter(t=>e?e.has(t.id):!0)},s={...r,sections:a};t.push({addonId:n.data.addonId,schemaWithValues:o,schema:s,serverValues:i})}return t},[z,S]),[J,se]=s(new Map),ce=o(e=>{se(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),Y=f(new Map),le=o(e=>t=>{t?Y.current.set(e,t):Y.current.delete(e)},[]),X=o(async(e,t)=>{d===`global`?await k.mutateAsync({addonId:e,nodeId:I,patch:t}):await A.mutateAsync({addonId:e,deviceId:p,nodeId:I,patch:t}),D.invalidateQueries({queryKey:[[`addonSettings`]]})},[k,A,I,d,p,D]),ue=o(async(e,t,n,r)=>{let i=I;try{switch(t){case`reprobe-engine`:await j.mutateAsync({nodeId:i}),D.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-hwaccel`:await M.mutateAsync({nodeId:i}),D.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await N.mutateAsync({nodeId:i}),D.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await O.addons.custom.mutate({addonId:e,action:t,input:r});return D.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[j,M,N,I,D,O]),de=o((e,t)=>{X(e,t)},[X]),Z=_({mutationFn:async()=>{let e=[];for(let t of q){let n=J.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(d===`global`?await k.mutateAsync({addonId:e,nodeId:I,patch:t}):await A.mutateAsync({addonId:e,deviceId:p,nodeId:I,patch:t}),e)))}},onSuccess:({saved:e})=>{for(let t of e)Y.current.get(t)?.discard();D.invalidateQueries({queryKey:[[`addonSettings`]]})}}),fe=o(()=>{for(let e of Y.current.values())e.discard()},[]),pe=u(()=>{let e=0;for(let t of q){let n=J.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[q,J]),me=u(()=>{let e=new Map;for(let t of q){let n=J.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[q,J]);if(R)return m(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let Q=U&&W?V.get(U):void 0;if(!P&&q.length===0)return v(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:[`No addons in `,l.length>0?`[${l.join(`, `)}]`:`the current selection`,` `,`expose `,d,`-level settings on this node.`]});let $=Z.isPending;return v(`div`,{className:`space-y-4`,children:[(T||E)&&v(`div`,{className:`border-b border-border pb-2`,children:[T&&m(`h2`,{className:`text-sm font-semibold text-foreground`,children:T}),E&&m(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:E})]}),P&&m(te,{tabs:H.map(e=>({id:e,label:ae.get(e)??e})),activeId:U,onChange:ie,pendingByTab:me}),Z.isError&&v(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[`Save failed: `,String(Z.error?.message??Z.error)]}),Q?Q.content:(()=>{let e=G?q.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===G).length,0):0,t=G!==null&&e<=1,n=q.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>G?(e.tab??`general`)===G:!0).map(e=>t?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i});return n.length===0?m(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:`Nothing to configure here for this node.`}):m(re,{entries:n,paneStates:J,displayNames:oe,disabled:$,setPaneRef:le,onPaneStateChange:ce,onImmediateSave:de,onAction:ue,inline:P||!!C})})(),!R&&m(ee,{pendingCount:pe,onSave:()=>Z.mutate(),onDiscard:fe,saving:$})]})}function re({entries:e,paneStates:t,displayNames:n,disabled:r,setPaneRef:i,onPaneStateChange:a,onImmediateSave:o,onAction:c,inline:d}){let f=u(()=>[...e].toSorted((e,t)=>{if(e.addonId===`system-config`)return-1;if(t.addonId===`system-config`)return 1;let r=n.get(e.addonId)??e.addonId,i=n.get(t.addonId)??t.addonId;return r.localeCompare(i)}),[e,n]),[p,h]=s(f[0]?.addonId??``);l(()=>{f.length!==0&&(f.find(e=>e.addonId===p)||h(f[0].addonId))},[f,p]);let g=f.find(e=>e.addonId===p)??f[0];if(!g)return null;let _=u(()=>c?(e,t,n,r)=>c(e,t,n,r):void 0,[c]),y=e=>m(C,{ref:i(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:o,onStateChange:a,onAction:_,disabled:r},e.addonId);return f.length===1||d?m(`div`,{className:`flex flex-col gap-4`,children:f.map(y)}):v(`div`,{className:`flex flex-col gap-3`,children:[m(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:f.map(e=>{let r=n.get(e.addonId)??e.addonId,i=e.addonId===g.addonId,a=(t.get(e.addonId)?.pendingKeys.length??0)>0;return v(`button`,{type:`button`,onClick:()=>h(e.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${i?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[r,a&&m(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},e.addonId)})}),m(`div`,{className:`space-y-2`,children:f.map(e=>m(`div`,{style:e.addonId===g.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{E as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$r as e,Ar as t,Bi as n,Br as r,Cr as i,Er as a,Fr as o,Gi as s,Hi as c,Hr as l,J as u,Ki as d,Kr as f,Li as p,Ni as m,Nr as h,Or as g,Pr as _,Qr as v,Ri as y,Rr as b,Sr as x,Tr as S,Ui as C,Ur as w,Vr as T,X as E,Zr as D,_ as O,_a as k,ai as A,br as j,ci as ee,ei as M,ii as N,jr as P,kr as F,ni as I,oi as te,vr as L,w as ne,wr as re,xr as ie,zi as ae}from"./src-C5tvi19O.js";import{F as oe,G as R,R as z,U as B,W as se,X as V,a as ce,b as H,o as U,w as le,x as W,y as G}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as ue}from"./player-overlays-DzZKARlk.js";import{O as de}from"./src-CrhOk7JL.js";import{t as fe}from"./download-DyMeaCfZ.js";import{i as pe,n as me,r as he,t as ge}from"./AddLocationWizard-ty_4uW1H.js";import{n as _e,r as ve,t as ye}from"./zap-DLiiHws-.js";import{t as be}from"./pencil-xW8n5CLs.js";import{t as xe}from"./plus-DVpT3Ja2.js";import{t as Se}from"./refresh-cw-BKhUNMXQ.js";import{t as Ce}from"./search-DyWYI0Yj.js";import{t as we}from"./server-X3K4ldX4.js";import{t as Te}from"./square-check-big-Bzz95oCZ.js";import{t as Ee}from"./square-Faey8y7b.js";import{A as De,B as K,F as Oe,M as ke,P as Ae,W as je,i as Me,j as Ne,k as q,s as J,w as Pe,x as Y}from"./index-CAfPe666.js";import{t as Fe}from"./AdminPage-CN6ZMhf0.js";import{r as Ie}from"./useDevice-B7VwJa4X.js";import{t as X}from"./useEventInvalidation-Cf9VIpDW.js";import{n as Le}from"./format-size-CO9d3C3-.js";import{t as Re}from"./NodeAddonsSettingsPanel-B4ru8rzf.js";var ze=K(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Be=K(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),Ve=K(`flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),He=K(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]);V();function Ue({selectedNodeId:e,onSelect:t,refreshToken:n}){let{data:i}=L(void 0),{data:a}=r(void 0),o=new Map;for(let e of a??[])o.set(e.agentNodeId,(o.get(e.agentNodeId)??0)+1);let s=i??[],c=s.filter(e=>e.isOnline).length,l=s.filter(e=>!e.isOnline).length;return W(`div`,{className:`flex flex-col h-full`,children:[W(`button`,{type:`button`,onClick:()=>t(Pt),className:`flex items-center gap-3 px-4 py-3 border-b border-border text-left transition-colors ${e===`__cluster__`?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[H(Pe,{className:`h-4 w-4 flex-shrink-0`}),W(`div`,{className:`min-w-0 flex-1`,children:[H(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),H(`div`,{className:`flex-1 overflow-y-auto`,children:s.map(n=>{let r=e===n.id,i=o.get(n.id)??0,a=n.isHub?we:q;return W(`button`,{type:`button`,onClick:()=>t(n.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${r?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[H(a,{className:`h-4 w-4 flex-shrink-0`}),W(`div`,{className:`min-w-0 flex-1`,children:[W(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-xs font-semibold truncate`,children:n.name}),n.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!n.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),n.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),W(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[W(`span`,{children:[n.cpuCores,` cores`]}),H(`span`,{children:`•`}),W(`span`,{children:[Math.round(n.memoryMB/1024),` GB`]}),i>0&&W(G,{children:[H(`span`,{children:`•`}),W(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[H(_e,{className:`h-2.5 w-2.5`}),i]})]})]})]})]},n.id)})}),W(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[W(`span`,{children:[c,` online`]}),l>0&&W(`span`,{className:`text-destructive`,children:[l,` offline`]})]})]})}function We({nodeId:e,refreshToken:t}){let{data:n}=L(void 0),r=n?.find(t=>t.id===e),i=y(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?W(`div`,{className:`px-6 py-4 border-b border-border`,children:[W(`div`,{className:`flex items-center gap-2 mb-1`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),W(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[H(`span`,{children:r.cpuModel??`CPU`}),H(`span`,{children:`•`}),W(`span`,{children:[r.cpuCores,` cores`]}),H(`span`,{children:`•`}),W(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&W(G,{children:[H(`span`,{children:`•`}),W(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),H(`span`,{children:`•`}),W(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),H(`span`,{children:`•`}),W(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&W(G,{children:[H(`span`,{children:`•`}),H(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):H(`div`,{className:`px-6 py-4 border-b border-border`,children:W(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function Ge({refreshToken:e,nodeId:t}){let[r,i]=R(new Map),{nodes:a}=p();n(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t?.deviceId==`number`&&i(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})});let{data:s}=o(void 0),c=B(()=>{let e=new Map;for(let t of s??[])e.set(t.nodeId,t.deviceCount);return e},[s]),l=B(()=>{let e=new Map,t=Date.now()-3e4;for(let n of r.values()){if(n.timestamp<t)continue;let r=n.nodeId??`hub`,i=e.get(r)??{attachedCameras:0,activeCameras:0,totalFps:0,totalInferenceWeighted:0,queueDepth:0};i.attachedCameras++,n.metrics.phase===`active`&&i.activeCameras++,i.totalFps+=n.metrics.actualFps,i.totalInferenceWeighted+=n.metrics.avgInferenceTimeMs,i.queueDepth+=n.metrics.queueDepth,e.set(r,i)}return e},[r]),u=B(()=>{let e=new Map;for(let t of a)e.set(t.id,t.shortName);return e},[a]),d=B(()=>{let e=0,t=0,n=0,r=0,i=0;for(let a of l.values())e+=a.attachedCameras,t+=a.activeCameras,n+=a.totalFps,r+=a.totalInferenceWeighted,i+=a.queueDepth;let o=e>0?r/e:0;return{totalAgents:a.length,onlineAgents:a.filter(e=>e.isOnline).length,attachedCameras:e,activeCameras:t,avgInferenceTimeMs:o,queueDepth:i,totalFps:n}},[l,a]);if(t){let e=l.get(t);return W(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),W(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[H(Z,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),H(Z,{label:`Cameras`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),H(Z,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),H(Z,{label:`Queue`,value:e?String(e.queueDepth):`—`}),H(Z,{label:`Audio`,value:String(c.get(t)??`—`)})]})]})}let f=[...l.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return W(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),W(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[H(Z,{label:`Total agents`,value:`${d.onlineAgents}/${d.totalAgents}`}),H(Z,{label:`Cameras`,value:`${d.activeCameras}/${d.attachedCameras}`}),H(Z,{label:`Total FPS`,value:d.totalFps.toFixed(1)}),H(Z,{label:`Avg inference ms`,value:d.avgInferenceTimeMs.toFixed(0)}),H(Z,{label:`Queue depth`,value:String(d.queueDepth)})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:W(`table`,{className:`w-full text-xs min-w-[480px]`,children:[H(`thead`,{className:`bg-surface`,children:W(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),H(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),H(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),H(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),H(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),H(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),W(`tbody`,{children:[f.map(([e,t])=>W(`tr`,{className:`border-t border-border`,children:[H(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:u.get(e)??e}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:c.get(e)??`—`})]},e)),f.length===0&&H(`tr`,{children:H(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function Z({label:e,value:t}){return W(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[H(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),H(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}V();var Q={active:!1,pinned:!1,nodeId:null,reason:``},Ke=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],qe={pipeline:q,decoder:Be,audio:ve},Je={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function Ye({mode:i,nodeId:a,compact:o=!1}){if(i===`agent`&&!a)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let s=U(),[c,l]=R(null),[u,d]=R(null),[f,m]=R(new Map);X([`pipelineOrchestrator`,`getPipelineAssignments`],Ke),X([`pipelineOrchestrator`,`getDecoderAssignments`],Ke),X([`pipelineOrchestrator`,`getAudioAssignments`],Ke);let{data:h}=r(void 0),{data:y}=b(void 0),{data:x}=_(void 0),{nodes:S}=p(),{data:C}=Ie();n(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&m(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),z(()=>{if(f.size===0)return;let e=setInterval(()=>{m(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[f.size]);let w=B(()=>{let e=new Map;for(let t of C??[])e.set(t.id,t.name);return e},[C]),T=B(()=>{let e=new Map,t=t=>{let n=e.get(t);if(n)return n;let r={deviceId:t,deviceName:w.get(t)??`Device ${t}`,pipeline:Q,decoder:Q,audio:Q};return e.set(t,r),r};for(let n of h??[]){let r=t(n.deviceId);e.set(n.deviceId,{...r,pipeline:{active:i===`cluster`?!0:n.agentNodeId===a,pinned:n.pinned,nodeId:n.agentNodeId,reason:n.reason??``}})}for(let n of y??[]){let r=t(n.deviceId);e.set(n.deviceId,{...r,decoder:{active:i===`cluster`?!0:n.decoderNodeId===a,pinned:n.pinned,nodeId:n.decoderNodeId,reason:n.reason??``}})}for(let n of x??[]){let r=t(n.deviceId);e.set(n.deviceId,{...r,audio:{active:i===`cluster`?!0:n.nodeId===a,pinned:n.pinned,nodeId:n.nodeId,reason:`capacity`}})}let n=[...e.values()];return i===`agent`&&(n=n.filter(e=>e.pipeline.active||e.decoder.active||e.audio.active)),n.sort((e,t)=>e.deviceId-t.deviceId),n},[h,y,x,w,i,a]),E=B(()=>(S??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[S]),O=()=>{s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},k=t({onSuccess:O}),A=e({onSuccess:O}),j=F({onSuccess:O}),ee=v({onSuccess:O}),M=g({onSuccess:O}),N=D({onSuccess:O}),P=(e,t,n)=>{t===`pipeline`?k.mutate({deviceId:e,agentNodeId:n}):t===`decoder`?j.mutate({deviceId:e,nodeId:n}):M.mutate({deviceId:e,nodeId:n}),l(null)},I=(e,t)=>{t===`pipeline`?A.mutate({deviceId:e}):t===`decoder`?ee.mutate({deviceId:e}):N.mutate({deviceId:e}),l(null)};return H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:W(`table`,{className:`w-full text-xs min-w-[640px]`,children:[H(`thead`,{className:`bg-surface`,children:W(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!o&&H(`th`,{className:`w-6`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Camera`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Pipeline`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Decoder`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Audio`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Status`})]})}),W(`tbody`,{children:[T.map(e=>{let t=f.get(e.deviceId),n=u===e.deviceId;return W(le.Fragment,{children:[W(`tr`,{className:`border-t border-border align-middle relative`,children:[!o&&H(`td`,{className:`px-2 py-2 align-middle`,children:H(`button`,{type:`button`,onClick:()=>d(n?null:e.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":n?`Collapse broker details`:`Expand broker details`,children:H(n?Ae:ke,{className:`h-3.5 w-3.5`})})}),W(`td`,{className:`px-3 py-2 align-middle`,children:[H(`div`,{className:`text-foreground font-medium leading-tight`,children:e.deviceName}),W(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,e.deviceId]})]}),H(Xe,{role:`pipeline`,state:e.pipeline,mode:i,deviceId:e.deviceId,onlineNodes:E,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`pipeline`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`pipeline`?null:{deviceId:e.deviceId,role:`pipeline`}),onCloseMenu:()=>l(null),onMove:t=>P(e.deviceId,`pipeline`,t),onUnpin:()=>I(e.deviceId,`pipeline`)}),H(Xe,{role:`decoder`,state:e.decoder,mode:i,deviceId:e.deviceId,onlineNodes:E,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`decoder`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`decoder`?null:{deviceId:e.deviceId,role:`decoder`}),onCloseMenu:()=>l(null),onMove:t=>P(e.deviceId,`decoder`,t),onUnpin:()=>I(e.deviceId,`decoder`)}),H(Xe,{role:`audio`,state:e.audio,mode:i,deviceId:e.deviceId,onlineNodes:E,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`audio`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`audio`?null:{deviceId:e.deviceId,role:`audio`}),onCloseMenu:()=>l(null),onMove:t=>P(e.deviceId,`audio`,t),onUnpin:()=>I(e.deviceId,`audio`)}),H(`td`,{className:`px-3 py-2 align-middle`,children:H($e,{snap:t})})]}),n&&!o&&W(`tr`,{className:`bg-surface/50`,children:[H(`td`,{}),H(`td`,{colSpan:5,className:`px-3 py-2`,children:H(ne,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:e.deviceId,instanceId:`pipeline-row/${e.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})})]})]},e.deviceId)}),T.length===0&&H(`tr`,{children:H(`td`,{colSpan:o?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:i===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function Xe({role:e,state:t,mode:n,onlineNodes:r,isMenuOpen:i,onToggleMenu:a,onCloseMenu:o,onMove:s,onUnpin:c}){let l=qe[e],u=r.filter(e=>e.id!==(t.nodeId??``)),d=(t.active||n===`cluster`)&&(u.length>0||t.pinned);return W(`td`,{className:`px-3 py-2 align-middle relative`,children:[W(`div`,{className:`flex items-center gap-2`,children:[H(n===`agent`?Ze:Qe,{state:t,Icon:l}),H(`div`,{className:`ml-auto`,children:d&&H(`button`,{type:`button`,onClick:a,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${Je[e]} actions`,children:H(ze,{className:`h-3 w-3 text-foreground-subtle`})})})]}),i&&d&&H(et,{title:Je[e],targets:u,pinned:t.pinned,onMove:s,onUnpin:c,onClose:o})]})}function Ze({state:e,Icon:t}){return W(`div`,{className:`flex items-center gap-1.5`,children:[H(e.active?Te:Ee,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),H(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&H(He,{className:`h-2.5 w-2.5 text-amber-400`})]})}function Qe({state:e,Icon:t}){return!e.active||!e.nodeId?W(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[H(t,{className:`h-3 w-3`}),H(`span`,{className:`text-[10px] italic`,children:`—`})]}):W(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[H(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),W(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[H(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),H(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?W(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[H(He,{className:`h-2.5 w-2.5`}),` manual`]}):W(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}function $e({snap:e}){if(!e)return H(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a}=e.metrics,o=k(t);return W(`div`,{className:`flex flex-col gap-0.5 font-mono text-[10px] tabular-nums leading-tight`,children:[W(`span`,{className:`inline-flex items-center gap-1 ${o.textColor}`,children:[H(O,{phase:t,className:`h-2.5 w-2.5`}),H(`span`,{className:`font-semibold uppercase tracking-wider`,children:o.label})]}),W(`span`,{className:`text-foreground-subtle`,children:[H(`span`,{className:`text-foreground`,children:n.toFixed(1)}),W(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),W(`span`,{className:`text-foreground-subtle`,children:[H(`span`,{className:`text-foreground`,children:r.toFixed(0)}),H(`span`,{children:` ms`}),i>0&&W(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]})]})}function et({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=se(null);return z(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),W(`div`,{ref:o,className:`absolute right-2 top-full mt-1 w-48 rounded-lg border border-border bg-surface shadow-lg z-20 text-left`,children:[H(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&H(`div`,{className:`py-1`,children:t.map(e=>W(`button`,{type:`button`,onClick:()=>r(e.id),className:`block w-full text-left px-3 py-1 text-[11px] text-foreground hover:bg-surface-hover`,children:[`Move to `,e.name]},e.id))}),n&&W(`button`,{type:`button`,onClick:i,className:`block w-full text-left px-3 py-1.5 text-[11px] text-destructive hover:bg-destructive/10 border-t border-border`,children:[`Unpin `,e.toLowerCase()]}),t.length===0&&!n&&H(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function tt({nodeId:e,refreshToken:t}){return W(`div`,{className:`space-y-6`,children:[H(Ge,{refreshToken:t,nodeId:e}),W(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),W(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Checkboxes mark the roles currently running on `,e,`. Use the kebab to move a role to another node or unpin it; live KPIs come from the runner snapshot stream.`]})]}),H(Ye,{mode:`agent`,nodeId:e,compact:!0})]})}V();function nt(e,t){let n=Math.max(0,t-e);return`${Math.floor(e/1e3)}s idle · ${Math.floor(n/1e3)}s left`}function rt({nodeId:e,refreshToken:t}){let n=U(),r=S({onSettled:()=>{n.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:i}=a({nodeId:e}),o=y(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??i??null,s=o===null;X([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:c}=I({nodeId:e}),{values:l}=ae(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),u=B(()=>l.filter(e=>e.metrics.phase===`active`).length,[l]),d=t=>{let n=c??[];n.length>0&&!window.confirm(`${n.length} camera(s) are dispatching through this engine. Killing it forces a respawn on the next frame. Continue?`)||r.mutate({nodeId:e,engine:t,force:n.length>0})};return W(`div`,{className:`space-y-6`,children:[W(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),W(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(o??[]).length,` engine(s) resident in RAM. `,(c??[]).length,` `,`camera(s) attached, `,u,` actively dispatching frames. Refreshes every 5s.`]})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:W(`table`,{className:`w-full text-xs min-w-[640px]`,children:[H(`thead`,{className:`bg-surface`,children:W(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),H(`th`,{className:`text-left px-3 py-2`,children:`Models`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),H(`th`,{className:`w-20`})]})}),W(`tbody`,{children:[s&&H(`tr`,{children:H(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!s&&(o??[]).map(e=>{let t=e.kind===`warm-override`;return W(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[H(`td`,{className:`px-3 py-2`,children:W(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium ${t?`bg-amber-500/15 text-amber-400`:`bg-success/15 text-success`}`,children:[H(t?Ve:q,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),H(`td`,{className:`px-3 py-2`,children:W(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[H(ye,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),H(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?H(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):H(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>H(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),H(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),H(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?H(`span`,{className:`text-foreground-subtle`,children:nt(e.idleMs,e.idleTtlMs)}):H(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(c??[]).length}),H(`td`,{className:`px-3 py-2 text-right`,children:W(`button`,{type:`button`,disabled:r.isPending,onClick:()=>d(e.engine),className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-destructive/30 text-destructive text-[11px] hover:bg-destructive/10 disabled:opacity-50`,children:[H(J,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!s&&(o??[]).length===0&&H(`tr`,{children:H(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No engines resident — the factory spins up on the first pipeline run.`})})]})]})}),W(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[H(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,H(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),r.isError&&W(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,r.error instanceof Error?r.error.message:`unknown`]})]})}V();var it=new Set(de);function at(e){return it.has(e)}function ot(e,t,n){return`${e}/${t}/${n}`}function st(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function ct(e){return{coreml:`Apple Neural Engine / GPU — .mlpackage`,openvino:`Intel CPU / GPU / NPU — .xml`,onnx:`CPU, CUDA, Node.js — .onnx`}[e.format]??`.${e.format}`}function $(e){return e.format}function lt(e,t){let n=0,r=0,i=0;for(let a of e)for(let e of a.addons)for(let a of e.models){let e=a.formats[t];e&&(n++,e.downloaded&&(r++,i+=e.sizeMB))}return{total:n,downloaded:r,downloadedSizeMB:i}}function ut({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?W(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-border/50 last:border-b-0 hover:bg-surface-hover/30 transition-colors`,children:[H(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),W(`div`,{className:`flex-1 min-w-0`,children:[W(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),W(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&W(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[H(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:H(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),W(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),H(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:Le(c.sizeMB)}),a&&W(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[H(Ne,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?W(`button`,{onClick:s,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md border border-danger/30 text-danger hover:bg-danger/10 disabled:opacity-50 transition-colors shrink-0`,children:[r?H(Y,{className:`h-3 w-3 animate-spin`}):H(J,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):W(`button`,{onClick:o,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[r?H(Y,{className:`h-3 w-3 animate-spin`}):H(fe,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function dt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=R(!1);return W(`div`,{className:`relative`,children:[W(`button`,{type:`button`,onClick:()=>a(!i),className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-4 py-2.5 w-full text-left hover:bg-surface-hover transition-colors`,children:[H(q,{className:`h-4 w-4 text-primary shrink-0`}),W(`div`,{className:`flex-1 min-w-0`,children:[W(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:st(n)}),$(n)===$(t)&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:ct(n)})]}),H(Ae,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&H(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-border bg-surface shadow-lg z-50 overflow-hidden`,children:e.map(e=>{let i=$(e)===$(n),o=$(e)===$(t);return W(`button`,{type:`button`,onClick:()=>{r(e),a(!1)},className:`flex items-center gap-3 px-4 py-2.5 w-full text-left transition-colors ${i?`bg-primary/5`:`hover:bg-surface-hover`}`,children:[H(q,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),W(`div`,{className:`flex-1`,children:[W(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:st(e)}),o&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:ct(e)})]}),i&&H(De,{className:`h-4 w-4 text-primary shrink-0`})]},$(e))})})]})}function ft({embedded:e=!1,nodeId:t}={}){let r=U(),a=t??`hub`,[o,s]=R(null),[c,l]=R(new Set),[u,d]=R(new Map),[f,p]=R(new Map),[m,h]=R(``),{data:g=[]}=x({nodeId:a}),_=g.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:v}=re({nodeId:a}),y=v,{data:b,isLoading:S}=i({nodeId:a}),C=ie(),w=j();n(`model.download.progress`,e=>{let t=e.data,n=typeof t.modelId==`string`?t.modelId:void 0,i=typeof t.progress==`number`?t.progress:void 0,a=typeof t.totalMB==`number`?t.totalMB:0;n===void 0||i===void 0||(d(e=>{let t=new Map(e);return i===100||i===-1?t.delete(n):t.set(n,{modelId:n,progress:i,totalMB:a}),t}),i===100&&r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let T=y??{runtime:`node`,backend:`cpu`,format:`onnx`},E=_.find(e=>e.format===o)??T,D=E.format,O=b?.slots??[],k=O.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[D]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),A=lt(k,D),ee=oe(async(e,t,n)=>{if(!at(n))return;let i=ot(e,t,n);l(e=>new Set([...e,i])),p(e=>{let t=new Map(e);return t.delete(i),t});try{await C.mutateAsync({addonId:e,modelId:t,format:n,nodeId:a}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[i,e instanceof Error?e.message:`Download failed`]]))}finally{l(e=>{let t=new Set(e);return t.delete(i),t})}},[C,r,a]),M=oe(async(e,t,n)=>{if(!at(n))return;let i=ot(e,t,n);l(e=>new Set([...e,i])),p(e=>{let t=new Map(e);return t.delete(i),t});try{await w.mutateAsync({addonId:e,modelId:t,format:n,nodeId:a}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[i,e instanceof Error?e.message:`Delete failed`]]))}finally{l(e=>{let t=new Set(e);return t.delete(i),t})}},[w,r,a]),N=oe(e=>{s(e.format)},[]),P=m.trim()?k.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(m.toLowerCase())||t.id.toLowerCase().includes(m.toLowerCase())||e.name.toLowerCase().includes(m.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):k,F=W(G,{children:[S&&H(`div`,{className:`flex items-center justify-center py-16`,children:H(Y,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!S&&O.length===0&&W(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[H(pe,{className:`h-8 w-8 mb-3 opacity-30`}),H(`span`,{className:`text-sm`,children:`No pipeline steps available`}),H(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!S&&O.length>0&&W(G,{children:[H(dt,{engines:_,activeEngine:T,viewEngine:E,onSelect:N}),W(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[W(`span`,{children:[H(`span`,{className:`font-semibold text-foreground tabular-nums`,children:A.total}),H(`span`,{className:`ml-1`,children:`compatible models`})]}),H(`span`,{className:`text-border`,children:`|`}),W(`span`,{children:[H(`span`,{className:`font-semibold text-success tabular-nums`,children:A.downloaded}),H(`span`,{className:`ml-1`,children:`downloaded`})]}),H(`span`,{className:`text-border`,children:`|`}),W(`span`,{className:`tabular-nums`,children:[Le(A.downloadedSizeMB),H(`span`,{className:`ml-1`,children:`on disk`})]})]}),A.total>5&&W(`div`,{className:`relative`,children:[H(Ce,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),H(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`Search models...`,className:`w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-border bg-surface text-foreground placeholder:text-foreground-subtle/50 focus:outline-none focus:ring-1 focus:ring-primary`})]}),P.map(e=>{let t=e.addons.reduce((e,t)=>e+t.models.length,0),n=e.addons.reduce((e,t)=>e+t.models.filter(e=>e.formats[D]?.downloaded).length,0);return W(`div`,{children:[W(`div`,{className:`flex items-center gap-2 mb-2`,children:[H(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),H(`div`,{className:`flex-1 h-px bg-border`}),W(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),H(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=ot(e.id,t.id,D);return H(ut,{addonId:e.id,model:t,format:D,isActive:c.has(n),progress:u.get(t.id),errorMsg:f.get(n),onDownload:()=>ee(e.id,t.id,D),onDelete:()=>M(e.id,t.id,D)},`${e.id}/${t.id}`)}))})]},e.id)}),P.length===0&&H(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:m.trim()?W(G,{children:[`No models matching “`,m,`”`]}):W(G,{children:[`No models available for `,st(E),` format`]})})]})]});return e?H(`div`,{className:`space-y-4`,children:F}):H(Fe,{children:F})}function pt({nodeId:e,refreshToken:t}){return H(ft,{embedded:!0,nodeId:e})}V();function mt({nodeId:e,title:t}){let{data:i}=Ie(),{data:a}=r(void 0),o=B(()=>{let e=new Map;for(let t of i??[])e.set(t.id,t.name);return e},[i]),s=B(()=>{if(!e)return null;let t=new Set;for(let n of a??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,a]),[c,l]=R(new Map);n(`pipeline.camera-metrics-snapshot`,t=>{let n=t.data;typeof n.deviceId==`number`&&(e&&n.nodeId!==e||l(e=>{let t=new Map(e);return t.set(n.deviceId,n),t}))}),z(()=>{if(c.size===0)return;let e=setInterval(()=>{l(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[c.size]);let u=B(()=>{let e=[];for(let t of c.values())s&&!s.has(t.deviceId)||e.push(t);return e.sort((e,t)=>e.deviceId-t.deviceId),e},[c,s]);return u.length===0?W(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2 text-[11px] text-foreground-subtle italic`,children:[t??`Cameras`,`: no live snapshots yet`]}):W(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[W(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[H(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),H(`span`,{className:`text-[10px] text-foreground-subtle`,children:u.length})]}),H(`div`,{className:`flex flex-wrap gap-1.5`,children:u.map(e=>{let t=o.get(e.deviceId)??`#${e.deviceId}`,n=k(e.metrics.phase);return W(`div`,{title:`${t} · ${n.label} · ${e.metrics.actualFps.toFixed(1)} fps · ${e.metrics.avgInferenceTimeMs.toFixed(0)}ms infer · q=${e.metrics.queueDepth}`,className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${n.badgeClass}`,children:[H(O,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),H(`span`,{className:`font-medium text-foreground/90 max-w-[120px] truncate`,children:t}),H(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),H(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}V();function ht(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function gt({nodeId:e,refreshToken:t}){let n=U(),[r,a]=R(null),[o,l]=R(null),u=i({nodeId:e},{refetchOnMount:`always`}),p=h({agentNodeId:e},{refetchOnMount:`always`}),m=f({onSuccess:()=>{n.invalidateQueries({queryKey:[[`addonSettings`]]}),n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]})}}),g=u.data??null,_=p.data,v=g?.selectedEngine.format??`coreml`,y=B(()=>g?s(g):[],[g]),b=B(()=>[{agentNodeId:e,engineLabel:v}],[e,v]),x=(e,t)=>{let n=_?.addonDefaults[e];return!ht(g,e)?.models.some(e=>!!e.formats[v])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},S=r&&g?ht(g,r.addonId):null,w=t=>{let n=_?.addonDefaults[t]??null;a({addonId:t,agentNodeId:e}),l(n)},T=(t,n)=>{if(!_)return;let r=_.addonDefaults[t],i=ht(g,t);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};m.mutate({agentNodeId:e,defaults:{..._.addonDefaults,[t]:a}})},E=()=>{a(null),l(null)},D=()=>{!o||!r||!_||m.mutate({agentNodeId:e,defaults:{..._.addonDefaults,[r.addonId]:o}},{onSuccess:E})};if(u.isLoading||p.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(u.error)return W(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(u.error)]});if(!g)return H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let O=r!==null&&S!==null&&o!==null;return W(`div`,{className:`relative h-full w-full space-y-3`,children:[H(mt,{nodeId:e}),H(`div`,{className:O?`pr-[360px]`:``,children:y.length>0?H(c,{tree:y,agents:b,getCellState:x,onCellClick:w,selectedCell:r,onToggleEnabled:T}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),H(d,{open:O,onClose:E,title:S?.name??``,subtitle:r?`${r.agentNodeId} · ${v}`:``,footer:W(G,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:E,children:`Cancel`}),H(`button`,{type:`button`,disabled:!o||!r||m.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:D,children:m.isPending?`Saving…`:`Save`})]}),children:S&&o&&r&&H(C,{mode:`agent`,addon:S,agentDefault:o,agentNodeId:r.agentNodeId,engineFormat:v,onChangeAgentConfig:e=>l(e)})})]})}var _t=[`detection-pipeline`,`decoder-nodeav`,`audio-analyzer`,`pipeline-runner`];function vt({nodeId:e,refreshToken:t}){return W(`div`,{className:`flex flex-col h-full`,children:[H(We,{nodeId:e,refreshToken:t}),H(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:H(Re,{nodeId:e,addonIds:_t,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:H(tt,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:H(gt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:H(rt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:H(pt,{nodeId:e,refreshToken:t})}]})})]})}function yt({refreshToken:e}){let t=U(),n=w({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return W(`div`,{className:`space-y-6`,children:[H(Ge,{refreshToken:e}),W(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[W(`div`,{className:`min-w-0`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),H(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · decoder · audio assignments per camera. Click the kebab to pin / unpin / move any role; expand the chevron for the per-camera broker drill-down.`})]}),W(`button`,{type:`button`,onClick:()=>n.mutate(void 0),disabled:n.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/90 disabled:opacity-50 shrink-0 self-start @md/clustertab:self-auto whitespace-nowrap`,children:[H(ye,{className:`h-3.5 w-3.5`}),n.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),H(Ye,{mode:`cluster`})]})}var bt=[`pipeline-orchestrator`];function xt({refreshToken:e}){return H(`div`,{className:`space-y-4 max-w-3xl`,children:H(Re,{nodeId:`hub`,addonIds:bt,level:`global`,title:`Cluster settings`,description:`Cluster-wide orchestration knobs: enabled nodes, load balancer thresholds, and failover policy. Per-camera pipelines live in Device Overrides; live cluster load is on the Assignments tab.`})})}V();function St({refreshToken:e}){let t=U(),{data:n,isLoading:r}=l(),[i,a]=R(null),[o,s]=R(``),[c,u]=R(``),d=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},f=M({onSuccess:()=>{a(null),d()}}),p=P({onSuccess:d}),m=e=>{a(e.id),s(e.name),u(e.description??``)},h=()=>{a(null),s(``),u(``)},g=()=>{if(!i)return;let e=c.trim();f.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return H(`div`,{className:`space-y-6 max-w-4xl`,children:W(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[W(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[W(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),H(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:`Curated pipeline presets operators can apply to any camera. Apply-time is a copy — future edits to a template don't retroactively change cameras that were seeded from it. Save a template from the device Pipeline tab.`})]}),W(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?W(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[H(xe,{className:`h-6 w-6 opacity-40`}),H(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):H(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return H(`li`,{className:`px-4 py-3 text-xs`,children:W(`div`,{className:`flex items-start gap-3`,children:[H(`div`,{className:`flex-1 min-w-0`,children:t?W(`div`,{className:`space-y-2`,children:[H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-xs text-foreground focus:outline-none focus:border-primary`,value:o,onChange:e=>s(e.target.value),placeholder:`Template name`,autoFocus:!0}),H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary`,value:c,onChange:e=>u(e.target.value),placeholder:`Description (optional)`})]}):W(G,{children:[H(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&H(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),W(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[`engine `,e.config.engine.runtime,`/`,e.config.engine.backend,` ·`,` `,e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,W(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),H(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?W(G,{children:[W(`button`,{type:`button`,onClick:g,disabled:f.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-50`,children:[H(Oe,{className:`h-3 w-3`}),`Save`]}),W(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover`,children:[H(Me,{className:`h-3 w-3`}),`Cancel`]})]}):W(G,{children:[H(`button`,{type:`button`,onClick:()=>m(e),title:`Rename`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,children:H(be,{className:`h-3 w-3`})}),H(`button`,{type:`button`,onClick:()=>{confirm(`Delete template "${e.name}"?`)&&p.mutate({id:e.id})},disabled:p.isPending,title:`Delete`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-red-400 hover:bg-surface-hover disabled:opacity-50`,children:H(J,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}V();function Ct(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function wt({nodeId:e,refreshToken:t}){let n=U(),r=ue().trpcClient,[a,o]=R(null),[l,u]=R(null),p=T(void 0,{refetchOnMount:`always`});X([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let m=L(void 0,{refetchOnMount:`always`}),h=B(()=>{let e=new Set;for(let t of m.data??[])t.isOnline&&e.add(t.id);return e},[m.data]),g=i({nodeId:e},{refetchOnMount:`always`}),_=B(()=>(p.data??[]).filter(e=>h.has(e.nodeId)).map(e=>e.nodeId),[p.data,h]),v=ce({enabled:_.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,_.join(`,`),t],queryFn:async()=>{let e={};for(let t of _)try{e[t]=(await r.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),y=f({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),n.invalidateQueries({queryKey:[[`addonSettings`]]})}}),b=B(()=>g.data?s(g.data):[],[g.data]),x=B(()=>{let e=p.data??[],t=h;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=v.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[p.data,v.data,h]),S=(e,t)=>{let n=(p.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=v.data?.[t];return!Ct(g.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},w=a?p.data?.find(e=>e.nodeId===a.agentNodeId)??null:null,E=a&&g.data?Ct(g.data,a.addonId):null,D=a?v.data?.[a.agentNodeId]??`coreml`:`coreml`,O=()=>{o(null),u(null)},k=(e,t)=>{let n=(p.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;o({addonId:e,agentNodeId:t}),u(n)},A=()=>{!l||!a||!w||y.mutate({agentNodeId:a.agentNodeId,defaults:{...w.settings.addonDefaults,[a.addonId]:l}},{onSuccess:O})};if(p.isLoading||g.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!g.data)return W(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,e,`.`]});let j=a!==null&&E!==null&&l!==null;return W(`div`,{className:`relative h-full w-full space-y-3`,children:[H(mt,{title:`Cluster cameras`}),H(`div`,{className:j?`pr-[360px]`:``,children:b.length>0&&x.length>0?H(c,{tree:b,agents:x,getCellState:S,onCellClick:k,selectedCell:a}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),H(d,{open:j,onClose:O,title:E?.name??``,subtitle:a?`${a.agentNodeId} · ${D}`:``,footer:W(G,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:O,children:`Cancel`}),H(`button`,{type:`button`,disabled:!l||!a||y.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:A,children:y.isPending?`Saving…`:`Save`})]}),children:E&&l&&a&&H(C,{mode:`agent`,addon:E,agentDefault:l,agentNodeId:a.agentNodeId,engineFormat:D,onChangeAgentConfig:e=>u(e)})})]})}V();function Tt({types:e}){let t=U(),n=m(),{data:r}=te({}),i=A(),a=B(()=>i.data??[],[i.data]),[o,s]=R(null),[c,l]=R(null),u=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},d=ee({onSuccess:u}),f=N({onSuccess:u}),p=B(()=>{let e=new Map;for(let t of r??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[r]),h=e=>{e.isDefault||d.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},g=async e=>{if(e.isDefault){await n({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await n({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&f.mutate({id:e.id})},_=e.map(e=>a.find(t=>t.id===e)).filter(e=>e!==void 0);return W(`div`,{className:`space-y-3`,children:[_.length===0?H(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):_.map(e=>H(he,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:p.get(e.id)??[],onAdd:e=>s(e),onEdit:e=>l(e),onDelete:e=>{g(e)},onSetDefault:e=>h(e)},e.id)),o!==null&&H(ge,{initialType:o,onClose:()=>s(null),onCreated:()=>{u(),s(null)}}),c!==null&&H(me,{location:c,onClose:()=>l(null),onSaved:()=>{u(),l(null)}})]})}V();var Et=`pipeline-analytics`;function Dt(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function Ot(){let e=U(),{data:t}=L(void 0),{data:n,isLoading:r}=u({addonId:Et}),i=Dt(n),a=E({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=B(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return W(`div`,{className:`flex flex-col gap-6`,children:[W(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),H(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),W(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(Y,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Et,patch:{postProcessingNodeId:e.target.value}})},disabled:a.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:o.map(e=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&H(Y,{className:`h-4 w-4 animate-spin text-primary`})]})]}),W(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),H(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),H(Tt,{types:[`eventMedia`]})]})]})}V();var kt=`recorder`;function At(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function jt(){let e=U(),{data:t}=L(void 0),{data:n,isLoading:r}=u({addonId:kt}),i=At(n,`recordingNodeId`,`hub`),a=E({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=B(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return W(`div`,{className:`flex flex-col gap-6`,children:[W(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),H(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),W(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(Y,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:kt,patch:{recordingNodeId:e.target.value}})},disabled:a.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:o.map(e=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&H(Y,{className:`h-4 w-4 animate-spin text-primary`})]}),i!==`hub`&&W(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,H(`span`,{className:`font-medium`,children:i}),`. If the auto-derived host doesn't work, set the recorder's`,H(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),W(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),H(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),H(Tt,{types:[`recordings`,`recordingsLow`]})]})]})}V();var Mt=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`}];function Nt({refreshToken:e}){let[t,n]=R(`assignments`),{data:r}=L(void 0),i=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return W(`div`,{className:`flex flex-col h-full`,children:[W(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),H(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),H(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Mt.map(e=>H(`button`,{type:`button`,onClick:()=>n(e.id),className:`shrink-0 whitespace-nowrap px-3 py-2 text-xs font-medium border-b-2 transition-colors ${t===e.id?`border-primary text-primary`:`border-transparent text-foreground-subtle hover:text-foreground`}`,children:e.label},e.id))}),W(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&H(yt,{refreshToken:e}),t===`pipeline`&&(i?H(wt,{nodeId:i,refreshToken:e}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&H(Ot,{}),t===`recording`&&H(jt,{}),t===`settings`&&H(xt,{refreshToken:e}),t===`templates`&&H(St,{refreshToken:e})]})]})}V();var Pt=`__cluster__`;function Ft(){let[e,t]=je(),n=e.get(`node`)??`__cluster__`,[r,i]=R(0);return z(()=>{e.get(`node`)||t({node:Pt},{replace:!0})},[e,t]),W(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[H(`div`,{className:`flex items-center justify-end gap-4 px-4 py-3 border-b border-border shrink-0`,children:W(`button`,{type:`button`,onClick:()=>i(e=>e+1),title:`Refresh`,className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[H(Se,{className:`h-3.5 w-3.5`}),`Refresh`]})}),W(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:[H(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:H(Ue,{selectedNodeId:n,onSelect:e=>{t({node:e},{replace:!0})},refreshToken:r})}),H(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:n===`__cluster__`?H(Nt,{refreshToken:r}):H(vt,{nodeId:n,refreshToken:r})})]})]})}export{Ft as PipelinePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ha as e,ma as t,pa as n}from"./src-C5tvi19O.js";import{F as r,G as i,R as a,U as o,W as s,X as c,b as l,x as u,y as ee}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{L as d,V as te,c as f,g as p,n as ne,p as re,s as m}from"./player-overlays-DzZKARlk.js";import{MaskShapeCanvas as h}from"./MaskShapeCanvas-C5K6H6Th.js";var g=p(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);c();var _=120,ie=`privacy-mask`,v=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,y=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function b(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function x(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function S(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function C({deviceId:c}){let p=f(re().trpcClient,c),[C,w]=i(null),[T,E]=i(!1),[D,O]=i(null),[k,A]=i(null),[j,M]=i(!1),[N,P]=i(!1),[F,I]=i(null),[L,R]=i(null),z=s(!1);a(()=>{if(!p)return;let e=!1;return z.current=!1,w(null),E(!1),O(null),A(null),P(!1),I(null),R(null),(async()=>{try{let t=await p.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(w(t),z.current)return;let n=await p.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);z.current=!0;let r={enabled:n.enabled,regions:n.regions};A(r),O(r)}catch(t){if(e)return;te(t)?E(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[p]);let B=o(()=>D!==null&&k!==null&&(D.enabled!==k.enabled||!S(D.regions,k.regions)),[D,k]),V=D?D.regions.length:0,H=C?C.maxRegions:0,U=s(0);a(()=>{U.current=H},[H]);let W=H>0&&V>=H,G=r(()=>{O(e=>e&&{...e,enabled:!e.enabled})},[]),K=r(e=>{I(typeof e==`number`?e:null)},[]),q=o(()=>D?D.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[D]),J=r((e,t)=>{let n=b(t);n&&O(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),Y=r(e=>{let t=b(e);t&&(R(null),O(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=x(e.regions),i={id:r,enabled:!0,shape:t};return I(r),{...e,regions:[...e.regions,i]}}))},[]),X=r(e=>{P(!0),I(null),R(e)},[]),Z=r(e=>{P(!0),R(null),I(e)},[]),ae=r(e=>{I(t=>t===e?null:t),O(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),oe=r(()=>{R(null),I(null),k&&O({enabled:k.enabled,regions:k.regions})},[k]),se=r(async()=>{if(!(!p||!D)){M(!0);try{await p.privacyMask?.setMask({patch:{enabled:D.enabled,regions:[...D.regions]}});let e=await p.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};A(t),O(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{M(!1)}}},[p,D]),ce=r(()=>{P(e=>(e&&(R(null),I(null)),!e))},[]),Q=C?.supportedShapes??[];ne(o(()=>N&&!T&&C&&D?{id:ie,order:_,node:l(h,{transparent:!0,items:q,supportedShapes:Q,polygonVertices:C.polygonVertices,selectedId:F,onSelect:K,onShapeChange:J,onDrawComplete:Y,drawingKind:L})}:null,[N,T,C,D,q,Q,F,K,J,Y,L]));let le=C?.supportedShapes.includes(`rect`)??!1,ue=C?.supportedShapes.includes(`polygon`)??!1,$=C!==null&&(C.maxRegions<=0||C.supportedShapes.length===0);return p?l(m,{title:`Privacy Mask`,icon:l(e,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:l(`div`,{className:`flex flex-col gap-3`,children:T||$?l(`p`,{className:`${d} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!T&&!$&&C!==null&&D!==null?u(ee,{children:[u(`p`,{className:`${d} leading-relaxed`,children:[`Toggle `,l(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,l(`strong`,{className:`text-foreground`,children:`Save`}),` to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`]}),u(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[l(`button`,{type:`button`,onClick:ce,disabled:j,"aria-pressed":N,className:N?y:v,children:N?`Done editing`:`Edit mask`}),l(`button`,{type:`button`,onClick:G,disabled:j,"aria-pressed":D.enabled,className:D.enabled?y:v,children:D.enabled?`Mask on`:`Mask off`}),le&&l(`button`,{type:`button`,onClick:()=>X(`rect`),disabled:j||W,"aria-pressed":L===`rect`,className:L===`rect`?y:v,title:W?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&l(`button`,{type:`button`,onClick:()=>X(`polygon`),disabled:j||W,"aria-pressed":L===`polygon`,className:L===`polygon`?y:v,title:W?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),u(`span`,{className:`${d} ml-1 tabular-nums`,children:[V,` / `,H,` zones`]}),l(`span`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:oe,disabled:j||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),l(`button`,{type:`button`,onClick:()=>void se(),disabled:j||!B,className:y,children:j?`Saving…`:`Save`})]}),V>0?l(`div`,{className:`flex flex-col gap-1`,children:D.regions.map(e=>{let r=F===e.id,i=e.shape.kind===`polygon`?g:t;return u(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${r?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[u(`button`,{type:`button`,onClick:()=>Z(e.id),disabled:j,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[l(i,{className:`h-3.5 w-3.5 shrink-0`}),u(`span`,{children:[`Zone `,e.id]}),l(`span`,{className:`text-foreground-faint capitalize`,children:e.shape.kind})]}),l(`button`,{type:`button`,onClick:()=>ae(e.id),disabled:j,"aria-label":`Delete zone ${String(e.id)}`,title:`Delete zone`,className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:l(n,{className:`h-3.5 w-3.5`})})]},e.id)})}):null]}):l(`p`,{className:`${d} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{C as PrivacyMaskSettings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,X as t,b 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-CK8iQdP1.js";import{t as i}from"./radio-CWnAI4na.js";import{t as a}from"./server-X3K4ldX4.js";import{t as o}from"./wifi-DYJHTrlD.js";import{B as s}from"./index-CAfPe666.js";var c=s(`cctv`,[[`path`,{d:`M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97`,key:`ir91b5`}],[`path`,{d:`M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z`,key:`jlp8i1`}],[`path`,{d:`M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15`,key:`19bib8`}],[`path`,{d:`M2 21v-4`,key:`l40lih`}],[`path`,{d:`M7 9h.01`,key:`19b3jx`}]]),l=s(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]);t();var u={frigate:{icon:c,color:`#3b82f6`,label:`Frigate`},scrypted:{icon:a,color:`#a855f7`,label:`Scrypted`},reolink:{icon:i,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:l,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:o,color:`#78716c`,label:`RTSP`},onvif:{icon:o,color:`#78716c`,label:`ONVIF`}},d={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},f={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function p(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function m(e){return u[p(e)]??{icon:c,color:`#78716c`,label:e}}function h(e){let t=p(e);return`/api/addon-assets/${e.toLowerCase().startsWith(`provider-`)?e:`provider-${t}`}/assets/icon.svg`}function g({type:t,size:i=`md`,showLabel:a}){let o=m(t),s=o.icon,[c,l]=e(!1),u=h(t);return r(`div`,{className:`flex items-center gap-2`,children:[n(`div`,{className:`flex items-center justify-center rounded-lg ${f[i]}`,style:{backgroundColor:`${o.color}15`},children:c?n(s,{className:d[i],style:{color:o.color}}):n(`img`,{src:u,alt:o.label,className:d[i],onError:()=>l(!0)})}),a&&n(`span`,{className:`text-xs font-medium text-foreground-subtle`,children:o.label})]})}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e,G as t,R as n,U as r,W as i,X as a,b as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";a();function c(e,t){for(let n of e)for(let e of n.fields){if(!(`key`in e)||e.key!==t)continue;if(e.type===`button`||e.type===`separator`||e.type===`info`)return!0;let r=e.immediate;return r===!0?!0:r===!1?!1:n.immediate===!0}return!1}function l({schema:a,serverValues:o,onImmediateSave:s,onDeferredSave:l}){let[u,d]=t({}),[f,p]=t(!1),m=i(null),h=a?.sections??[],g=Object.keys(u).length>0,_=r(()=>({...o,...u}),[o,u]);n(()=>{if(g){p(!0);return}m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(!1),500)},[g]);let v=e(()=>{p(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(!1),2e3)},[]),y=e(e=>{v();let t={},n={},r={...o,...u};for(let[i,a]of Object.entries(e))r[i]!==a&&(c(h,i)?t[i]=a:n[i]=a);Object.keys(t).length>0&&s(t),d(e=>{let r={...e};for(let e of Object.keys(t))delete r[e];for(let[e,t]of Object.entries(n))r[e]=t;return r})},[v,o,u,h,s]),b=e(e=>{let t={},n={};for(let[r,i]of Object.entries(u))e.includes(r)?t[r]=i:n[r]=i;d(n),Object.keys(t).length>0&&l(t)},[u,l]),x=e(e=>{d(t=>{let n={...t};for(let t of e)delete n[t];return n})},[]),S=e(()=>{d({})},[]);return{values:_,pendingKeys:Object.keys(u),hasPendingEdits:g,editingPaused:f,handleChange:y,handleSave:b,handleDiscard:x,resetAll:S}}function u({pendingCount:e,onSave:t,onDiscard:n,saving:r=!1,saveLabel:i=`Save`,discardLabel:a=`Discard`}){return e<=0?null:s(`div`,{className:`sticky bottom-0 -mb-3 flex items-center justify-between gap-3 rounded-lg border border-primary/40 bg-primary/5 px-3 py-2 shadow-sm z-10`,children:[s(`span`,{className:`text-xs text-foreground`,children:[e,` unsaved change`,e===1?``:`s`]}),s(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs text-foreground-subtle hover:bg-surface-hover disabled:opacity-50`,children:a}),o(`button`,{type:`button`,onClick:t,disabled:r,className:`inline-flex items-center rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:r?`Saving…`:i})]})]})}function d({tabs:e,activeId:t,onChange:n,countByTab:r,pendingByTab:i}){return e.length===0?null:o(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:e.map(e=>{let a=e.id===t,c=r?.get(e.id)??0,l=i?.get(e.id)??0;return s(`button`,{type:`button`,onClick:()=>n(e.id),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[e.label,c>0&&s(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:[`(`,c,`)`]}),l>0&&o(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-primary`})]},e.id)})})}export{u as n,l as r,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{vr as e}from"./src-C5tvi19O.js";import{b 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-CK8iQdP1.js";import{f as r}from"./index-CAfPe666.js";import{t as i}from"./AdminPage-CN6ZMhf0.js";import{t as a}from"./NodeAddonsSettingsPanel-B4ru8rzf.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 t(i,{children:s?t(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):c?l.length===0?t(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):t(a,{nodeId:c.id,addonIds:l,level:`global`}):n(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[t(r,{className:`h-8 w-8 opacity-30`}),t(`p`,{children:`No online hub node found.`}),t(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})})}export{o as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,X as t,b 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-CK8iQdP1.js";import{t as i}from"./CapabilityBadges-BWnECBvl.js";import{t as a}from"./ProviderIcon-BpqSF3Hu.js";import{t as o}from"./StatusBadge-CkYubfRG.js";import{t as s}from"./FormBuilder-DVLWBVys.js";t();function c({title:e,children:t}){return r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`border-b border-border px-4 py-2.5`,children:n(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),n(`div`,{className:`p-4`,children:t})]})}function l({name:e,cssVar:t,hex:i}){return r(`div`,{className:`flex flex-col items-center gap-1.5`,children:[n(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:t?`var(${t})`:i}}),n(`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[t,d]=e({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return r(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[r(`div`,{className:`mb-6`,children:[n(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),n(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),n(c,{title:`Typography`,children:r(`div`,{className:`space-y-3`,children:[n(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),n(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),n(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),n(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),n(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),n(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),n(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),n(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),n(c,{title:`Colors`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[n(l,{name:`primary`,cssVar:`--color-primary`}),n(l,{name:`background`,cssVar:`--color-background`}),n(l,{name:`surface`,cssVar:`--color-surface`}),n(l,{name:`foreground`,cssVar:`--color-foreground`}),n(l,{name:`success`,cssVar:`--color-success`}),n(l,{name:`warning`,cssVar:`--color-warning`}),n(l,{name:`danger`,cssVar:`--color-danger`}),n(l,{name:`info`,cssVar:`--color-info`}),n(l,{name:`border`,cssVar:`--color-border`}),n(`div`,{className:`w-px`}),n(l,{name:`frigate`,hex:`#3b82f6`}),n(l,{name:`scrypted`,hex:`#a855f7`}),n(l,{name:`reolink`,hex:`#06b6d4`}),n(l,{name:`ha`,hex:`#22d3ee`}),n(l,{name:`rtsp`,hex:`#78716c`})]})}),n(c,{title:`Buttons`,children:r(`div`,{className:`flex flex-wrap gap-3`,children:[n(`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`}),n(`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`}),n(`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`}),n(`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`}),n(`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`}),n(`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`})]})}),n(c,{title:`Inputs`,children:r(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),n(`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...`})]}),r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),n(`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`})]}),r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),n(`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:`••••••••`})]}),r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),r(`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:[n(`option`,{children:`Option A`}),n(`option`,{children:`Option B`}),n(`option`,{children:`Option C`})]})]}),r(`div`,{className:`md:col-span-2`,children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),n(`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})]}),n(`div`,{children:r(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[n(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),n(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),n(`div`,{children:r(`div`,{className:`flex items-center justify-between`,children:[n(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),n(f,{})]})}),r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),n(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),r(`div`,{children:[n(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),n(`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=>n(`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))})]})]})}),n(c,{title:`Badges`,children:r(`div`,{className:`space-y-3`,children:[r(`div`,{children:[n(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),n(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>n(o,{status:e},e))})]}),r(`div`,{children:[n(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),n(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),n(c,{title:`Cards`,children:r(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[r(`div`,{className:`rounded-lg bg-surface p-4`,children:[n(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),n(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),r(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[n(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),n(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),r(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[n(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),n(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),r(`div`,{className:`rounded-lg bg-background p-4`,children:[n(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),n(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),n(c,{title:`Provider Icons`,children:n(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>n(a,{type:e,size:`lg`,showLabel:!0},e))})}),r(c,{title:`Form Builder Demo`,children:[n(s,{schema:u,values:t,onChange:d}),r(`details`,{className:`mt-3`,children:[n(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),n(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(t,null,2)})]})]}),n(c,{title:`Info Boxes`,children:n(`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:t,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 r(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[n(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:t}),n(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[t,r]=e(!0);return n(`button`,{type:`button`,role:`switch`,"aria-checked":t,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,t?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:n(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,t?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";var n={running:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Running`},stopped:{bg:`bg-foreground-subtle/10`,text:`text-foreground-subtle`,dot:`bg-foreground-subtle`,label:`Stopped`},error:{bg:`bg-danger/10`,text:`text-danger`,dot:`bg-danger`,label:`Error`},online:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Online`},offline:{bg:`bg-foreground-subtle/10`,text:`text-foreground-subtle`,dot:`bg-foreground-subtle`,label:`Offline`},idle:{bg:`bg-info/10`,text:`text-info`,dot:`bg-info`,label:`Idle`},disabled:{bg:`bg-warning/10`,text:`text-warning`,dot:`bg-warning`,label:`Disabled`},enabled:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Enabled`}};function r({status:r}){let i=n[r]??n.stopped;return t(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium ${i.bg} ${i.text}`,children:[e(`span`,{className:`h-1.5 w-1.5 rounded-full ${i.dot}`}),i.label]})}export{r as t};
|
package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Cus-LW9c.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BLisQvKo.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-mzJ_Pmak.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-CGRDjIOZ.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-C5tvi19O.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-CK8iQdP1.js`).then(e=>e.v),[]),"@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-DEeasWo3.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-CK8iQdP1.js`).then(e=>(e.Q(),e.Z)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C1rR7FKs.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-DQOBkcAT.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-PYw2UAZ_.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-CK8iQdP1.js`).then(e=>e.C),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.0.3`,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.0.3`}},"@camstack/types":{name:`@camstack/types`,version:`1.0.3`,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.0.3`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.0.3`,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.0.3`}},"@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{a as e,n as t,r as n,t as r}from"./rolldown-runtime-Cyuzqnbw.js";var i=r((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var S={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function C(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function re(e,t){return C(e.type,t,e.props)}function w(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\/+/g;function T(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function E(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,E(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+T(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),E(o,r,i,``,function(e){return e})):o!=null&&(w(o)&&(o=re(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+T(a,u),c+=E(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+T(a,u++),c+=E(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return E(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function D(e,t,n){if(e==null)return e;var r=[],i=0;return E(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function se(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ce=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},le={map:D,forEach:function(e,t,n){D(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return D(e,function(){t++}),t},toArray:function(e){return D(e,function(e){return e})||[]},only:function(e){if(!w(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=le,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ne.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return C(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ne.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return C(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=w,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:se}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}},e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.2.7`})),a=r(((e,t)=>{t.exports=i()})),o=n({Activity:()=>l,Children:()=>u,Component:()=>d,Fragment:()=>f,Profiler:()=>p,PureComponent:()=>m,StrictMode:()=>h,Suspense:()=>g,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>_,__COMPILER_RUNTIME:()=>v,cache:()=>y,cacheSignal:()=>b,cloneElement:()=>x,createContext:()=>ee,createElement:()=>te,createRef:()=>S,default:()=>c,forwardRef:()=>ne,isValidElement:()=>C,lazy:()=>re,memo:()=>w,startTransition:()=>ie,unstable_useCacheRefresh:()=>ae,use:()=>T,useActionState:()=>oe,useCallback:()=>E,useContext:()=>D,useDebugValue:()=>se,useDeferredValue:()=>ce,useEffect:()=>le,useEffectEvent:()=>ue,useId:()=>de,useImperativeHandle:()=>fe,useInsertionEffect:()=>pe,useLayoutEffect:()=>me,useMemo:()=>he,useOptimistic:()=>ge,useReducer:()=>_e,useRef:()=>ve,useState:()=>ye,useSyncExternalStore:()=>be,useTransition:()=>xe,version:()=>Se}),s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,ee,te,S,ne,C,re,w,ie,ae,T,oe,E,D,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce=t((()=>{s=e(a()),c=s,l=c.Activity,u=c.Children,d=c.Component,f=c.Fragment,p=c.Profiler,m=c.PureComponent,h=c.StrictMode,g=c.Suspense,_=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,v=c.__COMPILER_RUNTIME,y=c.cache,b=c.cacheSignal,x=c.cloneElement,ee=c.createContext,te=c.createElement,S=c.createRef,ne=c.forwardRef,C=c.isValidElement,re=c.lazy,w=c.memo,ie=c.startTransition,ae=c.unstable_useCacheRefresh,T=c.use,oe=c.useActionState,E=c.useCallback,D=c.useContext,se=c.useDebugValue,ce=c.useDeferredValue,le=c.useEffect,ue=c.useEffectEvent,de=c.useId,fe=c.useImperativeHandle,pe=c.useInsertionEffect,me=c.useLayoutEffect,he=c.useMemo,ge=c.useOptimistic,_e=c.useReducer,ve=c.useRef,ye=c.useState,be=c.useSyncExternalStore,xe=c.useTransition,Se=c.version})),we=n({Activity:()=>ke,Children:()=>Ae,Component:()=>je,Fragment:()=>Me,Profiler:()=>Ne,PureComponent:()=>Pe,StrictMode:()=>Fe,Suspense:()=>Ie,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>Le,__COMPILER_RUNTIME:()=>Re,__moduleExports:()=>lt,cache:()=>ze,cacheSignal:()=>Be,cloneElement:()=>Ve,createContext:()=>k,createElement:()=>He,createRef:()=>Ue,default:()=>Oe,forwardRef:()=>We,isValidElement:()=>Ge,lazy:()=>Ke,memo:()=>qe,startTransition:()=>Je,unstable_useCacheRefresh:()=>Ye,use:()=>Xe,useActionState:()=>Ze,useCallback:()=>A,useContext:()=>j,useDebugValue:()=>Qe,useDeferredValue:()=>$e,useEffect:()=>M,useEffectEvent:()=>et,useId:()=>tt,useImperativeHandle:()=>nt,useInsertionEffect:()=>rt,useLayoutEffect:()=>it,useMemo:()=>N,useOptimistic:()=>at,useReducer:()=>ot,useRef:()=>P,useState:()=>F,useSyncExternalStore:()=>I,useTransition:()=>st,version:()=>ct}),Te,Ee,De,O,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,k,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,A,j,Qe,$e,M,et,tt,nt,rt,it,N,at,ot,P,F,I,st,ct,lt,L=t((()=>{Ce(),Te=`__mf_module_cache__`,globalThis[Te]||={share:{},remote:{}},globalThis[Te].share||={},globalThis[Te].remote||={},Ee=globalThis[Te],De=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`)break;let n=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t},O=Ee.share[`default:react`],O===void 0&&(O=De(o),Ee.share[`default:react`]=O),Oe=(()=>{let e=O;for(let t=0;t<5;t++){let t=e?.default;if(!t||typeof t!=`object`)return t??e;e=t}return e})(),{Activity:ke,Children:Ae,Component:je,Fragment:Me,Profiler:Ne,PureComponent:Pe,StrictMode:Fe,Suspense:Ie,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Le,__COMPILER_RUNTIME:Re,cache:ze,cacheSignal:Be,cloneElement:Ve,createContext:k,createElement:He,createRef:Ue,forwardRef:We,isValidElement:Ge,lazy:Ke,memo:qe,startTransition:Je,unstable_useCacheRefresh:Ye,use:Xe,useActionState:Ze,useCallback:A,useContext:j,useDebugValue:Qe,useDeferredValue:$e,useEffect:M,useEffectEvent:et,useId:tt,useImperativeHandle:nt,useInsertionEffect:rt,useLayoutEffect:it,useMemo:N,useOptimistic:at,useReducer:ot,useRef:P,useState:F,useSyncExternalStore:I,useTransition:st,version:ct}=O,lt=O})),ut=r((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),dt=r(((e,t)=>{t.exports=ut()}));L();var ft=n({Fragment:()=>ht,default:()=>mt,jsx:()=>gt,jsxs:()=>_t}),pt=e(dt()),mt=pt.default??pt,ht=mt.Fragment,gt=mt.jsx,_t=mt.jsxs,vt=n({Fragment:()=>Ct,__moduleExports:()=>Et,default:()=>St,jsx:()=>wt,jsxs:()=>Tt}),yt=`__mf_module_cache__`;globalThis[yt]||={share:{},remote:{}},globalThis[yt].share||={},globalThis[yt].remote||={};var bt=globalThis[yt],xt=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`)break;let n=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t},R=bt.share[`default:react/jsx-runtime`];R===void 0&&(R=xt(ft),bt.share[`default:react/jsx-runtime`]=R);var St=(()=>{let e=R;for(let t=0;t<5;t++){let t=e?.default;if(!t||typeof t!=`object`)return t??e;e=t}return e})(),{Fragment:Ct,jsx:wt,jsxs:Tt}=R,Et=R,z=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Dt=new class extends z{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ot={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},B=new class{#e=Ot;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function kt(e){setTimeout(e,0)}var At=typeof window>`u`||`Deno`in globalThis;function V(){}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function H(e,t){return typeof e==`function`?e(t):e}function U(e,t){return typeof e==`function`?e(t):e}function Pt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==It(o,t.options))return!1}else if(!G(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ft(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(W(t.options.mutationKey)!==W(a))return!1}else if(!G(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function It(e,t){return(t?.queryKeyHashFn||W)(e)}function W(e){return JSON.stringify(e,(e,t)=>Bt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function G(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>G(e[n],t[n])):!1}var Lt=Object.prototype.hasOwnProperty;function K(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=zt(e)&&zt(t);if(!r&&!(Bt(e)&&Bt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Lt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=K(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Rt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function zt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Bt(e){if(!Vt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Vt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Vt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ht(e){return new Promise(t=>{B.setTimeout(t,e)})}function Ut(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:K(e,t)}function Wt(e){return e}function Gt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Kt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var qt=Symbol();function Jt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===qt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yt(e,t){return typeof e==`function`?e(...t):!!e}function Xt(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var q=(()=>{let e=()=>At;return{isServer(){return e()},setIsServer(t){e=t}}})();function Zt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function Qt(e){let t;if(e.then(e=>(t=e,e),V)?.catch(V),t!==void 0)return{data:t}}function $t(e){return e}function en(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function tn(e,t,n){let r=()=>{let r=e.promise?.then(t).catch(e=>n(e)?Promise.reject(Error(`redacted`)):Promise.reject(e));return r?.catch(V),r};return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:r()},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function nn(e){return e.state.isPaused}function rn(e){return e.state.status===`success`}function an(e){return!0}function on(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??nn,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[en(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??rn,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors??an,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData??$t;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[tn(e,o,a)]:[])}}function sn(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??$t,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?Qt(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(V)})}var cn=kt;function ln(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=cn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var J=ln(),un=new class extends z{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dn(e){return Math.min(1e3*2**e,3e4)}function fn(e){return(e??`online`)===`online`?un.isOnline():!0}var Y=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function pn(e){return e instanceof Y}function mn(e){let t=!1,n=0,r,i=Zt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Y(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Dt.isFocused()&&(e.networkMode===`always`||un.isOnline())&&e.canRun(),u=()=>fn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(q.isServer()?0:3),o=e.retryDelay??dn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ht(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var hn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mt(this.gcTime)&&(this.#e=B.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(q.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(B.clearTimeout(this.#e),this.#e=void 0)}};function gn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Xt(e,()=>t.signal,()=>n=!0)},u=Jt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Kt:Gt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?vn:_n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function _n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function yn(e,t){return t?_n(e,t)!=null:!1}function bn(e,t){return!t||!e.getPreviousPageParam?!1:vn(e,t)!=null}var xn=class extends hn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=wn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=wn(this.options);e.data!==void 0&&(this.setState(Cn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ut(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>U(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>H(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Jt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=mn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Y&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Y){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Sn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Cn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),J.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Sn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Cn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function wn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var X=class extends z{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Zt(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),En(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof U(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Rt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&On(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||U(this.options.enabled,this.#t)!==U(t.enabled,this.#t)||H(this.options.staleTime,this.#t)!==H(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||U(this.options.enabled,this.#t)!==U(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return An(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}#g(){this.#b();let e=H(this.options.staleTime,this.#t);if(q.isServer()||this.#r.isStale||!Mt(e))return;let t=Nt(this.#r.dataUpdatedAt,e)+1;this.#d=B.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(q.isServer()||U(this.options.enabled,this.#t)===!1||!Mt(this.#p)||this.#p===0)&&(this.#f=B.setInterval(()=>{(this.options.refetchIntervalInBackground||Dt.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(B.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(B.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&En(e,t),o=i&&On(e,n,t,r);(a||o)&&(l={...l,...Sn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Ut(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Ut(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:kn(e,t),refetch:this.refetch,promise:this.#o,isEnabled:U(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Zt())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Rt(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){J.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Tn(e,t){return U(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&U(t.retryOnMount,e)===!1)}function En(e,t){return Tn(e,t)||e.state.data!==void 0&&Dn(e,t,t.refetchOnMount)}function Dn(e,t,n){if(U(t.enabled,e)!==!1&&H(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&kn(e,t)}return!1}function On(e,t,n,r){return(e!==t||U(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&kn(e,n)}function kn(e,t){return U(t.enabled,e)!==!1&&e.isStaleByTime(H(t.staleTime,e))}function An(e,t){return!Rt(e.getCurrentResult(),t)}var jn=class extends X{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yn(t,n.data),hasPreviousPage:bn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Mn=class extends hn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Nn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=mn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),J.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Nn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pn=class extends z{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Mn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Fn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Fn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Fn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Fn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){J.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ft(t,e))}findAll(e={}){return this.getAll().filter(t=>Ft(e,t))}notify(e){J.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return J.batch(()=>Promise.all(e.map(e=>e.continue().catch(V))))}};function Fn(e){return e.options.scope?.id}var In=class extends z{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Rt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&W(t.mutationKey)!==W(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Nn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){J.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ln(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Rn(e,t,n){let r=e.slice(0);return r[t]=n,r}var zn=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,J.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Rt(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ln(e,n).forEach(e=>{e.destroy()}),Ln(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=K(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new X(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Rn(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&J.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Bn=class extends z{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??It(r,t),a=this.get(i);return a||(a=new xn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){J.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Pt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Pt(e,t)):t}notify(e){J.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){J.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){J.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Vn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Bn,this.#t=e.mutationCache||new Pn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Dt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(H(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return J.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;J.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return J.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=J.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return J.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=J.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(V)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(V)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(H(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return un.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(W(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{G(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(W(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{G(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=It(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===qt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Hn({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Gt(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Xt({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}var Un=Symbol(`dataTagSymbol`),Wn=Symbol(`dataTagErrorSymbol`),Gn=Symbol(`unsetMarker`),Kn=k(void 0),Z=e=>{let t=j(Kn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},qn=({client:e,children:t})=>(M(()=>(e.mount(),()=>{e.unmount()}),[e]),wt(Kn.Provider,{value:e,children:t}));L();var Jn=k(!1),Yn=()=>j(Jn),Xn=Jn.Provider;L();function Zn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qn=k(Zn()),$n=()=>j(Qn),er=({children:e})=>{let[t]=F(()=>Zn());return wt(Qn.Provider,{value:t,children:typeof e==`function`?e(t):e})};L();var tr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Yt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},nr=e=>{M(()=>{e.clearReset()},[e])},rr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Yt(n,[e.error,r])),ir=(e,t)=>t.state.data===void 0,ar=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},or=(e,t)=>e.isLoading&&e.isFetching&&!t,sr=(e,t)=>e?.suspense&&t.isPending,cr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});L();function lr({queries:e,...t},n){let r=Z(n),i=Yn(),a=$n(),o=N(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{ar(e),tr(e,a,r.getQueryCache().get(e.queryHash))}),nr(a);let[s]=F(()=>new zn(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;I(A(e=>d?s.subscribe(J.batchCalls(e)):V,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>sr(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&sr(n,e)?cr(n,new X(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&rr({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}L();function ur(e,t,n){let r=Yn(),i=$n(),a=Z(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ar(o),tr(o,i,s),nr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=F(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(I(A(e=>{let t=f?u.subscribe(J.batchCalls(e)):V;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),M(()=>{u.setOptions(o)},[o,u]),sr(o,d))throw cr(o,u,i);if(rr({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!q.isServer()&&or(d,r)&&(l?cr(o,u,i):s?.promise)?.catch(V).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function dr(e,t){return ur(e,X,t)}function fr(e,t){return ur({...e,enabled:!0,suspense:!0,throwOnError:ir,placeholderData:void 0},X,t)}function pr(e,t){return ur({...e,enabled:!0,suspense:!0,throwOnError:ir},jn,t)}function mr(e,t){return lr({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:ir,enabled:!0,placeholderData:void 0}))},t)}function hr(e,t){let n=Z(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function gr(e,t){let n=Z(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function _r(e){return e}function vr(e){return e}L();var yr=({children:e,options:t={},state:n,queryClient:r})=>{let i=Z(r),a=P(t);M(()=>{a.current=t});let o=N(()=>{if(n){if(typeof n!=`object`)return;let e=i.getQueryCache(),t=n.queries||[],r=[],o=[];for(let n of t){let t=e.get(n.queryHash);t?(n.state.dataUpdatedAt>t.state.dataUpdatedAt||n.promise&&t.state.status!==`pending`&&t.state.fetchStatus!==`fetching`&&n.dehydratedAt!==void 0&&n.dehydratedAt>t.state.dataUpdatedAt)&&o.push(n):r.push(n)}if(r.length>0&&sn(i,{queries:r},a.current),o.length>0)return o}},[i,n]);return M(()=>{o&&sn(i,{queries:o},a.current)},[i,o]),e};L();function br(e,t){let n=Z(t),r=n.getQueryCache();return I(A(e=>r.subscribe(J.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}L();function xr(e,t){let n=Z(t);return Cr({filters:{...e,status:`pending`}},n).length}function Sr(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Cr(e={},t){let n=Z(t).getMutationCache(),r=P(e),i=P(null);return i.current===null&&(i.current=Sr(n,e)),M(()=>{r.current=e}),I(A(e=>n.subscribe(()=>{let t=K(i.current,Sr(n,r.current));i.current!==t&&(i.current=t,J.schedule(e))}),[n]),()=>i.current,()=>i.current)}L();function wr(e,t){let n=Z(t),[r]=F(()=>new In(n,e));M(()=>{r.setOptions(e)},[r,e]);let i=I(A(e=>r.subscribe(J.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A((e,t)=>{r.mutate(e,t).catch(V)},[r]);if(i.error&&Yt(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Tr(e){return e}function Er(e,t){return ur(e,jn,t)}var Dr=n({CancelledError:()=>Y,HydrationBoundary:()=>yr,InfiniteQueryObserver:()=>jn,IsRestoringProvider:()=>Xn,Mutation:()=>Mn,MutationCache:()=>Pn,MutationObserver:()=>In,QueriesObserver:()=>zn,Query:()=>xn,QueryCache:()=>Bn,QueryClient:()=>Vn,QueryClientContext:()=>Kn,QueryClientProvider:()=>qn,QueryErrorResetBoundary:()=>er,QueryObserver:()=>X,dataTagErrorSymbol:()=>Wn,dataTagSymbol:()=>Un,defaultScheduler:()=>cn,defaultShouldDehydrateMutation:()=>nn,defaultShouldDehydrateQuery:()=>rn,dehydrate:()=>on,environmentManager:()=>q,experimental_streamedQuery:()=>Hn,focusManager:()=>Dt,hashKey:()=>W,hydrate:()=>sn,infiniteQueryOptions:()=>vr,isCancelledError:()=>pn,isServer:()=>At,keepPreviousData:()=>Wt,matchMutation:()=>Ft,matchQuery:()=>Pt,mutationOptions:()=>Tr,noop:()=>V,notifyManager:()=>J,onlineManager:()=>un,partialMatchKey:()=>G,queryOptions:()=>_r,replaceEqualDeep:()=>K,shouldThrowError:()=>Yt,skipToken:()=>qt,timeoutManager:()=>B,unsetMarker:()=>Gn,useInfiniteQuery:()=>Er,useIsFetching:()=>br,useIsMutating:()=>xr,useIsRestoring:()=>Yn,useMutation:()=>wr,useMutationState:()=>Cr,usePrefetchInfiniteQuery:()=>gr,usePrefetchQuery:()=>hr,useQueries:()=>lr,useQuery:()=>dr,useQueryClient:()=>Z,useQueryErrorResetBoundary:()=>$n,useSuspenseInfiniteQuery:()=>pr,useSuspenseQueries:()=>mr,useSuspenseQuery:()=>fr}),Or=n({CancelledError:()=>Qr,HydrationBoundary:()=>kr,InfiniteQueryObserver:()=>$r,IsRestoringProvider:()=>Ar,Mutation:()=>ei,MutationCache:()=>ti,MutationObserver:()=>ni,QueriesObserver:()=>ri,Query:()=>ii,QueryCache:()=>ai,QueryClient:()=>oi,QueryClientContext:()=>jr,QueryClientProvider:()=>Mr,QueryErrorResetBoundary:()=>Nr,QueryObserver:()=>si,dataTagErrorSymbol:()=>Ai,dataTagSymbol:()=>ji,default:()=>Q,defaultScheduler:()=>ci,defaultShouldDehydrateMutation:()=>li,defaultShouldDehydrateQuery:()=>ui,dehydrate:()=>di,environmentManager:()=>fi,experimental_streamedQuery:()=>pi,focusManager:()=>mi,hashKey:()=>hi,hydrate:()=>gi,infiniteQueryOptions:()=>Pr,isCancelledError:()=>_i,isServer:()=>vi,keepPreviousData:()=>yi,matchMutation:()=>bi,matchQuery:()=>xi,mutationOptions:()=>Fr,noop:()=>Si,notifyManager:()=>Ci,onlineManager:()=>wi,partialMatchKey:()=>Ti,queryOptions:()=>Ir,replaceEqualDeep:()=>Ei,shouldThrowError:()=>Di,skipToken:()=>Oi,timeoutManager:()=>ki,unsetMarker:()=>Mi,useInfiniteQuery:()=>Lr,useIsFetching:()=>Rr,useIsMutating:()=>zr,useIsRestoring:()=>Br,useMutation:()=>Vr,useMutationState:()=>Hr,usePrefetchInfiniteQuery:()=>Ur,usePrefetchQuery:()=>Wr,useQueries:()=>Gr,useQuery:()=>Kr,useQueryClient:()=>qr,useQueryErrorResetBoundary:()=>Jr,useSuspenseInfiniteQuery:()=>Yr,useSuspenseQueries:()=>Xr,useSuspenseQuery:()=>Zr}),Q=Dr,kr=Q.HydrationBoundary,Ar=Q.IsRestoringProvider,jr=Q.QueryClientContext,Mr=Q.QueryClientProvider,Nr=Q.QueryErrorResetBoundary,Pr=Q.infiniteQueryOptions,Fr=Q.mutationOptions,Ir=Q.queryOptions,Lr=Q.useInfiniteQuery,Rr=Q.useIsFetching,zr=Q.useIsMutating,Br=Q.useIsRestoring,Vr=Q.useMutation,Hr=Q.useMutationState,Ur=Q.usePrefetchInfiniteQuery,Wr=Q.usePrefetchQuery,Gr=Q.useQueries,Kr=Q.useQuery,qr=Q.useQueryClient,Jr=Q.useQueryErrorResetBoundary,Yr=Q.useSuspenseInfiniteQuery,Xr=Q.useSuspenseQueries,Zr=Q.useSuspenseQuery,Qr=Q.CancelledError,$r=Q.InfiniteQueryObserver,ei=Q.Mutation,ti=Q.MutationCache,ni=Q.MutationObserver,ri=Q.QueriesObserver,ii=Q.Query,ai=Q.QueryCache,oi=Q.QueryClient,si=Q.QueryObserver,ci=Q.defaultScheduler,li=Q.defaultShouldDehydrateMutation,ui=Q.defaultShouldDehydrateQuery,di=Q.dehydrate,fi=Q.environmentManager,pi=Q.experimental_streamedQuery,mi=Q.focusManager,hi=Q.hashKey,gi=Q.hydrate,_i=Q.isCancelledError,vi=Q.isServer,yi=Q.keepPreviousData,bi=Q.matchMutation,xi=Q.matchQuery,Si=Q.noop,Ci=Q.notifyManager,wi=Q.onlineManager,Ti=Q.partialMatchKey,Ei=Q.replaceEqualDeep,Di=Q.shouldThrowError,Oi=Q.skipToken,ki=Q.timeoutManager,Ai=Q.dataTagErrorSymbol,ji=Q.dataTagSymbol,Mi=Q.unsetMarker,Ni=n({CancelledError:()=>sa,HydrationBoundary:()=>Ri,InfiniteQueryObserver:()=>ca,IsRestoringProvider:()=>zi,Mutation:()=>la,MutationCache:()=>ua,MutationObserver:()=>da,QueriesObserver:()=>fa,Query:()=>pa,QueryCache:()=>ma,QueryClient:()=>ha,QueryClientContext:()=>Bi,QueryClientProvider:()=>Vi,QueryErrorResetBoundary:()=>Hi,QueryObserver:()=>ga,__moduleExports:()=>Ha,dataTagErrorSymbol:()=>za,dataTagSymbol:()=>Ba,default:()=>Li,defaultScheduler:()=>_a,defaultShouldDehydrateMutation:()=>va,defaultShouldDehydrateQuery:()=>ya,dehydrate:()=>ba,environmentManager:()=>xa,experimental_streamedQuery:()=>Sa,focusManager:()=>Ca,hashKey:()=>wa,hydrate:()=>Ta,infiniteQueryOptions:()=>Ui,isCancelledError:()=>Ea,isServer:()=>Da,keepPreviousData:()=>Oa,matchMutation:()=>ka,matchQuery:()=>Aa,mutationOptions:()=>Wi,noop:()=>ja,notifyManager:()=>Ma,onlineManager:()=>Na,partialMatchKey:()=>Pa,queryOptions:()=>Gi,replaceEqualDeep:()=>Fa,shouldThrowError:()=>Ia,skipToken:()=>La,timeoutManager:()=>Ra,unsetMarker:()=>Va,useInfiniteQuery:()=>Ki,useIsFetching:()=>qi,useIsMutating:()=>Ji,useIsRestoring:()=>Yi,useMutation:()=>Xi,useMutationState:()=>Zi,usePrefetchInfiniteQuery:()=>Qi,usePrefetchQuery:()=>$i,useQueries:()=>ea,useQuery:()=>ta,useQueryClient:()=>na,useQueryErrorResetBoundary:()=>ra,useSuspenseInfiniteQuery:()=>ia,useSuspenseQueries:()=>aa,useSuspenseQuery:()=>oa}),Pi=`__mf_module_cache__`;globalThis[Pi]||={share:{},remote:{}},globalThis[Pi].share||={},globalThis[Pi].remote||={};var Fi=globalThis[Pi],Ii=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`)break;let n=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t},$=Fi.share[`default:@tanstack/react-query`];$===void 0&&($=Ii(Or),Fi.share[`default:@tanstack/react-query`]=$);var Li=(()=>{let e=$;for(let t=0;t<5;t++){let t=e?.default;if(!t||typeof t!=`object`)return t??e;e=t}return e})(),{HydrationBoundary:Ri,IsRestoringProvider:zi,QueryClientContext:Bi,QueryClientProvider:Vi,QueryErrorResetBoundary:Hi,infiniteQueryOptions:Ui,mutationOptions:Wi,queryOptions:Gi,useInfiniteQuery:Ki,useIsFetching:qi,useIsMutating:Ji,useIsRestoring:Yi,useMutation:Xi,useMutationState:Zi,usePrefetchInfiniteQuery:Qi,usePrefetchQuery:$i,useQueries:ea,useQuery:ta,useQueryClient:na,useQueryErrorResetBoundary:ra,useSuspenseInfiniteQuery:ia,useSuspenseQueries:aa,useSuspenseQuery:oa,CancelledError:sa,InfiniteQueryObserver:ca,Mutation:la,MutationCache:ua,MutationObserver:da,QueriesObserver:fa,Query:pa,QueryCache:ma,QueryClient:ha,QueryObserver:ga,defaultScheduler:_a,defaultShouldDehydrateMutation:va,defaultShouldDehydrateQuery:ya,dehydrate:ba,environmentManager:xa,experimental_streamedQuery:Sa,focusManager:Ca,hashKey:wa,hydrate:Ta,isCancelledError:Ea,isServer:Da,keepPreviousData:Oa,matchMutation:ka,matchQuery:Aa,noop:ja,notifyManager:Ma,onlineManager:Na,partialMatchKey:Pa,replaceEqualDeep:Fa,shouldThrowError:Ia,skipToken:La,timeoutManager:Ra,dataTagErrorSymbol:za,dataTagSymbol:Ba,unsetMarker:Va}=$,Ha=$;export{Ke as A,tt as B,ft as C,He as D,k as E,A as F,F as G,it as H,j as I,Ie as J,I as K,$e as L,je as M,Je as N,We as O,Xe as P,Ce as Q,M as R,vt as S,Ae as T,N as U,nt as V,P as W,L as X,we as Y,o as Z,Ni as _,ta as a,wt as b,aa as c,ha as d,wa as f,Ki as g,Gi as h,ea as i,qe as j,Ge as k,oa as l,La as m,Qi as n,na as o,Ui as p,Fe as q,$i as r,ia as s,Xi as t,Vi as u,Or as v,Oe as w,Tt as x,Ct as y,Me as z};
|