@cuongtran001/kanna 1.83.0 → 1.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{BoardsPage-B47z4IUS.js → BoardsPage-mm_dy-6I.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-B9V-5ps8.js → BoardsRoutePage-B7dJA_QL.js} +1 -1
- package/dist/client/assets/{ChatPage-DX0B9y32.js → ChatPage-Bw4peAkb.js} +3 -3
- package/dist/client/assets/{CronJobRow-Czmwve8c.js → CronJobRow-DKW6LnKe.js} +1 -1
- package/dist/client/assets/{CronJobsPage-CwlJzDdC.js → CronJobsPage-CBxttYFH.js} +1 -1
- package/dist/client/assets/{CronRunMessage-CWGg7z7P.js → CronRunMessage-B4x7mzzh.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-CSTHZ0r-.js → FilePreviewSheet-iaBNZ_R0.js} +1 -1
- package/dist/client/assets/{FlowSurface-BPL2XTsf.js → FlowSurface-B3kKtCHA.js} +1 -1
- package/dist/client/assets/{GenUIBlock-BREhbsjV.js → GenUIBlock-CMM23p8L.js} +2 -2
- package/dist/client/assets/{InboxPage-Cz9LwqUa.js → InboxPage-C_QKGmlx.js} +1 -1
- package/dist/client/assets/{KannaSocketProvider-Qy4JOiDr.js → KannaSocketProvider-Clv949La.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-CnlkL990.js → LocalProjectsPage-BLF1dYUW.js} +1 -1
- package/dist/client/assets/{SettingsPage-BF9zHwoY.js → SettingsPage-CITPPDfV.js} +1 -1
- package/dist/client/assets/{StackBoardsRoutePage-DQTwVdgd.js → StackBoardsRoutePage-BX-fo655.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-BRV-hiN2.js → ToolCallMessage-BbLzqXn7.js} +1 -1
- package/dist/client/assets/{VChartSurface-BMzsVUBZ.js → VChartSurface-D9jlaiQA.js} +1 -1
- package/dist/client/assets/{WebhooksPage-DqSM0Ldu.js → WebhooksPage-DGi5OTMt.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-D0AHM-Wb.js → WorkflowsPage-ndxOqUWo.js} +1 -1
- package/dist/client/assets/{WorkflowsSection-CADF_Bzd.js → WorkflowsSection-DgbttKnk.js} +1 -1
- package/dist/client/assets/{appSettingsStore-CRg6ywgC.js → appSettingsStore-CDBkjKuH.js} +1 -1
- package/dist/client/assets/{arrow-left-B1xpxyAz.js → arrow-left-DOANYNxC.js} +1 -1
- package/dist/client/assets/{chart-renderer-rxKOguR8.js → chart-renderer-Cw-dI71U.js} +1 -1
- package/dist/client/assets/{chatSounds-B9Ivu374.js → chatSounds-Cjf1Ow1m.js} +1 -1
- package/dist/client/assets/chevron-down-Coo9PgPJ.js +1 -0
- package/dist/client/assets/chevron-left-n1tLJKrp.js +1 -0
- package/dist/client/assets/{clipboard.adapter-B_fp79JP.js → clipboard.adapter-BCxT7Qli.js} +1 -1
- package/dist/client/assets/{columnStyle-BIq7Yfnj.js → columnStyle-aXeR3SrA.js} +1 -1
- package/dist/client/assets/{contextWindow-Dij7VexD.js → contextWindow-I-trSDu4.js} +1 -1
- package/dist/client/assets/{copyFeedbackStore-BVqIZyJA.js → copyFeedbackStore-BW6Vjufv.js} +1 -1
- package/dist/client/assets/{createScopedStore-SnvtxVfu.js → createScopedStore-D1trFyJw.js} +1 -1
- package/dist/client/assets/{cronJobsStore-abUqA7Tv.js → cronJobsStore-CndqKrjB.js} +1 -1
- package/dist/client/assets/{ellipsis-2QrMzUkm.js → ellipsis-CFHwUFtG.js} +1 -1
- package/dist/client/assets/{external-link-DOOcesX8.js → external-link-9xEpmM2n.js} +1 -1
- package/dist/client/assets/{flow-kinds-DSOaexAL.js → flow-kinds-DnUaQXgl.js} +1 -1
- package/dist/client/assets/{folder-Bwd3sLen.js → folder-Bg7BAFNU.js} +1 -1
- package/dist/client/assets/{genui-0tseVHei.js → genui-jdDJe0VI.js} +1 -1
- package/dist/client/assets/{globe-BzQDkdZX.js → globe-CeniwLw3.js} +1 -1
- package/dist/client/assets/{host-C3kMJzEk.js → host-BNDj5_aa.js} +1 -1
- package/dist/client/assets/{inbox-OcWbx5dq.js → inbox-C62UubNn.js} +1 -1
- package/dist/client/assets/{inboxStore-BZsasEeB.js → inboxStore-Bks9mpiK.js} +1 -1
- package/dist/client/assets/{index-CbcQLFbg.js → index-Dp3JEZQ3.js} +3 -3
- package/dist/client/assets/{info-BCSQhrG7.js → info-BMdKmB36.js} +1 -1
- package/dist/client/assets/{input-ExC-3rHy.js → input-CS1DBeNV.js} +1 -1
- package/dist/client/assets/{lexicalToReact-Ce76aPsW.js → lexicalToReact-CkI42EHr.js} +3 -3
- package/dist/client/assets/{log-DIu9xkUN.js → log-3sQ-5rrS.js} +1 -1
- package/dist/client/assets/{monitor-BP4FTtXg.js → monitor-_V-BjQpD.js} +1 -1
- package/dist/client/assets/{pencil-47Ckkow-.js → pencil-BTeN1rO_.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-DG0IogaL.js → pendingActionsStore-C9wopHr4.js} +1 -1
- package/dist/client/assets/{play-B0G1X5os.js → play-C_g7W9ao.js} +1 -1
- package/dist/client/assets/{plus-B-KGULQg.js → plus-D0uUa5kJ.js} +1 -1
- package/dist/client/assets/{popover-H1bnfjIL.js → popover-CA332KD1.js} +1 -1
- package/dist/client/assets/runDetached-BBRv1zoc.js +1 -0
- package/dist/client/assets/{search-D4Ge6Hht.js → search-48C1GM_8.js} +1 -1
- package/dist/client/assets/{searchable-select-BE62ykWr.js → searchable-select-C2LG0o1C.js} +1 -1
- package/dist/client/assets/{segmented-control-CwOQtips.js → segmented-control-DbmDSdKy.js} +1 -1
- package/dist/client/assets/{select-Dee_-sbr.js → select-BKHnGLKS.js} +1 -1
- package/dist/client/assets/{settings-header-button-BCTE-ScU.js → settings-header-button-D4w0LZ-R.js} +1 -1
- package/dist/client/assets/{sidebarPendingActions-BrcxtPLq.js → sidebarPendingActions-BQ059yIu.js} +1 -1
- package/dist/client/assets/{square-pen-DVDO1c01.js → square-pen-C5BA26g7.js} +1 -1
- package/dist/client/assets/{state-mark-Cpr4kZpE.js → state-mark-DNAt8L4c.js} +1 -1
- package/dist/client/assets/{terminal-CJmWAR__.js → terminal-DDMsYlkg.js} +1 -1
- package/dist/client/assets/{timer.adapter-BX7oyt8G.js → timer.adapter-Di4tkt37.js} +1 -1
- package/dist/client/assets/{tools-CdXgLXQy.js → tools-CeacgJBu.js} +1 -1
- package/dist/client/assets/{triangle-alert-La2uFCiR.js → triangle-alert-B6T8mkaG.js} +1 -1
- package/dist/client/assets/{useAppGlobalState-NukFv4HT.js → useAppGlobalState-C6_aikPC.js} +1 -1
- package/dist/client/assets/{useKannaState-BUbXZ9PG.js → useKannaState-BESpYf4x.js} +1 -1
- package/dist/client/assets/{useTheme-ee-m4Hcs.js → useTheme-V_0ZRiiP.js} +1 -1
- package/dist/client/assets/{webhook-CQwbFakw.js → webhook-_4KNokhW.js} +1 -1
- package/dist/client/assets/{webhookCommands-BxPTN2Od.js → webhookCommands-ClSc7rRQ.js} +1 -1
- package/dist/client/assets/{webhooksStore-26fMZM_X.js → webhooksStore-DmkDHteX.js} +1 -1
- package/dist/client/index.html +41 -41
- package/package.json +4 -3
- package/src/server/event-store-snapshot.test.ts +7 -0
- package/src/server/event-store-snapshot.ts +2 -0
- package/src/server/event-store.test.ts +37 -0
- package/src/server/remote-mcp/remote-mcp-tools.test.ts +8 -5
- package/dist/client/assets/chevron-down-Bj1p9afs.js +0 -1
- package/dist/client/assets/chevron-left-rwNvioId.js +0 -1
- package/dist/client/assets/runDetached-CXTNs9Tz.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{l as n,u as r}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{B as a,Ct as o,D as s,Ft as c,It as l,Lt as u,M as d,Nt as f,T as p,b as m,bt as h,d as g,f as _,ft as v,j as y,k as b,l as x,n as ee,o as te,u as ne,vt as S,wt as re,x as C,xt as ie}from"./useAppGlobalState-NukFv4HT.js";import{a as ae,c as w,d as oe,f as T,p as se,s as ce}from"./log-DIu9xkUN.js";import{a as E,c as D,d as O,f as k,n as A,o as j,r as M,s as N,t as P}from"./pendingActionsStore-DG0IogaL.js";import{C as le,S as ue,_ as de,a as fe,b as pe,d as me,g as he,h as ge,i as _e,m as ve,n as ye,t as be,v as xe,y as Se}from"./copyFeedbackStore-BVqIZyJA.js";import{t as Ce,zt as we}from"./lexicalToReact-Ce76aPsW.js";import{n as Te,r as Ee,t as De}from"./clipboard.adapter-B_fp79JP.js";import{t as Oe}from"./chevron-down-Bj1p9afs.js";import{a as ke,i as F,n as Ae,o as je,r as Me,t as Ne}from"./select-Dee_-sbr.js";import{t as Pe}from"./external-link-DOOcesX8.js";import{t as Fe}from"./info-BCSQhrG7.js";import{t as Ie}from"./monitor-BP4FTtXg.js";import{t as Le}from"./pencil-47Ckkow-.js";import{t as Re}from"./plus-B-KGULQg.js";import{n as ze,t as Be}from"./search-D4Ge6Hht.js";import{a as Ve,g as He,i as Ue,l as We,n as I,r as Ge,u as Ke}from"./webhooksStore-26fMZM_X.js";import{g as qe,i as Je,n as Ye,o as Xe,r as Ze,t as Qe,u as $e}from"./timer.adapter-BX7oyt8G.js";import{a as et,c as tt,o as nt,s as rt,t as L}from"./segmented-control-CwOQtips.js";import{t as R}from"./input-ExC-3rHy.js";import{C as it,S as at,_ as z,a as ot,c as st,d as ct,f as lt,g as ut,h as dt,i as ft,l as pt,m as mt,n as ht,o as gt,p as _t,r as vt,s as yt,t as bt,u as xt,x as St,y as Ct}from"./appSettingsStore-CRg6ywgC.js";import{t as wt}from"./runDetached-CXTNs9Tz.js";import{t as Tt}from"./chatSounds-B9Ivu374.js";import{c as Et,l as Dt,o as Ot,r as kt}from"./contextWindow-Dij7VexD.js";import{C as At,D as jt,E as Mt,O as Nt,T as Pt,_ as Ft,a as It,b as Lt,c as Rt,d as zt,f as Bt,g as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt,v as $t,w as B,x as en,y as tn}from"./types-C-hQn4rL.js";import{c as nn,h as rn,i as an,m as on,n as sn,o as cn,p as ln,r as un,s as dn,u as fn}from"./KannaSocketProvider-Qy4JOiDr.js";import{r as pn}from"./formatters-BGORekd-.js";import{n as V,t as mn}from"./formatDuration-BbWTR_M_.js";import{n as hn}from"./state-mark-Cpr4kZpE.js";import{n as gn,r as _n,t as vn}from"./popover-H1bnfjIL.js";import{n as yn}from"./cronJobsStore-abUqA7Tv.js";import{r as bn}from"./useTheme-ee-m4Hcs.js";import{a as xn,i as Sn,o as Cn,r as wn}from"./webhookCommands-BxPTN2Od.js";import{a as H,n as U,o as Tn,s as En,t as Dn}from"./searchable-select-BE62ykWr.js";import{t as On}from"./settings-header-button-BCTE-ScU.js";var kn={name:`antenna`,size:24,node:[[`path`,{d:`M2 12 7 2`,key:`117k30`}],[`path`,{d:`m7 12 5-10`,key:`1tvx22`}],[`path`,{d:`m12 12 5-10`,key:`ev1o1a`}],[`path`,{d:`m17 12 5-10`,key:`1e4ti3`}],[`path`,{d:`M4.5 7h15`,key:`vlsxkz`}],[`path`,{d:`M12 16v6`,key:`c8a4gj`}]]};kn.node;var An=k(kn),jn={name:`book-text`,size:24,node:[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M8 11h8`,key:`vwpz6n`}],[`path`,{d:`M8 7h6`,key:`1f0q6e`}]]};jn.node;var Mn=k(jn),Nn={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Nn.node;var Pn=k(Nn),Fn={name:`cloud-download`,size:24,node:[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]],aliases:[`download-cloud`]};Fn.node;var In=k(Fn),Ln={name:`command`,size:24,node:[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]};Ln.node;var Rn=k(Ln),zn={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};zn.node;var Bn=k(zn),Vn={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};Vn.node;var Hn=k(Vn),Un={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Un.node;var Wn=k(Un),Gn={name:`message-square-quote`,size:24,node:[[`path`,{d:`M14 14a2 2 0 0 0 2-2V8h-2`,key:`1r06pg`}],[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M8 14a2 2 0 0 0 2-2V8H8`,key:`1jzu5j`}]]};Gn.node;var Kn=k(Gn),qn={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};qn.node;var Jn=k(qn),Yn={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};Yn.node;var Xn=k(Yn),Zn={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Zn.node;var Qn=k(Zn),$n={name:`power-off`,size:24,node:[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};$n.node;var er=k($n),tr={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};tr.node;var nr=k(tr),rr={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};rr.node;var ir=k(rr),ar={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};ar.node;var or=k(ar),sr={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};sr.node;var cr=k(sr),lr=`gpt-5.4-mini`;function ur(e){return e===`previous-assistant-reply`||e===`full-transcript`}function dr(e){return e===`auto`||e===`manual`}var fr={enabled:!1,cloudflaredPath:`cloudflared`,mode:`always-ask`},W=e(t(),1),G=e(i(),1);function pr(e){let t=e.trim();if(t.startsWith(`https://`))try{let e=new URL(t);if(e.protocol!==`https:`)return!1;let n=e.hostname.toLowerCase();return!(n===`localhost`||!n.includes(`.`)||n.startsWith(`.`)||n.endsWith(`.`))}catch{return!1}if(t.startsWith(`mailto:`)){let e=t.slice(7),n=/^[^\s@]+@([^\s@]+)$/.exec(e);if(!n)return!1;let r=n[1].toLowerCase();return!(r===`localhost`||!r.includes(`.`)||r.startsWith(`.`)||r.endsWith(`.`))}return!1}var mr={maxFileSizeMb:2048},hr=51200,gr=[`app_launch`,`project_opened`,`project_created`,`project_removed`,`project_deleted`,`chat_created`,`chat_deleted`,`message_sent`,`update_checked`,`update_installed`,`update_failed`,`analytics_enabled`,`analytics_disabled`],_r=[`current_version`,`environment`,`latest_version`,`custom_port_enabled`,`no_open_enabled`,`password_enabled`,`strict_port_enabled`,`remote_enabled`,`host_enabled`,`share_quick_enabled`,`share_token_enabled`];function vr(){return{name:``,provider:`claude`,model:At(`claude`).defaultModel,modelOptions:{...Ft},systemPrompt:``,contextScope:`previous-assistant-reply`,triggerMode:`auto`}}function yr(){return{draft:vr(),error:null,pending:!1,confirmDelete:!1}}var br=w()(e=>({editing:{kind:`list`},form:yr(),timeoutDraft:``,loopError:null,setEditing:t=>e({editing:t}),resetForm:t=>e({form:{draft:t,error:null,pending:!1,confirmDelete:!1}}),patchForm:t=>e(e=>({form:{...e.form,...t}})),patchFormDraft:t=>e(e=>({form:{...e.form,draft:{...e.form.draft,...t}}})),setTimeoutDraft:t=>e({timeoutDraft:t}),setLoopError:t=>e({loopError:t})}));function K(e){return(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.label}),e.children,e.hint?(0,G.jsx)(`span`,{className:D(`text-xs`,e.hintTone===`destructive`?`text-destructive`:`text-muted-foreground`),children:e.hint}):null]})}function xr(e){let{draft:t,patchDraft:n}=e;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{label:`Working directory`,hint:`Optional. Relative to the parent chat cwd. Restricts the subagent's filesystem access to this subtree.`,children:(0,G.jsx)(R,{"data-testid":`subagent-form-working-dir`,value:t.workingDir??``,onChange:e=>{let t=e.target.value;n({workingDir:t.length>0?t:void 0})},placeholder:`docs`})}),(0,G.jsx)(K,{label:`Allowed paths`,hint:`Optional. Newline-separated, relative to the parent chat cwd. When set, file tools can only read/write inside these roots.`,children:(0,G.jsx)(ln,{"data-testid":`subagent-form-allowed-paths`,value:(t.allowedPaths??[]).join(`
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{l as n,u as r}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{B as a,Ct as o,D as s,Ft as c,It as l,Lt as u,M as d,Nt as f,T as p,b as m,bt as h,d as g,f as _,ft as v,j as y,k as b,l as x,n as ee,o as te,u as ne,vt as S,wt as re,x as C,xt as ie}from"./useAppGlobalState-C6_aikPC.js";import{a as ae,c as w,d as oe,f as T,p as se,s as ce}from"./log-3sQ-5rrS.js";import{a as E,c as D,d as O,f as k,n as A,o as j,r as M,s as N,t as P}from"./pendingActionsStore-C9wopHr4.js";import{C as le,S as ue,_ as de,a as fe,b as pe,d as me,g as he,h as ge,i as _e,m as ve,n as ye,t as be,v as xe,y as Se}from"./copyFeedbackStore-BW6Vjufv.js";import{t as Ce,zt as we}from"./lexicalToReact-CkI42EHr.js";import{n as Te,r as Ee,t as De}from"./clipboard.adapter-BCxT7Qli.js";import{t as Oe}from"./chevron-down-Coo9PgPJ.js";import{a as ke,i as F,n as Ae,o as je,r as Me,t as Ne}from"./select-BKHnGLKS.js";import{t as Pe}from"./external-link-9xEpmM2n.js";import{t as Fe}from"./info-BMdKmB36.js";import{t as Ie}from"./monitor-_V-BjQpD.js";import{t as Le}from"./pencil-BTeN1rO_.js";import{t as Re}from"./plus-D0uUa5kJ.js";import{n as ze,t as Be}from"./search-48C1GM_8.js";import{a as Ve,g as He,i as Ue,l as We,n as I,r as Ge,u as Ke}from"./webhooksStore-DmkDHteX.js";import{g as qe,i as Je,n as Ye,o as Xe,r as Ze,t as Qe,u as $e}from"./timer.adapter-Di4tkt37.js";import{a as et,c as tt,o as nt,s as rt,t as L}from"./segmented-control-DbmDSdKy.js";import{t as R}from"./input-CS1DBeNV.js";import{C as it,S as at,_ as z,a as ot,c as st,d as ct,f as lt,g as ut,h as dt,i as ft,l as pt,m as mt,n as ht,o as gt,p as _t,r as vt,s as yt,t as bt,u as xt,x as St,y as Ct}from"./appSettingsStore-CDBkjKuH.js";import{t as wt}from"./runDetached-BBRv1zoc.js";import{t as Tt}from"./chatSounds-Cjf1Ow1m.js";import{c as Et,l as Dt,o as Ot,r as kt}from"./contextWindow-I-trSDu4.js";import{C as At,D as jt,E as Mt,O as Nt,T as Pt,_ as Ft,a as It,b as Lt,c as Rt,d as zt,f as Bt,g as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt,v as $t,w as B,x as en,y as tn}from"./types-C-hQn4rL.js";import{c as nn,h as rn,i as an,m as on,n as sn,o as cn,p as ln,r as un,s as dn,u as fn}from"./KannaSocketProvider-Clv949La.js";import{r as pn}from"./formatters-BGORekd-.js";import{n as V,t as mn}from"./formatDuration-BbWTR_M_.js";import{n as hn}from"./state-mark-DNAt8L4c.js";import{n as gn,r as _n,t as vn}from"./popover-CA332KD1.js";import{n as yn}from"./cronJobsStore-CndqKrjB.js";import{r as bn}from"./useTheme-V_0ZRiiP.js";import{a as xn,i as Sn,o as Cn,r as wn}from"./webhookCommands-ClSc7rRQ.js";import{a as H,n as U,o as Tn,s as En,t as Dn}from"./searchable-select-C2LG0o1C.js";import{t as On}from"./settings-header-button-D4w0LZ-R.js";var kn={name:`antenna`,size:24,node:[[`path`,{d:`M2 12 7 2`,key:`117k30`}],[`path`,{d:`m7 12 5-10`,key:`1tvx22`}],[`path`,{d:`m12 12 5-10`,key:`ev1o1a`}],[`path`,{d:`m17 12 5-10`,key:`1e4ti3`}],[`path`,{d:`M4.5 7h15`,key:`vlsxkz`}],[`path`,{d:`M12 16v6`,key:`c8a4gj`}]]};kn.node;var An=k(kn),jn={name:`book-text`,size:24,node:[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M8 11h8`,key:`vwpz6n`}],[`path`,{d:`M8 7h6`,key:`1f0q6e`}]]};jn.node;var Mn=k(jn),Nn={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Nn.node;var Pn=k(Nn),Fn={name:`cloud-download`,size:24,node:[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]],aliases:[`download-cloud`]};Fn.node;var In=k(Fn),Ln={name:`command`,size:24,node:[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]};Ln.node;var Rn=k(Ln),zn={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};zn.node;var Bn=k(zn),Vn={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};Vn.node;var Hn=k(Vn),Un={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Un.node;var Wn=k(Un),Gn={name:`message-square-quote`,size:24,node:[[`path`,{d:`M14 14a2 2 0 0 0 2-2V8h-2`,key:`1r06pg`}],[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M8 14a2 2 0 0 0 2-2V8H8`,key:`1jzu5j`}]]};Gn.node;var Kn=k(Gn),qn={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};qn.node;var Jn=k(qn),Yn={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};Yn.node;var Xn=k(Yn),Zn={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Zn.node;var Qn=k(Zn),$n={name:`power-off`,size:24,node:[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};$n.node;var er=k($n),tr={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};tr.node;var nr=k(tr),rr={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};rr.node;var ir=k(rr),ar={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};ar.node;var or=k(ar),sr={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};sr.node;var cr=k(sr),lr=`gpt-5.4-mini`;function ur(e){return e===`previous-assistant-reply`||e===`full-transcript`}function dr(e){return e===`auto`||e===`manual`}var fr={enabled:!1,cloudflaredPath:`cloudflared`,mode:`always-ask`},W=e(t(),1),G=e(i(),1);function pr(e){let t=e.trim();if(t.startsWith(`https://`))try{let e=new URL(t);if(e.protocol!==`https:`)return!1;let n=e.hostname.toLowerCase();return!(n===`localhost`||!n.includes(`.`)||n.startsWith(`.`)||n.endsWith(`.`))}catch{return!1}if(t.startsWith(`mailto:`)){let e=t.slice(7),n=/^[^\s@]+@([^\s@]+)$/.exec(e);if(!n)return!1;let r=n[1].toLowerCase();return!(r===`localhost`||!r.includes(`.`)||r.startsWith(`.`)||r.endsWith(`.`))}return!1}var mr={maxFileSizeMb:2048},hr=51200,gr=[`app_launch`,`project_opened`,`project_created`,`project_removed`,`project_deleted`,`chat_created`,`chat_deleted`,`message_sent`,`update_checked`,`update_installed`,`update_failed`,`analytics_enabled`,`analytics_disabled`],_r=[`current_version`,`environment`,`latest_version`,`custom_port_enabled`,`no_open_enabled`,`password_enabled`,`strict_port_enabled`,`remote_enabled`,`host_enabled`,`share_quick_enabled`,`share_token_enabled`];function vr(){return{name:``,provider:`claude`,model:At(`claude`).defaultModel,modelOptions:{...Ft},systemPrompt:``,contextScope:`previous-assistant-reply`,triggerMode:`auto`}}function yr(){return{draft:vr(),error:null,pending:!1,confirmDelete:!1}}var br=w()(e=>({editing:{kind:`list`},form:yr(),timeoutDraft:``,loopError:null,setEditing:t=>e({editing:t}),resetForm:t=>e({form:{draft:t,error:null,pending:!1,confirmDelete:!1}}),patchForm:t=>e(e=>({form:{...e.form,...t}})),patchFormDraft:t=>e(e=>({form:{...e.form,draft:{...e.form.draft,...t}}})),setTimeoutDraft:t=>e({timeoutDraft:t}),setLoopError:t=>e({loopError:t})}));function K(e){return(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.label}),e.children,e.hint?(0,G.jsx)(`span`,{className:D(`text-xs`,e.hintTone===`destructive`?`text-destructive`:`text-muted-foreground`),children:e.hint}):null]})}function xr(e){let{draft:t,patchDraft:n}=e;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{label:`Working directory`,hint:`Optional. Relative to the parent chat cwd. Restricts the subagent's filesystem access to this subtree.`,children:(0,G.jsx)(R,{"data-testid":`subagent-form-working-dir`,value:t.workingDir??``,onChange:e=>{let t=e.target.value;n({workingDir:t.length>0?t:void 0})},placeholder:`docs`})}),(0,G.jsx)(K,{label:`Allowed paths`,hint:`Optional. Newline-separated, relative to the parent chat cwd. When set, file tools can only read/write inside these roots.`,children:(0,G.jsx)(ln,{"data-testid":`subagent-form-allowed-paths`,value:(t.allowedPaths??[]).join(`
|
|
2
2
|
`),onChange:e=>{let t=e.target.value.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);n({allowedPaths:t.length>0?t:void 0})},placeholder:`docs
|
|
3
3
|
wiki`,rows:3})}),(0,G.jsx)(K,{label:`Beacon tools`,hint:`Off by default. When on, this subagent can run commands and read files on your paired machines. Each call still asks for your approval.`,children:(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-foreground`,children:[(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`subagent-form-allow-beacon-tools`,checked:t.allowBeaconTools===!0,onChange:e=>{n({allowBeaconTools:e.target.checked})}}),(0,G.jsx)(`span`,{children:`Allow this subagent to use beacon tools (run on your paired machines)`})]})})]})}function Sr(e){return`contextWindow`in e}function Cr(e){return`fastMode`in e}function wr(e){let t=e.editing,n=(0,W.useMemo)(()=>t.kind===`edit`?e.subagents.find(e=>e.id===t.id)??null:null,[t,e.subagents]),r=t.kind,i=r!==`list`,a=e.subagents.length===0;return a&&!i?(0,G.jsx)(Tr,{onStartCreate:e.onStartCreate}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row md:items-start md:gap-8`,children:[a?null:(0,G.jsx)(Dr,{subagents:e.subagents,editing:e.editing,onSelect:e.onSelect,onStartCreate:e.onStartCreate}),i?(0,G.jsx)(Pr,{mode:r,subject:r===`edit`?n:null,providerDefaults:e.providerDefaults,availableProviders:e.availableProviders,handlers:e.handlers,onCancelEditing:e.onCancelEditing},r===`edit`?n?.id??`edit`:`create`):(0,G.jsx)(Er,{})]})}function Tr(e){return(0,G.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-4 rounded-lg border border-dashed border-border px-6 py-14 text-center`,"data-testid":`subagent-empty`,children:[(0,G.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:(0,G.jsx)(le,{className:`size-5`,"aria-hidden":!0})}),(0,G.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`No subagents yet`}),(0,G.jsxs)(E,{variant:`default`,size:`sm`,onClick:e.onStartCreate,children:[(0,G.jsx)(Re,{className:`mr-1.5 size-4`}),` Create subagent`]})]})}function Er(){return(0,G.jsx)(`div`,{className:`hidden flex-1 items-center justify-center rounded-lg border border-dashed border-border px-6 py-12 text-center text-sm text-muted-foreground md:flex`,children:`Select a subagent to edit, or create a new one.`})}function Dr(e){let t=e.editing.kind===`edit`?e.editing.id:null;return(0,G.jsxs)(`aside`,{className:`flex w-full flex-col gap-2 md:w-64 md:flex-shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,style:{fontVariantNumeric:`tabular-nums`},children:[e.subagents.length,` `,e.subagents.length===1?`agent`:`agents`]}),(0,G.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:e.onStartCreate,"data-testid":`subagent-create`,children:[(0,G.jsx)(Re,{className:`size-4`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Create subagent`})]})]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.subagents.map(n=>{let r=n.description?.trim()||(n.contextScope===`previous-assistant-reply`?`Last reply`:`Full transcript`);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-testid":`subagent-row:${n.id}`,onClick:()=>e.onSelect(n.id),className:D(`flex w-full flex-col items-start gap-0.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted`,t===n.id&&`bg-muted`),children:[(0,G.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:n.name}),(0,G.jsx)(Or,{provider:n.provider})]}),(0,G.jsx)(`span`,{className:`w-full truncate text-xs text-muted-foreground`,children:r})]})},n.id)})})]})}function Or({provider:e}){let t=At(e).label;return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:[(0,G.jsx)(le,{className:`size-3`}),` `,t]})}var kr=[{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`},{value:`openrouter`,label:`OpenRouter`}],Ar=[...kr,{value:`custom`,label:`Custom endpoints`}];function jr(e,t){return t.length===0?e:e.map(e=>e.id===`openrouter`?{...e,models:t.map(e=>({id:e.id,label:e.label}))}:e)}var Mr=[{value:`previous-assistant-reply`,label:`Last reply`},{value:`full-transcript`,label:`Full transcript`}],Nr=[{value:`auto`,label:`Auto`},{value:`manual`,label:`Manual`}];function Pr(e){let t=(0,W.useMemo)(()=>e.mode===`edit`&&e.subject?Gr(e.subject):Wr(`claude`,e.providerDefaults,e.availableProviders),[e.mode,e.subject,e.providerDefaults,e.availableProviders]),n=br(e=>e.resetForm),r=br(e=>e.form),i=br(e=>e.patchFormDraft),a=br(e=>e.patchForm);(0,W.useEffect)(()=>{n(t)},[]);let{draft:o,error:s,pending:c,confirmDelete:l}=r,u=o.provider===`custom`||e.availableProviders.some(e=>e.id===`custom`)?Ar:kr,d=s?.field===`name`?s.message:null,f=s?.field===`general`?s.message:null,p=qr(o,t),m=o.name.trim().length>0&&(e.mode===`create`||p);function h(e){i(e),s?.field===`name`&&`name`in e&&a({error:null})}function g(t){if(t===o.provider)return;let n=Wr(t,e.providerDefaults,e.availableProviders);i({provider:t,model:n.model,modelOptions:n.modelOptions})}function _(e){if(o.provider!==`claude`)return;let t=Sr(o.modelOptions)?o.modelOptions:Ft;i({modelOptions:{...Ft,...t,reasoningEffort:e}})}function v(e){if(o.provider!==`claude`)return;let t=Sr(o.modelOptions)?o.modelOptions:Ft;i({modelOptions:{...Ft,...t,contextWindow:e}})}function y(e){if(o.provider!==`codex`)return;let t=Cr(o.modelOptions)?o.modelOptions:$t;i({modelOptions:{...$t,...t,reasoningEffort:e}})}async function b(){if(m&&!c){a({pending:!0,error:null,confirmDelete:!1});try{let t=e.mode===`create`?await e.handlers.onCreate(o):await e.handlers.onUpdate(e.subject.id,o);t.ok||a({error:Yr(t.error)})}catch(e){a({error:{field:`general`,message:T(e)}})}finally{a({pending:!1})}}}async function x(){if(e.mode===`edit`&&e.subject){if(!l){a({confirmDelete:!0});return}a({pending:!0,error:null});try{await e.handlers.onDelete(e.subject.id)}catch(e){a({error:{field:`general`,message:T(e)}})}finally{a({pending:!1,confirmDelete:!1})}}}let ee=o.provider===`claude`?{...Ft,...Sr(o.modelOptions)?o.modelOptions:{}}:null,te=o.provider===`codex`?{...$t,...Cr(o.modelOptions)?o.modelOptions:{}}:null,ne=e.availableProviders.find(e=>e.id===o.provider)??At(o.provider);return(0,G.jsxs)(`section`,{className:`flex w-full flex-1 flex-col gap-4`,children:[(0,G.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`h3`,{className:`text-base font-medium text-foreground`,children:e.mode===`create`?`New subagent`:o.name||`Subagent`}),(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Mention with `,(0,G.jsxs)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`,children:[`@agent/`,o.name||`<name>`]}),` in chat.`]})]}),f?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive`,children:f}):null,(0,G.jsx)(K,{label:`Name`,hint:d,hintTone:d?`destructive`:`muted`,children:(0,G.jsx)(R,{"data-testid":`subagent-form-name`,value:o.name,onChange:e=>h({name:Xr(e.target.value)}),maxLength:64,placeholder:`reviewer`,className:`font-mono`})}),(0,G.jsx)(K,{label:`Description`,hint:`Optional. Shown next to the name.`,children:(0,G.jsx)(R,{"data-testid":`subagent-form-description`,value:o.description??``,onChange:e=>h({description:e.target.value}),placeholder:`Reviews diffs against the repo style`})}),(0,G.jsx)(K,{label:`Provider`,children:(0,G.jsx)(L,{value:o.provider,onValueChange:e=>{Zt(e)&&g(e)},options:u,size:`sm`})}),(0,G.jsx)(K,{label:`Model`,children:(0,G.jsxs)(Ne,{value:o.model,onValueChange:e=>h({model:e}),children:[(0,G.jsx)(ke,{"data-testid":`subagent-form-model`,className:`w-full md:w-72`,children:(0,G.jsx)(je,{placeholder:`Select a model`})}),(0,G.jsx)(Ae,{children:ne.models.map(e=>(0,G.jsx)(F,{value:e.id,children:e.label},e.id))})]})}),ee?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{label:`Reasoning effort`,children:(0,G.jsx)(L,{value:ee.reasoningEffort,onValueChange:e=>{Pt(e)&&_(e)},options:Ht.map(e=>({value:e.id,label:e.label})),size:`sm`})}),(0,G.jsx)(K,{label:`Context window`,children:(0,G.jsx)(L,{value:ee.contextWindow,onValueChange:e=>{B(e)&&v(e)},options:Gt.map(e=>({value:e.id,label:e.label})),size:`sm`})})]}):null,te?(0,G.jsx)(K,{label:`Reasoning effort`,children:(0,G.jsx)(L,{value:te.reasoningEffort,onValueChange:e=>{Mt(e)&&y(e)},options:Vt.map(e=>({value:e.id,label:e.label})),size:`sm`})}):null,(0,G.jsx)(K,{label:`Context scope`,children:(0,G.jsx)(L,{value:o.contextScope,onValueChange:e=>{ur(e)&&h({contextScope:e})},options:Mr,size:`sm`})}),(0,G.jsx)(K,{label:`Trigger`,hint:`Auto: the main agent may delegate on its own. Manual: only runs when you @-mention it.`,children:(0,G.jsx)(L,{value:o.triggerMode??`auto`,onValueChange:e=>{dr(e)&&h({triggerMode:e})},options:Nr,size:`sm`})}),(0,G.jsx)(K,{label:`System prompt`,hint:`What this persona should focus on. Plain text.`,children:(0,G.jsx)(ln,{"data-testid":`subagent-form-system-prompt`,value:o.systemPrompt,onChange:e=>h({systemPrompt:e.target.value}),placeholder:`You are a careful code reviewer...`,rows:6,className:`min-h-32`})}),(0,G.jsx)(K,{label:`Max turns`,hint:`Optional. Caps the agentic turns per run (like Claude Code's per-agent maxTurns). Empty = unbounded. Claude SDK runs stop gracefully at the limit; Codex runs are aborted.`,children:(0,G.jsx)(R,{"data-testid":`subagent-form-max-turns`,type:`number`,min:1,step:1,value:o.maxTurns?.toString()??``,onChange:e=>{let t=Number.parseInt(e.target.value,10);h({maxTurns:Number.isInteger(t)&&t>0?t:void 0})},placeholder:`unbounded`,className:`w-36`})}),o.provider===`claude`?(0,G.jsx)(xr,{draft:o,patchDraft:h}):null,(0,G.jsxs)(`footer`,{className:`flex flex-wrap items-center justify-end gap-2 pt-2`,children:[(0,G.jsx)(E,{variant:`ghost`,size:`sm`,onClick:e.onCancelEditing,children:`Cancel`}),e.mode===`edit`?(0,G.jsx)(E,{variant:`destructive`,size:`sm`,"data-testid":`subagent-form-delete`,disabled:c,pending:c&&l,onClick:()=>{A(P(`subagent.delete`,e.subject?.id??``),x)},children:l?`Confirm delete`:`Delete`}):null,(0,G.jsx)(E,{variant:`default`,size:`sm`,"data-testid":`subagent-form-save`,disabled:!m||c,pending:c&&!l,onClick:()=>{A(P(`subagent.save`,e.subject?.id??`new`),b)},children:c?`Saving…`:`Save`})]})]})}var Fr=[],Ir={claude:{model:At(`claude`).defaultModel,modelOptions:{...Ft},planMode:!1},codex:{model:At(`codex`).defaultModel,modelOptions:{...$t},planMode:!1},openrouter:{model:tn,modelOptions:{},planMode:!1},custom:{model:``,modelOptions:{},planMode:!1}};function Lr(e){let t=z(e=>e.settings?.subagents??Fr),n=z(e=>e.settings?.providerDefaults??Ir),r=z(ot),i=z(gt),a=m(Et(e=>e.models)),o=(0,W.useMemo)(()=>jr(Ve(Nt([...Lt],r),i),a),[r,i,a]),s=br(e=>e.editing),c=br(e=>e.setEditing),l=(0,W.useMemo)(()=>({onCreate:async t=>{let n=await e.state.socket.command({type:`subagent.create`,input:t});return n.ok&&c({kind:`edit`,id:n.subagent.id}),n},onUpdate:async(t,n)=>await e.state.socket.command({type:`subagent.update`,id:t,patch:{...n,maxTurns:n.maxTurns??null}}),onDelete:async t=>{await e.state.socket.command({type:`subagent.delete`,id:t}),c({kind:`list`})}}),[e.state.socket,c]),u=(0,W.useCallback)(e=>{c({kind:`edit`,id:e})},[c]),d=(0,W.useCallback)(()=>{c({kind:`create`})},[c]),f=(0,W.useCallback)(()=>{c({kind:`list`})},[c]);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-6 px-6 py-6`,children:[(0,G.jsx)(Hr,{subagents:t,handleWriteAppSettings:e.state.handleWriteAppSettings}),(0,G.jsx)(wr,{subagents:t,providerDefaults:n,availableProviders:o,editing:s,onSelect:u,onStartCreate:d,onCancelEditing:f,handlers:l})]})}var Rr=`__none__`,zr=30,Br=86400,Vr=600;function Hr(e){let t=z(e=>e.settings?.subagentRuntime),n=t?Math.round(t.runTimeoutMs/1e3):Vr,r=t?.defaultLoopSubagentId??null,i=br(e=>e.timeoutDraft),a=br(e=>e.setTimeoutDraft),o=br(e=>e.loopError),s=br(e=>e.setLoopError);(0,W.useEffect)(()=>{a(String(n))},[n]);function c(){let t=Number(i);if(!Number.isInteger(t)||t<zr||t>Br){a(String(n)),s(`Timeout must be a whole number of seconds between ${zr} and ${Br}.`);return}s(null),t!==n&&e.handleWriteAppSettings({subagentRuntime:{runTimeoutMs:t*1e3}}).catch(e=>s(e instanceof Error?e.message:`Unable to save subagent runtime settings.`))}function l(t){s(null);let n=t===Rr?null:t;e.handleWriteAppSettings({subagentRuntime:{defaultLoopSubagentId:n}}).catch(e=>s(e instanceof Error?e.message:`Unable to save default loop subagent.`))}return(0,G.jsxs)(`section`,{className:`flex flex-col gap-4 rounded-lg border border-border/60 bg-card/40 p-4`,children:[(0,G.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Loop & runtime`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Applies to background subagent runs and the autonomous `,(0,G.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono`,children:`/loop`}),`.`]})]}),o?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:o}):null,(0,G.jsx)(K,{label:`Stall timeout (seconds)`,hint:`A subagent run is aborted only after this long with no streamed activity — not a total wall-clock cap. A steadily-working run is never killed.`,children:(0,G.jsx)(R,{type:`number`,inputMode:`numeric`,min:zr,max:Br,value:i,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&(c(),e.currentTarget.blur())},className:`w-full md:w-48 tabular-nums`})}),(0,G.jsx)(K,{label:`Default loop subagent`,hint:`The subagent setup_loop delegates each chunk to when no explicit id is given.`,children:(0,G.jsxs)(Ne,{value:r??Rr,onValueChange:l,children:[(0,G.jsx)(ke,{className:`w-full md:w-72`,children:(0,G.jsx)(je,{placeholder:`None`})}),(0,G.jsxs)(Ae,{children:[(0,G.jsx)(F,{value:Rr,children:`None (require explicit id)`}),e.subagents.map(e=>(0,G.jsx)(F,{value:e.id,children:e.name},e.id))]})]})})]})}var Ur=new Set([`EMPTY_NAME`,`INVALID_CHAR`,`RESERVED_NAME`,`DUPLICATE_NAME`,`TOO_LONG`]);function Wr(e,t,n){if(e===`claude`){let r=t?.claude;return{name:``,provider:e,model:r?.model??n?.find(e=>e.id===`claude`)?.defaultModel??At(`claude`).defaultModel,modelOptions:{...r?.modelOptions??{...Ft}},systemPrompt:``,contextScope:`previous-assistant-reply`,triggerMode:`auto`}}if(jt(e))return{name:``,provider:e,model:t?.[e]?.model||n?.find(t=>t.id===e)?.defaultModel||At(e).defaultModel,modelOptions:{},systemPrompt:``,contextScope:`previous-assistant-reply`,triggerMode:`auto`};let r=t?.codex;return{name:``,provider:e,model:r?.model??n?.find(e=>e.id===`codex`)?.defaultModel??At(`codex`).defaultModel,modelOptions:{...r?.modelOptions??{...$t}},systemPrompt:``,contextScope:`previous-assistant-reply`,triggerMode:`auto`}}function Gr(e){return{name:e.name,description:e.description,provider:e.provider,model:e.model,modelOptions:e.modelOptions,systemPrompt:e.systemPrompt,contextScope:e.contextScope,triggerMode:e.triggerMode,workingDir:e.workingDir,allowedPaths:e.allowedPaths,maxTurns:e.maxTurns,allowBeaconTools:e.allowBeaconTools}}var Kr=(e,t)=>{if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};function qr(e,t){return e.name!==t.name||(e.description??``)!==(t.description??``)||e.provider!==t.provider||e.model!==t.model||e.systemPrompt!==t.systemPrompt||e.contextScope!==t.contextScope||(e.triggerMode??`auto`)!==(t.triggerMode??`auto`)||(e.workingDir??``)!==(t.workingDir??``)||!Kr(e.allowedPaths,t.allowedPaths)||(e.maxTurns??null)!==(t.maxTurns??null)||(e.allowBeaconTools??!1)!==(t.allowBeaconTools??!1)||!Jr(e.modelOptions,t.modelOptions)}function Jr(e,t){if(!se(e)||!se(t))return!1;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n)if(e[r]!==t[r])return!1;return!0}function Yr(e){return Ur.has(e.code)?{field:`name`,message:e.message}:{field:`general`,message:e.message}}function Xr(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).slice(0,64)}function q({title:e,description:t,children:n,bordered:r=!0,alignStart:i=!1}){return(0,G.jsx)(`div`,{className:r?`border-t border-border`:void 0,children:(0,G.jsxs)(`div`,{className:D(`flex flex-col gap-4 py-5 md:flex-row md:justify-between md:gap-8`,i?`md:items-start`:`md:items-center`),children:[(0,G.jsxs)(`div`,{className:`min-w-0 max-w-xl`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-13 text-muted-foreground`,children:t})]}),(0,G.jsx)(`div`,{className:`flex items-center justify-start md:shrink-0 md:justify-end`,children:n})]})})}function Zr({icon:e,message:t}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-md border border-dashed px-6 py-10 text-center`,children:[(0,G.jsx)(e,{className:`mb-3 h-8 w-8 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Qr({children:e}){return(0,G.jsx)(`ul`,{className:`flex flex-col divide-y rounded-md border`,children:e})}function $r({label:e,onEdit:t,onDelete:n,deletePending:r=!1}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(E,{variant:`ghost`,size:`sm`,onClick:t,"aria-label":`Edit ${e}`,children:(0,G.jsx)(Le,{className:`h-4 w-4`})}),(0,G.jsx)(E,{variant:`ghost`,size:`sm`,onClick:n,pending:r,"aria-label":`Delete ${e}`,children:(0,G.jsx)(He,{className:`h-4 w-4`})})]})}var ei=new Set;function ti(e){return{name:e?.name??``,transport:e?.transport??`stdio`,command:e?.transport===`stdio`?e.command:``,argsText:e?.transport===`stdio`?e.args.join(`
|
|
4
4
|
`):``,envText:e?.transport===`stdio`?Object.entries(e.env).map(([e,t])=>`${e}=${t}`).join(`
|
package/dist/client/assets/{StackBoardsRoutePage-DQTwVdgd.js → StackBoardsRoutePage-BX-fo655.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{l as n,u as r}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{t as a}from"./BoardsPage-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{l as n,u as r}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{t as a}from"./BoardsPage-mm_dy-6I.js";var o=e(t(),1),s=e(i(),1);function c({stackId:e}){let t=r(),i=n(),c=t.sidebarData.stacks.find(t=>t.id===e),l=c?c.title:`Stack`,u=(0,o.useCallback)(t=>{i(`/boards/stack/${e}/${t}`)},[i,e]);return(0,s.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,s.jsx)(a,{ownerKind:`stack`,ownerId:e,ownerName:l,socket:t.socket,onOpenBoard:u})})}export{c as StackBoardsRoutePage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{n}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,f as a,l as o,m as s,p as c,t as l,u}from"./log-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-eq8zrF0J.js";import{n}from"./chunk-OB3PAWPO-bMwGZcTr.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,f as a,l as o,m as s,p as c,t as l,u}from"./log-3sQ-5rrS.js";import{a as d,c as f,d as p,f as m}from"./pendingActionsStore-C9wopHr4.js";import{A as h,E as g,F as _,L as v,M as y,R as b,S as x,_ as S,a as C,b as w,c as T,d as E,g as D,k as ee,t as te,u as O,w as ne,x as re,y as ie}from"./FilePreviewSheet-iaBNZ_R0.js";import{r as ae}from"./terminal-DDMsYlkg.js";import{g as oe}from"./timer.adapter-Di4tkt37.js";import{t as k}from"./createScopedStore-D1trFyJw.js";import{x as se}from"./appSettingsStore-CDBkjKuH.js";import{c as ce,l as le,o as ue,r as de,s as fe}from"./contextWindow-I-trSDu4.js";import{n as pe,o as me}from"./formatters-BGORekd-.js";import{t as he}from"./formatDuration-BbWTR_M_.js";import{n as ge,r as _e}from"./tools-CeacgJBu.js";var A={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};A.node;var ve=m(A),j={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};j.node;var M=m(j),N={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};N.node;var ye=m(N),P={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};P.node;var F=m(P),I={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};I.node;var be=m(I);function xe(e){return e.kind===`tool`}function L(e){return new Date(e).toISOString()}function R(e){return{id:e._id,messageId:e.messageId,timestamp:L(e.createdAt),hidden:e.hidden}}var Se=`/.claude/plans/`;function Ce(e){return e.includes(Se)&&e.endsWith(`.md`)}function we(e,t){if(e.toolKind!==`exit_plan_mode`)return e.toolKind===`write_file`&&Ce(e.input.filePath)?e.input.content:t}function Te(e,t){return e.toolKind===`exit_plan_mode`&&!e.input.plan&&t?{...e.input,plan:t}:e.input}function Ee(e,t){return{id:e._id,messageId:e.messageId,hidden:e.hidden,kind:`tool`,toolKind:e.tool.toolKind,toolName:e.tool.toolName,toolId:e.tool.toolId,input:Te(e.tool,t),timestamp:L(e.createdAt)}}function De(e){if(!e.debugRaw)return;let t;try{t=JSON.parse(e.debugRaw).tool_use_result??void 0}catch{return}if(t!==void 0&&typeof t!=`number`&&typeof t!=`boolean`)return t}function z(e){return typeof e==`number`?e:void 0}function B(e){return typeof e==`string`?e:void 0}function Oe(e){if(e===void 0||!se(e))return;let t=e,n={readCount:z(t.readCount),searchCount:z(t.searchCount),bashCount:z(t.bashCount),editFileCount:z(t.editFileCount),linesAdded:z(t.linesAdded),linesRemoved:z(t.linesRemoved),otherToolCount:z(t.otherToolCount)};return Object.values(n).some(e=>e!==void 0)?n:void 0}function ke(e){if(!e.debugRaw)return;let t;try{t=JSON.parse(e.debugRaw).toolUseResult}catch{return}if(t===void 0||!se(t))return;let n=t,r={agentId:B(n.agentId),agentType:B(n.agentType),status:B(n.status),totalTokens:z(n.totalTokens),totalDurationMs:z(n.totalDurationMs),totalToolUseCount:z(n.totalToolUseCount),toolStats:Oe(n.toolStats),content:B(n.content)};return r.agentId!==void 0||r.agentType!==void 0||r.totalTokens!==void 0||r.totalDurationMs!==void 0||r.status!==void 0?r:void 0}function V(e){let t=new Map,n=[],r;for(let i of e)switch(i.kind){case`user_prompt`:n.push({...R(i),kind:`user_prompt`,content:i.content,attachments:i.attachments??[],steered:i.steered,autoContinue:i.autoContinue,expandedCommand:i.expandedCommand,origin:i.origin});break;case`system_init`:n.push({...R(i),kind:`system_init`,provider:i.provider,model:i.model,tools:i.tools,agents:i.agents,slashCommands:i.slashCommands,mcpServers:i.mcpServers,debugRaw:i.debugRaw});break;case`account_info`:n.push({...R(i),kind:`account_info`,accountInfo:i.accountInfo});break;case`assistant_text`:n.push({...R(i),kind:`assistant_text`,text:i.text});break;case`assistant_thinking`:n.push({...R(i),kind:`assistant_thinking`,text:i.text,signature:i.signature});break;case`api_error`:n.push({...R(i),kind:`api_error`,status:i.status,text:i.text,requestId:i.requestId,apiErrorReason:i.apiErrorReason});break;case`policy_refusal`:n.push({...R(i),kind:`policy_refusal`,text:i.text,requestId:i.requestId});break;case`tool_call`:{let e=Ee(i,r);r=we(i.tool,r),t.set(i.tool.toolId,{hydrated:e,normalized:i.tool}),xe(e)&&n.push(e);break}case`tool_result`:{let e=t.get(i.toolId);if(e){let t=ge.has(e.normalized.toolKind)?De(i)??i.content:i.content;e.normalized.toolKind===`subagent_task`?e.hydrated.result=ke(i):e.hydrated.result=_e(e.normalized,le(t)),e.hydrated.rawResult=t,e.hydrated.isError=i.isError,i.persisted&&(e.hydrated.persisted=i.persisted)}break}case`result`:n.push({...R(i),kind:`result`,success:!i.isError,cancelled:i.subtype===`cancelled`,result:i.result,durationMs:i.durationMs,costUsd:i.costUsd,codexErrorInfo:i.codexErrorInfo});break;case`status`:n.push({...R(i),kind:`status`,status:i.status});break;case`context_window_updated`:n.push({...R(i),kind:`context_window_updated`,usage:i.usage});break;case`compact_boundary`:n.push({...R(i),kind:`compact_boundary`});break;case`compact_summary`:n.push({...R(i),kind:`compact_summary`,summary:i.summary});break;case`context_cleared`:n.push({...R(i),kind:`context_cleared`});break;case`interrupted`:n.push({...R(i),kind:`interrupted`});break;case`memory_loaded`:n.push({...R(i),kind:`memory_loaded`,path:i.path});break;case`auto_continue_prompt`:n.push({...R(i),kind:`auto_continue_prompt`,scheduleId:i.scheduleId});break;case`pending_tool_request`:n.push({...R(i),kind:`pending_tool_request`,toolRequestId:i.toolRequestId,toolName:i.toolName,arguments:i.arguments});break;case`tool_request_resolved`:break;case`cron_armed`:n.push({...R(i),kind:`cron_armed`,jobId:i.jobId,instruction:i.instruction,mode:i.mode,scheduleText:i.scheduleText,scheduleHuman:i.scheduleHuman,nextFireAt:i.nextFireAt,...i.model===void 0?{}:{model:i.model},...i.upcomingFires===void 0?{}:{upcomingFires:i.upcomingFires},...i.cwd===void 0?{}:{cwd:i.cwd}});break;case`cron_command_error`:n.push({...R(i),kind:`cron_command_error`,message:i.message,...i.input===void 0?{}:{input:i.input},...i.suggestion===void 0?{}:{suggestion:i.suggestion}});break;case`cron_run`:n.push({...R(i),kind:`cron_run`,jobId:i.jobId,runId:i.runId,instruction:i.instruction,...i.spawnedChatId===void 0?{}:{spawnedChatId:i.spawnedChatId},firedAt:i.firedAt});break;case`cron_run_skipped`:n.push({...R(i),kind:`cron_run_skipped`,jobId:i.jobId,reason:i.reason,...i.missedCount===void 0?{}:{missedCount:i.missedCount}});break;case`cron_list`:n.push({...R(i),kind:`cron_list`,...i.help===void 0?{}:{help:i.help}});break;case`cron_job_change`:n.push({...R(i),kind:`cron_job_change`,jobId:i.jobId,change:i.change});break;case`webhook_delivery`:n.push({...R(i),kind:`webhook_delivery`,hookId:i.hookId,hookName:i.hookName,mode:i.mode,deliveryId:i.deliveryId,...i.message===void 0?{}:{message:i.message}});break;case`inbound_delivery`:n.push({...R(i),kind:`inbound_delivery`,sourceKind:i.sourceKind,sourceId:i.sourceId,sourceName:i.sourceName,mode:i.mode,deliveryId:i.deliveryId,threadId:i.threadId,...i.message===void 0?{}:{message:i.message}});break;case`loop_disarmed`:n.push({...R(i),kind:`loop_disarmed`,reason:i.reason,resumable:i.resumable,...i.trackingFileRel===void 0?{}:{trackingFileRel:i.trackingFileRel},...i.workdirAbs===void 0?{}:{workdirAbs:i.workdirAbs}});break;default:n.push({...R(i),kind:`unknown`,json:JSON.stringify(i,null,2)})}return n}var H=e(t(),1),U=e(r(),1),W=(0,H.memo)(({message:e})=>(0,U.jsx)(`div`,{className:`text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-[70ch] space-y-4`,children:C(e.text)})),Ae=(0,H.memo)(({message:e})=>(0,U.jsx)(`div`,{className:`px-0.5 w-full max-w-[70ch]`,children:(0,U.jsx)(D,{content:e.text})})),G=({children:e,className:t,animate:n=!0,shimmerWidth:r,...i})=>(0,U.jsx)(`span`,{className:f(`mx-auto max-w-md text-foreground/60`,n&&`animate-shiny-pulse`,t),...i,children:e});function je(e){let t=e.split(`
|
|
2
2
|
`),n=/^\s*(\d+)→(.*)$/;return t.map(e=>{let t=e.match(n);return t?{lineNumber:parseInt(t[1],10),content:t[2]}:{lineNumber:null,content:e}})}function Me(e){return e.replace(/<[^>]+>/g,``)}function Ne(e,t){let n=e.split(`
|
|
3
3
|
`),r=t.split(`
|
|
4
4
|
`);return Ie(Fe(n,r,Pe(n,r)))}function Pe(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)i[a][n]=e[a-1]===t[n-1]?i[a-1][n-1]+1:Math.max(i[a-1][n],i[a][n-1]);return i}function Fe(e,t,n){let r=[],i=e.length,a=t.length;for(;i>0||a>0;)i>0&&a>0&&e[i-1]===t[a-1]?(r.push({type:`context`,text:e[i-1],oldIdx:i,newIdx:a}),i--,a--):a>0&&(i===0||n[i][a-1]>=n[i-1][a])?(r.push({type:`added`,text:t[a-1],oldIdx:i,newIdx:a}),a--):(r.push({type:`removed`,text:e[i-1],oldIdx:i,newIdx:a}),i--);return r.reverse()}function Ie(e){return e.map(e=>{let t;return t=e.type===`removed`?`-`:e.type===`added`?`+`:` `,{type:e.type,content:`${t}${e.text}`}})}function K({content:e,isDiff:t=!1,oldString:n,newString:r}){let i=(0,H.useMemo)(()=>t&&n!==void 0&&r!==void 0?Ne(n,r):[],[t,n,r]),a=(0,H.useMemo)(()=>t?[]:je(e),[e,t]),o=(0,H.useMemo)(()=>a.some(e=>e.lineNumber!==null),[a]);return t&&i.length>0?(0,U.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,U.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,U.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,U.jsx)(`tbody`,{children:i.map((e,t)=>{let n;n=e.type===`removed`?`bg-destructive/10 dark:bg-destructive/15`:e.type===`added`?`bg-success/10 dark:bg-success/15`:``;let r;r=e.type===`removed`?`text-destructive`:e.type===`added`?`text-success`:`text-foreground`;let i;i=e.type===`removed`?`text-destructive/50`:e.type===`added`?`text-success/50`:`text-muted-foreground/50`;let a;return a=e.type===`removed`?`-`:e.type===`added`?`+`:` `,(0,U.jsxs)(`tr`,{className:n,children:[(0,U.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${i}`,children:a}),(0,U.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all ${r}`,children:e.content.slice(1)})]},t)})})})})}):(0,U.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,U.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,U.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,U.jsx)(`tbody`,{children:a.map((e,t)=>(0,U.jsxs)(`tr`,{children:[o&&(0,U.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right`,children:e.lineNumber===null?``:e.lineNumber}),(0,U.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all text-foreground`,children:Me(e.content)})]},t))})})})})}var Le=new Map;function q(e,t){if(!t)return;let n=Le.get(e);return n===void 0?void 0:t(n)}function Re(e){return{state:e===void 0?`idle`:`ready`,data:e===void 0?null:e,error:null}}function ze(e){let{cacheKey:t,enabled:n,ref:r,fetcher:i,rootMargin:a,fromCache:c}=e,l=q(t,c),d=(0,H.useMemo)(()=>u(()=>Re(q(t,c))),[t,c]),f=o(d,e=>e.state),p=o(d,e=>e.data),m=o(d,e=>e.error),h=(0,H.useRef)(t),g=(0,H.useRef)(null),_=(0,H.useRef)(t);return(0,H.useEffect)(()=>{_.current=t},[t]),(0,H.useEffect)(()=>{h.current!==t&&(h.current=t,d.setState(Re(q(t,c))))},[t,c,d]),(0,H.useEffect)(()=>{if(!n||l!==void 0)return;let e=r.current;if(!e||typeof IntersectionObserver>`u`)return;let o=!1,c=t,u=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;if(u.disconnect(),o)return;let e=new AbortController;g.current=e,d.setState({state:`loading`}),i(e.signal).then(e=>{o||_.current!==c||(Le.set(c,e),d.setState({data:e,state:`ready`}))}).catch(s(t=>{o||e.signal.aborted||_.current!==c||d.setState({error:t,state:`error`})}));break}},{rootMargin:a??`200px`});return u.observe(e),()=>{o=!0,u.disconnect(),g.current?.abort(),g.current=null}},[l,t,n,r,i,a,d]),(0,H.useMemo)(()=>({state:f,data:p,error:m}),[f,p,m])}function Be(e){return typeof e==`string`?e:void 0}function Ve({source:e,onOpen:t,variant:n}){let r={id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``},i=_(r),a=b(i,e.mimeType),o=e.size&&e.size>0?ie(e.size):null;return i===`image`?(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`touch-manipulation overflow-hidden rounded-xl border border-border bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:(0,U.jsx)(`img`,{src:e.contentUrl,alt:e.altText??e.displayName,loading:`lazy`,className:`max-h-64 w-auto max-w-full object-contain`})}):n===`expanded`&&(i===`text`||i===`code`||i===`markdown`||i===`json`||i===`table`)?(0,U.jsx)(He,{source:e,onOpen:t,friendlyType:a,sizeLabel:o}):(0,U.jsx)(S,{attachment:r,onClick:t,meta:(0,U.jsxs)(U.Fragment,{children:[a,o?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null]}),ariaLabel:`Preview ${e.displayName}, ${a}${o?`, ${o}`:``}`})}var He=function({source:e,onOpen:t,friendlyType:n,sizeLabel:r}){let i=(0,H.useRef)(null),a=e.contentUrl,o=(0,H.useCallback)(async e=>{let t=await v(a,4096);if(e.aborted)throw Error(`aborted`);return t.content.slice(0,200)},[a]),s=ze({ref:i,enabled:!0,cacheKey:`snippet:${e.id}|${e.contentUrl}|${e.size??0}`,fetcher:o,fromCache:Be}),c=s.state===`ready`&&typeof s.data==`string`?s.data:``;return(0,U.jsxs)(`button`,{ref:i,type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`flex w-full max-w-md flex-col items-start gap-1 rounded-xl border border-border bg-background p-3 text-left hover:bg-accent/40`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.displayName}),(0,U.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n,r?` · ${r}`:``]}),c?(0,U.jsx)(`pre`,{className:`line-clamp-3 max-h-16 w-full whitespace-pre-wrap break-words text-xs text-muted-foreground`,children:c}):null]})},J=k(`ImageViewMessage`,()=>e=>({open:!1,setOpen:t=>e({open:t})}));function Ue({toolId:e,path:t,contentUrl:n,mimeType:r}){let i=J.useScopedStore(e=>e.open),a=J.useScopedStore(e=>e.setOpen),o=T(t);if(!n)return(0,U.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/20 px-3 py-2 text-sm text-muted-foreground`,children:t});let s={id:`image-view-${e}`,contentUrl:n,displayName:o,fileName:o,relativePath:t,mimeType:r,origin:`image_view`};return(0,U.jsxs)(`figure`,{className:`flex flex-col gap-2`,"data-testid":`image-view`,children:[(0,U.jsx)(Ve,{source:s,onOpen:()=>a(!0),variant:`expanded`}),(0,U.jsx)(te,{source:i?s:null,open:i,onOpenChange:a})]})}function We(e){return(0,U.jsx)(J.Provider,{init:void 0,children:(0,U.jsx)(Ue,{...e})})}function Ge(){return(0,U.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`started…`})}function Ke({name:e,description:t,run:n}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(M,{className:`size-4 text-muted-icon shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:e??`Workflow`}),t&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:t}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(fe,{status:n.status}),n.agentCount!=null&&n.agentCount>0&&(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[n.agentCount,` agents`]})]}):(0,U.jsx)(Ge,{})]})]})}var qe={serverOverloaded:`transient`,internalServerError:`transient`,httpConnectionFailed:`transient`,responseStreamConnectionFailed:`transient`,responseStreamDisconnected:`transient`,responseTooManyFailedAttempts:`transient`,usageLimitExceeded:`quota`,sessionBudgetExceeded:`quota`,unauthorized:`auth`,contextWindowExceeded:`fatal`,badRequest:`fatal`,cyberPolicy:`fatal`,sandboxError:`fatal`,threadRollbackFailed:`fatal`,activeTurnNotSteerable:`fatal`,other:`unknown`},Je=new Set([`httpConnectionFailed`,`responseStreamConnectionFailed`,`responseStreamDisconnected`,`responseTooManyFailedAttempts`,`activeTurnNotSteerable`]);function Y(e){return e in qe}function Ye(e){if(e==null)return null;if(typeof e==`string`)return Y(e)&&!Je.has(e)?e:null;if(typeof e!=`object`)return null;let t=Object.keys(e);if(t.length!==1)return null;let[n]=t;return Je.has(n)&&Y(n)?n:null}function Xe(e){return typeof e==`string`?Y(e)?e:null:Ye(e)}function Ze(e){let t=Xe(e);return t===null?`unknown`:qe[t]}function Qe(e){return Ze(e)===`transient`}var $e={serverOverloaded:e=>`${e} is temporarily at capacity. Retry, or switch to another model.`,internalServerError:e=>`${e} hit a server-side error. Retrying usually clears it.`,httpConnectionFailed:()=>`Could not reach the model provider. Check your connection, then retry.`,responseStreamConnectionFailed:()=>`The response stream failed to connect. Retry to start a new stream.`,responseStreamDisconnected:()=>`The response stream disconnected mid-turn. Retry to pick up from where it stopped.`,responseTooManyFailedAttempts:e=>`${e} failed repeatedly while streaming. Retry, or switch to another model.`,usageLimitExceeded:()=>`You have reached your Codex usage limit. Access returns when the limit window resets.`,sessionBudgetExceeded:()=>`This session reached its configured token budget.`,unauthorized:()=>"Codex rejected the credentials for this request. Re-authenticate with `codex login`.",contextWindowExceeded:e=>`The conversation no longer fits in ${e}'s context window. Start a new chat or compact this one.`,badRequest:()=>`Codex rejected the request as malformed.`,cyberPolicy:()=>`Codex declined this request under its usage policy.`,sandboxError:()=>`The Codex sandbox failed to run the requested command.`,threadRollbackFailed:()=>`Codex could not roll the conversation back to the requested point.`,activeTurnNotSteerable:()=>`The running turn cannot accept new input. Wait for it to finish, or stop it.`},et=`The selected model`;function tt(e,t){let n=Xe(e);if(n===null)return null;let r=$e[n];return r===void 0?null:r(t??et)}var X=k(`TranscriptActionCard`,()=>e=>({busyId:null,actionError:null,setBusyId:t=>e({busyId:t}),setActionError:t=>e({actionError:t})})),nt={neutral:`border-border bg-card`,muted:`border-border/50 bg-card/50 opacity-75`,success:`border-emerald-500/30 bg-emerald-500/5`,error:`border-destructive/40 bg-destructive/5`},rt={primary:`default`,secondary:`secondary`,ghost:`ghost`,destructive:`destructive`};function it(e){return(0,U.jsx)(X.Provider,{init:void 0,children:(0,U.jsx)(at,{...e})})}function at({title:e,description:t,body:n,errorMessage:r,tone:i=`neutral`,actions:o=[]}){let c=X.useScopedStore(e=>e.busyId),u=X.useScopedStore(e=>e.actionError),p=X.useScopedStoreApi(),m=(0,H.useCallback)(e=>{let t=p.getState();if(t.busyId)return;t.setActionError(null);let n;try{n=e.onClick()}catch(e){l.error(`[transcript-action-card] sync click threw`,String(e)),p.getState().setActionError(a(e));return}n instanceof Promise&&(t.setBusyId(e.id),n.then(()=>p.getState().setBusyId(null),s(e=>{l.error(`[transcript-action-card] async click rejected`,e.message),p.getState().setActionError(e.message),p.getState().setBusyId(null)})))},[p]),h=c!==null;return(0,U.jsxs)(`div`,{"data-focus-fallback-ignore":!0,className:f(`rounded-lg border px-4 py-3 text-sm space-y-2 transition-colors`,nt[i]),children:[(0,U.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,U.jsxs)(`div`,{className:`space-y-1 min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`font-medium leading-tight`,children:e}),t?(0,U.jsx)(`div`,{className:`text-muted-foreground text-xs leading-snug`,children:t}):null]})}),n?(0,U.jsx)(`div`,{className:`text-xs leading-snug`,children:n}):null,r?(0,U.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,children:r}):null,u?(0,U.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,role:`alert`,children:u}):null,o.length>0?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:o.map(e=>{let t=c===e.id;return(0,U.jsxs)(d,{type:`button`,size:`sm`,variant:rt[e.variant??`ghost`],disabled:e.disabled||h&&!t,pending:t,onClick:()=>m(e),className:`gap-1.5`,children:[e.icon,e.label]},e.id)})}):null]})}function ot(e){if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h${r>0?` ${r}m`:``}`:r>0?`${r}m${i>0?` ${i}s`:``}`:`${i}s`}function st({durationMs:e,prefix:t=`Worked for`}){return e<=0?null:(0,U.jsxs)(ee,{children:[t,` `,ot(e)]})}var Z=/\[([^\]]+)\]\(\/chat\/([0-9a-fA-F][0-9a-fA-F-]{7,})\)/g;function ct(e,t){let r=[],i=0,a=0;Z.lastIndex=0;for(let o=Z.exec(e);o!==null;o=Z.exec(e))o.index>i&&r.push(e.slice(i,o.index)),r.push((0,U.jsx)(n,{to:`/chat/${o[2]}`,className:t??`underline decoration-destructive/40 hover:decoration-destructive`,children:o[1]},`chat-link-${a++}`)),i=o.index+o[0].length;return i<e.length&&r.push(e.slice(i)),r.length===0?e:r}function lt({resultMessageId:e,body:t,onRetry:n}){let r=[{id:`retry`,label:`Retry`,variant:`primary`,onClick:(0,H.useCallback)(()=>n(e),[n,e])}];return(0,U.jsx)(`div`,{className:`mx-2 my-1`,children:(0,U.jsx)(it,{title:`Turn failed`,tone:`error`,body:t,actions:r})})}function ut({message:e,onRetry:t}){if(!e.success){let n=e.codexErrorInfo,r=(n?tt(n,null):null)??e.result??``,i=r.trim().length>0,a=n!==void 0&&Qe(n),o=null;return a&&t?o=(0,U.jsx)(lt,{resultMessageId:e.id,body:r,onRetry:t}):i&&(o=(0,U.jsx)(`div`,{className:`px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm whitespace-pre-wrap`,children:ct(r)})),(0,U.jsxs)(U.Fragment,{children:[o,e.durationMs>0?(0,U.jsx)(st,{durationMs:e.durationMs,prefix:`Failed after`}):null]})}return(0,U.jsx)(st,{durationMs:e.durationMs})}function dt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function ft(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function pt(e){return e.replace(/<persisted-output>\n?/g,``).replace(/\n?<\/persisted-output>/g,``)}function mt({message:e,localPath:t,isRunning:n=!1}){if(e.kind===`tool`&&e.persisted){let t=pt(ft(e.rawResult??``));return(0,U.jsxs)(`div`,{className:`animate-in fade-in-0 duration-200 rounded-md border border-border bg-muted/30 p-2 space-y-1 text-xs`,children:[(0,U.jsxs)(`div`,{className:`font-medium`,children:[e.toolName,`: output too large (`,dt(e.persisted.originalSize),`) — saved to disk`]}),(0,U.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap overflow-hidden max-h-48`,children:t}),(0,U.jsxs)(`a`,{href:E(e.persisted.filePath),className:`text-blue-500 hover:underline break-all`,target:`_blank`,rel:`noreferrer`,children:[`View full output (`,e.persisted.filePath,`)`]})]})}let r;switch(e.kind){case`assistant_text`:r=(0,U.jsx)(W,{message:e});break;case`assistant_thinking`:r=(0,U.jsx)(Ae,{message:e});break;case`tool`:r=(0,U.jsx)($,{message:e,isLoading:n,localPath:t});break;case`result`:r=(0,U.jsx)(ut,{message:e});break;default:return null}return(0,U.jsx)(`div`,{className:`animate-in fade-in-0 duration-200`,children:r})}var ht=(0,H.createContext)(null);function gt({children:e,value:t}){return(0,U.jsx)(ht.Provider,{value:t,children:e})}function _t(){return(0,H.useContext)(ht)}var vt=[],Q=k(`SubagentTaskMessage`,()=>e=>({expanded:!1,loading:!1,loaded:!1,children:vt,error:null,setExpanded:t=>e({expanded:t}),setLoading:t=>e({loading:t}),setLoaded:t=>e({loaded:t}),setChildren:t=>e({children:t}),setError:t=>e({error:t})}));function yt(e,t){return t||e===`failed`||e===`error`?`destructive`:e===`in_progress`||e===`running`?`active`:`muted`}function bt(e){if(!e)return``;let t=[],n=(e,n,r)=>{e&&e>0&&t.push(`${e} ${e===1?n:r}`)};return n(e.readCount,`read`,`reads`),n(e.editFileCount,`edit`,`edits`),n(e.bashCount,`cmd`,`cmds`),n(e.searchCount,`search`,`searches`),n(e.otherToolCount,`tool`,`tools`),t.join(` · `)}function xt({subagentType:e,result:t,isError:n,localPath:r}){let i=e||`Agent`,a=yt(t?.status,n),o=bt(t?.toolStats),c=_t(),l=t?.agentId,u=!!(c&&l),d=Q.useScopedStore(e=>e.expanded),m=Q.useScopedStore(e=>e.loading),h=Q.useScopedStore(e=>e.loaded),g=Q.useScopedStore(e=>e.children),_=Q.useScopedStore(e=>e.error),v=Q.useScopedStore(e=>e.setExpanded),y=Q.useScopedStore(e=>e.setLoading),b=Q.useScopedStore(e=>e.setLoaded),x=Q.useScopedStore(e=>e.setChildren),S=Q.useScopedStore(e=>e.setError),C=(0,H.useCallback)(()=>{if(!c||!l)return;let e=!d;v(e),e&&!h&&!m&&(y(!0),S(null),c(l).then(e=>{x(V(e)),b(!0)}).catch(s(e=>S(e.message))).finally(()=>y(!1)))},[c,l,d,h,m,v,y,S,x,b]),w=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[u?(0,U.jsx)(ae,{className:f(`size-4 text-muted-icon shrink-0 transition-transform`,d&&`rotate-90`),"aria-hidden":!0}):(0,U.jsx)(F,{className:`size-4 text-muted-icon shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:i}),t?.status&&(0,U.jsx)(ue,{tone:a,label:t.status}),t?.totalTokens!=null&&t.totalTokens>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground tabular-nums`,children:[(0,U.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),de(t.totalTokens),` tokens`]}),t?.totalDurationMs!=null&&t.totalDurationMs>0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:he(t.totalDurationMs)}),o&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums truncate`,children:o}),m&&(0,U.jsx)(p,{className:`size-3 animate-spin text-muted-foreground`,"aria-label":`Loading`})]})]});return u?(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:C,"aria-expanded":d,className:`w-full text-left cursor-pointer`,children:w}),d&&(0,U.jsxs)(`div`,{className:`mt-2 ml-2 border-l-2 border-muted-foreground/20 pl-3 space-y-2`,children:[_&&(0,U.jsx)(`div`,{className:`text-xs text-destructive`,children:_}),!_&&h&&g.length===0&&(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No subagent activity recorded.`}),g.map(e=>(0,U.jsx)(mt,{message:e,localPath:r??``},e.id))]})]}):w}function St({subagentType:e,result:t,isError:n,localPath:r}){return(0,U.jsx)(Q.Provider,{init:void 0,children:(0,U.jsx)(xt,{subagentType:e,result:t,isError:n,localPath:r})})}var Ct=[],wt=i()(e=>({byChat:{},setRuns:(t,n)=>e(e=>({byChat:{...e.byChat,[t]:n}}))}));function Tt(e){return t=>t.byChat[e]??Ct}function Et(e){return((c(e)&&Array.isArray(e.content)?e.content:null)??(Array.isArray(e)?e:[])).flatMap(e=>!e||typeof e!=`object`||!(`type`in e)||e.type!==`image`?[]:`data`in e&&typeof e.data==`string`?[{type:`image`,data:e.data,mimeType:`mimeType`in e&&typeof e.mimeType==`string`?e.mimeType:void 0}]:`source`in e&&e.source&&typeof e.source==`object`&&`type`in e.source&&e.source.type===`base64`&&`data`in e.source&&typeof e.source.data==`string`?[{type:`image`,data:e.source.data,mimeType:`media_type`in e.source&&typeof e.source.media_type==`string`?e.source.media_type:void 0}]:[])}function Dt({images:e}){return(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,t)=>{let n=e.mimeType||`image/png`;return(0,U.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-muted/20`,children:(0,U.jsx)(`img`,{src:`data:${n};base64,${e.data}`,alt:`Read result ${t+1}`,className:`max-h-[50vh] w-full object-contain bg-background`})},`${n}:${t}`)})})}function $({message:e,isLoading:t=!1,localPath:n,chatId:r=``}){let i=e.result!==void 0,a=!i&&t,o=wt(ce(Tt(r))),s=(0,H.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill;if(e.toolKind===`glob`)return`Search files ${e.input.pattern===`**/*`?`in all directories`:`matching ${e.input.pattern}`}`;if(e.toolKind===`grep`){let t=e.input.pattern,n=e.input.outputMode;return n===`count`?`Count \`${t}\` occurrences`:n===`content`?`Find \`${t}\` in text`:`Find \`${t}\` in files`}return e.toolKind===`bash`?e.input.description||(e.input.command?pe(e.input.command):`Bash`):e.toolKind===`web_search`?e.input.query||`Web Search`:e.toolKind===`read_file`?`Read ${O(e.input.filePath,n)}`:e.toolKind===`image_view`?`View ${O(e.input.path,n)||e.input.path}`:e.toolKind===`write_file`?`Write ${O(e.input.filePath,n)}`:e.toolKind===`edit_file`?`Edit ${O(e.input.filePath,n)}`:e.toolKind===`delete_file`?`Delete ${O(e.input.filePath,n)}`:e.toolKind===`mcp_generic`?`${me(e.input.tool)} from ${me(e.input.server)}`:e.toolKind===`beacon`?e.input.beaconId?`Beacon ${e.input.beaconId}: ${e.input.summary}`:e.input.summary:e.toolKind===`subagent_task`?e.input.subagentType||e.toolName:e.toolKind===`workflow`?e.input.name??`Workflow`:e.toolName},[e.input,e.toolKind,e.toolName,n]),l=(0,H.useMemo)(()=>e.toolKind===`subagent_task`,[e.toolKind]),u=(0,H.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill},[e.input,e.toolKind]),d=e.toolKind===`bash`,f=e.toolKind===`write_file`,p=e.toolKind===`edit_file`,m=e.toolKind===`delete_file`,_=e.toolKind===`read_file`,v=e.toolKind===`image_view`,b=(0,H.useMemo)(()=>{if(typeof e.result==`string`)return e.result;if(!e.result)return``;if(c(e.result)){let t=e.result.content;if(typeof t==`string`)return t}return JSON.stringify(e.result,null,2)},[e.result]),S=(0,H.useMemo)(()=>{if(!_)return[];if(c(e.result)){let t=e.result.blocks;if(Array.isArray(t)){let e=Et(t);if(e.length>0)return e}}return Et(e.rawResult)},[_,e.rawResult,e.result]),C=(0,H.useMemo)(()=>{switch(e.toolKind){case`bash`:return e.input.command;case`write_file`:case`delete_file`:return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]),T;T=d?(0,U.jsxs)(`span`,{className:`flex items-center gap-2 w-full`,children:[(0,U.jsx)(`span`,{children:`Command`}),!!e.input.timeoutMs&&(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`timeout: `,String(e.input.timeoutMs),`ms`]}),!!e.input.runInBackground&&(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`background`})]}):f?`Contents`:`Input`;let E;E=p?(0,U.jsx)(K,{content:``,isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):m?(0,U.jsx)(K,{content:e.input.content}):!_&&!f&&!v?(0,U.jsx)(x,{label:T,copyText:C,children:C}):null;let D;if(e.toolKind===`workflow`&&!e.isError){let t=(c(e.result)&&typeof e.result.text==`string`?{taskId:typeof e.result.taskId==`string`?e.result.taskId:void 0,text:e.result.text}:void 0)?.taskId,n=t?o.find(e=>e.taskId===t):void 0;D=(0,U.jsx)(Ke,{name:e.input.name,description:e.input.description,run:n})}else D=e.toolKind===`subagent_task`&&e.result?(0,U.jsx)(St,{subagentType:e.input.subagentType,result:e.result,isError:e.isError,localPath:n}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`w-5 h-5 relative flex items-center justify-center`,children:e.isError?(0,U.jsx)(oe,{className:`size-4 text-destructive`}):l?(0,U.jsx)(F,{className:`size-4 text-muted-icon`}):e.toolKind===`image_view`?(0,U.jsx)(ye,{className:`size-4 text-muted-icon`}):e.toolKind===`workflow`?(0,U.jsx)(M,{className:`size-4 text-muted-icon`}):(0,U.jsx)(re,{icon:y(e.toolName),className:`size-4 text-muted-icon`})}),(0,U.jsx)(ne,{className:`text-left transition-opacity duration-200 truncate`,children:(0,U.jsx)(G,{animate:a,shimmerWidth:Math.max(20,((u||s)?.length??33)*3),children:u||s})})]});return(0,U.jsx)(g,{className:`w-full`,children:(0,U.jsx)(w,{expandedContent:(0,U.jsx)(h,{className:`my-4 text-sm`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[E,i&&_&&!e.isError&&(S.length>0?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Image`}),(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(Dt,{images:S})})]}):(0,U.jsx)(K,{content:b})),v&&!e.isError&&(0,U.jsx)(We,{toolId:e.toolId,path:e.input.path,contentUrl:e.input.contentUrl,mimeType:e.input.mimeType}),f&&!e.isError&&(0,U.jsx)(K,{content:e.input.content}),i&&!_&&!(v&&!e.isError)&&!(f&&!e.isError)&&!(p&&!e.isError)&&!(m&&!e.isError)&&(0,U.jsx)(x,{label:e.isError?`Error`:`Result`,copyText:b,children:b})]})}),children:D})})}export{ve as _,mt as a,it as c,Ae as d,W as f,M as g,F as h,gt as i,Ve as l,be as m,Tt as n,ut as o,V as p,wt as r,ct as s,$ as t,G as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{t as a}from"./react-eq8zrF0J.js";import{t as o}from"./jsx-runtime-BdxMnOeJ.js";import{d as s}from"./log-DIu9xkUN.js";import{O as c}from"./genui-0tseVHei.js";import{t as l}from"./runDetached-CXTNs9Tz.js";import{n as u}from"./useTheme-ee-m4Hcs.js";import{t as d}from"./chart-renderer-rxKOguR8.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:t.get(e.series)??e.series,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}function E(e,t){return e.series.some(e=>e.label===t&&e.role===`compare`)}var D=`seriesLabel`;function O(e,t){let n=e?.[t];return typeof n==`string`?n:``}function k(e){let t=e?.value;return typeof t==`number`?t:null}function A(e){let t=t=>c(k(t),e.format);return{mark:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]}}}function ee(e){return e.kind!==`line`&&e.kind!==`area`}function te(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>c(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!ee(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function ne(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function re(e,t){let n=new Map(e.series.map(e=>[e.id,e.label]));return{data:[{id:`points`,values:e.points.map(e=>C(e,n))}],background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:A(e),legends:ne(e,t)}}function ie(e,t){switch(e.kind){case`line`:return oe(e,t);case`area`:return se(e,t);case`bar`:case`stacked-bar`:return ce(e,t);case`combo`:return le(e,t);case`waterfall`:return ue(e,t);case`composition`:return de(e,t)}}function ae(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function oe(e,t){return{type:`line`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:t=>E(e,O(t,`seriesLabel`))?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function se(e,t){return{type:`area`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:t=>E(e,O(t,`seriesLabel`))?0:b}},point:{visible:!1}}}function ce(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...re(e,t),xField:r?[`x`,D]:`x`,yField:`value`,seriesField:D,stack:n,barMaxWidth:24,barGapInGroup:2,axes:te(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function le(e,t){let[n,r]=e.series,i=re(e,t),a=new Map(e.series.map(e=>[e.id,e.label])),o=t=>e.points.filter(e=>e.series===t).map(e=>C(e,a));return{type:`common`,background:i.background,padding:i.padding,color:i.color,tooltip:i.tooltip,legends:i.legends,data:[{id:`bars`,values:o(n?.id)},{id:`line`,values:o(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:D,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:D,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:te(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function ue(e,t){return{type:`rangeColumn`,...re(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:D,barMaxWidth:24,axes:te(e,t),bar:{style:{cornerRadius:2}}}}function de(e,t){return{type:`pie`,...re(e,t),categoryField:D,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var fe=e=>e,pe;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(pe||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var me=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),he,ge=t((()=>{he=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),_e,ve=t((()=>{ge(),_e=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||he(e,`Boolean`)})),M,ye=t((()=>{M=e=>typeof e==`function`})),N,be=t((()=>{N=e=>e==null})),P,xe=t((()=>{P=e=>e!=null})),F,Se=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Ce,we=t((()=>{Ce=e=>typeof e==`object`&&!!e})),Te,Ee=t((()=>{we(),ge(),Te=function(e){if(!Ce(e)||!he(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),De,Oe=t((()=>{De=e=>e===void 0})),ke,Ae=t((()=>{ge(),ke=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||he(e,`String`)}})),I,je=t((()=>{ge(),I=e=>Array.isArray?Array.isArray(e):he(e,`Array`)})),Me,Ne=t((()=>{Me=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Pe,Fe=t((()=>{ge(),Pe=e=>he(e,`Date`)})),L,Ie=t((()=>{ge(),L=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||he(e,`Number`)}})),R,Le=t((()=>{Ie(),R=e=>L(e)&&Number.isFinite(e)})),Re,ze=t((()=>{Re=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Be,Ve=t((()=>{Be=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),He,Ue=t((()=>{He=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),We,Ge,Ke=t((()=>{We=Object.prototype,Ge=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||We)}}));function z(e){if(N(e))return!0;if(Me(e))return!e.length;let t=He(e);if(t===`Map`||t===`Set`)return!e.size;if(Ge(e))return!Object.keys(e).length;for(let t in e)if(qe.call(e,t))return!1;return!0}var qe,Je=t((()=>{be(),Ne(),Ue(),Ke(),qe=Object.prototype.hasOwnProperty})),Ye,Xe=t((()=>{Ae(),Ye=(e,t,n)=>{let r=ke(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Ze,Qe,$e=t((()=>{Ze=Object.prototype.hasOwnProperty,Qe=(e,t)=>e!=null&&Ze.call(e,t)}));function et(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=I(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:_e(e)||L(e)||ke(e)?e:Pe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=et(a,t,n)}return r}var tt=t((()=>{je(),ve(),Fe(),Ie(),Ae(),xe()}));function nt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&I(e[o])?it(e,o,i[o]):rt(e,t,o,n,r)}}}}function rt(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(I(o)){if(r)s=[];else if(I(a))s=a;else if(Me(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else Te(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&nt(s,o,r,i),it(e,n,s)}function it(e,t,n){(n!==void 0&&!at(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function at(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ot(e,...t){let n=-1,r=t.length;for(;++n<r;)nt(e,t[n],!0);return e}var st=t((()=>{je(),Ne(),Ee(),xe()}));function ct(e,t){if(!e||!Te(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(ke(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var lt=t((()=>{Ee(),Ae()}));function ut(e){return Object.prototype.toString.call(e)}function dt(e){return Object.keys(e)}function ft(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(ut(e)!==ut(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(I(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!ft(e[r],t[r],n))return!1;return!0}if(!Te(e))return!1;let r=dt(e),i=dt(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!ft(e[a],t[a],n))return!1}return!0}var pt=t((()=>{je(),ye(),Ee()}));function mt(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function ht(e,t,n){let r=mt(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function gt(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else ht(e,t,n)}var _t=t((()=>{}));function B(e){return P(e)?I(e)?e:[e]:[]}function vt(e){if(Me(e))return e[e.length-1]}function yt(e,t){if(!I(e)||!I(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function bt(e){if(!I(e))return[e];let t=[];for(let n of e)t.push(...bt(n));return t}var xt,St,Ct=t((()=>{je(),Ne(),xe(),xt=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function wt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Tt=t((()=>{xe()}));function Et(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Dt=t((()=>{}));function Ot(e){return Number(e)}var kt=t((()=>{})),At=t((()=>{}));function jt(e,t,n){let r=[t].concat([].slice.call(n));Mt&&console[e].apply(console,r)}var Mt,Nt,Pt,Ft=t((()=>{Ie(),Mt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Nt||={}),Pt=class e{static getInstance(t,n){return e._instance&&L(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Nt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Nt.Info}canLogDebug(){return this._level>=Nt.Debug}canLogError(){return this._level>=Nt.Error}canLogWarn(){return this._level>=Nt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):jt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Nt.Warn&&jt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Nt.Info&&jt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Nt.Debug&&jt(this._method||`log`,`DEBUG`,e),this}},Pt._instance=null}));function It(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Et(e[i],t)>0?r=i:n=i+1}return n}var Lt,Rt=t((()=>{Dt(),be(),Lt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function zt(e,t,n=Ut,r=Ht){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Bt(e,t,n,r){return e>t&&!zt(e,t,n,r)}function Vt(e,t,n,r){return e<t&&!zt(e,t,n,r)}var Ht,Ut,Wt=t((()=>{Ht=1e-10,Ut=1e-10})),Gt,Kt=t((()=>{Gt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),qt,Jt=t((()=>{qt=function(e,t,n){return e<t?t:e>n?n:e}})),Yt,Xt=t((()=>{Yt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Zt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var Qt=t((()=>{}));function $t(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&en;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(R(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var en,tn=t((()=>{Se(),Le(),en=!1;try{en=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{en=!1}en=!1}));function nn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),$t(e,t,{leading:r,trailing:i,maxWait:t})}var rn=t((()=>{tn(),Se()}));function an(e,t){return n=>e*(1-n)+t*n}function on(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function sn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var cn,ln=t((()=>{cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(cn.source,`g`)})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{})),Cn=t((()=>{})),wn=t((()=>{})),Tn=t((()=>{ve(),ye(),be(),xe(),Se(),we(),Ee(),ge(),Oe(),Ae(),je(),Ne(),Fe(),Ie(),Le(),ze(),Ve(),Je(),Xe(),$e(),tt(),st(),lt(),pt(),_t(),Ct(),Tt(),At(),Rt(),At(),Wt(),Kt(),Jt(),Xt(),Qt(),tn(),rn(),ln(),kt(),un(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),bn(),xn(),Sn(),yn(),Cn(),wn()})),En=t((()=>{}));function Dn(e){return e>1?0:e<-1?Fn:Math.acos(e)}function On(e){return e>=1?In:e<=-1?-In:Math.asin(e)}function kn(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function An(e,t){return e[0]*t[1]-e[1]*t[0]}function jn(e,t){return Rn(e[0]-t[0])+Rn(e[1]-t[1])<1e-12}function Mn(e,t=10){return Math.round(e*t)/t}function Nn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function Pn(e,t){return Mn(e-t,10**Math.max(Nn(e),Nn(t)))}var Fn,In,Ln,V,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn=t((()=>{Fn=Math.PI,In=Fn/2,Ln=2*Fn,V=2*Math.PI,Rn=Math.abs,zn=Math.atan2,Bn=Math.cos,Vn=Math.max,Hn=Math.min,Un=Math.sin,Wn=Math.sqrt,Gn=Math.pow})),qn,Jn,Yn=t((()=>{Ie(),Kn(),qn=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return L(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return L(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Jn=class{static distancePP(e,t){return Wn(Gn(e.x-t.x,2)+Gn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Wn(Gn(e-n,2)+Gn(t-r,2))}static distancePN(e,t,n){return Wn(Gn(t-e.x,2)+Gn(n-e.y,2))}static pointAtPP(e,t,n){return new qn((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Xn=t((()=>{}));function Zn(e){return Math.PI/180*e}function Qn(e){return 180*e/Math.PI}function $n(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function er(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function tr(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=er(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function nr(e,t,n,r){let{x:i,y:a}=t,o=tr(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function rr(e){return(e=er(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var ir,ar,or=t((()=>{Kn(),ir=(e=0)=>{if(e<0)for(;e<-Ln;)e+=Ln;else if(e>0)for(;e>Ln;)e-=Ln;return e},ar=ir}));function sr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function cr(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function lr(e,t,n,r){if(!cr(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(sr(i,t,e),sr(a,r,n),jn(i,a))return!0;sr(o,n,e);let s=An(o,a)/An(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function ur(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=yr(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function dr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=yr(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function fr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function pr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function mr({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function hr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function gr(e,t){let n=t?Zn(e.angle):e.angle,r=hr(e);return[mr({x:e.x1,y:e.y1},n,r),mr({x:e.x2,y:e.y1},n,r),mr({x:e.x2,y:e.y2},n,r),mr({x:e.x1,y:e.y2},n,r)]}function _r(e,t,n=!1){let r=gr(e,n),i=gr(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(hr(e),hr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?Zn(e.angle):e.angle,f=n?Zn(90-e.angle):e.angle+In,p=n?Zn(t.angle):t.angle,m=n?Zn(90-t.angle):t.angle+In;f>V&&(f-=V),m>V&&(m-=V);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(pr(i,n)+pr(i,r))/2>pr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var vr,yr,br=t((()=>{or(),Kn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(vr||={}),yr=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),xr=t((()=>{})),Sr=t((()=>{})),Cr=t((()=>{br(),xr(),Sr()})),wr=t((()=>{}));function Tr(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Er=t((()=>{})),Dr=t((()=>{})),Or,kr=t((()=>{Or=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function Ar(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var jr=t((()=>{})),Mr,Nr=t((()=>{Tn(),kr(),jr(),Mr=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=Ar(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return ke(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(Or(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(Or(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(I(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Mr.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Mr.NUMBERS_CHAR_SET=`0123456789`,Mr.FULL_SIZE_CHAR=`字`})),Pr=t((()=>{})),Fr=t((()=>{Nr(),Pr(),jr()})),Ir=t((()=>{kr(),Fr()})),Lr,Rr,zr,Br=t((()=>{Lr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},Rr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),zr=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Vr=t((()=>{Xn(),Cr(),wr(),Er(),Dr(),Ir(),Br()}));function Hr(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var Ur,Wr,Gr,Kr=t((()=>{Tn(),Vr(),Ur=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return I(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Hr(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Wr=class extends Ur{},Gr=class e extends Ur{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return _r(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[mr({x:this.x1,y:this.y1},this.angle,e),mr({x:this.x2,y:this.y1},this.angle,e),mr({x:this.x1,y:this.y2},this.angle,e),mr({x:this.x2,y:this.y2},this.angle,e)]}}}));function qr(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=Bn(o),h=Un(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Jr,Yr=t((()=>{or(),Kn(),Jr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=Qn(a.rotateDeg),a}}})),Xr=t((()=>{En(),Yn(),Kr(),Yr()})),Zr,Qr=t((()=>{Zr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function $r(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var ei=t((()=>{}));function ti(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var ni=t((()=>{}));function ri(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ii(e){return L(e)?new pi(e>>16,e>>8&255,255&e,1):I(e)?new pi(e[0],e[1],e[2]):new pi(255,255,255)}function ai(e){return L(e)?new pi(e>>>24,e>>>16&255,e>>>8&255,255&e):I(e)?new pi(e[0],e[1],e[2],e[3]):new pi(255,255,255,1)}function oi(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function si(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var ci,li,ui,di,fi,pi,mi=t((()=>{Tn(),ei(),ni(),ci=/^#([0-9a-f]{3,8})$/,li={transparent:4294967040},ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},di=(e,t)=>{let n=ci.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new pi((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ii(e):t===8?new pi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},fi=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(li[e]))return ai(li[e]);if(P(ui[e]))return ii(ui[e]);let t=`${e}`.trim().toLowerCase(),n=di(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new pi(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=$r(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new pi(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new pi(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=ti(this.color.r,this.color.g,this.color.b),a=$r(N(e)?i.h:qt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new pi(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return di(t,!0)??this}setColorName(e){let t=ui[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=oi(e.color.r),this.color.g=oi(e.color.g),this.color.b=oi(e.color.b),this}copyLinearToSRGB(e){return this.color.r=si(e.color.r),this.color.g=si(e.color.g),this.color.b=si(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},pi=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${ri(this.r)+ri(this.g)+ri(this.b)+(this.opacity===1?``:ri(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=ti(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function hi(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var gi=t((()=>{}));function _i(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var vi=t((()=>{}));function yi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new pi(t,u,d,c*(1-e)+l*e)}}var bi=t((()=>{mi()})),xi=r({Color:()=>fi,DEFAULT_COLORS:()=>ui,RGB:()=>pi,hexToRgb:()=>hi,hslToRgb:()=>$r,interpolateRgb:()=>yi,rgbToHex:()=>_i,rgbToHsl:()=>ti}),Si=t((()=>{mi(),gi(),ei(),vi(),ni(),bi()})),Ci=t((()=>{}));function wi(e){if(R(e))return[e,e,e,e];if(I(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var Ti=t((()=>{Le(),je(),Se()})),Ei=t((()=>{})),Di=t((()=>{})),Oi=t((()=>{Ei(),Di()}));function ki(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function Ai(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var ji,Mi,Ni=t((()=>{ji=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Mi=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Pi=t((()=>{})),Fi=t((()=>{})),Ii=t((()=>{})),Li=t((()=>{})),Ri=t((()=>{Pi(),Fi(),Li(),Ii()})),zi,Bi=t((()=>{zi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Vi=t((()=>{})),Hi=t((()=>{})),Ui=t((()=>{Hi(),Vi()})),Wi=t((()=>{})),Gi=t((()=>{})),Ki=t((()=>{})),qi=t((()=>{Wi(),Gi(),Ki()})),Ji,H=t((()=>{Ji=n(me()),Tn(),Xr(),Qr(),Kn(),or(),Si(),Vr(),Ci(),Ft(),Ti(),Oi(),Ni(),Ri(),Si(),Bi(),Ui(),qi()})),Yi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};H();var Xi=function(e,...t){return $i(et(e),...t)};function Zi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)Zi(e[n],r,t)}else e[n]=r}function Qi(e,t){if(F(t)&&e!==t)for(let n in t)Zi(e,t,n)}function $i(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)Qi(e,t[n]);return e}var ea;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(ea||={});var ta=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};H();var na=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(R(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>ra(e,t,a))),e};function ra(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var ia={},aa={},oa=34,sa=10,ca=13;function la(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function ua(e,t){var n=la(e);return function(r,i){return t(n(r),i,e)}}function da(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function fa(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function pa(e){return e<0?`-`+fa(-e,6):e>9999?`+`+fa(e,6):fa(e,4)}function ma(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:pa(e.getUTCFullYear(),4)+`-`+fa(e.getUTCMonth()+1,2)+`-`+fa(e.getUTCDate(),2)+(i?`T`+fa(t,2)+`:`+fa(n,2)+`:`+fa(r,2)+`.`+fa(i,3)+`Z`:r?`T`+fa(t,2)+`:`+fa(n,2)+`:`+fa(r,2)+`Z`:n||t?`T`+fa(t,2)+`:`+fa(n,2)+`Z`:``)}function ha(e){var t=RegExp(`["`+e+`
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{t as a}from"./react-eq8zrF0J.js";import{t as o}from"./jsx-runtime-BdxMnOeJ.js";import{d as s}from"./log-3sQ-5rrS.js";import{O as c}from"./genui-jdDJe0VI.js";import{t as l}from"./runDetached-BBRv1zoc.js";import{n as u}from"./useTheme-V_0ZRiiP.js";import{t as d}from"./chart-renderer-Cw-dI71U.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:t.get(e.series)??e.series,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}function E(e,t){return e.series.some(e=>e.label===t&&e.role===`compare`)}var D=`seriesLabel`;function O(e,t){let n=e?.[t];return typeof n==`string`?n:``}function k(e){let t=e?.value;return typeof t==`number`?t:null}function A(e){let t=t=>c(k(t),e.format);return{mark:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]}}}function ee(e){return e.kind!==`line`&&e.kind!==`area`}function te(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>c(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!ee(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function ne(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function re(e,t){let n=new Map(e.series.map(e=>[e.id,e.label]));return{data:[{id:`points`,values:e.points.map(e=>C(e,n))}],background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:A(e),legends:ne(e,t)}}function ie(e,t){switch(e.kind){case`line`:return oe(e,t);case`area`:return se(e,t);case`bar`:case`stacked-bar`:return ce(e,t);case`combo`:return le(e,t);case`waterfall`:return ue(e,t);case`composition`:return de(e,t)}}function ae(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function oe(e,t){return{type:`line`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:t=>E(e,O(t,`seriesLabel`))?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function se(e,t){return{type:`area`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:t=>E(e,O(t,`seriesLabel`))?0:b}},point:{visible:!1}}}function ce(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...re(e,t),xField:r?[`x`,D]:`x`,yField:`value`,seriesField:D,stack:n,barMaxWidth:24,barGapInGroup:2,axes:te(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function le(e,t){let[n,r]=e.series,i=re(e,t),a=new Map(e.series.map(e=>[e.id,e.label])),o=t=>e.points.filter(e=>e.series===t).map(e=>C(e,a));return{type:`common`,background:i.background,padding:i.padding,color:i.color,tooltip:i.tooltip,legends:i.legends,data:[{id:`bars`,values:o(n?.id)},{id:`line`,values:o(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:D,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:D,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:te(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function ue(e,t){return{type:`rangeColumn`,...re(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:D,barMaxWidth:24,axes:te(e,t),bar:{style:{cornerRadius:2}}}}function de(e,t){return{type:`pie`,...re(e,t),categoryField:D,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var fe=e=>e,pe;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(pe||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var me=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),he,ge=t((()=>{he=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),_e,ve=t((()=>{ge(),_e=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||he(e,`Boolean`)})),M,ye=t((()=>{M=e=>typeof e==`function`})),N,be=t((()=>{N=e=>e==null})),P,xe=t((()=>{P=e=>e!=null})),F,Se=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Ce,we=t((()=>{Ce=e=>typeof e==`object`&&!!e})),Te,Ee=t((()=>{we(),ge(),Te=function(e){if(!Ce(e)||!he(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),De,Oe=t((()=>{De=e=>e===void 0})),ke,Ae=t((()=>{ge(),ke=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||he(e,`String`)}})),I,je=t((()=>{ge(),I=e=>Array.isArray?Array.isArray(e):he(e,`Array`)})),Me,Ne=t((()=>{Me=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Pe,Fe=t((()=>{ge(),Pe=e=>he(e,`Date`)})),L,Ie=t((()=>{ge(),L=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||he(e,`Number`)}})),R,Le=t((()=>{Ie(),R=e=>L(e)&&Number.isFinite(e)})),Re,ze=t((()=>{Re=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Be,Ve=t((()=>{Be=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),He,Ue=t((()=>{He=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),We,Ge,Ke=t((()=>{We=Object.prototype,Ge=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||We)}}));function z(e){if(N(e))return!0;if(Me(e))return!e.length;let t=He(e);if(t===`Map`||t===`Set`)return!e.size;if(Ge(e))return!Object.keys(e).length;for(let t in e)if(qe.call(e,t))return!1;return!0}var qe,Je=t((()=>{be(),Ne(),Ue(),Ke(),qe=Object.prototype.hasOwnProperty})),Ye,Xe=t((()=>{Ae(),Ye=(e,t,n)=>{let r=ke(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Ze,Qe,$e=t((()=>{Ze=Object.prototype.hasOwnProperty,Qe=(e,t)=>e!=null&&Ze.call(e,t)}));function et(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=I(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:_e(e)||L(e)||ke(e)?e:Pe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=et(a,t,n)}return r}var tt=t((()=>{je(),ve(),Fe(),Ie(),Ae(),xe()}));function nt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&I(e[o])?it(e,o,i[o]):rt(e,t,o,n,r)}}}}function rt(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(I(o)){if(r)s=[];else if(I(a))s=a;else if(Me(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else Te(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&nt(s,o,r,i),it(e,n,s)}function it(e,t,n){(n!==void 0&&!at(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function at(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ot(e,...t){let n=-1,r=t.length;for(;++n<r;)nt(e,t[n],!0);return e}var st=t((()=>{je(),Ne(),Ee(),xe()}));function ct(e,t){if(!e||!Te(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(ke(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var lt=t((()=>{Ee(),Ae()}));function ut(e){return Object.prototype.toString.call(e)}function dt(e){return Object.keys(e)}function ft(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(ut(e)!==ut(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(I(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!ft(e[r],t[r],n))return!1;return!0}if(!Te(e))return!1;let r=dt(e),i=dt(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!ft(e[a],t[a],n))return!1}return!0}var pt=t((()=>{je(),ye(),Ee()}));function mt(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function ht(e,t,n){let r=mt(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function gt(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else ht(e,t,n)}var _t=t((()=>{}));function B(e){return P(e)?I(e)?e:[e]:[]}function vt(e){if(Me(e))return e[e.length-1]}function yt(e,t){if(!I(e)||!I(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function bt(e){if(!I(e))return[e];let t=[];for(let n of e)t.push(...bt(n));return t}var xt,St,Ct=t((()=>{je(),Ne(),xe(),xt=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function wt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Tt=t((()=>{xe()}));function Et(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Dt=t((()=>{}));function Ot(e){return Number(e)}var kt=t((()=>{})),At=t((()=>{}));function jt(e,t,n){let r=[t].concat([].slice.call(n));Mt&&console[e].apply(console,r)}var Mt,Nt,Pt,Ft=t((()=>{Ie(),Mt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Nt||={}),Pt=class e{static getInstance(t,n){return e._instance&&L(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Nt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Nt.Info}canLogDebug(){return this._level>=Nt.Debug}canLogError(){return this._level>=Nt.Error}canLogWarn(){return this._level>=Nt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):jt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Nt.Warn&&jt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Nt.Info&&jt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Nt.Debug&&jt(this._method||`log`,`DEBUG`,e),this}},Pt._instance=null}));function It(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Et(e[i],t)>0?r=i:n=i+1}return n}var Lt,Rt=t((()=>{Dt(),be(),Lt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function zt(e,t,n=Ut,r=Ht){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Bt(e,t,n,r){return e>t&&!zt(e,t,n,r)}function Vt(e,t,n,r){return e<t&&!zt(e,t,n,r)}var Ht,Ut,Wt=t((()=>{Ht=1e-10,Ut=1e-10})),Gt,Kt=t((()=>{Gt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),qt,Jt=t((()=>{qt=function(e,t,n){return e<t?t:e>n?n:e}})),Yt,Xt=t((()=>{Yt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Zt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var Qt=t((()=>{}));function $t(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&en;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(R(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var en,tn=t((()=>{Se(),Le(),en=!1;try{en=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{en=!1}en=!1}));function nn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),$t(e,t,{leading:r,trailing:i,maxWait:t})}var rn=t((()=>{tn(),Se()}));function an(e,t){return n=>e*(1-n)+t*n}function on(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function sn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var cn,ln=t((()=>{cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(cn.source,`g`)})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{})),Cn=t((()=>{})),wn=t((()=>{})),Tn=t((()=>{ve(),ye(),be(),xe(),Se(),we(),Ee(),ge(),Oe(),Ae(),je(),Ne(),Fe(),Ie(),Le(),ze(),Ve(),Je(),Xe(),$e(),tt(),st(),lt(),pt(),_t(),Ct(),Tt(),At(),Rt(),At(),Wt(),Kt(),Jt(),Xt(),Qt(),tn(),rn(),ln(),kt(),un(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),bn(),xn(),Sn(),yn(),Cn(),wn()})),En=t((()=>{}));function Dn(e){return e>1?0:e<-1?Fn:Math.acos(e)}function On(e){return e>=1?In:e<=-1?-In:Math.asin(e)}function kn(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function An(e,t){return e[0]*t[1]-e[1]*t[0]}function jn(e,t){return Rn(e[0]-t[0])+Rn(e[1]-t[1])<1e-12}function Mn(e,t=10){return Math.round(e*t)/t}function Nn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function Pn(e,t){return Mn(e-t,10**Math.max(Nn(e),Nn(t)))}var Fn,In,Ln,V,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn=t((()=>{Fn=Math.PI,In=Fn/2,Ln=2*Fn,V=2*Math.PI,Rn=Math.abs,zn=Math.atan2,Bn=Math.cos,Vn=Math.max,Hn=Math.min,Un=Math.sin,Wn=Math.sqrt,Gn=Math.pow})),qn,Jn,Yn=t((()=>{Ie(),Kn(),qn=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return L(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return L(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Jn=class{static distancePP(e,t){return Wn(Gn(e.x-t.x,2)+Gn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Wn(Gn(e-n,2)+Gn(t-r,2))}static distancePN(e,t,n){return Wn(Gn(t-e.x,2)+Gn(n-e.y,2))}static pointAtPP(e,t,n){return new qn((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Xn=t((()=>{}));function Zn(e){return Math.PI/180*e}function Qn(e){return 180*e/Math.PI}function $n(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function er(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function tr(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=er(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function nr(e,t,n,r){let{x:i,y:a}=t,o=tr(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function rr(e){return(e=er(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var ir,ar,or=t((()=>{Kn(),ir=(e=0)=>{if(e<0)for(;e<-Ln;)e+=Ln;else if(e>0)for(;e>Ln;)e-=Ln;return e},ar=ir}));function sr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function cr(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function lr(e,t,n,r){if(!cr(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(sr(i,t,e),sr(a,r,n),jn(i,a))return!0;sr(o,n,e);let s=An(o,a)/An(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function ur(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=yr(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function dr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=yr(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function fr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function pr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function mr({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function hr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function gr(e,t){let n=t?Zn(e.angle):e.angle,r=hr(e);return[mr({x:e.x1,y:e.y1},n,r),mr({x:e.x2,y:e.y1},n,r),mr({x:e.x2,y:e.y2},n,r),mr({x:e.x1,y:e.y2},n,r)]}function _r(e,t,n=!1){let r=gr(e,n),i=gr(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(hr(e),hr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?Zn(e.angle):e.angle,f=n?Zn(90-e.angle):e.angle+In,p=n?Zn(t.angle):t.angle,m=n?Zn(90-t.angle):t.angle+In;f>V&&(f-=V),m>V&&(m-=V);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(pr(i,n)+pr(i,r))/2>pr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var vr,yr,br=t((()=>{or(),Kn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(vr||={}),yr=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),xr=t((()=>{})),Sr=t((()=>{})),Cr=t((()=>{br(),xr(),Sr()})),wr=t((()=>{}));function Tr(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Er=t((()=>{})),Dr=t((()=>{})),Or,kr=t((()=>{Or=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function Ar(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var jr=t((()=>{})),Mr,Nr=t((()=>{Tn(),kr(),jr(),Mr=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=Ar(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return ke(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(Or(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(Or(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(I(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Mr.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Mr.NUMBERS_CHAR_SET=`0123456789`,Mr.FULL_SIZE_CHAR=`字`})),Pr=t((()=>{})),Fr=t((()=>{Nr(),Pr(),jr()})),Ir=t((()=>{kr(),Fr()})),Lr,Rr,zr,Br=t((()=>{Lr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},Rr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),zr=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Vr=t((()=>{Xn(),Cr(),wr(),Er(),Dr(),Ir(),Br()}));function Hr(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var Ur,Wr,Gr,Kr=t((()=>{Tn(),Vr(),Ur=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return I(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Hr(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Wr=class extends Ur{},Gr=class e extends Ur{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return _r(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[mr({x:this.x1,y:this.y1},this.angle,e),mr({x:this.x2,y:this.y1},this.angle,e),mr({x:this.x1,y:this.y2},this.angle,e),mr({x:this.x2,y:this.y2},this.angle,e)]}}}));function qr(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=Bn(o),h=Un(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Jr,Yr=t((()=>{or(),Kn(),Jr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=Qn(a.rotateDeg),a}}})),Xr=t((()=>{En(),Yn(),Kr(),Yr()})),Zr,Qr=t((()=>{Zr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function $r(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var ei=t((()=>{}));function ti(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var ni=t((()=>{}));function ri(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ii(e){return L(e)?new pi(e>>16,e>>8&255,255&e,1):I(e)?new pi(e[0],e[1],e[2]):new pi(255,255,255)}function ai(e){return L(e)?new pi(e>>>24,e>>>16&255,e>>>8&255,255&e):I(e)?new pi(e[0],e[1],e[2],e[3]):new pi(255,255,255,1)}function oi(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function si(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var ci,li,ui,di,fi,pi,mi=t((()=>{Tn(),ei(),ni(),ci=/^#([0-9a-f]{3,8})$/,li={transparent:4294967040},ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},di=(e,t)=>{let n=ci.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new pi((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ii(e):t===8?new pi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},fi=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(li[e]))return ai(li[e]);if(P(ui[e]))return ii(ui[e]);let t=`${e}`.trim().toLowerCase(),n=di(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new pi(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=$r(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new pi(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new pi(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=ti(this.color.r,this.color.g,this.color.b),a=$r(N(e)?i.h:qt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new pi(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return di(t,!0)??this}setColorName(e){let t=ui[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=oi(e.color.r),this.color.g=oi(e.color.g),this.color.b=oi(e.color.b),this}copyLinearToSRGB(e){return this.color.r=si(e.color.r),this.color.g=si(e.color.g),this.color.b=si(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},pi=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${ri(this.r)+ri(this.g)+ri(this.b)+(this.opacity===1?``:ri(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=ti(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function hi(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var gi=t((()=>{}));function _i(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var vi=t((()=>{}));function yi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new pi(t,u,d,c*(1-e)+l*e)}}var bi=t((()=>{mi()})),xi=r({Color:()=>fi,DEFAULT_COLORS:()=>ui,RGB:()=>pi,hexToRgb:()=>hi,hslToRgb:()=>$r,interpolateRgb:()=>yi,rgbToHex:()=>_i,rgbToHsl:()=>ti}),Si=t((()=>{mi(),gi(),ei(),vi(),ni(),bi()})),Ci=t((()=>{}));function wi(e){if(R(e))return[e,e,e,e];if(I(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var Ti=t((()=>{Le(),je(),Se()})),Ei=t((()=>{})),Di=t((()=>{})),Oi=t((()=>{Ei(),Di()}));function ki(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function Ai(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var ji,Mi,Ni=t((()=>{ji=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Mi=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Pi=t((()=>{})),Fi=t((()=>{})),Ii=t((()=>{})),Li=t((()=>{})),Ri=t((()=>{Pi(),Fi(),Li(),Ii()})),zi,Bi=t((()=>{zi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Vi=t((()=>{})),Hi=t((()=>{})),Ui=t((()=>{Hi(),Vi()})),Wi=t((()=>{})),Gi=t((()=>{})),Ki=t((()=>{})),qi=t((()=>{Wi(),Gi(),Ki()})),Ji,H=t((()=>{Ji=n(me()),Tn(),Xr(),Qr(),Kn(),or(),Si(),Vr(),Ci(),Ft(),Ti(),Oi(),Ni(),Ri(),Si(),Bi(),Ui(),qi()})),Yi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};H();var Xi=function(e,...t){return $i(et(e),...t)};function Zi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)Zi(e[n],r,t)}else e[n]=r}function Qi(e,t){if(F(t)&&e!==t)for(let n in t)Zi(e,t,n)}function $i(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)Qi(e,t[n]);return e}var ea;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(ea||={});var ta=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};H();var na=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(R(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>ra(e,t,a))),e};function ra(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var ia={},aa={},oa=34,sa=10,ca=13;function la(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function ua(e,t){var n=la(e);return function(r,i){return t(n(r),i,e)}}function da(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function fa(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function pa(e){return e<0?`-`+fa(-e,6):e>9999?`+`+fa(e,6):fa(e,4)}function ma(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:pa(e.getUTCFullYear(),4)+`-`+fa(e.getUTCMonth()+1,2)+`-`+fa(e.getUTCDate(),2)+(i?`T`+fa(t,2)+`:`+fa(n,2)+`:`+fa(r,2)+`.`+fa(i,3)+`Z`:r?`T`+fa(t,2)+`:`+fa(n,2)+`:`+fa(r,2)+`Z`:n||t?`T`+fa(t,2)+`:`+fa(n,2)+`Z`:``)}function ha(e){var t=RegExp(`["`+e+`
|
|
2
2
|
\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?ua(e,t):la(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===sa&&--i,e.charCodeAt(i-1)===ca&&--i;function u(){if(c)return aa;if(l)return l=!1,ia;var t,r=a,o;if(e.charCodeAt(r)===oa){for(;a++<i&&e.charCodeAt(a)!==oa||e.charCodeAt(++a)===oa;);return(t=a)>=i?c=!0:(o=e.charCodeAt(a++))===sa?l=!0:o===ca&&(l=!0,e.charCodeAt(a)===sa&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a<i;){if((o=e.charCodeAt(t=a++))===sa)l=!0;else if(o===ca)l=!0,e.charCodeAt(a)===sa&&++a;else if(o!==n)continue;return e.slice(r,t)}return c=!0,e.slice(r,i)}for(;(s=u())!==aa;){for(var d=[];s!==ia&&s!==aa;)d.push(s),s=u();t&&(d=t(d,o++))==null||r.push(d)}return r}function a(t,n){return t.map(function(t){return n.map(function(e){return u(t[e])}).join(e)})}function o(t,n){return n??=da(t),[n.map(u).join(e)].concat(a(t,n)).join(`
|
|
3
3
|
`)}function s(e,t){return t??=da(e),a(e,t).join(`
|
|
4
4
|
`)}function c(e){return e.map(l).join(`
|