@dimina-kit/devtools 0.4.0-dev.20260728065133 → 0.4.0-dev.20260728095034
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/main/app/app.js +11 -3
- package/dist/main/index.bundle.js +319 -81
- package/dist/main/ipc/settings.js +4 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +6 -3
- package/dist/main/services/mcp/tools/project-tools.d.ts +49 -0
- package/dist/main/services/mcp/tools/project-tools.js +121 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +11 -0
- package/dist/main/services/notifications/renderer-notifier.js +3 -0
- package/dist/main/services/workbench-context.d.ts +14 -0
- package/dist/main/services/workbench-context.js +9 -1
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/native-host/common/common.js +58 -154
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +3297 -6602
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/renderer/assets/index-BJlFbXHb.js +49 -0
- package/dist/renderer/assets/{input-dsgeTmVX.js → input-xdmfv-eH.js} +2 -2
- package/dist/renderer/assets/{ipc-transport-BgFdT9bT.js → ipc-transport-B3EpmfNS.js} +2 -2
- package/dist/renderer/assets/popover-B88e2hkg.js +2 -0
- package/dist/renderer/assets/{select-DAw1hzkl.js → select-CD9CJyhI.js} +2 -2
- package/dist/renderer/assets/settings-44hf0QtO.js +2 -0
- package/dist/renderer/assets/settings-api-pJKPuP1M.js +2 -0
- package/dist/renderer/assets/workbenchSettings-DKD5U1Ql.js +8 -0
- package/dist/renderer/entries/main/index.html +5 -5
- package/dist/renderer/entries/popover/index.html +4 -4
- package/dist/renderer/entries/settings/index.html +4 -4
- package/dist/renderer/entries/workbench-settings/index.html +3 -3
- package/dist/shared/ipc-channels.d.ts +2 -0
- package/dist/shared/ipc-channels.js +2 -0
- package/package.json +6 -6
- package/dist/renderer/assets/index-M5NDq_vi.js +0 -49
- package/dist/renderer/assets/popover-Disfu1cx.js +0 -2
- package/dist/renderer/assets/settings-M_8GFW2M.js +0 -2
- package/dist/renderer/assets/settings-api-DFR5eDl_.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CxdXeoOu.js +0 -8
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
closes the overlay — mirrors the popover entry. */
|
|
12
12
|
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: transparent !important; }
|
|
13
13
|
</style>
|
|
14
|
-
<script type="module" crossorigin src="../../assets/settings-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="../../assets/input-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="../../assets/settings-api-
|
|
14
|
+
<script type="module" crossorigin src="../../assets/settings-44hf0QtO.js"></script>
|
|
15
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-B3EpmfNS.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="../../assets/input-xdmfv-eH.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="../../assets/settings-api-pJKPuP1M.js">
|
|
18
18
|
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<!-- See entries/main/index.html for CSP rationale. -->
|
|
7
7
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: http: https:; font-src 'self' data:; media-src 'self' blob: http: https:; connect-src 'self' http: https: ws: wss:;" />
|
|
8
8
|
<title>开发工具设置</title>
|
|
9
|
-
<script type="module" crossorigin src="../../assets/workbenchSettings-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="../../assets/settings-api-
|
|
9
|
+
<script type="module" crossorigin src="../../assets/workbenchSettings-DKD5U1Ql.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-B3EpmfNS.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="../../assets/settings-api-pJKPuP1M.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="../../assets/constants-EAMiwL9_.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
14
14
|
</head>
|
|
@@ -116,6 +116,7 @@ export declare const WorkbenchSettingsChannel: {
|
|
|
116
116
|
readonly Get: "workbenchSettings:get";
|
|
117
117
|
readonly Save: "workbenchSettings:save";
|
|
118
118
|
readonly SetTheme: "workbenchSettings:setTheme";
|
|
119
|
+
readonly Restart: "workbenchSettings:restart";
|
|
119
120
|
readonly GetCdpStatus: "workbenchSettings:getCdpStatus";
|
|
120
121
|
readonly GetMcpStatus: "workbenchSettings:getMcpStatus";
|
|
121
122
|
readonly Init: "workbenchSettings:init";
|
|
@@ -239,6 +240,7 @@ export declare const PopoverChannel: {
|
|
|
239
240
|
};
|
|
240
241
|
export declare const WindowChannel: {
|
|
241
242
|
readonly NavigateBack: "window:navigateBack";
|
|
243
|
+
readonly OpenProject: "window:openProject";
|
|
242
244
|
readonly ScreenState: "window:screenState";
|
|
243
245
|
};
|
|
244
246
|
export declare const AppChannel: {
|
|
@@ -115,6 +115,7 @@ export const WorkbenchSettingsChannel = {
|
|
|
115
115
|
Get: 'workbenchSettings:get',
|
|
116
116
|
Save: 'workbenchSettings:save',
|
|
117
117
|
SetTheme: 'workbenchSettings:setTheme',
|
|
118
|
+
Restart: 'workbenchSettings:restart',
|
|
118
119
|
GetCdpStatus: 'workbenchSettings:getCdpStatus',
|
|
119
120
|
GetMcpStatus: 'workbenchSettings:getMcpStatus',
|
|
120
121
|
Init: 'workbenchSettings:init',
|
|
@@ -265,6 +266,7 @@ export const PopoverChannel = {
|
|
|
265
266
|
// ── Window ───────────────────────────────────────────────────────────────
|
|
266
267
|
export const WindowChannel = {
|
|
267
268
|
NavigateBack: 'window:navigateBack',
|
|
269
|
+
OpenProject: 'window:openProject',
|
|
268
270
|
// Renderer → main: the renderer's current top-level screen ('project' when
|
|
269
271
|
// inside a project screen, 'list' on the project list / landing). The
|
|
270
272
|
// renderer pushes this on every screen change, including the moment it enters
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina-kit/devtools",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.20260728095034",
|
|
4
4
|
"description": "Dimina DevTools - modular developer tools for mini app debugging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dimina",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"chrome-remote-interface": "^0.34.0",
|
|
86
86
|
"ws": "^8.20.0",
|
|
87
87
|
"zod": "^4.3.6",
|
|
88
|
-
"@dimina-kit/devkit": "0.1.2-dev.
|
|
89
|
-
"@dimina-kit/
|
|
90
|
-
"@dimina-kit/
|
|
91
|
-
"@dimina-kit/electron-deck": "0.1.0-dev.
|
|
88
|
+
"@dimina-kit/devkit": "0.1.2-dev.20260728095034",
|
|
89
|
+
"@dimina-kit/view-anchor": "0.1.0-dev.20260728095034",
|
|
90
|
+
"@dimina-kit/inspect": "0.4.0-dev.20260728095034",
|
|
91
|
+
"@dimina-kit/electron-deck": "0.1.0-dev.20260728095034"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@playwright/test": "^1.59.1",
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
"typescript": "5.9.2",
|
|
133
133
|
"vite": "^8.0.8",
|
|
134
134
|
"vitest": "^4.1.4",
|
|
135
|
-
"@dimina-kit/typescript-config": "0.1.0",
|
|
136
135
|
"@dimina-kit/eslint-config": "0.1.0",
|
|
136
|
+
"@dimina-kit/typescript-config": "0.1.0",
|
|
137
137
|
"@dimina-kit/workbench": "0.1.0"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,T as r,_ as i,a,d as o,g as s,h as c,l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _,w as v}from"./ipc-transport-BgFdT9bT.js";import{n as y,r as b,t as x}from"./input-dsgeTmVX.js";import{_ as S,a as C,b as w,d as T,f as E,g as ee,h as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as ce,s as le,t as ue,u as de,v as fe,y as pe}from"./select-DAw1hzkl.js";import{n as me}from"./constants-EAMiwL9_.js";import{l as he}from"./settings-api-DFR5eDl_.js";var ge=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),_e=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ve=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ye=e=>{let t=ve(e);return t.charAt(0).toUpperCase()+t.slice(1)},be={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},xe=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=t(r()),Se=(0,D.createContext)({}),Ce=()=>(0,D.useContext)(Se),we=(0,D.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ce()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,D.createElement)(`svg`,{ref:c,...be,width:t??l??be.width,height:t??l??be.height,stroke:e??f,strokeWidth:m,className:ge(`lucide`,p,i),...!a&&!xe(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,D.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Te=(e,t)=>{let n=(0,D.forwardRef)(({className:n,...r},i)=>(0,D.createElement)(we,{ref:i,iconNode:t,className:ge(`lucide-${_e(ye(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ye(e),n},Ee=Te(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),De=Te(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Oe=t(e(),1),O=n();function ke({project:e,onOpen:t,onRemove:n,thumbnail:r}){let[i,a]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`relative bg-surface border border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5`,onClick:()=>t(e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[r?(0,O.jsx)(`img`,{src:r,className:`h-28 w-full object-cover object-top`,alt:``}):(0,O.jsx)(`div`,{className:`h-28 bg-surface-thumb`}),(0,O.jsxs)(`div`,{className:`p-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium text-text-white mb-1 truncate`,title:e.name,children:e.name}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-secondary truncate`,title:e.path,children:e.path}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-dim mt-1.5`,children:b(e.lastOpened)})]}),i&&(0,O.jsx)(w,{variant:`danger`,size:`icon-sm`,className:`absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-overlay text-text-secondary leading-none hover:text-status-error hover:bg-danger-bg`,onClick:t=>{t.stopPropagation(),n(e)},title:`移除`,children:`×`})]})}function Ae(e){return(0,O.jsxs)(`button`,{type:`button`,onClick:e.onClick,"aria-label":`新建项目`,className:`relative bg-transparent border-2 border-dashed border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5 h-full min-h-[188px] flex flex-col items-center justify-center gap-2 text-text-secondary hover:text-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`span`,{className:`text-3xl leading-none`,"aria-hidden":`true`,children:`+`}),(0,O.jsx)(`span`,{className:`text-sm font-medium`,children:`新建项目`})]})}function je({projects:e,onAdd:t,onCreate:n,onOpen:r,onRemove:i,thumbnails:a}){let[o,s]=(0,D.useState)(``),c=(0,D.useMemo)(()=>{if(!o.trim())return e;let t=o.trim().toLowerCase();return e.filter(e=>(e.name||``).toLowerCase().includes(t)||(e.path||``).toLowerCase().includes(t))},[e,o]),l=n??(()=>{}),u=e.length>0&&c.length===0;return(0,O.jsx)(`div`,{className:`flex flex-col h-screen bg-bg`,children:(0,O.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between mb-6 gap-4`,children:[(0,O.jsx)(`div`,{className:`flex items-center flex-1 max-w-xs min-w-0`,children:(0,O.jsxs)(`div`,{className:`relative w-full`,children:[(0,O.jsx)(Ee,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-secondary pointer-events-none`}),(0,O.jsx)(x,{placeholder:`搜索`,value:o,onChange:e=>s(e.target.value),className:`w-full h-8 pl-8 pr-3 rounded-md text-sm`})]})}),(0,O.jsx)(w,{variant:`ghost`,size:`sm`,onClick:t,className:`shrink-0 text-accent hover:text-accent-hover hover:bg-transparent`,children:`导入`})]}),u?(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-72 text-text-dim gap-3`,children:[(0,O.jsx)(`span`,{className:`text-5xl opacity-40`,children:`🔍`}),(0,O.jsx)(`span`,{className:`text-sm`,children:`未找到匹配的项目`})]}):(0,O.jsxs)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:[(0,O.jsx)(Ae,{onClick:l}),c.map(e=>(0,O.jsx)(ke,{project:e,onOpen:r,onRemove:i,thumbnail:a?.[e.path]},e.path))]})]})})}function Me(e){return e.trim().replace(/[\\/:*?"<>|]+/g,`-`).replace(/\s+/g,`-`).replace(/-{2,}/g,`-`).replace(/^[-.]+|[-.]+$/g,``)}function Ne(e,t){return t?e?e.endsWith(`/`)?`${e}${t}`:`${e}/${t}`:t:``}function Pe(e){let{open:t,templates:n,defaultBaseDir:r,onSubmit:i,onCancel:a,onBrowse:o}=e,[s,c]=(0,D.useState)(``),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(n[0]?.id??`blank`),p=(0,D.useRef)(!1);if((0,D.useEffect)(()=>{n.find(e=>e.id===d)||f(n[0]?.id??`blank`)},[n,d]),(0,D.useEffect)(()=>{t&&(c(``),u(``),p.current=!1)},[t]),!t)return null;let m=s.trim().length>0&&l.trim().length>0;function h(e){if(c(e),!p.current){let t=Me(e);u(t?Ne(r??``,t):``)}}function g(e){p.current=!0,u(e)}async function _(){let e=await o();e&&(p.current=!0,u(e))}function v(){m&&i({name:s.trim(),path:l.trim(),templateId:d})}return(0,O.jsx)(`div`,{role:`dialog`,"aria-label":`新建项目`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,children:(0,O.jsxs)(`div`,{className:`bg-surface rounded-lg shadow-lg w-[560px] max-w-[90vw] p-6`,children:[(0,O.jsx)(`h2`,{className:`text-base font-semibold text-text-white mb-4`,children:`新建项目`}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`项目名`}),(0,O.jsx)(`input`,{"aria-label":`项目名`,type:`text`,value:s,onChange:e=>h(e.target.value),placeholder:`My App`,className:`h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`})]}),(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`目录`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":`目录`,type:`text`,value:l,onChange:e=>g(e.target.value),placeholder:`/absolute/path/to/dir`,className:`flex-1 h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`}),(0,O.jsx)(`button`,{type:`button`,onClick:_,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`浏览`})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`模板`}),(0,O.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(160px, 1fr))`},children:n.map(e=>{let t=e.id===d;return(0,O.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:[`text-left p-3 rounded-md border`,t?`border-accent text-text-white bg-accent/10`:`border-border text-text-secondary hover:border-accent`].join(` `),"aria-pressed":t,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),e.description?(0,O.jsx)(`div`,{className:`text-[11px] mt-1 text-text-dim`,children:e.description}):null]},e.id)})})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:a,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`取消`}),(0,O.jsx)(`button`,{type:`button`,onClick:v,disabled:!m,className:`px-3 h-8 rounded-md text-sm bg-accent text-white disabled:opacity-40 disabled:cursor-not-allowed`,children:`创建`})]})]})})}function Fe(){return h(a.GetBranding)}function Ie(){return u(g.List)}function Le(){return h(d.OpenDirectory)}function Re(e){return u(g.Add,e)}function ze(e){return h(g.Remove,e)}function Be(e){return u(l.Open,e)}function Ve(e){return u(l.GetPages,e)}function He(e){return u(l.GetCompileConfig,e)}function Ue(e,t){return u(l.SaveCompileConfig,e,t)}function We(e){return p(l.Status,t=>e(t))}function Ge(e){return p(l.CompileLog,t=>e(t))}function Ke(e){return p(o.RuntimeStatus,t=>e(t))}function qe(e){return h(l.CaptureThumbnail,e)}function Je(e){return h(l.GetThumbnail,e)}function Ye(){return u(g.ListTemplates)}function Xe(){return h(g.OpenCreateDialog)}function Ze(e){return u(g.Create,e)}function Qe(){return u(g.GetCreateDefaults)}function $e(){return h(m.Open)}var et={selected:`simulator`,simulatorVisible:!0};function tt(e){return e+48}function nt(e,t){return Math.max(200,Math.min(t-200,e))}function rt(e){let{initialDevice:t}=e,[n,r]=(0,D.useState)(t),[i,a]=(0,D.useState)(85),[o,s]=(0,D.useState)(()=>tt(t.width)),c=(0,D.useRef)(o),l=(0,D.useRef)(n);(0,D.useEffect)(()=>{c.current=o},[o]),(0,D.useEffect)(()=>{l.current=n},[n]);let u=(0,D.useCallback)(e=>{se({brand:`Apple`,model:e.name,system:e.system,platform:`ios`,pixelRatio:e.pixelRatio,screenWidth:e.width,screenHeight:e.height,statusBarHeight:e.statusBarHeight,notchType:e.notchType,safeAreaInsets:{...e.safeAreaInsets}})},[]);return{device:n,zoom:i,simPanelWidth:o,setSimPanelWidth:s,handleDeviceChange:(0,D.useCallback)(e=>{let t=fe.find(t=>t.name===e.target.value)??fe[1];r(t),u(t),s(tt(t.width))},[u]),handleZoomChange:(0,D.useCallback)(e=>{a(e.target.value===`auto`?ee:Number(e.target.value))},[]),handleSplitterDrag:(0,D.useCallback)((e,t=`trailing`)=>{e.preventDefault();let n=e.clientX,r=c.current,i=e=>{let i=e.clientX-n;s(nt(r+(t===`trailing`?i:-i),window.innerWidth))},a=()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},[]),sendDeviceInfo:u,simPanelWidthRef:c,deviceRef:l}}var it=200,at=300;function ot(e){let{projectPath:t}=e,[n,r]=(0,D.useState)({status:`compiling`,message:`正在编译...`}),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)([]),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)({startPage:``,scene:me,queryParams:[]});(0,D.useEffect)(()=>{let e=!1;async function n(){try{let n=await Be(t);if(e)return;if(!n.success){r({status:`error`,message:n.error});return}let[i,o]=await Promise.all([Ve(t),He(t)]);if(e)return;a(n.appInfo),l(n.port),s(i.pages),d({startPage:o.startPage||i.entryPagePath||i.pages[0]||``,scene:o.scene??1001,queryParams:o.queryParams||[]}),r({status:`ready`,message:`编译完成`})}catch(t){if(e)return;r({status:`error`,message:t instanceof Error?t.message:String(t)})}}return n(),()=>{e=!0}},[t]);let[f,p]=(0,D.useState)(0),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)([]),v=(0,D.useRef)(0),[y,b]=(0,D.useState)(null),[x,S]=(0,D.useState)(!1);(0,D.useEffect)(()=>{h([]),_([]),b(null),S(!1)},[t]),(0,D.useEffect)(()=>We(e=>{r(e),e.pages&&s(e.pages),e.watcher===`dead`&&S(!0);let t=++v.current;h(n=>{let r=e.hotReload===!0?{at:Date.now(),status:e.status,message:e.message,hotReload:!0,seq:t}:{at:Date.now(),status:e.status,message:e.message,seq:t},i=[...n,r];return i.length>it?i.slice(i.length-it):i}),e.hotReload===!0&&(b(null),p(e=>e+1))}),[]),(0,D.useEffect)(()=>Ke(e=>{i?.appId&&e.appId!==i.appId||b(e)}),[i]),(0,D.useEffect)(()=>Ge(e=>{let t=++v.current;_(n=>{let r=[...n,{...e,seq:t}];return r.length>at?r.slice(r.length-at):r})}),[]);let C=(0,D.useCallback)(()=>{h([]),_([])},[]),w=(0,D.useRef)(!1),[T,E]=(0,D.useState)(0);return{compileStatus:n,appInfo:i,port:c,pages:o,compileConfig:u,hotReloadToken:f,compileEvents:m,compileLogs:g,clearCompileEvents:C,relaunch:(0,D.useCallback)(async(e=u)=>{try{if(!i?.appId||w.current)return;w.current=!0,r({status:`ready`,message:`正在刷新...`});try{await Ue(t,e),d(e),E(e=>e+1),r({status:`ready`,message:`刷新完成`})}finally{w.current=!1}}catch(e){w.current=!1,r({status:`error`,message:e instanceof Error?e.message:`刷新失败`})}},[i,u,t]),relaunchNonce:T,runtimeStatus:y,watcherDead:x}}var st=[`appId`,`entry`,`page`];function ct(e){return encodeURIComponent(e).replace(/%2F/g,`/`).replace(/%2C/g,`,`)}function lt(e){let t=Object.keys(e.query);if(t.length===0)return e.pagePath;let n=t.map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e.query[t]??``)}`).join(`&`);return`${e.pagePath}?${n}`}function ut(e){let t=e.indexOf(`?`);if(t<0)return{pagePath:e,query:{}};let n=e.slice(0,t),r={};for(let n of e.slice(t+1).split(`&`)){if(!n)continue;let e=n.indexOf(`=`),t=e>=0?n.slice(0,e):n,i=e>=0?n.slice(e+1):``;t&&(r[decodeURIComponent(t)]=decodeURIComponent(i))}return{pagePath:n,query:r}}function dt(e,t,n={}){let r=lt(t),i=[`appId=${ct(e)}`,`entry=${ct(r)}`,`page=${ct(r)}`];for(let[e,t]of Object.entries(n))st.includes(e)||i.push(`${encodeURIComponent(e)}=${ct(t)}`);return i.join(`&`)}function ft(e){let t=e.host??`localhost`,n=e.pathname??`/simulator.html`,r=dt(e.appId,e.page,e.extras??{});return`http://${t}:${e.port}${n}?${r}`}function pt(e,t,n,r){let i=t.startPage||`pages/index/index`,a={};for(let e of t.queryParams??[])e.key&&(a[e.key]=e.value);a.scene=String(t.scene??1001);let o={};return r?.length&&(o.apiNamespaces=r.join(`,`)),ft({appId:e,page:{pagePath:i,query:a},port:n,extras:o})}function mt(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),n=t.get(`appId`),r=t.get(`entry`);if(!n||!r)return null;let i=ut(r),a=t.get(`page`);return{appId:n,entry:i,current:a&&a!==r?ut(a):i}}function ht(e){if(!e)return null;try{return mt(new URL(e).search)}catch{return null}}function gt(e){return ht(e)?.current.pagePath??``}function _t(e){let{compileStatus:t,sendDeviceInfo:n,simPanelWidthRef:r,deviceRef:i,appInfo:a,compileConfig:o,port:s,projectPath:c,hotReloadToken:l,relaunchNonce:u}=e,d=(0,D.useMemo)(()=>!a||!s?``:pt(a.appId,o,s),[a,o,s]),[f,p]=(0,D.useState)(()=>gt(d));(0,D.useEffect)(()=>{p(gt(d))},[d]),(0,D.useEffect)(()=>de(e=>{e&&p(e)}),[]);let m=(0,D.useRef)({currentPage:f,compileConfig:o,appInfo:a,port:s});(0,D.useEffect)(()=>{m.current={currentPage:f,compileConfig:o,appInfo:a,port:s}});let h=(0,D.useRef)(l);return(0,D.useEffect)(()=>{if(t.status!==`ready`||!d)return;let e=l!==h.current;h.current=l;let a=d;if(e){let e=m.current;if(e.appInfo&&e.port){let t=e.currentPage||e.compileConfig.startPage;a=pt(e.appInfo.appId,t===e.compileConfig.startPage?e.compileConfig:{...e.compileConfig,startPage:t,queryParams:[]},e.port)}}n(i.current);let o=!1,s=null,u=()=>{o||(s=window.setTimeout(()=>{o||qe(c).catch(()=>{})},3e3))},f=()=>{ae(a,r.current).then(u).catch(()=>{})};return e?te(a).then(e=>{if(!o){if(e===!0){u();return}f()}}).catch(()=>{o||f()}):f(),()=>{o=!0,s!==null&&window.clearTimeout(s)}},[t.status,d,l,u,r,i,n,c]),{simulatorUrl:d,currentPage:f}}function vt(){return{getSnapshot:async()=>await h(i.GetSnapshot)??null,subscribe:e=>p(i.Event,e),setActive:e=>{h(i.SetActive,e)},inspect:async e=>await h(c.Inspect,e)??null,clearInspection:async()=>{await h(c.Clear)}}}var yt={ok:!1,error:`ipc transport failed`};function bt(){return{getSnapshot:async()=>await h(s.GetSnapshot)??[],subscribe:e=>p(s.Event,e),setActive:()=>{},setItem:async(e,t)=>await h(s.Set,{key:e,value:t})??yt,removeItem:async e=>await h(s.Remove,{key:e})??yt,clear:async()=>await h(s.Clear)??yt,clearAll:async()=>await h(s.ClearAll)??yt,getPrefix:async()=>await h(s.GetActivePrefix)??``}}var xt={bridges:[],entries:{}};function St(){return{getSnapshot:async()=>await h(f.GetSnapshot)??xt,subscribe:e=>p(f.Event,e),setActive:()=>{},setData:async(e,t)=>await h(f.SetData,{bridgeId:e,data:t})??!1}}function Ct(e){let{compileStatus:t}=e,n=t.status===`ready`;return{wxmlSource:(0,D.useMemo)(()=>vt(),[]),wxmlEnabled:n,storageSource:(0,D.useMemo)(()=>bt(),[]),storageEnabled:n,appDataSource:(0,D.useMemo)(()=>St(),[]),appDataEnabled:n}}function wt(e){let{initialRightPane:t}=e,[n,r]=(0,D.useState)(t);return{rightPane:n,selectRightPane:(0,D.useCallback)(e=>{r({selected:e,simulatorVisible:!0})},[]),toggleRightPaneVisible:(0,D.useCallback)(()=>{r(e=>({...e,simulatorVisible:!e.simulatorVisible}))},[])}}function Tt(e){let{relaunch:t,compileConfig:n,pages:r,compileDropdownRef:i}=e,[a,o]=(0,D.useState)(!1),s=(0,D.useRef)(t);(0,D.useEffect)(()=>{s.current=t},[t]),(0,D.useEffect)(()=>{let e=le(()=>o(!1)),t=re(e=>{o(!1),s.current(e)});return()=>{e(),t()}},[]);let c=(0,D.useRef)(n),l=(0,D.useRef)(r);return(0,D.useEffect)(()=>{c.current=n},[n]),(0,D.useEffect)(()=>{l.current=r},[r]),{showCompilePanel:a,toggleCompilePanel:(0,D.useCallback)(()=>{o(e=>{if(e)return ne(),!1;let t=i.current;if(!t)return e;let n=t.getBoundingClientRect();return ie({top:Math.round(n.bottom-40+6),left:Math.round(n.left),config:c.current,pages:l.current}),!0})},[i])}}function Et(e){let{projectPath:t,initialDevice:n=fe[1],initialRightPane:r=et}=e,i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=rt({initialDevice:n}),s=ot({projectPath:t});(0,D.useEffect)(()=>{s.compileStatus.status===`ready`&&o.setSimPanelWidth(o.device.width+48)},[o.device.width,s.compileStatus.status,o.setSimPanelWidth]);let c=_t({compileStatus:s.compileStatus,sendDeviceInfo:o.sendDeviceInfo,simPanelWidthRef:o.simPanelWidthRef,deviceRef:o.deviceRef,appInfo:s.appInfo,compileConfig:s.compileConfig,port:s.port,projectPath:t,hotReloadToken:s.hotReloadToken,relaunchNonce:s.relaunchNonce}),l=Ct({compileStatus:s.compileStatus,activePagePath:c.currentPage}),u=wt({initialRightPane:r}),d=Tt({relaunch:s.relaunch,compileConfig:s.compileConfig,pages:s.pages,compileDropdownRef:a});return{session:{compileStatus:s.compileStatus,appInfo:s.appInfo,port:s.port,pages:s.pages,compileConfig:s.compileConfig,compileEvents:s.compileEvents,compileLogs:s.compileLogs,clearCompileEvents:s.clearCompileEvents,relaunch:s.relaunch,runtimeStatus:s.runtimeStatus,watcherDead:s.watcherDead},device:{device:o.device,zoom:o.zoom,simPanelWidth:o.simPanelWidth,setSimPanelWidth:o.setSimPanelWidth,handleDeviceChange:o.handleDeviceChange,handleZoomChange:o.handleZoomChange,handleSplitterDrag:o.handleSplitterDrag,sendDeviceInfo:o.sendDeviceInfo},simulator:{simulatorRef:i,simulatorUrl:c.simulatorUrl,currentPage:c.currentPage},panelData:{wxmlSource:l.wxmlSource,wxmlEnabled:l.wxmlEnabled,storageSource:l.storageSource,storageEnabled:l.storageEnabled,appDataSource:l.appDataSource,appDataEnabled:l.appDataEnabled},rightPane:{rightPane:u.rightPane,selectRightPane:u.selectRightPane,toggleRightPaneVisible:u.toggleRightPaneVisible},popover:{compileDropdownRef:a,showCompilePanel:d.showCompilePanel,toggleCompilePanel:d.toggleCompilePanel}}}var Dt={dockTree:null,simulatorAlignment:`left`,devtoolsPosition:`inEditor`},Ot=`dimina-devtools.layout.v1`;function kt(){try{let e=window.localStorage.getItem(Ot);if(!e)return Dt;let t=JSON.parse(e);return{dockTree:typeof t.dockTree==`string`?t.dockTree:null,simulatorAlignment:t.simulatorAlignment===`right`?`right`:`left`,devtoolsPosition:t.devtoolsPosition===`belowSimulator`||t.devtoolsPosition===`rightOfSimulator`?t.devtoolsPosition:`inEditor`}}catch{return Dt}}function At(e){try{window.localStorage.setItem(Ot,JSON.stringify(e))}catch{}}function jt(){let[e,t]=(0,D.useState)(kt);return(0,D.useEffect)(()=>{At(e)},[e]),{state:e,setDockTree:(0,D.useCallback)(e=>{t(t=>t.dockTree===e?t:{...t,dockTree:e})},[]),setSimulatorAlignment:(0,D.useCallback)(e=>{t(t=>t.simulatorAlignment===e?t:{...t,simulatorAlignment:e})},[]),setDevtoolsPosition:(0,D.useCallback)(e=>{t(t=>t.devtoolsPosition===e?t:{...t,devtoolsPosition:e})},[])}}var Mt={compiling:`bg-status-warn animate-[pulse_1s_infinite]`,ready:`bg-accent`,error:`bg-status-error`};function Nt({status:e}){return(0,O.jsx)(`span`,{className:y(`w-1.5 h-1.5 rounded-full shrink-0`,Mt[e]??`bg-border`)})}function Pt(){let e=new Map;return{register(t){return e.set(t.id,t),{dispose(){e.get(t.id)===t&&e.delete(t.id)}}},get(t){return e.get(t)},list(){return[...e.values()]}}}var Ft=64;function It(e){return JSON.stringify(e)}function Lt(e,t,n,r){e===void 0?r.push(`node missing string id (kind=${String(t)})`):n.seenIds.has(e)?r.push(`duplicate node id: ${e}`):n.seenIds.add(e)}function Rt(e,t,n,r){if(typeof e!=`string`){r.push(`tabs ${t??`?`}: non-string panel id`);return}n.panelOwners.get(e)===void 0?n.panelOwners.set(e,t??`?`):r.push(`duplicate panel id across groups: ${e}`),n.knownPanelIds&&!n.knownPanelIds.has(e)&&r.push(`orphan panel not in known panel ids: ${e}`)}function zt(e,t,n,r){let i=e,a=Array.isArray(i.panels)?i.panels:null;if(!a){r.push(`tabs ${t??`?`}: panels is not an array`);return}a.length===0&&r.push(`tabs ${t??`?`}: empty tabgroup`);for(let e of a)Rt(e,t,n,r);let o=i.active;(typeof o!=`string`||!a.includes(o))&&r.push(`tabs ${t??`?`}: active ${String(o)} not in panels`)}function Bt(e,t,n){if(e===null)return!1;if(typeof e!=`object`)return n.push(`split ${t??`?`}: constraint is not null nor an object: ${String(e)}`),!1;let r=Object.keys(e),i=r.includes(`fixedPx`),a=r.includes(`minPx`);(r.length!==1||!(i||a))&&n.push(`split ${t??`?`}: constraint must have exactly one of 'fixedPx' or 'minPx', got [${r.join(`, `)}]`);let o=i?`fixedPx`:`minPx`,s=i?e.fixedPx:e.minPx;return(typeof s!=`number`||!Number.isFinite(s)||s<=0)&&n.push(`split ${t??`?`}: constraint ${o} must be a finite number > 0, got ${String(s)}`),!0}function Vt(e,t,n){let r=Array.isArray(e)?e:null;if(!r){n.push(`split ${t??`?`}: constraints is not an array`);return}let i=r.length>0;for(let e of r)Bt(e,t,n)||(i=!1);i&&n.push(`split ${t??`?`}: all children are px-sized constraints; at least one must be weight-sized`)}function Ht(e,t,n,r){if(!e||e.length!==t.length){r.push(`split ${n??`?`}: sizes ${e?e.length:`missing`} != children ${t.length}`);return}for(let t of e)(typeof t!=`number`||!Number.isFinite(t))&&r.push(`split ${n??`?`}: non-finite size ${String(t)}`)}function Ut(e,t){let n=[],r={seenIds:new Set,seenObjects:new Set,panelOwners:new Map,knownPanelIds:t},i=(e,t,a)=>{if(t>Ft){n.push(`depth exceeds ${Ft}`);return}if(typeof e!=`object`||!e){n.push(`node is not an object: ${String(e)}`);return}let o=e;if(a.has(o)){n.push(`cycle detected: node reachable from itself`);return}if(r.seenObjects.has(o)){n.push(`shared node reference: same object appears twice`);return}r.seenObjects.add(o);let s=e,c=s.kind,l=typeof s.id==`string`?s.id:void 0;Lt(l,c,r,n),c===`tabs`?zt(e,l,r,n):c===`split`?Wt(e,l,t,a,o,r,n,i):n.push(`unknown node kind: ${String(c)}`)};return i(e,0,new Set),n}function Wt(e,t,n,r,i,a,o,s){let c=e,l=Array.isArray(c.children)?c.children:null,u=Array.isArray(c.sizes)?c.sizes:null,d=c.orientation;if(d!==`row`&&d!==`column`&&o.push(`split ${t??`?`}: invalid orientation ${String(d)}`),c.constraints!==void 0&&Vt(c.constraints,t,o),!l){o.push(`split ${t??`?`}: children is not an array`);return}if(l.length<2&&o.push(`split ${t??`?`}: must have >= 2 children, has ${l.length}`),Ht(u,l,t,o),c.constraints!==void 0&&Array.isArray(c.constraints)){let e=c.constraints;e.length!==l.length&&o.push(`split ${t??`?`}: constraints ${e.length} != children ${l.length}`)}let f=new Set(r);f.add(i);for(let e of l)s(e,n+1,f)}function Gt(e,t){return typeof e!=`object`||!e?[`tree is not an object`]:e.version===1?Ut(e.root,t):[`unsupported version: ${String(e.version)}`]}function Kt(e){let t;try{t=JSON.parse(e)}catch{throw Error(`parseLayout: input is not valid JSON`)}if(typeof t!=`object`||!t)throw Error(`parseLayout: top-level value is not an object`);let n=t;if(n.version!==1)throw Error(`parseLayout: unsupported version ${String(n.version)}`);if(n.root===void 0||n.root===null)throw Error(`parseLayout: missing root`);let r=Ut(n.root,null);if(r.length>0)throw Error(`parseLayout: illegal layout — ${r.join(`; `)}`);return{version:1,root:n.root}}var qt=1;function Jt(e,t){return(e.constraints?.[t]??null)===null}function Yt(e){if(e.kind===`tabs`)return e;let t=e.children.map(Yt),n=t.some((t,n)=>t!==e.children[n]),r=e.sizes.map((t,r)=>!Jt(e,r)||typeof t==`number`&&Number.isFinite(t)&&t>0?t:(n=!0,qt));if(!n)return e;let i={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:r};return e.constraints===void 0?i:{...i,constraints:e.constraints}}function Xt(e){let t=Yt(e.root);return t===e.root?e:{version:1,root:t}}function Zt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.id===t&&(n=e):e.children.forEach(r))};return r(e),n}function Qt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.panels.includes(t)&&(n=e):e.children.forEach(r))};return r(e),n}function $t(e,t){return Qt(e,t)?.id}function en(e){return e.kind===`tabs`?e.panels.length:e.children.reduce((e,t)=>e+en(t),0)}function k(e,t,n){return{kind:`tabs`,id:e,panels:t,active:n}}function tn(e,t,n){if(e.length===0)return``;if(e.includes(t))return t;let r=Math.min(n,e.length-1);return e[Math.max(0,r)]}function nn(e){if(e.kind===`tabs`)return e.panels.length===0?null:e;let t=[],n=[],r=[],i=e.constraints!==void 0;if(e.children.forEach((a,o)=>{let s=nn(a);s!==null&&(t.push(s),n.push(e.sizes[o]??1),i&&r.push(e.constraints[o]??null))}),t.length===0)return null;if(t.length===1)return t[0];let a={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:n};return i?(r.length>0&&!r.some(e=>e===null)&&(r[r.length-1]=null),{...a,constraints:r}):a}function A(e){let t=nn(e);if(t===null)throw Error(`mutation would empty the entire layout`);return t}function rn(e){let t=new Set,n=e=>{if(e.kind===`tabs`)for(let n of e.panels)t.add(n);else e.children.forEach(n)};return n(e),t}function an(e,t){return rn(e).has(t)}function on(e){let t=new Set,n=e=>{t.add(e.id),e.kind===`split`&&e.children.forEach(n)};return n(e),t}function j(e,t){let n=t,r=2;for(;e.has(n);)n=`${t}#${r}`,r+=1;return e.add(n),n}function sn(e,t){let n=null,r=e=>{n||e.kind===`split`&&(e.id===t&&(n=e),e.children.forEach(r))};return r(e),n}function M(e,t,n){if(e.id===t)return n;if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let r={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(e=>M(e,t,n)),sizes:[...e.sizes]};return e.constraints===void 0?r:{...r,constraints:[...e.constraints]}}function cn(e){if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let t={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(cn),sizes:[...e.sizes]};return e.constraints===void 0?t:{...t,constraints:[...e.constraints]}}function N(e){return{version:1,root:e}}function ln(e,t,n){let r=sn(e.root,t);if(!r)throw Error(`setSizes: split not found: ${t}`);if(n.length!==r.children.length)throw Error(`setSizes: sizes length ${n.length} != children length ${r.children.length}`);if(!n.every(e=>Number.isFinite(e)))throw Error(`setSizes: every size must be a finite number, got [${n.join(`, `)}]`);let i={kind:`split`,id:r.id,orientation:r.orientation,children:r.children.map(cn),sizes:[...n]},a=r.constraints===void 0?i:{...i,constraints:[...r.constraints]};return N(M(e.root,t,a))}function un(e,t,n,r){let i=sn(e.root,t);if(!i)throw Error(`setConstraint: split not found: ${t}`);if(!Number.isInteger(n))throw Error(`setConstraint: childIndex must be an integer, got ${n}`);if(n<0||n>=i.children.length)throw Error(`setConstraint: childIndex ${n} out of range [0, ${i.children.length})`);let a=i.constraints===void 0?i.children.map(()=>null):[...i.constraints];if(a[n]=r,a.length>0&&a.every(e=>e!==null))return e;let o={kind:`split`,id:i.id,orientation:i.orientation,children:i.children.map(cn),sizes:[...i.sizes],constraints:a};return N(M(e.root,t,o))}function dn(e,t,n){let r=Zt(e.root,t);if(!r)throw Error(`setActive: group not found: ${t}`);if(!r.panels.includes(n))throw Error(`setActive: panel ${n} not in group ${t}`);let i=k(r.id,[...r.panels],n);return N(M(e.root,t,i))}function fn(e,t){let n=Qt(e,t);if(!n)throw Error(`panel not found: ${t}`);let r=n.panels.indexOf(t),i=n.panels.filter(e=>e!==t),a=k(n.id,i,tn(i,n.active,r));return A(M(e,n.id,a))}function pn(e,t){let n=rn(e.root);return n.size===1&&n.has(t)?e:N(fn(e.root,t))}function mn(e,t){if(!Qt(e.root,t))throw Error(`extractPanel: panel not found: ${t}`);return{tree:N(fn(e.root,t)),extracted:t}}function hn(e,t,n){if(an(e.root,t))throw Error(`insertPanel: panel already exists in the tree: ${t}`);let r=Zt(e.root,n.groupId);if(!r)throw Error(`insertPanel: dest group not found: ${n.groupId}`);let i=[...r.panels],a=gn(n.index,i.length);i.splice(a,0,t);let o=k(r.id,i,r.active);return N(A(M(e.root,r.id,o)))}function gn(e,t){return e===void 0?t:e<0?0:e>t?t:e}function _n(e,t,n){let r=Qt(e.root,t);if(!r)throw Error(`movePanel: panel not found: ${t}`);let i=Zt(e.root,n.groupId);if(!i)throw Error(`movePanel: dest group not found: ${n.groupId}`);if(r.id===i.id){let i=r.panels.filter(e=>e!==t),a=gn(n.index,i.length),o=[...i];o.splice(a,0,t);let s=k(r.id,o,r.active);return N(A(M(e.root,r.id,s)))}let a=r.panels.indexOf(t),o=r.panels.filter(e=>e!==t),s=k(r.id,o,tn(o,r.active,a)),c=[...i.panels],l=gn(n.index,c.length);c.splice(l,0,t);let u=k(i.id,c,i.active),d=M(e.root,r.id,s);return d=M(d,i.id,u),N(A(d))}function vn(e,t,n,r){if(an(e.root,t))throw Error(`wrapRoot: new panel already exists in the tree: ${t}`);let i=on(e.root),a=e.root.id,o=k(j(i,`${a}__new`),[t],t),s=cn(e.root),c=r===`after`?[s,o]:[o,s];return N({kind:`split`,id:j(i,`${a}__wrap`),orientation:n,children:c,sizes:[1,1]})}function yn(e,t,n,r,i){if(an(e.root,r))throw Error(`splitGroup: new panel already exists in the tree: ${r}`);let a=Zt(e.root,t);if(!a)throw Error(`splitGroup: group not found: ${t}`);let o=on(e.root),s=k(j(o,`${t}__new`),[r],r),c=cn(a),l=i===`after`?[c,s]:[s,c],u={kind:`split`,id:j(o,`${t}__sp`),orientation:n,children:l,sizes:[1,1]};return N(A(M(e.root,t,u)))}function P(e,t,n,r,i){if(an(e.root,r))throw Error(`splitPanel: new panel already exists in the tree: ${r}`);let a=Qt(e.root,t);if(!a)throw Error(`splitPanel: panel not found: ${t}`);let o=on(e.root),s=a.id,c=k(j(o,`${s}__split`),[t],t),l=k(j(o,`${s}__new`),[r],r),u=i===`after`?[c,l]:[l,c],d={kind:`split`,id:j(o,`${s}__sp`),orientation:n,children:u,sizes:[1,1]};if(a.panels.length===1)return N(A(M(e.root,s,d)));let f=a.panels.indexOf(t),p=a.panels.filter(e=>e!==t),m=k(s,p,tn(p,a.active,f)),h=i===`after`?[m,d]:[d,m],g={kind:`split`,id:j(o,`${s}__outer`),orientation:n,children:h,sizes:[1,1]};return N(A(M(e.root,s,g)))}function bn(e){let t=structuredClone(e),n=0,r=new Set,i=!1,a=[],o=e=>{let i=e(t);if(i===t)return;t=i,n+=1;let a={tree:t,revision:n};for(let e of[...r])try{e(a)}catch{}};return{get(){return t},apply(e){if(i){a.push(e);return}i=!0;try{for(o(e);a.length>0;){let e=a.shift();try{o(e)}catch{}}}finally{i=!1}},subscribe(e){return r.add(e),()=>{r.delete(e)}}}}function xn(e,t,n){return n.get(t)?.closable===!1?e:pn(e,t)}function Sn(){let e=Pt();return e.register({kind:`dom`,id:`simulator`,title:`Simulator`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`editor`,title:`Editor`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`wxml`,title:`WXML`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`appdata`,title:`AppData`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`storage`,title:`Storage`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`native`,id:`console`,title:`Console`,nativeRef:{id:`console`},dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`compile`,title:`编译`,dropPolicy:`reorder-only`,closable:!1}),e}function Cn(e){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:[1,6],constraints:[{minPx:e},null],children:[{kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`},{kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[{kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`},{kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`}]}]}}}var wn={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},Tn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),En=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),Dn=()=>({...wn,panels:[...wn.panels]});function On(e,t,n,r){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:e.map((e,t)=>r[t]??1),constraints:e.map((e,r)=>r===t?{minPx:n}:null),children:e}}}function kn(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[Tn(),Dn()]};return r?On([t,En()],0,e,[1,6]):On([En(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?On([Tn(),Dn(),En()],0,e,[1,4,5]):On([En(),Dn(),Tn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[En(),Dn()]};return r?On([Tn(),i],0,e,[1,6]):On([i,Tn()],1,e,[6,1])}function An(e,t,n){return bn(jn(e,t,n))}function jn(e,t,n){if(e===null)return Cn(t);try{let r=Kt(e);if(Gt(r,n).length===0)return Mn(Xt(r),t)}catch{}return Cn(t)}function Mn(e,t){let n=Fn(e);return Nn.some(e=>n.has(e))?Nn.reduce((e,r)=>n.has(r)?e:Bn(e,r,t),e):e}var Nn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Pn(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)Pn(n,t)}function Fn(e){let t=new Set;return Pn(e.root,t),t}function In(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=In(n,t);if(e!==void 0)return e}}function Ln(e,t){return t.find(t=>e.has(t))}function Rn(e,t){if(e.kind===`tabs`)return null;for(let n=0;n<e.children.length;n++){if(e.children[n].id===t)return{splitId:e.id,childIndex:n};let r=Rn(e.children[n],t);if(r)return r}return null}function zn(e,t){let n=In(e.root,`simulator`);if(!n)return e;let r=Rn(e.root,n);return r?un(e,r.splitId,r.childIndex,{minPx:t}):e}function Bn(e,t,n){let r=Fn(e);if(r.has(t))return e;if(Nn.includes(t)){let n=Nn.find(e=>e!==t&&r.has(e));return n?hn(e,t,{groupId:In(e.root,n)}):r.has(`editor`)?P(e,`editor`,`column`,t,`after`):r.has(`simulator`)?P(e,`simulator`,`row`,t,`after`):P(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=Ln(r,Nn);return t?yn(e,In(e.root,t),`column`,`editor`,`before`):r.has(`simulator`)?P(e,`simulator`,`row`,`editor`,`after`):P(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?zn(vn(e,`simulator`,`row`,`before`),n):P(e,[...r][0],`column`,t,`after`)}function Vn(e,t){let n=Fn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Hn=Nn;function Un({model:e,registry:t,simPanelWidth:n}){let[,r]=(0,D.useState)(0);(0,D.useEffect)(()=>e.subscribe(()=>r(e=>e+1)),[e]);let i=new Set(Vn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Hn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?xn(e,r,t):Bn(e,r,n))}function u(){if(s){let t=Hn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>pn(e,t),e))}else{let t=Hn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>Bn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Kn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(qn,{filled:a})}),(0,O.jsx)(Kn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(Jn,{filled:o})}),(0,O.jsx)(Kn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Yn,{filled:s})})]})}function Wn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state,a=r===`left`;function o(){let r=a?`right`:`left`;t.setSimulatorAlignment(r),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(w,{variant:`icon`,size:`icon`,onClick:o,title:a?`模拟器位置:左侧(点击切换到右侧)`:`模拟器位置:右侧(点击切换到左侧)`,"data-testid":`layout-toolbar-alignment-toggle`,"data-alignment":r,className:`text-text-muted hover:text-text hover:bg-surface-3`,children:(0,O.jsx)(Xn,{side:r})})}function Gn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`调试器位置`,children:[{id:`inEditor`,title:`调试器位置:在编辑器面板中`},{id:`belowSimulator`,title:`调试器位置:在模拟器下方`},{id:`rightOfSimulator`,title:`调试器位置:在模拟器右侧`}].map(e=>(0,O.jsx)(Kn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Zn,{variant:e.id})},e.id))})}function Kn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(w,{variant:`icon`,size:`icon`,onClick:n,disabled:t,title:r,"aria-pressed":e,"data-testid":i,"data-active":e?`true`:`false`,className:y(`text-text-muted/45 hover:text-text-muted hover:bg-surface-3`,e&&`bg-surface-active text-text ring-1 ring-accent/50 hover:bg-surface-active hover:text-text`),children:a})}function qn({filled:e}){return(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`,fill:`currentColor`,stroke:`currentColor`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`,stroke:`var(--color-surface-2)`,strokeWidth:`1.2`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`})]})})}function Jn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:e?2:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`polyline`,{points:`5,4 1.5,8 5,12`}),(0,O.jsx)(`polyline`,{points:`11,4 14.5,8 11,12`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`6.5`,y2:`13`})]})}function Yn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[e?(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`,fill:`currentColor`,stroke:`currentColor`}):(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3.5`,x2:`5`,y2:`2`}),(0,O.jsx)(`line`,{x1:`10`,y1:`3.5`,x2:`11`,y2:`2`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`7.5`,x2:`2`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`9.5`,x2:`2`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`11.5`,x2:`2`,y2:`12.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`7.5`,x2:`14`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`9.5`,x2:`14`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`11.5`,x2:`14`,y2:`12.5`})]})}function Xn({side:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),e===`left`?(0,O.jsx)(`rect`,{x:`2.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`}):(0,O.jsx)(`rect`,{x:`8.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`})]})}function Zn({variant:e}){return e===`inEditor`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`7.1`,y:`8.5`,width:`6.3`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):e===`belowSimulator`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`8`,y1:`3`,x2:`8`,y2:`13`}),(0,O.jsx)(`rect`,{x:`2.6`,y:`8.5`,width:`4.8`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`13`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`9.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`6.3`,y:`3.6`,width:`3`,height:`8.8`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]})}function Qn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function $n({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,dockModel:a,dockRegistry:o,layout:s,simPanelWidth:c}){return(0,O.jsx)(`div`,{className:`flex flex-col shrink-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 bg-surface-2 border-b border-border shrink-0`,style:{height:40},children:[(0,O.jsx)(`div`,{ref:e,children:(0,O.jsxs)(w,{variant:`outline`,size:`sm`,onClick:n,className:y(t&&`border-accent`),title:`编译模式`,children:[`普通编译 `,(0,O.jsx)(`span`,{className:`text-[10px] text-text-secondary`,children:`▾`})]})}),(0,O.jsx)(Qn,{}),(0,O.jsx)(w,{variant:`icon`,size:`icon`,onClick:()=>{r()},disabled:i.status===`compiling`,title:`重新编译`,children:`↺`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 shrink-0`,children:[(0,O.jsx)(Nt,{status:i.status}),(0,O.jsx)(`span`,{className:`text-[11px] text-text-muted max-w-28 truncate`,children:i.message})]}),(0,O.jsx)(`div`,{className:`flex-1 min-w-2`}),(0,O.jsx)(Un,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Wn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Gn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(w,{variant:`icon`,size:`icon`,onClick:()=>{he(!0)},title:`设置`,children:`⚙`})]})})}var er={x:0,y:0,width:0,height:0},tr=e=>({x:Math.round(e.x),y:Math.round(e.y),width:Math.max(0,Math.round(e.width)),height:Math.max(0,Math.round(e.height))});function nr(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return tr({x:t.left,y:t.top,width:t.width,height:t.height})},c=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,l=()=>{if(o||!n)return;let e=s();a&&c(a,e)||(a=e,r(e))},u=()=>{i||(i=new ResizeObserver(l),i.observe(e),window.addEventListener(`resize`,l))},d=()=>{i&&=(i.disconnect(),null),window.removeEventListener(`resize`,l)},f=()=>{a=null,n?(u(),a=s(),r(a)):(d(),r(er))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function rr(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:tr({x:t.left,y:t.top,width:t.width,height:t.height})}}var ir=(e,t)=>e.visible===t.visible?e.visible&&t.visible?e.bounds.x===t.bounds.x&&e.bounds.y===t.bounds.y&&e.bounds.width===t.bounds.width&&e.bounds.height===t.bounds.height:!0:!1;function ar(e,t){let n=t.visible,r=t.publish,i=t.guardDisplayNone??!1,a=t.followScroll??!1,o=t.followGeometry??!1,s=null,c=null,l=null,u=!1,d=null,f=0,p=!1,m=null,h=()=>{let t=rr(e);return i&&t.visible&&(t.bounds.width===0||t.bounds.height===0)?{visible:!1}:t},g=()=>{if(u||!n)return;let e=h();l&&ir(l,e)||(l=e,r(e))},_=()=>l?.visible===!1?!0:f++>=30,v=()=>{if(d=null,u||!n){m=null;return}if(m!==null&&performance.now()>=m){m=null;return}let e=h();if(!e.visible){if(_()){m=null;return}d=requestAnimationFrame(v);return}if(l&&ir(l,e)){if(f++,f>=2&&!p){m=null;return}}else l=e,r(e),f=0;!u&&n?d=requestAnimationFrame(v):m=null},y=()=>{!o||u||(f=0,d===null&&(d=requestAnimationFrame(v)))},b=()=>{d!==null&&(cancelAnimationFrame(d),d=null),f=0,m=null,p=!1},x=()=>{o?y():g()},S=e=>{let t=e.target;t&&t.closest&&t.closest(`[role="separator"]`)&&(p=!0,y())},C=()=>{p&&(p=!1,y())},w=()=>{s||(s=new ResizeObserver(g),s.observe(e),window.addEventListener(`resize`,g),i&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(g),c.observe(e)),a&&window.addEventListener(`scroll`,x,{capture:!0,passive:!0}),o&&(window.addEventListener(`pointerdown`,S,{capture:!0}),window.addEventListener(`pointerup`,C,{capture:!0})))},T=()=>{s&&=(s.disconnect(),null),c&&=(c.disconnect(),null),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,x,{capture:!0}),window.removeEventListener(`pointerdown`,S,{capture:!0}),window.removeEventListener(`pointerup`,C,{capture:!0}),b()},E=()=>{if(l=null,n)w(),l=h(),r(l);else{T();let e={visible:!1};l=e,r(e)}};return E(),{update(e){u||(r=e.publish,n=e.visible,E())},dispose(){u||(u=!0,T())},pulse(e){if(!(u||!o)){if(e!==void 0&&e>0){let t=performance.now()+e;m=m===null?t:Math.max(m,t)}y()}}}}function or(e){let t=(0,D.useRef)(null),n=(0,D.useRef)(null),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)([e.present,e.publish,...e.deps??[]]),a=(0,D.useRef)(()=>{let e=t.current;e&&(e.update({present:!1,publish:r.current.publish}),e.dispose(),t.current=null)}),o=(0,D.useCallback)(e=>{e!==n.current&&(n.current=e,t.current&&(e?(t.current.dispose(),t.current=null):a.current()),e&&(t.current=nr(e,{present:r.current.present,publish:r.current.publish}),i.current=[r.current.present,r.current.publish,...r.current.deps??[]]))},[]);return(0,D.useEffect)(()=>{let n=[e.present,e.publish,...e.deps??[]],r=i.current;(n.length!==r.length||n.some((e,t)=>!Object.is(e,r[t])))&&(i.current=n,t.current?.update({present:e.present,publish:e.publish}))},[e.present,e.publish,...e.deps??[]]),(0,D.useEffect)(()=>{let e=a.current;return n.current&&!t.current&&(t.current=nr(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}var sr=(0,D.createContext)(null);function cr(){return(0,D.useContext)(sr)}var F={simulator:`simulator`,simulatorDevtools:`simulator-devtools`,workbench:`workbench`,hostToolbar:`host-toolbar`,settings:`settings`,popover:`popover`},lr={base:0,hostToolbar:5,settings:10,popover:20};function ur(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function dr(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function fr(e){return e/100*window.innerHeight}function pr(e){return e/100*window.innerWidth}function mr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function hr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=mr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=dr(t,i);break;case`em`:r=ur(t,i);break;case`vh`:r=fr(i);break;case`vw`:r=pr(i);break}return r}function I(e){return parseFloat(e.toFixed(3))}function gr({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function _r(e){let{panels:t}=e,n=gr({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=I(hr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=I(hr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=I(hr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=I(hr({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function L(e,t=`Assertion error`){if(!e)throw Error(t)}function vr(e,t){return Array.from(t).sort(e===`horizontal`?yr:br)}function yr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function br(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function xr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Sr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Cr({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Sr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return L(i,`No rect found`),i}var wr;function Tr(){return wr===void 0&&(wr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),wr}function Er(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=vr(n,Array.from(t.children).filter(xr).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Cr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Tr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:gr({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Dr=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},R=new Map,Or=new Dr;function kr(e){R=new Map(R),R.delete(e)}function Ar(e,t){for(let[t]of R)if(t.id===e)return t}function z(e,t){for(let[t,n]of R)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function B(){return R}function jr(e,t){return Or.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function V(e,t){let n=R.get(e);R=new Map(R),R.set(e,t),Or.emit(`groupChange`,{group:e,prev:n,next:t})}function Mr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Sr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Nr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Pr(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Br(e),b:Br(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();L(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:zr(Rr(n.a)),b:zr(Rr(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Fr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ir(e){let t=getComputedStyle(Vr(e)??e).display;return t===`flex`||t===`inline-flex`}function Lr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Ir(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Fr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Rr(e){let t=e.length;for(;t--;){let n=e[t];if(L(n,`Missing node`),Lr(n))return n}return null}function zr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Br(e){let t=[];for(;e;)t.push(e),e=Vr(e);return t}function Vr(e){let{parentNode:t}=e;return Nr(t)?t.host:t}function Hr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ur({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!xr(n)||n.contains(e)||e.contains(n))return!0;if(Pr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Hr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Wr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Er(r),a=Mr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Ur({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Gr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function H(e,t,n=0){return Math.abs(I(e)-I(t))<=n}function U(e,t){return H(e,t)?0:e>t?1:-1}function Kr({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(U(r,c)<0)if(a){let e=(i+c)/2;r=U(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=I(r),r}function qr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(H(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;L(u!=null,`Invalid first pivot index`),L(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,i)){let t=o-n;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];L(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,o)){let t=n-i;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&U(i,c)<0)if(e>0){let t=c-o,n=t/2;U(i+e,c)<0&&(e=U(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;U(i-e,c)<0&&(e=U(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];L(e!=null,`Previous layout not found for panel index ${r}`);let a=Kr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];L(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Kr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!H(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Gr(c,l))return i;{let t=e<0?d:u,r=s[t];L(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Kr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!H(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];L(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Kr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(H(i,s)||(t-=s-i,l[r]=s),H(t,0))break;e>0?r--:r++}}}if(!H(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Jr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||U(e[n],t[n])!==0)return!1;return!0}function W({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!H(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];L(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];L(i!=null,`No layout data found for index ${e}`);let o=r[e];L(o!=null,`No layout data found for index ${e}`);let s=Kr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!H(a,0))for(let e=0;e<t.length;e++){let n=r[e];L(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Kr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,H(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Yr({groupId:e,panelId:t}){let n=()=>{let t=B();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=W({layout:qr({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Jr(l,p)||V(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&H(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=gr({group:t});o(I(hr({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Xr(e){e.defaultPrevented||Wr(e,B()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Yr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Zr(e){let t=B();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Qr({groupId:e}){let t=()=>{let t=B();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=W({layout:e,panelConstraints:r});return n?o:(Jr(o,c)||V(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function G(e,t){let n=Zr(e),r=z(n.id,!0),i=n.separators.find(t=>t.element===e);L(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);L(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Qr({groupId:n.id}).getLayout(),c=W({layout:qr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Jr(s,c)||V(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function $r(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Zr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&G(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&G(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&G(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&G(t,-5);break;case`End`:e.preventDefault(),G(t,100);break;case`Enter`:{e.preventDefault();let n=Zr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=z(n.id,!0),o=n.separators.find(e=>e.element===t);L(o,`Matching separator not found`);let s=a.get(o);L(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(L(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];G(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Zr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);L(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),G(t,-100);break}}var ei={cursorFlags:0,state:`inactive`},ti=new Dr;function K(){return ei}function ni(e){return ti.addListener(`change`,e)}function ri(e){let t=ei,n={...ei};n.cursorFlags=e,ei=n,ti.emit(`change`,{prev:t,next:n})}function ii(e){let t=ei;ei=e,ti.emit(`change`,{prev:t,next:e})}function ai(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=B(),n=Wr(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),ii({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var oi=e=>e,si=()=>{},ci=1,li=2,ui=4,di=8,fi=3,pi=12,mi;function hi(){return mi===void 0&&(mi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(mi=!0)),mi}function gi({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&hi()){let t=(e&ci)!==0,n=(e&li)!==0,r=(e&ui)!==0,i=(e&di)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return hi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var _i=new WeakMap;function vi(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=_i.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=K();switch(r.state){case`active`:case`hover`:{let e=gi({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}_i.set(e,{prevStyle:t,styleSheet:n})}function yi({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=qr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Jr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ci:li;break;case`vertical`:s|=d<0?ui:di;break}}else V(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&fi:c|=s&fi,t.movementY===0?c|=o&pi:c|=s&pi,ri(c),vi(e)}function bi(e){let t=B(),n=K();switch(n.state){case`active`:yi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function xi(e){if(e.defaultPrevented)return;let t=K(),n=B();switch(t.state){case`active`:if(e.buttons===0){ii({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}yi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Wr(e,n);r.length===0?t.state!==`inactive`&&ii({cursorFlags:0,state:`inactive`}):ii({cursorFlags:0,hitRegions:r,state:`hover`}),vi(e.currentTarget);break}}}function Si(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(K().state){case`hover`:ii({cursorFlags:0,state:`inactive`})}}function Ci(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=K();switch(t.state){case`active`:ii({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(vi(e.currentTarget),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)}),e.preventDefault())}}function wi(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=I(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=I((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ti(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=gr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:I(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ei(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Di({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=I(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=I((r[e]??0)/a*l);else{let e=I(l/c.length);for(let t of c)u[t]=e}return u}function Oi(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ki=new Map;function Ai(e){let t=!0;L(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=gr({group:e});if(t===0)return;let n=z(e.id);if(!n)return;let r=_r(e),i=n.defaultLayoutDeferred?wi(r):n.layout,a=W({layout:Di({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Jr(n.layout,a)&&Ei(n.derivedPanelConstraints,r)&&n.groupSize===t)return;V(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ti(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{L(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=gr({group:e}),s=_r(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Oi(e.panels,l)||(l=void 0));let u=W({layout:e.mutableState.layouts[c]??l??wi(s),panelConstraints:s}),d=e.element.ownerDocument;ki.set(d,(ki.get(d)??0)+1);let f=new Map;return Er(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),V(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{L(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,$r)}),ki.get(d)===1&&(d.addEventListener(`dblclick`,Xr,!0),d.addEventListener(`pointerdown`,ai,!0),d.addEventListener(`pointerleave`,bi),d.addEventListener(`pointermove`,xi),d.addEventListener(`pointerout`,Si),d.addEventListener(`pointerup`,Ci,!0)),function(){t=!1,ki.set(d,Math.max(0,(ki.get(d)??0)-1)),kr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,$r)}),ki.get(d)||(d.removeEventListener(`dblclick`,Xr,!0),d.removeEventListener(`pointerdown`,ai,!0),d.removeEventListener(`pointerleave`,bi),d.removeEventListener(`pointermove`,xi),d.removeEventListener(`pointerout`,Si),d.removeEventListener(`pointerup`,Ci,!0)),a.disconnect()}}function ji(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Mi(e){let t=(0,D.useId)();return`${e??t}`}var q=typeof window<`u`?D.useLayoutEffect:D.useEffect;function Ni(e){let t=(0,D.useRef)(e);return q(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Pi(...e){return Ni(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Fi(e){let t=(0,D.useRef)({...e});return q(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Ii=(0,D.createContext)(null);function Li(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:oi});(0,D.useImperativeHandle)(t,()=>n.current,[]),q(()=>{Object.assign(n.current,Qr({groupId:e}))})}function Ri({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,D.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Ni(e=>{Jr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Ni(e=>{Jr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Mi(s),v=(0,D.useRef)(null),[y,b]=ji(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Pi(v,a);Li(_,o);let C=Ni((e,t)=>{let r=K(),i=Ar(e),a=z(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Fi({defaultLayout:n,disableCursor:r}),T=(0,D.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=vr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=vr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Ar(_),i=z(_);r&&i&&V(r,{...i,derivedPanelConstraints:_r(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,D.useRef)(null);return q(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Ai(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=z(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=jr(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=H(t.collapsedSize,i[t.panelId]),a=H(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=K().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,D.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,O.jsx)(Ii.Provider,{value:T,children:(0,O.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ri.displayName=`Group`;function zi(){let e=(0,D.useContext)(Ii);return L(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Bi(e,t){let{id:n}=zi(),r=(0,D.useRef)({collapse:si,expand:si,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:si});(0,D.useImperativeHandle)(t,()=>r.current,[]),q(()=>{Object.assign(r.current,Yr({groupId:n,panelId:e}))})}function Vi({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Mi(c),_=Fi({disabled:a}),v=(0,D.useRef)(null),y=Pi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=zi(),T=d!==null,E=Ni((e,t,n)=>{d?.(e,c,n)});q(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,D.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Bi(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>jr(x,e),ee,ee),ne;return ne=te?JSON.parse(te):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,O.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Hi,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...ne},children:(0,O.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Vi.displayName=`Panel`;var Hi={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Ui({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=W({layout:qr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=W({layout:qr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Wi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Mi(a),l=Fi({disabled:n,disableDoubleClick:r}),[u,d]=(0,D.useState)({}),[f,p]=(0,D.useState)(`inactive`),[m,h]=(0,D.useState)(!1),g=(0,D.useRef)(null),_=Pi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=zi(),C=b===`horizontal`?`vertical`:`horizontal`;q(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ni(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=jr(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Ui({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,D.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,O.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Wi.displayName=`Separator`;function Gi(e,t,n,r){return!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)}function Ki(e){return Number.isFinite(e)?Math.max(0,Math.min(.5,e)):.25}function qi(e,t,n,r){let i=n<0?n:n>e?n-e:0,a=r<0?r:r>t?r-t:0;if(i===0&&a===0)return;let o=Math.abs(i);return o>=Math.abs(a)&&o>0?i<0?`left`:`right`:a<0?`top`:`bottom`}function Ji(e,t,n,r,i){let a=i*Math.min(e,t),o=n<a,s=n>e-a,c=r<a,l=r>t-a;return{inLeft:o,inTop:c,activeHoriz:o||s,activeVert:c||l}}function Yi(e,t,n,r,i,a){return(i?n/e:(e-n)/e)<=(a?r/t:(t-r)/t)?i?`left`:`right`:a?`top`:`bottom`}function Xi(e,t,n,r,i){let{inLeft:a,inTop:o,activeHoriz:s,activeVert:c}=Ji(e,t,n,r,i);return!s&&!c?`center`:s&&!c?a?`left`:`right`:c&&!s?o?`top`:`bottom`:Yi(e,t,n,r,a,o)}function Zi(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(Gi(r,i,a,o))return`center`;let s=Ki(n),c=qi(r,i,a,o);return c===void 0?Xi(r,i,a,o,s):c}function Qi(e,t,n){if(e===`center`)return{kind:`move`,panelId:t,destGroupId:n.groupId};let r=e===`left`||e===`right`?`row`:`column`,i=e===`left`||e===`top`?`before`:`after`;return{kind:`split`,atPanelId:n.panelId,dir:r,side:i,newPanelId:t}}function $i(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function ea(e,t){if(!Number.isFinite(t))return 0;let n=0;for(let r of e)if(t>=r.left+r.width/2)n+=1;else break;return n}function ta(e,t,n,r){let i=t.indexOf(n),a=i>=0&&r>i,o=t.filter(e=>e!==n),s=e.filter(e=>e!==n),c=a?r-1:r;if(c<0&&(c=0),c>o.length&&(c=o.length),c>=o.length)return s.length;let l=o[c],u=s.indexOf(l);return u>=0?u:s.length}var na=.5;function ra(e){let t=e.reduce((e,t)=>e+(t>0?t:0),0);if(t<=0){let t=e.length>0?100/e.length:100;return e.map(()=>t)}return e.map(e=>(e>0?e:0)/t*100)}function ia(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=ra(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function aa(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function oa(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=aa(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function sa(e,t,n,r=na){let i=new Set(n);for(let t of Object.keys(e))if(!i.has(t))return!1;for(let e of Object.keys(t))if(!i.has(e))return!1;for(let i of n){let n=e[i],a=t[i];if(!Number.isFinite(n)||!Number.isFinite(a)||Math.abs(n-a)>r)return!1}return!0}function ca(e,t,n,r,i){let a=e=>(n?.[e]??null)!==null,o=t=>{let a=n?.[t]??null;if(i&&i.containerPx>0&&a){if(a.fixedPx!=null)return a.fixedPx/i.containerPx*100;if(a.minPx!=null&&!i.trustLiveForMinPx)return a.minPx/i.containerPx*100}let o=r[e[t]];return typeof o==`number`?o:null},s=la(e,a,o);if(s===null)return null;let c=Math.max(0,100-s),l=0,u=0;for(let n=0;n<e.length;n++){if(a(n))continue;let e=t[n]??0;l+=e>0?e:0,u+=1}let d={};for(let n=0;n<e.length;n++){let r=e[n];d[r]=a(n)?o(n):ua(t[n]??0,c,l,u)}return d}function la(e,t,n){let r=0;for(let i=0;i<e.length;i++){if(!t(i))continue;let e=n(i);if(e===null)return null;r+=e}return r}function ua(e,t,n,r){return n<=0?r>0?t/r:t:t*(e>0?e:0)/n}function da(e,t,n){let r=[],i=[];for(let a=0;a<e.length;a++){if((t?.[a]??null)!==null)continue;let o=n[e[a]];if(typeof o!=`number`||!Number.isFinite(o))return null;r.push(a),i.push(o>0?o:0)}return r.length===0?null:{indices:r,ratios:ra(i)}}function fa(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=ia(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(aa(a)),s=(0,D.useRef)(null),c=(0,D.useRef)(null),l=(0,D.useRef)(t);l.current=t;let u=[];t.children.forEach((e,r)=>{r>0&&u.push((0,O.jsx)(Wi,{"data-deck-resize-handle":``},`handle-${r}`));let a=t.constraints?.[r]??null;if(a?.fixedPx!=null){let t=`${a.fixedPx}px`;u.push((0,O.jsx)(Vi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:wa(e,n)},pa(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;u.push((0,O.jsx)(Vi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:wa(e,n)},pa(e)))}else{let t=i.get(r);u.push((0,O.jsx)(Vi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:wa(e,n)},pa(e)))}});let d=e=>{let t=l.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=da(r,t.constraints,e);if(!a)return;let o=ia(t.sizes,t.constraints),s=a.indices.map(e=>o.get(e)??0);if(!a.ratios.some((e,t)=>Math.abs(e-s[t])>.1))return;let c=r.map((n,r)=>i(r)?t.sizes[r]??1:e[n]);n.onApplyLayout(t.id,oa(c,t.constraints))},f=e=>{c.current=e,e&&(e.__deckApplyLayout=e=>{let t=l.current,r=e=>(t.constraints?.[e]??null)!==null,i=e.map((e,n)=>r(n)?t.sizes[n]??1:e);n.onApplyLayout(t.id,oa(i,t.constraints))},Object.defineProperty(e,`__deckGroupApi`,{configurable:!0,get:()=>s.current??void 0}))},p=(0,D.useCallback)(e=>{let t=s.current;if(!t)return{pushed:!1,stuck:!1};let n=l.current,r=n.children.map(e=>e.id),i=t.getLayout(),a=c.current?.getBoundingClientRect(),o=a?n.orientation===`row`?a.width:a.height:0,u=o>0?{containerPx:o,trustLiveForMinPx:!e}:void 0,d=ca(r,n.sizes,n.constraints,i,u);return d?sa(i,d,r)?{pushed:!1,stuck:!0}:(t.setLayout(d),{pushed:!0,stuck:sa(t.getLayout(),d,r)}):{pushed:!1,stuck:!1}},[]),m=t.sizes.join(`,`),h=t.children.length,g=(0,D.useRef)(null);return(0,D.useEffect)(()=>{let e=g.current!==h;if(g.current=h,!e){p(!1);return}let t=!1,n=0,r=0,i=()=>{if(t)return;r+=1;let{stuck:e}=p(!0);!e&&r<8&&(n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{t=!0,cancelAnimationFrame(n)}},[m,h,p]),(0,O.jsx)(`div`,{ref:f,"data-deck-split":t.id,"data-orientation":t.orientation,"data-deck-sizes":t.sizes.join(`,`),style:{width:`100%`,height:`100%`},children:(0,O.jsx)(Ri,{groupRef:s,orientation:r,onLayoutChanged:d,style:{width:`100%`,height:`100%`},children:u},t.children.length)})}function pa(e){return e.id}function ma(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(ha,{panelId:n,bindNativeSlot:t.bindNativeSlot},n):null,e.panels.filter(e=>t.registry.get(e)?.kind!==`native`).slice().sort((e,t)=>e<t?-1:+(e>t)).map(e=>{let r=e===n;return(0,O.jsx)(`div`,{"data-deck-panel-body":e,style:{display:r?`flex`:`none`,flexDirection:`column`,flex:1,minWidth:0,minHeight:0},children:t.renderDomPanel(e,{active:r})},`dom-${e}`)})]}):null}function ha(e){let{panelId:t,bindNativeSlot:n}=e,r=(0,D.useRef)(n);return r.current=n,(0,O.jsx)(`div`,{ref:(0,D.useCallback)(e=>{r.current(t,e)},[t]),"data-deck-native-slot":t,style:{flex:1,minWidth:0,minHeight:0,height:`100%`}})}var ga=`application/x-deck-panel`;function _a(e){let{node:t,ctx:n}=e,[r,i]=(0,D.useState)(null),a=(0,D.useRef)(t);a.current=t;let o=(0,D.useRef)(n.onRedock);o.current=n.onRedock;let s=e=>{e&&(e.__deckHandleDrop=(e,t)=>{let n=a.current;o.current(n.id,n.active,e,t)})},c=e=>{if(!e.dataTransfer?.types.includes(ga))return;e.preventDefault();let t=n.activeDragPanelId.current;if(n.suppressReorderOnlyDropIndicator&&t!==null&&n.registry.get(t)?.dropPolicy===`reorder-only`){i(null);return}let r=e.currentTarget.getBoundingClientRect();i(Zi({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top}))},l=()=>{i(null)},u=e=>{e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),a=Zi({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer?.getData(ga);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=ea(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,o,a,s)},d=e=>{e.dataTransfer?.types.includes(ga)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer?.getData(ga);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=ea(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,r,`center`,a)},p=t.panels.filter(e=>!n.registry.get(e)?.hideTab);return(0,O.jsxs)(`div`,{ref:s,"data-deck-group":t.id,onDragOver:c,onDragLeave:l,onDrop:u,style:{position:`relative`,display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,minWidth:0,minHeight:0},children:[p.length>0?(0,O.jsx)(`div`,{role:`tablist`,style:{flexShrink:0},onDragOver:d,onDrop:f,children:p.map(e=>{let r=e===t.active,i=n.registry.get(e),a=i?.title??e;return(0,O.jsxs)(`button`,{type:`button`,role:`tab`,draggable:i?.draggable===!1?void 0:`true`,"data-deck-tab":e,"data-active":r?`true`:`false`,onDragStart:t=>{if(t.target instanceof Element&&t.target.closest(`[data-deck-tab-close]`)!==null){t.preventDefault();return}t.dataTransfer.setData(ga,e),t.dataTransfer.setData(`text/plain`,e),t.dataTransfer.effectAllowed=`move`,n.activeDragPanelId.current=e},onDragEnd:()=>{n.activeDragPanelId.current=null},onClick:()=>{r?n.onActiveTabClick?.(e):n.onActivate(t.id,e)},children:[a,n.canClose&&i?.closable!==!1?(0,O.jsx)(`span`,{role:`button`,tabIndex:0,"data-deck-tab-close":e,"aria-label":`Close ${a}`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),t.preventDefault(),n.onClose(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.stopPropagation(),t.preventDefault(),n.onClose(e))},children:`×`}):null]},e)})}):null,ma(t,n),r?(0,O.jsx)(ya,{zone:r}):null]})}function va(e){let t={position:`absolute`,pointerEvents:`none`,background:`rgba(64, 128, 255, 0.25)`,outline:`2px solid rgba(64, 128, 255, 0.6)`};switch(e){case`left`:return{...t,left:`0`,top:`0`,width:`50%`,height:`100%`};case`right`:return{...t,right:`0`,top:`0`,width:`50%`,height:`100%`};case`top`:return{...t,left:`0`,top:`0`,width:`100%`,height:`50%`};case`bottom`:return{...t,left:`0`,bottom:`0`,width:`100%`,height:`50%`};default:return{...t,left:`0`,top:`0`,width:`100%`,height:`100%`}}}function ya(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:va(e.zone)})}var ba=(0,D.createContext)(0);function xa(){return(0,D.useContext)(ba)}function Sa(e,t,n){let{groupId:r,activePanelId:i,draggedPanelId:a,draggedGroupId:o,zone:s,reorderIndex:c}=n;if(o===void 0||o!==r||s!==`center`)return;let l=Zt(e.get().root,r),u;if(c!==void 0&&l){let e=l.panels.filter(e=>t.get(e)?.hideTab!==!0);u=ta(l.panels,e,a,c)}else u=l?l.panels.indexOf(i):void 0;e.apply(e=>_n(e,a,{groupId:r,index:u}))}function Ca(e){let{model:t,registry:n,renderDomPanel:r,bindNativeSlot:i,suppressReorderOnlyDropIndicator:a,onActiveTabClick:o}=e,[s,c]=(0,D.useState)(()=>t.get()),[l,u]=(0,D.useState)(0),d=(0,D.useRef)(null);(0,D.useEffect)(()=>(c(t.get()),t.subscribe(e=>{c(e.tree),u(e.revision)})),[t]);let f=(0,D.useCallback)((e,n)=>{t.apply(t=>dn(t,e,n))},[t]),p=(0,D.useCallback)(e=>{t.apply(t=>xn(t,e,n))},[t,n]),m=en(s.root)>1,h=(0,D.useCallback)(e=>$t(s.root,e)!==void 0,[s]),g=(0,D.useCallback)((e,n)=>{t.apply(t=>ln(t,e,n))},[t]),_=(0,D.useCallback)((e,r,i,a,o)=>{let s={groupId:e,panelId:r},c=$t(t.get().root,i);if(n.get(i)?.draggable===!1||n.get(r)?.draggable===!1)return;if(n.get(i)?.dropPolicy===`reorder-only`){Sa(t,n,{groupId:e,activePanelId:r,draggedPanelId:i,draggedGroupId:c,zone:a,reorderIndex:o});return}if($i(i,c,s,a))return;let l=Qi(a,i,s);if(l.kind===`move`){t.apply(e=>_n(e,l.panelId,{groupId:l.destGroupId}));return}t.apply(e=>{let{tree:t}=mn(e,l.newPanelId);return $t(t.root,l.atPanelId)===void 0?e:P(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(ba.Provider,{value:l,children:wa(s.root,{registry:n,renderDomPanel:r,bindNativeSlot:i,onActivate:f,onActiveTabClick:o,onApplyLayout:g,onRedock:_,onClose:p,canClose:m,isPanelInTree:h,suppressReorderOnlyDropIndicator:a??!1,activeDragPanelId:d})})}function wa(e,t){return e.kind===`split`?Ta(e,t):Ea(e,t)}function Ta(e,t){return(0,O.jsx)(fa,{node:e,ctx:t},e.id)}function Ea(e,t){return(0,O.jsx)(_a,{node:e,ctx:t},e.id)}function Da({phase:e,code:t,reason:n,onRelaunch:r}){return(0,O.jsx)(`div`,{"data-testid":`sim-runtime-error`,className:`absolute inset-0 flex flex-col items-center justify-center bg-black/70 z-10`,children:(0,O.jsxs)(`div`,{className:`text-center p-4`,children:[(0,O.jsx)(`div`,{className:`text-status-error text-[14px] font-medium mb-2`,children:e===`crashed`?`小程序已崩溃`:`小程序启动失败`}),(0,O.jsx)(`div`,{className:`text-status-error text-[11px] max-w-[280px] break-words mb-3`,children:n??t??`未知原因`}),(0,O.jsx)(`button`,{type:`button`,onClick:r,className:`text-[11px] px-3 py-1 rounded border border-status-error text-status-error hover:bg-status-error/10`,children:`重新启动`})]})})}function Oa({requested:e,resolved:t,onDismiss:n}){return(0,O.jsxs)(`div`,{"data-testid":`sim-fallback-banner`,className:`flex items-center gap-2 px-2.5 py-1 bg-status-warn/15 border-b border-status-warn/40 text-[11px] text-status-warn shrink-0`,children:[(0,O.jsxs)(`span`,{className:`flex-1 min-w-0 truncate`,children:[`启动页 "`,e,`" 不存在,已回退到 "`,t,`"`]}),(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 text-status-warn/80 hover:text-status-warn px-1`,title:`关闭`,children:`×`})]})}function ka(){return(0,O.jsx)(`div`,{"data-testid":`sim-watcher-dead-banner`,className:`flex items-center gap-2 px-2.5 py-1 bg-status-error/15 border-b border-status-error/40 text-[11px] text-status-error shrink-0`,children:`文件监听已停止,后续代码修改将不会自动重新编译`})}var Aa=50;function ja(e,t,n){if(e.width<=0||e.height<=0)return n;let r=Math.min(e.width/(t.width+Aa),e.height/(t.height+Aa));return Math.max(1,Math.min(100,Math.floor(r*100)))}function Ma({device:e,zoom:t,onDeviceChange:n,onZoomChange:r,compileStatus:i,currentPage:a,copied:o,onCopyPagePath:s,runtimeStatus:c=null,watcherDead:l=!1,onRelaunch:u=()=>{},onOpenInternalDevtools:d=()=>{}}){let f=(0,D.useRef)(typeof t==`number`?t:100),p=(0,D.useRef)(t),m=(0,D.useRef)(e),h=(0,D.useRef)(null),[g,_]=(0,D.useState)(!1);(0,D.useEffect)(()=>{i.status===`ready`&&_(!0)},[i.status]);let v=c?.phase===`launch-failed`||c?.phase===`crashed`,[b,x]=(0,D.useState)(!1);(0,D.useEffect)(()=>{c||x(!1)},[c]);let S=!!c?.pageFallback&&!v&&!b,C=i.status===`compiling`&&g,w=cr(),T=(0,D.useCallback)(e=>{if(e.visible){let t=p.current;f.current=t===`auto`?ja(e.bounds,m.current,f.current):t}w?.set({viewId:F.simulator,placement:e,layer:lr.base,extra:{zoom:f.current}})},[w]),E=(0,D.useCallback)(e=>{let t=h.current;if(t){e?(t.dispose(),h.current=ar(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:T})):(t.update({visible:!1,publish:T}),t.dispose(),h.current=null);return}e&&(h.current=ar(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:T}))},[T]);return(0,D.useLayoutEffect)(()=>{p.current=t,m.current=e}),(0,D.useLayoutEffect)(()=>{h.current?.update({visible:!0,publish:T})},[t,e,T]),(0,D.useEffect)(()=>{h.current?.pulse(300)},[xa()]),(0,D.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,w?.remove(F.simulator)},[w]),(0,O.jsxs)(`div`,{className:`bg-sim-bg flex flex-col overflow-hidden h-full w-full`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-2 shrink-0 border-b border-border-subtle`,children:[(0,O.jsx)(ue,{value:e.name,onChange:n,children:fe.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,O.jsxs)(ue,{value:t,onChange:r,className:`w-[76px] shrink-0`,children:[pe.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,`%`]},e)),(0,O.jsx)(`option`,{value:ee,children:`自适应`})]})]}),l&&(0,O.jsx)(ka,{}),S&&c?.pageFallback&&(0,O.jsx)(Oa,{requested:c.pageFallback.requested,resolved:c.pageFallback.resolved,onDismiss:()=>x(!0)}),(0,O.jsxs)(`div`,{ref:E,className:`flex-1 min-h-0 bg-sim-bg relative`,"data-area":`native-simulator`,children:[i.status===`compiling`&&!g&&(0,O.jsx)(`div`,{"data-testid":`sim-compiling-overlay`,className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,O.jsx)(`div`,{className:`text-text-dim text-[13px]`,children:`正在编译中...`})}),C&&(0,O.jsxs)(`div`,{"data-testid":`sim-recompiling-indicator`,className:`absolute top-2 right-2 z-10 flex items-center gap-1.5 rounded bg-black/60 px-2 py-0.5 pointer-events-none`,children:[(0,O.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent animate-pulse`}),(0,O.jsx)(`span`,{className:`text-text-dim text-[11px]`,children:`编译中…`})]}),i.status===`error`&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/70 z-10`,children:(0,O.jsxs)(`div`,{className:`text-center p-4`,children:[(0,O.jsx)(`div`,{className:`text-status-error text-[14px] font-medium mb-2`,children:`编译失败`}),(0,O.jsx)(`div`,{className:`text-status-error text-[11px] max-w-[280px] break-words`,children:i.message})]})}),i.status!==`error`&&c&&(c.phase===`launch-failed`||c.phase===`crashed`)&&(0,O.jsx)(Da,{phase:c.phase,code:c.code,reason:c.reason,onRelaunch:u})]}),(0,O.jsxs)(`div`,{className:`flex items-center px-2.5 bg-sim-bottom border-t border-border-subtle shrink-0 h-[30px] min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,O.jsx)(`span`,{className:`text-[11px] text-text-dim truncate min-w-0`,children:a||`—`}),a&&(0,O.jsx)(`button`,{className:y(`shrink-0 flex items-center justify-center w-4 h-4 rounded transition-colors`,o?`text-accent`:`text-text-dim hover:text-text`),onClick:s,title:`复制路径`,children:o?(0,O.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:(0,O.jsx)(`polyline`,{points:`1.5,5 4,7.5 8.5,2.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,O.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:[(0,O.jsx)(`rect`,{x:`1`,y:`3`,width:`6`,height:`6.5`,rx:`1`,stroke:`currentColor`,strokeWidth:`1`}),(0,O.jsx)(`path`,{d:`M3 3V2a1 1 0 011-1h4a1 1 0 011 1v5a1 1 0 01-1 1H7`,stroke:`currentColor`,strokeWidth:`1`})]})})]}),(0,O.jsx)(`button`,{className:`ml-auto shrink-0 flex items-center justify-center w-4 h-4 rounded text-text-dim hover:text-text transition-colors`,onClick:d,title:`调试开发者工具`,"data-testid":`sim-open-internal-devtools`,children:(0,O.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 11 11`,fill:`none`,children:[(0,O.jsx)(`rect`,{x:`3`,y:`3.5`,width:`5`,height:`5.5`,rx:`1.5`,stroke:`currentColor`,strokeWidth:`1`}),(0,O.jsx)(`path`,{d:`M4 3.5V3a1.5 1.5 0 013 0v.5M1.5 5.5H3M8 5.5h1.5M2 8.5l1.3-1M9 8.5l-1.3-1M2 3l1.3 1M9 3L7.7 4`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`})]})})]})]})}function Na(){let e=(0,D.useRef)(null),t=cr(),n=(0,D.useCallback)(e=>{t?.set({viewId:F.workbench,placement:e,layer:lr.base})},[t]),r=(0,D.useCallback)(t=>{let r=e.current;if(r){t?(r.dispose(),e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(r.update({visible:!1,publish:n}),r.dispose(),e.current=null);return}t&&(e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[n]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[xa()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null,t?.remove(F.workbench)},[t]),(0,O.jsx)(`div`,{ref:r,className:`h-full w-full`,"data-area":`editor`})}function Pa(e,t){return!!(t===0||e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function Fa({entries:e}){return(0,O.jsx)(O.Fragment,{children:e.map(([e,t])=>(0,O.jsxs)(`span`,{children:[` `,(0,O.jsx)(`span`,{className:`text-code-blue`,children:e}),(0,O.jsx)(`span`,{className:`text-text-dim`,children:`=`}),(0,O.jsxs)(`span`,{className:`text-code-orange`,children:[`"`,t,`"`]})]},e))})}function Ia({node:e,depth:t}){return(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2`,style:{paddingLeft:t*16},children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsx)(`span`,{className:`text-text`,children:e.text})]})}function La({node:e,depth:t,inspectedSid:n,onInspect:r}){return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(Ha,{node:e,depth:t,inspectedSid:n,onInspect:r},i))})}function Ra({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Pa(e,t)),o=t*16,s=(e.children??[]).length>0;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2 cursor-pointer`,style:{paddingLeft:o},onClick:()=>s&&a(!i),children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 inline-block text-center select-none`,children:s?i?`▾`:`▸`:` `}),(0,O.jsx)(`span`,{className:`text-text-dim italic`,children:`#shadow-root`})]}),i&&e.children.map((e,i)=>(0,O.jsx)(Ha,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}function za({node:e,indent:t,attrEntries:n,isInspected:r,onMouseEnter:i,inlineText:a}){return(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2${r?` bg-surface-2`:``}`,style:{paddingLeft:t},onMouseEnter:i,"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),(0,O.jsx)(Fa,{entries:n}),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:`>`}),(0,O.jsx)(`span`,{className:`text-text`,children:a}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]})}function Ba({node:e,depth:t,indent:n,attrEntries:r,hasChildren:i,expanded:a,isInspected:o,inspectedSid:s,onInspect:c,onToggle:l,onMouseEnter:u}){return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-start hover:bg-surface-2 py-px leading-[18px]${i?` cursor-pointer`:``}${o?` bg-surface-2`:``}`,style:{paddingLeft:n},onMouseEnter:u,onClick:()=>{i&&l()},"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 text-center select-none`,children:i?a?`▾`:`▸`:` `}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),(0,O.jsx)(Fa,{entries:r}),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:i?`>`:` />`})]})]}),a&&i&&(0,O.jsxs)(O.Fragment,{children:[e.children.map((e,n)=>(0,O.jsx)(Ha,{node:e,depth:t+1,inspectedSid:s,onInspect:c},n)),(0,O.jsxs)(`div`,{style:{paddingLeft:n},className:`py-px leading-[18px]`,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]})]})]})}function Va({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Pa(e,t)),o=t*16,s=!!(e.sid&&e.sid===n),c=(e.children??[]).length>0,l=Object.entries(e.attrs),u=()=>{e.sid&&r?.(e)},d=c&&e.children.length===1&&e.children[0].tagName===`#text`?e.children[0].text:null;return d?(0,O.jsx)(za,{node:e,indent:o,attrEntries:l,isInspected:s,onMouseEnter:u,inlineText:d}):(0,O.jsx)(Ba,{node:e,depth:t,indent:o,attrEntries:l,hasChildren:c,expanded:i,isInspected:s,inspectedSid:n,onInspect:r,onToggle:()=>a(!i),onMouseEnter:u})}function Ha({node:e,depth:t,inspectedSid:n,onInspect:r}){return e.tagName===`#text`?(0,O.jsx)(Ia,{node:e,depth:t}):e.tagName===`#fragment`?(0,O.jsx)(La,{node:e,depth:t,inspectedSid:n,onInspect:r}):e.tagName===`#shadow-root`?(0,O.jsx)(Ra,{node:e,depth:t,inspectedSid:n,onInspect:r}):(0,O.jsx)(Va,{node:e,depth:t,inspectedSid:n,onInspect:r})}function Ua({inspection:e}){if(!e)return null;let{rect:t,style:n}=e,r=[n.display,n.position===`static`?null:n.position,n.boxSizing].filter(Boolean);return(0,O.jsxs)(`div`,{className:`border-t border-border-subtle bg-bg-panel px-2.5 py-1.5 font-mono text-[11px] text-text-dim shrink-0`,children:[(0,O.jsx)(`span`,{className:`text-text`,children:`box`}),` `,Math.round(t.width),` x `,Math.round(t.height),` @ `,Math.round(t.x),`, `,Math.round(t.y),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),r.join(` / `),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),`font `,n.fontSize]})}function Wa({tree:e,onInspectElement:t,onClearInspection:n,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)(null),o=(0,D.useRef)(0),s=(0,D.useRef)(null);(0,D.useEffect)(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let c=(0,D.useCallback)(e=>{if(!e.sid||!t)return;let n=e.sid;s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null;let e=++o.current;t(n).then(t=>{e===o.current&&a(t)}).catch(()=>{e===o.current&&a(null)})})},[t]),l=(0,D.useCallback)(()=>{s.current!==null&&(cancelAnimationFrame(s.current),s.current=null),o.current++,a(null),n?.()},[n]);return e?(0,O.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,onMouseLeave:l,"data-testid":`wxml-panel`,children:[(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2 font-mono text-[12px]`,children:(0,O.jsx)(Ha,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(Ua,{inspection:i})]}):(0,O.jsx)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,"data-testid":`wxml-panel`,children:(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:r?`等待小程序加载...`:`小程序未运行`})})}function Ga(e){let{source:t,enabled:n,active:r}=e,i=(0,D.useRef)({subscribe:e.subscribe,seed:e.seed});(0,D.useEffect)(()=>{i.current={subscribe:e.subscribe,seed:e.seed}}),(0,D.useEffect)(()=>{if(!n)return;let e=i.current.subscribe(t);return()=>{e(),t.setActive(!1)}},[t,n]),(0,D.useEffect)(()=>{n&&t.setActive(r)},[t,n,r]);let a=(0,D.useRef)({source:null,on:!1});(0,D.useEffect)(()=>{let e=n&&r,o=a.current,s=e&&(!o.on||o.source!==t);if(a.current={source:t,on:e},!s)return;let c=!1;return i.current.seed(t,()=>c),()=>{c=!0}},[t,n,r])}function Ka({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)(null);return Ga({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(a),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}}),(0,O.jsx)(Wa,{tree:i,onInspectElement:t=>e.inspect(t),onClearInspection:async()=>{await e.clearInspection()},isRuntimeRunning:r})}var qa=`inline-flex items-center justify-center gap-1.5 font-medium transition-colors focus:outline-none disabled:opacity-35 disabled:cursor-not-allowed whitespace-nowrap shrink-0 border border-border text-text-muted hover:text-text rounded h-5 px-2 text-[11px]`;function Ja({items:e,onSet:t,onRemove:n,onClear:r,onClearAll:i,getPrefix:a,isRuntimeRunning:o=!0}){let[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)(``),[_,v]=(0,D.useState)(``);(0,D.useEffect)(()=>{let e=!1,t,n=()=>{a().then(r=>{if(!e){if(r){m(r);return}t=setTimeout(n,300)}})};return n(),()=>{e=!0,t&&clearTimeout(t)}},[a]);async function y(e){f(!0),u(null);try{let t=await e();return t.ok?t:(u(t.error),null)}finally{f(!1)}}function b(e){c({key:e.key,draft:e.value})}async function x(){if(!s)return;let{key:e,draft:n}=s;c(null),await y(()=>t(e,n))}async function S(e){await y(()=>n(e))}async function C(){e.length!==0&&await y(()=>r())}async function w(){i&&(typeof window<`u`&&!window.confirm(`清空所有 appId 的 Storage 数据?该操作不可撤销。`)||await y(()=>i()))}async function T(){let e=h.trim();if(!e){u(`key 不能为空`);return}let n=p+e;await y(()=>t(n,_))&&(g(``),v(``))}return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`storage-panel`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:d||e.length===0,className:`${qa} hover:border-status-error hover:text-status-error`,title:`仅清空当前 appId 的 Storage`,children:`清空`}),i&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:d,className:`${qa} hover:border-status-error hover:text-status-error`,title:`清空所有 appId 的 Storage`,children:`清空所有`}),l&&(0,O.jsx)(`span`,{className:`ml-2 text-[11px] text-status-error truncate`,title:l,children:l})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,O.jsxs)(`table`,{className:`w-full border-collapse text-[12px]`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10 w-px pr-5`,children:`Key`}),(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10`,children:`Value`}),(0,O.jsx)(`th`,{className:`w-px sticky top-0 bg-bg-panel z-10 border-b border-border-subtle`})]})}),(0,O.jsx)(`tbody`,{children:e.length===0?(0,O.jsx)(`tr`,{children:(0,O.jsx)(`td`,{colSpan:3,className:`text-[12px] text-text-dim text-center px-4 py-6`,children:o?`暂无 Storage 数据`:`小程序未运行`})}):e.map(e=>{let t=s?.key===e.key,n=p&&e.key.startsWith(p)?e.key.slice(p.length):e.key;return(0,O.jsxs)(`tr`,{className:`hover:[&>td]:bg-surface`,children:[(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle w-px pr-5 align-top`,children:(0,O.jsx)(`div`,{className:`font-mono text-code-blue max-w-[240px] truncate`,title:e.key,children:n})}),(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle font-mono text-code-orange break-all align-top cursor-text`,onClick:()=>{t||b(e)},children:t?(0,O.jsx)(`input`,{autoFocus:!0,type:`text`,value:s.draft,onChange:t=>c({key:e.key,draft:t.target.value}),onBlur:()=>void x(),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),x()):e.key===`Escape`&&(e.preventDefault(),c(null))},className:`w-full bg-transparent outline-none border border-accent/60 rounded px-1 py-0 font-mono text-code-orange`}):e.value}),(0,O.jsx)(`td`,{className:`px-1 py-0.5 border-b border-border-subtle align-top`,children:(0,O.jsx)(`button`,{type:`button`,onClick:()=>void S(e.key),disabled:d,title:`删除`,className:`text-text-dim hover:text-status-error px-1 leading-none`,children:`×`})})]},e.key)})})]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-t border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:`key`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())},className:`w-32 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(`input`,{type:`text`,placeholder:`value`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())},className:`flex-1 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:d||!h.trim(),className:`${qa} hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function Ya(e,t){switch(t.type){case`added`:case`updated`:{let n=e.findIndex(e=>e.key===t.key);if(n<0)return[...e,{key:t.key,value:t.newValue}];let r=[...e];return r[n]={key:t.key,value:t.newValue},r}case`removed`:return e.filter(e=>e.key!==t.key);case`cleared`:return[]}}function Xa({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)([]);Ga({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(e=>{a(t=>Ya(t,e))}),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}});let o=e.clearAll?.bind(e);return(0,O.jsx)(Ja,{items:i,onSet:(t,n)=>e.setItem(t,n),onRemove:t=>e.removeItem(t),onClear:()=>e.clear(),onClearAll:o,getPrefix:()=>e.getPrefix(),isRuntimeRunning:r})}function Za(e,t){return typeof t==`number`?`${e}[${t}]`:e===``?t:`${e}.${t}`}function Qa(e){return typeof e==`object`&&!!e}function $a(e){return Array.isArray(e)?e.map((e,t)=>[t,e]):Object.keys(e).sort().map(t=>[t,e[t]])}function eo(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}var to=``;function no(e,t){let n=e.overrides.get(t);return n===void 0?e.baseline===`expanded`?!0:e.baseline===`collapsed`?!1:t===to:n}function ro({path:e,value:t,editable:n,ctx:r}){if(typeof t==`boolean`)return(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-code-keyword`,children:[n&&(0,O.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>r.onCommit?.(e,!t,t),className:`accent-accent`}),String(t)]});if(t==null)return(0,O.jsx)(`span`,{className:`text-code-keyword`,children:String(t)});if(r.state.editingPath===e){let n=()=>{let n=t;if(typeof n==`number`){let t=r.state.draft.trim(),i=Number(t);if(r.endEdit(),t===``||!Number.isFinite(i))return;r.onCommit?.(e,i,n);return}let i=r.state.draft;r.endEdit(),r.onCommit?.(e,i,n)};return(0,O.jsx)(`input`,{type:`text`,autoFocus:!0,value:r.state.draft,onChange:e=>r.setDraft(e.target.value),onKeyDown:e=>{e.key===`Enter`?n():e.key===`Escape`&&r.endEdit()},onBlur:n,className:`bg-surface-3 border border-accent rounded px-1 text-[12px] font-mono min-w-0 w-40`})}return(0,O.jsx)(`span`,{"data-testid":`appdata-value`,className:typeof t==`string`?`text-code-orange`:void 0,style:typeof t==`number`?{color:`var(--color-code-number)`}:void 0,onDoubleClick:n?()=>r.beginEdit(e,String(t)):void 0,children:String(t)})}function io(e){return typeof e==`string`&&(e===``||/[.[\]]/.test(e))}function ao({path:e,label:t,value:n,depth:r,unsafeSegments:i,ctx:a}){let o={paddingLeft:r*14};if(Qa(n)){let s=no(a.state,e);return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-px cursor-pointer hover:bg-surface-3 text-[12px] font-mono`,style:o,onClick:()=>a.toggle(e,n),children:[(0,O.jsx)(`span`,{className:`text-text-secondary w-3 shrink-0 text-center select-none`,children:s?`▾`:`▸`}),(0,O.jsx)(`span`,{className:`text-code-blue`,children:t}),(0,O.jsx)(`span`,{className:`text-text-secondary`,children:eo(n)})]}),s&&$a(n).map(([t,n])=>(0,O.jsx)(ao,{path:Za(e,t),label:String(t),value:n,depth:r+1,unsafeSegments:i||io(t),ctx:a},String(t)))]})}let s=typeof n==`string`||typeof n==`number`||typeof n==`boolean`,c=r>1&&i||t===`__proto__`,l=s&&a.onCommit!==void 0&&!c;return(0,O.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-px text-[12px] font-mono`,style:o,...l?{"data-path":e}:{},children:[(0,O.jsx)(`span`,{className:`w-3 shrink-0`}),(0,O.jsx)(`span`,{className:`text-code-blue`,children:t}),(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`:`}),(0,O.jsx)(ro,{path:e,value:n,editable:l,ctx:a})]})}function oo({root:e,bridgeId:t,command:n,onCommit:r}){let[i,a]=(0,D.useState)(`default`),[o,s]=(0,D.useState)(new Map),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)(null),[f,p]=(0,D.useState)(``);n&&n.bridgeId===t&&n.seq!==c&&(a(n.mode),s(new Map),l(n.seq));let m={baseline:i,overrides:o,editingPath:u,draft:f};return(0,O.jsx)(`div`,{"data-testid":`appdata-tree`,className:`py-1`,children:(0,O.jsx)(ao,{path:to,label:`object`,value:e,depth:0,unsafeSegments:!1,ctx:{state:m,toggle:(e,t)=>{let n=new Map(o),r=!no(m,e);n.set(e,r),r&&Array.isArray(t)&&t.forEach((t,r)=>{Qa(t)&&n.set(Za(e,r),!0)}),s(n)},beginEdit:(e,t)=>{d(e),p(t)},setDraft:p,endEdit:()=>d(null),onCommit:r}})})}function so(e){return e.pagePath??e.id}function co(e){return e!=null&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function lo(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(!(!r||typeof r!=`object`))for(let e of Object.keys(r))Object.defineProperty(t,e,{value:r[e],enumerable:!0,writable:!0,configurable:!0})}return t}function uo({title:e,disabled:t,onClick:n,children:r}){return(0,O.jsx)(`button`,{title:e,disabled:t,onClick:n,className:`px-1.5 py-0.5 text-[12px] rounded text-text-secondary hover:bg-surface-3 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function fo({state:e,onSelectBridge:t,isRuntimeRunning:n=!0,onSetData:r}){let{bridges:i,activeBridgeId:a,entries:o}=e,[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)([]),[d,f]=(0,D.useState)([]),p=(0,D.useRef)(!1),[m,h]=(0,D.useState)(!1),g=n?`暂无页面数据(仅显示 Page 级 data)`:`小程序未运行`,_=e=>{a&&c({seq:(s?.seq??0)+1,mode:e,bridgeId:a})},v=(e,t,n)=>{let i;try{i=r?.(e,t)}catch{n(!1);return}if(co(i)){Promise.resolve(i).then(e=>e!==!1,()=>!1).then(n);return}n(i!==!1)},y=(e,t,n)=>{p.current||(p.current=!0,h(!0),v(e,t,e=>{p.current=!1,h(!1),n(e)}))},b=e=>(t,n,r)=>{y(e,{[t]:n},i=>{i&&(u(i=>[...i,{bridgeId:e,path:t,before:r,after:n}]),f([]))})},x=e=>i.some(t=>t.id===e),S=(e,t,n)=>{y(e.bridgeId,{[e.path]:t},t=>{t&&n(e)})};return i.length===0?(0,O.jsx)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`appdata-panel`,children:(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:g})}):(0,O.jsxs)(`div`,{className:`flex overflow-hidden flex-1`,"data-testid":`appdata-panel`,children:[(0,O.jsxs)(`div`,{"data-testid":`appdata-pages`,className:`w-40 shrink-0 border-r border-border-subtle bg-bg-panel flex flex-col overflow-hidden`,children:[(0,O.jsx)(`div`,{className:`px-2 py-1 text-[11px] text-text-secondary border-b border-border-subtle shrink-0`,children:`Pages`}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto`,role:`listbox`,children:i.map(e=>{let n=e.id===a;return(0,O.jsx)(`button`,{"data-testid":`appdata-page-item`,role:`option`,"aria-selected":n,title:e.id,onClick:()=>t(e.id),className:`block w-full text-left px-2 py-1 text-[11px] truncate `+(n?`bg-accent/20 text-accent`:`text-text-dim hover:bg-surface-3`),children:so(e)},e.id)})})]}),(0,O.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,O.jsxs)(`div`,{"data-testid":`appdata-toolbar`,className:`flex items-center gap-1 px-2 py-0.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(uo,{title:`全部展开`,onClick:()=>_(`expanded`),children:`⊕`}),(0,O.jsx)(uo,{title:`全部收起`,onClick:()=>_(`collapsed`),children:`⊖`}),(0,O.jsx)(uo,{title:`撤销`,disabled:l.length===0||m,onClick:()=>{let e=l.at(-1);if(e){if(!x(e.bridgeId)){u(t=>t.filter(t=>t!==e));return}S(e,e.before,e=>{u(t=>t.filter(t=>t!==e)),f(t=>[...t,e])})}},children:`↶`}),(0,O.jsx)(uo,{title:`重做`,disabled:d.length===0||m,onClick:()=>{let e=d.at(-1);if(e){if(!x(e.bridgeId)){f(t=>t.filter(t=>t!==e));return}S(e,e.after,e=>{f(t=>t.filter(t=>t!==e)),u(t=>[...t,e])})}},children:`↷`})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:i.map(e=>{let t=e.id===a,n=o[e.id]??{},i=Object.keys(n).length>0;return(0,O.jsx)(`div`,{"data-bridge-id":e.id,className:`absolute inset-0 flex-col overflow-y-auto`,style:{display:t?`flex`:`none`},children:i?(0,O.jsx)(oo,{root:lo(n),bridgeId:e.id,command:s,onCommit:r?b(e.id):void 0}):(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:g})},e.id)})})]})]})}function po(e){return(e??``).replace(/^\/+/,``)}function mo(e,t=``){let n=e.map(e=>e.id),r=n.join(`\0`),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(t);if(r!==o){let e=o?o.split(`\0`):[];n.some(t=>!e.includes(t))&&a(null),s(r)}t!==c&&(a(null),l(t));let u=t?e.find(e=>po(e.pagePath)===po(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}var ho={bridges:[],entries:{}};function go({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0,activePagePath:i=``}){let[a,o]=(0,D.useState)(ho);Ga({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(e=>{o(e)}),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||o(e)})}});let{activeBridgeId:s,setActiveBridge:c}=mo(a.bridges,i),l=e.setData?.bind(e),u=l?(e,t)=>l(e,t):void 0;return(0,O.jsx)(fo,{state:{bridges:a.bridges,activeBridgeId:s,entries:a.entries},onSelectBridge:c,isRuntimeRunning:r,onSetData:u})}function _o(...e){return e.filter(Boolean).join(` `)}function vo(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function yo(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function bo(e){return e.kind===`event`?e.event.message:e.log.text}function xo({events:e,logs:t=[],onClear:n}){let r=e.length>0?e[e.length-1]:null,[i,a]=(0,D.useState)(``),o=(0,D.useRef)(null),s=(0,D.useRef)(null),c=(0,D.useRef)(!0);(0,D.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;c.current=n-t-r<20};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,D.useEffect)(()=>{c.current&&s.current?.scrollIntoView?.({behavior:`auto`})},[e.length+t.length]);let l=(0,D.useMemo)(()=>{let n=[];e.forEach((t,r)=>{let i=r>0?e[r-1]:null,a=t.status===`ready`&&i?.status===`compiling`?t.at-i.at:null;n.push({kind:`event`,at:t.at,seq:t.seq,event:t,durationMs:a})});for(let e of t)n.push({kind:`log`,at:e.at,seq:e.seq,log:e});return n.sort((e,t)=>e.at===t.at?e.seq!==void 0&&t.seq!==void 0?e.seq-t.seq:0:e.at-t.at)},[e,t]),u=(0,D.useMemo)(()=>{if(!i)return l;let e=i.toLowerCase();return l.filter(t=>bo(t).toLowerCase().includes(e))},[l,i]),d=e.length===0&&t.length===0;return(0,O.jsxs)(`div`,{className:`flex flex-col h-full w-full min-h-0 text-[12px]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 h-8 shrink-0 border-b border-border-subtle`,children:[r?(0,O.jsx)(`span`,{"data-compile-current":!0,"data-status":r.status,className:_o(`truncate font-medium shrink-0`,yo(r.status)),children:r.message}):(0,O.jsx)(`span`,{className:`text-text-muted shrink-0`,children:`编译信息`}),(0,O.jsx)(`div`,{className:`flex-1 min-w-0`}),(0,O.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`过滤...`,className:`h-6 px-2 text-[12px] rounded-sm border border-border-subtle bg-surface
|
|
2
|
-
text-text placeholder:text-text-dim
|
|
3
|
-
focus:outline-none focus:border-text-muted
|
|
4
|
-
w-40 shrink-0`}),i&&(0,O.jsxs)(`span`,{className:`text-[11px] text-text-muted tabular-nums shrink-0`,children:[u.length,`/`,l.length]}),(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`px-2 h-6 rounded-sm text-text-muted hover:text-text hover:bg-surface-2 transition-colors shrink-0`,children:`清空`})]}),(0,O.jsx)(`div`,{ref:o,className:`flex-1 min-h-0 overflow-auto`,children:d?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-muted`,children:`暂无编译信息`}):u.length===0?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-muted`,children:`无匹配日志`}):(0,O.jsxs)(`ul`,{className:`px-2 py-1 space-y-0.5`,children:[u.map((e,t)=>e.kind===`event`?(0,O.jsxs)(`li`,{"data-compile-row":!0,"data-status":e.event.status,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:vo(e.at)}),(0,O.jsx)(`span`,{className:_o(`break-all`,yo(e.event.status)),children:e.event.message}),e.event.hotReload===!0&&(0,O.jsx)(`span`,{className:`shrink-0 px-1 rounded-sm bg-surface-2 text-text-muted`,children:`已重启`}),e.durationMs!==null&&(0,O.jsxs)(`span`,{"data-compile-duration":!0,className:`shrink-0 text-text-muted tabular-nums`,children:[(e.durationMs/1e3).toFixed(1),`s`]})]},`e-${e.at}-${t}`):(0,O.jsxs)(`li`,{"data-compile-log":!0,"data-stream":e.log.stream,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:vo(e.at)}),(0,O.jsx)(`span`,{className:_o(`break-all font-mono`,e.log.stream===`stderr`?`text-red-500`:`text-text`),children:e.log.text})]},`l-${e.at}-${t}`)),(0,O.jsx)(`div`,{ref:s})]})})]})}function So(e){let{tabId:t,wxmlSource:n,wxmlEnabled:r=!0,storageSource:i,storageEnabled:a=!0,appDataSource:o,appDataEnabled:s=!0,activePagePath:c,tabActive:l=!0,compileEvents:u=[],compileLogs:d=[],onClearCompileEvents:f,isRuntimeRunning:p=!0}=e;switch(t){case`wxml`:return(0,O.jsx)(Ka,{source:n,enabled:r,active:l,isRuntimeRunning:p});case`appdata`:return(0,O.jsx)(go,{source:o,enabled:s,active:l,isRuntimeRunning:p,activePagePath:c});case`storage`:return(0,O.jsx)(Xa,{source:i,enabled:a,active:l,isRuntimeRunning:p});case`compile`:return(0,O.jsx)(xo,{events:u,logs:d,onClear:f??(()=>{})})}}function Co(e){let t=e.requestFrame??(e=>requestAnimationFrame(e)),n=e.cancelFrame??(e=>cancelAnimationFrame(e)),r=typeof e.generation==`function`?e.generation:()=>e.generation,i=new Map,a=!1,o=null,s=0,c=!1;function l(){c||o!==null||(o=t(u))}function u(){o=null,!(c||!a)&&(a=!1,e.publish({generation:r(),epoch:s++,views:[...i.values()]}))}return{set(e){c||(i.set(e.viewId,e),a=!0,l())},remove(e){c||i.delete(e)&&(a=!0,l())},dispose(){c||(c=!0,o!==null&&(n(o),o=null),e.publish({generation:r(),epoch:s++,views:[]}))}}}var wo=0,To=new Set([`simulator`,`editor`,`wxml`,`appdata`,`storage`,`console`,`compile`]);function Eo({project:e}){let t=(0,D.useRef)(null),[n,r]=(0,D.useState)(!1),{session:i,device:a,simulator:o,panelData:s,rightPane:c,popover:l}=Et({projectPath:e.path}),u=jt(),{state:d}=u,[f]=(0,D.useState)(()=>An(d.dockTree??null,a.simPanelWidth,To)),p=(0,D.useMemo)(()=>Sn(),[]),[m]=(0,D.useState)(()=>++wo),h=(0,D.useMemo)(()=>Co({generation:m,publish:e=>{E(e)}}),[m]);(0,D.useEffect)(()=>()=>h.dispose(),[h]);let[g,_]=(0,D.useState)(0);(0,D.useEffect)(()=>{let e=!1,t=oe(t=>{e=!0,_(t)});return ce().then(t=>{e||typeof t==`number`&&_(t)}),t},[]);let v=or({present:g>0,publish:e=>{let t=g>0&&e.width>0&&e.height>0;h.set({viewId:F.hostToolbar,placement:t?{visible:!0,bounds:e}:{visible:!1},layer:lr.hostToolbar})},deps:[g,h]});(0,D.useEffect)(()=>{let t=`Dimina DevTools`;return document.title=`${e.name} - ${t}`,Fe().then(n=>{n?.appName&&(t=n.appName,document.title=`${e.name} - ${t}`)}).catch(()=>{}),()=>{document.title=t}},[e.name]),(0,D.useEffect)(()=>()=>{t.current!==null&&window.clearTimeout(t.current)},[]);async function y(){if(o.currentPage)try{await navigator.clipboard.writeText(o.currentPage),r(!0),t.current!==null&&window.clearTimeout(t.current),t.current=window.setTimeout(()=>r(!1),S)}catch{r(!1)}}let b={rightPane:c.rightPane,onSelectTab:c.selectRightPane,wxmlSource:s.wxmlSource,wxmlEnabled:s.wxmlEnabled,storageSource:s.storageSource,storageEnabled:s.storageEnabled,appDataSource:s.appDataSource,appDataEnabled:s.appDataEnabled,activePagePath:o.currentPage,compileEvents:i.compileEvents,compileLogs:i.compileLogs,onClearCompileEvents:i.clearCompileEvents,isRuntimeRunning:i.runtimeStatus?.phase===`running`};return(0,O.jsx)(sr.Provider,{value:h,children:(0,O.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,O.jsx)(`div`,{ref:v,style:{height:g},className:`shrink-0 w-full`,"data-area":`host-toolbar`}),(0,O.jsx)($n,{compileDropdownRef:l.compileDropdownRef,showCompilePanel:l.showCompilePanel,onToggleCompilePanel:l.toggleCompilePanel,onRelaunch:()=>i.relaunch(),compileStatus:i.compileStatus,dockModel:f,dockRegistry:p,layout:u,simPanelWidth:a.simPanelWidth}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,O.jsx)(jo,{dockModel:f,dockRegistry:p,simPanelWidth:a.simPanelWidth,renderDomPanel:(e,t)=>e===`simulator`?(0,O.jsx)(Ma,{device:a.device,zoom:a.zoom,onDeviceChange:a.handleDeviceChange,onZoomChange:a.handleZoomChange,compileStatus:i.compileStatus,currentPage:o.currentPage,copied:n,onCopyPagePath:y,runtimeStatus:i.runtimeStatus,watcherDead:i.watcherDead,onRelaunch:()=>i.relaunch(),onOpenInternalDevtools:()=>{$e()}}):e===`editor`?(0,O.jsx)(Na,{}):e===`wxml`||e===`appdata`||e===`storage`||e===`compile`?(0,O.jsx)(Ao,{tabId:e,active:t.active,panelProps:b}):null,onPersistTree:u.setDockTree,persistedTree:d.dockTree??null})})]})})}function Do(e){return e.kind===`tabs`?e.panels.includes(`simulator`):e.children.some(Do)}function Oo(e,t){function n(e){if(e.kind===`tabs`)return null;if(e.id===t.splitId)return(e.constraints?.[t.childIndex]??null)?.minPx??null;for(let t of e.children){let e=n(t);if(e!==null)return e}return null}return n(e)}function ko(e){if(e.kind===`tabs`)return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if((e.constraints?.[t]??null)!==null&&Do(n))return{splitId:e.id,childIndex:t};let r=ko(n);if(r)return r}return null}function Ao({tabId:e,active:t,panelProps:n}){return(0,O.jsx)(So,{tabId:e,...n,tabActive:t})}function jo(e){let{dockModel:t,dockRegistry:n,simPanelWidth:r,renderDomPanel:i,onPersistTree:a,persistedTree:o}=e,s=(0,D.useRef)(null),c=cr(),l=(0,D.useCallback)(e=>{c?.set({viewId:F.simulatorDevtools,placement:e,layer:lr.base})},[c]),u=(0,D.useCallback)((e,t,n)=>{if(e.current){t?(e.current.dispose(),e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(e.current.update({visible:!1,publish:n}),e.current.dispose(),e.current=null);return}t&&(e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[]),d=(0,D.useCallback)((e,t)=>{e===`console`&&u(s,t,l)},[u,l]);return(0,D.useEffect)(()=>{let e=t.get().root,n=ko(e);n&&Oo(e,n)!==r&&t.apply(e=>{let t=ko(e.root);return!t||Oo(e.root,t)===r?e:un(e,t.splitId,t.childIndex,{minPx:r})})},[t,r]),(0,D.useEffect)(()=>()=>{s.current?.dispose(),s.current=null,c?.remove(F.simulatorDevtools)},[c]),(0,D.useEffect)(()=>t.subscribe(e=>{a(It(e.tree))}),[t,a]),(0,D.useEffect)(()=>{let e=It(t.get());e!==o&&a(e)},[]),(0,O.jsx)(Ca,{model:t,registry:n,renderDomPanel:i,bindNativeSlot:d,onActiveTabClick:(0,D.useCallback)(e=>{e===`simulator`||e===`editor`||t.apply(t=>xn(t,e,n))},[t,n])})}typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Mo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function No(...e){return t=>{let n=!1,r=e.map(e=>{let r=Mo(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Mo(e[t],null)}}}}function Y(...e){return D.useCallback(No(...e),e)}function Po(e,t){let n=D.createContext(t),r=e=>{let{children:t,...r}=e,i=D.useMemo(()=>r,Object.values(r));return(0,O.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=D.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Fo(e,t=[]){let n=[];function r(t,r){let i=D.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=D.useMemo(()=>o,Object.values(o));return(0,O.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=D.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>D.createContext(e));return function(n){let r=n?.[e]||t;return D.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Io(i,...t)]}function Io(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Lo=globalThis?.document?D.useLayoutEffect:()=>{},Ro=D.useId||(()=>void 0),zo=0;function Bo(e){let[t,n]=D.useState(Ro());return Lo(()=>{e||n(e=>e??String(zo++))},[e]),e||(t?`radix-${t}`:``)}var Vo=D.useInsertionEffect||Lo;function Ho({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Uo({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=D.useRef(e!==void 0);D.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,D.useCallback(t=>{if(s){let n=Wo(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Uo({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return Vo(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Wo(e){return typeof e==`function`}var Go=t(v(),1);function Ko(e){let t=qo(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(Yo);if(o){let e=o.props.children,r=a.map(t=>t===o?D.Children.count(e)>1?D.Children.only(null):D.isValidElement(e)?e.props.children:null:t);return(0,O.jsx)(t,{...i,ref:n,children:D.isValidElement(e)?D.cloneElement(e,void 0,r):null})}return(0,O.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function qo(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=Zo(n),i=Xo(r,n.props);return n.type!==D.Fragment&&(i.ref=t?No(t,e):e),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Jo=Symbol(`radix.slottable`);function Yo(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Jo}function Xo(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Zo(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Ko(`Primitive.${t}`),r=D.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,O.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Qo(e,t){e&&Go.flushSync(()=>e.dispatchEvent(t))}function $o(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}function es(e,t=globalThis?.document){let n=$o(e);D.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var ts=`DismissableLayer`,ns=`dismissableLayer.update`,rs=`dismissableLayer.pointerDownOutside`,is=`dismissableLayer.focusOutside`,as,os=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ss=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(os),[u,d]=D.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=D.useState({}),m=Y(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=us(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=ds(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return es(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),D.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(as=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),fs(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=as)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),fs())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(ns,e),()=>document.removeEventListener(ns,e)},[]),(0,O.jsx)(X.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,S.onFocusCapture),onBlurCapture:J(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,x.onPointerDownCapture)})});ss.displayName=ts;var cs=`DismissableLayerBranch`,ls=D.forwardRef((e,t)=>{let n=D.useContext(os),r=D.useRef(null),i=Y(t,r);return D.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,O.jsx)(X.div,{...e,ref:i})});ls.displayName=cs;function us(e,t=globalThis?.document){let n=$o(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ps(rs,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ds(e,t=globalThis?.document){let n=$o(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&ps(is,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function fs(){let e=new CustomEvent(ns);document.dispatchEvent(e)}function ps(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Qo(i,a):i.dispatchEvent(a)}var ms=`focusScope.autoFocusOnMount`,hs=`focusScope.autoFocusOnUnmount`,gs={bubbles:!1,cancelable:!0},_s=`FocusScope`,vs=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=$o(i),u=$o(a),d=D.useRef(null),f=Y(t,e=>c(e)),p=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Z(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Z(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Z(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),D.useEffect(()=>{if(s){Ts.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ms,gs);s.addEventListener(ms,l),s.dispatchEvent(t),t.defaultPrevented||(ys(Os(xs(s)),{select:!0}),document.activeElement===e&&Z(s))}return()=>{s.removeEventListener(ms,l),setTimeout(()=>{let t=new CustomEvent(hs,gs);s.addEventListener(hs,u),s.dispatchEvent(t),t.defaultPrevented||Z(e??document.body,{select:!0}),s.removeEventListener(hs,u),Ts.remove(p)},0)}}},[s,l,u,p]);let m=D.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=bs(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Z(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Z(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,O.jsx)(X.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});vs.displayName=_s;function ys(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Z(r,{select:t}),document.activeElement!==n)return}function bs(e){let t=xs(e);return[Ss(t,e),Ss(t.reverse(),e)]}function xs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ss(e,t){for(let n of e)if(!Cs(n,{upTo:t}))return n}function Cs(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function ws(e){return e instanceof HTMLInputElement&&`select`in e}function Z(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ws(e)&&t&&e.select()}}var Ts=Es();function Es(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Ds(e,t),e.unshift(t)},remove(t){e=Ds(e,t),e[0]?.resume()}}}function Ds(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Os(e){return e.filter(e=>e.tagName!==`A`)}var ks=`Portal`,As=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);Lo(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Go.createPortal((0,O.jsx)(X.div,{...r,ref:t}),o):null});As.displayName=ks;function js(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var Ms=e=>{let{present:t,children:n}=e,r=Ns(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=Y(r.ref,Fs(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};Ms.displayName=`Presence`;function Ns(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=js(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=Ps(r.current);a.current=o===`mounted`?e:`none`},[o]),Lo(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ps(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Lo(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ps(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ps(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:D.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Ps(e){return e?.animationName||`none`}function Fs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Is=0;function Ls(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Rs()),document.body.insertAdjacentElement(`beforeend`,e[1]??Rs()),Is++,()=>{Is===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Is--}},[])}function Rs(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Q=function(){return Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Q.apply(this,arguments)};function zs(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Bs(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Vs=`right-scroll-bar-position`,Hs=`width-before-scroll-bar`,Us=`with-scroll-bars-hidden`,Ws=`--removed-body-scroll-bar-size`;function Gs(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ks(e,t){var n=(0,D.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var qs=typeof window<`u`?D.useLayoutEffect:D.useEffect,Js=new WeakMap;function Ys(e,t){var n=Ks(t||null,function(t){return e.forEach(function(e){return Gs(e,t)})});return qs(function(){var t=Js.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Gs(e,null)}),i.forEach(function(e){r.has(e)||Gs(e,a)})}Js.set(n,e)},[e]),n}function Xs(e){return e}function Zs(e,t){t===void 0&&(t=Xs);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Qs(e){e===void 0&&(e={});var t=Zs(null);return t.options=Q({async:!0,ssr:!1},e),t}var $s=function(e){var t=e.sideCar,n=zs(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return D.createElement(r,Q({},n))};$s.isSideCarExport=!0;function ec(e,t){return e.useMedium(t),$s}var tc=Qs(),nc=function(){},rc=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:nc,onWheelCapture:nc,onTouchMoveCapture:nc}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=zs(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Ys([n,t]),C=Q(Q({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:tc,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?D.cloneElement(D.Children.only(s),Q(Q({},C),{ref:S})):D.createElement(v,Q({},C,{className:c,ref:S}),s))});rc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rc.classNames={fullWidth:Hs,zeroRight:Vs};var ic,ac=function(){if(ic)return ic;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function oc(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ac();return t&&e.setAttribute(`nonce`,t),e}function sc(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cc(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var lc=function(){var e=0,t=null;return{add:function(n){e==0&&(t=oc())&&(sc(t,n),cc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},uc=function(){var e=lc();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},dc=function(){var e=uc();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},fc={left:0,top:0,right:0,gap:0},pc=function(e){return parseInt(e||``,10)||0},mc=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[pc(n),pc(r),pc(i)]},hc=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return fc;var t=mc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gc=dc(),_c=`data-scroll-locked`,vc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
5
|
-
.${Us} {
|
|
6
|
-
overflow: hidden ${r};
|
|
7
|
-
padding-right: ${s}px ${r};
|
|
8
|
-
}
|
|
9
|
-
body[${_c}] {
|
|
10
|
-
overflow: hidden ${r};
|
|
11
|
-
overscroll-behavior: contain;
|
|
12
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
13
|
-
padding-left: ${i}px;
|
|
14
|
-
padding-top: ${a}px;
|
|
15
|
-
padding-right: ${o}px;
|
|
16
|
-
margin-left:0;
|
|
17
|
-
margin-top:0;
|
|
18
|
-
margin-right: ${s}px ${r};
|
|
19
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.${Vs} {
|
|
23
|
-
right: ${s}px ${r};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.${Hs} {
|
|
27
|
-
margin-right: ${s}px ${r};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.${Vs} .${Vs} {
|
|
31
|
-
right: 0 ${r};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.${Hs} .${Hs} {
|
|
35
|
-
margin-right: 0 ${r};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
body[${_c}] {
|
|
39
|
-
${Ws}: ${s}px;
|
|
40
|
-
}
|
|
41
|
-
`},yc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},bc=function(){D.useEffect(function(){return document.body.setAttribute(_c,(yc()+1).toString()),function(){var e=yc()-1;e<=0?document.body.removeAttribute(_c):document.body.setAttribute(_c,e.toString())}},[])},xc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;bc();var a=D.useMemo(function(){return hc(i)},[i]);return D.createElement(gc,{styles:vc(a,!t,i,n?``:`!important`)})},Sc=!1;if(typeof window<`u`)try{var Cc=Object.defineProperty({},`passive`,{get:function(){return Sc=!0,!0}});window.addEventListener(`test`,Cc,Cc),window.removeEventListener(`test`,Cc,Cc)}catch{Sc=!1}var wc=Sc?{passive:!1}:!1,Tc=function(e){return e.tagName===`TEXTAREA`},Ec=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Tc(e)&&n[t]===`visible`)},Dc=function(e){return Ec(e,`overflowY`)},Oc=function(e){return Ec(e,`overflowX`)},kc=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Mc(e,r)){var i=Nc(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ac=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},jc=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Mc=function(e,t){return e===`v`?Dc(t):Oc(t)},Nc=function(e,t){return e===`v`?Ac(t):jc(t)},Pc=function(e,t){return e===`h`&&t===`rtl`?-1:1},Fc=function(e,t,n,r,i){var a=Pc(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Nc(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Mc(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ic=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Lc=function(e){return[e.deltaX,e.deltaY]},Rc=function(e){return e&&`current`in e?e.current:e},zc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Bc=function(e){return`
|
|
42
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
43
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
44
|
-
`},Vc=0,Hc=[];function Uc(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(Vc++)[0],a=D.useState(dc)[0],o=D.useRef(e);D.useEffect(function(){o.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Bs([e.lockRef.current],(e.shards||[]).map(Rc),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=D.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ic(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=kc(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=kc(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Fc(h,t,e,h===`h`?s:c,!0)},[]),c=D.useCallback(function(e){var n=e;if(!(!Hc.length||Hc[Hc.length-1]!==a)){var r=`deltaY`in n?Lc(n):Ic(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&zc(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Rc).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=D.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Wc(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=D.useCallback(function(e){n.current=Ic(e),r.current=void 0},[]),d=D.useCallback(function(t){l(t.type,Lc(t),t.target,s(t,e.lockRef.current))},[]),f=D.useCallback(function(t){l(t.type,Ic(t),t.target,s(t,e.lockRef.current))},[]);D.useEffect(function(){return Hc.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,wc),document.addEventListener(`touchmove`,c,wc),document.addEventListener(`touchstart`,u,wc),function(){Hc=Hc.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,wc),document.removeEventListener(`touchmove`,c,wc),document.removeEventListener(`touchstart`,u,wc)}},[]);var p=e.removeScrollBar,m=e.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:Bc(i)}):null,p?D.createElement(xc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Gc=ec(tc,Uc),Kc=D.forwardRef(function(e,t){return D.createElement(rc,Q({},e,{ref:t,sideCar:Gc}))});Kc.classNames=rc.classNames;var qc=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Jc=new WeakMap,Yc=new WeakMap,Xc={},Zc=0,Qc=function(e){return e&&(e.host||Qc(e.parentNode))},$c=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Qc(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},el=function(e,t,n,r){var i=$c(t,Array.isArray(e)?e:[e]);Xc[n]||(Xc[n]=new WeakMap);var a=Xc[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Jc.get(e)||0)+1,l=(a.get(e)||0)+1;Jc.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Yc.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Zc++,function(){o.forEach(function(e){var t=Jc.get(e)-1,i=a.get(e)-1;Jc.set(e,t),a.set(e,i),t||(Yc.has(e)||e.removeAttribute(r),Yc.delete(e)),i||e.removeAttribute(n)}),Zc--,Zc||(Jc=new WeakMap,Jc=new WeakMap,Yc=new WeakMap,Xc={})}},tl=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||qc(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),el(r,i,n,`aria-hidden`)):function(){return null}},nl=`Dialog`,[rl,il]=Fo(nl),[al,$]=rl(nl),ol=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=D.useRef(null),c=D.useRef(null),[l,u]=Ho({prop:r,defaultProp:i??!1,onChange:a,caller:nl});return(0,O.jsx)(al,{scope:t,triggerRef:s,contentRef:c,contentId:Bo(),titleId:Bo(),descriptionId:Bo(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};ol.displayName=nl;var sl=`DialogTrigger`,cl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(sl,n),a=Y(t,i.triggerRef);return(0,O.jsx)(X.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Ol(i.open),...r,ref:a,onClick:J(e.onClick,i.onOpenToggle)})});cl.displayName=sl;var ll=`DialogPortal`,[ul,dl]=rl(ll,{forceMount:void 0}),fl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=$(ll,t);return(0,O.jsx)(ul,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(Ms,{present:n||a.open,children:(0,O.jsx)(As,{asChild:!0,container:i,children:e})}))})};fl.displayName=ll;var pl=`DialogOverlay`,ml=D.forwardRef((e,t)=>{let n=dl(pl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(pl,e.__scopeDialog);return a.modal?(0,O.jsx)(Ms,{present:r||a.open,children:(0,O.jsx)(gl,{...i,ref:t})}):null});ml.displayName=pl;var hl=Ko(`DialogOverlay.RemoveScroll`),gl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(pl,n);return(0,O.jsx)(Kc,{as:hl,allowPinchZoom:!0,shards:[i.contentRef],children:(0,O.jsx)(X.div,{"data-state":Ol(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),_l=`DialogContent`,vl=D.forwardRef((e,t)=>{let n=dl(_l,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(_l,e.__scopeDialog);return(0,O.jsx)(Ms,{present:r||a.open,children:a.modal?(0,O.jsx)(yl,{...i,ref:t}):(0,O.jsx)(bl,{...i,ref:t})})});vl.displayName=_l;var yl=D.forwardRef((e,t)=>{let n=$(_l,e.__scopeDialog),r=D.useRef(null),i=Y(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return tl(e)},[]),(0,O.jsx)(xl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault())})}),bl=D.forwardRef((e,t)=>{let n=$(_l,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(xl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),xl=D.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=$(_l,n),c=D.useRef(null),l=Y(t,c);return Ls(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(vs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(ss,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Ol(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Ml,{titleId:s.titleId}),(0,O.jsx)(Pl,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Sl=`DialogTitle`,Cl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(Sl,n);return(0,O.jsx)(X.h2,{id:i.titleId,...r,ref:t})});Cl.displayName=Sl;var wl=`DialogDescription`,Tl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(wl,n);return(0,O.jsx)(X.p,{id:i.descriptionId,...r,ref:t})});Tl.displayName=wl;var El=`DialogClose`,Dl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(El,n);return(0,O.jsx)(X.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});Dl.displayName=El;function Ol(e){return e?`open`:`closed`}var kl=`DialogTitleWarning`,[Al,jl]=Po(kl,{contentName:_l,titleName:Sl,docsSlug:`dialog`}),Ml=({titleId:e})=>{let t=jl(kl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
45
|
-
|
|
46
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
47
|
-
|
|
48
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return D.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Nl=`DialogDescriptionWarning`,Pl=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jl(Nl).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Fl=ol,Il=fl,Ll=ml,Rl=vl,zl=Cl,Bl=Tl,Vl=Dl,Hl=Fl,Ul=Il,Wl=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ll,{ref:n,className:y(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Wl.displayName=Ll.displayName;var Gl=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Ul,{children:[(0,O.jsx)(Wl,{}),(0,O.jsxs)(Rl,{ref:r,className:y(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-surface text-text p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,O.jsxs)(Vl,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-bg transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-surface-active data-[state=open]:text-text-muted`,children:[(0,O.jsx)(De,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Gl.displayName=Rl.displayName;var Kl=({className:e,...t})=>(0,O.jsx)(`div`,{className:y(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Kl.displayName=`DialogHeader`;var ql=({className:e,...t})=>(0,O.jsx)(`div`,{className:y(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});ql.displayName=`DialogFooter`;var Jl=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(zl,{ref:n,className:y(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Jl.displayName=zl.displayName;var Yl=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Bl,{ref:n,className:y(`text-sm text-text-muted`,e),...t}));Yl.displayName=Bl.displayName;function Xl(){let[e,t]=(0,D.useState)(!1),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(`prompt`),[o,s]=(0,D.useState)(0),[c,l]=(0,D.useState)(``),[d,f]=(0,D.useState)(`download`);(0,D.useEffect)(()=>p(_.Available,e=>{r(e),a(`prompt`),s(0),l(``),t(!0)}),[]),(0,D.useEffect)(()=>p(_.DownloadProgress,e=>{s(Math.round(e.percent))}),[]);let m=(0,D.useCallback)(async()=>{a(`downloading`),s(0);try{let e=await u(_.Download);e.success?a(`ready`):(l(e.error||`Download failed`),f(`download`),a(`error`))}catch(e){l(e instanceof Error?e.message:String(e)),f(`download`),a(`error`)}},[]),h=(0,D.useCallback)(async()=>{try{let e=await u(_.Install);e.success||(l(e.error||`Install failed`),f(`install`),a(`error`))}catch(e){l(e instanceof Error?e.message:String(e)),f(`install`),a(`error`)}},[]),g=(0,D.useCallback)(()=>{n?.mandatory&&i!==`ready`||t(!1)},[n,i]);return n?(0,O.jsx)(Hl,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&i!==`ready`||t(e)},children:(0,O.jsxs)(Gl,{className:`max-w-md`,children:[(0,O.jsxs)(Kl,{children:[(0,O.jsx)(Jl,{children:i===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(Yl,{children:[i===`prompt`&&`New version ${n.version} is available.`,i===`downloading`&&`Downloading... ${o}%`,i===`ready`&&`Download complete. Click install to restart and apply the update.`,i===`error`&&`${d===`install`?`Install`:`Download`} failed: ${c}`]})]}),n.releaseNotes&&i===`prompt`&&(0,O.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded border border-border bg-surface-2 p-3 text-xs text-text-secondary whitespace-pre-wrap`,children:n.releaseNotes}),i===`downloading`&&(0,O.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-surface-3`,children:(0,O.jsx)(`div`,{className:`h-full bg-accent transition-all duration-300`,style:{width:`${o}%`}})}),(0,O.jsxs)(ql,{children:[i===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(w,{variant:`outline`,onClick:g,children:`Later`}),(0,O.jsx)(w,{onClick:m,children:`Download`})]}),i===`ready`&&(0,O.jsx)(w,{onClick:h,children:`Install & Restart`}),i===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{variant:`outline`,onClick:g,children:`Close`}),(0,O.jsx)(w,{onClick:d===`install`?h:m,children:`Retry`})]})]})]})}):null}var Zl=`Dimina DevTools`;function Ql(){let[e,t]=(0,D.useState)(`list`),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)({}),[c,l]=(0,D.useState)(Zl),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(``);async function g(){a(await Ie())}(0,D.useEffect)(()=>{g(),Fe().then(e=>{e?.appName&&(l(e.appName),document.title=e.appName)}).catch(()=>{})},[]),(0,D.useEffect)(()=>{i.length!==0&&Promise.all(i.map(e=>Je(e.path).then(t=>[e.path,t]))).then(e=>s(Object.fromEntries(e)))},[i]),(0,D.useEffect)(()=>{C(e===`project`?`project`:`list`)},[e]),(0,D.useEffect)(()=>T(()=>{document.title=c,t(`list`),r(null),Ie().then(a)}),[c]);async function _(){let e=await Le();if(!e)return;let t;try{t=await Re(e)}catch{return}await g(),x(t)}async function v(){let e;try{e=await Xe()}catch{e=null}if(e&&`ready`in e){await g(),x(e.ready);return}if(e){let t;try{t=await Ze(e)}catch{return}await g(),x(t);return}let[t,n]=await Promise.allSettled([Ye(),Qe()]);p(t.status===`fulfilled`?t.value:[]),h(n.status===`fulfilled`?n.value.baseDir:``),d(!0)}async function y(e){d(!1);let t;try{t=await Ze(e)}catch{return}await g(),x(t)}async function b(e){await ze(e.path),await g()}function x(e){r(e),t(`project`)}return e===`list`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Xl,{}),(0,O.jsx)(je,{projects:i,onAdd:_,onCreate:v,onOpen:x,onRemove:b,thumbnails:o}),(0,O.jsx)(Pe,{open:u,templates:f,defaultBaseDir:m,onSubmit:y,onCancel:()=>d(!1),onBrowse:Le})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Xl,{}),(0,O.jsx)(Eo,{project:n},n?.path)]})}Oe.createRoot(document.getElementById(`root`)).render((0,O.jsx)(Ql,{}));
|
|
49
|
-
//# sourceMappingURL=index-M5NDq_vi.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,T as r,c as i,i as a}from"./ipc-transport-BgFdT9bT.js";import{t as o}from"./input-dsgeTmVX.js";import{b as s,c,i as l,t as u}from"./select-DAw1hzkl.js";import{n as d}from"./constants-EAMiwL9_.js";function f(e){a(i.Relaunch,e)}var p=t(e(),1),m=t(r(),1),h=n();function g(){let[e,t]=(0,m.useState)({top:0,left:0}),[n,r]=(0,m.useState)({startPage:``,scene:d,queryParams:[]}),[i,a]=(0,m.useState)([]);(0,m.useEffect)(()=>c(e=>{a(e.pages),r(e.config);let n=window.innerWidth-340-8;t({top:e.top,left:Math.min(e.left,n)})}),[]);function p(){l()}function g(){r(e=>({...e,queryParams:[...e.queryParams,{key:``,value:``}]}))}function _(e){r(t=>({...t,queryParams:t.queryParams.filter((t,n)=>n!==e)}))}function v(e,t,n){r(r=>{let i=[...r.queryParams];return i[e]={...i[e]??{key:``,value:``},[t]:n},{...r,queryParams:i}})}function y(){f(n)}return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`fixed inset-0`,onClick:p}),(0,h.jsxs)(`div`,{className:`fixed w-[340px] bg-surface border border-border-strong rounded-md p-3.5 shadow-[0_8px_24px_var(--color-overlay-heavy)] z-10`,style:{top:e.top,left:e.left},onClick:e=>e.stopPropagation(),children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-3`,children:[(0,h.jsx)(`label`,{className:`w-16 shrink-0 text-code-label text-[12px]`,children:`启动页面`}),(0,h.jsxs)(u,{className:`flex-1 min-w-0 bg-surface-input border-text-dim text-text text-[12px] py-0.5`,value:n.startPage,onChange:e=>r(t=>({...t,startPage:e.target.value})),children:[n.startPage&&!i.includes(n.startPage)&&(0,h.jsxs)(`option`,{value:n.startPage,children:[n.startPage,`(页面不存在)`]}),i.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-3`,children:[(0,h.jsx)(`label`,{className:`w-16 shrink-0 text-code-label text-[12px]`,children:`scene 值`}),(0,h.jsx)(o,{type:`number`,className:`w-20 bg-surface-input border-text-dim text-text text-[12px]`,value:n.scene,onChange:e=>r(t=>({...t,scene:Number(e.target.value)||1001}))})]}),(0,h.jsxs)(`div`,{className:`flex items-start gap-2.5 mb-3`,children:[(0,h.jsx)(`label`,{className:`w-16 shrink-0 text-code-label text-[12px] pt-1`,children:`启动参数`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5 flex-1`,children:[n.queryParams.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,h.jsx)(o,{className:`w-24 bg-surface-input border-text-dim text-text text-[12px]`,value:e.key,placeholder:`参数名`,onChange:e=>v(t,`key`,e.target.value)}),(0,h.jsx)(o,{className:`w-24 bg-surface-input border-text-dim text-text text-[12px]`,value:e.value,placeholder:`参数值`,onChange:e=>v(t,`value`,e.target.value)}),(0,h.jsx)(s,{variant:`ghost`,size:`icon-sm`,className:`text-text-secondary hover:text-status-error hover:bg-transparent`,onClick:()=>_(t),children:`×`})]},t)),(0,h.jsx)(s,{variant:`outline`,size:`xs`,className:`border-dashed border-text-dim text-text-secondary hover:border-accent hover:text-accent hover:bg-transparent`,onClick:g,children:`+ 添加参数`})]})]}),(0,h.jsx)(`div`,{className:`mt-3.5`,children:(0,h.jsx)(s,{onClick:y,children:`▶ 重新编译`})})]})]})}p.createRoot(document.getElementById(`root`)).render((0,h.jsx)(g,{}));
|
|
2
|
-
//# sourceMappingURL=popover-Disfu1cx.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,T as r}from"./ipc-transport-BgFdT9bT.js";import{t as i}from"./input-dsgeTmVX.js";import{l as a,n as o,o as s,t as c}from"./settings-api-DFR5eDl_.js";var l=t(e(),1),u=t(r(),1),d=n(),f=[{id:`local`,label:`本地设置`},{id:`project`,label:`项目配置`}];function p(){let[e,t]=(0,u.useState)(`local`),[n,r]=(0,u.useState)(``),[l,p]=(0,u.useState)({startPage:``,scene:1001,queryParams:[]}),[m,h]=(0,u.useState)({uploadWithSourceMap:!1});(0,u.useEffect)(()=>s(e=>{r(e.projectPath),p(e.config),h({uploadWithSourceMap:!!e.projectSettings?.uploadWithSourceMap})}),[]);function g(e){let t={...l,...e};p(t),o(t)}function _(e){let t={...m,...e};h(t),c(t)}function v(e,t,n){return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-md border border-border bg-bg hover:bg-surface-3 transition-colors text-left`,children:[(0,d.jsx)(`span`,{className:`h-4 w-4 rounded-sm border flex items-center justify-center text-[11px] ${t?`bg-accent border-accent text-white`:`border-border bg-surface text-transparent`}`,children:`✓`}),(0,d.jsx)(`span`,{className:`text-[12px] text-text`,children:e})]})}return(0,d.jsx)(`div`,{"data-testid":`settings-backdrop`,className:`fixed inset-0`,onClick:()=>void a(!1),children:(0,d.jsxs)(`div`,{"data-testid":`settings-panel`,className:`fixed top-0 right-0 h-full w-[320px] flex flex-col bg-surface text-text border-l border-border shadow-[0_8px_24px_var(--color-overlay-heavy)]`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(`div`,{className:`flex items-center border-b border-border shrink-0`,children:f.map(n=>(0,d.jsx)(`button`,{className:`flex-1 py-2.5 text-[12px] text-center transition-colors ${e===n.id?`text-accent border-b-2 border-accent`:`text-text-secondary hover:text-text`}`,onClick:()=>t(n.id),children:n.label},n.id))}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[e===`local`&&(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`div`,{className:`text-[12px] text-text-secondary`,children:`本地设置`}),v(`上传时启用 Sourcemap`,m.uploadWithSourceMap,e=>_({uploadWithSourceMap:e}))]}),e===`project`&&(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b border-border`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`本地目录`}),(0,d.jsx)(`span`,{className:`text-[12px] text-text truncate ml-4 max-w-[180px]`,title:n,children:n})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-[12px] text-text-secondary mb-1`,children:`启动页面`}),(0,d.jsx)(i,{value:l.startPage,onChange:e=>g({startPage:e.target.value}),className:`w-full h-8 px-2 text-[12px]`})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-[12px] text-text-secondary mb-1`,children:`Scene`}),(0,d.jsx)(i,{type:`number`,value:l.scene,onChange:e=>g({scene:parseInt(e.target.value||`1001`,10)}),className:`w-full h-8 px-2 text-[12px]`})]})]})]})]})})}l.createRoot(document.getElementById(`root`)).render((0,d.jsx)(p,{}));
|
|
2
|
-
//# sourceMappingURL=settings-M_8GFW2M.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as e,i as t,n,r,t as i,x as a}from"./ipc-transport-BgFdT9bT.js";function o(t){return i(e.SetVisible,t)}function s(n){t(e.ConfigChanged,n)}function c(n){t(e.ProjectSettingsChanged,n)}function l(t){return r(e.Init,e=>t(e))}function u(){return n(a.Get)}function d(e){return i(a.Save,e)}function f(e){return i(a.SetTheme,e)}function p(){return n(a.GetCdpStatus)}function m(){return n(a.GetMcpStatus)}function h(e){return r(a.Init,t=>e(t))}export{u as a,d as c,m as i,o as l,s as n,l as o,p as r,h as s,c as t,f as u};
|
|
2
|
-
//# sourceMappingURL=settings-api-DFR5eDl_.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,T as r}from"./ipc-transport-BgFdT9bT.js";import{t as i}from"./constants-EAMiwL9_.js";import{a,c as o,i as s,r as c,s as l,u}from"./settings-api-DFR5eDl_.js";var d=t(e(),1),f=t(r(),1),p=n(),m=[{id:`general`,label:`通用`},{id:`debug`,label:`调试`},{id:`mcp`,label:`MCP`}],h={system:`跟随系统`,dark:`深色`,light:`浅色`};function g({checked:e,onClick:t}){return(0,p.jsx)(`button`,{type:`button`,onClick:t,className:`relative inline-flex h-5 w-9 shrink-0 rounded-full transition-colors`,style:{background:e?`var(--color-accent)`:`var(--color-surface-3)`},children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform`,style:{marginTop:3,transform:e?`translateX(18px)`:`translateX(3px)`}})})}function _({activeTab:e,onSelect:t}){return(0,p.jsx)(`div`,{className:`flex items-center border-b border-border shrink-0`,children:m.map(n=>(0,p.jsx)(`button`,{className:`flex-1 py-2.5 text-[12px] text-center transition-colors ${e===n.id?`text-accent border-b-2 border-accent`:`text-text-secondary hover:text-text`}`,onClick:()=>t(n.id),children:n.label},n.id))})}function v({theme:e,onSelect:t}){return(0,p.jsx)(`div`,{className:`flex rounded overflow-hidden border border-border text-[11px]`,children:[`system`,`dark`,`light`].map((n,r)=>(0,p.jsx)(`button`,{onClick:()=>t(n),className:[`px-3 py-1 transition-colors`,r>0?`border-l border-border`:``,e===n?`bg-accent text-white`:`text-text-secondary hover:text-text hover:bg-surface-3`].join(` `),children:h[n]},n))})}function y({autoBuildEnabled:e,onAutoBuildChange:t,autoReloadEnabled:n,onAutoReloadChange:r,theme:i,onThemeChange:a,saved:o}){return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`编译与预览`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`开启「自动编译」后,打开项目时会监听源文件改动并自动重新编译。开启「自动刷新」后,每次编译完成会刷新模拟器(仅改样式时原地热替换,保留当前页面栈与表单状态);关闭它则任何改动都不刷新,仅手动刷新。配置在下次打开项目时生效。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`监听文件变化自动编译`}),(0,p.jsx)(g,{checked:e,onClick:()=>t(!e)})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`编译完成后自动刷新模拟器`}),(0,p.jsx)(g,{checked:n,onClick:()=>r(!n)})]})]}),(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-3 bg-bg`,children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`外观`})}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`颜色模式`}),(0,p.jsx)(v,{theme:i,onSelect:a})]})]}),o&&(0,p.jsx)(`div`,{className:`text-[11px] text-status-success`,children:`已保存`})]})}function b({cdpStatus:e}){return(0,p.jsxs)(`div`,{className:`rounded p-3 space-y-2 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium text-text-secondary`,children:`当前状态`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e?.active?`var(--color-status-success)`:`var(--color-text-dim)`}}),(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:e?.active?`CDP 已激活 - 端口 ${e.activePort}`:`CDP 未激活`})]}),e?.implicitDevDefault&&(0,p.jsx)(`div`,{className:`text-[11px] text-text-dim`,children:`当前为开发模式默认端口`}),e?.active&&(0,p.jsxs)(`div`,{className:`text-[11px] text-text-dim font-mono`,children:[`调试地址: http://localhost:`,e.activePort]})]})}function x(e,t){return!e||e.implicitDevDefault?!1:t.enabled===e.active?t.enabled&&e.active&&t.port!==e.activePort:!0}function S({cdpEnabled:e,onToggleCdp:t,portInput:n,onPortInputChange:r,cdpStatus:a,needsRestart:o,onSave:s,saved:c}){return(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`DevTools Protocol`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`开启后可通过 DevTools Protocol 连接调试模拟器。配置变更需要重启应用后生效。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`启用 DevTools Protocol`}),(0,p.jsx)(g,{checked:e,onClick:t})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`label`,{className:`text-[12px] shrink-0 w-16 text-text-secondary`,children:`调试端口`}),(0,p.jsx)(`input`,{type:`number`,min:1024,max:65535,value:n,onChange:e=>r(e.target.value),disabled:!e,className:`w-24 h-7 px-2 rounded text-[12px] outline-none bg-surface border border-border text-text`,style:{opacity:e?1:.4}}),(0,p.jsxs)(`span`,{className:`text-[11px] text-text-dim`,children:[`默认 `,i]})]}),(0,p.jsx)(b,{cdpStatus:a}),o&&(0,p.jsx)(`div`,{className:`rounded px-3 py-2 text-[12px] border bg-warn-bg text-[var(--color-status-warn)]`,children:`配置已变更,需要重启应用后生效`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`button`,{onClick:s,className:`h-7 px-4 rounded text-[13px] font-medium text-white bg-accent hover:bg-accent-hover`,children:`保存`}),c&&(0,p.jsx)(`span`,{className:`text-[11px] text-status-success`,children:`已保存`})]})]})}function C({color:e,children:t}){return(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:t})]})}function w({mcpEnabled:e,mcpStatus:t}){return(0,p.jsxs)(`div`,{className:`rounded p-3 space-y-2 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium text-text-secondary`,children:`当前状态`}),e?t?.running?(0,p.jsxs)(C,{color:`var(--color-status-success)`,children:[`MCP 已运行 - 端口 `,t.activePort]}):(0,p.jsxs)(C,{color:`var(--color-status-error, #e54d4d)`,children:[`MCP 未运行`,t?.error===`port-in-use`?`(端口 ${t.configuredPort} 已被占用)`:t?.error?`(${t.error})`:``]}):(0,p.jsx)(C,{color:`var(--color-text-dim)`,children:`MCP 未启用`})]})}function T({mcpEnabled:e,onToggleMcp:t,mcpPortInput:n,onMcpPortInputChange:r,mcpStatus:i,mcpPort:a,onSave:o,saved:s}){return(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`MCP 配置`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`AI 助手可以通过 MCP 连接当前开发工具,读取 console、截图、执行 JS、查看 DOM / Storage / 网络请求。启用后开发工具启动时会自动监听 SSE 端点,并自动启用 CDP。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`启用 MCP 服务`}),(0,p.jsx)(g,{checked:e,onClick:t})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`label`,{className:`text-[12px] shrink-0 w-16 text-text-secondary`,children:`SSE 端口`}),(0,p.jsx)(`input`,{type:`number`,min:1024,max:65535,value:n,onChange:e=>r(e.target.value),disabled:!e,className:`w-24 h-7 px-2 rounded text-[12px] outline-none bg-surface border border-border text-text`,style:{opacity:e?1:.4}}),(0,p.jsx)(`span`,{className:`text-[11px] text-text-dim`,children:`默认 7789`})]}),(0,p.jsx)(w,{mcpEnabled:e,mcpStatus:i}),(0,p.jsxs)(`div`,{className:`rounded p-3 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium mb-2 text-text-secondary`,children:"`.mcp.json` 示例(SSE 传输)"}),(0,p.jsx)(`pre`,{className:`text-[11px] whitespace-pre-wrap leading-relaxed text-[var(--color-code-blue)] font-mono`,children:`{
|
|
2
|
-
"mcpServers": {
|
|
3
|
-
"dimina-devtools": {
|
|
4
|
-
"url": "http://127.0.0.1:${a}/sse"
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
}`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`button`,{onClick:o,className:`h-7 px-4 rounded text-[13px] font-medium text-white bg-accent hover:bg-accent-hover`,children:`保存`}),s&&(0,p.jsx)(`span`,{className:`text-[11px] text-status-success`,children:`已保存`})]})]})}function E(){let[e,t]=(0,f.useState)({cdp:{enabled:!1,port:i},mcp:{enabled:!1,port:7789},compile:{autoBuild:!0},preview:{autoReload:!0},theme:`system`,lastCreateBaseDir:null}),[n,r]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(`general`),[v,b]=(0,f.useState)(!1),[C,w]=(0,f.useState)(String(i)),[E,D]=(0,f.useState)(`7789`);(0,f.useEffect)(()=>{let e=l(e=>{t(e.settings),w(String(e.settings.cdp.port)),D(String(e.settings.mcp.port))});return a().then(e=>{t(e),w(String(e.cdp.port)),D(String(e.mcp.port))}),c().then(r),s().then(m),e},[]);function O(){b(!0),window.setTimeout(()=>b(!1),2e3)}function k(){t(e=>({...e,cdp:{...e.cdp,enabled:!e.cdp.enabled}}))}function A(){t(e=>({...e,mcp:{...e.mcp,enabled:!e.mcp.enabled}}))}function j(n){let r={...e,theme:n};t(r),u(n),o(r)}function M(e){t(e),o(e).then(O)}async function N(){let n=parseInt(C,10);if(Number.isNaN(n)||n<1024||n>65535)return;let i=parseInt(E,10);if(Number.isNaN(i)||i<1024||i>65535)return;let a={...e,cdp:{...e.cdp,port:n},mcp:{...e.mcp,port:i}};t(a),await o(a),r(await c()),m(await s()),O()}let P=x(n,e.cdp);return(0,p.jsxs)(`div`,{className:`flex flex-col h-screen bg-surface text-text`,children:[(0,p.jsx)(_,{activeTab:h,onSelect:g}),(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[h===`general`&&(0,p.jsx)(y,{autoBuildEnabled:e.compile.autoBuild,onAutoBuildChange:t=>M({...e,compile:{...e.compile,autoBuild:t}}),autoReloadEnabled:e.preview.autoReload,onAutoReloadChange:t=>M({...e,preview:{...e.preview,autoReload:t}}),theme:e.theme,onThemeChange:j,saved:v}),h===`debug`&&(0,p.jsx)(S,{cdpEnabled:e.cdp.enabled,onToggleCdp:k,portInput:C,onPortInputChange:w,cdpStatus:n,needsRestart:P,onSave:N,saved:v}),h===`mcp`&&(0,p.jsx)(T,{mcpEnabled:e.mcp.enabled,onToggleMcp:A,mcpPortInput:E,onMcpPortInputChange:D,mcpStatus:d,mcpPort:e.mcp.port,onSave:N,saved:v})]})]})}d.createRoot(document.getElementById(`root`)).render((0,p.jsx)(E,{}));
|
|
8
|
-
//# sourceMappingURL=workbenchSettings-CxdXeoOu.js.map
|