@rubytech/create-maxy-code 0.1.370 → 0.1.371

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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts.map +1 -1
  3. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js +1 -0
  4. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js.map +1 -1
  5. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts.map +1 -1
  6. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +2 -1
  7. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
  8. package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.d.ts.map +1 -1
  9. package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js +5 -1
  10. package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js.map +1 -1
  11. package/payload/server/{chunk-CXEC5RWB.js → chunk-OBZE2KCK.js} +42 -0
  12. package/payload/server/maxy-edge.js +1 -1
  13. package/payload/server/public/assets/{AdminLoginScreens-B45MFjWG.js → AdminLoginScreens-zXJJq-wN.js} +1 -1
  14. package/payload/server/public/assets/AdminShell-BA24dbW1.js +1 -0
  15. package/payload/server/public/assets/{Checkbox-BPYEJJPq.js → Checkbox-BO0J7hn7.js} +1 -1
  16. package/payload/server/public/assets/{OperatorConversations-Civ7TETM.css → OperatorConversations-BA1bRX1_.css} +1 -1
  17. package/payload/server/public/assets/OperatorConversations-Cf-ejiJO.js +9 -0
  18. package/payload/server/public/assets/{admin-DcuJ3_xm.js → admin-B5blbG0q.js} +1 -1
  19. package/payload/server/public/assets/{browser-Be9LRtM2.js → browser-Cc38Ih6f.js} +1 -1
  20. package/payload/server/public/assets/calendar-ZY9A8F44.js +1 -0
  21. package/payload/server/public/assets/chat-zZuu4bcb.js +1 -0
  22. package/payload/server/public/assets/data-DuoDaO1z.js +1 -0
  23. package/payload/server/public/assets/{graph-XYK2qT5D.js → graph-CSOYoN0i.js} +3 -3
  24. package/payload/server/public/assets/{graph-labels-DNCXtQVn.js → graph-labels-DdiX7_Ot.js} +1 -1
  25. package/payload/server/public/assets/operator-Cvci_FDA.js +1 -0
  26. package/payload/server/public/assets/page-6HQSRX5P.js +32 -0
  27. package/payload/server/public/assets/{public-BxZBMrEL.js → public-DG-f7MFU.js} +1 -1
  28. package/payload/server/public/assets/{rotate-ccw-BxD1B_G-.js → rotate-ccw-Dahm1S_V.js} +1 -1
  29. package/payload/server/public/browser.html +4 -4
  30. package/payload/server/public/calendar.html +4 -4
  31. package/payload/server/public/chat.html +6 -6
  32. package/payload/server/public/data.html +4 -4
  33. package/payload/server/public/graph.html +7 -7
  34. package/payload/server/public/index.html +6 -6
  35. package/payload/server/public/operator.html +8 -8
  36. package/payload/server/public/public.html +6 -6
  37. package/payload/server/server.js +35 -1
  38. package/payload/server/public/assets/AdminShell-CyZPfbzd.js +0 -1
  39. package/payload/server/public/assets/OperatorConversations-D_o_59Oc.js +0 -9
  40. package/payload/server/public/assets/calendar-BeofvK7c.js +0 -1
  41. package/payload/server/public/assets/chat-nth30R3E.js +0 -1
  42. package/payload/server/public/assets/data-lTmU53k6.js +0 -1
  43. package/payload/server/public/assets/operator-As5Tw1vj.js +0 -1
  44. package/payload/server/public/assets/page-CII4OBX3.js +0 -32
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CAM3fms7.js";import{H as t,M as n,P as r,W as i,b as a,j as o,v as s,w as c,y as l,z as u}from"./OperatorConversations-D_o_59Oc.js";import{t as d,y as f}from"./AdminShell-CyZPfbzd.js";var p=u(`monitor-play`,[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]),m=t(),h=e(i(),1),g=c(),_=`maxy-vnc-popout`;function v(){let[e,t]=(0,h.useState)(null),[i,s]=(0,h.useState)(!1),[c,u]=(0,h.useState)(null),d=l(null);(0,h.useEffect)(()=>{let e=!1;return fetch(`/vnc-viewer.html`,{method:`HEAD`}).then(n=>{e||(console.info(`[browser-page] op=viewer-probe available=${n.ok}`),t(n.ok))}).catch(()=>{e||(console.info(`[browser-page] op=viewer-probe available=false`),t(!1))}),()=>{e=!0}},[]);let f=(0,h.useCallback)(()=>{window.open(`/vnc-popout.html?title=${encodeURIComponent(a.productName)}`,_,`width=1024,height=768`)},[]),m=(0,h.useCallback)(async()=>{s(!0),u(null);try{let e=await d(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}}catch(e){u(e instanceof Error?e.message:String(e))}finally{s(!1)}},[d]);return e===null?(0,g.jsx)(`div`,{className:`vnc-surface`,children:(0,g.jsxs)(`div`,{className:`data-loading`,children:[(0,g.jsx)(o,{size:18,className:`spin`}),` Checking viewer…`]})}):e?(0,g.jsxs)(`div`,{className:`vnc-surface`,children:[(0,g.jsxs)(`div`,{className:`vnc-surface__toolbar`,children:[(0,g.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:m,disabled:i,children:[i?(0,g.jsx)(o,{size:14,className:`spin`}):(0,g.jsx)(n,{size:14}),` Launch browser`]}),(0,g.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:f,children:[(0,g.jsx)(r,{size:14}),` Pop out`]}),c&&(0,g.jsx)(`span`,{className:`vnc-surface__error`,children:c})]}),(0,g.jsx)(`iframe`,{className:`vnc-surface__iframe`,src:`/vnc-viewer.html`,title:`VNC viewer`})]}):(0,g.jsx)(`div`,{className:`vnc-surface`,children:(0,g.jsxs)(`div`,{className:`vnc-surface__unavailable`,children:[(0,g.jsx)(p,{size:20}),(0,g.jsx)(`p`,{children:`VNC surface not available on this platform.`})]})})}function y(){let[e,t]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),[a,c]=(0,h.useState)(void 0),[l,u]=(0,h.useState)(null),[p,m]=(0,h.useState)(void 0),[_,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&c(e.businessName),e.sessionId!==void 0&&u(e.sessionId??null),x(e.role??null),m(e.userName===void 0?null:e.userName),y(e.avatar??null)}catch{}t(n),i(!0)}}).catch(()=>{e||(t(n),i(!0))}),()=>{e=!0}},[]);let S=(0,h.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[C,w]=(0,h.useState)(!1),T=(0,h.useCallback)(async()=>{w(!0);try{let e=await f();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return r?e?(0,g.jsx)(s,{cacheKey:e,surface:`browser`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=browser`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,g.jsx)(d,{cacheKey:e,businessName:a,sessionId:l,onLogout:S,onDisconnect:T,disconnecting:C,userName:p,userAvatar:_,role:b,children:(0,g.jsxs)(`div`,{className:`data-page`,children:[(0,g.jsx)(`header`,{className:`data-header`,children:(0,g.jsxs)(`h1`,{className:`data-title`,children:[(0,g.jsx)(n,{size:18}),` Browser`]})}),(0,g.jsx)(v,{})]})})}):(0,g.jsxs)(`div`,{className:`data-page`,children:[(0,g.jsx)(`header`,{className:`data-header`,children:(0,g.jsxs)(`h1`,{className:`data-title`,children:[(0,g.jsx)(n,{size:18}),` Browser`]})}),(0,g.jsxs)(`div`,{className:`data-empty`,children:[(0,g.jsx)(`p`,{children:`You are not signed in.`}),(0,g.jsxs)(`p`,{children:[`Open the `,(0,g.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,g.jsx)(`div`,{className:`data-page`,children:(0,g.jsxs)(`div`,{className:`data-loading`,children:[(0,g.jsx)(o,{size:18,className:`spin`}),` Loading…`]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,g.jsx)(y,{}));
1
+ import{o as e}from"./chunk-CAM3fms7.js";import{B as t,F as n,G as r,M as i,N as a,T as o,U as s,b as c,x as l,y as u}from"./OperatorConversations-Cf-ejiJO.js";import{t as d,y as f}from"./AdminShell-BA24dbW1.js";var p=t(`monitor-play`,[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]),m=s(),h=e(r(),1),g=o(),_=`maxy-vnc-popout`;function v(){let[e,t]=(0,h.useState)(null),[r,o]=(0,h.useState)(!1),[s,u]=(0,h.useState)(null),d=c(null);(0,h.useEffect)(()=>{let e=!1;return fetch(`/vnc-viewer.html`,{method:`HEAD`}).then(n=>{e||(console.info(`[browser-page] op=viewer-probe available=${n.ok}`),t(n.ok))}).catch(()=>{e||(console.info(`[browser-page] op=viewer-probe available=false`),t(!1))}),()=>{e=!0}},[]);let f=(0,h.useCallback)(()=>{window.open(`/vnc-popout.html?title=${encodeURIComponent(l.productName)}`,_,`width=1024,height=768`)},[]),m=(0,h.useCallback)(async()=>{o(!0),u(null);try{let e=await d(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}}catch(e){u(e instanceof Error?e.message:String(e))}finally{o(!1)}},[d]);return e===null?(0,g.jsx)(`div`,{className:`vnc-surface`,children:(0,g.jsxs)(`div`,{className:`data-loading`,children:[(0,g.jsx)(i,{size:18,className:`spin`}),` Checking viewer…`]})}):e?(0,g.jsxs)(`div`,{className:`vnc-surface`,children:[(0,g.jsxs)(`div`,{className:`vnc-surface__toolbar`,children:[(0,g.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:m,disabled:r,children:[r?(0,g.jsx)(i,{size:14,className:`spin`}):(0,g.jsx)(a,{size:14}),` Launch browser`]}),(0,g.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:f,children:[(0,g.jsx)(n,{size:14}),` Pop out`]}),s&&(0,g.jsx)(`span`,{className:`vnc-surface__error`,children:s})]}),(0,g.jsx)(`iframe`,{className:`vnc-surface__iframe`,src:`/vnc-viewer.html`,title:`VNC viewer`})]}):(0,g.jsx)(`div`,{className:`vnc-surface`,children:(0,g.jsxs)(`div`,{className:`vnc-surface__unavailable`,children:[(0,g.jsx)(p,{size:20}),(0,g.jsx)(`p`,{children:`VNC surface not available on this platform.`})]})})}function y(){let[e,t]=(0,h.useState)(null),[n,r]=(0,h.useState)(!1),[o,s]=(0,h.useState)(void 0),[c,l]=(0,h.useState)(null),[p,m]=(0,h.useState)(void 0),[_,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&s(e.businessName),e.sessionId!==void 0&&l(e.sessionId??null),x(e.role??null),m(e.userName===void 0?null:e.userName),y(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let S=(0,h.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[C,w]=(0,h.useState)(!1),T=(0,h.useCallback)(async()=>{w(!0);try{let e=await f();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return n?e?(0,g.jsx)(u,{cacheKey:e,surface:`browser`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=browser`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,g.jsx)(d,{cacheKey:e,businessName:o,sessionId:c,onLogout:S,onDisconnect:T,disconnecting:C,userName:p,userAvatar:_,role:b,children:(0,g.jsxs)(`div`,{className:`data-page`,children:[(0,g.jsx)(`header`,{className:`data-header`,children:(0,g.jsxs)(`h1`,{className:`data-title`,children:[(0,g.jsx)(a,{size:18}),` Browser`]})}),(0,g.jsx)(v,{})]})})}):(0,g.jsxs)(`div`,{className:`data-page`,children:[(0,g.jsx)(`header`,{className:`data-header`,children:(0,g.jsxs)(`h1`,{className:`data-title`,children:[(0,g.jsx)(a,{size:18}),` Browser`]})}),(0,g.jsxs)(`div`,{className:`data-empty`,children:[(0,g.jsx)(`p`,{children:`You are not signed in.`}),(0,g.jsxs)(`p`,{children:[`Open the `,(0,g.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,g.jsx)(`div`,{className:`data-page`,children:(0,g.jsxs)(`div`,{className:`data-loading`,children:[(0,g.jsx)(i,{size:18,className:`spin`}),` Loading…`]})})}(0,m.createRoot)(document.getElementById(`root`)).render((0,g.jsx)(y,{}));
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CAM3fms7.js";import{A as t,B as n,D as r,E as i,F as a,G as o,H as s,L as c,M as l,R as u,T as d,U as f,y as p}from"./OperatorConversations-Cf-ejiJO.js";import{d as m,t as h,y as g}from"./AdminShell-BA24dbW1.js";var _=n(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),v=n(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),y=n(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),b=n(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),x=n(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),S=n(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),C=f(),w=e(o(),1);function T(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function E(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function D(e){let t=T(e),n=t.getDay();return E(t,n===0?-6:1-n)}function O(e){let t=D(e);return Array.from({length:7},(e,n)=>E(t,n))}function k(e){let t=D(new Date(e.getFullYear(),e.getMonth(),1));return Array.from({length:42},(e,n)=>E(t,n))}function A(){return Array.from({length:24},(e,t)=>t)}function ee(e){let t=e.getFullYear();return Array.from({length:12},(e,n)=>new Date(t,n,1))}function j(e,t){switch(e){case`day`:{let e=T(t);return{from:e,to:E(e,1)}}case`week`:{let e=D(t);return{from:e,to:E(e,7)}}case`month`:{let e=D(new Date(t.getFullYear(),t.getMonth(),1));return{from:e,to:E(e,42)}}case`year`:return{from:new Date(t.getFullYear(),0,1),to:new Date(t.getFullYear()+1,0,1)}}}function M(e,t,n){switch(e){case`day`:return E(t,n);case`week`:return E(t,n*7);case`month`:return new Date(t.getFullYear(),t.getMonth()+n,1);case`year`:return new Date(t.getFullYear()+n,t.getMonth(),1)}}function N(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function P(e,t){return{role:`button`,tabIndex:0,onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}}}var F=d(),I=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],L=3;function R(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function te({anchor:e,meetings:t,onSelect:n}){let r=k(e),i=e.getMonth(),a=new Date;return(0,F.jsxs)(`div`,{className:`cal-month`,children:[(0,F.jsx)(`div`,{className:`cal-weekday-row`,children:I.map(e=>(0,F.jsx)(`div`,{className:`cal-weekday`,children:e},e))}),(0,F.jsx)(`div`,{className:`cal-month-grid`,children:r.map(e=>{let r=t.filter(t=>N(new Date(t.startsAt),e)).sort((e,t)=>e.startsAt.localeCompare(t.startsAt)),o=e.getMonth()!==i,s=N(e,a);return(0,F.jsxs)(`div`,{className:`cal-cell${o?` cal-cell-out`:``}${s?` cal-cell-today`:``}`,children:[(0,F.jsx)(`div`,{className:`cal-cell-num`,children:e.getDate()}),r.slice(0,L).map(e=>(0,F.jsxs)(`div`,{className:`cal-chip`,title:e.title??`Untitled`,...P(e,n),children:[!e.isAllDay&&(0,F.jsx)(`span`,{className:`cal-chip-time`,children:R(new Date(e.startsAt))}),e.title??`Untitled`]},e.meetingId)),r.length>L&&(0,F.jsxs)(`div`,{className:`cal-more`,children:[`+`,r.length-L,` more`]})]},e.toISOString())})})]})}var z=1440,B=1.8;function V(e){return e.getHours()*60+e.getMinutes()}function H(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function U({day:e,meetings:t,hourHeight:n,onSelect:r}){let i=n*24,a=t.filter(t=>!t.isAllDay&&N(new Date(t.startsAt),e));return(0,F.jsx)(`div`,{className:`cal-day-col`,children:(0,F.jsxs)(`div`,{className:`cal-hours`,style:{height:`${i}px`},children:[Array.from({length:24},(e,t)=>(0,F.jsx)(`div`,{className:`cal-hour-line`,style:{top:`${t*n}px`}},t)),a.map(t=>{let n=new Date(t.startsAt),i=t.endsAt?new Date(t.endsAt):new Date(n.getTime()+30*6e4),a=V(n),o=N(i,e)?V(i):z,s=a/z*100,c=Math.max((o-a)/z*100,B);return(0,F.jsxs)(`div`,{className:`cal-event`,style:{top:`${s}%`,height:`${c}%`},title:t.title??`Untitled`,...P(t,r),children:[(0,F.jsx)(`span`,{className:`cal-event-time`,children:H(n)}),(0,F.jsx)(`span`,{className:`cal-event-title`,children:t.title??`Untitled`})]},t.meetingId)})]})})}var W=44;function G(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function K({anchor:e,meetings:t,onSelect:n}){let r=O(e),i=new Date;return(0,F.jsxs)(`div`,{className:`cal-timed`,children:[(0,F.jsxs)(`div`,{className:`cal-day-headrow`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`}),r.map(e=>(0,F.jsxs)(`div`,{className:`cal-day-head${N(e,i)?` cal-day-head-today`:``}`,children:[(0,F.jsx)(`span`,{className:`cal-day-head-name`,children:e.toLocaleDateString([],{weekday:`short`})}),(0,F.jsx)(`span`,{className:`cal-day-head-num`,children:e.getDate()})]},e.toISOString()))]}),(0,F.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),r.map(e=>(0,F.jsx)(`div`,{className:`cal-allday-cell`,children:t.filter(t=>t.isAllDay&&N(new Date(t.startsAt),e)).map(e=>(0,F.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...P(e,n),children:e.title??`Untitled`},e.meetingId))},e.toISOString()))]}),(0,F.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:A().map(e=>(0,F.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${W}px`},children:e===0?``:G(e)},e))}),r.map(e=>(0,F.jsx)(U,{day:e,meetings:t,hourHeight:W,onSelect:n},e.toISOString()))]})]})}var q=52;function J(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function Y({anchor:e,meetings:t,onSelect:n}){let r=t.filter(t=>t.isAllDay&&N(new Date(t.startsAt),e));return(0,F.jsxs)(`div`,{className:`cal-timed cal-timed-single`,children:[(0,F.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),(0,F.jsx)(`div`,{className:`cal-allday-cell`,children:r.map(e=>(0,F.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...P(e,n),children:e.title??`Untitled`},e.meetingId))})]}),(0,F.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,F.jsx)(`div`,{className:`cal-timed-gutter`,children:A().map(e=>(0,F.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${q}px`},children:e===0?``:J(e)},e))}),(0,F.jsx)(U,{day:e,meetings:t,hourHeight:q,onSelect:n})]})]})}var X=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Z(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function ne({anchor:e,meetings:t,onPickMonth:n}){let r=new Date,i=new Set(t.map(e=>Z(new Date(e.startsAt))));return(0,F.jsx)(`div`,{className:`cal-year`,children:(0,F.jsx)(`div`,{className:`cal-year-grid`,children:ee(e).map(e=>{let t=k(e),a=e.getMonth();return(0,F.jsxs)(`button`,{type:`button`,className:`cal-mini`,onClick:()=>n(e),title:e.toLocaleDateString([],{month:`long`,year:`numeric`}),children:[(0,F.jsx)(`div`,{className:`cal-mini-title`,children:e.toLocaleDateString([],{month:`long`})}),(0,F.jsx)(`div`,{className:`cal-mini-weekrow`,children:X.map((e,t)=>(0,F.jsx)(`span`,{className:`cal-mini-weekday`,children:e},t))}),(0,F.jsx)(`div`,{className:`cal-mini-grid`,children:t.map(e=>{let t=e.getMonth()!==a,n=N(e,r),o=!t&&i.has(Z(e));return(0,F.jsxs)(`span`,{className:`cal-mini-day${t?` cal-mini-day-out`:``}${n?` cal-mini-day-today`:``}`,children:[e.getDate(),o&&(0,F.jsx)(`span`,{className:`cal-mini-dot`})]},e.toISOString())})})]},a)})})})}var re={meeting:`Meeting`,event:`Event`,task:`Task`};function ie(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ae(e){return new Date(e).toISOString()}function Q(e){return Math.floor(new Date(e).getTime()/6e4)}function oe(e){let t=new Date(e.startsAt);if(e.isAllDay)return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});let n=t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return e.endsAt?`${n} · ${r} – ${new Date(e.endsAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}`:`${n} · ${r}`}function se(e){if(!e)return null;let t=e.match(/filename="([^"]+)"/);return t?t[1]:null}function ce(e,t){return e.email??`${e.name??`unknown`}-${t}`}function le({a:e}){let t=e.name||e.email||`Unknown`,n=e.name&&e.email?e.email:null;return(0,F.jsxs)(`span`,{className:`cal-attendee-lines`,children:[(0,F.jsx)(`span`,{className:`cal-attendee-name`,children:t}),n&&(0,F.jsx)(`span`,{className:`cal-attendee-email`,children:n})]})}function ue({meeting:e,adminFetch:n,onClose:a,onSaved:o,onDeleted:s}){let u=e.kind===`meeting`,[d,f]=(0,w.useState)(!1),[p,h]=(0,w.useState)(!1),[g,v]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),[O,k]=(0,w.useState)(e),[A,ee]=(0,w.useState)(e.title??``),[j,M]=(0,w.useState)(ie(e.startsAt)),[N,P]=(0,w.useState)(e.endsAt?ie(e.endsAt):``),[I,L]=(0,w.useState)(e.location??``),[R,te]=(0,w.useState)(e.privateNote??``),[z,B]=(0,w.useState)(``),[V,H]=(0,w.useState)(``);(0,w.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!C&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C,a]);let U=(0,w.useCallback)(()=>{let e={},t=A.trim();t!==(O.title??``)&&(e.title=t);let n=ae(j);Q(n)!==Q(O.startsAt)&&(e.startsAt=n);let r=N?ae(N):null;(r===null?O.endsAt!==null:O.endsAt===null||Q(r)!==Q(O.endsAt))&&(e.endsAt=r);let i=I.trim()||null;i!==(O.location??null)&&(e.location=i);let a=R.trim()||null;return a!==(O.privateNote??null)&&(e.privateNote=a),e},[A,j,N,I,R,O]),W=(0,w.useCallback)(async()=>{let t=U();if(Object.keys(t).length===0){f(!1);return}T(!0),D(null);try{let r=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();k(i.meeting),o(i.meeting),f(!1)}catch(e){D(e instanceof Error?e.message:`Save failed`)}finally{T(!1)}},[n,U,e.meetingId,o]),G=(0,w.useCallback)(async()=>{let t=z.trim(),r=V.trim();if(!(!t&&!r)){T(!0),D(null);try{let i=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t||void 0,email:r||void 0})});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json();k(a.meeting),o(a.meeting),B(``),H(``)}catch(e){D(e instanceof Error?e.message:`Add failed`)}finally{T(!1)}}},[n,z,V,e.meetingId,o]),K=(0,w.useCallback)(async t=>{let r=t.email?{email:t.email}:{name:t.name};T(!0),D(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!t.ok)throw Error(`HTTP ${t.status}`);let i=await t.json();k(i.meeting),o(i.meeting)}catch(e){D(e instanceof Error?e.message:`Remove failed`)}finally{T(!1)}},[n,e.meetingId,o]),q=(0,w.useCallback)(async()=>{T(!0),D(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);s(e.meetingId)}catch(e){D(e instanceof Error?e.message:`Delete failed`),T(!1)}},[n,e.meetingId,s]),J=(0,w.useCallback)(async t=>{v(!1),T(!0),D(null);try{let r=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/ics?attendees=${t?`1`:`0`}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.blob(),a=se(r.headers.get(`content-disposition`))??`meeting.ics`,o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=a,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}catch(e){D(e instanceof Error?e.message:`Download failed`)}finally{T(!1)}},[n,e.meetingId]),Y=re[e.kind??`meeting`],X=z.trim().length>0||V.trim().length>0;return(0,F.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{C||a()},children:(0,F.jsxs)(`div`,{className:`cal-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":d?`Edit meeting`:`Meeting detail`,onClick:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,F.jsx)(`span`,{className:`cal-modal-kind`,children:Y}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:a,"aria-label":`Close`,autoFocus:!0,disabled:C,children:(0,F.jsx)(i,{size:16})})]}),!d&&(0,F.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,F.jsx)(`div`,{className:`cal-modal-title`,children:O.title??`Untitled`}),(0,F.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,F.jsx)(y,{size:14}),(0,F.jsx)(`span`,{children:oe(O)})]}),O.location&&(0,F.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,F.jsx)(b,{size:14}),(0,F.jsx)(`span`,{children:O.location})]}),O.attendees.length>0&&(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,F.jsx)(m,{size:14}),(0,F.jsx)(`div`,{className:`cal-modal-attendees`,children:O.attendees.map((e,t)=>(0,F.jsx)(`div`,{className:`cal-attendee-row`,children:(0,F.jsx)(le,{a:e})},ce(e,t)))})]}),O.privateNote&&(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,F.jsx)(x,{size:14}),(0,F.jsx)(`span`,{className:`cal-modal-note`,children:O.privateNote})]}),(0,F.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,F.jsx)(_,{size:14}),(0,F.jsx)(`span`,{children:Y})]})]}),d&&(0,F.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Title`}),(0,F.jsx)(`input`,{type:`text`,value:A,onChange:e=>ee(e.target.value),disabled:C})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Start`}),(0,F.jsx)(`input`,{type:`datetime-local`,value:j,onChange:e=>M(e.target.value),disabled:C})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`End`}),(0,F.jsx)(`input`,{type:`datetime-local`,value:N,onChange:e=>P(e.target.value),disabled:C})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Location`}),(0,F.jsx)(`input`,{type:`text`,value:I,onChange:e=>L(e.target.value),disabled:C})]}),(0,F.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Attendees`}),(0,F.jsxs)(`div`,{className:`cal-modal-attendees cal-modal-attendees-edit`,children:[O.attendees.length===0&&(0,F.jsx)(`div`,{className:`cal-attendee-empty`,children:`No attendees yet.`}),O.attendees.map((e,t)=>(0,F.jsxs)(`div`,{className:`cal-attendee-row cal-attendee-row-edit`,children:[(0,F.jsx)(le,{a:e}),(0,F.jsx)(`button`,{type:`button`,className:`cal-attendee-remove`,onClick:()=>K(e),disabled:C,"aria-label":`Remove ${e.name||e.email||`attendee`}`,children:(0,F.jsx)(i,{size:13})})]},ce(e,t)))]}),(0,F.jsxs)(`div`,{className:`cal-attendee-add`,children:[(0,F.jsx)(`input`,{type:`text`,placeholder:`Name`,value:z,onChange:e=>B(e.target.value),disabled:C,"aria-label":`Attendee name`}),(0,F.jsx)(`input`,{type:`email`,placeholder:`Email`,value:V,onChange:e=>H(e.target.value),disabled:C,"aria-label":`Attendee email`}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-attendee-add-btn`,onClick:G,disabled:C||!X,"aria-label":`Add attendee`,children:C?(0,F.jsx)(l,{size:13,className:`spin`}):(0,F.jsx)(S,{size:13})})]})]}),(0,F.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,F.jsx)(`span`,{children:`Private note`}),(0,F.jsx)(`textarea`,{className:`cal-modal-textarea`,value:R,onChange:e=>te(e.target.value),disabled:C,rows:3,placeholder:`Only you and your team can see this.`})]})]}),E&&(0,F.jsx)(`div`,{className:`cal-modal-error`,children:E}),u&&(0,F.jsxs)(`div`,{className:`cal-modal-actions`,children:[!d&&!p&&!g&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>f(!0),disabled:C,children:[(0,F.jsx)(t,{size:14}),` Edit`]}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>h(!0),disabled:C,children:[(0,F.jsx)(r,{size:14}),` Delete`]}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-download`,onClick:()=>{O.attendees.length>0?v(!0):J(!1)},disabled:C,children:[C?(0,F.jsx)(l,{size:14,className:`spin`}):(0,F.jsx)(c,{size:14}),` Download`]})]}),g&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Include attendees in the file?`}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:()=>J(!0),disabled:C,children:[C?(0,F.jsx)(l,{size:14,className:`spin`}):null,` Yes`]}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>J(!1),disabled:C,children:`No`}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>v(!1),disabled:C,children:`Cancel`})]}),d&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:W,disabled:C,children:[C?(0,F.jsx)(l,{size:14,className:`spin`}):null,` Save`]}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{f(!1),D(null)},disabled:C,children:`Cancel`})]}),p&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this meeting?`}),(0,F.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:q,disabled:C,children:[C?(0,F.jsx)(l,{size:14,className:`spin`}):null,` Delete`]}),(0,F.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>h(!1),disabled:C,children:`Cancel`})]})]})]})})}var $=`maxy-admin-session-key`,de=[`day`,`week`,`month`,`year`];function fe(e,t){switch(e){case`day`:return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`week`:{let{from:e,to:n}=j(`week`,t),r=new Date(n.getTime()-1);return`${e.toLocaleDateString([],{day:`numeric`,month:`short`})} – ${r.toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})}`}case`month`:return t.toLocaleDateString([],{month:`long`,year:`numeric`});case`year`:return String(t.getFullYear())}}function pe(){let[e,t]=(0,w.useState)(null),[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(void 0),[o,s]=(0,w.useState)(null),[c,u]=(0,w.useState)(void 0),[d,f]=(0,w.useState)(null),[m,_]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem($)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&s(e.sessionId??null),_(e.role??null),u(e.userName===void 0?null:e.userName),f(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let v=(0,w.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[y,b]=(0,w.useState)(!1),x=(0,w.useCallback)(async()=>{b(!0);try{let e=await g();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{b(!1)}},[]);return n?e?(0,F.jsx)(p,{cacheKey:e,surface:`calendar`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=calendar`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,F.jsx)(h,{cacheKey:e,businessName:i,sessionId:o,onLogout:v,onDisconnect:x,disconnecting:y,userName:c,userAvatar:d,role:m,children:(0,F.jsx)(me,{cacheKey:e})})}):(0,F.jsx)(`div`,{className:`cal-page`,children:(0,F.jsxs)(`div`,{className:`cal-empty`,children:[(0,F.jsx)(`p`,{children:`You are not signed in.`}),(0,F.jsxs)(`p`,{children:[`Open the `,(0,F.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,F.jsx)(`div`,{className:`cal-page`,children:(0,F.jsxs)(`div`,{className:`cal-loading`,children:[(0,F.jsx)(l,{size:18,className:`spin`}),` Loading…`]})})}function me({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:n}=s({initialCacheKey:e,surface:`calendar`}),[r,i]=(0,w.useState)(`month`),[o,c]=(0,w.useState)(()=>new Date),[d,f]=(0,w.useState)([]),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(null),[y,b]=(0,w.useState)(null),[x,S]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=!1;return t(`/api/admin/calendar/booking-link`).then(async t=>{if(e||!t.ok)return;let n=await t.json();typeof n.bookingDomain==`string`&&n.bookingDomain&&S(n.bookingDomain)}).catch(()=>{}),()=>{e=!0}},[t]),(0,w.useEffect)(()=>{let e=!1,{from:n,to:i}=j(r,o);return m(!0),g(null),t(`/api/admin/calendar/meetings?from=${encodeURIComponent(n.toISOString())}&to=${encodeURIComponent(i.toISOString())}`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(Array.isArray(n.meetings)?n.meetings:[])}).catch(t=>{e||(g(t instanceof Error?t.message:`Failed to load`),f([]))}).finally(()=>{e||m(!1)}),()=>{e=!0}},[r,o,n,t]);let C=(0,w.useCallback)(()=>c(new Date),[]),T=(0,w.useCallback)(()=>c(e=>M(r,e,-1)),[r]),E=(0,w.useCallback)(()=>c(e=>M(r,e,1)),[r]),D=(0,w.useCallback)(e=>{c(e),i(`month`)},[]);(0,w.useEffect)(()=>{b(null)},[r,o]);let O=(0,w.useCallback)(e=>{f(t=>t.map(t=>t.meetingId===e.meetingId?e:t)),b(e)},[]),k=(0,w.useCallback)(e=>{f(t=>t.filter(t=>t.meetingId!==e)),b(null)},[]);return(0,F.jsxs)(`div`,{className:`cal-page`,children:[(0,F.jsxs)(`header`,{className:`cal-header`,children:[(0,F.jsxs)(`div`,{className:`cal-title`,children:[(0,F.jsx)(_,{size:20}),` Calendar`]}),(0,F.jsxs)(`div`,{className:`cal-nav`,children:[(0,F.jsx)(`button`,{type:`button`,className:`cal-today-btn`,onClick:C,children:`Today`}),(0,F.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:T,"aria-label":`Previous`,children:(0,F.jsx)(u,{size:18})}),(0,F.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:E,"aria-label":`Next`,children:(0,F.jsx)(v,{size:18})}),(0,F.jsx)(`span`,{className:`cal-range-label`,children:fe(r,o)}),p&&(0,F.jsx)(l,{size:16,className:`spin`})]}),(0,F.jsx)(`div`,{className:`cal-views`,children:de.map(e=>(0,F.jsx)(`button`,{type:`button`,className:`cal-view-btn${e===r?` cal-view-btn-active`:``}`,onClick:()=>i(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),x&&(0,F.jsxs)(`a`,{className:`cal-booking-link`,href:`https://${x}`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,F.jsx)(a,{size:14}),` Booking page`]})]}),(0,F.jsxs)(`div`,{className:`cal-body`,children:[h&&(0,F.jsxs)(`div`,{className:`cal-error`,children:[`Could not load the calendar: `,h]}),r===`day`&&(0,F.jsx)(Y,{anchor:o,meetings:d,onSelect:b}),r===`week`&&(0,F.jsx)(K,{anchor:o,meetings:d,onSelect:b}),r===`month`&&(0,F.jsx)(te,{anchor:o,meetings:d,onSelect:b}),r===`year`&&(0,F.jsx)(ne,{anchor:o,meetings:d,onPickMonth:D})]}),y&&(0,F.jsx)(ue,{meeting:y,adminFetch:t,onClose:()=>b(null),onSaved:O,onDeleted:k})]})}(0,C.createRoot)(document.getElementById(`root`)).render((0,F.jsx)(pe,{}));
@@ -0,0 +1 @@
1
+ import{T as e,U as t}from"./OperatorConversations-Cf-ejiJO.js";import"./admin-types-DJoj6VJv.js";import"./AdminShell-BA24dbW1.js";import{n}from"./page-6HQSRX5P.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CAM3fms7.js";import{A as t,B as n,D as r,E as i,G as a,H as o,I as s,L as c,M as l,O as ee,P as te,T as u,U as d,f,k as ne,m as p,p as re,t as ie,v as ae,y as m}from"./OperatorConversations-Cf-ejiJO.js";import{i as oe,t as se}from"./graph-labels-DdiX7_Ot.js";var ce=n(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),le=n(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ue=n(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),de=n(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),fe=n(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),pe=n(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),me=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),h=d(),g=e(a(),1);function he(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||se.has(e)&&(t.add(e),n.push(e)));return n}var _=u(),ge=/\.(png|jpe?g|gif|webp|svg)$/i;function _e(e){return ge.test(e)}var ve=`maxy-data-view`,ye=95*1024*1024,be=48*1024*1024;function xe(){return typeof window>`u`?`list`:window.localStorage.getItem(ve)===`grid`?`grid`:`list`}function Se(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,_.jsx)(m,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,_.jsx)(`div`,{className:`data-page data-page-full`,children:(0,_.jsx)(Ce,{cacheKey:e})})}):(0,_.jsx)(`div`,{className:`data-page`,children:(0,_.jsxs)(`div`,{className:`data-empty`,children:[(0,_.jsx)(`p`,{children:`You are not signed in.`}),(0,_.jsxs)(`p`,{children:[`Open the `,(0,_.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,_.jsx)(`div`,{className:`data-page`,children:(0,_.jsxs)(`div`,{className:`data-loading`,children:[(0,_.jsx)(l,{size:18,className:`spin`}),` Loading…`]})})}function Ce({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=o({initialCacheKey:e,surface:`data`});return(0,_.jsx)(b,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function we(){if(typeof window>`u`)return`.`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`.`}function Te(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function v(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function y(e){return new Promise((t,n)=>e.file(t,n))}async function Ee(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await y(r),relpath:e});else if(r.isDirectory){let t=await v(r.createReader());n.push(...await Ee(t,e))}}return n}function De(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function b({adminFetch:e,cacheKey:n,sessionRefetchNonce:a}){let[o,u]=(0,g.useState)(``),d=(0,g.useRef)(null),[m,se]=(0,g.useState)(``),[h,ge]=(0,g.useState)(null),[Se,Ce]=(0,g.useState)(`hybrid`),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[S,Ae]=(0,g.useState)(null),[Ne,Pe]=(0,g.useState)(0),[C,Fe]=(0,g.useState)(!1),[w,Ie]=(0,g.useState)(()=>we()),[T,Le]=(0,g.useState)(null),[E,Re]=(0,g.useState)(()=>xe()),[D,ze]=(0,g.useState)(null),[O,Be]=(0,g.useState)([]),[k,Ve]=(0,g.useState)(!1),[He,Ue]=(0,g.useState)(null),[We,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(null),[Ge,N]=(0,g.useState)(null),[Ke,qe]=(0,g.useState)(null),[Je,Ye]=(0,g.useState)(!1),[Xe,Ze]=(0,g.useState)(null),P=(0,g.useRef)(null),[Qe,F]=(0,g.useState)(0),[$e,I]=(0,g.useState)(!1),[et,tt]=(0,g.useState)(``),[L,R]=(0,g.useState)(null),[nt,rt]=(0,g.useState)(``),[it,z]=(0,g.useState)(null),B=(()=>{let e=w===`.`?[]:w.split(`/`).filter(Boolean);return e.length>=2&&e[0]===`accounts`})();(0,g.useEffect)(()=>{console.info(`[data-ui] op=mount header=operator home=absent`)},[]);let at=(0,g.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),ot=(0,g.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[V,st]=(0,g.useState)([]),[ct,lt]=(0,g.useState)(`files`);(0,g.useEffect)(()=>{if(!n)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(n)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||st(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[n]);let ut=(0,g.useMemo)(()=>[...new Set(V.map(e=>e.channel))],[V]),[H,dt]=(0,g.useState)(!1),ft=(0,g.useRef)(null),[pt,U]=(0,g.useState)(!1),mt=(0,g.useRef)(null);(0,g.useEffect)(()=>{let e=o.trim();if(!e){se(``),ge(null),x(null);return}Fe(!1);let t=setTimeout(()=>se(e),300);return()=>clearTimeout(t)},[o]),(0,g.useEffect)(()=>{if(!m){y(!1);return}let t=!1;return y(!0),x(null),e(`/api/admin/graph-search?q=${encodeURIComponent(m)}&labels=FileArtifact&limit=20${C?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ge(e.results),Ce(e.mode??`hybrid`),Pe(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||x(e instanceof Error?e.message:String(e))}).finally(()=>{t||y(!1)}),()=>{t=!0}},[m,e,a,C]);let ht=(0,g.useMemo)(()=>h?he(h):[],[h]),W=S&&ht.includes(S)?S:null,gt=(0,g.useMemo)(()=>h?W?h.filter(e=>e.labels.includes(W)):h:null,[h,W]),_t=(0,g.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[n]);(0,g.useEffect)(()=>{if(!h)return;let e=h.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[h]),(0,g.useEffect)(()=>{let t=!1;return Ve(!0),Ue(null),e(`/api/admin/files?path=${encodeURIComponent(w===`.`?``:w)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(Le(e.entries),Be(e.displayPath??[]))}).catch(e=>{t||(Le([]),Be([]),Ue(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Ve(!1)}),()=>{t=!0}},[e,w,Qe,a]),(0,g.useEffect)(()=>{Te(w)},[w]);let vt=(0,g.useCallback)(()=>{F(e=>e+1)},[]),G=(0,g.useCallback)(e=>{dt(!1),Ie(e)},[]),yt=(0,g.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);console.log(`[data-search] op=locate nodeId=${e.nodeId} folder=${r}`),u(``),x(null),Ae(null),G(r)},[G]),bt=(0,g.useCallback)(()=>{if(w===`.`||w===``)return;let e=w.split(`/`).filter(Boolean);e.pop(),Ie(e.length===0?`.`:e.join(`/`))},[w]),xt=(0,g.useCallback)(e=>{re(n,w===`.`?e.name:`${w}/${e.name}`)},[w,n]),[K,St]=(0,g.useState)(!1),[q,Ct]=(0,g.useState)(new Set),wt=(0,g.useRef)(null),J=(0,g.useRef)(!1),Y=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,Tt=(0,g.useCallback)(e=>{St(!0),Ct(new Set([e])),console.info(`[data-ui] op=select-enter count=1`)},[]),X=(0,g.useCallback)(e=>{St(!1),Ct(new Set),console.info(`[data-ui] op=select-exit reason=${e}`)},[]),Z=(0,g.useCallback)(e=>{Ct(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Et=(0,g.useCallback)(e=>{J.current=!1,wt.current=setTimeout(()=>{J.current=!0,Tt(e)},500)},[Tt]),Q=(0,g.useCallback)(()=>{wt.current&&=(clearTimeout(wt.current),null)},[]),Dt=(0,g.useCallback)(e=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}xt(e)},[K,Z,xt]),Ot=(0,g.useCallback)(e=>{Re(e),typeof window<`u`&&window.localStorage.setItem(ve,e),console.info(`[data] op=view-mode mode=${e}`)},[]),kt=(0,g.useCallback)(e=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}ze({src:f(n,w===`.`?e.name:`${w}/${e.name}`),alt:e.displayName??e.name})},[K,Z,w,n]),At=(0,g.useCallback)(()=>(T??[]).filter(e=>e.kind===`file`&&q.has(e.name)),[T,q]),jt=(0,g.useCallback)(()=>(T??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&q.has(e.name)),[T,q]),Mt=(0,g.useCallback)(()=>{let e=jt(),t=e.some(e=>e.kind===`directory`);e.length===1&&!t?xt(e[0]):e.length>=1&&p(n,e.map(e=>w===`.`?e.name:`${w}/${e.name}`)),X(`action`)},[jt,xt,w,n,X]),Nt=(0,g.useCallback)(async()=>{let t=At(),n=t.filter(e=>!e.protected),r=t.length-n.length;Ze(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=w===`.`?t.name:`${w}/${t.name}`;try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){Ze(e instanceof Error?e.message:String(e))}}F(e=>e+1),X(`action`)},[At,w,e,X]),Pt=(0,g.useCallback)(async()=>{let e=At();if(console.info(`[data-ui] op=share supported=${Y} count=${e.length}`),Y)try{let t=await Promise.all(e.map(async e=>{let t=w===`.`?e.name:`${w}/${e.name}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=await(await fetch(r)).blob();return new File([i],e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:t})&&await navigator.share({files:t})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[At,Y,w,n]),Ft=(0,g.useCallback)(()=>{P.current?.click()},[]),It=(0,g.useCallback)((e,t={})=>{let r=(r,i,a)=>{let o=new URLSearchParams({session_key:n,path:w===`.`?``:w,filename:e.name});t.relpath&&o.set(`relpath`,t.relpath),t.token&&o.set(`token`,t.token);for(let[e,t]of Object.entries(i))o.set(e,t);return new Promise(t=>{let n=new XMLHttpRequest;n.open(`POST`,`/api/admin/files/upload?${o.toString()}`),n.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),a&&(n.upload.onprogress=e=>{e.lengthComputable&&a(e.loaded)}),n.onload=()=>{let e={};try{e=JSON.parse(n.responseText)}catch{}t({status:n.status,data:e})},n.onerror=()=>t({status:0,data:{}}),n.onabort=()=>t({status:0,data:{error:`aborted`}}),n.send(r)})};if(e.size<=ye)return r(e,{},n=>t.onProgress?.(n,e.size));let i=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,a=Math.ceil(e.size/be);return(async()=>{let n={status:0,data:{}};for(let o=0;o<a;o++){let s=o*be;if(n=await r(e.slice(s,Math.min(s+be,e.size)),{uploadId:i,seq:String(o),total:String(a)},n=>t.onProgress?.(s+n,e.size)),!(n.status>=200&&n.status<300))return n}return n})()},[n,w]),Lt=(0,g.useCallback)(async e=>{N(null),A(!0),M({loaded:0,total:e.size});try{let{status:t,data:n}=await It(e,{onProgress:(e,t)=>M({loaded:e,total:t})});t>=200&&t<300&&n.path?(Ie(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),F(e=>e+1)):N(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{A(!1),M(null),P.current&&(P.current.value=``)}},[It]),Rt=(0,g.useCallback)(e=>{B&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Ye(!0))},[B]),zt=(0,g.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Ye(!1)},[]),Bt=(0,g.useCallback)(async e=>{e.preventDefault(),Ye(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(console.info(`[data-ui] op=drop-received token=${t} items=${n.length}`),n.length===0)return;if(!B){console.info(`[data-ui] op=drop-rejected token=${t} reason=no-write`),N(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);A(!0),N(null),qe(null);let i=performance.now();try{let e=await Ee(r),n=e.reduce((e,t)=>e+t.file.size,0),a=new Set(e.map(e=>e.relpath.split(`/`).slice(0,-1).join(`/`)).filter(Boolean)).size;console.info(`[data-ui] op=drop-walk token=${t} files=${e.length} dirs=${a} bytes=${n}`);let o=0,s=[];for(let n=0;n<e.length;n++){let{file:r,relpath:i}=e[n];console.info(`[data-ui] op=drop-file token=${t} rel="${i}" i=${n+1}/${e.length}`),M({loaded:0,total:r.size});let{status:a,data:c}=await It(r,{relpath:i,token:t,onProgress:(e,t)=>M({loaded:e,total:t})});if(a>=200&&a<300)o++,console.info(`[data-ui] op=drop-file-ok token=${t} rel="${i}"`);else{let e=a===0?`http=0`:De(a,c.error);s.push(`${i} (${e})`),console.info(`[data-ui] op=drop-file-skip token=${t} rel="${i}" reason=${e}`)}}let c=Math.round(performance.now()-i);console.info(`[data-ui] op=drop-done token=${t} uploaded=${o} skipped=${s.length} ms=${c}`),qe(`Uploaded ${o}, skipped ${s.length}${s.length?`: ${s.join(`, `)}`:``}`),F(e=>e+1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1),M(null)}},[B,It]),Vt=(0,g.useCallback)(async()=>{let t=et.trim();if(t){z(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:w===`.`?``:w,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);I(!1),tt(``),F(e=>e+1)}catch(e){z(e instanceof Error?e.message:String(e))}}},[e,et,w]),Ht=(0,g.useCallback)(async()=>{if(!L)return;let t=nt.trim();if(!t)return;z(null);let n=w===`.`?L:`${w}/${L}`;try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);R(null),rt(``),X(`action`),F(e=>e+1)}catch(e){z(e instanceof Error?e.message:String(e))}},[e,nt,L,w,X]);(0,g.useEffect)(()=>{if(!H)return;let e=e=>{ft.current&&!ft.current.contains(e.target)&&dt(!1)},t=e=>{e.key===`Escape`&&dt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[H]),(0,g.useEffect)(()=>{if(!pt)return;let e=e=>{mt.current&&!mt.current.contains(e.target)&&U(!1)},t=e=>{e.key===`Escape`&&U(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[pt]);let $=(0,g.useCallback)(e=>O.slice(0,e+1).map(e=>e.name).join(`/`),[O]),Ut=O.length>=2,Wt=Ut?[{name:`.`,label:`data`},...O.slice(0,O.length-2).map((e,t)=>({name:$(t),label:e.displayName??e.name}))]:[];return(0,_.jsxs)(`main`,{className:`data-main`,children:[(0,_.jsx)(ae,{variant:`operator`,onNavigate:ot,conversationsCount:V.length,conversationsChannels:ut,onOpenConversations:()=>lt(`conversations`),onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:at,onDisconnect:async()=>!0,disconnecting:!1}),ct===`conversations`?(0,_.jsx)(ie,{conversations:V,sessionKey:n,onBack:()=>lt(`files`)}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`data-toolbar`,children:[K?(0,_.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>X(`cancel`),"aria-label":`Cancel selection`,children:[(0,_.jsx)(i,{size:14}),` Cancel`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`data-search-input`,children:[o===``&&(0,_.jsx)(oe,{size:14}),(0,_.jsx)(`input`,{ref:d,type:`text`,value:o,onChange:e=>u(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),v&&(0,_.jsx)(l,{size:14,className:`spin`}),o!==``&&(0,_.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{u(``),d.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,_.jsx)(i,{size:14})})]}),(0,_.jsxs)(`div`,{className:`data-toolbar-actions`,ref:mt,children:[(0,_.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>U(e=>!e),"aria-haspopup":`menu`,"aria-expanded":pt,"aria-label":`File actions`,title:`File actions`,children:(0,_.jsx)(s,{size:16})}),(0,_.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":pt?`true`:void 0,children:[(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{vt(),U(!1)},disabled:k,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[k?(0,_.jsx)(l,{size:16,className:`spin`}):(0,_.jsx)(ne,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ft(),U(!1)},disabled:We||!B,title:B?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[We?j&&j.total>0?(0,_.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(j.loaded/j.total*100),`%`]}):(0,_.jsx)(l,{size:16,className:`spin`}):(0,_.jsx)(me,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{I(e=>!e),tt(``),z(null),U(!1)},disabled:We||!B,title:B?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,_.jsx)(le,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ot(E===`grid`?`list`:`grid`),U(!1)},title:E===`grid`?`List view`:`Grid view`,"aria-label":E===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":E===`grid`,children:[E===`grid`?(0,_.jsx)(fe,{size:16}):(0,_.jsx)(de,{size:16}),(0,_.jsx)(`span`,{className:`data-action-label`,children:E===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,_.jsxs)(`div`,{className:`data-breadcrumbs`,children:[w!==`.`&&(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:bt,title:`Up one level`,"aria-label":`Up one level`,children:(0,_.jsx)(ce,{size:14})}),Ut?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,ref:ft,children:[(0,_.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>dt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":H,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),H&&(0,_.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Wt.map(e=>(0,_.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>G(e.name),title:e.label,children:e.label},e.name))})]}),[O.length-2,O.length-1].map(e=>{let t=O[e];return(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,_.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G($(e)),title:t.name,children:t.displayName??t.name})]},$(e))})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G(`.`),children:`data`}),O.map((e,t)=>(0,_.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,_.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,_.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G($(t)),title:e.name,children:e.displayName??e.name})]},$(t)))]})]}),$e&&(0,_.jsxs)(`div`,{className:`data-inline-form`,children:[(0,_.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:et,autoFocus:!0,onChange:e=>tt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Vt(),e.key===`Escape`&&I(!1)}}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Vt,children:`Create`}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>I(!1),children:`Cancel`})]}),L&&(0,_.jsxs)(`div`,{className:`data-inline-form`,children:[(0,_.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:nt,autoFocus:!0,onChange:e=>rt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ht(),e.key===`Escape`&&R(null)}}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Ht,children:`Rename`}),(0,_.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>R(null),children:`Cancel`})]}),it&&(0,_.jsx)(`div`,{className:`data-error`,children:it}),(0,_.jsx)(`input`,{type:`file`,ref:P,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Lt(t)}})]}),(0,_.jsxs)(`div`,{className:`data-body`,"data-drag-active":Je?`true`:void 0,onDragEnter:Rt,onDragOver:Rt,onDragLeave:zt,onDrop:Bt,children:[(b!==null||h!==null)&&(0,_.jsxs)(`section`,{className:`data-panel`,children:[b&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,b]}),ht.length>0&&(0,_.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:ht.map(e=>{let t=e===W;return(0,_.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>Ae(t?null:e),children:ke([e])??e},e)})}),h&&!v&&(0,_.jsxs)(`div`,{className:`data-results-meta`,children:[gt.length,` of `,h.length,` result`,h.length===1?``:`s`]}),h&&!v&&!W&&Ne>0&&!C&&(0,_.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Fe(!0),children:[Ne,` low-confidence result`,Ne===1?``:`s`,` hidden — show all`]}),h&&!v&&!W&&C&&(0,_.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Fe(!1),children:`Showing all results — hide low-confidence`}),h&&h.length===0&&!v&&(0,_.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),gt&&gt.length>0&&(0,_.jsx)(`ul`,{className:`data-results`,children:gt.map(e=>(0,_.jsx)(Oe,{hit:e,mode:Se,onDownload:_t,onLocate:yt},e.nodeId))})]}),(0,_.jsxs)(`section`,{className:`data-panel`,children:[j&&(0,_.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":j.total>0?Math.round(j.loaded/j.total*100):void 0,children:[(0,_.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,_.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${j.total>0?Math.round(j.loaded/j.total*100):0}%`}})}),(0,_.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,j.total>0?`${Math.round(j.loaded/j.total*100)}%`:``]})]}),Ge&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,Ge]}),Ke&&(0,_.jsx)(`div`,{className:`data-status`,children:Ke}),Xe&&(0,_.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Xe]}),He&&(0,_.jsx)(`div`,{className:`data-error`,children:He}),k&&(0,_.jsxs)(`div`,{className:`data-loading`,children:[(0,_.jsx)(l,{size:14,className:`spin`}),` Loading…`]}),!K&&!k&&T&&T.length>0&&(0,_.jsxs)(`div`,{className:`data-select-hint`,children:[(0,_.jsx)(pe,{size:13}),(0,_.jsx)(`span`,{children:`Press and hold a file to select, rename, or delete it.`})]}),!k&&T&&T.length===0&&!He&&(0,_.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!k&&T&&T.length>0&&E===`grid`&&(0,_.jsx)(`ul`,{className:`data-grid`,children:T.map(e=>{let t=e.displayName??e.name,r=K&&q.has(e.name);if(e.kind===`directory`)return(0,_.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Et(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}G(w===`.`?e.name:`${w}/${e.name}`)},children:[K&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsx)(ue,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t})]})},e.name);if(e.kind===`file`){let i=_e(e.name),a=w===`.`?e.name:`${w}/${e.name}`;return(0,_.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Et(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>i?kt(e):Dt(e),title:K?void 0:i?`Preview ${t}`:`Download ${t}`,children:[K&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,_.jsx)(`img`,{className:`data-grid-thumb`,src:f(n,a),alt:t,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,_.jsx)(te,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t}),!i&&(0,_.jsx)(`span`,{className:`data-grid-sub`,children:je(e.sizeBytes)})]})},e.name)}return(0,_.jsx)(`li`,{className:`data-grid-cell`,children:(0,_.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,_.jsx)(te,{size:28,className:`data-grid-glyph`}),(0,_.jsx)(`span`,{className:`data-grid-label`,children:t}),(0,_.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!k&&T&&T.length>0&&E===`list`&&(0,_.jsx)(`ul`,{className:`data-entries`,children:T.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=K&&q.has(e.name);return(0,_.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Et(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}G(w===`.`?e.name:`${w}/${e.name}`)},children:[K&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsx)(ue,{size:14}),(0,_.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=K&&q.has(e.name);return(0,_.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,_.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Et(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>Dt(e),title:K?void 0:`Download ${t}`,children:[K&&(0,_.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,_.jsxs)(`span`,{className:`data-entry-text`,children:[(0,_.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,_.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Me(e.modifiedAt)}`,children:[je(e.sizeBytes),` · `,Me(e.modifiedAt)]})]})]})},e.name)}return(0,_.jsx)(`li`,{className:`data-entry`,children:(0,_.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,_.jsxs)(`span`,{className:`data-entry-text`,children:[(0,_.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,_.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]}),K&&(0,_.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,_.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Pt,disabled:!Y||q.size===0,title:Y?`Share selected files`:`Sharing is not supported on this device`,children:[(0,_.jsx)(ee,{size:16}),` Share`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Mt,disabled:q.size===0,children:[(0,_.jsx)(c,{size:16}),` Download`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=[...q][0];e&&(R(e),rt(e))},disabled:q.size!==1,children:[(0,_.jsx)(t,{size:16}),` Rename`]}),(0,_.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Nt,disabled:q.size===0,children:[(0,_.jsx)(r,{size:16}),` Delete`]})]})})]}),D&&(0,_.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":D.alt,onClick:()=>ze(null),children:(0,_.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:D.src,alt:D.alt})})]})}function Oe({hit:e,mode:t,onDownload:n,onLocate:r}){let i=x(e.properties),a=S(e.properties),o=ke(e.labels),s=Ae(e.properties),[c,l]=(0,g.useState)(!1),ee=a&&a.length>280,te=c||!ee?a:a?.slice(0,280)+`…`,u=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,d=e.properties.relativePath,f=typeof d==`string`&&d.length>0,ne=f?d.lastIndexOf(`/`):-1,p=f?ne===-1?`data`:d.slice(0,ne):null;return(0,_.jsxs)(`li`,{className:`data-result`,children:[(0,_.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${i??o??`file`}`,children:[o&&(0,_.jsx)(`div`,{className:`data-result-header`,children:(0,_.jsx)(`span`,{className:`data-result-labels`,children:o})}),i&&(0,_.jsx)(`div`,{className:`data-result-title`,children:i}),a&&(0,_.jsx)(`pre`,{className:`data-result-body`,children:te}),(0,_.jsxs)(`div`,{className:`data-result-scores`,children:[s&&(0,_.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Me(s),` · `]}),u]})]}),f&&(0,_.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${p}`,"aria-label":`Locate in ${p}`,children:[(0,_.jsx)(ue,{size:12}),p]}),ee&&(0,_.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>l(e=>!e),children:c?`Show less`:`Show more`})]})}function ke(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function x(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function S(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ae(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function je(e){return e==null?``: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(1)} GB`}function Me(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}(0,h.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(Se,{}));