@rubytech/create-maxy-code 0.1.498 → 0.1.500
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/package.json +1 -1
- package/payload/platform/lib/active-rules/dist/index.d.ts +3 -7
- package/payload/platform/lib/active-rules/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/active-rules/dist/index.js +20 -52
- package/payload/platform/lib/active-rules/dist/index.js.map +1 -1
- package/payload/platform/lib/active-rules/src/index.test.ts +35 -69
- package/payload/platform/lib/active-rules/src/index.ts +17 -58
- package/payload/platform/plugins/admin/PLUGIN.md +1 -1
- package/payload/platform/plugins/admin/hooks/__tests__/admin-authoring-observer.test.sh +135 -0
- package/payload/platform/plugins/admin/hooks/__tests__/prompt-optimiser-directive.test.sh +11 -2
- package/payload/platform/plugins/admin/hooks/prompt-optimiser-directive.sh +6 -3
- package/payload/platform/plugins/admin/mcp/dist/index.js +52 -107
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.d.ts +8 -4
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.d.ts.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js +67 -50
- package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/store-skill-core.d.ts +33 -0
- package/payload/platform/plugins/admin/mcp/dist/store-skill-core.d.ts.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/store-skill-core.js +122 -0
- package/payload/platform/plugins/admin/mcp/dist/store-skill-core.js.map +1 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +11 -5
- package/payload/platform/plugins/contacts/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/contacts/PLUGIN.md +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/index.js +3 -12
- package/payload/platform/plugins/contacts/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/contact-lookup.test.js +105 -2
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/contact-lookup.test.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.d.ts +11 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.js +56 -4
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.js.map +1 -1
- package/payload/platform/plugins/docs/references/contacts-guide.md +2 -0
- package/payload/platform/plugins/docs/references/internals.md +2 -2
- package/payload/platform/plugins/docs/references/outlook-guide.md +4 -0
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -2
- package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js +53 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js +50 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/compose.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/compose.js +15 -2
- package/payload/platform/plugins/email/mcp/dist/lib/compose.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts +29 -0
- package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/signature.js +55 -0
- package/payload/platform/plugins/email/mcp/dist/lib/signature.js.map +1 -0
- package/payload/platform/plugins/email/references/email-reference.md +10 -0
- package/payload/platform/plugins/email/skills/email-composition/SKILL.md +9 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js +10 -9
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js.map +1 -1
- package/payload/platform/plugins/memory/skills/conversational-memory/SKILL.md +2 -0
- package/payload/platform/plugins/memory/skills/preference-audit/SKILL.md +16 -0
- package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +6 -0
- package/payload/platform/plugins/prompt-optimiser/skills/prompt-optimiser/SKILL.md +1 -1
- package/payload/platform/plugins/prompt-optimiser/skills/prompt-optimiser/__tests__/restatement-ladder.test.sh +2 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +26 -1
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts +19 -19
- package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js +28 -34
- package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts +15 -0
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js +61 -0
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/server/public/assets/{AdminLoginScreens-Ce5aBBWF.js → AdminLoginScreens-CKg_Dlpv.js} +1 -1
- package/payload/server/public/assets/{admin-BWb8me-E.js → admin-wtSUU5N0.js} +1 -1
- package/payload/server/public/assets/chat-DRuIxGtE.js +1 -0
- package/payload/server/public/assets/data-BdZCvyvN.js +1 -0
- package/payload/server/public/assets/{operator-icJwMkZF.js → operator-DglDYmdV.js} +1 -1
- package/payload/server/public/assets/{page-iG57nKOg.js → page-C-5sTAE-.js} +2 -2
- package/payload/server/public/assets/{page-DUgrGrJp.js → page-C8G5p4jr.js} +1 -1
- package/payload/server/public/assets/{public-CkOumzpf.js → public-DqJjXR4p.js} +1 -1
- package/payload/server/public/assets/{useVoiceRecorder-Cu6zvuFx.js → useVoiceRecorder-Cj-VZDKO.js} +1 -1
- package/payload/server/public/chat.html +3 -3
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/public/operator.html +4 -4
- package/payload/server/public/public.html +3 -3
- package/payload/server/server.js +89 -63
- package/payload/server/public/assets/chat-qtOiJX-Y.js +0 -1
- package/payload/server/public/assets/data-BjqC4hyM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-fQC6bEKA.js";import{A as t,B as n,F as r,G as i,H as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,g as m,i as h,p as g,s as _,t as v,u as y,v as ee,x as te,y as ne}from"./useSubAccountSwitcher-Bc7XHr0L.js";import{C as b,E as x,S as re,T as S,n as ie,r as ae,s as C,x as oe}from"./useVoiceRecorder-Cu6zvuFx.js";import{t as w}from"./chevron-left-BzIg4in6.js";import{i as T,t as E}from"./graph-labels-DykmXYHA.js";import{t as D}from"./triangle-alert-DumCWC08.js";var se=r(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ce=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),le=r(`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=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),de=r(`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=r(`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=r(`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`}]]),O=r(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),me=r(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),he=r(`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`}]]),k=r(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),A=e(i(),1);function ge(){let[e,t]=(0,A.useState)([]),[n,r]=(0,A.useState)(!1),[i,a]=(0,A.useState)(null),o=(0,A.useRef)(null),s=(0,A.useCallback)(e=>{a(null);let n=e.find(e=>!ae(e.type,x));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>S);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,A.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,A.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,A.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,A.useCallback)(()=>{r(!1)},[]),onDrop:(0,A.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var j=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function _e(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var M=n();function N({onSelect:e}){return(0,M.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:j.map((t,n)=>(0,M.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function ve({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,A.useState)(``),[a,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(!1),f=(0,A.useCallback)(t=>{d(!0),l(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{s(e),i(e.path===`.`?``:e.path)}).catch(e=>l(e instanceof Error?e.message:String(e))).finally(()=>d(!1))},[e]);(0,A.useEffect)(()=>{f(``)},[f]);let p=e=>f(r?`${r}/${e}`:e),h=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),f(e.join(`/`))},g=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,M.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,M.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,M.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:h,"aria-label":`Up one folder`,children:(0,M.jsx)(w,{size:18})}),(0,M.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,M.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,M.jsx)(m,{size:18})})]}),c&&(0,M.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:c}),u&&(0,M.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!u&&(0,M.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,M.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,M.jsx)(`li`,{children:e.kind===`directory`?(0,M.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>p(e.name),children:[(0,M.jsx)(o,{size:16,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,M.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>g(e),children:[(0,M.jsx)(re,{size:16,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}function ye(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function P({accountId:e,remoteJid:t,sessionKey:n,replyTo:r,onClearReply:i}){let[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(!1),[y,ne]=(0,A.useState)([]),x=(0,A.useRef)(null),{pendingFiles:S,attachError:ae,addFiles:C,removeFile:w,clearFiles:T}=ge(),{state:E,elapsedSeconds:D,errorMessage:se,start:ce,send:le,discard:de}=ie(),fe=E===`recording`||E===`paused`,pe=(0,A.useCallback)(()=>{console.info(`[operator-ui] op=voice-record state=start ms=0`),ce()},[ce]),he=(0,A.useCallback)(async()=>{let e=D*1e3,t=await le();if(console.info(`[operator-ui] op=voice-record state=stop ms=${e}`),t){let e=t.type===`audio/ogg`?`.ogg`:t.type===`audio/mp4`?`.m4a`:`.webm`;C([new File([t],`voice-note${e}`,{type:t.type})])}},[D,le,C]),k=(0,A.useCallback)(()=>{console.info(`[operator-ui] op=voice-record state=cancel ms=${D*1e3}`),de()},[D,de]),j=(0,A.useRef)(!1),P=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[F,be]=(0,A.useState)(null),[xe,Se]=(0,A.useState)(null),I=(0,A.useRef)(null),L=(0,A.useRef)(44),R=(0,A.useCallback)(e=>{let t=I.current;if(!t)return;t.moved=!0;let n=Math.min(P(),Math.max(44,t.startH+(t.startY-e.clientY)));L.current=n,be(n)},[]),z=(0,A.useCallback)(()=>{let e=I.current?.moved??!1;I.current=null,window.removeEventListener(`pointermove`,R),window.removeEventListener(`pointerup`,z),e&&console.info(`[operator-ui] op=wa-composer-resize mode=drag h=${L.current}`)},[R]),Ce=(0,A.useCallback)(e=>{I.current={startY:e.clientY,startH:x.current?.offsetHeight??44,moved:!1},window.addEventListener(`pointermove`,R),window.addEventListener(`pointerup`,z),e.preventDefault()},[R,z]),B=(0,A.useCallback)(e=>{let t=F??x.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(P(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&(be(n),console.info(`[operator-ui] op=wa-composer-resize mode=key h=${n}`))},[F]),we=(0,A.useRef)(``);(0,A.useEffect)(()=>{let e=x.current;if(!e)return;let t=we.current!==``&&a===``;if(we.current=a,F!==null){t&&be(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(P(),Math.max(44,e.scrollHeight));e.style.height=n,Se(r)},[a,F]);let Te=(a.trim().length>0||S.length>0||y.length>0)&&!s,V=(0,A.useCallback)(async()=>{if(!j.current&&!(a.trim().length===0&&S.length===0&&y.length===0)){j.current=!0,c(!0),d(null);try{let s=`/api/whatsapp-reader/reply?session_key=${encodeURIComponent(n)}`,c;if(S.length>0||y.length>0){let n=new FormData;n.append(`accountId`,e),n.append(`remoteJid`,t),a.trim()&&n.append(`text`,a);for(let e of S)n.append(`files`,e);for(let e of y)n.append(`fileRefs`,e.path);r&&n.append(`quotedId`,r.msgKeyId),c=await fetch(s,{method:`POST`,body:n})}else c=await fetch(s,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({accountId:e,remoteJid:t,text:a,...r?{quotedId:r.msgKeyId}:{}})});let l=await c.json().catch(()=>({}));if(!c.ok){d(l.error??`Send failed.`),console.info(`[operator-ui] op=reply-fail remoteJid=${t} error=${l.error??`unknown`}`);return}o(``),T(),ne([]),i?.(),console.info(`[operator-ui] op=reply-sent remoteJid=${t} sent=${l.sent??0}`)}catch(e){d(`Could not reach the server. Try again.`),console.info(`[operator-ui] op=reply-fail remoteJid=${t} error=${String(e)}`)}finally{j.current=!1,c(!1)}}},[a,S,y,r,i,e,t,n,T]),Ee=(0,A.useCallback)(e=>{let t=x.current,{value:n,caret:r}=_e(a,e,t?t.selectionStart:null,t?t.selectionEnd:null);o(n),p(!1),requestAnimationFrame(()=>{let e=x.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[a]),De=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Te&&V())},H=e=>e.dataTransfer.types.includes(`Files`),Oe=(0,A.useCallback)(e=>{H(e)&&(e.preventDefault(),v(!0))},[]),ke=(0,A.useCallback)(()=>v(!1),[]),Ae=(0,A.useCallback)(e=>{if(!H(e))return;e.preventDefault(),v(!1);let t=[...e.dataTransfer.files];if(t.length===0)return;let n=Math.max(0,S.length+t.length-5);console.info(`[operator-ui] op=composer-drop count=${t.length} rejected=${n}`),C(t)},[S.length,C]),je=e=>e.startsWith(`image/`)?(0,M.jsx)(ue,{size:14}):e===`application/pdf`?(0,M.jsx)(re,{size:14}):(0,M.jsx)(b,{size:14});return(0,M.jsxs)(`div`,{className:`wa-reply${_?` wa-reply-drag-over`:``}`,onDragOver:Oe,onDragLeave:ke,onDrop:Ae,children:[h&&(0,M.jsx)(ve,{sessionKey:n,onPick:e=>{ne(t=>[...t,e].slice(0,5)),g(!1)},onClose:()=>g(!1)}),f&&(0,M.jsx)(N,{onSelect:Ee}),u&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:u}),ae&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ae}),E===`error`&&se&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:se}),(S.length>0||y.length>0)&&(0,M.jsxs)(`div`,{className:`wa-reply-attachments`,children:[S.map((e,t)=>(0,M.jsxs)(`div`,{className:`wa-reply-chip`,children:[je(e.type),(0,M.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>w(t),"aria-label":`Remove ${e.name}`,children:(0,M.jsx)(m,{size:12})})]},`f-${t}`)),y.map((e,t)=>(0,M.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,M.jsx)(re,{size:14}),(0,M.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>ne(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,M.jsx)(m,{size:12})})]},`r-${t}`))]}),r&&(0,M.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,M.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,M.jsx)(`span`,{className:`wa-reply-quote-who`,children:r.fromMe?`You`:r.senderName??`Contact`}),(0,M.jsx)(`span`,{className:`wa-reply-quote-text`,children:r.body||`Message`})]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>i?.(),"aria-label":`Cancel reply`,children:(0,M.jsx)(m,{size:14})})]}),!fe&&(0,M.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:Ce,onKeyDown:B}),(0,M.jsx)(`div`,{className:`wa-reply-row`,children:fe?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:k,"aria-label":`Cancel recording`,children:(0,M.jsx)(l,{size:20})}),(0,M.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,M.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),ye(D)]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,M.jsx)(ee,{size:20})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>p(e=>!e),disabled:s,"aria-label":`Emoji`,"aria-expanded":f,children:(0,M.jsx)(me,{size:22})}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>g(!0),disabled:s,"aria-label":`Attach files`,children:(0,M.jsx)(te,{size:22})}),(0,M.jsx)(`textarea`,{ref:x,className:`wa-reply-input`,value:a,rows:1,style:{height:`${F??xe??44}px`},placeholder:`Type a message`,disabled:s,onChange:e=>o(e.target.value),onKeyDown:De}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void pe(),disabled:s,"aria-label":`Record voice note`,children:(0,M.jsx)(oe,{size:22})}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void V(),disabled:!Te,"aria-label":`Send`,children:(0,M.jsx)(O,{size:20})})]})})]})}function F({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=f(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(``),p=()=>{l(!1),d(``)},[h,g]=(0,A.useState)(null);return(0,M.jsxs)(`div`,{className:`wa-web`,children:[(0,M.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,M.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,M.jsx)(w,{size:20})}),(0,M.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,M.jsx)(k,{size:20})}),c?(0,M.jsxs)(`div`,{className:`wa-web-search`,children:[(0,M.jsx)(T,{size:18,"aria-hidden":!0}),(0,M.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p()}}),(0,M.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:p,"aria-label":`Close search`,children:(0,M.jsx)(m,{size:18})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,M.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,M.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>l(!0),"aria-label":`Search messages`,children:(0,M.jsx)(T,{size:20})})]})]}),(0,M.jsx)(`div`,{className:`wa-web-body`,children:(0,M.jsx)(C,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{accountId:e,remoteJid:t},search:c?u:void 0,onReplyTo:a?void 0:g})}),a?(0,M.jsx)(`p`,{className:`wa-reply wa-reply-readonly`,children:`Group messages are read-only.`}):(0,M.jsx)(P,{accountId:e,remoteJid:t,sessionKey:r,replyTo:h,onClearReply:()=>g(null)})]})}function be(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||E.has(e)&&(t.add(e),n.push(e)));return n}function xe(e,t,n=`data`){let r=`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`+(n===`data`?``:`&root=${encodeURIComponent(n)}`),i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()}function Se(e,t){let n=new URLSearchParams;n.set(`session_key`,e);for(let e of t)n.append(`path`,e);let r=document.createElement(`a`);r.href=`/api/admin/files/download-zip?${n.toString()}`,r.rel=`noopener noreferrer`,document.body.appendChild(r),r.click(),r.remove()}function I(e,t,n=`data`){return`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}&disposition=inline`+(n===`data`?``:`&root=${encodeURIComponent(n)}`)}function L(e){if(!e)return``;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function R({conversations:e,sessionKey:t,onBack:n}){let[r,i]=(0,A.useState)(null),a=h(e);return r?r.source===`store`&&r.accountId&&r.remoteJid?(0,M.jsx)(F,{accountId:r.accountId,remoteJid:r.remoteJid,contactName:u(r),sessionKey:t,onBack:()=>i(null)},_(r)):(0,M.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,M.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>i(null),"aria-label":`Back to conversations`,children:[(0,M.jsx)(w,{size:16}),` Back`]}),(0,M.jsx)(`span`,{className:`op-conv-title`,children:u(r)})]}),(0,M.jsx)(C,{sessionId:r.sessionId,projectDir:r.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:r.source===`store`,store:r.source===`store`?{accountId:r.accountId,remoteJid:r.remoteJid}:void 0},_(r))]}):(0,M.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,M.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,M.jsx)(w,{size:16}),` Chat`]}),(0,M.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),a.map(e=>(0,M.jsxs)(`div`,{className:`op-conv-group`,children:[(0,M.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,M.jsx)(y,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{console.info(`[operator-ui] op=reader-open channel=${e.channel} key=${_(e)} readonly=true source=${e.source}`),i(e)},children:[(0,M.jsx)(`span`,{className:`op-conv-name`,children:u(e)}),e.modelGated&&(0,M.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,M.jsx)(D,{size:13})}),(0,M.jsx)(`span`,{className:`op-conv-when`,children:L(e.lastMessageAt)})]},_(e)))]},e.channel))]})}var z=/\.(png|jpe?g|gif|webp|svg)$/i;function Ce(e){return z.test(e)}function B(e){return e.entryPath??e.name}var we=`maxy-data-view`,Te=95*1024*1024,V=48*1024*1024;function Ee(){return typeof window>`u`?`list`:window.localStorage.getItem(we)===`grid`?`grid`:`list`}function De(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(!1);return(0,A.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,M.jsx)(g,{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,M.jsx)(`div`,{className:`data-page data-page-full`,children:(0,M.jsx)(H,{cacheKey:e})})}):(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsxs)(`div`,{className:`data-empty`,children:[(0,M.jsx)(`p`,{children:`You are not signed in.`}),(0,M.jsxs)(`p`,{children:[`Open the `,(0,M.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsxs)(`div`,{className:`data-loading`,children:[(0,M.jsx)(c,{size:18,className:`spin`}),` Loading…`]})})}function H({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,M.jsx)(Fe,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Oe(){if(typeof window>`u`)return`.`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`.`}function ke(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 Ae(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function je(e){return new Promise((t,n)=>e.file(t,n))}async function Me(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 je(r),relpath:e});else if(r.isDirectory){let t=await Ae(r.createReader());n.push(...await Me(t,e))}}return n}function Ne(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 Pe({adminFetch:e,cacheKey:n,sessionRefetchNonce:r}){let[i,a]=(0,A.useState)(``),u=(0,A.useRef)(null),[f,p]=(0,A.useState)(``),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`hybrid`),[y,ee]=(0,A.useState)(!1),[te,b]=(0,A.useState)(null),[x,S]=(0,A.useState)(null),[ie,ae]=(0,A.useState)(0),[C,oe]=(0,A.useState)(!1),[w,E]=(0,A.useState)(()=>Oe()),[D,ue]=(0,A.useState)(null),[O,me]=(0,A.useState)(()=>Ee()),[k,ge]=(0,A.useState)(null),[j,_e]=(0,A.useState)([]),[N,ve]=(0,A.useState)(!1),[ye,P]=(0,A.useState)(null),[F,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(null),[De,H]=(0,A.useState)(null),[Ae,je]=(0,A.useState)(null),[Pe,Fe]=(0,A.useState)(!1),[Ie,ze]=(0,A.useState)(null),Be=(0,A.useRef)(null),[Ve,U]=(0,A.useState)(0),[We,Ge]=(0,A.useState)(!1),[Ke,qe]=(0,A.useState)(``),[Je,Ye]=(0,A.useState)(null),[Xe,Ze]=(0,A.useState)(``),[Qe,$e]=(0,A.useState)(null),W=(()=>{let e=w===`.`?[]:w.split(`/`).filter(Boolean);return e.length>=2&&e[0]===`accounts`})(),[et,tt]=(0,A.useState)(!1),nt=(0,A.useRef)(null),[rt,G]=(0,A.useState)(!1),it=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=i.trim();if(!e){p(``),g(null),b(null);return}oe(!1);let t=setTimeout(()=>p(e),300);return()=>clearTimeout(t)},[i]),(0,A.useEffect)(()=>{if(!f){ee(!1);return}let t=!1;return ee(!0),b(null),e(`/api/admin/graph-search?q=${encodeURIComponent(f)}&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||(g(e.results),v(e.mode??`hybrid`),ae(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||b(e instanceof Error?e.message:String(e))}).finally(()=>{t||ee(!1)}),()=>{t=!0}},[f,e,r,C]);let at=(0,A.useMemo)(()=>h?be(h):[],[h]),K=x&&at.includes(x)?x:null,ot=(0,A.useMemo)(()=>h?K?h.filter(e=>e.labels.includes(K)):h:null,[h,K]),st=(0,A.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,A.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,A.useEffect)(()=>{let t=!1;return ve(!0),P(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||(ue(e.entries),_e(e.displayPath??[]))}).catch(e=>{t||(ue([]),_e([]),P(e instanceof Error?e.message:String(e)))}).finally(()=>{t||ve(!1)}),()=>{t=!0}},[e,w,Ve,r]),(0,A.useEffect)(()=>{ke(w)},[w]);let ct=(0,A.useCallback)(()=>{U(e=>e+1)},[]),q=(0,A.useCallback)(e=>{tt(!1),E(e)},[]),lt=(0,A.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}`),a(``),b(null),S(null),q(r)},[q]),ut=(0,A.useCallback)(()=>{if(w===`.`||w===``)return;let e=w.split(`/`).filter(Boolean);e.pop(),E(e.length===0?`.`:e.join(`/`))},[w]),dt=(0,A.useCallback)(e=>{xe(n,w===`.`?B(e):`${w}/${B(e)}`)},[w,n]),[J,ft]=(0,A.useState)(!1),[Y,pt]=(0,A.useState)(new Set),mt=(0,A.useRef)(null),X=(0,A.useRef)(!1),ht=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,gt=(0,A.useCallback)(e=>{ft(!0),pt(new Set([e])),console.info(`[data-ui] op=select-enter count=1`)},[]),Z=(0,A.useCallback)(e=>{ft(!1),pt(new Set),console.info(`[data-ui] op=select-exit reason=${e}`)},[]),Q=(0,A.useCallback)(e=>{pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_t=(0,A.useCallback)(e=>{X.current=!1,mt.current=setTimeout(()=>{X.current=!0,gt(e)},500)},[gt]),$=(0,A.useCallback)(()=>{mt.current&&=(clearTimeout(mt.current),null)},[]),vt=(0,A.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}dt(e)},[J,Q,dt]),yt=(0,A.useCallback)(e=>{me(e),typeof window<`u`&&window.localStorage.setItem(we,e),console.info(`[data] op=view-mode mode=${e}`)},[]),bt=(0,A.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}ge({src:I(n,w===`.`?B(e):`${w}/${B(e)}`),alt:e.displayName??e.name})},[J,Q,w,n]),xt=(0,A.useCallback)(()=>(D??[]).filter(e=>e.kind===`file`&&Y.has(e.name)),[D,Y]),St=(0,A.useCallback)(()=>{if(Y.size!==1)return null;let e=(D??[]).find(e=>Y.has(e.name));return e&&!e.entryPath?e:null},[D,Y]),Ct=(0,A.useCallback)(()=>(D??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&Y.has(e.name)),[D,Y]),wt=(0,A.useCallback)(()=>{let e=Ct(),t=e.some(e=>e.kind===`directory`);e.length===1&&!t?dt(e[0]):e.length>=1&&Se(n,e.map(e=>w===`.`?B(e):`${w}/${B(e)}`)),Z(`action`)},[Ct,dt,w,n,Z]),Tt=(0,A.useCallback)(async()=>{let t=xt(),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===`.`?B(t):`${w}/${B(t)}`;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))}}U(e=>e+1),Z(`action`)},[xt,w,e,Z]),Et=(0,A.useCallback)(async()=>{let e=xt();if(console.info(`[data-ui] op=share supported=${ht} count=${e.length}`),ht)try{let t=await Promise.all(e.map(async e=>{let t=w===`.`?B(e):`${w}/${B(e)}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??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)}`)}},[xt,ht,w,n]),Dt=(0,A.useCallback)(()=>{Be.current?.click()},[]),Ot=(0,A.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<=Te)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/V);return(async()=>{let n={status:0,data:{}};for(let o=0;o<a;o++){let s=o*V;if(n=await r(e.slice(s,Math.min(s+V,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]),kt=(0,A.useCallback)(async e=>{H(null),L(!0),z({loaded:0,total:e.size});try{let{status:t,data:n}=await Ot(e,{onProgress:(e,t)=>z({loaded:e,total:t})});t>=200&&t<300&&n.path?(E(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),U(e=>e+1)):H(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{L(!1),z(null),Be.current&&(Be.current.value=``)}},[Ot]),At=(0,A.useCallback)(e=>{W&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Fe(!0))},[W]),jt=(0,A.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Fe(!1)},[]),Mt=(0,A.useCallback)(async e=>{e.preventDefault(),Fe(!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(!W){console.info(`[data-ui] op=drop-rejected token=${t} reason=no-write`),H(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);L(!0),H(null),je(null);let i=performance.now();try{let e=await Me(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}`),z({loaded:0,total:r.size});let{status:a,data:c}=await Ot(r,{relpath:i,token:t,onProgress:(e,t)=>z({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`:Ne(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}`),je(`Uploaded ${o}, skipped ${s.length}${s.length?`: ${s.join(`, `)}`:``}`),U(e=>e+1)}catch(e){H(e instanceof Error?e.message:String(e))}finally{L(!1),z(null)}},[W,Ot]),Nt=(0,A.useCallback)(async()=>{let t=Ke.trim();if(t){$e(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}`);Ge(!1),qe(``),U(e=>e+1)}catch(e){$e(e instanceof Error?e.message:String(e))}}},[e,Ke,w]),Pt=(0,A.useCallback)(async()=>{if(!Je)return;let t=Xe.trim();if(!t)return;$e(null);let n=w===`.`?Je:`${w}/${Je}`;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}`);Ye(null),Ze(``),Z(`action`),U(e=>e+1)}catch(e){$e(e instanceof Error?e.message:String(e))}},[e,Xe,Je,w,Z]);(0,A.useEffect)(()=>{if(!et)return;let e=e=>{nt.current&&!nt.current.contains(e.target)&&tt(!1)},t=e=>{e.key===`Escape`&&tt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[et]),(0,A.useEffect)(()=>{if(!rt)return;let e=e=>{it.current&&!it.current.contains(e.target)&&G(!1)},t=e=>{e.key===`Escape`&&G(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[rt]);let Ft=(0,A.useCallback)(e=>j.slice(0,e+1).map(e=>e.name).join(`/`),[j]),It=j.length>=2,Lt=It?[{name:`.`,label:`data`},...j.slice(0,j.length-2).map((e,t)=>({name:Ft(t),label:e.displayName??e.name}))]:[];return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`data-toolbar`,children:[J?(0,M.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Z(`cancel`),"aria-label":`Cancel selection`,children:[(0,M.jsx)(m,{size:14}),` Cancel`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`data-search-input`,children:[i===``&&(0,M.jsx)(T,{size:14}),(0,M.jsx)(`input`,{ref:u,type:`text`,value:i,onChange:e=>a(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),y&&(0,M.jsx)(c,{size:14,className:`spin`}),i!==``&&(0,M.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{a(``),u.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,M.jsx)(m,{size:14})})]}),(0,M.jsxs)(`div`,{className:`data-toolbar-actions`,ref:it,children:[(0,M.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>G(e=>!e),"aria-haspopup":`menu`,"aria-expanded":rt,"aria-label":`File actions`,title:`File actions`,children:(0,M.jsx)(ce,{size:16})}),(0,M.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":rt?`true`:void 0,children:[(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{ct(),G(!1)},disabled:N,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[N?(0,M.jsx)(c,{size:16,className:`spin`}):(0,M.jsx)(d,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Dt(),G(!1)},disabled:F||!W,title:W?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[F?R&&R.total>0?(0,M.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(R.loaded/R.total*100),`%`]}):(0,M.jsx)(c,{size:16,className:`spin`}):(0,M.jsx)(he,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ge(e=>!e),qe(``),$e(null),G(!1)},disabled:F||!W,title:W?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,M.jsx)(le,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{yt(O===`grid`?`list`:`grid`),G(!1)},title:O===`grid`?`List view`:`Grid view`,"aria-label":O===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":O===`grid`,children:[O===`grid`?(0,M.jsx)(fe,{size:16}):(0,M.jsx)(de,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:O===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,M.jsxs)(`div`,{className:`data-breadcrumbs`,children:[w!==`.`&&(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:ut,title:`Up one level`,"aria-label":`Up one level`,children:(0,M.jsx)(se,{size:14})}),It?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,ref:nt,children:[(0,M.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>tt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":et,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),et&&(0,M.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Lt.map(e=>(0,M.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>q(e.name),title:e.label,children:e.label},e.name))})]}),[j.length-2,j.length-1].map(e=>{let t=j[e];return(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,M.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Ft(e)),title:t.name,children:t.displayName??t.name})]},Ft(e))})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(`.`),children:`data`}),j.map((e,t)=>(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,M.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Ft(t)),title:e.name,children:e.displayName??e.name})]},Ft(t)))]})]}),We&&(0,M.jsxs)(`div`,{className:`data-inline-form`,children:[(0,M.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:Ke,autoFocus:!0,onChange:e=>qe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Nt(),e.key===`Escape`&&Ge(!1)}}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Nt,children:`Create`}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>Ge(!1),children:`Cancel`})]}),Je&&(0,M.jsxs)(`div`,{className:`data-inline-form`,children:[(0,M.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:Xe,autoFocus:!0,onChange:e=>Ze(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Pt(),e.key===`Escape`&&Ye(null)}}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Pt,children:`Rename`}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>Ye(null),children:`Cancel`})]}),Qe&&(0,M.jsx)(`div`,{className:`data-error`,children:Qe}),(0,M.jsx)(`input`,{type:`file`,ref:Be,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&kt(t)}})]}),(0,M.jsxs)(`div`,{className:`data-body`,"data-drag-active":Pe?`true`:void 0,onDragEnter:At,onDragOver:At,onDragLeave:jt,onDrop:Mt,children:[(te!==null||h!==null)&&(0,M.jsxs)(`section`,{className:`data-panel admin-card`,children:[te&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,te]}),at.length>0&&(0,M.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:at.map(e=>{let t=e===K;return(0,M.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>S(t?null:e),children:Re([e])??e},e)})}),h&&!y&&(0,M.jsxs)(`div`,{className:`data-results-meta`,children:[ot.length,` of `,h.length,` result`,h.length===1?``:`s`]}),h&&!y&&!K&&ie>0&&!C&&(0,M.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[ie,` low-confidence result`,ie===1?``:`s`,` hidden — show all`]}),h&&!y&&!K&&C&&(0,M.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),h&&h.length===0&&!y&&(0,M.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),ot&&ot.length>0&&(0,M.jsx)(`ul`,{className:`data-results`,children:ot.map(e=>(0,M.jsx)(Le,{hit:e,mode:_,onDownload:st,onLocate:lt},e.nodeId))})]}),(0,M.jsxs)(`section`,{className:`data-panel admin-card`,children:[R&&(0,M.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R.total>0?Math.round(R.loaded/R.total*100):void 0,children:[(0,M.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,M.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${R.total>0?Math.round(R.loaded/R.total*100):0}%`}})}),(0,M.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,R.total>0?`${Math.round(R.loaded/R.total*100)}%`:``]})]}),De&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,De]}),Ae&&(0,M.jsx)(`div`,{className:`data-status`,children:Ae}),Ie&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Ie]}),ye&&(0,M.jsx)(`div`,{className:`data-error`,children:ye}),N&&(0,M.jsxs)(`div`,{className:`data-loading`,children:[(0,M.jsx)(c,{size:14,className:`spin`}),` Loading…`]}),!J&&!N&&D&&D.length>0&&(0,M.jsxs)(`div`,{className:`data-select-hint`,children:[(0,M.jsx)(pe,{size:13}),(0,M.jsx)(`span`,{children:`Press and hold a file to select, rename, or delete it.`})]}),!N&&D&&D.length===0&&!ye&&(0,M.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!N&&D&&D.length>0&&O===`grid`&&(0,M.jsx)(`ul`,{className:`data-grid`,children:D.map(e=>{let t=e.displayName??e.name,r=J&&Y.has(e.name);if(e.kind===`directory`)return(0,M.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(w===`.`?e.name:`${w}/${e.name}`)},children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsx)(o,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t})]})},e.name);if(e.kind===`file`){let i=Ce(B(e)),a=w===`.`?B(e):`${w}/${B(e)}`;return(0,M.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?bt(e):vt(e),title:J?void 0:i?`Preview ${t}`:`Download ${t}`,children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,M.jsx)(`img`,{className:`data-grid-thumb`,src:I(n,a),alt:t,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,M.jsx)(re,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t}),!i&&(0,M.jsx)(`span`,{className:`data-grid-sub`,children:He(e.sizeBytes)})]})},e.name)}return(0,M.jsx)(`li`,{className:`data-grid-cell`,children:(0,M.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,M.jsx)(re,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,children:t}),(0,M.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!N&&D&&D.length>0&&O===`list`&&(0,M.jsx)(`ul`,{className:`data-entries`,children:D.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=J&&Y.has(e.name);return(0,M.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(w===`.`?e.name:`${w}/${e.name}`)},children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsx)(o,{size:14}),(0,M.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=J&&Y.has(e.name);return(0,M.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>vt(e),title:J?void 0:`Download ${t}`,children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsxs)(`span`,{className:`data-entry-text`,children:[(0,M.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,M.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Ue(e.modifiedAt)}`,children:[He(e.sizeBytes),` · `,Ue(e.modifiedAt)]})]})]})},e.name)}return(0,M.jsx)(`li`,{className:`data-entry`,children:(0,M.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,M.jsxs)(`span`,{className:`data-entry-text`,children:[(0,M.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,M.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]}),J&&(0,M.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,M.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Et,disabled:!ht||Y.size===0,title:ht?`Share selected files`:`Sharing is not supported on this device`,children:[(0,M.jsx)(ne,{size:16}),` Share`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:wt,disabled:Y.size===0,children:[(0,M.jsx)(t,{size:16}),` Download`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=St();e&&(Ye(e.name),Ze(e.name))},disabled:!St(),children:[(0,M.jsx)(s,{size:16}),` Rename`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Tt,disabled:Y.size===0,children:[(0,M.jsx)(l,{size:16}),` Delete`]})]})}),k&&(0,M.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":k.alt,onClick:()=>ge(null),children:(0,M.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:k.src,alt:k.alt})})]})}function Fe({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){(0,A.useEffect)(()=>{console.info(`[data-ui] op=mount header=operator home=absent`)},[]);let r=(0,A.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),i=(0,A.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[a,o]=(0,A.useState)([]),[s,c]=(0,A.useState)(`files`),{subAccounts:l,activeAccountId:u,switching:d,switchAccount:f}=v(t);return(0,A.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||o(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,M.jsxs)(`main`,{className:`data-main`,children:[(0,M.jsx)(p,{variant:`operator`,onNavigate:i,onOpenConversations:a.length>0?()=>c(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:l,activeAccountId:u,switchingAccount:d,onSwitchAccount:f}),s===`conversations`?(0,M.jsx)(R,{conversations:a,sessionKey:t,onBack:()=>c(`files`)}):(0,M.jsx)(Pe,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function Ie({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsx)(`main`,{className:`data-main`,children:(0,M.jsx)(Pe,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function Le({hit:e,mode:t,onDownload:n,onLocate:r}){let i=ze(e.properties),a=Be(e.properties),s=Re(e.labels),c=Ve(e.properties),[l,u]=(0,A.useState)(!1),d=a&&a.length>280,f=l||!d?a:a?.slice(0,280)+`…`,p=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,m=e.properties.relativePath,h=typeof m==`string`&&m.length>0,g=h?m.lastIndexOf(`/`):-1,_=h?g===-1?`data`:m.slice(0,g):null;return(0,M.jsxs)(`li`,{className:`data-result`,children:[(0,M.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??s??`file`}`,children:[s&&(0,M.jsx)(`div`,{className:`data-result-header`,children:(0,M.jsx)(`span`,{className:`data-result-labels`,children:s})}),i&&(0,M.jsx)(`div`,{className:`data-result-title`,children:i}),a&&(0,M.jsx)(`pre`,{className:`data-result-body`,children:f}),(0,M.jsxs)(`div`,{className:`data-result-scores`,children:[c&&(0,M.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Ue(c),` · `]}),p]})]}),h&&(0,M.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${_}`,"aria-label":`Locate in ${_}`,children:[(0,M.jsx)(o,{size:12}),_]}),d&&(0,M.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>u(e=>!e),children:l?`Show less`:`Show more`})]})}function Re(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 ze(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 Be(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 Ve(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 He(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 Ue(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`—`}}export{k as a,F as i,Ie as n,xe as r,De as t};
|
|
1
|
+
import{o as e}from"./chunk-fQC6bEKA.js";import{A as t,B as n,F as r,G as i,H as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,g as m,i as h,p as g,s as _,t as v,u as y,v as ee,x as te,y as ne}from"./useSubAccountSwitcher-Bc7XHr0L.js";import{C as b,E as x,S as re,T as S,n as ie,r as ae,s as C,x as oe}from"./useVoiceRecorder-Cj-VZDKO.js";import{t as w}from"./chevron-left-BzIg4in6.js";import{i as T,t as E}from"./graph-labels-DykmXYHA.js";import{t as D}from"./triangle-alert-DumCWC08.js";var se=r(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ce=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),le=r(`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=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),de=r(`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=r(`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=r(`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`}]]),O=r(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),me=r(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),he=r(`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`}]]),k=r(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),A=e(i(),1);function ge(){let[e,t]=(0,A.useState)([]),[n,r]=(0,A.useState)(!1),[i,a]=(0,A.useState)(null),o=(0,A.useRef)(null),s=(0,A.useCallback)(e=>{a(null);let n=e.find(e=>!ae(e.type,x));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>S);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,A.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,A.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,A.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,A.useCallback)(()=>{r(!1)},[]),onDrop:(0,A.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var j=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function _e(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var M=n();function N({onSelect:e}){return(0,M.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:j.map((t,n)=>(0,M.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function ve({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,A.useState)(``),[a,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(!1),f=(0,A.useCallback)(t=>{d(!0),l(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{s(e),i(e.path===`.`?``:e.path)}).catch(e=>l(e instanceof Error?e.message:String(e))).finally(()=>d(!1))},[e]);(0,A.useEffect)(()=>{f(``)},[f]);let p=e=>f(r?`${r}/${e}`:e),h=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),f(e.join(`/`))},g=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,M.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,M.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,M.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:h,"aria-label":`Up one folder`,children:(0,M.jsx)(w,{size:18})}),(0,M.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,M.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,M.jsx)(m,{size:18})})]}),c&&(0,M.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:c}),u&&(0,M.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!u&&(0,M.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,M.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,M.jsx)(`li`,{children:e.kind===`directory`?(0,M.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>p(e.name),children:[(0,M.jsx)(o,{size:16,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,M.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>g(e),children:[(0,M.jsx)(re,{size:16,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}function ye(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function P({accountId:e,remoteJid:t,sessionKey:n,replyTo:r,onClearReply:i}){let[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(!1),[y,ne]=(0,A.useState)([]),x=(0,A.useRef)(null),{pendingFiles:S,attachError:ae,addFiles:C,removeFile:w,clearFiles:T}=ge(),{state:E,elapsedSeconds:D,errorMessage:se,start:ce,send:le,discard:de}=ie(),fe=E===`recording`||E===`paused`,pe=(0,A.useCallback)(()=>{console.info(`[operator-ui] op=voice-record state=start ms=0`),ce()},[ce]),he=(0,A.useCallback)(async()=>{let e=D*1e3,t=await le();if(console.info(`[operator-ui] op=voice-record state=stop ms=${e}`),t){let e=t.type===`audio/ogg`?`.ogg`:t.type===`audio/mp4`?`.m4a`:`.webm`;C([new File([t],`voice-note${e}`,{type:t.type})])}},[D,le,C]),k=(0,A.useCallback)(()=>{console.info(`[operator-ui] op=voice-record state=cancel ms=${D*1e3}`),de()},[D,de]),j=(0,A.useRef)(!1),P=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[F,be]=(0,A.useState)(null),[xe,Se]=(0,A.useState)(null),I=(0,A.useRef)(null),L=(0,A.useRef)(44),R=(0,A.useCallback)(e=>{let t=I.current;if(!t)return;t.moved=!0;let n=Math.min(P(),Math.max(44,t.startH+(t.startY-e.clientY)));L.current=n,be(n)},[]),z=(0,A.useCallback)(()=>{let e=I.current?.moved??!1;I.current=null,window.removeEventListener(`pointermove`,R),window.removeEventListener(`pointerup`,z),e&&console.info(`[operator-ui] op=wa-composer-resize mode=drag h=${L.current}`)},[R]),Ce=(0,A.useCallback)(e=>{I.current={startY:e.clientY,startH:x.current?.offsetHeight??44,moved:!1},window.addEventListener(`pointermove`,R),window.addEventListener(`pointerup`,z),e.preventDefault()},[R,z]),B=(0,A.useCallback)(e=>{let t=F??x.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(P(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&(be(n),console.info(`[operator-ui] op=wa-composer-resize mode=key h=${n}`))},[F]),we=(0,A.useRef)(``);(0,A.useEffect)(()=>{let e=x.current;if(!e)return;let t=we.current!==``&&a===``;if(we.current=a,F!==null){t&&be(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(P(),Math.max(44,e.scrollHeight));e.style.height=n,Se(r)},[a,F]);let Te=(a.trim().length>0||S.length>0||y.length>0)&&!s,V=(0,A.useCallback)(async()=>{if(!j.current&&!(a.trim().length===0&&S.length===0&&y.length===0)){j.current=!0,c(!0),d(null);try{let s=`/api/whatsapp-reader/reply?session_key=${encodeURIComponent(n)}`,c;if(S.length>0||y.length>0){let n=new FormData;n.append(`accountId`,e),n.append(`remoteJid`,t),a.trim()&&n.append(`text`,a);for(let e of S)n.append(`files`,e);for(let e of y)n.append(`fileRefs`,e.path);r&&n.append(`quotedId`,r.msgKeyId),c=await fetch(s,{method:`POST`,body:n})}else c=await fetch(s,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({accountId:e,remoteJid:t,text:a,...r?{quotedId:r.msgKeyId}:{}})});let l=await c.json().catch(()=>({}));if(!c.ok){d(l.error??`Send failed.`),console.info(`[operator-ui] op=reply-fail remoteJid=${t} error=${l.error??`unknown`}`);return}o(``),T(),ne([]),i?.(),console.info(`[operator-ui] op=reply-sent remoteJid=${t} sent=${l.sent??0}`)}catch(e){d(`Could not reach the server. Try again.`),console.info(`[operator-ui] op=reply-fail remoteJid=${t} error=${String(e)}`)}finally{j.current=!1,c(!1)}}},[a,S,y,r,i,e,t,n,T]),Ee=(0,A.useCallback)(e=>{let t=x.current,{value:n,caret:r}=_e(a,e,t?t.selectionStart:null,t?t.selectionEnd:null);o(n),p(!1),requestAnimationFrame(()=>{let e=x.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[a]),De=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Te&&V())},H=e=>e.dataTransfer.types.includes(`Files`),Oe=(0,A.useCallback)(e=>{H(e)&&(e.preventDefault(),v(!0))},[]),ke=(0,A.useCallback)(()=>v(!1),[]),Ae=(0,A.useCallback)(e=>{if(!H(e))return;e.preventDefault(),v(!1);let t=[...e.dataTransfer.files];if(t.length===0)return;let n=Math.max(0,S.length+t.length-5);console.info(`[operator-ui] op=composer-drop count=${t.length} rejected=${n}`),C(t)},[S.length,C]),je=e=>e.startsWith(`image/`)?(0,M.jsx)(ue,{size:14}):e===`application/pdf`?(0,M.jsx)(re,{size:14}):(0,M.jsx)(b,{size:14});return(0,M.jsxs)(`div`,{className:`wa-reply${_?` wa-reply-drag-over`:``}`,onDragOver:Oe,onDragLeave:ke,onDrop:Ae,children:[h&&(0,M.jsx)(ve,{sessionKey:n,onPick:e=>{ne(t=>[...t,e].slice(0,5)),g(!1)},onClose:()=>g(!1)}),f&&(0,M.jsx)(N,{onSelect:Ee}),u&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:u}),ae&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ae}),E===`error`&&se&&(0,M.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:se}),(S.length>0||y.length>0)&&(0,M.jsxs)(`div`,{className:`wa-reply-attachments`,children:[S.map((e,t)=>(0,M.jsxs)(`div`,{className:`wa-reply-chip`,children:[je(e.type),(0,M.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>w(t),"aria-label":`Remove ${e.name}`,children:(0,M.jsx)(m,{size:12})})]},`f-${t}`)),y.map((e,t)=>(0,M.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,M.jsx)(re,{size:14}),(0,M.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>ne(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,M.jsx)(m,{size:12})})]},`r-${t}`))]}),r&&(0,M.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,M.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,M.jsx)(`span`,{className:`wa-reply-quote-who`,children:r.fromMe?`You`:r.senderName??`Contact`}),(0,M.jsx)(`span`,{className:`wa-reply-quote-text`,children:r.body||`Message`})]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>i?.(),"aria-label":`Cancel reply`,children:(0,M.jsx)(m,{size:14})})]}),!fe&&(0,M.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:Ce,onKeyDown:B}),(0,M.jsx)(`div`,{className:`wa-reply-row`,children:fe?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:k,"aria-label":`Cancel recording`,children:(0,M.jsx)(l,{size:20})}),(0,M.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,M.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),ye(D)]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,M.jsx)(ee,{size:20})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>p(e=>!e),disabled:s,"aria-label":`Emoji`,"aria-expanded":f,children:(0,M.jsx)(me,{size:22})}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>g(!0),disabled:s,"aria-label":`Attach files`,children:(0,M.jsx)(te,{size:22})}),(0,M.jsx)(`textarea`,{ref:x,className:`wa-reply-input`,value:a,rows:1,style:{height:`${F??xe??44}px`},placeholder:`Type a message`,disabled:s,onChange:e=>o(e.target.value),onKeyDown:De}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void pe(),disabled:s,"aria-label":`Record voice note`,children:(0,M.jsx)(oe,{size:22})}),(0,M.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void V(),disabled:!Te,"aria-label":`Send`,children:(0,M.jsx)(O,{size:20})})]})})]})}function F({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=f(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(``),p=()=>{l(!1),d(``)},[h,g]=(0,A.useState)(null);return(0,M.jsxs)(`div`,{className:`wa-web`,children:[(0,M.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,M.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,M.jsx)(w,{size:20})}),(0,M.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,M.jsx)(k,{size:20})}),c?(0,M.jsxs)(`div`,{className:`wa-web-search`,children:[(0,M.jsx)(T,{size:18,"aria-hidden":!0}),(0,M.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p()}}),(0,M.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:p,"aria-label":`Close search`,children:(0,M.jsx)(m,{size:18})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,M.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,M.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,M.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>l(!0),"aria-label":`Search messages`,children:(0,M.jsx)(T,{size:20})})]})]}),(0,M.jsx)(`div`,{className:`wa-web-body`,children:(0,M.jsx)(C,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{accountId:e,remoteJid:t},search:c?u:void 0,onReplyTo:a?void 0:g})}),a?(0,M.jsx)(`p`,{className:`wa-reply wa-reply-readonly`,children:`Group messages are read-only.`}):(0,M.jsx)(P,{accountId:e,remoteJid:t,sessionKey:r,replyTo:h,onClearReply:()=>g(null)})]})}function be(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||E.has(e)&&(t.add(e),n.push(e)));return n}function xe(e,t,n=`data`){let r=`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`+(n===`data`?``:`&root=${encodeURIComponent(n)}`),i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()}function Se(e,t){let n=new URLSearchParams;n.set(`session_key`,e);for(let e of t)n.append(`path`,e);let r=document.createElement(`a`);r.href=`/api/admin/files/download-zip?${n.toString()}`,r.rel=`noopener noreferrer`,document.body.appendChild(r),r.click(),r.remove()}function I(e,t,n=`data`){return`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}&disposition=inline`+(n===`data`?``:`&root=${encodeURIComponent(n)}`)}function L(e){if(!e)return``;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function R({conversations:e,sessionKey:t,onBack:n}){let[r,i]=(0,A.useState)(null),a=h(e);return r?r.source===`store`&&r.accountId&&r.remoteJid?(0,M.jsx)(F,{accountId:r.accountId,remoteJid:r.remoteJid,contactName:u(r),sessionKey:t,onBack:()=>i(null)},_(r)):(0,M.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,M.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>i(null),"aria-label":`Back to conversations`,children:[(0,M.jsx)(w,{size:16}),` Back`]}),(0,M.jsx)(`span`,{className:`op-conv-title`,children:u(r)})]}),(0,M.jsx)(C,{sessionId:r.sessionId,projectDir:r.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:r.source===`store`,store:r.source===`store`?{accountId:r.accountId,remoteJid:r.remoteJid}:void 0},_(r))]}):(0,M.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,M.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,M.jsx)(w,{size:16}),` Chat`]}),(0,M.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),a.map(e=>(0,M.jsxs)(`div`,{className:`op-conv-group`,children:[(0,M.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,M.jsx)(y,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{console.info(`[operator-ui] op=reader-open channel=${e.channel} key=${_(e)} readonly=true source=${e.source}`),i(e)},children:[(0,M.jsx)(`span`,{className:`op-conv-name`,children:u(e)}),e.modelGated&&(0,M.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,M.jsx)(D,{size:13})}),(0,M.jsx)(`span`,{className:`op-conv-when`,children:L(e.lastMessageAt)})]},_(e)))]},e.channel))]})}var z=/\.(png|jpe?g|gif|webp|svg)$/i;function Ce(e){return z.test(e)}function B(e){return e.entryPath??e.name}var we=`maxy-data-view`,Te=95*1024*1024,V=48*1024*1024;function Ee(){return typeof window>`u`?`list`:window.localStorage.getItem(we)===`grid`?`grid`:`list`}function De(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(!1);return(0,A.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,M.jsx)(g,{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,M.jsx)(`div`,{className:`data-page data-page-full`,children:(0,M.jsx)(H,{cacheKey:e})})}):(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsxs)(`div`,{className:`data-empty`,children:[(0,M.jsx)(`p`,{children:`You are not signed in.`}),(0,M.jsxs)(`p`,{children:[`Open the `,(0,M.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsxs)(`div`,{className:`data-loading`,children:[(0,M.jsx)(c,{size:18,className:`spin`}),` Loading…`]})})}function H({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,M.jsx)(Fe,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Oe(){if(typeof window>`u`)return`.`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`.`}function ke(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 Ae(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function je(e){return new Promise((t,n)=>e.file(t,n))}async function Me(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 je(r),relpath:e});else if(r.isDirectory){let t=await Ae(r.createReader());n.push(...await Me(t,e))}}return n}function Ne(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 Pe({adminFetch:e,cacheKey:n,sessionRefetchNonce:r}){let[i,a]=(0,A.useState)(``),u=(0,A.useRef)(null),[f,p]=(0,A.useState)(``),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`hybrid`),[y,ee]=(0,A.useState)(!1),[te,b]=(0,A.useState)(null),[x,S]=(0,A.useState)(null),[ie,ae]=(0,A.useState)(0),[C,oe]=(0,A.useState)(!1),[w,E]=(0,A.useState)(()=>Oe()),[D,ue]=(0,A.useState)(null),[O,me]=(0,A.useState)(()=>Ee()),[k,ge]=(0,A.useState)(null),[j,_e]=(0,A.useState)([]),[N,ve]=(0,A.useState)(!1),[ye,P]=(0,A.useState)(null),[F,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(null),[De,H]=(0,A.useState)(null),[Ae,je]=(0,A.useState)(null),[Pe,Fe]=(0,A.useState)(!1),[Ie,ze]=(0,A.useState)(null),Be=(0,A.useRef)(null),[Ve,U]=(0,A.useState)(0),[We,Ge]=(0,A.useState)(!1),[Ke,qe]=(0,A.useState)(``),[Je,Ye]=(0,A.useState)(null),[Xe,Ze]=(0,A.useState)(``),[Qe,$e]=(0,A.useState)(null),W=(()=>{let e=w===`.`?[]:w.split(`/`).filter(Boolean);return e.length>=2&&e[0]===`accounts`})(),[et,tt]=(0,A.useState)(!1),nt=(0,A.useRef)(null),[rt,G]=(0,A.useState)(!1),it=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=i.trim();if(!e){p(``),g(null),b(null);return}oe(!1);let t=setTimeout(()=>p(e),300);return()=>clearTimeout(t)},[i]),(0,A.useEffect)(()=>{if(!f){ee(!1);return}let t=!1;return ee(!0),b(null),e(`/api/admin/graph-search?q=${encodeURIComponent(f)}&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||(g(e.results),v(e.mode??`hybrid`),ae(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||b(e instanceof Error?e.message:String(e))}).finally(()=>{t||ee(!1)}),()=>{t=!0}},[f,e,r,C]);let at=(0,A.useMemo)(()=>h?be(h):[],[h]),K=x&&at.includes(x)?x:null,ot=(0,A.useMemo)(()=>h?K?h.filter(e=>e.labels.includes(K)):h:null,[h,K]),st=(0,A.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,A.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,A.useEffect)(()=>{let t=!1;return ve(!0),P(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||(ue(e.entries),_e(e.displayPath??[]))}).catch(e=>{t||(ue([]),_e([]),P(e instanceof Error?e.message:String(e)))}).finally(()=>{t||ve(!1)}),()=>{t=!0}},[e,w,Ve,r]),(0,A.useEffect)(()=>{ke(w)},[w]);let ct=(0,A.useCallback)(()=>{U(e=>e+1)},[]),q=(0,A.useCallback)(e=>{tt(!1),E(e)},[]),lt=(0,A.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}`),a(``),b(null),S(null),q(r)},[q]),ut=(0,A.useCallback)(()=>{if(w===`.`||w===``)return;let e=w.split(`/`).filter(Boolean);e.pop(),E(e.length===0?`.`:e.join(`/`))},[w]),dt=(0,A.useCallback)(e=>{xe(n,w===`.`?B(e):`${w}/${B(e)}`)},[w,n]),[J,ft]=(0,A.useState)(!1),[Y,pt]=(0,A.useState)(new Set),mt=(0,A.useRef)(null),X=(0,A.useRef)(!1),ht=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,gt=(0,A.useCallback)(e=>{ft(!0),pt(new Set([e])),console.info(`[data-ui] op=select-enter count=1`)},[]),Z=(0,A.useCallback)(e=>{ft(!1),pt(new Set),console.info(`[data-ui] op=select-exit reason=${e}`)},[]),Q=(0,A.useCallback)(e=>{pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_t=(0,A.useCallback)(e=>{X.current=!1,mt.current=setTimeout(()=>{X.current=!0,gt(e)},500)},[gt]),$=(0,A.useCallback)(()=>{mt.current&&=(clearTimeout(mt.current),null)},[]),vt=(0,A.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}dt(e)},[J,Q,dt]),yt=(0,A.useCallback)(e=>{me(e),typeof window<`u`&&window.localStorage.setItem(we,e),console.info(`[data] op=view-mode mode=${e}`)},[]),bt=(0,A.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}ge({src:I(n,w===`.`?B(e):`${w}/${B(e)}`),alt:e.displayName??e.name})},[J,Q,w,n]),xt=(0,A.useCallback)(()=>(D??[]).filter(e=>e.kind===`file`&&Y.has(e.name)),[D,Y]),St=(0,A.useCallback)(()=>{if(Y.size!==1)return null;let e=(D??[]).find(e=>Y.has(e.name));return e&&!e.entryPath?e:null},[D,Y]),Ct=(0,A.useCallback)(()=>(D??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&Y.has(e.name)),[D,Y]),wt=(0,A.useCallback)(()=>{let e=Ct(),t=e.some(e=>e.kind===`directory`);e.length===1&&!t?dt(e[0]):e.length>=1&&Se(n,e.map(e=>w===`.`?B(e):`${w}/${B(e)}`)),Z(`action`)},[Ct,dt,w,n,Z]),Tt=(0,A.useCallback)(async()=>{let t=xt(),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===`.`?B(t):`${w}/${B(t)}`;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))}}U(e=>e+1),Z(`action`)},[xt,w,e,Z]),Et=(0,A.useCallback)(async()=>{let e=xt();if(console.info(`[data-ui] op=share supported=${ht} count=${e.length}`),ht)try{let t=await Promise.all(e.map(async e=>{let t=w===`.`?B(e):`${w}/${B(e)}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??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)}`)}},[xt,ht,w,n]),Dt=(0,A.useCallback)(()=>{Be.current?.click()},[]),Ot=(0,A.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<=Te)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/V);return(async()=>{let n={status:0,data:{}};for(let o=0;o<a;o++){let s=o*V;if(n=await r(e.slice(s,Math.min(s+V,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]),kt=(0,A.useCallback)(async e=>{H(null),L(!0),z({loaded:0,total:e.size});try{let{status:t,data:n}=await Ot(e,{onProgress:(e,t)=>z({loaded:e,total:t})});t>=200&&t<300&&n.path?(E(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),U(e=>e+1)):H(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{L(!1),z(null),Be.current&&(Be.current.value=``)}},[Ot]),At=(0,A.useCallback)(e=>{W&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Fe(!0))},[W]),jt=(0,A.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Fe(!1)},[]),Mt=(0,A.useCallback)(async e=>{e.preventDefault(),Fe(!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(!W){console.info(`[data-ui] op=drop-rejected token=${t} reason=no-write`),H(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);L(!0),H(null),je(null);let i=performance.now();try{let e=await Me(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}`),z({loaded:0,total:r.size});let{status:a,data:c}=await Ot(r,{relpath:i,token:t,onProgress:(e,t)=>z({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`:Ne(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}`),je(`Uploaded ${o}, skipped ${s.length}${s.length?`: ${s.join(`, `)}`:``}`),U(e=>e+1)}catch(e){H(e instanceof Error?e.message:String(e))}finally{L(!1),z(null)}},[W,Ot]),Nt=(0,A.useCallback)(async()=>{let t=Ke.trim();if(t){$e(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}`);Ge(!1),qe(``),U(e=>e+1)}catch(e){$e(e instanceof Error?e.message:String(e))}}},[e,Ke,w]),Pt=(0,A.useCallback)(async()=>{if(!Je)return;let t=Xe.trim();if(!t)return;$e(null);let n=w===`.`?Je:`${w}/${Je}`;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}`);Ye(null),Ze(``),Z(`action`),U(e=>e+1)}catch(e){$e(e instanceof Error?e.message:String(e))}},[e,Xe,Je,w,Z]);(0,A.useEffect)(()=>{if(!et)return;let e=e=>{nt.current&&!nt.current.contains(e.target)&&tt(!1)},t=e=>{e.key===`Escape`&&tt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[et]),(0,A.useEffect)(()=>{if(!rt)return;let e=e=>{it.current&&!it.current.contains(e.target)&&G(!1)},t=e=>{e.key===`Escape`&&G(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[rt]);let Ft=(0,A.useCallback)(e=>j.slice(0,e+1).map(e=>e.name).join(`/`),[j]),It=j.length>=2,Lt=It?[{name:`.`,label:`data`},...j.slice(0,j.length-2).map((e,t)=>({name:Ft(t),label:e.displayName??e.name}))]:[];return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`data-toolbar`,children:[J?(0,M.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Z(`cancel`),"aria-label":`Cancel selection`,children:[(0,M.jsx)(m,{size:14}),` Cancel`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`data-search-input`,children:[i===``&&(0,M.jsx)(T,{size:14}),(0,M.jsx)(`input`,{ref:u,type:`text`,value:i,onChange:e=>a(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),y&&(0,M.jsx)(c,{size:14,className:`spin`}),i!==``&&(0,M.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{a(``),u.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,M.jsx)(m,{size:14})})]}),(0,M.jsxs)(`div`,{className:`data-toolbar-actions`,ref:it,children:[(0,M.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>G(e=>!e),"aria-haspopup":`menu`,"aria-expanded":rt,"aria-label":`File actions`,title:`File actions`,children:(0,M.jsx)(ce,{size:16})}),(0,M.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":rt?`true`:void 0,children:[(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{ct(),G(!1)},disabled:N,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[N?(0,M.jsx)(c,{size:16,className:`spin`}):(0,M.jsx)(d,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Dt(),G(!1)},disabled:F||!W,title:W?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[F?R&&R.total>0?(0,M.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(R.loaded/R.total*100),`%`]}):(0,M.jsx)(c,{size:16,className:`spin`}):(0,M.jsx)(he,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ge(e=>!e),qe(``),$e(null),G(!1)},disabled:F||!W,title:W?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,M.jsx)(le,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{yt(O===`grid`?`list`:`grid`),G(!1)},title:O===`grid`?`List view`:`Grid view`,"aria-label":O===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":O===`grid`,children:[O===`grid`?(0,M.jsx)(fe,{size:16}):(0,M.jsx)(de,{size:16}),(0,M.jsx)(`span`,{className:`data-action-label`,children:O===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,M.jsxs)(`div`,{className:`data-breadcrumbs`,children:[w!==`.`&&(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:ut,title:`Up one level`,"aria-label":`Up one level`,children:(0,M.jsx)(se,{size:14})}),It?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,ref:nt,children:[(0,M.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>tt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":et,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),et&&(0,M.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Lt.map(e=>(0,M.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>q(e.name),title:e.label,children:e.label},e.name))})]}),[j.length-2,j.length-1].map(e=>{let t=j[e];return(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,M.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Ft(e)),title:t.name,children:t.displayName??t.name})]},Ft(e))})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(`.`),children:`data`}),j.map((e,t)=>(0,M.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,M.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,M.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Ft(t)),title:e.name,children:e.displayName??e.name})]},Ft(t)))]})]}),We&&(0,M.jsxs)(`div`,{className:`data-inline-form`,children:[(0,M.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:Ke,autoFocus:!0,onChange:e=>qe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Nt(),e.key===`Escape`&&Ge(!1)}}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Nt,children:`Create`}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>Ge(!1),children:`Cancel`})]}),Je&&(0,M.jsxs)(`div`,{className:`data-inline-form`,children:[(0,M.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:Xe,autoFocus:!0,onChange:e=>Ze(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Pt(),e.key===`Escape`&&Ye(null)}}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Pt,children:`Rename`}),(0,M.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>Ye(null),children:`Cancel`})]}),Qe&&(0,M.jsx)(`div`,{className:`data-error`,children:Qe}),(0,M.jsx)(`input`,{type:`file`,ref:Be,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&kt(t)}})]}),(0,M.jsxs)(`div`,{className:`data-body`,"data-drag-active":Pe?`true`:void 0,onDragEnter:At,onDragOver:At,onDragLeave:jt,onDrop:Mt,children:[(te!==null||h!==null)&&(0,M.jsxs)(`section`,{className:`data-panel admin-card`,children:[te&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,te]}),at.length>0&&(0,M.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:at.map(e=>{let t=e===K;return(0,M.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>S(t?null:e),children:Re([e])??e},e)})}),h&&!y&&(0,M.jsxs)(`div`,{className:`data-results-meta`,children:[ot.length,` of `,h.length,` result`,h.length===1?``:`s`]}),h&&!y&&!K&&ie>0&&!C&&(0,M.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[ie,` low-confidence result`,ie===1?``:`s`,` hidden — show all`]}),h&&!y&&!K&&C&&(0,M.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),h&&h.length===0&&!y&&(0,M.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),ot&&ot.length>0&&(0,M.jsx)(`ul`,{className:`data-results`,children:ot.map(e=>(0,M.jsx)(Le,{hit:e,mode:_,onDownload:st,onLocate:lt},e.nodeId))})]}),(0,M.jsxs)(`section`,{className:`data-panel admin-card`,children:[R&&(0,M.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R.total>0?Math.round(R.loaded/R.total*100):void 0,children:[(0,M.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,M.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${R.total>0?Math.round(R.loaded/R.total*100):0}%`}})}),(0,M.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,R.total>0?`${Math.round(R.loaded/R.total*100)}%`:``]})]}),De&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,De]}),Ae&&(0,M.jsx)(`div`,{className:`data-status`,children:Ae}),Ie&&(0,M.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Ie]}),ye&&(0,M.jsx)(`div`,{className:`data-error`,children:ye}),N&&(0,M.jsxs)(`div`,{className:`data-loading`,children:[(0,M.jsx)(c,{size:14,className:`spin`}),` Loading…`]}),!J&&!N&&D&&D.length>0&&(0,M.jsxs)(`div`,{className:`data-select-hint`,children:[(0,M.jsx)(pe,{size:13}),(0,M.jsx)(`span`,{children:`Press and hold a file to select, rename, or delete it.`})]}),!N&&D&&D.length===0&&!ye&&(0,M.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!N&&D&&D.length>0&&O===`grid`&&(0,M.jsx)(`ul`,{className:`data-grid`,children:D.map(e=>{let t=e.displayName??e.name,r=J&&Y.has(e.name);if(e.kind===`directory`)return(0,M.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(w===`.`?e.name:`${w}/${e.name}`)},children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsx)(o,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t})]})},e.name);if(e.kind===`file`){let i=Ce(B(e)),a=w===`.`?B(e):`${w}/${B(e)}`;return(0,M.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?bt(e):vt(e),title:J?void 0:i?`Preview ${t}`:`Download ${t}`,children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,M.jsx)(`img`,{className:`data-grid-thumb`,src:I(n,a),alt:t,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,M.jsx)(re,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t}),!i&&(0,M.jsx)(`span`,{className:`data-grid-sub`,children:He(e.sizeBytes)})]})},e.name)}return(0,M.jsx)(`li`,{className:`data-grid-cell`,children:(0,M.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,M.jsx)(re,{size:28,className:`data-grid-glyph`}),(0,M.jsx)(`span`,{className:`data-grid-label`,children:t}),(0,M.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!N&&D&&D.length>0&&O===`list`&&(0,M.jsx)(`ul`,{className:`data-entries`,children:D.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=J&&Y.has(e.name);return(0,M.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(w===`.`?e.name:`${w}/${e.name}`)},children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsx)(o,{size:14}),(0,M.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=J&&Y.has(e.name);return(0,M.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,M.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>_t(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>vt(e),title:J?void 0:`Download ${t}`,children:[J&&(0,M.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,M.jsxs)(`span`,{className:`data-entry-text`,children:[(0,M.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,M.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Ue(e.modifiedAt)}`,children:[He(e.sizeBytes),` · `,Ue(e.modifiedAt)]})]})]})},e.name)}return(0,M.jsx)(`li`,{className:`data-entry`,children:(0,M.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,M.jsxs)(`span`,{className:`data-entry-text`,children:[(0,M.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,M.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]}),J&&(0,M.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,M.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Et,disabled:!ht||Y.size===0,title:ht?`Share selected files`:`Sharing is not supported on this device`,children:[(0,M.jsx)(ne,{size:16}),` Share`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:wt,disabled:Y.size===0,children:[(0,M.jsx)(t,{size:16}),` Download`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=St();e&&(Ye(e.name),Ze(e.name))},disabled:!St(),children:[(0,M.jsx)(s,{size:16}),` Rename`]}),(0,M.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Tt,disabled:Y.size===0,children:[(0,M.jsx)(l,{size:16}),` Delete`]})]})}),k&&(0,M.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":k.alt,onClick:()=>ge(null),children:(0,M.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:k.src,alt:k.alt})})]})}function Fe({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){(0,A.useEffect)(()=>{console.info(`[data-ui] op=mount header=operator home=absent`)},[]);let r=(0,A.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),i=(0,A.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[a,o]=(0,A.useState)([]),[s,c]=(0,A.useState)(`files`),{subAccounts:l,activeAccountId:u,switching:d,switchAccount:f}=v(t);return(0,A.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||o(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,M.jsxs)(`main`,{className:`data-main`,children:[(0,M.jsx)(p,{variant:`operator`,onNavigate:i,onOpenConversations:a.length>0?()=>c(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:l,activeAccountId:u,switchingAccount:d,onSwitchAccount:f}),s===`conversations`?(0,M.jsx)(R,{conversations:a,sessionKey:t,onBack:()=>c(`files`)}):(0,M.jsx)(Pe,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function Ie({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,M.jsx)(`div`,{className:`data-page`,children:(0,M.jsx)(`main`,{className:`data-main`,children:(0,M.jsx)(Pe,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function Le({hit:e,mode:t,onDownload:n,onLocate:r}){let i=ze(e.properties),a=Be(e.properties),s=Re(e.labels),c=Ve(e.properties),[l,u]=(0,A.useState)(!1),d=a&&a.length>280,f=l||!d?a:a?.slice(0,280)+`…`,p=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,m=e.properties.relativePath,h=typeof m==`string`&&m.length>0,g=h?m.lastIndexOf(`/`):-1,_=h?g===-1?`data`:m.slice(0,g):null;return(0,M.jsxs)(`li`,{className:`data-result`,children:[(0,M.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??s??`file`}`,children:[s&&(0,M.jsx)(`div`,{className:`data-result-header`,children:(0,M.jsx)(`span`,{className:`data-result-labels`,children:s})}),i&&(0,M.jsx)(`div`,{className:`data-result-title`,children:i}),a&&(0,M.jsx)(`pre`,{className:`data-result-body`,children:f}),(0,M.jsxs)(`div`,{className:`data-result-scores`,children:[c&&(0,M.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Ue(c),` · `]}),p]})]}),h&&(0,M.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${_}`,"aria-label":`Locate in ${_}`,children:[(0,M.jsx)(o,{size:12}),_]}),d&&(0,M.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>u(e=>!e),children:l?`Show less`:`Show more`})]})}function Re(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 ze(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 Be(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 Ve(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 He(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 Ue(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`—`}}export{k as a,F as i,Ie as n,xe as r,De as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-fQC6bEKA.js";import{B as t,G as n,U as r}from"./useSubAccountSwitcher-Bc7XHr0L.js";import"./useVoiceRecorder-
|
|
1
|
+
import{o as e}from"./chunk-fQC6bEKA.js";import{B as t,G as n,U as r}from"./useSubAccountSwitcher-Bc7XHr0L.js";import"./useVoiceRecorder-Cj-VZDKO.js";import{b as i}from"./AdminShell-BFVVkWFC.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-C-5sTAE-.js";import"./useCopyFeedback-DHCtz8qX.js";var d=r(),f=e(n(),1),p=t();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&(sessionStorage.setItem(s,e),o&&console.info(`[public-webchat] op=seed-persisted len=${e.length} head=${e.slice(0,40)}`))}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
|
package/payload/server/public/assets/{useVoiceRecorder-Cu6zvuFx.js → useVoiceRecorder-Cj-VZDKO.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-render-fJz4vym9.js","assets/preload-helper-DL2DwvxV.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-fQC6bEKA.js";import{A as t,B as n,F as r,G as i,g as a,r as o}from"./useSubAccountSwitcher-Bc7XHr0L.js";import{n as s,t as c}from"./maximize-2-BbzPm7o8.js";import{n as l,t as u}from"./time-entry-format-BreNpFLJ.js";import{t as d}from"./preload-helper-DL2DwvxV.js";var f=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/x-m4a,audio/mpeg,audio/webm,audio/wav,video/mp4,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp4,.mp3,.wav,.webm`,p=new Set(f.split(`,`).filter(e=>!e.startsWith(`.`))),m=50*1024*1024;function h(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var g=r(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),_=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),v=r(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),y=r(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=r(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),x=r(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),S=r(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),C=e(i(),1),w=n();function T({children:e,tail:t=null,repinSignals:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(0),l=(0,C.useRef)(0),u=()=>{let e=r.current;if(!e)return;let t=e.clientHeight,n=e.scrollHeight,i=t!==c.current||n!==l.current;if(c.current=t,l.current=n,i){a.current&&(e.scrollTop=e.scrollHeight);return}let o=n-e.scrollTop-t<=32;a.current=o,s(e=>e===o?e:o)},d=()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,l.current=e.scrollHeight,c.current=e.clientHeight,a.current=!0,s(!0))},f=t!=null;return(0,C.useLayoutEffect)(()=>{let e=r.current;e&&a.current&&(e.scrollTop=e.scrollHeight),e&&(l.current=e.scrollHeight,c.current=e.clientHeight)},[...n,f]),(0,C.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return r.current&&e.observe(r.current),i.current&&e.observe(i.current),()=>e.disconnect()},[]),(0,w.jsxs)(`div`,{className:`wa-reader`,children:[(0,w.jsx)(`div`,{className:`wa-reader-thread`,ref:r,onScroll:u,children:(0,w.jsxs)(`div`,{className:`wa-thread-scroll`,ref:i,children:[e,t]})}),!o&&(0,w.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:d,"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}var E={auth_expired:`Your session has expired. Please sign in again.`,claude_down:`Claude is currently experiencing an outage. Please try again in a few minutes.`,claude_overloaded:`Claude is overloaded right now. Please try again shortly.`,model_unavailable:`The selected model is currently unavailable. Switch to a different model from the model picker to continue.`,agent_error:`Something went wrong. Please try again.`},D={auth_expired:`I'm not available right now. Please try again later.`,claude_down:`I'm not available right now. Please try again later.`,claude_overloaded:`I'm not available right now. Please try again shortly.`,model_unavailable:`I'm not available right now. Please try again later.`,agent_error:`I'm not available right now. Please try again later.`};function O(e,t=`admin`){return t===`public`?D[e]:E[e]}function k(e){return e===`whatsapp`?` · via WhatsApp`:e===`webchat`?` · via web`:``}var A=56,j=5;function ee(e,t){let n=Math.max(1,Math.floor(e.length/t)),r=[],i=0;for(let a=0;a<t;a++){let t=a*n,o=0,s=0;for(let r=t;r<t+n&&r<e.length;r++)o+=e[r]*e[r],s++;let c=s>0?Math.sqrt(o/s):0;r.push(c),c>i&&(i=c)}return i>0?r.map(e=>e/i):r}function te({src:e,filename:t,onDecodeFail:n,onMediaError:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),o=(0,C.useRef)(!1),[s,c]=(0,C.useState)([]),[d,f]=(0,C.useState)(void 0),[p,m]=(0,C.useState)(!1),[h,g]=(0,C.useState)(0),[_,v]=(0,C.useState)(0);(0,C.useEffect)(()=>{let t=!1,r=null,i=window.AudioContext??window.webkitAudioContext,a=()=>{t||o.current||(o.current=!0,n())};if(!i){a();return}let s=new i;return(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`audio fetch ${n.status}`);let i=await n.blob();if(t)return;r=URL.createObjectURL(i),f(r);let a=await s.decodeAudioData(await i.arrayBuffer());if(t)return;c(ee(a.getChannelData(0),A)),Number.isFinite(a.duration)&&a.duration>0&&v(a.duration)}catch{a()}finally{try{s.close()}catch{}}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]);let y=()=>{let e=i.current;e&&(p?e.pause():Promise.resolve(e.play()).catch(()=>{}))},b=e=>{let t=i.current;if(!t||!(_>0))return;let n=Math.min(_,Math.max(0,e));t.currentTime=n,g(n)},S=e=>{let t=a.current;if(!t||!(_>0))return;let n=t.getBoundingClientRect();b(Math.min(1,Math.max(0,(e-n.left)/n.width))*_)},T=e=>{S(e.clientX);let t=e=>S(e.clientX),n=()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},E=e=>{if(!(_>0))return;let t=i.current?.currentTime??0;switch(e.key){case`ArrowRight`:case`ArrowUp`:b(t+j),e.preventDefault();break;case`ArrowLeft`:case`ArrowDown`:b(t-j),e.preventDefault();break;case`Home`:b(0),e.preventDefault();break;case`End`:b(_),e.preventDefault();break;default:break}},D=_>0?Math.min(1,h/_):0,O=Math.round(D*A),k=u(h>0?h:_);return(0,w.jsxs)(`div`,{className:`voice-note`,children:[(0,w.jsx)(`button`,{type:`button`,className:`voice-note-play`,"aria-label":`${p?`Pause`:`Play`} ${t}`,onClick:y,children:p?(0,w.jsx)(x,{size:16,"aria-hidden":!0}):(0,w.jsx)(l,{size:16,"aria-hidden":!0})}),(0,w.jsx)(`div`,{ref:a,className:`voice-note-bars`,role:`slider`,tabIndex:0,"aria-label":`Seek ${t}`,"aria-valuemin":0,"aria-valuemax":Math.round(_),"aria-valuenow":Math.round(h),onMouseDown:T,onKeyDown:E,children:(s.length?s:Array.from({length:A},()=>0)).map((e,t)=>(0,w.jsx)(`span`,{className:`voice-note-bar${t<O?` is-played`:``}`,style:{height:`${Math.max(10,Math.round(e*100))}%`}},t))}),(0,w.jsx)(`span`,{className:`voice-note-time`,children:k}),(0,w.jsx)(`audio`,{ref:i,className:`voice-note-audio`,preload:`metadata`,src:d,"aria-label":t,onPlay:()=>m(!0),onPause:()=>m(!1),onEnded:()=>m(!1),onError:()=>r?.(),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&v(t)},onTimeUpdate:e=>g(e.currentTarget.currentTime)})]})}var M=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,N=/\.pdf$/i;function ne(e,t){return(t?t.startsWith(`image/`):M.test(e))?`image`:t&&t.startsWith(`audio/`)?`audio`:(t?t===`application/pdf`:N.test(e))?`pdf`:`file`}function P(e,t,n,r){let i=encodeURIComponent(e.path),a=encodeURIComponent(n),o=r?`&disposition=${r}`:``;return e.root===`scratchpad`?`/api/admin/files/download?path=${i}&root=scratchpad&sessionId=${encodeURIComponent(t)}&session_key=${a}${o}`:`/api/admin/files/download?path=${i}&root=data&session_key=${a}${o}`}function F(e,t,n,r){return t===`public`?`/api/public-reader/attachment/${e}?sessionId=${encodeURIComponent(n)}`:`/api/admin/attachment/${e}?session_key=${encodeURIComponent(r)}`}function I(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t<10?t.toFixed(1):Math.round(t)} KB`;let n=t/1024;return`${n<10?n.toFixed(1):Math.round(n)} MB`}function L({href:e,filename:t,label:n}){return(0,w.jsxs)(`a`,{className:`chat-attachment-chip`,href:e,download:t,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0}),n]})}function R({href:e,filename:n,className:r,size:i=14,onClick:a}){return(0,w.jsx)(`a`,{className:r,href:e,download:n,"aria-label":`Download ${n}`,onClick:a,children:(0,w.jsx)(t,{size:i,"aria-hidden":!0})})}function re({src:e,filename:t,sizeBytes:n,expandable:r,onFail:i}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(!1),l=n==null?t:`${t} · ${I(n)}`;return s?(0,w.jsx)(L,{href:e,filename:t,label:l}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`chat-attachment-image-wrap`,children:[(0,w.jsx)(`img`,{className:`chat-attachment-image`,src:e,alt:t,onClick:r?()=>o(!0):void 0,onError:()=>{c(!0),i?.(`fetch`)}}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`})]}),r&&a&&(0,w.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:()=>o(!1),children:(0,w.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:e,alt:t})})]})}var ie=280,ae=360,oe=16;function z({src:e,filename:t,sizeBytes:n,onFail:r}){let[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=n==null?t:`${t} · ${I(n)}`;return(0,C.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{let{loadPdf:r,renderPageToFit:i}=await d(async()=>{let{loadPdf:e,renderPageToFit:t}=await import(`./pdf-render-fJz4vym9.js`);return{loadPdf:e,renderPageToFit:t}},__vite__mapDeps([0,1])),a=await r(e);n=a;let o=l.current;if(t||!o)return;await i(a,1,o,ie,ae)}catch{t||(s(!0),r?.(`render`))}})(),()=>{t=!0;try{n?.destroy()}catch{}}},[e]),o?(0,w.jsx)(L,{href:e,filename:t,label:u}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`chat-attachment-pdf`,children:[(0,w.jsx)(`canvas`,{ref:l,className:`chat-attachment-pdf-canvas`,"aria-label":t}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-pdf-expand`,"aria-label":`Expand ${t}`,onClick:()=>a(!0),children:(0,w.jsx)(c,{size:14,"aria-hidden":!0})})]}),i&&(0,w.jsx)(se,{src:e,filename:t,label:u,onClose:()=>a(!1),onFail:r})]})}function se({src:e,filename:t,label:n,onClose:r,onFail:i}){let o=(0,C.useRef)(null),s=(0,C.useRef)(null),[c,l]=(0,C.useState)(null),[u,f]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let t=!1;return(async()=>{try{let{loadPdf:n}=await d(async()=>{let{loadPdf:e}=await import(`./pdf-render-fJz4vym9.js`);return{loadPdf:e}},__vite__mapDeps([0,1])),r=await n(e);if(t){try{r.destroy()}catch{}return}s.current=r,l(r.numPages)}catch{t||(f(!0),i?.(`render`))}})(),()=>{t=!0;try{s.current?.destroy()}catch{}}},[e]),(0,C.useEffect)(()=>{if(c==null)return;let e=o.current,t=s.current;if(!e||!t)return;let n=!1;return(async()=>{try{let{renderPageToWidth:r}=await d(async()=>{let{renderPageToWidth:e}=await import(`./pdf-render-fJz4vym9.js`);return{renderPageToWidth:e}},__vite__mapDeps([0,1])),i=Array.from(e.querySelectorAll(`canvas.chat-attachment-overlay-page`)),a=Math.max(e.clientWidth-oe*2,1);for(let e=0;e<i.length;e++){if(n)return;await r(t,e+1,i[e],a)}}catch{n||(f(!0),i?.(`render`))}})(),()=>{n=!0}},[c]),(0,w.jsxs)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:r,children:[(0,w.jsx)(`div`,{ref:o,className:`chat-attachment-overlay-pdf`,onClick:e=>e.stopPropagation(),children:u?(0,w.jsx)(L,{href:e,filename:t,label:n}):Array.from({length:c??0},(e,n)=>(0,w.jsx)(`canvas`,{className:`chat-attachment-overlay-page`,"aria-label":`${t} page ${n+1}`},n))}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-overlay-download`,size:20,onClick:e=>e.stopPropagation()}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-overlay-close`,"aria-label":`Close`,onClick:r,children:(0,w.jsx)(a,{size:20,"aria-hidden":!0})})]})}function ce({src:e,filename:t,onFail:n}){let[r,i]=(0,C.useState)(!1);return r?(0,w.jsx)(`audio`,{className:`chat-attachment-audio`,controls:!0,preload:`metadata`,src:e,"aria-label":t,onError:()=>n?.(`fetch`)}):(0,w.jsx)(te,{src:e,filename:t,onDecodeFail:()=>{i(!0),n?.(`render`)},onMediaError:()=>{i(!0),n?.(`fetch`)}})}function B({filename:e,href:t,mimeType:n,sizeBytes:r,expandable:i,telemetry:a}){let o=ne(e,n);(0,C.useEffect)(()=>{a?.onRender?.({kind:o,mime:n,served:!!t})},[]);let s=a?.onFail?e=>a.onFail({kind:o===`pdf`?`pdf`:o===`audio`?`audio`:`image`,mime:n,reason:e}):void 0;if(o===`image`&&t)return(0,w.jsx)(re,{src:t,filename:e,sizeBytes:r,expandable:i,onFail:s});if(o===`audio`&&t)return(0,w.jsx)(ce,{src:t,filename:e,onFail:s});if(o===`pdf`&&t)return(0,w.jsx)(z,{src:t,filename:e,sizeBytes:r,onFail:s});let c=r==null?e:`${e} · ${I(r)}`;return t?(0,w.jsx)(L,{href:t,filename:e,label:c}):(0,w.jsxs)(`p`,{className:`chat-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,c]})}function le(e,t,n,r=`/api/whatsapp-reader/stream`,i=e,a=!0){let[o,s]=(0,C.useState)([]),[c,l]=(0,C.useState)(`open`),[u,d]=(0,C.useState)(null),f=(0,C.useRef)([]);return(0,C.useEffect)(()=>{f.current=o},[o]),(0,C.useEffect)(()=>{s([]),f.current=[],d(null)},[i,t,n,r]),(0,C.useEffect)(()=>{if(l(`open`),!a)return;let i=f.current.slice(),o=i.map(V),c=0,u=i.length>0,p=`${r}?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,m=new EventSource(p);return m.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),l(`open`)},m.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(u){if(c<o.length&&V(t)===o[c]){c+=1;return}u=!1}s(e=>[...e,t])},m.addEventListener(`activity`,e=>{try{d(JSON.parse(e.data))}catch{}}),m.addEventListener(`activity-clear`,()=>d(null)),m.onerror=()=>{m.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${m.readyState}`),l(`error`))},()=>m.close()},[e,t,n,r,i,a]),{turns:o,status:c,subagentActivity:u}}function V(e){return JSON.stringify(e)}function ue(e,t,n,r=!0){let[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(`open`);return(0,C.useEffect)(()=>{if(a([]),s(`open`),!r||!e||!t)return;let i=`/api/whatsapp-reader/store-stream?accountId=${encodeURIComponent(e)}&remoteJid=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,o=new EventSource(i);return o.onopen=()=>s(`open`),o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>[...e,t])},o.addEventListener(`reaction`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>e.map(e=>e.kind===`whatsapp-persisted`&&e.msgKeyId===t.targetMsgKeyId?{...e,reactions:t.reactions}:e))}),o.onerror=()=>{o.readyState===2&&s(`error`)},()=>o.close()},[e,t,n,r]),{turns:i,status:o}}var H=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function de(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:H(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:H(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function fe(e,t,n=!0){let[r,i]=(0,C.useState)([]);return(0,C.useEffect)(()=>{if(!n||typeof fetch!=`function`)return;let r=!0,a=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(a).then(e=>e.ok?e.json():{entries:[]}).then(e=>{r&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{r&&i([])}),()=>{r=!1}},[e,t,n]),r}var pe=new Set([`operator-inbound`,`operator-typed`,`agent-reply`,`agent-reply-document`,`agent-file`,`agent-error`,`agent-webchat-final`,`whatsapp-persisted`]);function U(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function W(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}var me=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],he=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function G(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function K(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:G(t)}function ge(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=G(n);if(r===G(t))return`Today`;let i=new Date(t);return i.setDate(i.getDate()-1),r===G(i)?`Yesterday`:`${me[n.getDay()]} ${n.getDate()} ${he[n.getMonth()]} ${n.getFullYear()}`}function q(e){return e.kind===`turn`?e.turn.ts:e.entry.ts}function J({ts:e}){return(0,w.jsx)(`div`,{className:`day-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`day-divider-label`,children:ge(e)})})}function Y(){return(0,w.jsx)(`div`,{className:`session-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`session-divider-label`,children:`Conversation continued`})})}function X({label:e,ts:t}){return(0,w.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,w.jsx)(`span`,{className:`wa-who`,children:e}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(t)})]})}function _e({turn:e}){let[t,n]=(0,C.useState)(!1),r=e.kind===`tool-result`,i=r?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,a=r?e.isError?`result (error)`:`result`:`↳ ${e.name}`,o=r?e.text:JSON.stringify(e.input,null,2);return(0,w.jsxs)(`div`,{className:i,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,w.jsx)(`span`,{className:`wa-who`,children:a}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),t&&(0,w.jsx)(`pre`,{className:`wa-code`,children:o})]})}function Z({entry:e,sessionId:t,sessionKey:n}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=()=>{let s=!r;if(i(s),s&&a===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(o).catch(()=>o(`(directive unavailable)`))}};return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":r,onClick:s,children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:r?`▾`:`▸`}),(0,w.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),r&&(0,w.jsx)(`pre`,{className:`wa-code`,children:a??`Loading…`})]})}function ve(e){return`text`in e&&typeof e.text==`string`?e.text:``}function ye(e,t){let n=(t??``).trim();if(!n)return e;let r=e.toLowerCase(),i=n.toLowerCase(),a=[],o=0,s=0;for(;;){let t=r.indexOf(i,o);if(t===-1){a.push(e.slice(o));break}t>o&&a.push(e.slice(o,t)),a.push((0,w.jsx)(`mark`,{className:`wa-search-hit`,children:e.slice(t,t+i.length)},s++)),o=t+i.length}return a.length===1?a[0]:(0,w.jsx)(w.Fragment,{children:a})}var Q={onRender:({kind:e,mime:t,served:n})=>console.info(`[operator-ui] op=reader-attachment kind=${e} mime=${t??``} served=${n}`),onFail:({kind:e,mime:t,reason:n})=>console.info(`[operator-ui] op=reader-attachment-fail kind=${e} mime=${t??``} reason=${n}`)};function be(e,t,n){switch(e.kind){case`operator-inbound`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,w.jsx)(X,{label:`Operator${k(e.source)}`,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.text}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))})]},t);case`operator-typed`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,w.jsx)(X,{label:`Operator (web)`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsxs)(`p`,{className:`wa-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,`sent document(s): `,e.files.map(W).join(`, `)]}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`agent-file`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),e.files.map((t,r)=>{let i=W(t),a=e.downloads?.[r];return(0,w.jsx)(B,{expandable:!0,filename:i,href:a?P(a,n.sessionId,n.sessionKey,N.test(i)?`inline`:void 0):void 0,telemetry:Q},r)}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`whatsapp-persisted`:{let r=e.origin===`operator-manual`,i=e.fromMe?r?`You`:`Sent`:e.senderName??`Contact`;return(0,w.jsxs)(`div`,{className:`wa-turn ${e.fromMe?`wa-turn-out`:`wa-turn-in`}${r?` wa-op-manual`:``}`,children:[n.onReplyTo&&e.msgKeyId&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-reply`,"aria-label":`Reply to this message`,onClick:()=>n.onReplyTo({msgKeyId:e.msgKeyId,body:e.text,senderName:e.senderName,fromMe:e.fromMe}),children:(0,w.jsx)(S,{size:14})}),n.showCopy&&e.text&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-copy`,"aria-label":`Copy this message`,onClick:()=>{let t=e.text;o(t).then(e=>e?console.info(`[operator-ui] op=wa-copy len=${t.length} ok=true`):console.warn(`[operator-ui] op=wa-copy-fail reason=clipboard-unavailable`))},children:(0,w.jsx)(s,{size:14})}),e.quoted&&(0,w.jsxs)(`div`,{className:`wa-quoted`,children:[(0,w.jsx)(`span`,{className:`wa-quoted-who`,children:e.quoted.fromMe?`You`:e.quoted.sender??`Contact`}),(0,w.jsx)(`span`,{className:`wa-quoted-body`,children:e.quoted.body||`Message`})]}),(0,w.jsx)(X,{label:i,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:ye(e.text,n.highlight)}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))}),e.reactions&&e.reactions.length>0&&(0,w.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,w.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,w.jsxs)(`span`,{className:`wa-bubble-meta`,children:[r&&(0,w.jsx)(`span`,{className:`wa-op-tag`,children:`You`}),(0,w.jsx)(`time`,{className:`wa-bubble-time`,children:U(e.ts)}),e.fromMe&&(0,w.jsx)(g,{size:14,className:`wa-bubble-tick`,"aria-hidden":!0})]})]},t)}case`session-continued`:return(0,w.jsx)(Y,{},t);case`harness-internal`:return null;case`tool-call`:case`tool-result`:return(0,w.jsx)(_e,{turn:e},t);case`agent-error`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-error`,role:`alert`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body wa-error-body`,children:O(e.code,`admin`)}),e.code===`agent_error`&&e.raw&&(0,w.jsx)(`pre`,{className:`wa-code`,children:e.raw})]},t)}}function $(e,t,n,r=`admin`,i,a,o){let s={sessionId:t,sessionKey:n,audience:r,highlight:i,onReplyTo:a,showCopy:o},c=[],l=null;return e.forEach((e,r)=>{let i=q(e),a=K(i);a!==null&&a!==l&&(c.push((0,w.jsx)(J,{ts:i},`day-${r}`)),l=a),c.push(e.kind===`turn`?be(e.turn,r,s):(0,w.jsx)(Z,{entry:e.entry,sessionId:t,sessionKey:n},r))}),c}function xe(e){return e.filter(e=>e.kind===`turn`&&pe.has(e.turn.kind))}var Se=(0,C.memo)(function({sessionId:e,projectDir:t,sessionKey:n,renderItems:r=$,clean:i,onToggleClean:a,forceDeliveredOnly:o=!1,streamEndpoint:s=`/api/whatsapp-reader/stream`,suppressDirectives:c=!1,tail:l=null,resetKey:u,onTurnsChange:d,onActivityChange:f,store:p,search:m,onReplyTo:h}){let g=!!p,_=le(e,t,n,s,u,!g),v=ue(p?.accountId??``,p?.remoteJid??``,n,g),{turns:y,status:b}=g?{turns:v.turns,status:v.status}:{turns:_.turns,status:_.status},x=g?null:_.subagentActivity;(0,C.useEffect)(()=>{f?.(x)},[x,f]),(0,C.useEffect)(()=>{d?.(y.length)},[y.length,d]);let S=de(y,fe(e,n,!c)),E=a==null?!1:!!i,D=o||E?xe(S):S,O=(m??``).trim().toLowerCase(),k=O.length>0,A=k?D.filter(e=>e.kind===`turn`&&ve(e.turn).toLowerCase().includes(O)):D,j=k?D.filter(e=>e.kind===`turn`).length:0;return(0,C.useEffect)(()=>{k&&console.info(`[operator-ui] op=wa-search q=${O} matches=${A.length} ofTurns=${j}`)},[O,k,A.length,j]),(0,w.jsxs)(T,{repinSignals:[y,E,k],tail:l,children:[b===`error`&&(0,w.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),!k&&y.length===0&&b===`open`&&(0,w.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),k&&A.length===0&&(0,w.jsxs)(`div`,{className:`wa-reader-placeholder`,children:[`No matches for "`,m,`".`]}),g?$(A,e,n,`admin`,m,h,!0):r(D,e,n)]})});function Ce(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}var we=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Te(){for(let e of we)if(MediaRecorder.isTypeSupported(e))return e;return``}function Ee(e){return e.split(`;`)[0]}async function De(){return typeof navigator>`u`||!navigator.mediaDevices?.enumerateDevices?[]:(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`)}function Oe(e){let[t,n]=(0,C.useState)(`idle`),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)([]),f=(0,C.useRef)(``),p=(0,C.useRef)(null),m=(0,C.useRef)(0),h=(0,C.useRef)(0),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(0),y=(0,C.useCallback)(()=>{if(p.current&&=(clearInterval(p.current),null),v.current&&=(cancelAnimationFrame(v.current),0),l.current&&l.current.state!==`inactive`)try{l.current.stop()}catch{}l.current=null,d.current=[],u.current&&=(u.current.getTracks().forEach(e=>e.stop()),null),g.current&&(g.current.close().catch(()=>{}),g.current=null,_.current=null),h.current=0,m.current=0},[]);(0,C.useEffect)(()=>y,[y]);let b=(0,C.useCallback)(()=>{m.current=Date.now(),p.current=setInterval(()=>{let e=Date.now()-m.current,t=h.current+e;i(Math.floor(t/1e3))},200)},[]),x=(0,C.useCallback)(()=>{p.current&&=(clearInterval(p.current),null);let e=Date.now()-m.current;h.current+=e},[]),S=(0,C.useCallback)(()=>{let e=_.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),o(new Uint8Array(t)),v.current=requestAnimationFrame(n)};n()},[]),w=(0,C.useCallback)(()=>{v.current&&=(cancelAnimationFrame(v.current),0)},[]),T=e?.onResult,E=(0,C.useCallback)(async e=>{if(!(t!==`idle`&&t!==`error`)){if(c(null),typeof window<`u`&&!window.isSecureContext){n(`error`),c(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){n(`error`),c(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){n(`error`),c(`Voice recording is not supported in this browser.`);return}try{let t=e?{audio:{deviceId:{exact:e}}}:{audio:!0},r;try{r=await navigator.mediaDevices.getUserMedia(t)}catch(t){let n=t?.name;if(e&&(n===`OverconstrainedError`||n===`NotFoundError`))r=await navigator.mediaDevices.getUserMedia({audio:!0});else throw t}u.current=r;let a=new AudioContext;g.current=a;let s=a.createMediaStreamSource(r),c=a.createAnalyser();c.fftSize=256,s.connect(c),_.current=c;let p=Te();f.current=p;let m=new MediaRecorder(r,p?{mimeType:p}:void 0);l.current=m,d.current=[],m.ondataavailable=e=>{e.data.size>0&&d.current.push(e.data)},r.getAudioTracks()[0]?.addEventListener(`ended`,()=>{y(),n(`idle`),i(0),o(null)}),m.start(1e3),n(`recording`),i(0),b(),S(),T?.({ok:!0})}catch(e){y(),n(`error`),e instanceof DOMException?(T?.({ok:!1,name:e.name,message:e.message}),e.name===`NotAllowedError`?c(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?c(`No microphone found. Connect a microphone to use voice recording.`):e.name===`NotReadableError`?c(`The microphone could not be started even though access was granted. The browser reported: ${e.message} (${e.name}).`):c(`Microphone error (${e.name}): ${e.message}`)):(T?.({ok:!1}),c(`Could not start recording.`))}}},[t,y,b,S,T]),D=(0,C.useCallback)(()=>{let e=l.current;e&&(t===`recording`&&e.state===`recording`?(e.pause(),x(),w(),n(`paused`)):t===`paused`&&e.state===`paused`&&(e.resume(),b(),S(),n(`recording`)))},[t,x,b,S,w]),O=(0,C.useCallback)(()=>{t!==`recording`&&t!==`paused`||(y(),n(`idle`),i(0),o(null))},[t,y]),k=(0,C.useCallback)(async()=>{if(t!==`recording`&&t!==`paused`)return null;let e=l.current;if(!e)return null;let r=t===`recording`?Date.now()-m.current:0;return h.current+r<1e3?(O(),null):(n(`sending`),x(),w(),new Promise(t=>{e.onstop=()=>{let r=f.current||e.mimeType||`audio/webm`,a=new Blob(d.current,{type:Ee(r)});y(),n(`idle`),i(0),o(null),t(a.size>0?a:null)},e.stop()}))},[t,O,x,w,y]);return(0,C.useEffect)(()=>{if(t!==`error`)return;let e=setTimeout(()=>{n(`idle`),c(null)},8e3);return()=>clearTimeout(e)},[t]),{state:t,elapsedSeconds:r,waveform:a,errorMessage:s,start:E,togglePause:D,discard:O,send:k}}export{_ as C,h as D,p as E,v as S,m as T,P as _,Z as a,b,W as c,q as d,B as f,F as g,N as h,J as i,K as l,M as m,Oe as n,Y as o,z as p,Ce as r,Se as s,De as t,U as u,O as v,f as w,y as x,x as y};
|
|
2
|
+
import{o as e}from"./chunk-fQC6bEKA.js";import{A as t,B as n,F as r,G as i,g as a,r as o}from"./useSubAccountSwitcher-Bc7XHr0L.js";import{n as s,t as c}from"./maximize-2-BbzPm7o8.js";import{n as l,t as u}from"./time-entry-format-BreNpFLJ.js";import{t as d}from"./preload-helper-DL2DwvxV.js";var f=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/x-m4a,audio/mpeg,audio/webm,audio/wav,video/mp4,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp4,.mp3,.wav,.webm`,p=new Set(f.split(`,`).filter(e=>!e.startsWith(`.`))),m=50*1024*1024;function h(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var g=r(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),_=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),v=r(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),y=r(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=r(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),x=r(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),S=r(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),C=e(i(),1),w=n();function T({children:e,tail:t=null,repinSignals:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(0),l=(0,C.useRef)(0),u=()=>{let e=r.current;if(!e)return;let t=e.clientHeight,n=e.scrollHeight,i=t!==c.current||n!==l.current;if(c.current=t,l.current=n,i){a.current&&(e.scrollTop=e.scrollHeight);return}let o=n-e.scrollTop-t<=32;a.current=o,s(e=>e===o?e:o)},d=()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,l.current=e.scrollHeight,c.current=e.clientHeight,a.current=!0,s(!0))},f=t!=null;return(0,C.useLayoutEffect)(()=>{let e=r.current;e&&a.current&&(e.scrollTop=e.scrollHeight),e&&(l.current=e.scrollHeight,c.current=e.clientHeight)},[...n,f]),(0,C.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return r.current&&e.observe(r.current),i.current&&e.observe(i.current),()=>e.disconnect()},[]),(0,w.jsxs)(`div`,{className:`wa-reader`,children:[(0,w.jsx)(`div`,{className:`wa-reader-thread`,ref:r,onScroll:u,children:(0,w.jsxs)(`div`,{className:`wa-thread-scroll`,ref:i,children:[e,t]})}),!o&&(0,w.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:d,"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}var E={auth_expired:`Your session has expired. Please sign in again.`,claude_down:`Claude is currently experiencing an outage. Please try again in a few minutes.`,claude_overloaded:`Claude is overloaded right now. Please try again shortly.`,model_unavailable:`The selected model is currently unavailable. Switch to a different model from the model picker to continue.`,agent_error:`Something went wrong. Please try again.`},D={auth_expired:`I'm not available right now. Please try again later.`,claude_down:`I'm not available right now. Please try again later.`,claude_overloaded:`I'm not available right now. Please try again shortly.`,model_unavailable:`I'm not available right now. Please try again later.`,agent_error:`I'm not available right now. Please try again later.`};function O(e,t=`admin`){return t===`public`?D[e]:E[e]}function k(e){return e===`whatsapp`?` · via WhatsApp`:e===`webchat`?` · via web`:``}var A=56,j=5;function ee(e,t){let n=Math.max(1,Math.floor(e.length/t)),r=[],i=0;for(let a=0;a<t;a++){let t=a*n,o=0,s=0;for(let r=t;r<t+n&&r<e.length;r++)o+=e[r]*e[r],s++;let c=s>0?Math.sqrt(o/s):0;r.push(c),c>i&&(i=c)}return i>0?r.map(e=>e/i):r}function te({src:e,filename:t,onDecodeFail:n,onMediaError:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),o=(0,C.useRef)(!1),[s,c]=(0,C.useState)([]),[d,f]=(0,C.useState)(void 0),[p,m]=(0,C.useState)(!1),[h,g]=(0,C.useState)(0),[_,v]=(0,C.useState)(0);(0,C.useEffect)(()=>{let t=!1,r=null,i=window.AudioContext??window.webkitAudioContext,a=()=>{t||o.current||(o.current=!0,n())};if(!i){a();return}let s=new i;return(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`audio fetch ${n.status}`);let i=await n.blob();if(t)return;r=URL.createObjectURL(i),f(r);let a=await s.decodeAudioData(await i.arrayBuffer());if(t)return;c(ee(a.getChannelData(0),A)),Number.isFinite(a.duration)&&a.duration>0&&v(a.duration)}catch{a()}finally{try{s.close()}catch{}}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]);let y=()=>{let e=i.current;e&&(p?e.pause():Promise.resolve(e.play()).catch(()=>{}))},b=e=>{let t=i.current;if(!t||!(_>0))return;let n=Math.min(_,Math.max(0,e));t.currentTime=n,g(n)},S=e=>{let t=a.current;if(!t||!(_>0))return;let n=t.getBoundingClientRect();b(Math.min(1,Math.max(0,(e-n.left)/n.width))*_)},T=e=>{S(e.clientX);let t=e=>S(e.clientX),n=()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},E=e=>{if(!(_>0))return;let t=i.current?.currentTime??0;switch(e.key){case`ArrowRight`:case`ArrowUp`:b(t+j),e.preventDefault();break;case`ArrowLeft`:case`ArrowDown`:b(t-j),e.preventDefault();break;case`Home`:b(0),e.preventDefault();break;case`End`:b(_),e.preventDefault();break;default:break}},D=_>0?Math.min(1,h/_):0,O=Math.round(D*A),k=u(h>0?h:_);return(0,w.jsxs)(`div`,{className:`voice-note`,children:[(0,w.jsx)(`button`,{type:`button`,className:`voice-note-play`,"aria-label":`${p?`Pause`:`Play`} ${t}`,onClick:y,children:p?(0,w.jsx)(x,{size:16,"aria-hidden":!0}):(0,w.jsx)(l,{size:16,"aria-hidden":!0})}),(0,w.jsx)(`div`,{ref:a,className:`voice-note-bars`,role:`slider`,tabIndex:0,"aria-label":`Seek ${t}`,"aria-valuemin":0,"aria-valuemax":Math.round(_),"aria-valuenow":Math.round(h),onMouseDown:T,onKeyDown:E,children:(s.length?s:Array.from({length:A},()=>0)).map((e,t)=>(0,w.jsx)(`span`,{className:`voice-note-bar${t<O?` is-played`:``}`,style:{height:`${Math.max(10,Math.round(e*100))}%`}},t))}),(0,w.jsx)(`span`,{className:`voice-note-time`,children:k}),(0,w.jsx)(`audio`,{ref:i,className:`voice-note-audio`,preload:`metadata`,src:d,"aria-label":t,onPlay:()=>m(!0),onPause:()=>m(!1),onEnded:()=>m(!1),onError:()=>r?.(),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&v(t)},onTimeUpdate:e=>g(e.currentTarget.currentTime)})]})}var M=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,N=/\.pdf$/i;function ne(e,t){return(t?t.startsWith(`image/`):M.test(e))?`image`:t&&t.startsWith(`audio/`)?`audio`:(t?t===`application/pdf`:N.test(e))?`pdf`:`file`}function P(e,t,n,r){let i=encodeURIComponent(e.path),a=encodeURIComponent(n),o=r?`&disposition=${r}`:``;return e.root===`scratchpad`?`/api/admin/files/download?path=${i}&root=scratchpad&sessionId=${encodeURIComponent(t)}&session_key=${a}${o}`:`/api/admin/files/download?path=${i}&root=data&session_key=${a}${o}`}function F(e,t,n,r){return t===`public`?`/api/public-reader/attachment/${e}?sessionId=${encodeURIComponent(n)}`:`/api/admin/attachment/${e}?session_key=${encodeURIComponent(r)}`}function I(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t<10?t.toFixed(1):Math.round(t)} KB`;let n=t/1024;return`${n<10?n.toFixed(1):Math.round(n)} MB`}function L({href:e,filename:t,label:n}){return(0,w.jsxs)(`a`,{className:`chat-attachment-chip`,href:e,download:t,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0}),n]})}function R({href:e,filename:n,className:r,size:i=14,onClick:a}){return(0,w.jsx)(`a`,{className:r,href:e,download:n,"aria-label":`Download ${n}`,onClick:a,children:(0,w.jsx)(t,{size:i,"aria-hidden":!0})})}function re({src:e,filename:t,sizeBytes:n,expandable:r,onFail:i}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(!1),l=n==null?t:`${t} · ${I(n)}`;return s?(0,w.jsx)(L,{href:e,filename:t,label:l}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`chat-attachment-image-wrap`,children:[(0,w.jsx)(`img`,{className:`chat-attachment-image`,src:e,alt:t,onClick:r?()=>o(!0):void 0,onError:()=>{c(!0),i?.(`fetch`)}}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`})]}),r&&a&&(0,w.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:()=>o(!1),children:(0,w.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:e,alt:t})})]})}var ie=280,ae=360,oe=16;function z({src:e,filename:t,sizeBytes:n,onFail:r}){let[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=n==null?t:`${t} · ${I(n)}`;return(0,C.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{let{loadPdf:r,renderPageToFit:i}=await d(async()=>{let{loadPdf:e,renderPageToFit:t}=await import(`./pdf-render-fJz4vym9.js`);return{loadPdf:e,renderPageToFit:t}},__vite__mapDeps([0,1])),a=await r(e);n=a;let o=l.current;if(t||!o)return;await i(a,1,o,ie,ae)}catch{t||(s(!0),r?.(`render`))}})(),()=>{t=!0;try{n?.destroy()}catch{}}},[e]),o?(0,w.jsx)(L,{href:e,filename:t,label:u}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`chat-attachment-pdf`,children:[(0,w.jsx)(`canvas`,{ref:l,className:`chat-attachment-pdf-canvas`,"aria-label":t}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-pdf-expand`,"aria-label":`Expand ${t}`,onClick:()=>a(!0),children:(0,w.jsx)(c,{size:14,"aria-hidden":!0})})]}),i&&(0,w.jsx)(se,{src:e,filename:t,label:u,onClose:()=>a(!1),onFail:r})]})}function se({src:e,filename:t,label:n,onClose:r,onFail:i}){let o=(0,C.useRef)(null),s=(0,C.useRef)(null),[c,l]=(0,C.useState)(null),[u,f]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let t=!1;return(async()=>{try{let{loadPdf:n}=await d(async()=>{let{loadPdf:e}=await import(`./pdf-render-fJz4vym9.js`);return{loadPdf:e}},__vite__mapDeps([0,1])),r=await n(e);if(t){try{r.destroy()}catch{}return}s.current=r,l(r.numPages)}catch{t||(f(!0),i?.(`render`))}})(),()=>{t=!0;try{s.current?.destroy()}catch{}}},[e]),(0,C.useEffect)(()=>{if(c==null)return;let e=o.current,t=s.current;if(!e||!t)return;let n=!1;return(async()=>{try{let{renderPageToWidth:r}=await d(async()=>{let{renderPageToWidth:e}=await import(`./pdf-render-fJz4vym9.js`);return{renderPageToWidth:e}},__vite__mapDeps([0,1])),i=Array.from(e.querySelectorAll(`canvas.chat-attachment-overlay-page`)),a=Math.max(e.clientWidth-oe*2,1);for(let e=0;e<i.length;e++){if(n)return;await r(t,e+1,i[e],a)}}catch{n||(f(!0),i?.(`render`))}})(),()=>{n=!0}},[c]),(0,w.jsxs)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:r,children:[(0,w.jsx)(`div`,{ref:o,className:`chat-attachment-overlay-pdf`,onClick:e=>e.stopPropagation(),children:u?(0,w.jsx)(L,{href:e,filename:t,label:n}):Array.from({length:c??0},(e,n)=>(0,w.jsx)(`canvas`,{className:`chat-attachment-overlay-page`,"aria-label":`${t} page ${n+1}`},n))}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-overlay-download`,size:20,onClick:e=>e.stopPropagation()}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-overlay-close`,"aria-label":`Close`,onClick:r,children:(0,w.jsx)(a,{size:20,"aria-hidden":!0})})]})}function ce({src:e,filename:t,onFail:n}){let[r,i]=(0,C.useState)(!1);return r?(0,w.jsx)(`audio`,{className:`chat-attachment-audio`,controls:!0,preload:`metadata`,src:e,"aria-label":t,onError:()=>n?.(`fetch`)}):(0,w.jsx)(te,{src:e,filename:t,onDecodeFail:()=>{i(!0),n?.(`render`)},onMediaError:()=>{i(!0),n?.(`fetch`)}})}function B({filename:e,href:t,mimeType:n,sizeBytes:r,expandable:i,telemetry:a}){let o=ne(e,n);(0,C.useEffect)(()=>{a?.onRender?.({kind:o,mime:n,served:!!t})},[]);let s=a?.onFail?e=>a.onFail({kind:o===`pdf`?`pdf`:o===`audio`?`audio`:`image`,mime:n,reason:e}):void 0;if(o===`image`&&t)return(0,w.jsx)(re,{src:t,filename:e,sizeBytes:r,expandable:i,onFail:s});if(o===`audio`&&t)return(0,w.jsx)(ce,{src:t,filename:e,onFail:s});if(o===`pdf`&&t)return(0,w.jsx)(z,{src:t,filename:e,sizeBytes:r,onFail:s});let c=r==null?e:`${e} · ${I(r)}`;return t?(0,w.jsx)(L,{href:t,filename:e,label:c}):(0,w.jsxs)(`p`,{className:`chat-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,c]})}function le(e,t,n,r=`/api/whatsapp-reader/stream`,i=e,a=!0){let[o,s]=(0,C.useState)([]),[c,l]=(0,C.useState)(`open`),[u,d]=(0,C.useState)(null),f=(0,C.useRef)([]);return(0,C.useEffect)(()=>{f.current=o},[o]),(0,C.useEffect)(()=>{s([]),f.current=[],d(null)},[i,t,n,r]),(0,C.useEffect)(()=>{if(l(`open`),!a)return;let i=f.current.slice(),o=i.map(V),c=0,u=i.length>0,p=`${r}?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,m=new EventSource(p);return m.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),l(`open`)},m.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(u){if(c<o.length&&V(t)===o[c]){c+=1;return}u=!1}s(e=>[...e,t])},m.addEventListener(`activity`,e=>{try{d(JSON.parse(e.data))}catch{}}),m.addEventListener(`activity-clear`,()=>d(null)),m.onerror=()=>{m.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${m.readyState}`),l(`error`))},()=>m.close()},[e,t,n,r,i,a]),{turns:o,status:c,subagentActivity:u}}function V(e){return JSON.stringify(e)}function ue(e,t,n,r=!0){let[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(`open`);return(0,C.useEffect)(()=>{if(a([]),s(`open`),!r||!e||!t)return;let i=`/api/whatsapp-reader/store-stream?accountId=${encodeURIComponent(e)}&remoteJid=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,o=new EventSource(i);return o.onopen=()=>s(`open`),o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>[...e,t])},o.addEventListener(`reaction`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>e.map(e=>e.kind===`whatsapp-persisted`&&e.msgKeyId===t.targetMsgKeyId?{...e,reactions:t.reactions}:e))}),o.onerror=()=>{o.readyState===2&&s(`error`)},()=>o.close()},[e,t,n,r]),{turns:i,status:o}}var H=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function de(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:H(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:H(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function fe(e,t,n=!0){let[r,i]=(0,C.useState)([]);return(0,C.useEffect)(()=>{if(!n||typeof fetch!=`function`)return;let r=!0,a=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(a).then(e=>e.ok?e.json():{entries:[]}).then(e=>{r&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{r&&i([])}),()=>{r=!1}},[e,t,n]),r}var pe=new Set([`operator-inbound`,`operator-typed`,`agent-reply`,`agent-reply-document`,`agent-file`,`agent-error`,`agent-webchat-final`,`whatsapp-persisted`]);function U(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function W(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}var me=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],he=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function G(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function K(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:G(t)}function ge(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=G(n);if(r===G(t))return`Today`;let i=new Date(t);return i.setDate(i.getDate()-1),r===G(i)?`Yesterday`:`${me[n.getDay()]} ${n.getDate()} ${he[n.getMonth()]} ${n.getFullYear()}`}function q(e){return e.kind===`turn`?e.turn.ts:e.entry.ts}function J({ts:e}){return(0,w.jsx)(`div`,{className:`day-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`day-divider-label`,children:ge(e)})})}function Y(){return(0,w.jsx)(`div`,{className:`session-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`session-divider-label`,children:`Conversation continued`})})}function X({label:e,ts:t}){return(0,w.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,w.jsx)(`span`,{className:`wa-who`,children:e}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(t)})]})}function _e({turn:e}){let[t,n]=(0,C.useState)(!1),r=e.kind===`tool-result`,i=r?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,a=r?e.isError?`result (error)`:`result`:`↳ ${e.name}`,o=r?e.text:JSON.stringify(e.input,null,2);return(0,w.jsxs)(`div`,{className:i,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,w.jsx)(`span`,{className:`wa-who`,children:a}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),t&&(0,w.jsx)(`pre`,{className:`wa-code`,children:o})]})}function Z({entry:e,sessionId:t,sessionKey:n}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=()=>{let s=!r;if(i(s),s&&a===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(o).catch(()=>o(`(directive unavailable)`))}};return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":r,onClick:s,children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:r?`▾`:`▸`}),(0,w.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),r&&(0,w.jsx)(`pre`,{className:`wa-code`,children:a??`Loading…`})]})}function ve(e){return`text`in e&&typeof e.text==`string`?e.text:``}function ye(e,t){let n=(t??``).trim();if(!n)return e;let r=e.toLowerCase(),i=n.toLowerCase(),a=[],o=0,s=0;for(;;){let t=r.indexOf(i,o);if(t===-1){a.push(e.slice(o));break}t>o&&a.push(e.slice(o,t)),a.push((0,w.jsx)(`mark`,{className:`wa-search-hit`,children:e.slice(t,t+i.length)},s++)),o=t+i.length}return a.length===1?a[0]:(0,w.jsx)(w.Fragment,{children:a})}var Q={onRender:({kind:e,mime:t,served:n})=>console.info(`[operator-ui] op=reader-attachment kind=${e} mime=${t??``} served=${n}`),onFail:({kind:e,mime:t,reason:n})=>console.info(`[operator-ui] op=reader-attachment-fail kind=${e} mime=${t??``} reason=${n}`)};function be(e,t,n){switch(e.kind){case`operator-inbound`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,w.jsx)(X,{label:`Operator${k(e.source)}`,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.text}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))})]},t);case`operator-typed`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,w.jsx)(X,{label:`Operator (web)`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsxs)(`p`,{className:`wa-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,`sent document(s): `,e.files.map(W).join(`, `)]}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`agent-file`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),e.files.map((t,r)=>{let i=W(t),a=e.downloads?.[r];return(0,w.jsx)(B,{expandable:!0,filename:i,href:a?P(a,n.sessionId,n.sessionKey,N.test(i)?`inline`:void 0):void 0,telemetry:Q},r)}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`whatsapp-persisted`:{let r=e.origin===`operator-manual`,i=e.fromMe?r?`You`:`Sent`:e.senderName??`Contact`;return(0,w.jsxs)(`div`,{className:`wa-turn ${e.fromMe?`wa-turn-out`:`wa-turn-in`}${r?` wa-op-manual`:``}`,children:[n.onReplyTo&&e.msgKeyId&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-reply`,"aria-label":`Reply to this message`,onClick:()=>n.onReplyTo({msgKeyId:e.msgKeyId,body:e.text,senderName:e.senderName,fromMe:e.fromMe}),children:(0,w.jsx)(S,{size:14})}),n.showCopy&&e.text&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-copy`,"aria-label":`Copy this message`,onClick:()=>{let t=e.text;o(t).then(e=>e?console.info(`[operator-ui] op=wa-copy len=${t.length} ok=true`):console.warn(`[operator-ui] op=wa-copy-fail reason=clipboard-unavailable`))},children:(0,w.jsx)(s,{size:14})}),e.quoted&&(0,w.jsxs)(`div`,{className:`wa-quoted`,children:[(0,w.jsx)(`span`,{className:`wa-quoted-who`,children:e.quoted.fromMe?`You`:e.quoted.sender??`Contact`}),(0,w.jsx)(`span`,{className:`wa-quoted-body`,children:e.quoted.body||`Message`})]}),(0,w.jsx)(X,{label:i,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:ye(e.text,n.highlight)}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))}),e.reactions&&e.reactions.length>0&&(0,w.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,w.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,w.jsxs)(`span`,{className:`wa-bubble-meta`,children:[r&&(0,w.jsx)(`span`,{className:`wa-op-tag`,children:`You`}),(0,w.jsx)(`time`,{className:`wa-bubble-time`,children:U(e.ts)}),e.fromMe&&(0,w.jsx)(g,{size:14,className:`wa-bubble-tick`,"aria-hidden":!0})]})]},t)}case`session-continued`:return(0,w.jsx)(Y,{},t);case`harness-internal`:return null;case`tool-call`:case`tool-result`:return(0,w.jsx)(_e,{turn:e},t);case`agent-error`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-error`,role:`alert`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body wa-error-body`,children:O(e.code,`admin`)}),e.code===`agent_error`&&e.raw&&(0,w.jsx)(`pre`,{className:`wa-code`,children:e.raw})]},t)}}function $(e,t,n,r=`admin`,i,a,o){let s={sessionId:t,sessionKey:n,audience:r,highlight:i,onReplyTo:a,showCopy:o},c=[],l=null;return e.forEach((e,r)=>{let i=q(e),a=K(i);a!==null&&a!==l&&(c.push((0,w.jsx)(J,{ts:i},`day-${r}`)),l=a),c.push(e.kind===`turn`?be(e.turn,r,s):(0,w.jsx)(Z,{entry:e.entry,sessionId:t,sessionKey:n},r))}),c}function xe(e){return e.filter(e=>e.kind===`turn`&&pe.has(e.turn.kind)&&!(e.turn.kind===`operator-inbound`&&e.turn.scheduled))}var Se=(0,C.memo)(function({sessionId:e,projectDir:t,sessionKey:n,renderItems:r=$,clean:i,onToggleClean:a,forceDeliveredOnly:o=!1,streamEndpoint:s=`/api/whatsapp-reader/stream`,suppressDirectives:c=!1,tail:l=null,resetKey:u,onTurnsChange:d,onActivityChange:f,store:p,search:m,onReplyTo:h}){let g=!!p,_=le(e,t,n,s,u,!g),v=ue(p?.accountId??``,p?.remoteJid??``,n,g),{turns:y,status:b}=g?{turns:v.turns,status:v.status}:{turns:_.turns,status:_.status},x=g?null:_.subagentActivity;(0,C.useEffect)(()=>{f?.(x)},[x,f]),(0,C.useEffect)(()=>{d?.(y.length)},[y.length,d]);let S=de(y,fe(e,n,!c)),E=a==null?!1:!!i,D=o||E?xe(S):S,O=(m??``).trim().toLowerCase(),k=O.length>0,A=k?D.filter(e=>e.kind===`turn`&&ve(e.turn).toLowerCase().includes(O)):D,j=k?D.filter(e=>e.kind===`turn`).length:0;return(0,C.useEffect)(()=>{k&&console.info(`[operator-ui] op=wa-search q=${O} matches=${A.length} ofTurns=${j}`)},[O,k,A.length,j]),(0,w.jsxs)(T,{repinSignals:[y,E,k],tail:l,children:[b===`error`&&(0,w.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),!k&&y.length===0&&b===`open`&&(0,w.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),k&&A.length===0&&(0,w.jsxs)(`div`,{className:`wa-reader-placeholder`,children:[`No matches for "`,m,`".`]}),g?$(A,e,n,`admin`,m,h,!0):r(D,e,n)]})});function Ce(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}var we=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Te(){for(let e of we)if(MediaRecorder.isTypeSupported(e))return e;return``}function Ee(e){return e.split(`;`)[0]}async function De(){return typeof navigator>`u`||!navigator.mediaDevices?.enumerateDevices?[]:(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`)}function Oe(e){let[t,n]=(0,C.useState)(`idle`),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)([]),f=(0,C.useRef)(``),p=(0,C.useRef)(null),m=(0,C.useRef)(0),h=(0,C.useRef)(0),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(0),y=(0,C.useCallback)(()=>{if(p.current&&=(clearInterval(p.current),null),v.current&&=(cancelAnimationFrame(v.current),0),l.current&&l.current.state!==`inactive`)try{l.current.stop()}catch{}l.current=null,d.current=[],u.current&&=(u.current.getTracks().forEach(e=>e.stop()),null),g.current&&(g.current.close().catch(()=>{}),g.current=null,_.current=null),h.current=0,m.current=0},[]);(0,C.useEffect)(()=>y,[y]);let b=(0,C.useCallback)(()=>{m.current=Date.now(),p.current=setInterval(()=>{let e=Date.now()-m.current,t=h.current+e;i(Math.floor(t/1e3))},200)},[]),x=(0,C.useCallback)(()=>{p.current&&=(clearInterval(p.current),null);let e=Date.now()-m.current;h.current+=e},[]),S=(0,C.useCallback)(()=>{let e=_.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),o(new Uint8Array(t)),v.current=requestAnimationFrame(n)};n()},[]),w=(0,C.useCallback)(()=>{v.current&&=(cancelAnimationFrame(v.current),0)},[]),T=e?.onResult,E=(0,C.useCallback)(async e=>{if(!(t!==`idle`&&t!==`error`)){if(c(null),typeof window<`u`&&!window.isSecureContext){n(`error`),c(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){n(`error`),c(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){n(`error`),c(`Voice recording is not supported in this browser.`);return}try{let t=e?{audio:{deviceId:{exact:e}}}:{audio:!0},r;try{r=await navigator.mediaDevices.getUserMedia(t)}catch(t){let n=t?.name;if(e&&(n===`OverconstrainedError`||n===`NotFoundError`))r=await navigator.mediaDevices.getUserMedia({audio:!0});else throw t}u.current=r;let a=new AudioContext;g.current=a;let s=a.createMediaStreamSource(r),c=a.createAnalyser();c.fftSize=256,s.connect(c),_.current=c;let p=Te();f.current=p;let m=new MediaRecorder(r,p?{mimeType:p}:void 0);l.current=m,d.current=[],m.ondataavailable=e=>{e.data.size>0&&d.current.push(e.data)},r.getAudioTracks()[0]?.addEventListener(`ended`,()=>{y(),n(`idle`),i(0),o(null)}),m.start(1e3),n(`recording`),i(0),b(),S(),T?.({ok:!0})}catch(e){y(),n(`error`),e instanceof DOMException?(T?.({ok:!1,name:e.name,message:e.message}),e.name===`NotAllowedError`?c(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?c(`No microphone found. Connect a microphone to use voice recording.`):e.name===`NotReadableError`?c(`The microphone could not be started even though access was granted. The browser reported: ${e.message} (${e.name}).`):c(`Microphone error (${e.name}): ${e.message}`)):(T?.({ok:!1}),c(`Could not start recording.`))}}},[t,y,b,S,T]),D=(0,C.useCallback)(()=>{let e=l.current;e&&(t===`recording`&&e.state===`recording`?(e.pause(),x(),w(),n(`paused`)):t===`paused`&&e.state===`paused`&&(e.resume(),b(),S(),n(`recording`)))},[t,x,b,S,w]),O=(0,C.useCallback)(()=>{t!==`recording`&&t!==`paused`||(y(),n(`idle`),i(0),o(null))},[t,y]),k=(0,C.useCallback)(async()=>{if(t!==`recording`&&t!==`paused`)return null;let e=l.current;if(!e)return null;let r=t===`recording`?Date.now()-m.current:0;return h.current+r<1e3?(O(),null):(n(`sending`),x(),w(),new Promise(t=>{e.onstop=()=>{let r=f.current||e.mimeType||`audio/webm`,a=new Blob(d.current,{type:Ee(r)});y(),n(`idle`),i(0),o(null),t(a.size>0?a:null)},e.stop()}))},[t,O,x,w,y]);return(0,C.useEffect)(()=>{if(t!==`error`)return;let e=setTimeout(()=>{n(`idle`),c(null)},8e3);return()=>clearTimeout(e)},[t]),{state:t,elapsedSeconds:r,waveform:a,errorMessage:s,start:E,togglePause:D,discard:O,send:k}}export{_ as C,h as D,p as E,v as S,m as T,P as _,Z as a,b,W as c,q as d,B as f,F as g,N as h,J as i,K as l,M as m,Oe as n,Y as o,z as p,Ce as r,Se as s,De as t,U as u,O as v,f as w,y as x,x as y};
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Chat — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/chat-
|
|
8
|
+
<script type="module" crossorigin src="/assets/chat-DRuIxGtE.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DL2DwvxV.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-BreNpFLJ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/maximize-2-BbzPm7o8.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Cj-VZDKO.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-DHCtz8qX.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/bot-DESMpxSQ.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/page-C-5sTAE-.js">
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
|
|
23
23
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
24
24
|
</head>
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Data — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/data-
|
|
8
|
+
<script type="module" crossorigin src="/assets/data-BdZCvyvN.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/graph-labels-DykmXYHA.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DL2DwvxV.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-BreNpFLJ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/maximize-2-BbzPm7o8.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Cj-VZDKO.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-DumCWC08.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/page-C8G5p4jr.js">
|
|
19
19
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
|
|
20
20
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
21
21
|
</head>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/admin-
|
|
8
|
+
<script type="module" crossorigin src="/assets/admin-wtSUU5N0.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/graph-labels-DykmXYHA.js">
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DL2DwvxV.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-BreNpFLJ.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/maximize-2-BbzPm7o8.js">
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Cj-VZDKO.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CKg_Dlpv.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-DumCWC08.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/page-C8G5p4jr.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/bot-DESMpxSQ.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/chevron-right-BcFSa9C3.js">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Operator — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/operator-
|
|
8
|
+
<script type="module" crossorigin src="/assets/operator-DglDYmdV.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DL2DwvxV.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-BreNpFLJ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/maximize-2-BbzPm7o8.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Cj-VZDKO.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CKg_Dlpv.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-DHCtz8qX.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/bot-DESMpxSQ.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/page-C-5sTAE-.js">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
25
25
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/public-
|
|
8
|
+
<script type="module" crossorigin src="/assets/public-DqJjXR4p.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DL2DwvxV.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-BreNpFLJ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/maximize-2-BbzPm7o8.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Cj-VZDKO.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-DHCtz8qX.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/bot-DESMpxSQ.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/page-C-5sTAE-.js">
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
|
|
23
23
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
24
24
|
</head>
|