@rubytech/create-maxy-code 0.1.82 → 0.1.84
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/plugins/admin/PLUGIN.md +1 -1
- package/payload/platform/plugins/admin/hooks/__tests__/pre-tool-use-memory-write-revoke.test.sh +142 -24
- package/payload/platform/plugins/admin/hooks/__tests__/turn-completed-graph-write.test.sh +131 -218
- package/payload/platform/plugins/admin/hooks/pre-tool-use.sh +85 -17
- package/payload/platform/plugins/cloudflare/PLUGIN.md +2 -11
- package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +9 -7
- package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +20 -10
- package/payload/platform/plugins/docs/references/cloudflare.md +10 -9
- package/payload/platform/scripts/seed-neo4j.sh +20 -14
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts +6 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js +21 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +47 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +265 -44
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/platform/templates/specialists/agents/database-operator.md +8 -10
- package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-brochure/SKILL.md +3 -0
- package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-brochure/references/template.html +18 -8
- package/payload/server/{chunk-TFEIFU7F.js → chunk-BDFOTLPW.js} +1 -1
- package/payload/server/{chunk-W33UUYYR.js → chunk-BVDLDM6O.js} +1 -1
- package/payload/server/{chunk-VGMVEYX7.js → chunk-JRBCOVA4.js} +64 -5
- package/payload/server/{cloudflare-task-tracker-7P355PSD.js → cloudflare-task-tracker-M5ONAGUT.js} +2 -2
- package/payload/server/maxy-edge.js +2 -2
- package/payload/server/public/assets/Checkbox-B34vplI7.js +1 -0
- package/payload/server/public/assets/{admin-Dl273yTS.js → admin-BkTlPuP0.js} +5 -5
- package/payload/server/public/assets/{arc-aUiRP9AS.js → arc-DMDAZHAN.js} +1 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-COhEvUpo.js +1 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-Iyf6H93s.js → architectureDiagram-Q4EWVU46-DQMCKDU2.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-e7l5Mhun.js → blockDiagram-DXYQGD6D-CqJNtiQY.js} +1 -1
- package/payload/server/public/assets/{brand-CTMGYFDd.css → brand-C_iHnsbT.css} +1 -1
- package/payload/server/public/assets/{brand-dPgPNs7n.js → brand-HqTMr1bV.js} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-bDICnX2_.js → c4Diagram-AHTNJAMY-BVAa1YL3.js} +1 -1
- package/payload/server/public/assets/channel-CZG4mVkt.js +1 -0
- package/payload/server/public/assets/{chunk-2KRD3SAO-BK3470lx.js → chunk-2KRD3SAO-Di4bO8ir.js} +1 -1
- package/payload/server/public/assets/chunk-336JU56O-XIsdqKyD.js +2 -0
- package/payload/server/public/assets/chunk-426QAEUC-Dw4mcMYK.js +1 -0
- package/payload/server/public/assets/{chunk-4BX2VUAB-BOvVdJLf.js → chunk-4BX2VUAB-DyEhFk-Z.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-CzvvHuMJ.js → chunk-4TB4RGXK-BvrlG2FS.js} +1 -1
- package/payload/server/public/assets/{chunk-55IACEB6-BwZyF7vR.js → chunk-55IACEB6-BRJOZLpU.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-DxqHPDro.js → chunk-5FUZZQ4R-3-UZ9191.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-BA6nMu9F.js → chunk-5PVQY5BW-DOeY60Lp.js} +1 -1
- package/payload/server/public/assets/{chunk-67CJDMHE-D5bhMrtY.js → chunk-67CJDMHE-BG6-9r6c.js} +1 -1
- package/payload/server/public/assets/{chunk-7N4EOEYR-Si7Lgrwc.js → chunk-7N4EOEYR-BvMbitX7.js} +1 -1
- package/payload/server/public/assets/{chunk-AA7GKIK3-DMuHtDqO.js → chunk-AA7GKIK3-CE8mGBD5.js} +1 -1
- package/payload/server/public/assets/{chunk-BSJP7CBP-L79XKVcb.js → chunk-BSJP7CBP-DP7LTBll.js} +1 -1
- package/payload/server/public/assets/{chunk-CIAEETIT-C0O7Upmg.js → chunk-CIAEETIT-VfnIdN-h.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-gUSTktie.js → chunk-EDXVE4YY-BSbGSOxN.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-C-wW17kd.js → chunk-ENJZ2VHE-CszgAcWZ.js} +1 -1
- package/payload/server/public/assets/{chunk-FMBD7UC4-C_E43NFJ.js → chunk-FMBD7UC4-w-yBZsN2.js} +1 -1
- package/payload/server/public/assets/{chunk-FOC6F5B3-D9lWWHAu.js → chunk-FOC6F5B3-f9cFywhd.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-zLc9NsO5.js → chunk-ICPOFSXX-rgw1I6pt.js} +2 -2
- package/payload/server/public/assets/{chunk-K5T4RW27-DuhsNH4c.js → chunk-K5T4RW27-B_ZUrFUq.js} +1 -1
- package/payload/server/public/assets/{chunk-KGLVRYIC-B4-A1Abi.js → chunk-KGLVRYIC-CcWTvRlI.js} +1 -1
- package/payload/server/public/assets/{chunk-LIHQZDEY-BxqgHRgT.js → chunk-LIHQZDEY-D-5-peQw.js} +1 -1
- package/payload/server/public/assets/{chunk-ORNJ4GCN-DEYQ5WaJ.js → chunk-ORNJ4GCN-B4Z5L25I.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-Bt9RJ_rb.js → chunk-OYMX7WX6-DL4v2Nx4.js} +1 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-CWh_0JsP.js +1 -0
- package/payload/server/public/assets/{chunk-U2HBQHQK-BAM6MO6g.js → chunk-U2HBQHQK-CwMCwyfq.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-DbOwgg1R.js → chunk-X2U36JSP-CvKfDVvq.js} +1 -1
- package/payload/server/public/assets/{chunk-XPW4576I-CBfZXZDB.js → chunk-XPW4576I-m1Y_r88I.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-BXUfYLeM.js → chunk-YZCP3GAM-D7vju2_U.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-BBIHnMjI.js → chunk-ZZ45TVLE-sANOwJKn.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-BoqQ3pHg.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-FoKuBK7n.js +1 -0
- package/payload/server/public/assets/clone-CT8AM-bU.js +1 -0
- package/payload/server/public/assets/{cose-bilkent-S5V4N54A-Br2gjtEO.js → cose-bilkent-S5V4N54A-BhtgY3T7.js} +1 -1
- package/payload/server/public/assets/{dagre-Bv8aHCaJ.js → dagre-CplqWwSs.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-BZ0q7dDA.js → dagre-KV5264BT-DNbl5g9o.js} +1 -1
- package/payload/server/public/assets/data-BIDM6J5V.js +1 -0
- package/payload/server/public/assets/{device-url-actions-CK6x8-FQ.js → device-url-actions-nxh9PmIH.js} +1 -1
- package/payload/server/public/assets/{diagram-5BDNPKRD-Bbzy2KoW.js → diagram-5BDNPKRD-BCdMaYnY.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-CadVHWrV.js → diagram-G4DWMVQ6-8XhDBU0o.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-DwJ6fVMv.js → diagram-MMDJMWI5-M-RMQgtx.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-Bh8d1vg-.js → diagram-TYMM5635-BBHPIBvQ.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-B1oTY2ob.js → erDiagram-SMLLAGMA-D6jOL-9s.js} +1 -1
- package/payload/server/public/assets/{flatten-Bo6YRmWl.js → flatten-BsWEYbBB.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-BZU76iLs.js → flowDiagram-DWJPFMVM-CiyTYRlU.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-PjhJx62i.js → ganttDiagram-T4ZO3ILL-DHSIpjfS.js} +1 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-DeTNsAO0.js +1 -0
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-DLrxzJYi.js → gitGraphDiagram-UUTBAWPF-CEneVF3o.js} +1 -1
- package/payload/server/public/assets/graph-Cm-iWFqy.js +1 -0
- package/payload/server/public/assets/graph-labels-CFX6KkCz.js +1 -0
- package/payload/server/public/assets/{graphlib-D2ExKXiT.js → graphlib-CuF7rLfE.js} +1 -1
- package/payload/server/public/assets/info-OMHHGYJF-DJJ9GlS6.js +1 -0
- package/payload/server/public/assets/infoDiagram-42DDH7IO-wGl-JoP7.js +2 -0
- package/payload/server/public/assets/{isEmpty-D6Kr-M1M.js → isEmpty-BWl67LAZ.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-Ed8ANWEq.js → ishikawaDiagram-UXIWVN3A-B3TxFNi_.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-DF1gG775.js → journeyDiagram-VCZTEJTY-B5n8No7p.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-D8VcaKAp.js → kanban-definition-6JOO6SKY-ByGF39_h.js} +1 -1
- package/payload/server/public/assets/{line-CgMZIaVM.js → line-Br0FyyFW.js} +1 -1
- package/payload/server/public/assets/{linear-DOh_6k2k.js → linear-0O14Y6uf.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-ez9lChuL.js → mermaid-parser.core-BUcTjodx.js} +2 -2
- package/payload/server/public/assets/{mermaid.core-BiVW_Lka.js → mermaid.core-BKzdtZgG.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-C-BlLBbo.js → mindmap-definition-QFDTVHPH-CobGMF9l.js} +1 -1
- package/payload/server/public/assets/{ordinal-BDi6f4xk.js → ordinal-krseTxxN.js} +1 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-CGbvGkvF.js +1 -0
- package/payload/server/public/assets/{page-BQCQwUG5.js → page-B5NRnW0t.js} +1 -1
- package/payload/server/public/assets/{page-DStDaJgc.js → page-Ba0BAfpu.js} +2 -2
- package/payload/server/public/assets/pie-ZZUOXDRM-BZy8rjFn.js +1 -0
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-BK0-LxVl.js → pieDiagram-DEJITSTG-DXFmGcNR.js} +1 -1
- package/payload/server/public/assets/{public-DMk9cZKl.js → public-DWfBzf83.js} +5 -5
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-vKAQHu-t.js → quadrantDiagram-34T5L4WZ-BnChStlO.js} +1 -1
- package/payload/server/public/assets/radar-PYXPWWZC-DcfWIVXr.js +1 -0
- package/payload/server/public/assets/{reduce-CGi9ik8i.js → reduce-tk-xY6Fv.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-Df9sXR35.js → requirementDiagram-MS252O5E-DdiBKsyO.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DG6xirA4.js → sankeyDiagram-XADWPNL6-16-np_56.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-B1a38KHX.js → sequenceDiagram-FGHM5R23-D67SCRpA.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-CRiIDR4O.js → stateDiagram-FHFEXIEX-CvNJX0YC.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CFw2U4iL.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-CkBOE7Y8.js → timeline-definition-GMOUNBTQ-BJE5YoBa.js} +1 -1
- package/payload/server/public/assets/treeView-SZITEDCU-3WugwVdj.js +1 -0
- package/payload/server/public/assets/treemap-W4RFUUIX-Cf5mDLlu.js +1 -0
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-CwKBydYc.js → vennDiagram-DHZGUBPP-DF17ddXt.js} +1 -1
- package/payload/server/public/assets/wardley-RL74JXVD-Bv4md4b3.js +1 -0
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-BWXYfzIr.js → wardleyDiagram-NUSXRM2D-xn_2XUOo.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-D-4v5Dy_.js → xychartDiagram-5P7HB3ND-DVF8zf3f.js} +1 -1
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +6 -5
- package/payload/server/public/index.html +8 -7
- package/payload/server/public/public.html +5 -4
- package/payload/server/server.js +229 -22
- package/payload/server/public/assets/architecture-YZFGNWBL--v-pJPNp.js +0 -1
- package/payload/server/public/assets/channel-CkgyfA91.js +0 -1
- package/payload/server/public/assets/chunk-336JU56O-CbnUj19H.js +0 -2
- package/payload/server/public/assets/chunk-426QAEUC-DxGLqjw5.js +0 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-Bd-GrQM6.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-PyvJekA9.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-6hFNhiTb.js +0 -1
- package/payload/server/public/assets/clone-CFIJrRLl.js +0 -1
- package/payload/server/public/assets/data-BgADjmk1.js +0 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-CI0s_tqn.js +0 -1
- package/payload/server/public/assets/graph-B1_erzSo.js +0 -1
- package/payload/server/public/assets/graph-labels-CpFvcba2.js +0 -1
- package/payload/server/public/assets/info-OMHHGYJF-g3gYW7Qm.js +0 -1
- package/payload/server/public/assets/infoDiagram-42DDH7IO-Cn0r9nCK.js +0 -2
- package/payload/server/public/assets/packet-4T2RLAQJ-CT0TB9HI.js +0 -1
- package/payload/server/public/assets/pie-ZZUOXDRM-CXLe7TFF.js +0 -1
- package/payload/server/public/assets/radar-PYXPWWZC-DnPLBl-D.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-C8cVmi_o.js +0 -1
- package/payload/server/public/assets/treeView-SZITEDCU-C3cb7Xwe.js +0 -1
- package/payload/server/public/assets/treemap-W4RFUUIX-Dc7G3Bgm.js +0 -1
- package/payload/server/public/assets/wardley-RL74JXVD-DtgibWAt.js +0 -1
- /package/payload/server/public/assets/{_baseFor-Cam2PbSt.js → _baseFor-BHtDrjIo.js} +0 -0
- /package/payload/server/public/assets/{array-DYRGGQae.js → array-DetWRiSa.js} +0 -0
- /package/payload/server/public/assets/{cytoscape.esm-nWsJMTNI.js → cytoscape.esm-C9yNhe1u.js} +0 -0
- /package/payload/server/public/assets/{defaultLocale-Du1XY3Dp.js → defaultLocale-_WRwicXn.js} +0 -0
- /package/payload/server/public/assets/{dist-BzAsli7o.js → dist-Bd4S37oi.js} +0 -0
- /package/payload/server/public/assets/{init-B5BXBRcm.js → init-sTEcj9YX.js} +0 -0
- /package/payload/server/public/assets/{katex-HOUACuRw.js → katex-s61Rgv6l.js} +0 -0
- /package/payload/server/public/assets/{path-CNO468J-.js → path-B0Ik7Tu9.js} +0 -0
- /package/payload/server/public/assets/{rough.esm-DRO6hWPh.js → rough.esm-DKRO8IF-.js} +0 -0
- /package/payload/server/public/assets/{src-CWiyyVfn.js → src-B6XdH6xq.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
2
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,c as n,d as r,f as i,
|
|
3
|
-
`);r=a.pop();for(let e of a){if(!e.startsWith(`data: `))continue;let t=e.slice(6);if(t===`[DONE]`)continue;let n;try{n=JSON.parse(t)}catch{continue}yield n}}}finally{t.cancel()}}function te({cacheKeyRef:e,ensureSession:t,sessionError:n,pageState:r,inputRef:i}){let[a,o]=(0,A.useState)([]),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(!1),u=e=>{l.current=e,c(e)},d=(0,A.useCallback)(async a=>{if(!l.current){u(!0),o([{role:`maxy`,content:``,timestamp:Date.now()}]);try{let n=await fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({greeting:!0,session_key:a})});if(n.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}P&&console.warn(`[greeting] stale session, retrying with fresh session`);let r=await t();if(!r)return;n=await fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({greeting:!0,session_key:r})})}if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let r=``,i=``,s=()=>{i&&(r+=i,i=``,o(e=>{let t=[...e];return t[0]={...t[0],content:r},t}))},c=setInterval(s,60);try{for await(let e of B(n)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(i+=e.text),e.type===`component`&&(s(),o(t=>{let n=[...t],r={...n[0]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[0]={...r,components:i},n}))}}finally{clearInterval(c),s()}}catch(e){if(P&&console.error(`[chat] greeting failed:`,e),r===`auth-required`)return;let t=e instanceof Error?e.message:String(e);o([{role:`maxy`,content:e instanceof Error&&e.fromSSE?t:n??`I'm having trouble connecting right now. Try refreshing the page.`,timestamp:Date.now()}])}finally{u(!1),r===`chat`&&i.current?.focus()}}},[e,t,n,r,i]),f=(0,A.useCallback)(async(a,s)=>{let c=s?.hidden??!1,d=s?.files??[];if(!a&&d.length===0||l.current)return;u(!0);let f=d.map(e=>({filename:e.name,mimeType:e.type})),p={role:`visitor`,content:a,attachments:f.length>0?f:void 0,timestamp:Date.now(),hidden:c},m;o(e=>{let t=[...e,p,{role:`maxy`,content:``,timestamp:Date.now()}];return m=t.length-1,t});try{let n=await t();if(!n)throw Error(`session`);let r=e=>{if(d.length>0){let t=new FormData;t.append(`message`,a),t.append(`session_key`,e);for(let e of d)t.append(`attachments`,e);return{body:t,headers:{}}}return{body:JSON.stringify({message:a,session_key:e}),headers:{"Content-Type":`application/json`}}},{body:i,headers:s}=r(n),c=await fetch(`/api/chat`,{method:`POST`,headers:s,body:i});if(c.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}P&&console.warn(`[session-expired] stale key cleared, retrying with fresh session`);let n=await t();if(!n)throw Error(`session`);({body:i,headers:s}=r(n)),c=await fetch(`/api/chat`,{method:`POST`,headers:s,body:i})}if(!c.ok){let e=await c.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let l=``,u=``,f=()=>{u&&(l+=u,u=``,o(e=>{let t=[...e];return t[m]={...t[m],content:l},t}))},p=setInterval(f,60);try{for await(let e of B(c)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(u+=e.text),e.type===`component`&&(f(),o(t=>{let n=[...t],r={...n[m]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[m]={...r,components:i},n}))}}finally{clearInterval(p),f()}}catch(e){if(P&&console.error(`[chat] sendMessage failed:`,e),r===`auth-required`)return;let t=e instanceof Error?e.message:String(e),i=e instanceof Error&&e.fromSSE;o(e=>{let r=[...e];return r[m]={...r[m],content:i?t:t===`session`?n??`I'm having trouble connecting right now. Try refreshing the page.`:`Sorry, I hit a snag. Try again in a moment.`},r})}finally{u(!1),r===`chat`&&i.current?.focus()}},[e,t,n,r,i]);return{messages:a,setMessages:o,isStreaming:s,sendMessage:f,sendGreeting:d,handleComponentSubmit:(0,A.useCallback)((e,t,n)=>{o(n=>{let r=[...n],i={...r[e]},a=[...i.components||[]];return a[t]={...a[t],submitted:!0},r[e]={...i,components:a},r}),f(n,{hidden:!0})},[f])}}function ne({cacheKeyRef:e,groupSlug:t,isStreaming:n,setMessages:r}){let i=(0,A.useRef)(new Date().toISOString()),a=(0,A.useRef)(!0);(0,A.useEffect)(()=>{let e=()=>{a.current=document.visibilityState===`visible`};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let o=(0,A.useCallback)(async()=>{let n=e.current;if(!(!n||!t))try{let e=await fetch(`/api/group/messages?session_key=${encodeURIComponent(n)}&since=${encodeURIComponent(i.current)}`);if(!e.ok)return;let t=await e.json();if(!t.messages||t.messages.length===0)return;let a=t.messages[t.messages.length-1];a.timestamp&&(i.current=new Date(a.timestamp).toISOString()),r(e=>{let n=new Set(e.filter(e=>e.messageId).map(e=>e.messageId)),r=t.messages.filter(e=>!n.has(e.messageId)).map(e=>({role:e.role,content:e.content,timestamp:e.timestamp,senderName:e.senderName??void 0,senderVisitorId:e.senderVisitorId??void 0,messageId:e.messageId}));if(r.length===0)return e;let i=[...e,...r];return i.sort((e,t)=>e.timestamp-t.timestamp),i})}catch(e){console.error(`[group-poll] failed: ${e instanceof Error?e.message:String(e)}`)}},[e,t,r]);(0,A.useEffect)(()=>{if(!t)return;let e,r=!1;function i(){if(r)return;let t=a.current?3e3:3e4;e=setTimeout(async()=>{n||await o(),i()},t)}return i(),()=>{r=!0,clearTimeout(e)}},[t,n,o])}var V=l();function re({value:e,onChange:t,onComplete:n,disabled:r}){let i=(0,A.useRef)([]);function a(n,r){r.key===`Backspace`?(r.preventDefault(),e[n]?t(e.slice(0,n)+e.slice(n+1)):n>0&&(t(e.slice(0,n-1)+e.slice(n)),i.current[n-1]?.focus())):r.key===`ArrowLeft`&&n>0?i.current[n-1]?.focus():r.key===`ArrowRight`&&n<5&&i.current[n+1]?.focus()}function o(r,a){let o=a.nativeEvent.data;if(!o||!/^\d$/.test(o))return;let s=e.split(``);for(s[r]=o;s.length<r;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);t(c),c.length===6?n(c):r<5&&i.current[r+1]?.focus()}function s(e){e.preventDefault();let r=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);r&&(t(r),r.length===6?n(r):i.current[r.length]?.focus())}return(0,V.jsx)(`div`,{className:`gate-otp-field`,children:Array.from({length:6}).map((t,n)=>(0,V.jsx)(`input`,{ref:e=>{i.current[n]=e},type:`text`,inputMode:`numeric`,className:`pin-box${e[n]?` pin-box-filled`:``}`,value:e[n]||``,onKeyDown:e=>a(n,e),onInput:e=>o(n,e),onPaste:s,onFocus:e=>e.target.select(),autoFocus:n===0,autoComplete:`off`,maxLength:1,disabled:r,"aria-label":`Code digit ${n+1}`},n))})}function ie({gateState:e,setGateState:n,grantInfo:r,setGrantInfo:i,gateCacheKeyRef:a,resolvedSlugRef:o,onAuthenticated:s}){let[c,l]=(0,A.useState)(``),[u,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(``),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(``),[y,b]=(0,A.useState)(``),[x,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(null),[T,E]=(0,A.useState)(null),[D,O]=(0,A.useState)(!1);async function k(e){if(e.preventDefault(),!D){w(null),O(!0);try{let e=o.current,t=await fetch(`/api/access/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contact:c,password:u,agentSlug:e})}),r=await t.json();t.ok?s(r.session_key):t.status===401?r.error?.includes(`setup not complete`)||r.error?.includes(`invitation link`)?(n(`private-agent`),w(null)):w(r.error||`Invalid credentials`):t.status===403?(n(`access-expired`),r.expiresAt&&i(e=>e?{...e,expiresAt:r.expiresAt}:{displayName:null,contactValue:c,contactMethod:`email`,expiresAt:r.expiresAt,status:`expired`})):t.status===429?w(r.error||`Too many attempts. Please try again later.`):w(r.error||`Something went wrong`)}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function j(e){if(!D){w(null),O(!0);try{let t=o.current,r=await fetch(`/api/access/verify-otp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({phone:y,code:e,agentSlug:t})}),s=await r.json();r.ok?(a.current=s.session_key,i(s.grant),n(`set-password`)):r.status===429?n(`otp-failed`):(w(s.error||`Invalid code`),_(``))}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function M(e){if(e.preventDefault(),!D){if(w(null),u!==f){w(`Passwords do not match`);return}if(!L(u).every(e=>e.met)){w(`Password does not meet requirements`);return}O(!0);try{let e=a.current;if(!e){w(`Session expired. Please use your invitation link again.`);return}let t=await fetch(`/api/access/create-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_key:e,password:u})}),n=await t.json();t.ok?s(n.session_key):t.status===400&&n.requirements?w(n.requirements.filter(e=>!e.met).map(e=>e.label).join(`, `)):w(n.error||`Something went wrong`)}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function N(e){if(e.preventDefault(),!(D||!c)){w(null),O(!0);try{let e=o.current,t=await fetch(`/api/access/forgot-password`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contact:c,agentSlug:e})});t.status===429?w((await t.json()).error||`Too many attempts. Please try again later.`):(E(`If an account exists, a reset link has been sent.`),setTimeout(()=>{S(!1),E(null)},4e3))}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}switch(e){case`set-password`:{let e=L(u),n=e.every(e=>e.met),i=u===f,a=n&&i&&f.length>0;return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[r?.expiresAt&&(0,V.jsxs)(`div`,{className:`gate-expiry-badge`,children:[`Access until `,new Date(r.expiresAt).toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`})]}),(0,V.jsxs)(`h2`,{className:`gate-title`,children:[`Welcome, `,r?.displayName||`there`]}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`Create a password to access this agent in the future.`}),(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:M,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-display-name`,children:`Display name`}),(0,V.jsx)(`input`,{id:`gate-display-name`,type:`text`,value:r?.displayName||``,disabled:!0})]}),(0,V.jsxs)(`div`,{className:`gate-field gate-pw-row`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-pw`,children:`Password`}),(0,V.jsx)(`div`,{className:`gate-pw-toggle`,children:(0,V.jsx)(t,{checked:m,onChange:h,label:`Show`})}),(0,V.jsx)(`input`,{id:`gate-pw`,type:m?`text`:`password`,value:u,onChange:e=>d(e.target.value),placeholder:`Your password`,autoFocus:!0,autoComplete:`new-password`}),u.length>0&&(0,V.jsx)(`div`,{className:`gate-strength`,children:e.map(e=>(0,V.jsxs)(`span`,{className:`gate-strength-item${e.met?` met`:``}`,children:[e.met?`✓`:`○`,` `,e.label]},e.key))})]}),(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-pw-confirm`,children:`Confirm password`}),(0,V.jsx)(`input`,{id:`gate-pw-confirm`,type:m?`text`:`password`,value:f,onChange:e=>p(e.target.value),placeholder:`Confirm your password`,autoComplete:`new-password`}),f.length>0&&!i&&(0,V.jsx)(`div`,{className:`gate-error`,children:`Passwords do not match`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(v,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!a||D,loading:D,children:`Create account & enter chat`})})]})]})})}case`enter-otp`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`h2`,{className:`gate-title`,children:`Enter your code`}),(0,V.jsxs)(`p`,{className:`gate-subtitle`,children:[`Enter the 6-digit code sent to `,R(y,`phone`)]}),(0,V.jsx)(re,{value:g,onChange:_,onComplete:j,disabled:D}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),D&&(0,V.jsxs)(`div`,{className:`gate-loading`,children:[(0,V.jsx)(`span`,{className:`spinner`}),`Verifying...`]}),(0,V.jsx)(`div`,{className:`gate-resend`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{n(`sign-in`),_(``),w(null)},children:`Use a different number`})})]})});case`sign-in`:case`private-agent`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`h2`,{className:`gate-title`,children:e===`private-agent`?`Private Agent`:`Welcome back`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:e===`private-agent`?`This agent is invitation-only. If you have an account, sign in below.`:`Sign in to continue your conversation.`}),x?(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:N,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-forgot-contact`,children:`Email or phone`}),(0,V.jsx)(`input`,{id:`gate-forgot-contact`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`you@example.com`,autoFocus:!0,autoComplete:`email`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),T&&(0,V.jsx)(`div`,{className:`gate-success`,children:T}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(v,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!c.trim()||D,loading:D,children:`Send reset link`})}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{S(!1),w(null),E(null)},children:`Back to sign in`})})]}):(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:k,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-contact`,children:`Email or phone`}),(0,V.jsx)(`input`,{id:`gate-contact`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`you@example.com`,autoFocus:!0,autoComplete:`email`})]}),(0,V.jsxs)(`div`,{className:`gate-field gate-pw-row`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-login-pw`,children:`Password`}),(0,V.jsx)(`div`,{className:`gate-pw-toggle`,children:(0,V.jsx)(t,{checked:m,onChange:h,label:`Show`})}),(0,V.jsx)(`input`,{id:`gate-login-pw`,type:m?`text`:`password`,value:u,onChange:e=>d(e.target.value),placeholder:`Your password`,autoComplete:`current-password`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(v,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!c.trim()||!u||D,loading:D,children:`Sign in`})}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{S(!0),w(null)},children:`Forgot password?`})})]}),e===`private-agent`&&(0,V.jsx)(`p`,{className:`gate-hint`,children:`No account? You need an invitation from the agent owner.`})]})});case`access-expired`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⏰`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Access expired`}),(0,V.jsxs)(`p`,{className:`gate-subtitle`,children:[r?.expiresAt?`Your access expired on ${new Date(r.expiresAt).toLocaleDateString(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`})}.`:`Your access to this agent has expired.`,` `,`Contact the agent owner to renew.`]}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(v,{variant:`secondary`,onClick:()=>{n(`sign-in`),w(null),d(``)},children:`Sign in with a different account`})})]})});case`link-expired`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⚠️`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Link expired`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`This invitation link has expired or has already been used. If you already set your password, sign in below. Otherwise, ask the agent owner to send a new invitation.`}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(v,{variant:`primary`,onClick:()=>{n(`sign-in`),w(null)},children:`Go to sign in`})})]})});case`otp-failed`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⛔`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Too many attempts`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`You've entered the wrong code too many times. Ask the agent owner to send a new code.`}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(v,{variant:`secondary`,onClick:()=>{n(`sign-in`),w(null),_(``)},children:`Back to sign in`})})]})})}}var H=100;function U(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,reason:`invalid JSON: ${e instanceof Error?e.message:String(e)}`}}if(typeof t!=`object`||!t||Array.isArray(t))return{ok:!1,reason:`payload is not a JSON object`};let n=t;if(typeof n.url!=`string`||n.url.length===0)return{ok:!1,reason:`url is required`};let r;try{r=new URL(n.url)}catch{return{ok:!1,reason:`url is not a valid URL`}}if(r.protocol!==`http:`&&r.protocol!==`https:`)return{ok:!1,reason:`url scheme ${r.protocol} is not permitted (http/https only)`};if(typeof n.intent!=`string`||n.intent.length===0)return{ok:!1,reason:`intent is required`};if(n.intent.length>H)return{ok:!1,reason:`intent exceeds ${H} chars`};let i;if(n.hostname!==void 0){if(typeof n.hostname!=`string`)return{ok:!1,reason:`hostname must be a string when provided`};i=n.hostname}return{ok:!0,payload:i?{url:n.url,intent:n.intent,hostname:i}:{url:n.url,intent:n.intent}}}var W={ok:`succeeded`,timeout:`navigation timed out`,"cdp-unreachable":`device browser is not responding`,error:`navigation error`};async function G(e,t){try{await fetch(`/api/admin/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:e,fields:t})})}catch(t){console.error(`[device-url:event] failed to post event`,e,t)}}function K({raw:e,reason:t}){return(0,A.useEffect)(()=>{G(`device-url:malformed`,{reason:t.slice(0,200),length:e.length})},[e,t]),(0,V.jsx)(`pre`,{className:`md-pre md-device-url-malformed`,children:(0,V.jsxs)(`code`,{className:`md-code`,children:[(0,V.jsxs)(`span`,{className:`md-device-url-malformed-label`,children:[(0,V.jsx)(O,{size:12}),` device-URL block is malformed: `,t]}),`
|
|
4
|
-
`,e]})})}function q({payload:e,reason:t}){let[n,r]=(0,A.useState)(`idle`);(0,A.useEffect)(()=>{G(`device-url:fallback-shown`,{intent:e.intent,reason:t,hostname:e.hostname??``})},[e.intent,e.hostname,t]);let a=async()=>{if(await g(e.url)){r(`copied`),window.setTimeout(()=>r(`idle`),2e3);return}r(`failed`),G(`device-url:fallback-shown`,{intent:e.intent,reason:`clipboard-write-failed`,hostname:e.hostname??``})},o=e.hostname?` on the device (${e.hostname})`:` on the device`;return(0,V.jsxs)(`div`,{className:`md-device-url md-device-url-fallback`,role:`group`,children:[(0,V.jsxs)(`div`,{className:`md-device-url-fallback-message`,children:[(0,V.jsx)(O,{size:14}),(0,V.jsxs)(`span`,{children:[`Could not open `,(0,V.jsx)(`strong`,{children:e.intent}),o,` automatically (`,t,`). Copy the URL and open it in a browser on the device:`]})]}),(0,V.jsxs)(`div`,{className:`md-device-url-fallback-url`,children:[(0,V.jsx)(`code`,{children:e.url}),(0,V.jsxs)(`button`,{type:`button`,className:`md-device-url-fallback-copy`,onClick:a,"aria-label":`Copy URL`,children:[n===`copied`?(0,V.jsx)(i,{size:14}):(0,V.jsx)(b,{size:14}),n===`copied`?`Copied`:n===`failed`?`Copy failed`:`Copy`]})]}),n===`failed`&&(0,V.jsx)(`div`,{className:`md-device-url-fallback-copy-failed`,children:`Your browser blocked the copy action. Select the URL text above manually to copy it.`})]})}function J({payload:e}){let t=x(),[n,r]=(0,A.useState)({phase:`idle`});(0,A.useEffect)(()=>{G(`device-url:render`,{intent:e.intent,url:e.url,hostname:e.hostname??``,origin:`tool`})},[e.intent,e.url,e.hostname]);let i=async()=>{if(n.phase!==`navigating`){r({phase:`navigating`});try{let n=await fetch(`/api/admin/device-browser/navigate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),i=await n.json().catch(()=>({}));if(n.ok&&i.ok){r({phase:`succeeded`}),t&&(t.onShowVnc(),G(`device-url:vnc-surface-shown`,{intent:e.intent})),window.setTimeout(()=>r({phase:`idle`}),2500);return}r({phase:`fallback`,reason:i.navigateResult?W[i.navigateResult]:i.detail?i.detail.slice(0,80):`navigation failed`})}catch(e){r({phase:`fallback`,reason:(e instanceof Error?e.message:String(e)).slice(0,80)})}}},a=n.phase===`navigating`,s=n.phase===`succeeded`;return(0,V.jsxs)(`div`,{className:`md-device-url`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`md-device-url-button`,onClick:i,disabled:a,"aria-label":`Open ${e.intent} on the device's browser`,title:e.hostname?`Opens on device: ${e.hostname}`:`Opens on the device running Maxy`,children:[(0,V.jsx)(o,{size:16,className:`md-device-url-icon`}),(0,V.jsx)(`span`,{className:`md-device-url-label`,children:a?`Opening…`:s?`Opened on device`:`Open ${e.intent} on device`})]}),n.phase===`fallback`&&(0,V.jsx)(q,{payload:e,reason:n.reason})]})}function Y({source:e}){let t=U(e.trim());return t.ok?(0,V.jsx)(J,{payload:t.payload}):(0,V.jsx)(K,{raw:e,reason:t.reason})}var X=`modulepreload`,ae=function(e){return`/`+e},Z={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=ae(t,n),t in Z)return;Z[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:X,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$=null;function oe(){return $||=Q(async()=>{let{default:e}=await import(`./mermaid.core-BiVW_Lka.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`neutral`}),e)),$}function se({source:e}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let n=!1,i=`mermaid-${Math.random().toString(36).slice(2,9)}`;return oe().then(t=>t.render(i,e)).then(({svg:e})=>{!n&&t.current&&(t.current.innerHTML=e)}).catch(t=>{n||(console.error(`[MermaidBlock] render failed:`,e,t),r(t instanceof Error?t.message:`Diagram render failed`))}),()=>{n=!0}},[e]),n?(0,V.jsxs)(`div`,{className:`md-mermaid md-mermaid-error`,children:[(0,V.jsx)(`div`,{className:`md-mermaid-error-label`,children:`Diagram render error`}),(0,V.jsx)(`pre`,{className:`md-pre`,children:(0,V.jsx)(`code`,{className:`md-code`,children:e})})]}):(0,V.jsx)(`div`,{className:`md-mermaid`,ref:t})}var ce=/\.(mp4|webm|mov)(\?.*)?$/i,le=/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/,ue=/vimeo\.com\/(\d+)/;function de(e){return!!e&&ce.test(e)}function fe(e){if(!e)return null;let t=e.match(le);return t?t[1]:null}function pe(e){if(!e)return null;let t=e.match(ue);return t?t[1]:null}function me({src:e}){return(0,V.jsx)(`video`,{className:`md-video`,controls:!0,playsInline:!0,preload:`metadata`,children:(0,V.jsx)(`source`,{src:e})})}function he({videoId:e}){return(0,V.jsx)(`div`,{className:`md-video-iframe`,children:(0,V.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${e}`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function ge({videoId:e}){return(0,V.jsx)(`div`,{className:`md-video-iframe`,children:(0,V.jsx)(`iframe`,{src:`https://player.vimeo.com/video/${e}`,allow:`autoplay; fullscreen; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function _e(e){if(de(e))return(0,V.jsx)(me,{src:e});let t=fe(e);if(t)return(0,V.jsx)(he,{videoId:t});let n=pe(e);return n?(0,V.jsx)(ge,{videoId:n}):null}var ve={p:({children:e})=>(0,V.jsx)(`p`,{className:`md-p`,children:e}),h1:({children:e})=>(0,V.jsx)(`h1`,{className:`md-heading`,children:e}),h2:({children:e})=>(0,V.jsx)(`h2`,{className:`md-heading`,children:e}),h3:({children:e})=>(0,V.jsx)(`h3`,{className:`md-heading`,children:e}),code:({children:e,className:t})=>t===`language-mermaid`?(0,V.jsx)(se,{source:String(e).replace(/\n$/,``)}):t===`language-maxy-device-url`?(0,V.jsx)(Y,{source:String(e).replace(/\n$/,``)}):(0,V.jsx)(`code`,{className:`md-code ${t||``}`.trim(),children:e}),pre:({children:e,node:t})=>{let n=t?.children?.[0];if(n?.type===`element`&&n.tagName===`code`){let t=n.properties?.className??[];if(t.includes(`language-mermaid`)||t.includes(`language-maxy-device-url`))return(0,V.jsx)(V.Fragment,{children:e})}return(0,V.jsx)(`pre`,{className:`md-pre`,children:e})},ul:({children:e})=>(0,V.jsx)(`ul`,{className:`md-list`,children:e}),ol:({children:e})=>(0,V.jsx)(`ol`,{className:`md-list md-list-ordered`,children:e}),li:({children:e})=>(0,V.jsx)(`li`,{className:`md-list-item`,children:e}),hr:()=>(0,V.jsx)(`hr`,{className:`md-hr`}),strong:({children:e})=>(0,V.jsx)(`strong`,{className:`md-strong`,children:e}),img:({src:e,alt:t})=>_e(e)||(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:(0,V.jsx)(`img`,{className:`md-img`,src:e,alt:t||``,loading:`lazy`})}),a:({href:e,children:t})=>_e(e)||(0,V.jsx)(`a`,{href:e,className:`md-link`,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({children:e})=>(0,V.jsx)(`table`,{className:`md-table`,children:e}),thead:({children:e})=>(0,V.jsx)(`thead`,{className:`md-thead`,children:e}),tbody:({children:e})=>(0,V.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,V.jsx)(`tr`,{className:`md-tr`,children:e}),th:({children:e})=>(0,V.jsx)(`th`,{className:`md-th`,children:e}),td:({children:e})=>(0,V.jsx)(`td`,{className:`md-td`,children:e})};function ye({content:e,elapsedSeconds:t,timestamp:n}){return(0,V.jsxs)(`div`,{className:`markdown-message`,children:[(0,V.jsx)(y,{remarkPlugins:[_],components:ve,children:e}),t!==void 0&&(0,V.jsxs)(`div`,{className:`message-meta`,children:[t,`s`]}),n&&(0,V.jsx)(`span`,{className:`message-timestamp`,children:n})]})}function be({submitted:e,submittedLabel:t=`Submitted`,actions:n,children:r}){return(0,V.jsxs)(`div`,{className:`component-card${e?` component-card--submitted`:``}`,children:[r,(0,V.jsx)(`div`,{className:`component-card__actions`,children:e?(0,V.jsx)(`span`,{className:`component-card__done-label`,children:t}):n.map((e,t)=>(0,V.jsx)(v,{variant:e.variant,size:`sm`,disabled:e.disabled,onClick:e.onClick,children:e.label},t))})]})}function xe({data:e,onSubmit:t,submitted:n}){let r=e,i=Array.isArray(r?.options)?r.options:[],[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(`Submitted`);if(i.length===0)return null;let l=e=>{n||o(e)},u=()=>{if(!a||n)return;let e=i.find(e=>e.value===a);c(e?.label??`Submitted`),t((r?.submitMessage??`Selected: {{value}}`).replace(`{{value}}`,a).replace(`{{label}}`,e?.label??a))},d=()=>{n||(c(r?.backLabel??`Back`),t(r?.backMessage??``))},f=(e,t)=>{if(!n)if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault();let n=(t+1)%i.length;l(i[n].value),(e.currentTarget.parentElement?.children[n])?.focus()}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault();let n=(t-1+i.length)%i.length;l(i[n].value),(e.currentTarget.parentElement?.children[n])?.focus()}else (e.key===` `||e.key===`Enter`)&&(e.preventDefault(),l(i[t].value))};return(0,V.jsx)(be,{submitted:n,submittedLabel:s,actions:[...r?.backLabel&&r?.backMessage?[{label:r.backLabel,variant:`ghost`,onClick:d}]:[],{label:r?.submitLabel??`Confirm`,variant:`primary`,disabled:!a,onClick:u}],children:(0,V.jsxs)(`div`,{className:`single-select`,role:`radiogroup`,"aria-label":r?.title??`Select one`,children:[r?.title&&(0,V.jsx)(`div`,{className:`single-select__title`,children:r.title}),i.map((e,t)=>(0,V.jsxs)(`div`,{className:`single-select__row${a===e.value?` single-select__row--selected`:``}`,role:`radio`,"aria-checked":a===e.value,tabIndex:a===e.value||!a&&t===0?0:-1,onClick:()=>l(e.value),onKeyDown:e=>f(e,t),children:[(0,V.jsx)(`span`,{className:`single-select__radio${a===e.value?` single-select__radio--checked`:``}`}),(0,V.jsxs)(`div`,{className:`single-select__info`,children:[(0,V.jsxs)(`span`,{className:`single-select__label`,children:[e.icon&&(0,V.jsx)(`span`,{className:`single-select__icon`,children:e.icon}),e.label]}),e.description&&(0,V.jsx)(`span`,{className:`single-select__desc`,children:e.description})]})]},e.value))]})})}function Se({data:e,onSubmit:n,submitted:r}){let i=e,a=Array.isArray(i?.options)?i.options:[],[o,s]=(0,A.useState)(a.map(e=>!!e.locked||!!e.defaultSelected)),[c,l]=(0,A.useState)(`Submitted`);if(a.length===0)return null;let u=a.some(e=>e.locked),d=a.every((e,t)=>e.locked||o[t]),f=e=>{r||a[e].locked||s(t=>t.map((t,n)=>n===e?!t:t))},p=()=>{r||s(a.map((e,t)=>e.locked?o[t]:!d))},m=a.filter((e,t)=>!e.locked&&o[t]).map(e=>e.value),h=m.length>0||u,g=()=>{if(!(!h||r)){if(l(`Submitted`),m.length===0){n(`No optional plugins selected`);return}n((i?.submitMessage??`Selected: {{values}}`).replace(`{{values}}`,m.join(`, `)))}},_=()=>{r||(l(`Skipped`),n(i?.skipMessage??`Skipped`))},v=()=>{r||(l(i?.backLabel??`Back`),n(i?.backMessage??``))},y=[];return i?.backLabel&&i?.backMessage&&y.push({label:i.backLabel,variant:`ghost`,onClick:v}),i?.skipLabel&&y.push({label:i.skipLabel,variant:`ghost`,onClick:_}),y.push({label:i?.submitLabel??`Confirm`,variant:`primary`,disabled:!h,onClick:g}),(0,V.jsx)(be,{submitted:r,submittedLabel:c,actions:y,children:(0,V.jsxs)(`div`,{className:`multi-select`,children:[i?.title&&(0,V.jsx)(`div`,{className:`multi-select__title`,children:i.title}),i?.selectAll&&(0,V.jsx)(`div`,{className:`multi-select__header`,children:(0,V.jsx)(t,{checked:d,onChange:p,label:`Select all`,disabled:r})}),(0,V.jsx)(`div`,{className:`multi-select__list`,role:`group`,"aria-label":i?.title??`Select options`,children:a.map((e,n)=>{let i=e.group&&(n===0||e.group!==a[n-1].group),s=!!e.locked;return(0,V.jsxs)(A.Fragment,{children:[i&&(0,V.jsx)(`div`,{className:`multi-select__group-header`,children:e.group}),(0,V.jsxs)(`div`,{className:`multi-select__row${s?` multi-select__row--locked`:``}`,role:`checkbox`,"aria-checked":o[n],"aria-disabled":s||void 0,tabIndex:s?-1:0,onClick:()=>f(n),onKeyDown:e=>{r||s||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),f(n))},children:[(0,V.jsx)(t,{checked:o[n],onChange:()=>f(n),disabled:r||s}),(0,V.jsxs)(`div`,{className:`multi-select__info`,children:[(0,V.jsxs)(`span`,{className:`multi-select__label`,children:[e.label,e.badge&&(0,V.jsx)(`span`,{className:`multi-select__badge`,children:e.badge})]}),e.description&&(0,V.jsx)(`span`,{className:`multi-select__desc`,children:e.description})]})]})]},e.value)})})]})})}function Ce({data:e,onSubmit:t,submitted:n}){let r=e,i=Array.isArray(r?.buttons)?r.buttons:[],[a,o]=(0,A.useState)(`Submitted`);if(i.length===0)return null;let s=e=>{n||(o(e.label),t(e.value))};return(0,V.jsx)(be,{submitted:n,submittedLabel:a,actions:i.map(e=>({label:e.label,variant:`primary`,onClick:()=>s(e)})),children:(0,V.jsx)(V.Fragment,{})})}var we={"single-select":xe,"multi-select":Se,"action-buttons":Ce};function Te({name:e,data:t,onSubmit:n,submitted:r}){let i=we[e];return i?(0,V.jsx)(i,{data:t,onSubmit:n,submitted:r}):(console.warn(`[PublicComponentRenderer] Unknown component: "${e}". Registered: ${Object.keys(we).join(`, `)}`),(0,V.jsx)(`div`,{className:`component-card component-card--error`,children:(0,V.jsxs)(`p`,{style:{fontFamily:`var(--font-body)`,fontSize:12,color:`var(--text-secondary)`},children:[`Component “`,e,`” is not available. This may require a platform update.`]})}))}function Ee(e){let t=new Date(e),n=new Date,r=String(t.getHours()).padStart(2,`0`),i=String(t.getMinutes()).padStart(2,`0`),a=String(t.getSeconds()).padStart(2,`0`);return t.toDateString()===n.toDateString()?`${r}:${i}:${a}`:`${String(t.getDate()).padStart(2,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${t.getFullYear()} ${r}:${i}:${a}`}function De({messages:e,isStreaming:n,sessionError:i,selectionMode:a,selectedItems:o,toggleSelectItem:s,onComponentSubmit:c,remainingSuggestions:l,onSuggestionClick:u,isAtBottom:d,setIsAtBottom:f,isGroup:p,sessionId:h}){let[g,_]=(0,A.useState)(new Set),[y,b]=(0,A.useState)(new Set),x=(0,A.useRef)(null),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(!1),E=(0,A.useRef)(!1),D=(0,A.useRef)(!1),O=(0,A.useRef)(0),k=(0,A.useRef)(!1),j=(0,A.useRef)(new Map);k.current=n,(0,A.useEffect)(()=>{n&&!T.current&&d&&(E.current=!0)},[n,d]),(0,A.useEffect)(()=>{if(!E.current&&!d){T.current=n,D.current=!1;return}if(T.current&&!n&&w.current&&C.current){let e=w.current;if(e.offsetHeight>C.current.clientHeight){E.current=!1,D.current=!0,e.scrollIntoView({behavior:`smooth`,block:`start`}),T.current=n;return}}(d||E.current)&&!D.current&&x.current?.scrollIntoView({behavior:`smooth`}),T.current&&!n&&(E.current=!1),T.current=n},[e,d,n]),(0,A.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>{let t=e.scrollTop;k.current&&t<O.current&&(E.current=!1),O.current=t,f(e.scrollHeight-e.scrollTop-e.clientHeight<80)};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>e.removeEventListener(`scroll`,t)},[f]),(0,A.useEffect)(()=>{function e(){b(e=>{let t=new Set;return j.current.forEach((n,r)=>{n.isConnected&&(g.has(r)?e.has(r)&&t.add(r):n.scrollHeight>n.clientHeight+2&&t.add(r))}),e.size===t.size&&[...e].every(e=>t.has(e))?e:t})}e();let t=new ResizeObserver(e);return j.current.forEach(e=>t.observe(e)),()=>t.disconnect()},[e.length,g]);let M=[...e].sort((e,t)=>e.timestamp-t.timestamp);(0,A.useEffect)(()=>{a&&console.log(`[selection] entered`,{conversationId:h??`unknown`,order:M.map(e=>({ts:e.timestamp,role:e.role,id:e.messageId}))})},[a]);let N=M.reduce((e,t,n)=>t.role===`maxy`&&!t.hidden?n:e,-1);return(0,V.jsxs)(`div`,{className:`chat-messages-wrap`,children:[a&&(0,V.jsx)(`div`,{className:`selection-overlay-band`}),(0,V.jsxs)(`div`,{className:`chat-messages`,ref:C,children:[i&&e.length===0&&(0,V.jsx)(`div`,{className:`session-error`,children:(0,V.jsx)(`p`,{children:i})}),M.map((e,i)=>{if(e.hidden)return null;let l=n&&i===M.length-1,u=`${e.timestamp}_${e.role}`,d=o.has(u);return(0,V.jsxs)(`div`,{ref:i===N?w:void 0,className:`message ${e.role}${d?` selected`:``}`,children:[a&&!l&&(0,V.jsx)(`div`,{className:`message-select-check`,children:(0,V.jsx)(t,{checked:d,onChange:()=>s(u)})}),(0,V.jsxs)(`div`,{className:`bubble`,children:[p&&e.role===`visitor`&&e.senderName&&(0,V.jsx)(`span`,{className:`bubble-sender`,children:e.senderName}),e.role===`visitor`&&e.content?(()=>{let t=g.has(i),n=y.has(i);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{ref:e=>{e?j.current.set(i,e):j.current.delete(i)},className:t?`bubble-content`:`bubble-content clamped${n?` overflowing`:``}`,children:e.content}),n&&(0,V.jsx)(`div`,{className:`bubble-expand`,children:(0,V.jsx)(v,{variant:`icon`,className:t?`expanded`:``,onClick:()=>_(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t}),"aria-label":t?`Collapse message`:`Expand message`,children:(0,V.jsx)(r,{size:14})})})]})})():e.content?(0,V.jsx)(ye,{content:e.content,timestamp:Ee(e.timestamp)}):(0,V.jsxs)(`span`,{className:`typing-indicator`,children:[(0,V.jsx)(`span`,{className:`typing-dot`}),(0,V.jsx)(`span`,{className:`typing-dot`}),(0,V.jsx)(`span`,{className:`typing-dot`})]}),e.attachments&&e.attachments.length>0&&(0,V.jsx)(`div`,{className:`message-attachments`,children:e.attachments.map((e,t)=>(0,V.jsxs)(`span`,{className:`message-attachment-chip no-action`,children:[e.mimeType===`application/pdf`?(0,V.jsx)(m,{size:12}):e.mimeType.startsWith(`text/`)?(0,V.jsx)(S,{size:12}):null,(0,V.jsx)(`span`,{children:e.filename})]},t))}),e.role===`visitor`&&(0,V.jsx)(`span`,{className:`message-timestamp`,children:Ee(e.timestamp)})]}),e.role===`maxy`&&e.components&&e.components.length>0&&(0,V.jsx)(`div`,{className:`public-components`,children:e.components.map((e,t)=>(0,V.jsx)(`div`,{className:`public-component-enter`,children:(0,V.jsx)(Te,{name:e.name,data:e.data,onSubmit:e=>c(i,t,e),submitted:e.submitted})},t))})]},i)}),!n&&l.length>0&&(0,V.jsx)(`div`,{className:`chat-suggestions`,children:l.map(e=>(0,V.jsx)(v,{variant:`suggestion`,onClick:()=>u(e),children:e},e))}),(0,V.jsx)(`div`,{ref:x})]}),!d&&(0,V.jsx)(`button`,{className:`scroll-to-bottom`,onClick:()=>x.current?.scrollIntoView({behavior:`smooth`}),"aria-label":`Scroll to bottom`,children:(0,V.jsx)(r,{size:18})})]})}function Oe({selectedItems:e,messages:t,isStreaming:n,copySelected:r,selectAll:i,exitSelection:a,showCopyToast:o}){let[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(null),u=(0,A.useRef)(!1);function d(e){let n=e.lastIndexOf(`_`),r=e.slice(0,n),i=e.slice(n+1),a=parseInt(r,10);return t.find(e=>e.timestamp===a&&e.role===i)?.content??``}function f(e,t){return parseInt(e.slice(0,e.lastIndexOf(`_`)),10)-parseInt(t.slice(0,t.lastIndexOf(`_`)),10)}function p(){let e=[...t].sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let t of e){if(t.hidden||!t.content)continue;let e=t.role===`visitor`?`Visitor`:`Maxy`;n.push(`${e}:\n${t.content}`)}return n.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BKzdtZgG.js","assets/dist-Bd4S37oi.js","assets/chunk-DD-I1_y5.js","assets/chunk-U2HBQHQK-CwMCwyfq.js","assets/src-B6XdH6xq.js","assets/chunk-5PVQY5BW-DOeY60Lp.js","assets/chunk-ICPOFSXX-rgw1I6pt.js","assets/_baseFor-BHtDrjIo.js","assets/isEmpty-BWl67LAZ.js","assets/chunk-336JU56O-XIsdqKyD.js","assets/chunk-5FUZZQ4R-3-UZ9191.js","assets/chunk-X2U36JSP-CvKfDVvq.js","assets/chunk-ZZ45TVLE-sANOwJKn.js","assets/rough.esm-DKRO8IF-.js","assets/chunk-ENJZ2VHE-CszgAcWZ.js","assets/line-Br0FyyFW.js","assets/path-B0Ik7Tu9.js","assets/array-DetWRiSa.js","assets/chunk-BSJP7CBP-DP7LTBll.js","assets/chunk-426QAEUC-Dw4mcMYK.js","assets/chunk-XPW4576I-m1Y_r88I.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,c as n,d as r,f as i,h as a,l as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./brand-HqTMr1bV.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./device-url-actions-nxh9PmIH.js";import{t as x}from"./Checkbox-B34vplI7.js";var S=i(`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`}]]),C=i(`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`}]]),w=i(`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`}]]),T=i(`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`}]]),E=i(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),D=i(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),O=i(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),k=l(),A=e(a(),1),j=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.opus,.ogg,.m4a,.mp3,.wav,.webm`,M=new Set(j.split(`,`).filter(e=>!e.startsWith(`.`))),N=50*1024*1024,P=typeof window<`u`&&/^(localhost|127\.0\.0\.1|[a-z0-9-]+\.local)(:|$)/.test(window.location.hostname);function ee(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function F(){let e=window.location.pathname;if(e.startsWith(`/g/`))return;let t=e.match(/^\/([a-z][a-z0-9-]{2,49})$/);return t?t[1]:void 0}function I(){let e=window.location.pathname.match(/^\/g\/([a-z0-9][a-z0-9-]{0,49})$/);return e?e[1]:void 0}function L(e){return[{key:`length`,label:`At least 8 characters`,met:e.length>=8},{key:`number`,label:`Contains a number`,met:/\d/.test(e)},{key:`special`,label:`Contains a special character`,met:/[^A-Za-z0-9]/.test(e)},{key:`whitespace`,label:`No spaces`,met:e.length>0&&!/\s/.test(e)}]}function R(e,t){if(t===`phone`)return e.length>4?e.slice(0,e.length-4).replace(/\d/g,`•`)+` `+e.slice(-4):e;let n=e.indexOf(`@`);return n<=2?e:e.slice(0,2)+`•••`+e.slice(n)}function z(e){let[t,n]=(0,A.useState)(null),[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(`loading`),[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)(null),[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(!1),[h,g]=(0,A.useState)(null),_=(0,A.useMemo)(()=>F(),[]),v=(0,A.useMemo)(()=>I(),[]),[y,b]=(0,A.useState)(null),x=(0,A.useRef)(_||``),S=(0,A.useRef)(null),C=(0,A.useRef)(null),w=(0,A.useRef)(!1),T=(0,A.useRef)(null),[E,D]=(0,A.useState)(`sign-in`),[O,k]=(0,A.useState)(null),j=(0,A.useRef)(null),M=(0,A.useRef)(null);(0,A.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(M.current=e)}catch{}},[]);let N=(0,A.useCallback)(t=>{S.current=t,n(t);try{sessionStorage.setItem(`maxy_session`,t)}catch{}o(`chat`),e(t)},[e]),L=(0,A.useCallback)(()=>{S.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}n(null),o(`auth-required`),D(`sign-in`)},[]),R=(0,A.useCallback)(async e=>{try{let t=x.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})}),r=await n.json();n.ok?(j.current=r.session_key,k(r.grant),D(`set-password`),window.history.replaceState({},``,window.location.pathname)):D(`link-expired`)}catch{D(`sign-in`)}},[]),z=(0,A.useCallback)(async()=>{if(S.current)return S.current;if(C.current)return C.current;let e=(async()=>{try{let e=M.current,t=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:ee(),..._?{agent:_}:{},...v?{group_slug:v}:{},...e?{session_key:e}:{}})});if(!t.ok){let e=await t.json().catch(()=>({error:``}));return P&&console.error(`[session] POST /api/session failed: ${t.status} ${t.statusText}`,e),t.status===404?i(e.error||`Agent not found`):t.status===503&&i(e.error||`Service unavailable`),null}let r=await t.json();if(r.auth_required){r.agent_id&&(x.current=r.agent_id),c(r.displayName||``),r.agentImage&&u(r.agentImage),r.agentImageShape&&f(r.agentImageShape),r.showAgentName&&m(r.showAgentName),r.branding&&g(r.branding),o(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?R(e):D(`sign-in`),null}S.current=r.session_key,n(r.session_key),r.displayName&&c(r.displayName),r.agentImage&&u(r.agentImage),r.agentImageShape&&f(r.agentImageShape),r.showAgentName&&m(r.showAgentName),r.branding&&g(r.branding),o(`chat`),r.resumed&&r.messages&&(w.current=!0,T.current=r.messages),r.group&&b({groupSlug:r.groupSlug,groupName:r.groupName,participants:r.participants??[]});try{sessionStorage.setItem(`maxy_session`,r.session_key)}catch{}return r.session_key}catch(e){return P&&console.error(`[session] fetch /api/session threw:`,e),i(`Unable to connect. Please check your connection and try again.`),null}finally{C.current=null}})();return C.current=e,e},[_,v,R]);return{sessionId:t,cacheKeyRef:S,sessionError:r,pageState:a,setPageState:o,agentDisplayName:s,agentImage:l,agentImageShape:d,showAgentName:p,agentSlug:_,branding:h,resolvedSlugRef:x,ensureSession:z,startNewSession:(0,A.useCallback)(async()=>{S.current=null,C.current=null,M.current=null,w.current=!1,T.current=null,n(null),i(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}let t=await z();t&&e(t)},[z,e]),enterChat:N,enterGate:L,resumedRef:w,resumeMessagesRef:T,gateState:E,setGateState:D,grantInfo:O,setGrantInfo:k,gateCacheKeyRef:j,groupContext:y,groupSlug:v}}async function*B(e){let t=e.body?.getReader();if(!t)throw Error(`No response stream`);let n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
|
|
3
|
+
`);r=a.pop();for(let e of a){if(!e.startsWith(`data: `))continue;let t=e.slice(6);if(t===`[DONE]`)continue;let n;try{n=JSON.parse(t)}catch{continue}yield n}}}finally{t.cancel()}}function te({cacheKeyRef:e,ensureSession:t,sessionError:n,pageState:r,inputRef:i}){let[a,o]=(0,A.useState)([]),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(!1),u=e=>{l.current=e,c(e)},d=(0,A.useCallback)(async a=>{if(!l.current){u(!0),o([{role:`maxy`,content:``,timestamp:Date.now()}]);try{let n=await fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({greeting:!0,session_key:a})});if(n.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}P&&console.warn(`[greeting] stale session, retrying with fresh session`);let r=await t();if(!r)return;n=await fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({greeting:!0,session_key:r})})}if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let r=``,i=``,s=()=>{i&&(r+=i,i=``,o(e=>{let t=[...e];return t[0]={...t[0],content:r},t}))},c=setInterval(s,60);try{for await(let e of B(n)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(i+=e.text),e.type===`component`&&(s(),o(t=>{let n=[...t],r={...n[0]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[0]={...r,components:i},n}))}}finally{clearInterval(c),s()}}catch(e){if(P&&console.error(`[chat] greeting failed:`,e),r===`auth-required`)return;let t=e instanceof Error?e.message:String(e);o([{role:`maxy`,content:e instanceof Error&&e.fromSSE?t:n??`I'm having trouble connecting right now. Try refreshing the page.`,timestamp:Date.now()}])}finally{u(!1),r===`chat`&&i.current?.focus()}}},[e,t,n,r,i]),f=(0,A.useCallback)(async(a,s)=>{let c=s?.hidden??!1,d=s?.files??[];if(!a&&d.length===0||l.current)return;u(!0);let f=d.map(e=>({filename:e.name,mimeType:e.type})),p={role:`visitor`,content:a,attachments:f.length>0?f:void 0,timestamp:Date.now(),hidden:c},m;o(e=>{let t=[...e,p,{role:`maxy`,content:``,timestamp:Date.now()}];return m=t.length-1,t});try{let n=await t();if(!n)throw Error(`session`);let r=e=>{if(d.length>0){let t=new FormData;t.append(`message`,a),t.append(`session_key`,e);for(let e of d)t.append(`attachments`,e);return{body:t,headers:{}}}return{body:JSON.stringify({message:a,session_key:e}),headers:{"Content-Type":`application/json`}}},{body:i,headers:s}=r(n),c=await fetch(`/api/chat`,{method:`POST`,headers:s,body:i});if(c.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}P&&console.warn(`[session-expired] stale key cleared, retrying with fresh session`);let n=await t();if(!n)throw Error(`session`);({body:i,headers:s}=r(n)),c=await fetch(`/api/chat`,{method:`POST`,headers:s,body:i})}if(!c.ok){let e=await c.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let l=``,u=``,f=()=>{u&&(l+=u,u=``,o(e=>{let t=[...e];return t[m]={...t[m],content:l},t}))},p=setInterval(f,60);try{for await(let e of B(c)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(u+=e.text),e.type===`component`&&(f(),o(t=>{let n=[...t],r={...n[m]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[m]={...r,components:i},n}))}}finally{clearInterval(p),f()}}catch(e){if(P&&console.error(`[chat] sendMessage failed:`,e),r===`auth-required`)return;let t=e instanceof Error?e.message:String(e),i=e instanceof Error&&e.fromSSE;o(e=>{let r=[...e];return r[m]={...r[m],content:i?t:t===`session`?n??`I'm having trouble connecting right now. Try refreshing the page.`:`Sorry, I hit a snag. Try again in a moment.`},r})}finally{u(!1),r===`chat`&&i.current?.focus()}},[e,t,n,r,i]);return{messages:a,setMessages:o,isStreaming:s,sendMessage:f,sendGreeting:d,handleComponentSubmit:(0,A.useCallback)((e,t,n)=>{o(n=>{let r=[...n],i={...r[e]},a=[...i.components||[]];return a[t]={...a[t],submitted:!0},r[e]={...i,components:a},r}),f(n,{hidden:!0})},[f])}}function ne({cacheKeyRef:e,groupSlug:t,isStreaming:n,setMessages:r}){let i=(0,A.useRef)(new Date().toISOString()),a=(0,A.useRef)(!0);(0,A.useEffect)(()=>{let e=()=>{a.current=document.visibilityState===`visible`};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let o=(0,A.useCallback)(async()=>{let n=e.current;if(!(!n||!t))try{let e=await fetch(`/api/group/messages?session_key=${encodeURIComponent(n)}&since=${encodeURIComponent(i.current)}`);if(!e.ok)return;let t=await e.json();if(!t.messages||t.messages.length===0)return;let a=t.messages[t.messages.length-1];a.timestamp&&(i.current=new Date(a.timestamp).toISOString()),r(e=>{let n=new Set(e.filter(e=>e.messageId).map(e=>e.messageId)),r=t.messages.filter(e=>!n.has(e.messageId)).map(e=>({role:e.role,content:e.content,timestamp:e.timestamp,senderName:e.senderName??void 0,senderVisitorId:e.senderVisitorId??void 0,messageId:e.messageId}));if(r.length===0)return e;let i=[...e,...r];return i.sort((e,t)=>e.timestamp-t.timestamp),i})}catch(e){console.error(`[group-poll] failed: ${e instanceof Error?e.message:String(e)}`)}},[e,t,r]);(0,A.useEffect)(()=>{if(!t)return;let e,r=!1;function i(){if(r)return;let t=a.current?3e3:3e4;e=setTimeout(async()=>{n||await o(),i()},t)}return i(),()=>{r=!0,clearTimeout(e)}},[t,n,o])}var V=t();function re({value:e,onChange:t,onComplete:n,disabled:r}){let i=(0,A.useRef)([]);function a(n,r){r.key===`Backspace`?(r.preventDefault(),e[n]?t(e.slice(0,n)+e.slice(n+1)):n>0&&(t(e.slice(0,n-1)+e.slice(n)),i.current[n-1]?.focus())):r.key===`ArrowLeft`&&n>0?i.current[n-1]?.focus():r.key===`ArrowRight`&&n<5&&i.current[n+1]?.focus()}function o(r,a){let o=a.nativeEvent.data;if(!o||!/^\d$/.test(o))return;let s=e.split(``);for(s[r]=o;s.length<r;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);t(c),c.length===6?n(c):r<5&&i.current[r+1]?.focus()}function s(e){e.preventDefault();let r=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);r&&(t(r),r.length===6?n(r):i.current[r.length]?.focus())}return(0,V.jsx)(`div`,{className:`gate-otp-field`,children:Array.from({length:6}).map((t,n)=>(0,V.jsx)(`input`,{ref:e=>{i.current[n]=e},type:`text`,inputMode:`numeric`,className:`pin-box${e[n]?` pin-box-filled`:``}`,value:e[n]||``,onKeyDown:e=>a(n,e),onInput:e=>o(n,e),onPaste:s,onFocus:e=>e.target.select(),autoFocus:n===0,autoComplete:`off`,maxLength:1,disabled:r,"aria-label":`Code digit ${n+1}`},n))})}function ie({gateState:e,setGateState:t,grantInfo:n,setGrantInfo:r,gateCacheKeyRef:i,resolvedSlugRef:a,onAuthenticated:o}){let[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(``),[p,m]=(0,A.useState)(!1),[h,g]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(null),[T,E]=(0,A.useState)(null),[D,O]=(0,A.useState)(!1);async function k(e){if(e.preventDefault(),!D){w(null),O(!0);try{let e=a.current,n=await fetch(`/api/access/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contact:s,password:l,agentSlug:e})}),i=await n.json();n.ok?o(i.session_key):n.status===401?i.error?.includes(`setup not complete`)||i.error?.includes(`invitation link`)?(t(`private-agent`),w(null)):w(i.error||`Invalid credentials`):n.status===403?(t(`access-expired`),i.expiresAt&&r(e=>e?{...e,expiresAt:i.expiresAt}:{displayName:null,contactValue:s,contactMethod:`email`,expiresAt:i.expiresAt,status:`expired`})):n.status===429?w(i.error||`Too many attempts. Please try again later.`):w(i.error||`Something went wrong`)}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function j(e){if(!D){w(null),O(!0);try{let n=a.current,o=await fetch(`/api/access/verify-otp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({phone:v,code:e,agentSlug:n})}),s=await o.json();o.ok?(i.current=s.session_key,r(s.grant),t(`set-password`)):o.status===429?t(`otp-failed`):(w(s.error||`Invalid code`),g(``))}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function M(e){if(e.preventDefault(),!D){if(w(null),l!==d){w(`Passwords do not match`);return}if(!L(l).every(e=>e.met)){w(`Password does not meet requirements`);return}O(!0);try{let e=i.current;if(!e){w(`Session expired. Please use your invitation link again.`);return}let t=await fetch(`/api/access/create-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_key:e,password:l})}),n=await t.json();t.ok?o(n.session_key):t.status===400&&n.requirements?w(n.requirements.filter(e=>!e.met).map(e=>e.label).join(`, `)):w(n.error||`Something went wrong`)}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}async function N(e){if(e.preventDefault(),!(D||!s)){w(null),O(!0);try{let e=a.current,t=await fetch(`/api/access/forgot-password`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contact:s,agentSlug:e})});t.status===429?w((await t.json()).error||`Too many attempts. Please try again later.`):(E(`If an account exists, a reset link has been sent.`),setTimeout(()=>{S(!1),E(null)},4e3))}catch{w(`Unable to connect. Please try again.`)}finally{O(!1)}}}switch(e){case`set-password`:{let e=L(l),t=e.every(e=>e.met),r=l===d,i=t&&r&&d.length>0;return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[n?.expiresAt&&(0,V.jsxs)(`div`,{className:`gate-expiry-badge`,children:[`Access until `,new Date(n.expiresAt).toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`})]}),(0,V.jsxs)(`h2`,{className:`gate-title`,children:[`Welcome, `,n?.displayName||`there`]}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`Create a password to access this agent in the future.`}),(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:M,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-display-name`,children:`Display name`}),(0,V.jsx)(`input`,{id:`gate-display-name`,type:`text`,value:n?.displayName||``,disabled:!0})]}),(0,V.jsxs)(`div`,{className:`gate-field gate-pw-row`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-pw`,children:`Password`}),(0,V.jsx)(`div`,{className:`gate-pw-toggle`,children:(0,V.jsx)(x,{checked:p,onChange:m,label:`Show`})}),(0,V.jsx)(`input`,{id:`gate-pw`,type:p?`text`:`password`,value:l,onChange:e=>u(e.target.value),placeholder:`Your password`,autoFocus:!0,autoComplete:`new-password`}),l.length>0&&(0,V.jsx)(`div`,{className:`gate-strength`,children:e.map(e=>(0,V.jsxs)(`span`,{className:`gate-strength-item${e.met?` met`:``}`,children:[e.met?`✓`:`○`,` `,e.label]},e.key))})]}),(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-pw-confirm`,children:`Confirm password`}),(0,V.jsx)(`input`,{id:`gate-pw-confirm`,type:p?`text`:`password`,value:d,onChange:e=>f(e.target.value),placeholder:`Confirm your password`,autoComplete:`new-password`}),d.length>0&&!r&&(0,V.jsx)(`div`,{className:`gate-error`,children:`Passwords do not match`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(_,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!i||D,loading:D,children:`Create account & enter chat`})})]})]})})}case`enter-otp`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`h2`,{className:`gate-title`,children:`Enter your code`}),(0,V.jsxs)(`p`,{className:`gate-subtitle`,children:[`Enter the 6-digit code sent to `,R(v,`phone`)]}),(0,V.jsx)(re,{value:h,onChange:g,onComplete:j,disabled:D}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),D&&(0,V.jsxs)(`div`,{className:`gate-loading`,children:[(0,V.jsx)(`span`,{className:`spinner`}),`Verifying...`]}),(0,V.jsx)(`div`,{className:`gate-resend`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{t(`sign-in`),g(``),w(null)},children:`Use a different number`})})]})});case`sign-in`:case`private-agent`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`h2`,{className:`gate-title`,children:e===`private-agent`?`Private Agent`:`Welcome back`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:e===`private-agent`?`This agent is invitation-only. If you have an account, sign in below.`:`Sign in to continue your conversation.`}),b?(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:N,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-forgot-contact`,children:`Email or phone`}),(0,V.jsx)(`input`,{id:`gate-forgot-contact`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`you@example.com`,autoFocus:!0,autoComplete:`email`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),T&&(0,V.jsx)(`div`,{className:`gate-success`,children:T}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(_,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!s.trim()||D,loading:D,children:`Send reset link`})}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{S(!1),w(null),E(null)},children:`Back to sign in`})})]}):(0,V.jsxs)(`form`,{className:`gate-form`,onSubmit:k,children:[(0,V.jsxs)(`div`,{className:`gate-field`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-contact`,children:`Email or phone`}),(0,V.jsx)(`input`,{id:`gate-contact`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`you@example.com`,autoFocus:!0,autoComplete:`email`})]}),(0,V.jsxs)(`div`,{className:`gate-field gate-pw-row`,children:[(0,V.jsx)(`label`,{htmlFor:`gate-login-pw`,children:`Password`}),(0,V.jsx)(`div`,{className:`gate-pw-toggle`,children:(0,V.jsx)(x,{checked:p,onChange:m,label:`Show`})}),(0,V.jsx)(`input`,{id:`gate-login-pw`,type:p?`text`:`password`,value:l,onChange:e=>u(e.target.value),placeholder:`Your password`,autoComplete:`current-password`})]}),C&&(0,V.jsx)(`div`,{className:`gate-error`,children:C}),(0,V.jsx)(`div`,{className:`gate-submit`,children:(0,V.jsx)(_,{variant:`primary`,type:`submit`,fullWidth:!0,disabled:!s.trim()||!l||D,loading:D,children:`Sign in`})}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`gate-link`,onClick:()=>{S(!0),w(null)},children:`Forgot password?`})})]}),e===`private-agent`&&(0,V.jsx)(`p`,{className:`gate-hint`,children:`No account? You need an invitation from the agent owner.`})]})});case`access-expired`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⏰`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Access expired`}),(0,V.jsxs)(`p`,{className:`gate-subtitle`,children:[n?.expiresAt?`Your access expired on ${new Date(n.expiresAt).toLocaleDateString(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`})}.`:`Your access to this agent has expired.`,` `,`Contact the agent owner to renew.`]}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(_,{variant:`secondary`,onClick:()=>{t(`sign-in`),w(null),u(``)},children:`Sign in with a different account`})})]})});case`link-expired`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⚠️`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Link expired`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`This invitation link has expired or has already been used. If you already set your password, sign in below. Otherwise, ask the agent owner to send a new invitation.`}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(_,{variant:`primary`,onClick:()=>{t(`sign-in`),w(null)},children:`Go to sign in`})})]})});case`otp-failed`:return(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsxs)(`div`,{className:`gate-card`,children:[(0,V.jsx)(`div`,{className:`gate-icon`,children:`⛔`}),(0,V.jsx)(`h2`,{className:`gate-title`,children:`Too many attempts`}),(0,V.jsx)(`p`,{className:`gate-subtitle`,children:`You've entered the wrong code too many times. Ask the agent owner to send a new code.`}),(0,V.jsx)(`div`,{className:`gate-actions`,children:(0,V.jsx)(_,{variant:`secondary`,onClick:()=>{t(`sign-in`),w(null),g(``)},children:`Back to sign in`})})]})})}}var H=100;function U(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,reason:`invalid JSON: ${e instanceof Error?e.message:String(e)}`}}if(typeof t!=`object`||!t||Array.isArray(t))return{ok:!1,reason:`payload is not a JSON object`};let n=t;if(typeof n.url!=`string`||n.url.length===0)return{ok:!1,reason:`url is required`};let r;try{r=new URL(n.url)}catch{return{ok:!1,reason:`url is not a valid URL`}}if(r.protocol!==`http:`&&r.protocol!==`https:`)return{ok:!1,reason:`url scheme ${r.protocol} is not permitted (http/https only)`};if(typeof n.intent!=`string`||n.intent.length===0)return{ok:!1,reason:`intent is required`};if(n.intent.length>H)return{ok:!1,reason:`intent exceeds ${H} chars`};let i;if(n.hostname!==void 0){if(typeof n.hostname!=`string`)return{ok:!1,reason:`hostname must be a string when provided`};i=n.hostname}return{ok:!0,payload:i?{url:n.url,intent:n.intent,hostname:i}:{url:n.url,intent:n.intent}}}var W={ok:`succeeded`,timeout:`navigation timed out`,"cdp-unreachable":`device browser is not responding`,error:`navigation error`};async function G(e,t){try{await fetch(`/api/admin/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:e,fields:t})})}catch(t){console.error(`[device-url:event] failed to post event`,e,t)}}function K({raw:e,reason:t}){return(0,A.useEffect)(()=>{G(`device-url:malformed`,{reason:t.slice(0,200),length:e.length})},[e,t]),(0,V.jsx)(`pre`,{className:`md-pre md-device-url-malformed`,children:(0,V.jsxs)(`code`,{className:`md-code`,children:[(0,V.jsxs)(`span`,{className:`md-device-url-malformed-label`,children:[(0,V.jsx)(O,{size:12}),` device-URL block is malformed: `,t]}),`
|
|
4
|
+
`,e]})})}function q({payload:e,reason:t}){let[n,i]=(0,A.useState)(`idle`);(0,A.useEffect)(()=>{G(`device-url:fallback-shown`,{intent:e.intent,reason:t,hostname:e.hostname??``})},[e.intent,e.hostname,t]);let a=async()=>{if(await h(e.url)){i(`copied`),window.setTimeout(()=>i(`idle`),2e3);return}i(`failed`),G(`device-url:fallback-shown`,{intent:e.intent,reason:`clipboard-write-failed`,hostname:e.hostname??``})},o=e.hostname?` on the device (${e.hostname})`:` on the device`;return(0,V.jsxs)(`div`,{className:`md-device-url md-device-url-fallback`,role:`group`,children:[(0,V.jsxs)(`div`,{className:`md-device-url-fallback-message`,children:[(0,V.jsx)(O,{size:14}),(0,V.jsxs)(`span`,{children:[`Could not open `,(0,V.jsx)(`strong`,{children:e.intent}),o,` automatically (`,t,`). Copy the URL and open it in a browser on the device:`]})]}),(0,V.jsxs)(`div`,{className:`md-device-url-fallback-url`,children:[(0,V.jsx)(`code`,{children:e.url}),(0,V.jsxs)(`button`,{type:`button`,className:`md-device-url-fallback-copy`,onClick:a,"aria-label":`Copy URL`,children:[n===`copied`?(0,V.jsx)(r,{size:14}):(0,V.jsx)(y,{size:14}),n===`copied`?`Copied`:n===`failed`?`Copy failed`:`Copy`]})]}),n===`failed`&&(0,V.jsx)(`div`,{className:`md-device-url-fallback-copy-failed`,children:`Your browser blocked the copy action. Select the URL text above manually to copy it.`})]})}function J({payload:e}){let t=b(),[r,i]=(0,A.useState)({phase:`idle`});(0,A.useEffect)(()=>{G(`device-url:render`,{intent:e.intent,url:e.url,hostname:e.hostname??``,origin:`tool`})},[e.intent,e.url,e.hostname]);let a=async()=>{if(r.phase!==`navigating`){i({phase:`navigating`});try{let n=await fetch(`/api/admin/device-browser/navigate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(n.ok&&r.ok){i({phase:`succeeded`}),t&&(t.onShowVnc(),G(`device-url:vnc-surface-shown`,{intent:e.intent})),window.setTimeout(()=>i({phase:`idle`}),2500);return}i({phase:`fallback`,reason:r.navigateResult?W[r.navigateResult]:r.detail?r.detail.slice(0,80):`navigation failed`})}catch(e){i({phase:`fallback`,reason:(e instanceof Error?e.message:String(e)).slice(0,80)})}}},o=r.phase===`navigating`,s=r.phase===`succeeded`;return(0,V.jsxs)(`div`,{className:`md-device-url`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`md-device-url-button`,onClick:a,disabled:o,"aria-label":`Open ${e.intent} on the device's browser`,title:e.hostname?`Opens on device: ${e.hostname}`:`Opens on the device running Maxy`,children:[(0,V.jsx)(n,{size:16,className:`md-device-url-icon`}),(0,V.jsx)(`span`,{className:`md-device-url-label`,children:o?`Opening…`:s?`Opened on device`:`Open ${e.intent} on device`})]}),r.phase===`fallback`&&(0,V.jsx)(q,{payload:e,reason:r.reason})]})}function Y({source:e}){let t=U(e.trim());return t.ok?(0,V.jsx)(J,{payload:t.payload}):(0,V.jsx)(K,{raw:e,reason:t.reason})}var X=`modulepreload`,ae=function(e){return`/`+e},Z={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=ae(t,n),t in Z)return;Z[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:X,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$=null;function oe(){return $||=Q(async()=>{let{default:e}=await import(`./mermaid.core-BKzdtZgG.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`neutral`}),e)),$}function se({source:e}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let n=!1,i=`mermaid-${Math.random().toString(36).slice(2,9)}`;return oe().then(t=>t.render(i,e)).then(({svg:e})=>{!n&&t.current&&(t.current.innerHTML=e)}).catch(t=>{n||(console.error(`[MermaidBlock] render failed:`,e,t),r(t instanceof Error?t.message:`Diagram render failed`))}),()=>{n=!0}},[e]),n?(0,V.jsxs)(`div`,{className:`md-mermaid md-mermaid-error`,children:[(0,V.jsx)(`div`,{className:`md-mermaid-error-label`,children:`Diagram render error`}),(0,V.jsx)(`pre`,{className:`md-pre`,children:(0,V.jsx)(`code`,{className:`md-code`,children:e})})]}):(0,V.jsx)(`div`,{className:`md-mermaid`,ref:t})}var ce=/\.(mp4|webm|mov)(\?.*)?$/i,le=/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/,ue=/vimeo\.com\/(\d+)/;function de(e){return!!e&&ce.test(e)}function fe(e){if(!e)return null;let t=e.match(le);return t?t[1]:null}function pe(e){if(!e)return null;let t=e.match(ue);return t?t[1]:null}function me({src:e}){return(0,V.jsx)(`video`,{className:`md-video`,controls:!0,playsInline:!0,preload:`metadata`,children:(0,V.jsx)(`source`,{src:e})})}function he({videoId:e}){return(0,V.jsx)(`div`,{className:`md-video-iframe`,children:(0,V.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${e}`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function ge({videoId:e}){return(0,V.jsx)(`div`,{className:`md-video-iframe`,children:(0,V.jsx)(`iframe`,{src:`https://player.vimeo.com/video/${e}`,allow:`autoplay; fullscreen; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function _e(e){if(de(e))return(0,V.jsx)(me,{src:e});let t=fe(e);if(t)return(0,V.jsx)(he,{videoId:t});let n=pe(e);return n?(0,V.jsx)(ge,{videoId:n}):null}var ve={p:({children:e})=>(0,V.jsx)(`p`,{className:`md-p`,children:e}),h1:({children:e})=>(0,V.jsx)(`h1`,{className:`md-heading`,children:e}),h2:({children:e})=>(0,V.jsx)(`h2`,{className:`md-heading`,children:e}),h3:({children:e})=>(0,V.jsx)(`h3`,{className:`md-heading`,children:e}),code:({children:e,className:t})=>t===`language-mermaid`?(0,V.jsx)(se,{source:String(e).replace(/\n$/,``)}):t===`language-maxy-device-url`?(0,V.jsx)(Y,{source:String(e).replace(/\n$/,``)}):(0,V.jsx)(`code`,{className:`md-code ${t||``}`.trim(),children:e}),pre:({children:e,node:t})=>{let n=t?.children?.[0];if(n?.type===`element`&&n.tagName===`code`){let t=n.properties?.className??[];if(t.includes(`language-mermaid`)||t.includes(`language-maxy-device-url`))return(0,V.jsx)(V.Fragment,{children:e})}return(0,V.jsx)(`pre`,{className:`md-pre`,children:e})},ul:({children:e})=>(0,V.jsx)(`ul`,{className:`md-list`,children:e}),ol:({children:e})=>(0,V.jsx)(`ol`,{className:`md-list md-list-ordered`,children:e}),li:({children:e})=>(0,V.jsx)(`li`,{className:`md-list-item`,children:e}),hr:()=>(0,V.jsx)(`hr`,{className:`md-hr`}),strong:({children:e})=>(0,V.jsx)(`strong`,{className:`md-strong`,children:e}),img:({src:e,alt:t})=>_e(e)||(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:(0,V.jsx)(`img`,{className:`md-img`,src:e,alt:t||``,loading:`lazy`})}),a:({href:e,children:t})=>_e(e)||(0,V.jsx)(`a`,{href:e,className:`md-link`,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({children:e})=>(0,V.jsx)(`table`,{className:`md-table`,children:e}),thead:({children:e})=>(0,V.jsx)(`thead`,{className:`md-thead`,children:e}),tbody:({children:e})=>(0,V.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,V.jsx)(`tr`,{className:`md-tr`,children:e}),th:({children:e})=>(0,V.jsx)(`th`,{className:`md-th`,children:e}),td:({children:e})=>(0,V.jsx)(`td`,{className:`md-td`,children:e})};function ye({content:e,elapsedSeconds:t,timestamp:n}){return(0,V.jsxs)(`div`,{className:`markdown-message`,children:[(0,V.jsx)(v,{remarkPlugins:[g],components:ve,children:e}),t!==void 0&&(0,V.jsxs)(`div`,{className:`message-meta`,children:[t,`s`]}),n&&(0,V.jsx)(`span`,{className:`message-timestamp`,children:n})]})}function be({submitted:e,submittedLabel:t=`Submitted`,actions:n,children:r}){return(0,V.jsxs)(`div`,{className:`component-card${e?` component-card--submitted`:``}`,children:[r,(0,V.jsx)(`div`,{className:`component-card__actions`,children:e?(0,V.jsx)(`span`,{className:`component-card__done-label`,children:t}):n.map((e,t)=>(0,V.jsx)(_,{variant:e.variant,size:`sm`,disabled:e.disabled,onClick:e.onClick,children:e.label},t))})]})}function xe({data:e,onSubmit:t,submitted:n}){let r=e,i=Array.isArray(r?.options)?r.options:[],[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(`Submitted`);if(i.length===0)return null;let l=e=>{n||o(e)},u=()=>{if(!a||n)return;let e=i.find(e=>e.value===a);c(e?.label??`Submitted`),t((r?.submitMessage??`Selected: {{value}}`).replace(`{{value}}`,a).replace(`{{label}}`,e?.label??a))},d=()=>{n||(c(r?.backLabel??`Back`),t(r?.backMessage??``))},f=(e,t)=>{if(!n)if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault();let n=(t+1)%i.length;l(i[n].value),(e.currentTarget.parentElement?.children[n])?.focus()}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault();let n=(t-1+i.length)%i.length;l(i[n].value),(e.currentTarget.parentElement?.children[n])?.focus()}else (e.key===` `||e.key===`Enter`)&&(e.preventDefault(),l(i[t].value))};return(0,V.jsx)(be,{submitted:n,submittedLabel:s,actions:[...r?.backLabel&&r?.backMessage?[{label:r.backLabel,variant:`ghost`,onClick:d}]:[],{label:r?.submitLabel??`Confirm`,variant:`primary`,disabled:!a,onClick:u}],children:(0,V.jsxs)(`div`,{className:`single-select`,role:`radiogroup`,"aria-label":r?.title??`Select one`,children:[r?.title&&(0,V.jsx)(`div`,{className:`single-select__title`,children:r.title}),i.map((e,t)=>(0,V.jsxs)(`div`,{className:`single-select__row${a===e.value?` single-select__row--selected`:``}`,role:`radio`,"aria-checked":a===e.value,tabIndex:a===e.value||!a&&t===0?0:-1,onClick:()=>l(e.value),onKeyDown:e=>f(e,t),children:[(0,V.jsx)(`span`,{className:`single-select__radio${a===e.value?` single-select__radio--checked`:``}`}),(0,V.jsxs)(`div`,{className:`single-select__info`,children:[(0,V.jsxs)(`span`,{className:`single-select__label`,children:[e.icon&&(0,V.jsx)(`span`,{className:`single-select__icon`,children:e.icon}),e.label]}),e.description&&(0,V.jsx)(`span`,{className:`single-select__desc`,children:e.description})]})]},e.value))]})})}function Se({data:e,onSubmit:t,submitted:n}){let r=e,i=Array.isArray(r?.options)?r.options:[],[a,o]=(0,A.useState)(i.map(e=>!!e.locked||!!e.defaultSelected)),[s,c]=(0,A.useState)(`Submitted`);if(i.length===0)return null;let l=i.some(e=>e.locked),u=i.every((e,t)=>e.locked||a[t]),d=e=>{n||i[e].locked||o(t=>t.map((t,n)=>n===e?!t:t))},f=()=>{n||o(i.map((e,t)=>e.locked?a[t]:!u))},p=i.filter((e,t)=>!e.locked&&a[t]).map(e=>e.value),m=p.length>0||l,h=()=>{if(!(!m||n)){if(c(`Submitted`),p.length===0){t(`No optional plugins selected`);return}t((r?.submitMessage??`Selected: {{values}}`).replace(`{{values}}`,p.join(`, `)))}},g=()=>{n||(c(`Skipped`),t(r?.skipMessage??`Skipped`))},_=()=>{n||(c(r?.backLabel??`Back`),t(r?.backMessage??``))},v=[];return r?.backLabel&&r?.backMessage&&v.push({label:r.backLabel,variant:`ghost`,onClick:_}),r?.skipLabel&&v.push({label:r.skipLabel,variant:`ghost`,onClick:g}),v.push({label:r?.submitLabel??`Confirm`,variant:`primary`,disabled:!m,onClick:h}),(0,V.jsx)(be,{submitted:n,submittedLabel:s,actions:v,children:(0,V.jsxs)(`div`,{className:`multi-select`,children:[r?.title&&(0,V.jsx)(`div`,{className:`multi-select__title`,children:r.title}),r?.selectAll&&(0,V.jsx)(`div`,{className:`multi-select__header`,children:(0,V.jsx)(x,{checked:u,onChange:f,label:`Select all`,disabled:n})}),(0,V.jsx)(`div`,{className:`multi-select__list`,role:`group`,"aria-label":r?.title??`Select options`,children:i.map((e,t)=>{let r=e.group&&(t===0||e.group!==i[t-1].group),o=!!e.locked;return(0,V.jsxs)(A.Fragment,{children:[r&&(0,V.jsx)(`div`,{className:`multi-select__group-header`,children:e.group}),(0,V.jsxs)(`div`,{className:`multi-select__row${o?` multi-select__row--locked`:``}`,role:`checkbox`,"aria-checked":a[t],"aria-disabled":o||void 0,tabIndex:o?-1:0,onClick:()=>d(t),onKeyDown:e=>{n||o||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),d(t))},children:[(0,V.jsx)(x,{checked:a[t],onChange:()=>d(t),disabled:n||o}),(0,V.jsxs)(`div`,{className:`multi-select__info`,children:[(0,V.jsxs)(`span`,{className:`multi-select__label`,children:[e.label,e.badge&&(0,V.jsx)(`span`,{className:`multi-select__badge`,children:e.badge})]}),e.description&&(0,V.jsx)(`span`,{className:`multi-select__desc`,children:e.description})]})]})]},e.value)})})]})})}function Ce({data:e,onSubmit:t,submitted:n}){let r=e,i=Array.isArray(r?.buttons)?r.buttons:[],[a,o]=(0,A.useState)(`Submitted`);if(i.length===0)return null;let s=e=>{n||(o(e.label),t(e.value))};return(0,V.jsx)(be,{submitted:n,submittedLabel:a,actions:i.map(e=>({label:e.label,variant:`primary`,onClick:()=>s(e)})),children:(0,V.jsx)(V.Fragment,{})})}var we={"single-select":xe,"multi-select":Se,"action-buttons":Ce};function Te({name:e,data:t,onSubmit:n,submitted:r}){let i=we[e];return i?(0,V.jsx)(i,{data:t,onSubmit:n,submitted:r}):(console.warn(`[PublicComponentRenderer] Unknown component: "${e}". Registered: ${Object.keys(we).join(`, `)}`),(0,V.jsx)(`div`,{className:`component-card component-card--error`,children:(0,V.jsxs)(`p`,{style:{fontFamily:`var(--font-body)`,fontSize:12,color:`var(--text-secondary)`},children:[`Component “`,e,`” is not available. This may require a platform update.`]})}))}function Ee(e){let t=new Date(e),n=new Date,r=String(t.getHours()).padStart(2,`0`),i=String(t.getMinutes()).padStart(2,`0`),a=String(t.getSeconds()).padStart(2,`0`);return t.toDateString()===n.toDateString()?`${r}:${i}:${a}`:`${String(t.getDate()).padStart(2,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${t.getFullYear()} ${r}:${i}:${a}`}function De({messages:e,isStreaming:t,sessionError:n,selectionMode:r,selectedItems:i,toggleSelectItem:a,onComponentSubmit:s,remainingSuggestions:c,onSuggestionClick:l,isAtBottom:u,setIsAtBottom:d,isGroup:f,sessionId:m}){let[h,g]=(0,A.useState)(new Set),[v,y]=(0,A.useState)(new Set),b=(0,A.useRef)(null),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(!1),E=(0,A.useRef)(!1),D=(0,A.useRef)(!1),O=(0,A.useRef)(0),k=(0,A.useRef)(!1),j=(0,A.useRef)(new Map);k.current=t,(0,A.useEffect)(()=>{t&&!T.current&&u&&(E.current=!0)},[t,u]),(0,A.useEffect)(()=>{if(!E.current&&!u){T.current=t,D.current=!1;return}if(T.current&&!t&&w.current&&C.current){let e=w.current;if(e.offsetHeight>C.current.clientHeight){E.current=!1,D.current=!0,e.scrollIntoView({behavior:`smooth`,block:`start`}),T.current=t;return}}(u||E.current)&&!D.current&&b.current?.scrollIntoView({behavior:`smooth`}),T.current&&!t&&(E.current=!1),T.current=t},[e,u,t]),(0,A.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>{let t=e.scrollTop;k.current&&t<O.current&&(E.current=!1),O.current=t,d(e.scrollHeight-e.scrollTop-e.clientHeight<80)};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>e.removeEventListener(`scroll`,t)},[d]),(0,A.useEffect)(()=>{function e(){y(e=>{let t=new Set;return j.current.forEach((n,r)=>{n.isConnected&&(h.has(r)?e.has(r)&&t.add(r):n.scrollHeight>n.clientHeight+2&&t.add(r))}),e.size===t.size&&[...e].every(e=>t.has(e))?e:t})}e();let t=new ResizeObserver(e);return j.current.forEach(e=>t.observe(e)),()=>t.disconnect()},[e.length,h]);let M=[...e].sort((e,t)=>e.timestamp-t.timestamp);(0,A.useEffect)(()=>{r&&console.log(`[selection] entered`,{conversationId:m??`unknown`,order:M.map(e=>({ts:e.timestamp,role:e.role,id:e.messageId}))})},[r]);let N=M.reduce((e,t,n)=>t.role===`maxy`&&!t.hidden?n:e,-1);return(0,V.jsxs)(`div`,{className:`chat-messages-wrap`,children:[r&&(0,V.jsx)(`div`,{className:`selection-overlay-band`}),(0,V.jsxs)(`div`,{className:`chat-messages`,ref:C,children:[n&&e.length===0&&(0,V.jsx)(`div`,{className:`session-error`,children:(0,V.jsx)(`p`,{children:n})}),M.map((e,n)=>{if(e.hidden)return null;let c=t&&n===M.length-1,l=`${e.timestamp}_${e.role}`,u=i.has(l);return(0,V.jsxs)(`div`,{ref:n===N?w:void 0,className:`message ${e.role}${u?` selected`:``}`,children:[r&&!c&&(0,V.jsx)(`div`,{className:`message-select-check`,children:(0,V.jsx)(x,{checked:u,onChange:()=>a(l)})}),(0,V.jsxs)(`div`,{className:`bubble`,children:[f&&e.role===`visitor`&&e.senderName&&(0,V.jsx)(`span`,{className:`bubble-sender`,children:e.senderName}),e.role===`visitor`&&e.content?(()=>{let t=h.has(n),r=v.has(n);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{ref:e=>{e?j.current.set(n,e):j.current.delete(n)},className:t?`bubble-content`:`bubble-content clamped${r?` overflowing`:``}`,children:e.content}),r&&(0,V.jsx)(`div`,{className:`bubble-expand`,children:(0,V.jsx)(_,{variant:`icon`,className:t?`expanded`:``,onClick:()=>g(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),"aria-label":t?`Collapse message`:`Expand message`,children:(0,V.jsx)(p,{size:14})})})]})})():e.content?(0,V.jsx)(ye,{content:e.content,timestamp:Ee(e.timestamp)}):(0,V.jsxs)(`span`,{className:`typing-indicator`,children:[(0,V.jsx)(`span`,{className:`typing-dot`}),(0,V.jsx)(`span`,{className:`typing-dot`}),(0,V.jsx)(`span`,{className:`typing-dot`})]}),e.attachments&&e.attachments.length>0&&(0,V.jsx)(`div`,{className:`message-attachments`,children:e.attachments.map((e,t)=>(0,V.jsxs)(`span`,{className:`message-attachment-chip no-action`,children:[e.mimeType===`application/pdf`?(0,V.jsx)(o,{size:12}):e.mimeType.startsWith(`text/`)?(0,V.jsx)(S,{size:12}):null,(0,V.jsx)(`span`,{children:e.filename})]},t))}),e.role===`visitor`&&(0,V.jsx)(`span`,{className:`message-timestamp`,children:Ee(e.timestamp)})]}),e.role===`maxy`&&e.components&&e.components.length>0&&(0,V.jsx)(`div`,{className:`public-components`,children:e.components.map((e,t)=>(0,V.jsx)(`div`,{className:`public-component-enter`,children:(0,V.jsx)(Te,{name:e.name,data:e.data,onSubmit:e=>s(n,t,e),submitted:e.submitted})},t))})]},n)}),!t&&c.length>0&&(0,V.jsx)(`div`,{className:`chat-suggestions`,children:c.map(e=>(0,V.jsx)(_,{variant:`suggestion`,onClick:()=>l(e),children:e},e))}),(0,V.jsx)(`div`,{ref:b})]}),!u&&(0,V.jsx)(`button`,{className:`scroll-to-bottom`,onClick:()=>b.current?.scrollIntoView({behavior:`smooth`}),"aria-label":`Scroll to bottom`,children:(0,V.jsx)(p,{size:18})})]})}function Oe({selectedItems:e,messages:t,isStreaming:n,copySelected:r,selectAll:i,exitSelection:a,showCopyToast:o}){let[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(null),u=(0,A.useRef)(!1);function d(e){let n=e.lastIndexOf(`_`),r=e.slice(0,n),i=e.slice(n+1),a=parseInt(r,10);return t.find(e=>e.timestamp===a&&e.role===i)?.content??``}function f(e,t){return parseInt(e.slice(0,e.lastIndexOf(`_`)),10)-parseInt(t.slice(0,t.lastIndexOf(`_`)),10)}function p(){let e=[...t].sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let t of e){if(t.hidden||!t.content)continue;let e=t.role===`visitor`?`Visitor`:`Maxy`;n.push(`${e}:\n${t.content}`)}return n.join(`
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
`)}A.useEffect(()=>{if(!s)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);function m(){l.current!==null&&(clearTimeout(l.current),l.current=null)}let h=[...t].sort((e,t)=>e.timestamp-t.timestamp),_=h.reduce((e,t,r)=>(t.hidden||n&&r===h.length-1||e.push(`${t.timestamp}_${t.role}`),e),[]),v=_.length>0&&_.every(t=>e.has(t));return(0,V.jsx)(`div`,{className:`chat-input-area`,children:(0,V.jsxs)(`div`,{className:`selection-bar`,children:[(0,V.jsxs)(`div`,{className:`selection-bar-left`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`selection-select-all`,onClick:()=>i(_),disabled:_.length===0,"aria-label":v?`Deselect all`:`Select all`,title:v?`Deselect all`:`Select all`,children:[(0,V.jsx)(E,{size:16}),(0,V.jsx)(`span`,{children:v?`Deselect all`:`Select all`})]}),(0,V.jsxs)(`span`,{className:`selection-count`,children:[e.size,` Selected`]})]}),(0,V.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(s){c(!1);return}u.current=!1,l.current=setTimeout(()=>{u.current=!0,c(!0),l.current=null},500)},onPointerUp:m,onPointerLeave:m,onPointerCancel:m,onClick:async()=>{u.current||await r(d,f)},children:[(0,V.jsx)(b,{size:18}),(0,V.jsx)(`span`,{children:`Copy`})]}),s&&(0,V.jsx)(`div`,{className:`copy-menu`,children:(0,V.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let e=p();e&&o(await g(e)),a()},children:`Copy all`})})]}),(0,V.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:a,children:`Cancel`})]})})}var ke=44,Ae=(0,A.forwardRef)(function({value:e,onChange:t,placeholder:n,disabled:r},i){let a=(0,A.useRef)(null),o=(0,A.useRef)(!1),s=(0,A.useCallback)((e,t)=>{let n=e.closest(`.chat-form`);n&&(n.dataset.expanded=t>ke?`true`:``)},[]),c=(0,A.useCallback)(e=>{if(o.current)return;let t=window.innerHeight*.75;e.style.height=`auto`;let n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`,s(e,n)},[s]);return(0,A.useImperativeHandle)(i,()=>({focus(){a.current?.focus()},resetHeight(){if(!a.current)return;o.current=!1,a.current.style.height=``,a.current.style.overflowY=``;let e=a.current.closest(`.chat-form`);e&&(e.dataset.expanded=``)},getOffsetHeight(){return a.current?.offsetHeight??36},setHeight(e){a.current&&(o.current=!0,a.current.style.height=`${e}px`,s(a.current,e))}})),(0,V.jsx)(`textarea`,{ref:a,className:`chat-input`,rows:1,value:e,onChange:e=>{t(e.target.value),c(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest(`form`)?.requestSubmit())},placeholder:n,disabled:r,"aria-label":n||`Type a message...`})});function je({inputRef:e}){let t=(0,A.useRef)(null);function n(n){e.current&&(n.preventDefault(),n.target.setPointerCapture(n.pointerId),t.current={startY:n.clientY,startH:e.current.getOffsetHeight()})}function r(n){if(!t.current||!e.current)return;let r=t.current.startY-n.clientY,i=window.innerHeight*.75,a=Math.max(36,Math.min(i,t.current.startH+r));e.current.setHeight(a)}function i(){t.current=null}return(0,V.jsx)(`div`,{className:`chat-resize-handle`,onPointerDown:n,onPointerMove:r,onPointerUp:i,"aria-label":`Resize input`,children:(0,V.jsx)(`div`,{className:`chat-resize-handle-bar`})})}function Me(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function Ne({data:e,active:t}){let n=[];if(e&&e.length>0&&t){let t=Math.floor(e.length/24);for(let r=0;r<24;r++){let i=e[r*t]??128,a=Math.abs(i-128)/128;n.push(Math.max(.15,a))}}else for(let e=0;e<24;e++)n.push(.15);return(0,V.jsx)(`div`,{className:`voice-waveform`,"aria-hidden":`true`,children:n.map((e,t)=>(0,V.jsx)(`div`,{className:`voice-waveform-bar`,style:{height:`${Math.round(e*100)}%`}},t))})}function Pe({state:e,elapsedSeconds:t,waveform:r,onTogglePause:i,onDiscard:a,onSend:o}){if(e===`idle`||e===`error`)return null;let s=e===`recording`,c=e===`paused`,l=e===`sending`;return(0,V.jsxs)(`div`,{className:`voice-recorder`,role:`region`,"aria-label":`Voice recording`,"aria-live":`polite`,children:[(0,V.jsx)(`button`,{type:`button`,className:`voice-trash`,onClick:a,disabled:l,"aria-label":`Discard recording`,children:(0,V.jsx)(f,{size:16})}),(0,V.jsx)(`span`,{className:`voice-timer`,"aria-live":`polite`,"aria-atomic":`true`,children:Me(t)}),(0,V.jsx)(Ne,{data:r,active:s}),(0,V.jsx)(`button`,{type:`button`,className:`voice-pause`,onClick:i,disabled:l,"aria-label":c?`Resume recording`:`Pause recording`,children:c?(0,V.jsx)(n,{size:14}):(0,V.jsx)(T,{size:14})}),(0,V.jsx)(v,{variant:`send`,type:`button`,onClick:o,disabled:l,loading:l,"aria-label":`Send voice note`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,V.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})}var Fe=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Ie(){for(let e of Fe)if(MediaRecorder.isTypeSupported(e))return e;return``}function Le(e){return e.split(`;`)[0]}function Re(){let[e,t]=(0,A.useState)(`idle`),[n,r]=(0,A.useState)(0),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(null),u=(0,A.useRef)([]),d=(0,A.useRef)(``),f=(0,A.useRef)(null),p=(0,A.useRef)(0),m=(0,A.useRef)(0),h=(0,A.useRef)(null),g=(0,A.useRef)(null),_=(0,A.useRef)(0),v=(0,A.useCallback)(()=>{if(f.current&&=(clearInterval(f.current),null),_.current&&=(cancelAnimationFrame(_.current),0),c.current&&c.current.state!==`inactive`)try{c.current.stop()}catch{}c.current=null,u.current=[],l.current&&=(l.current.getTracks().forEach(e=>e.stop()),null),h.current&&(h.current.close().catch(()=>{}),h.current=null,g.current=null),m.current=0,p.current=0},[]);(0,A.useEffect)(()=>v,[v]);let y=(0,A.useCallback)(()=>{p.current=Date.now(),f.current=setInterval(()=>{let e=Date.now()-p.current,t=m.current+e;r(Math.floor(t/1e3))},200)},[]),b=(0,A.useCallback)(()=>{f.current&&=(clearInterval(f.current),null);let e=Date.now()-p.current;m.current+=e},[]),x=(0,A.useCallback)(()=>{let e=g.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),a(new Uint8Array(t)),_.current=requestAnimationFrame(n)};n()},[]),S=(0,A.useCallback)(()=>{_.current&&=(cancelAnimationFrame(_.current),0)},[]),C=(0,A.useCallback)(async()=>{if(!(e!==`idle`&&e!==`error`)){if(s(null),typeof window<`u`&&!window.isSecureContext){t(`error`),s(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){t(`error`),s(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){t(`error`),s(`Voice recording is not supported in this browser.`);return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});l.current=e;let n=new AudioContext;h.current=n;let i=n.createMediaStreamSource(e),o=n.createAnalyser();o.fftSize=256,i.connect(o),g.current=o;let s=Ie();d.current=s;let f=new MediaRecorder(e,s?{mimeType:s}:void 0);c.current=f,u.current=[],f.ondataavailable=e=>{e.data.size>0&&u.current.push(e.data)},e.getAudioTracks()[0]?.addEventListener(`ended`,()=>{v(),t(`idle`),r(0),a(null)}),f.start(1e3),t(`recording`),r(0),y(),x()}catch(e){v(),t(`error`),e instanceof DOMException?e.name===`NotAllowedError`?s(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?s(`No microphone found. Connect a microphone to use voice recording.`):s(`Microphone error: ${e.message}`):s(`Could not start recording.`)}}},[e,v,y,x]),w=(0,A.useCallback)(()=>{let n=c.current;n&&(e===`recording`&&n.state===`recording`?(n.pause(),b(),S(),t(`paused`)):e===`paused`&&n.state===`paused`&&(n.resume(),y(),x(),t(`recording`)))},[e,b,y,x,S]),T=(0,A.useCallback)(()=>{e!==`recording`&&e!==`paused`||(v(),t(`idle`),r(0),a(null))},[e,v]),E=(0,A.useCallback)(async()=>{if(e!==`recording`&&e!==`paused`)return null;let n=c.current;if(!n)return null;let i=e===`recording`?Date.now()-p.current:0;return m.current+i<1e3?(T(),null):(t(`sending`),b(),S(),new Promise(e=>{n.onstop=()=>{let i=d.current||n.mimeType||`audio/webm`,o=new Blob(u.current,{type:Le(i)});v(),t(`idle`),r(0),a(null),e(o.size>0?o:null)},n.stop()}))},[e,T,b,S,v]);return(0,A.useEffect)(()=>{if(e!==`error`)return;let n=setTimeout(()=>{t(`idle`),s(null)},8e3);return()=>clearTimeout(n)},[e]),{state:e,elapsedSeconds:n,waveform:i,errorMessage:o,start:C,togglePause:w,discard:T,send:E}}function ze(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}function Be({input:e,setInput:t,isStreaming:n,pendingFiles:r,setPendingFiles:i,attachError:a,setAttachError:o,isDragOver:s,setIsDragOver:c,inputRef:l,onSubmit:u,onSendVoiceNote:d}){let f=(0,A.useRef)(null),p=Re(),h=p.state===`recording`||p.state===`paused`||p.state===`sending`,g=!h&&!n&&!e.trim()&&r.length===0;async function _(){let e=await p.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;d(new File([e],`voice-note${t}`,{type:e.type}))}function y(e){o(null);let t=e.find(e=>!ze(e.type,M));if(t){o(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, voice notes.`);return}let n=e.find(e=>e.size>N);if(n){o(`"${n.name}" exceeds the 50 MB limit.`);return}i(t=>[...t,...e].slice(0,5))}function b(e){e.preventDefault(),c(!0)}function x(){c(!1)}function T(e){e.preventDefault(),c(!1),y([...e.dataTransfer.files])}return(0,V.jsxs)(`div`,{className:`chat-input-area`,children:[(0,V.jsx)(`input`,{ref:f,type:`file`,multiple:!0,accept:j,style:{display:`none`},onChange:e=>{e.target.files&&y([...e.target.files]),e.target.value=``}}),r.length>0&&(0,V.jsx)(`div`,{className:`attachment-strip`,children:r.map((e,t)=>(0,V.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,V.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,V.jsx)(C,{size:14}):e.type===`application/pdf`?(0,V.jsx)(m,{size:14}):(0,V.jsx)(S,{size:14}),(0,V.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,V.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>i(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),a&&(0,V.jsx)(`p`,{className:`attach-error`,children:a}),p.state===`error`&&p.errorMessage&&(0,V.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,V.jsx)(C,{size:14}),p.errorMessage]}),(0,V.jsx)(je,{inputRef:l}),h?(0,V.jsx)(`div`,{className:`chat-form voice-active`,children:(0,V.jsx)(Pe,{state:p.state,elapsedSeconds:p.elapsedSeconds,waveform:p.waveform,onTogglePause:p.togglePause,onDiscard:p.discard,onSend:_})}):(0,V.jsxs)(`form`,{className:`chat-form${s?` drag-over`:``}`,onSubmit:u,onDragOver:b,onDragLeave:x,onDrop:T,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t){if(e.kind!==`file`)continue;let t=e.getAsFile();if(!t)continue;let r=t.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([t],`pasted-image-${Date.now()}.${r}`,{type:t.type}))}n.length>0&&y(n)},children:[(0,V.jsx)(v,{variant:`icon`,type:`button`,onClick:()=>f.current?.click(),disabled:n,"aria-label":`Attach file`,children:(0,V.jsx)(w,{size:14})}),(0,V.jsx)(Ae,{ref:l,value:e,onChange:t}),g?(0,V.jsx)(v,{variant:`send`,type:`button`,onClick:p.start,disabled:n,"aria-label":`Record voice note`,children:(0,V.jsx)(C,{size:14})}):(0,V.jsx)(v,{variant:`send`,type:`submit`,disabled:n||!e.trim()&&r.length===0,"aria-label":`Send message`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,V.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})]})}var Ve=[];function He(){let[e,t]=(0,A.useState)(``),[n,r]=(0,A.useState)([]),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(null),[l,u]=(0,A.useState)(Ve),[f,m]=(0,A.useState)(!0),g=(0,A.useRef)(null),{selectionMode:_,selectedItems:v,copyToast:y,exitSelection:b,enterSelection:x,toggleSelectItem:S,selectAll:C,copySelected:w,showCopyToast:T}=h(),O=(0,A.useRef)(()=>{}),k=z((0,A.useCallback)(e=>{O.current(e)},[])),{sessionId:j,cacheKeyRef:M,sessionError:N,pageState:P,agentDisplayName:ee,agentImage:F,agentImageShape:I,showAgentName:L,branding:R,ensureSession:B,startNewSession:re,resumedRef:H,resumeMessagesRef:U,groupContext:W,groupSlug:G}=k,{messages:K,setMessages:q,isStreaming:J,sendMessage:Y,sendGreeting:X,handleComponentSubmit:ae}=te({cacheKeyRef:M,ensureSession:B,sessionError:N,pageState:P,inputRef:g});(0,A.useEffect)(()=>{O.current=X},[X]),ne({cacheKeyRef:M,groupSlug:G,isStreaming:J,setMessages:q}),(0,A.useEffect)(()=>{let e=!1;return(async()=>{let t=await B();if(!e&&t){if(H.current&&U.current&&U.current.length>0){let e=U.current.map(e=>({role:e.role,content:e.content,timestamp:e.timestamp}));e.sort((e,t)=>e.timestamp-t.timestamp),q(e),U.current=null;return}X(t)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>{P===`chat`&&g.current?.focus()},[P]),(0,A.useEffect)(()=>{if(P!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[P]),(0,A.useEffect)(()=>{if(!R)return;let e=document.documentElement;if(R.primaryColor&&(e.style.setProperty(`--sage`,R.primaryColor),e.style.setProperty(`--sage-hover`,R.primaryColor),e.style.setProperty(`--sage-subtle`,R.primaryColor+`14`),e.style.setProperty(`--sage-glow`,R.primaryColor+`26`)),R.accentColor&&e.style.setProperty(`--visitor-bubble`,R.accentColor),R.backgroundColor&&e.style.setProperty(`--bg`,R.backgroundColor),document.title=R.name,R.primaryColor){let e=document.querySelector(`meta[name="theme-color"]`);e||(e=document.createElement(`meta`),e.name=`theme-color`,document.head.appendChild(e)),e.content=R.primaryColor}if(R.faviconUrl){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=R.faviconUrl}},[R]),(0,A.useEffect)(()=>{function e(e){e.key===`Escape`&&_&&b()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,b]);function Z(){J||(q([]),u(Ve),re())}function Q(e){if(!e&&n.length===0||J)return;q(e=>e.map(e=>e.components?.some(e=>!e.submitted)?{...e,components:e.components.map(e=>e.submitted?e:{...e,submitted:!0})}:e)),u(t=>t.filter(t=>t!==e)),m(!0);let i=[...n];t(``),r([]),s(null),Y(e,{files:i})}function $(t){t.preventDefault(),Q(e.trim()),g.current?.resetHeight()}return(0,V.jsxs)(`div`,{className:`chat-page`,children:[(0,V.jsxs)(`header`,{className:`chat-header`,children:[(0,V.jsx)(`img`,{src:F||R?.logoUrl||d,alt:R?.name||p.productName,className:`chat-logo${F&&I===`circle`?` chat-logo--circle`:``}${F&&I===`rounded`?` chat-logo--rounded`:``}`,onError:e=>{e.target.src=R?.logoUrl||d}}),(0,V.jsxs)(`div`,{className:`chat-header-text`,children:[L!==`none`&&(0,V.jsx)(`h1`,{className:`chat-tagline`,children:W?.groupName||L&&ee||R?.name||p.productName}),(0,V.jsx)(`p`,{className:`chat-intro`,children:W?`${W.participants.length} participants`:R?.tagline||``}),(0,V.jsx)(`p`,{className:`chat-ai-indicator`,children:`AI assistant`})]}),P===`chat`&&!_&&(0,V.jsxs)(`div`,{className:`chat-header-actions`,children:[(0,V.jsx)(`button`,{className:`chat-header-action`,onClick:Z,disabled:J,title:`New conversation`,"aria-label":`New conversation`,children:(0,V.jsx)(D,{size:16})}),(0,V.jsx)(`button`,{className:`chat-header-action`,onClick:x,title:`Select messages`,"aria-label":`Select messages`,children:(0,V.jsx)(E,{size:16})})]})]}),P===`loading`&&(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsx)(`div`,{className:`gate-loading`,children:(0,V.jsx)(`span`,{className:`spinner`})})}),P===`auth-required`&&(0,V.jsx)(ie,{gateState:k.gateState,setGateState:k.setGateState,grantInfo:k.grantInfo,setGrantInfo:k.setGrantInfo,gateCacheKeyRef:k.gateCacheKeyRef,resolvedSlugRef:k.resolvedSlugRef,onAuthenticated:k.enterChat}),P===`chat`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(De,{messages:K,isStreaming:J,sessionError:N,selectionMode:_,selectedItems:v,toggleSelectItem:S,onComponentSubmit:ae,remainingSuggestions:l,onSuggestionClick:Q,isAtBottom:f,setIsAtBottom:m,isGroup:!!W,sessionId:j}),_?(0,V.jsx)(Oe,{selectedItems:v,messages:K,isStreaming:J,copySelected:w,selectAll:C,exitSelection:b,showCopyToast:T}):(0,V.jsx)(Be,{input:e,setInput:t,isStreaming:J,pendingFiles:n,setPendingFiles:r,attachError:o,setAttachError:s,isDragOver:i,setIsDragOver:a,inputRef:g,onSubmit:$,onSendVoiceNote:e=>{t(``),r([]),s(null),Y(`[Voice note]`,{files:[e]})}})]}),y&&(0,V.jsx)(`span`,{className:`copy-toast${y===`failed`?` copy-toast-failed`:``}`,children:y===`copied`?`Copied`:`Copy failed`}),(0,V.jsxs)(`footer`,{className:`chat-footer`,children:[(0,V.jsxs)(`a`,{href:c,children:[p.domain,` `,`↗`]}),j&&(0,V.jsxs)(`span`,{style:{opacity:.35,fontSize:`10px`,fontFamily:`monospace`,marginLeft:`1rem`},children:[`Conversation · `,j.slice(0,8)]})]})]})}(0,k.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(He,{}));export{Q as t};
|
|
8
|
+
`)}A.useEffect(()=>{if(!s)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);function m(){l.current!==null&&(clearTimeout(l.current),l.current=null)}let g=[...t].sort((e,t)=>e.timestamp-t.timestamp),_=g.reduce((e,t,r)=>(t.hidden||n&&r===g.length-1||e.push(`${t.timestamp}_${t.role}`),e),[]),v=_.length>0&&_.every(t=>e.has(t));return(0,V.jsx)(`div`,{className:`chat-input-area`,children:(0,V.jsxs)(`div`,{className:`selection-bar`,children:[(0,V.jsxs)(`div`,{className:`selection-bar-left`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`selection-select-all`,onClick:()=>i(_),disabled:_.length===0,"aria-label":v?`Deselect all`:`Select all`,title:v?`Deselect all`:`Select all`,children:[(0,V.jsx)(E,{size:16}),(0,V.jsx)(`span`,{children:v?`Deselect all`:`Select all`})]}),(0,V.jsxs)(`span`,{className:`selection-count`,children:[e.size,` Selected`]})]}),(0,V.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(s){c(!1);return}u.current=!1,l.current=setTimeout(()=>{u.current=!0,c(!0),l.current=null},500)},onPointerUp:m,onPointerLeave:m,onPointerCancel:m,onClick:async()=>{u.current||await r(d,f)},children:[(0,V.jsx)(y,{size:18}),(0,V.jsx)(`span`,{children:`Copy`})]}),s&&(0,V.jsx)(`div`,{className:`copy-menu`,children:(0,V.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let e=p();e&&o(await h(e)),a()},children:`Copy all`})})]}),(0,V.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:a,children:`Cancel`})]})})}var ke=44,Ae=(0,A.forwardRef)(function({value:e,onChange:t,placeholder:n,disabled:r},i){let a=(0,A.useRef)(null),o=(0,A.useRef)(!1),s=(0,A.useCallback)((e,t)=>{let n=e.closest(`.chat-form`);n&&(n.dataset.expanded=t>ke?`true`:``)},[]),c=(0,A.useCallback)(e=>{if(o.current)return;let t=window.innerHeight*.75;e.style.height=`auto`;let n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`,s(e,n)},[s]);return(0,A.useImperativeHandle)(i,()=>({focus(){a.current?.focus()},resetHeight(){if(!a.current)return;o.current=!1,a.current.style.height=``,a.current.style.overflowY=``;let e=a.current.closest(`.chat-form`);e&&(e.dataset.expanded=``)},getOffsetHeight(){return a.current?.offsetHeight??36},setHeight(e){a.current&&(o.current=!0,a.current.style.height=`${e}px`,s(a.current,e))}})),(0,V.jsx)(`textarea`,{ref:a,className:`chat-input`,rows:1,value:e,onChange:e=>{t(e.target.value),c(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest(`form`)?.requestSubmit())},placeholder:n,disabled:r,"aria-label":n||`Type a message...`})});function je({inputRef:e}){let t=(0,A.useRef)(null);function n(n){e.current&&(n.preventDefault(),n.target.setPointerCapture(n.pointerId),t.current={startY:n.clientY,startH:e.current.getOffsetHeight()})}function r(n){if(!t.current||!e.current)return;let r=t.current.startY-n.clientY,i=window.innerHeight*.75,a=Math.max(36,Math.min(i,t.current.startH+r));e.current.setHeight(a)}function i(){t.current=null}return(0,V.jsx)(`div`,{className:`chat-resize-handle`,onPointerDown:n,onPointerMove:r,onPointerUp:i,"aria-label":`Resize input`,children:(0,V.jsx)(`div`,{className:`chat-resize-handle-bar`})})}function Me(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function Ne({data:e,active:t}){let n=[];if(e&&e.length>0&&t){let t=Math.floor(e.length/24);for(let r=0;r<24;r++){let i=e[r*t]??128,a=Math.abs(i-128)/128;n.push(Math.max(.15,a))}}else for(let e=0;e<24;e++)n.push(.15);return(0,V.jsx)(`div`,{className:`voice-waveform`,"aria-hidden":`true`,children:n.map((e,t)=>(0,V.jsx)(`div`,{className:`voice-waveform-bar`,style:{height:`${Math.round(e*100)}%`}},t))})}function Pe({state:e,elapsedSeconds:t,waveform:n,onTogglePause:r,onDiscard:i,onSend:a}){if(e===`idle`||e===`error`)return null;let o=e===`recording`,s=e===`paused`,l=e===`sending`;return(0,V.jsxs)(`div`,{className:`voice-recorder`,role:`region`,"aria-label":`Voice recording`,"aria-live":`polite`,children:[(0,V.jsx)(`button`,{type:`button`,className:`voice-trash`,onClick:i,disabled:l,"aria-label":`Discard recording`,children:(0,V.jsx)(c,{size:16})}),(0,V.jsx)(`span`,{className:`voice-timer`,"aria-live":`polite`,"aria-atomic":`true`,children:Me(t)}),(0,V.jsx)(Ne,{data:n,active:o}),(0,V.jsx)(`button`,{type:`button`,className:`voice-pause`,onClick:r,disabled:l,"aria-label":s?`Resume recording`:`Pause recording`,children:s?(0,V.jsx)(d,{size:14}):(0,V.jsx)(T,{size:14})}),(0,V.jsx)(_,{variant:`send`,type:`button`,onClick:a,disabled:l,loading:l,"aria-label":`Send voice note`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,V.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})}var Fe=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Ie(){for(let e of Fe)if(MediaRecorder.isTypeSupported(e))return e;return``}function Le(e){return e.split(`;`)[0]}function Re(){let[e,t]=(0,A.useState)(`idle`),[n,r]=(0,A.useState)(0),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(null),u=(0,A.useRef)([]),d=(0,A.useRef)(``),f=(0,A.useRef)(null),p=(0,A.useRef)(0),m=(0,A.useRef)(0),h=(0,A.useRef)(null),g=(0,A.useRef)(null),_=(0,A.useRef)(0),v=(0,A.useCallback)(()=>{if(f.current&&=(clearInterval(f.current),null),_.current&&=(cancelAnimationFrame(_.current),0),c.current&&c.current.state!==`inactive`)try{c.current.stop()}catch{}c.current=null,u.current=[],l.current&&=(l.current.getTracks().forEach(e=>e.stop()),null),h.current&&(h.current.close().catch(()=>{}),h.current=null,g.current=null),m.current=0,p.current=0},[]);(0,A.useEffect)(()=>v,[v]);let y=(0,A.useCallback)(()=>{p.current=Date.now(),f.current=setInterval(()=>{let e=Date.now()-p.current,t=m.current+e;r(Math.floor(t/1e3))},200)},[]),b=(0,A.useCallback)(()=>{f.current&&=(clearInterval(f.current),null);let e=Date.now()-p.current;m.current+=e},[]),x=(0,A.useCallback)(()=>{let e=g.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),a(new Uint8Array(t)),_.current=requestAnimationFrame(n)};n()},[]),S=(0,A.useCallback)(()=>{_.current&&=(cancelAnimationFrame(_.current),0)},[]),C=(0,A.useCallback)(async()=>{if(!(e!==`idle`&&e!==`error`)){if(s(null),typeof window<`u`&&!window.isSecureContext){t(`error`),s(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){t(`error`),s(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){t(`error`),s(`Voice recording is not supported in this browser.`);return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});l.current=e;let n=new AudioContext;h.current=n;let i=n.createMediaStreamSource(e),o=n.createAnalyser();o.fftSize=256,i.connect(o),g.current=o;let s=Ie();d.current=s;let f=new MediaRecorder(e,s?{mimeType:s}:void 0);c.current=f,u.current=[],f.ondataavailable=e=>{e.data.size>0&&u.current.push(e.data)},e.getAudioTracks()[0]?.addEventListener(`ended`,()=>{v(),t(`idle`),r(0),a(null)}),f.start(1e3),t(`recording`),r(0),y(),x()}catch(e){v(),t(`error`),e instanceof DOMException?e.name===`NotAllowedError`?s(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?s(`No microphone found. Connect a microphone to use voice recording.`):s(`Microphone error: ${e.message}`):s(`Could not start recording.`)}}},[e,v,y,x]),w=(0,A.useCallback)(()=>{let n=c.current;n&&(e===`recording`&&n.state===`recording`?(n.pause(),b(),S(),t(`paused`)):e===`paused`&&n.state===`paused`&&(n.resume(),y(),x(),t(`recording`)))},[e,b,y,x,S]),T=(0,A.useCallback)(()=>{e!==`recording`&&e!==`paused`||(v(),t(`idle`),r(0),a(null))},[e,v]),E=(0,A.useCallback)(async()=>{if(e!==`recording`&&e!==`paused`)return null;let n=c.current;if(!n)return null;let i=e===`recording`?Date.now()-p.current:0;return m.current+i<1e3?(T(),null):(t(`sending`),b(),S(),new Promise(e=>{n.onstop=()=>{let i=d.current||n.mimeType||`audio/webm`,o=new Blob(u.current,{type:Le(i)});v(),t(`idle`),r(0),a(null),e(o.size>0?o:null)},n.stop()}))},[e,T,b,S,v]);return(0,A.useEffect)(()=>{if(e!==`error`)return;let n=setTimeout(()=>{t(`idle`),s(null)},8e3);return()=>clearTimeout(n)},[e]),{state:e,elapsedSeconds:n,waveform:i,errorMessage:o,start:C,togglePause:w,discard:T,send:E}}function ze(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}function Be({input:e,setInput:t,isStreaming:n,pendingFiles:r,setPendingFiles:i,attachError:a,setAttachError:s,isDragOver:c,setIsDragOver:l,inputRef:u,onSubmit:d,onSendVoiceNote:f}){let p=(0,A.useRef)(null),m=Re(),h=m.state===`recording`||m.state===`paused`||m.state===`sending`,g=!h&&!n&&!e.trim()&&r.length===0;async function v(){let e=await m.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;f(new File([e],`voice-note${t}`,{type:e.type}))}function y(e){s(null);let t=e.find(e=>!ze(e.type,M));if(t){s(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, voice notes.`);return}let n=e.find(e=>e.size>N);if(n){s(`"${n.name}" exceeds the 50 MB limit.`);return}i(t=>[...t,...e].slice(0,5))}function b(e){e.preventDefault(),l(!0)}function x(){l(!1)}function T(e){e.preventDefault(),l(!1),y([...e.dataTransfer.files])}return(0,V.jsxs)(`div`,{className:`chat-input-area`,children:[(0,V.jsx)(`input`,{ref:p,type:`file`,multiple:!0,accept:j,style:{display:`none`},onChange:e=>{e.target.files&&y([...e.target.files]),e.target.value=``}}),r.length>0&&(0,V.jsx)(`div`,{className:`attachment-strip`,children:r.map((e,t)=>(0,V.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,V.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,V.jsx)(C,{size:14}):e.type===`application/pdf`?(0,V.jsx)(o,{size:14}):(0,V.jsx)(S,{size:14}),(0,V.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,V.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>i(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),a&&(0,V.jsx)(`p`,{className:`attach-error`,children:a}),m.state===`error`&&m.errorMessage&&(0,V.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,V.jsx)(C,{size:14}),m.errorMessage]}),(0,V.jsx)(je,{inputRef:u}),h?(0,V.jsx)(`div`,{className:`chat-form voice-active`,children:(0,V.jsx)(Pe,{state:m.state,elapsedSeconds:m.elapsedSeconds,waveform:m.waveform,onTogglePause:m.togglePause,onDiscard:m.discard,onSend:v})}):(0,V.jsxs)(`form`,{className:`chat-form${c?` drag-over`:``}`,onSubmit:d,onDragOver:b,onDragLeave:x,onDrop:T,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t){if(e.kind!==`file`)continue;let t=e.getAsFile();if(!t)continue;let r=t.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([t],`pasted-image-${Date.now()}.${r}`,{type:t.type}))}n.length>0&&y(n)},children:[(0,V.jsx)(_,{variant:`icon`,type:`button`,onClick:()=>p.current?.click(),disabled:n,"aria-label":`Attach file`,children:(0,V.jsx)(w,{size:14})}),(0,V.jsx)(Ae,{ref:u,value:e,onChange:t}),g?(0,V.jsx)(_,{variant:`send`,type:`button`,onClick:m.start,disabled:n,"aria-label":`Record voice note`,children:(0,V.jsx)(C,{size:14})}):(0,V.jsx)(_,{variant:`send`,type:`submit`,disabled:n||!e.trim()&&r.length===0,"aria-label":`Send message`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,V.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})]})}var Ve=[];function He(){let[e,t]=(0,A.useState)(``),[n,r]=(0,A.useState)([]),[i,a]=(0,A.useState)(!1),[o,c]=(0,A.useState)(null),[l,d]=(0,A.useState)(Ve),[p,h]=(0,A.useState)(!0),g=(0,A.useRef)(null),{selectionMode:_,selectedItems:v,copyToast:y,exitSelection:b,enterSelection:x,toggleSelectItem:S,selectAll:C,copySelected:w,showCopyToast:T}=m(),O=(0,A.useRef)(()=>{}),k=z((0,A.useCallback)(e=>{O.current(e)},[])),{sessionId:j,cacheKeyRef:M,sessionError:N,pageState:P,agentDisplayName:ee,agentImage:F,agentImageShape:I,showAgentName:L,branding:R,ensureSession:B,startNewSession:re,resumedRef:H,resumeMessagesRef:U,groupContext:W,groupSlug:G}=k,{messages:K,setMessages:q,isStreaming:J,sendMessage:Y,sendGreeting:X,handleComponentSubmit:ae}=te({cacheKeyRef:M,ensureSession:B,sessionError:N,pageState:P,inputRef:g});(0,A.useEffect)(()=>{O.current=X},[X]),ne({cacheKeyRef:M,groupSlug:G,isStreaming:J,setMessages:q}),(0,A.useEffect)(()=>{let e=!1;return(async()=>{let t=await B();if(!e&&t){if(H.current&&U.current&&U.current.length>0){let e=U.current.map(e=>({role:e.role,content:e.content,timestamp:e.timestamp}));e.sort((e,t)=>e.timestamp-t.timestamp),q(e),U.current=null;return}X(t)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>{P===`chat`&&g.current?.focus()},[P]),(0,A.useEffect)(()=>{if(P!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[P]),(0,A.useEffect)(()=>{if(!R)return;let e=document.documentElement;if(R.primaryColor&&(e.style.setProperty(`--sage`,R.primaryColor),e.style.setProperty(`--sage-hover`,R.primaryColor),e.style.setProperty(`--sage-subtle`,R.primaryColor+`14`),e.style.setProperty(`--sage-glow`,R.primaryColor+`26`)),R.accentColor&&e.style.setProperty(`--visitor-bubble`,R.accentColor),R.backgroundColor&&e.style.setProperty(`--bg`,R.backgroundColor),document.title=R.name,R.primaryColor){let e=document.querySelector(`meta[name="theme-color"]`);e||(e=document.createElement(`meta`),e.name=`theme-color`,document.head.appendChild(e)),e.content=R.primaryColor}if(R.faviconUrl){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=R.faviconUrl}},[R]),(0,A.useEffect)(()=>{function e(e){e.key===`Escape`&&_&&b()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,b]);function Z(){J||(q([]),d(Ve),re())}function Q(e){if(!e&&n.length===0||J)return;q(e=>e.map(e=>e.components?.some(e=>!e.submitted)?{...e,components:e.components.map(e=>e.submitted?e:{...e,submitted:!0})}:e)),d(t=>t.filter(t=>t!==e)),h(!0);let i=[...n];t(``),r([]),c(null),Y(e,{files:i})}function $(t){t.preventDefault(),Q(e.trim()),g.current?.resetHeight()}return(0,V.jsxs)(`div`,{className:`chat-page`,children:[(0,V.jsxs)(`header`,{className:`chat-header`,children:[(0,V.jsx)(`img`,{src:F||R?.logoUrl||u,alt:R?.name||f.productName,className:`chat-logo${F&&I===`circle`?` chat-logo--circle`:``}${F&&I===`rounded`?` chat-logo--rounded`:``}`,onError:e=>{e.target.src=R?.logoUrl||u}}),(0,V.jsxs)(`div`,{className:`chat-header-text`,children:[L!==`none`&&(0,V.jsx)(`h1`,{className:`chat-tagline`,children:W?.groupName||L&&ee||R?.name||f.productName}),(0,V.jsx)(`p`,{className:`chat-intro`,children:W?`${W.participants.length} participants`:R?.tagline||``}),(0,V.jsx)(`p`,{className:`chat-ai-indicator`,children:`AI assistant`})]}),P===`chat`&&!_&&(0,V.jsxs)(`div`,{className:`chat-header-actions`,children:[(0,V.jsx)(`button`,{className:`chat-header-action`,onClick:Z,disabled:J,title:`New conversation`,"aria-label":`New conversation`,children:(0,V.jsx)(D,{size:16})}),(0,V.jsx)(`button`,{className:`chat-header-action`,onClick:x,title:`Select messages`,"aria-label":`Select messages`,children:(0,V.jsx)(E,{size:16})})]})]}),P===`loading`&&(0,V.jsx)(`div`,{className:`gate-wrap`,children:(0,V.jsx)(`div`,{className:`gate-loading`,children:(0,V.jsx)(`span`,{className:`spinner`})})}),P===`auth-required`&&(0,V.jsx)(ie,{gateState:k.gateState,setGateState:k.setGateState,grantInfo:k.grantInfo,setGrantInfo:k.setGrantInfo,gateCacheKeyRef:k.gateCacheKeyRef,resolvedSlugRef:k.resolvedSlugRef,onAuthenticated:k.enterChat}),P===`chat`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(De,{messages:K,isStreaming:J,sessionError:N,selectionMode:_,selectedItems:v,toggleSelectItem:S,onComponentSubmit:ae,remainingSuggestions:l,onSuggestionClick:Q,isAtBottom:p,setIsAtBottom:h,isGroup:!!W,sessionId:j}),_?(0,V.jsx)(Oe,{selectedItems:v,messages:K,isStreaming:J,copySelected:w,selectAll:C,exitSelection:b,showCopyToast:T}):(0,V.jsx)(Be,{input:e,setInput:t,isStreaming:J,pendingFiles:n,setPendingFiles:r,attachError:o,setAttachError:c,isDragOver:i,setIsDragOver:a,inputRef:g,onSubmit:$,onSendVoiceNote:e=>{t(``),r([]),c(null),Y(`[Voice note]`,{files:[e]})}})]}),y&&(0,V.jsx)(`span`,{className:`copy-toast${y===`failed`?` copy-toast-failed`:``}`,children:y===`copied`?`Copied`:`Copy failed`}),(0,V.jsxs)(`footer`,{className:`chat-footer`,children:[(0,V.jsxs)(`a`,{href:s,children:[f.domain,` `,`↗`]}),j&&(0,V.jsxs)(`span`,{style:{opacity:.35,fontSize:`10px`,fontFamily:`monospace`,marginLeft:`1rem`},children:[`Conversation · `,j.slice(0,8)]})]})]})}(0,k.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(He,{}));export{Q as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as e,h as t,p as n}from"./src-
|
|
1
|
+
import{g as e,h as t,p as n}from"./src-B6XdH6xq.js";import{B as r,C as i,E as a,L as o,V as s,W as c,_ as l,a as u,b as d,c as f,d as p,v as m}from"./chunk-ICPOFSXX-rgw1I6pt.js";import{t as h}from"./linear-0O14Y6uf.js";import"./defaultLocale-_WRwicXn.js";var g=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[1,7],s=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],d=[1,37],f=[1,36],p=[1,38],m=[1,35],h=[1,43],g=[1,41],_=[1,14],v=[1,23],y=[1,18],b=[1,19],x=[1,20],S=[1,21],C=[1,22],w=[1,24],T=[1,25],E=[1,26],D=[1,27],O=[1,28],k=[1,29],A=[1,32],j=[1,33],M=[1,34],N=[1,39],P=[1,40],F=[1,42],I=[1,44],L=[1,62],R=[1,61],z=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],B=[1,65],ee=[1,66],te=[1,67],ne=[1,68],re=[1,69],ie=[1,70],ae=[1,71],oe=[1,72],se=[1,73],ce=[1,74],le=[1,75],ue=[1,76],V=[4,5,6,7,8,9,10,11,12,13,14,15,18],H=[1,90],U=[1,91],W=[1,92],G=[1,99],K=[1,93],q=[1,96],J=[1,94],Y=[1,95],X=[1,97],Z=[1,98],de=[1,102],fe=[10,55,56,57],Q=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],pe={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:`error`,4:`ALPHA`,5:`NUM`,6:`NODE_STRING`,7:`DOWN`,8:`MINUS`,9:`DEFAULT`,10:`COMMA`,11:`COLON`,12:`AMP`,13:`BRKT`,14:`MULT`,15:`UNICODE_TEXT`,17:`UNIT`,18:`SPACE`,19:`STYLE`,20:`PCT`,25:`CLASSDEF`,28:`QUADRANT`,35:`title`,36:`title_value`,37:`acc_title`,38:`acc_title_value`,39:`acc_descr`,40:`acc_descr_value`,41:`acc_descr_multiline_value`,42:`section`,44:`point_start`,45:`point_x`,46:`point_y`,47:`class_name`,48:`X-AXIS`,49:`AXIS-TEXT-DELIMITER`,50:`Y-AXIS`,51:`QUADRANT_1`,52:`QUADRANT_2`,53:`QUADRANT_3`,54:`QUADRANT_4`,55:`NEWLINE`,56:`SEMI`,57:`EOF`,60:`STR`,61:`MD_STR`,63:`PUNCTUATION`,64:`PLUS`,65:`EQUALS`,66:`DOT`,67:`UNDERSCORE`},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 23:this.$=a[s];break;case 24:this.$=a[s-1]+``+a[s];break;case 26:this.$=a[s-1]+a[s];break;case 27:this.$=[a[s].trim()];break;case 28:a[s-2].push(a[s].trim()),this.$=a[s-2];break;case 29:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 37:this.$=[];break;case 42:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 43:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 44:case 45:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 46:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 47:r.addPoint(a[s-3],``,a[s-1],a[s],[]);break;case 48:r.addPoint(a[s-4],a[s-3],a[s-1],a[s],[]);break;case 49:r.addPoint(a[s-4],``,a[s-2],a[s-1],a[s]);break;case 50:r.addPoint(a[s-5],a[s-4],a[s-2],a[s-1],a[s]);break;case 51:r.setXAxisLeftText(a[s-2]),r.setXAxisRightText(a[s]);break;case 52:a[s-1].text+=` ⟶ `,r.setXAxisLeftText(a[s-1]);break;case 53:r.setXAxisLeftText(a[s]);break;case 54:r.setYAxisBottomText(a[s-2]),r.setYAxisTopText(a[s]);break;case 55:a[s-1].text+=` ⟶ `,r.setYAxisBottomText(a[s-1]);break;case 56:r.setYAxisBottomText(a[s]);break;case 57:r.setQuadrant1Text(a[s]);break;case 58:r.setQuadrant2Text(a[s]);break;case 59:r.setQuadrant3Text(a[s]);break;case 60:r.setQuadrant4Text(a[s]);break;case 64:this.$={text:a[s],type:`text`};break;case 65:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 66:this.$={text:a[s],type:`text`};break;case 67:this.$={text:a[s],type:`markdown`};break;case 68:this.$=a[s];break;case 69:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[{18:n,26:1,27:2,28:r,55:i,56:a,57:o},{1:[3]},{18:n,26:8,27:2,28:r,55:i,56:a,57:o},{18:n,26:9,27:2,28:r,55:i,56:a,57:o},e(s,[2,33],{29:10}),e(c,[2,61]),e(c,[2,62]),e(c,[2,63]),{1:[2,30]},{1:[2,31]},e(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:f,10:p,12:m,13:h,14:g,18:_,25:v,35:y,37:b,39:x,41:S,42:C,48:w,50:T,51:E,52:D,53:O,54:k,60:A,61:j,63:M,64:N,65:P,66:F,67:I}),e(s,[2,34]),{27:45,55:i,56:a,57:o},e(l,[2,37]),e(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:d,5:f,10:p,12:m,13:h,14:g,18:_,25:v,35:y,37:b,39:x,41:S,42:C,48:w,50:T,51:E,52:D,53:O,54:k,60:A,61:j,63:M,64:N,65:P,66:F,67:I}),e(l,[2,39]),e(l,[2,40]),e(l,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},e(l,[2,45]),e(l,[2,46]),{18:[1,50]},{4:d,5:f,10:p,12:m,13:h,14:g,43:51,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,10:p,12:m,13:h,14:g,43:52,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,10:p,12:m,13:h,14:g,43:53,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,10:p,12:m,13:h,14:g,43:54,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,10:p,12:m,13:h,14:g,43:55,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,10:p,12:m,13:h,14:g,43:56,58:31,60:A,61:j,63:M,64:N,65:P,66:F,67:I},{4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,44:[1,57],47:[1,58],58:60,59:59,63:M,64:N,65:P,66:F,67:I},e(z,[2,64]),e(z,[2,66]),e(z,[2,67]),e(z,[2,70]),e(z,[2,71]),e(z,[2,72]),e(z,[2,73]),e(z,[2,74]),e(z,[2,75]),e(z,[2,76]),e(z,[2,77]),e(z,[2,78]),e(z,[2,79]),e(z,[2,80]),e(s,[2,35]),e(l,[2,38]),e(l,[2,42]),e(l,[2,43]),e(l,[2,44]),{3:64,4:B,5:ee,6:te,7:ne,8:re,9:ie,10:ae,11:oe,12:se,13:ce,14:le,15:ue,21:63},e(l,[2,53],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,49:[1,77],63:M,64:N,65:P,66:F,67:I}),e(l,[2,56],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,49:[1,78],63:M,64:N,65:P,66:F,67:I}),e(l,[2,57],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),e(l,[2,58],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),e(l,[2,59],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),e(l,[2,60],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),{45:[1,79]},{44:[1,80]},e(z,[2,65]),e(z,[2,81]),e(z,[2,82]),e(z,[2,83]),{3:82,4:B,5:ee,6:te,7:ne,8:re,9:ie,10:ae,11:oe,12:se,13:ce,14:le,15:ue,18:[1,81]},e(V,[2,23]),e(V,[2,1]),e(V,[2,2]),e(V,[2,3]),e(V,[2,4]),e(V,[2,5]),e(V,[2,6]),e(V,[2,7]),e(V,[2,8]),e(V,[2,9]),e(V,[2,10]),e(V,[2,11]),e(V,[2,12]),e(l,[2,52],{58:31,43:83,4:d,5:f,10:p,12:m,13:h,14:g,60:A,61:j,63:M,64:N,65:P,66:F,67:I}),e(l,[2,55],{58:31,43:84,4:d,5:f,10:p,12:m,13:h,14:g,60:A,61:j,63:M,64:N,65:P,66:F,67:I}),{46:[1,85]},{45:[1,86]},{4:H,5:U,6:W,8:G,11:K,13:q,16:89,17:J,18:Y,19:X,20:Z,22:88,23:87},e(V,[2,24]),e(l,[2,51],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),e(l,[2,54],{59:59,58:60,4:d,5:f,8:L,10:p,12:m,13:h,14:g,18:R,63:M,64:N,65:P,66:F,67:I}),e(l,[2,47],{22:88,16:89,23:100,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{46:[1,101]},e(l,[2,29],{10:de}),e(fe,[2,27],{16:103,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),e(Q,[2,25]),e(Q,[2,13]),e(Q,[2,14]),e(Q,[2,15]),e(Q,[2,16]),e(Q,[2,17]),e(Q,[2,18]),e(Q,[2,19]),e(Q,[2,20]),e(Q,[2,21]),e(Q,[2,22]),e(l,[2,49],{10:de}),e(l,[2,48],{22:88,16:89,23:104,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{4:H,5:U,6:W,8:G,11:K,13:q,16:89,17:J,18:Y,19:X,20:Z,22:105},e(Q,[2,26]),e(l,[2,50],{10:de}),e(fe,[2,28],{16:103,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z})],defaultActions:{8:[2,30],9:[2,31]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};pe.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-K5T4RW27-B_ZUrFUq.js";import{n as e}from"./chunk-2KRD3SAO-Di4bO8ir.js";export{e as createRadarServices};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,O as t,T as n,_ as r,c as i,d as a,f as o,g as s,h as c,i as l,m as u,n as d,p as f,r as p,s as m,t as h,v as g,w as _,y as v}from"./_baseFor-
|
|
1
|
+
import{E as e,O as t,T as n,_ as r,c as i,d as a,f as o,g as s,h as c,i as l,m as u,n as d,p as f,r as p,s as m,t as h,v as g,w as _,y as v}from"./_baseFor-BHtDrjIo.js";import{i as y,n as b,r as x}from"./isEmpty-BWl67LAZ.js";function ee(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var te=`__lodash_hash_undefined__`;function ne(e){return this.__data__.set(e,te),this}function re(e){return this.__data__.has(e)}function S(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new v;++t<n;)this.add(e[t])}S.prototype.add=S.prototype.push=ne,S.prototype.has=re;function ie(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function C(e,t){return e.has(t)}var ae=1,oe=2;function w(e,t,n,r,i,a){var o=n&ae,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&oe?new S:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!ie(t,function(e,t){if(!C(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function se(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function T(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ce=1,le=2,ue=`[object Boolean]`,de=`[object Date]`,fe=`[object Error]`,pe=`[object Map]`,me=`[object Number]`,he=`[object RegExp]`,ge=`[object Set]`,_e=`[object String]`,ve=`[object Symbol]`,ye=`[object ArrayBuffer]`,be=`[object DataView]`,E=e?e.prototype:void 0,D=E?E.valueOf:void 0;function xe(e,n,i,a,o,s,c){switch(i){case be:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case ye:return!(e.byteLength!=n.byteLength||!s(new r(e),new r(n)));case ue:case de:case me:return t(+e,+n);case fe:return e.name==n.name&&e.message==n.message;case he:case _e:return e==n+``;case pe:var l=se;case ge:var u=a&ce;if(l||=T,e.size!=n.size&&!u)return!1;var d=c.get(e);if(d)return d==n;a|=le,c.set(e,n);var f=w(l(e),l(n),a,o,s,c);return c.delete(e),f;case ve:if(D)return D.call(e)==D.call(n)}return!1}function O(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function k(e,t,n){var r=t(e);return s(e)?r:O(r,n(e))}function A(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function j(){return[]}var Se=Object.prototype.propertyIsEnumerable,M=Object.getOwnPropertySymbols,N=M?function(e){return e==null?[]:(e=Object(e),A(M(e),function(t){return Se.call(e,t)}))}:j;function P(e){return l(e)?m(e):y(e)}function F(e){return k(e,P,N)}var Ce=1,we=Object.prototype.hasOwnProperty;function Te(e,t,n,r,i,a){var o=n&Ce,s=F(e),c=s.length;if(c!=F(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:we.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var Ee=1,I=`[object Arguments]`,L=`[object Array]`,R=`[object Object]`,z=Object.prototype.hasOwnProperty;function De(e,t,n,r,a,o){var c=s(e),l=s(t),u=c?L:b(e),d=l?L:b(t);u=u==I?R:u,d=d==I?R:d;var p=u==R,m=d==R,h=u==d;if(h&&f(e)){if(!f(t))return!1;c=!0,p=!1}if(h&&!p)return o||=new g,c||i(e)?w(e,t,n,r,a,o):xe(e,t,u,n,r,a,o);if(!(n&Ee)){var _=p&&z.call(e,`__wrapped__`),v=m&&z.call(t,`__wrapped__`);if(_||v){var y=_?e.value():e,x=v?t.value():t;return o||=new g,a(y,x,n,r,o)}}return h?(o||=new g,Te(e,t,n,r,a,o)):!1}function B(e,t,n,r,i){return e===t?!0:e==null||t==null||!c(e)&&!c(t)?e!==e&&t!==t:De(e,t,n,r,B,i)}var Oe=1,ke=2;function Ae(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new g;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?B(u,l,Oe|ke,r,d):f))return!1}}return!0}function V(e){return e===e&&!_(e)}function je(e){for(var t=P(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,V(i)]}return t}function H(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Me(e){var t=je(e);return t.length==1&&t[0][2]?H(t[0][0],t[0][1]):function(n){return n===e||Ae(n,e,t)}}var Ne=`[object Symbol]`;function U(e){return typeof e==`symbol`||c(e)&&n(e)==Ne}var Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fe=/^\w*$/;function W(e,t){if(s(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||U(e)?!0:Fe.test(e)||!Pe.test(e)||t!=null&&e in Object(t)}var Ie=500;function Le(e){var t=p(e,function(e){return n.size===Ie&&n.clear(),e}),n=t.cache;return t}var Re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ze=/\\(\\)?/g,Be=Le(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Re,function(e,n,r,i){t.push(r?i.replace(ze,`$1`):n||e)}),t}),Ve=1/0,G=e?e.prototype:void 0,K=G?G.toString:void 0;function q(e){if(typeof e==`string`)return e;if(s(e))return ee(e,q)+``;if(U(e))return K?K.call(e):``;var t=e+``;return t==`0`&&1/e==-Ve?`-0`:t}function He(e){return e==null?``:q(e)}function J(e,t){return s(e)?e:W(e,t)?[e]:Be(He(e))}var Ue=1/0;function Y(e){if(typeof e==`string`||U(e))return e;var t=e+``;return t==`0`&&1/e==-Ue?`-0`:t}function X(e,t){t=J(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Y(t[n++])];return n&&n==r?e:void 0}function We(e,t,n){var r=e==null?void 0:X(e,t);return r===void 0?n:r}function Ge(e,t){return e!=null&&t in Object(e)}function Ke(e,t,n){t=J(t,e);for(var r=-1,i=t.length,c=!1;++r<i;){var l=Y(t[r]);if(!(c=e!=null&&n(e,l)))break;e=e[l]}return c||++r!=i?c:(i=e==null?0:e.length,!!i&&a(i)&&o(l,i)&&(s(e)||u(e)))}function qe(e,t){return e!=null&&Ke(e,t,Ge)}var Je=1,Ye=2;function Xe(e,t){return W(e)&&V(t)?H(Y(e),t):function(n){var r=We(n,e);return r===void 0&&r===t?qe(n,e):B(t,r,Je|Ye)}}function Ze(e){return function(t){return t?.[e]}}function Qe(e){return function(t){return X(t,e)}}function $e(e){return W(e)?Ze(Y(e)):Qe(e)}function Z(e){return typeof e==`function`?e:e==null?d:typeof e==`object`?s(e)?Xe(e[0],e[1]):Me(e):$e(e)}function et(e,t){return e&&h(e,t,P)}function tt(e,t){return function(n,r){if(n==null)return n;if(!l(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var Q=tt(et);function nt(e,t){var n=[];return Q(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function rt(e,t){return(s(e)?A:nt)(e,Z(t,3))}var it=e?e.isConcatSpreadable:void 0;function at(e){return s(e)||u(e)||!!(it&&e&&e[it])}function ot(e,t,n,r,i){var a=-1,o=e.length;for(n||=at,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?ot(s,t-1,n,r,i):O(i,s):r||(i[i.length]=s)}return i}function st(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function ct(e){return e!==e}function lt(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function ut(e,t,n){return t===t?lt(e,t,n):st(e,ct,n)}function dt(e,t){return!!(e!=null&&e.length)&&ut(e,t,0)>-1}function ft(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function pt(){}var mt=x&&1/T(new x([,-0]))[1]==1/0?function(e){return new x(e)}:pt,ht=200;function gt(e,t,n){var r=-1,i=dt,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=ft;else if(a>=ht){var l=t?null:mt(e);if(l)return T(l);o=!1,i=C,c=new S}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function _t(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function $(e){return typeof e==`function`?e:d}function vt(e,t){return(s(e)?_t:Q)(e,$(t))}function yt(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function bt(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function xt(e,t,n){var r=s(e)?yt:bt,i=arguments.length<3;return r(e,Z(t,4),n,i,Q)}export{j as C,ee as E,N as S,O as T,J as _,gt as a,F as b,rt as c,Z as d,Ze as f,Y as g,X as h,_t as i,Q as l,Ke as m,vt as n,st as o,qe as p,$ as r,ot as s,xt as t,et as u,He as v,k as w,P as x,U as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as e,h as t,m as n}from"./src-CWiyyVfn.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,b as l,v as u,y as d}from"./chunk-ICPOFSXX-zLc9NsO5.js";import"./dist-BzAsli7o.js";import{h as f}from"./chunk-5PVQY5BW-BA6nMu9F.js";import"./chunk-U2HBQHQK-BAM6MO6g.js";import"./chunk-BSJP7CBP-L79XKVcb.js";import"./chunk-ZZ45TVLE-BBIHnMjI.js";import{t as p}from"./chunk-55IACEB6-BwZyF7vR.js";import{t as m}from"./chunk-EDXVE4YY-gUSTktie.js";import"./chunk-X2U36JSP-DbOwgg1R.js";import"./chunk-5FUZZQ4R-DxqHPDro.js";import"./chunk-ENJZ2VHE-C-wW17kd.js";import{r as h,t as g}from"./chunk-336JU56O-CbnUj19H.js";var _=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],c=[2,7],l=[1,26],u=[1,27],d=[1,28],f=[1,29],p=[1,33],m=[1,34],h=[1,35],g=[1,36],_=[1,37],v=[1,38],y=[1,24],b=[1,31],x=[1,32],S=[1,30],C=[1,39],w=[1,40],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,61],D=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],k=[27,29],ee=[1,70],A=[1,71],te=[1,72],ne=[1,73],re=[1,74],ie=[1,75],ae=[1,76],j=[1,83],M=[1,80],N=[1,84],P=[1,85],F=[1,86],I=[1,87],L=[1,88],R=[1,89],z=[1,90],B=[1,91],V=[1,92],oe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],H=[63,64],se=[1,101],ce=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],U=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],W=[1,110],G=[1,106],K=[1,107],q=[1,108],J=[1,109],Y=[1,111],X=[1,116],Z=[1,117],Q=[1,114],$=[1,115],le={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:`error`,5:`NEWLINE`,6:`RD`,8:`EOF`,9:`acc_title`,10:`acc_title_value`,11:`acc_descr`,12:`acc_descr_value`,13:`acc_descr_multiline_value`,21:`direction_tb`,22:`direction_bt`,23:`direction_rl`,24:`direction_lr`,27:`STRUCT_START`,29:`STYLE_SEPARATOR`,31:`ID`,32:`COLONSEP`,34:`TEXT`,36:`RISK`,38:`VERIFYMTHD`,40:`STRUCT_STOP`,41:`REQUIREMENT`,42:`FUNCTIONAL_REQUIREMENT`,43:`INTERFACE_REQUIREMENT`,44:`PERFORMANCE_REQUIREMENT`,45:`PHYSICAL_REQUIREMENT`,46:`DESIGN_CONSTRAINT`,47:`LOW_RISK`,48:`MED_RISK`,49:`HIGH_RISK`,50:`VERIFY_ANALYSIS`,51:`VERIFY_DEMONSTRATION`,52:`VERIFY_INSPECTION`,53:`VERIFY_TEST`,54:`ELEMENT`,57:`TYPE`,59:`DOCREF`,61:`END_ARROW_L`,63:`LINE`,64:`END_ARROW_R`,65:`CONTAINS`,66:`COPIES`,67:`DERIVES`,68:`SATISFIES`,69:`VERIFIES`,70:`REFINES`,71:`TRACES`,72:`CLASSDEF`,74:`CLASS`,75:`ALPHA`,76:`COMMA`,77:`STYLE`,80:`NUM`,81:`COLON`,82:`UNIT`,83:`SPACE`,84:`BRKT`,85:`PCT`,86:`MINUS`,87:`LABEL`,88:`SEMICOLON`,89:`unqString`,90:`qString`},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 4:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 5:case 6:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:r.setDirection(`TB`);break;case 18:r.setDirection(`BT`);break;case 19:r.setDirection(`RL`);break;case 20:r.setDirection(`LR`);break;case 21:r.addRequirement(a[s-3],a[s-4]);break;case 22:r.addRequirement(a[s-5],a[s-6]),r.setClass([a[s-5]],a[s-3]);break;case 23:r.setNewReqId(a[s-2]);break;case 24:r.setNewReqText(a[s-2]);break;case 25:r.setNewReqRisk(a[s-2]);break;case 26:r.setNewReqVerifyMethod(a[s-2]);break;case 29:this.$=r.RequirementType.REQUIREMENT;break;case 30:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=r.RiskLevel.LOW_RISK;break;case 36:this.$=r.RiskLevel.MED_RISK;break;case 37:this.$=r.RiskLevel.HIGH_RISK;break;case 38:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=r.VerifyType.VERIFY_TEST;break;case 42:r.addElement(a[s-3]);break;case 43:r.addElement(a[s-5]),r.setClass([a[s-5]],a[s-3]);break;case 44:r.setNewElementType(a[s-2]);break;case 45:r.setNewElementDocRef(a[s-2]);break;case 48:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 49:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 50:this.$=r.Relationships.CONTAINS;break;case 51:this.$=r.Relationships.COPIES;break;case 52:this.$=r.Relationships.DERIVES;break;case 53:this.$=r.Relationships.SATISFIES;break;case 54:this.$=r.Relationships.VERIFIES;break;case 55:this.$=r.Relationships.REFINES;break;case 56:this.$=r.Relationships.TRACES;break;case 57:this.$=a[s-2],r.defineClass(a[s-1],a[s]);break;case 58:r.setClass(a[s-1],a[s]);break;case 59:r.setClass([a[s-2]],a[s]);break;case 60:case 62:this.$=[a[s]];break;case 61:case 63:this.$=a[s-2].concat([a[s]]);break;case 64:this.$=a[s-2],r.setCssStyle(a[s-1],a[s]);break;case 65:this.$=[a[s]];break;case 66:a[s-2].push(a[s]),this.$=a[s-2];break;case 68:this.$=a[s-1]+a[s];break}},`anonymous`),table:[{3:1,4:2,6:n,9:r,11:i,13:a},{1:[3]},{3:8,4:2,5:[1,7],6:n,9:r,11:i,13:a},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(o,[2,6]),{3:12,4:2,6:n,9:r,11:i,13:a},{1:[2,2]},{4:17,5:s,7:13,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},e(o,[2,4]),e(o,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:43,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:44,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:45,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:46,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:47,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:48,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:49,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:50,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(T,[2,17]),e(T,[2,18]),e(T,[2,19]),e(T,[2,20]),{30:60,33:62,75:E,89:C,90:w},{30:63,33:62,75:E,89:C,90:w},{30:64,33:62,75:E,89:C,90:w},e(D,[2,29]),e(D,[2,30]),e(D,[2,31]),e(D,[2,32]),e(D,[2,33]),e(D,[2,34]),e(O,[2,81]),e(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(k,[2,79]),e(k,[2,80]),{27:[1,67],29:[1,68]},e(k,[2,85]),e(k,[2,86]),{62:69,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{62:77,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{30:78,33:62,75:E,89:C,90:w},{73:79,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},e(oe,[2,60]),e(oe,[2,62]),{73:93,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},{30:94,33:62,75:E,76:M,89:C,90:w},{5:[1,95]},{30:96,33:62,75:E,89:C,90:w},{5:[1,97]},{30:98,33:62,75:E,89:C,90:w},{63:[1,99]},e(H,[2,50]),e(H,[2,51]),e(H,[2,52]),e(H,[2,53]),e(H,[2,54]),e(H,[2,55]),e(H,[2,56]),{64:[1,100]},e(T,[2,59],{76:M}),e(T,[2,64],{76:se}),{33:103,75:[1,102],89:C,90:w},e(ce,[2,65],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),e(U,[2,67]),e(U,[2,69]),e(U,[2,70]),e(U,[2,71]),e(U,[2,72]),e(U,[2,73]),e(U,[2,74]),e(U,[2,75]),e(U,[2,76]),e(U,[2,77]),e(U,[2,78]),e(T,[2,57],{76:se}),e(T,[2,58],{76:M}),{5:W,28:105,31:G,34:K,36:q,38:J,40:Y},{27:[1,112],76:M},{5:X,40:Z,56:113,57:Q,59:$},{27:[1,118],76:M},{33:119,89:C,90:w},{33:120,89:C,90:w},{75:j,78:121,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},e(oe,[2,61]),e(oe,[2,63]),e(U,[2,68]),e(T,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:W,28:126,31:G,34:K,36:q,38:J,40:Y},e(T,[2,28]),{5:[1,127]},e(T,[2,42]),{32:[1,128]},{32:[1,129]},{5:X,40:Z,56:130,57:Q,59:$},e(T,[2,47]),{5:[1,131]},e(T,[2,48]),e(T,[2,49]),e(ce,[2,66],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),{33:132,89:C,90:w},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(T,[2,27]),{5:W,28:145,31:G,34:K,36:q,38:J,40:Y},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(T,[2,46]),{5:X,40:Z,56:152,57:Q,59:$},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(T,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(T,[2,43]),{5:W,28:159,31:G,34:K,36:q,38:J,40:Y},{5:W,28:160,31:G,34:K,36:q,38:J,40:Y},{5:W,28:161,31:G,34:K,36:q,38:J,40:Y},{5:W,28:162,31:G,34:K,36:q,38:J,40:Y},{5:X,40:Z,56:163,57:Q,59:$},{5:X,40:Z,56:164,57:Q,59:$},e(T,[2,23]),e(T,[2,24]),e(T,[2,25]),e(T,[2,26]),e(T,[2,44]),e(T,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,ee,A;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var te=``;for(O in A=[],s[w])this.terminals_[O]&&O>f&&A.push(`'`+this.terminals_[O]+`'`);te=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
1
|
+
import{g as e,h as t,m as n}from"./src-B6XdH6xq.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,b as l,v as u,y as d}from"./chunk-ICPOFSXX-rgw1I6pt.js";import"./dist-Bd4S37oi.js";import{h as f}from"./chunk-5PVQY5BW-DOeY60Lp.js";import"./chunk-U2HBQHQK-CwMCwyfq.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-sANOwJKn.js";import{t as p}from"./chunk-55IACEB6-BRJOZLpU.js";import{t as m}from"./chunk-EDXVE4YY-BSbGSOxN.js";import"./chunk-X2U36JSP-CvKfDVvq.js";import"./chunk-5FUZZQ4R-3-UZ9191.js";import"./chunk-ENJZ2VHE-CszgAcWZ.js";import{r as h,t as g}from"./chunk-336JU56O-XIsdqKyD.js";var _=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],c=[2,7],l=[1,26],u=[1,27],d=[1,28],f=[1,29],p=[1,33],m=[1,34],h=[1,35],g=[1,36],_=[1,37],v=[1,38],y=[1,24],b=[1,31],x=[1,32],S=[1,30],C=[1,39],w=[1,40],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,61],D=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],k=[27,29],ee=[1,70],A=[1,71],te=[1,72],ne=[1,73],re=[1,74],ie=[1,75],ae=[1,76],j=[1,83],M=[1,80],N=[1,84],P=[1,85],F=[1,86],I=[1,87],L=[1,88],R=[1,89],z=[1,90],B=[1,91],V=[1,92],oe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],H=[63,64],se=[1,101],ce=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],U=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],W=[1,110],G=[1,106],K=[1,107],q=[1,108],J=[1,109],Y=[1,111],X=[1,116],Z=[1,117],Q=[1,114],$=[1,115],le={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:`error`,5:`NEWLINE`,6:`RD`,8:`EOF`,9:`acc_title`,10:`acc_title_value`,11:`acc_descr`,12:`acc_descr_value`,13:`acc_descr_multiline_value`,21:`direction_tb`,22:`direction_bt`,23:`direction_rl`,24:`direction_lr`,27:`STRUCT_START`,29:`STYLE_SEPARATOR`,31:`ID`,32:`COLONSEP`,34:`TEXT`,36:`RISK`,38:`VERIFYMTHD`,40:`STRUCT_STOP`,41:`REQUIREMENT`,42:`FUNCTIONAL_REQUIREMENT`,43:`INTERFACE_REQUIREMENT`,44:`PERFORMANCE_REQUIREMENT`,45:`PHYSICAL_REQUIREMENT`,46:`DESIGN_CONSTRAINT`,47:`LOW_RISK`,48:`MED_RISK`,49:`HIGH_RISK`,50:`VERIFY_ANALYSIS`,51:`VERIFY_DEMONSTRATION`,52:`VERIFY_INSPECTION`,53:`VERIFY_TEST`,54:`ELEMENT`,57:`TYPE`,59:`DOCREF`,61:`END_ARROW_L`,63:`LINE`,64:`END_ARROW_R`,65:`CONTAINS`,66:`COPIES`,67:`DERIVES`,68:`SATISFIES`,69:`VERIFIES`,70:`REFINES`,71:`TRACES`,72:`CLASSDEF`,74:`CLASS`,75:`ALPHA`,76:`COMMA`,77:`STYLE`,80:`NUM`,81:`COLON`,82:`UNIT`,83:`SPACE`,84:`BRKT`,85:`PCT`,86:`MINUS`,87:`LABEL`,88:`SEMICOLON`,89:`unqString`,90:`qString`},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 4:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 5:case 6:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:r.setDirection(`TB`);break;case 18:r.setDirection(`BT`);break;case 19:r.setDirection(`RL`);break;case 20:r.setDirection(`LR`);break;case 21:r.addRequirement(a[s-3],a[s-4]);break;case 22:r.addRequirement(a[s-5],a[s-6]),r.setClass([a[s-5]],a[s-3]);break;case 23:r.setNewReqId(a[s-2]);break;case 24:r.setNewReqText(a[s-2]);break;case 25:r.setNewReqRisk(a[s-2]);break;case 26:r.setNewReqVerifyMethod(a[s-2]);break;case 29:this.$=r.RequirementType.REQUIREMENT;break;case 30:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=r.RiskLevel.LOW_RISK;break;case 36:this.$=r.RiskLevel.MED_RISK;break;case 37:this.$=r.RiskLevel.HIGH_RISK;break;case 38:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=r.VerifyType.VERIFY_TEST;break;case 42:r.addElement(a[s-3]);break;case 43:r.addElement(a[s-5]),r.setClass([a[s-5]],a[s-3]);break;case 44:r.setNewElementType(a[s-2]);break;case 45:r.setNewElementDocRef(a[s-2]);break;case 48:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 49:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 50:this.$=r.Relationships.CONTAINS;break;case 51:this.$=r.Relationships.COPIES;break;case 52:this.$=r.Relationships.DERIVES;break;case 53:this.$=r.Relationships.SATISFIES;break;case 54:this.$=r.Relationships.VERIFIES;break;case 55:this.$=r.Relationships.REFINES;break;case 56:this.$=r.Relationships.TRACES;break;case 57:this.$=a[s-2],r.defineClass(a[s-1],a[s]);break;case 58:r.setClass(a[s-1],a[s]);break;case 59:r.setClass([a[s-2]],a[s]);break;case 60:case 62:this.$=[a[s]];break;case 61:case 63:this.$=a[s-2].concat([a[s]]);break;case 64:this.$=a[s-2],r.setCssStyle(a[s-1],a[s]);break;case 65:this.$=[a[s]];break;case 66:a[s-2].push(a[s]),this.$=a[s-2];break;case 68:this.$=a[s-1]+a[s];break}},`anonymous`),table:[{3:1,4:2,6:n,9:r,11:i,13:a},{1:[3]},{3:8,4:2,5:[1,7],6:n,9:r,11:i,13:a},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(o,[2,6]),{3:12,4:2,6:n,9:r,11:i,13:a},{1:[2,2]},{4:17,5:s,7:13,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},e(o,[2,4]),e(o,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:43,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:44,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:45,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:46,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:47,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:48,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:49,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:50,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(T,[2,17]),e(T,[2,18]),e(T,[2,19]),e(T,[2,20]),{30:60,33:62,75:E,89:C,90:w},{30:63,33:62,75:E,89:C,90:w},{30:64,33:62,75:E,89:C,90:w},e(D,[2,29]),e(D,[2,30]),e(D,[2,31]),e(D,[2,32]),e(D,[2,33]),e(D,[2,34]),e(O,[2,81]),e(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(k,[2,79]),e(k,[2,80]),{27:[1,67],29:[1,68]},e(k,[2,85]),e(k,[2,86]),{62:69,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{62:77,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{30:78,33:62,75:E,89:C,90:w},{73:79,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},e(oe,[2,60]),e(oe,[2,62]),{73:93,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},{30:94,33:62,75:E,76:M,89:C,90:w},{5:[1,95]},{30:96,33:62,75:E,89:C,90:w},{5:[1,97]},{30:98,33:62,75:E,89:C,90:w},{63:[1,99]},e(H,[2,50]),e(H,[2,51]),e(H,[2,52]),e(H,[2,53]),e(H,[2,54]),e(H,[2,55]),e(H,[2,56]),{64:[1,100]},e(T,[2,59],{76:M}),e(T,[2,64],{76:se}),{33:103,75:[1,102],89:C,90:w},e(ce,[2,65],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),e(U,[2,67]),e(U,[2,69]),e(U,[2,70]),e(U,[2,71]),e(U,[2,72]),e(U,[2,73]),e(U,[2,74]),e(U,[2,75]),e(U,[2,76]),e(U,[2,77]),e(U,[2,78]),e(T,[2,57],{76:se}),e(T,[2,58],{76:M}),{5:W,28:105,31:G,34:K,36:q,38:J,40:Y},{27:[1,112],76:M},{5:X,40:Z,56:113,57:Q,59:$},{27:[1,118],76:M},{33:119,89:C,90:w},{33:120,89:C,90:w},{75:j,78:121,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},e(oe,[2,61]),e(oe,[2,63]),e(U,[2,68]),e(T,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:W,28:126,31:G,34:K,36:q,38:J,40:Y},e(T,[2,28]),{5:[1,127]},e(T,[2,42]),{32:[1,128]},{32:[1,129]},{5:X,40:Z,56:130,57:Q,59:$},e(T,[2,47]),{5:[1,131]},e(T,[2,48]),e(T,[2,49]),e(ce,[2,66],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),{33:132,89:C,90:w},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(T,[2,27]),{5:W,28:145,31:G,34:K,36:q,38:J,40:Y},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(T,[2,46]),{5:X,40:Z,56:152,57:Q,59:$},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(T,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(T,[2,43]),{5:W,28:159,31:G,34:K,36:q,38:J,40:Y},{5:W,28:160,31:G,34:K,36:q,38:J,40:Y},{5:W,28:161,31:G,34:K,36:q,38:J,40:Y},{5:W,28:162,31:G,34:K,36:q,38:J,40:Y},{5:X,40:Z,56:163,57:Q,59:$},{5:X,40:Z,56:164,57:Q,59:$},e(T,[2,23]),e(T,[2,24]),e(T,[2,25]),e(T,[2,26]),e(T,[2,44]),e(T,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,ee,A;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var te=``;for(O in A=[],s[w])this.terminals_[O]&&O>f&&A.push(`'`+this.terminals_[O]+`'`);te=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+A.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(te,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:A})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),ee=s[r[r.length-2]][r[r.length-1]],r.push(ee);break;case 3:return!0}}return!0},`parse`)};le.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as e,p as t}from"./src-CWiyyVfn.js";import{B as n,C as r,K as i,V as a,W as o,_ as s,a as c,b as l,s as u,u as d,v as f}from"./chunk-ICPOFSXX-zLc9NsO5.js";import{t as p}from"./ordinal-BDi6f4xk.js";function m(e){for(var t=e.length/6|0,n=Array(t),r=0;r<t;)n[r]=`#`+e.slice(r*6,++r*6);return n}var h=m(`4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab`);function g(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function _(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function v(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function y(e){return e.target.depth}function b(e){return e.depth}function x(e,t){return t-1-e.height}function S(e,t){return e.sourceLinks.length?e.depth:t-1}function C(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?_(e.sourceLinks,y)-1:0}function w(e){return function(){return e}}function T(e,t){return D(e.source,t.source)||e.index-t.index}function E(e,t){return D(e.target,t.target)||e.index-t.index}function D(e,t){return e.y0-t.y0}function O(e){return e.value}function k(e){return e.index}function A(e){return e.nodes}function j(e){return e.links}function M(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function N({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function P(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=k,c=S,l,u,d=A,f=j,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),y(e),b(e),x(e),F(e),N(e),e}m.update=function(e){return N(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:w(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:w(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:w(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:w(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=M(n,t)),typeof i!=`object`&&(i=r.target=M(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function y({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(v(t.sourceLinks,O),v(t.targetLinks,O)):t.fixedValue}function b({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function x({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function C({nodes:t}){let r=g(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function P(e){let n=_(e,e=>(r-t-(e.length-1)*o)/v(e,O));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}H(i)}}function F(e){let n=C(e);o=Math.min(a,(r-t)/(g(n,e=>e.length)-1)),P(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);L(n,t,r),I(n,t,r)}}function I(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=U(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function L(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=W(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function R(e,n){let i=e.length>>1,a=e[i];B(e,a.y0-o,i-1,n),z(e,a.y1+o,i+1,n),B(e,r,e.length-1,n),z(e,t,0,n)}function z(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function B(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function V({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(E);for(let{target:{targetLinks:t}}of e)t.sort(T)}}function H(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(E),n.sort(T)}function U(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function W(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var F=Math.PI,I=2*F,L=1e-6,R=I-L;function z(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function B(){return new z}z.prototype=B.prototype={constructor:z,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>L)if(!(Math.abs(u*s-c*l)>L)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((F-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>L&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>L||Math.abs(this._y1-l)>L)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%I+I),d>R?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>L&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=F)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function V(e){return function(){return e}}function H(e){return e[0]}function U(e){return e[1]}var W=Array.prototype.slice;function ee(e){return e.source}function G(e){return e.target}function K(e){var t=ee,n=G,r=H,i=U,a=null;function o(){var o,s=W.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=B(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:V(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:V(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function q(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function te(){return K(q)}function ne(e){return[e.source.x1,e.y0]}function re(e){return[e.target.x0,e.y1]}function ie(){return te().source(ne).target(re)}var J=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,9],r=[1,10],i=[1,5,10,12],a={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:`error`,4:`SANKEY`,5:`NEWLINE`,10:`EOF`,11:`field[source]`,12:`COMMA`,13:`field[target]`,14:`field[value]`,18:`DQUOTE`,19:`ESCAPED_TEXT`,20:`NON_ESCAPED_TEXT`},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 7:let e=r.findOrCreateNode(a[s-4].trim().replaceAll(`""`,`"`)),t=r.findOrCreateNode(a[s-2].trim().replaceAll(`""`,`"`)),n=parseFloat(a[s].trim());r.addLink(e,t,n);break;case 8:case 9:case 11:this.$=a[s];break;case 10:this.$=a[s-1];break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:r},{15:18,16:7,17:8,18:n,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:n,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
1
|
+
import{h as e,p as t}from"./src-B6XdH6xq.js";import{B as n,C as r,K as i,V as a,W as o,_ as s,a as c,b as l,s as u,u as d,v as f}from"./chunk-ICPOFSXX-rgw1I6pt.js";import{t as p}from"./ordinal-krseTxxN.js";function m(e){for(var t=e.length/6|0,n=Array(t),r=0;r<t;)n[r]=`#`+e.slice(r*6,++r*6);return n}var h=m(`4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab`);function g(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function _(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function v(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function y(e){return e.target.depth}function b(e){return e.depth}function x(e,t){return t-1-e.height}function S(e,t){return e.sourceLinks.length?e.depth:t-1}function C(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?_(e.sourceLinks,y)-1:0}function w(e){return function(){return e}}function T(e,t){return D(e.source,t.source)||e.index-t.index}function E(e,t){return D(e.target,t.target)||e.index-t.index}function D(e,t){return e.y0-t.y0}function O(e){return e.value}function k(e){return e.index}function A(e){return e.nodes}function j(e){return e.links}function M(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function N({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function P(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=k,c=S,l,u,d=A,f=j,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),y(e),b(e),x(e),F(e),N(e),e}m.update=function(e){return N(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:w(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:w(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:w(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:w(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=M(n,t)),typeof i!=`object`&&(i=r.target=M(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function y({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(v(t.sourceLinks,O),v(t.targetLinks,O)):t.fixedValue}function b({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function x({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function C({nodes:t}){let r=g(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function P(e){let n=_(e,e=>(r-t-(e.length-1)*o)/v(e,O));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}H(i)}}function F(e){let n=C(e);o=Math.min(a,(r-t)/(g(n,e=>e.length)-1)),P(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);L(n,t,r),I(n,t,r)}}function I(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=U(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function L(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=W(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function R(e,n){let i=e.length>>1,a=e[i];B(e,a.y0-o,i-1,n),z(e,a.y1+o,i+1,n),B(e,r,e.length-1,n),z(e,t,0,n)}function z(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function B(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function V({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(E);for(let{target:{targetLinks:t}}of e)t.sort(T)}}function H(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(E),n.sort(T)}function U(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function W(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var F=Math.PI,I=2*F,L=1e-6,R=I-L;function z(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function B(){return new z}z.prototype=B.prototype={constructor:z,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>L)if(!(Math.abs(u*s-c*l)>L)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((F-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>L&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>L||Math.abs(this._y1-l)>L)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%I+I),d>R?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>L&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=F)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function V(e){return function(){return e}}function H(e){return e[0]}function U(e){return e[1]}var W=Array.prototype.slice;function ee(e){return e.source}function G(e){return e.target}function K(e){var t=ee,n=G,r=H,i=U,a=null;function o(){var o,s=W.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=B(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:V(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:V(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function q(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function te(){return K(q)}function ne(e){return[e.source.x1,e.y0]}function re(e){return[e.target.x0,e.y1]}function ie(){return te().source(ne).target(re)}var J=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,9],r=[1,10],i=[1,5,10,12],a={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:`error`,4:`SANKEY`,5:`NEWLINE`,10:`EOF`,11:`field[source]`,12:`COMMA`,13:`field[target]`,14:`field[value]`,18:`DQUOTE`,19:`ESCAPED_TEXT`,20:`NON_ESCAPED_TEXT`},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 7:let e=r.findOrCreateNode(a[s-4].trim().replaceAll(`""`,`"`)),t=r.findOrCreateNode(a[s-2].trim().replaceAll(`""`,`"`)),n=parseFloat(a[s].trim());r.addLink(e,t,n);break;case 8:case 9:case 11:this.$=a[s];break;case 10:this.$=a[s-1];break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:r},{15:18,16:7,17:8,18:n,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:n,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};a.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|