@dimina-kit/devtools 0.4.0-dev.20260718143821 → 0.4.0-dev.20260728063215
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 +67 -1
- package/dist/main/app/lifecycle.js +9 -0
- package/dist/main/index.bundle.js +928 -162
- package/dist/main/ipc/bridge-router.d.ts +36 -0
- package/dist/main/ipc/bridge-router.js +56 -0
- package/dist/main/ipc/index.d.ts +1 -0
- package/dist/main/ipc/index.js +1 -0
- package/dist/main/ipc/internal-devtools.d.ts +15 -0
- package/dist/main/ipc/internal-devtools.js +9 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +15 -1
- package/dist/main/services/console-forward/index.js +42 -2
- package/dist/main/services/console-forward/internal-log.d.ts +11 -0
- package/dist/main/services/console-forward/internal-log.js +23 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/diagnostics/index.d.ts +10 -0
- package/dist/main/services/elements-forward/index.js +14 -96
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +64 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +113 -8
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/index.d.ts +31 -0
- package/dist/main/services/network-forward/index.js +256 -8
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/views/console-filter.d.ts +145 -0
- package/dist/main/services/views/console-filter.js +233 -0
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/native-simulator-devtools-host.js +138 -30
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +182 -0
- package/dist/main/services/workbench-context.d.ts +10 -0
- package/dist/main/utils/theme.d.ts +10 -6
- package/dist/main/utils/theme.js +10 -6
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/native-host/render/render.js +89 -73
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +1 -1
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/renderer/assets/index-M5NDq_vi.js +49 -0
- package/dist/renderer/assets/{input-c2OcrrZy.js → input-dsgeTmVX.js} +2 -2
- package/dist/renderer/assets/ipc-transport-BgFdT9bT.js +9 -0
- package/dist/renderer/assets/{popover-kv2qspWz.js → popover-Disfu1cx.js} +2 -2
- package/dist/renderer/assets/{select-DKqzMtTh.js → select-DAw1hzkl.js} +2 -2
- package/dist/renderer/assets/{settings-dJNKTGr8.js → settings-M_8GFW2M.js} +2 -2
- package/dist/renderer/assets/settings-api-DFR5eDl_.js +2 -0
- package/dist/renderer/assets/{workbenchSettings-DQ_VP5-W.js → workbenchSettings-CxdXeoOu.js} +2 -2
- 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 +3 -0
- package/dist/shared/ipc-channels.js +6 -0
- package/package.json +8 -8
- package/dist/renderer/assets/index-DfDIvgvK.js +0 -49
- package/dist/renderer/assets/ipc-transport-CuDJ07aE.js +0 -9
- package/dist/renderer/assets/settings-api-qpXKDRXt.js +0 -2
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.20260728063215",
|
|
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/
|
|
89
|
-
"@dimina-kit/
|
|
90
|
-
"@dimina-kit/view-anchor": "0.1.0-dev.
|
|
91
|
-
"@dimina-kit/
|
|
88
|
+
"@dimina-kit/devkit": "0.1.2-dev.20260728063215",
|
|
89
|
+
"@dimina-kit/electron-deck": "0.1.0-dev.20260728063215",
|
|
90
|
+
"@dimina-kit/view-anchor": "0.1.0-dev.20260728063215",
|
|
91
|
+
"@dimina-kit/inspect": "0.4.0-dev.20260728063215"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@playwright/test": "^1.59.1",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"clsx": "^2.1.1",
|
|
116
116
|
"cmdk": "^1.1.1",
|
|
117
117
|
"concurrently": "^9.2.1",
|
|
118
|
-
"electron": "^
|
|
118
|
+
"electron": "^43.2.0",
|
|
119
119
|
"electron-builder": "^26.8.1",
|
|
120
120
|
"esbuild": "^0.28.1",
|
|
121
121
|
"eslint": "^10.2.1",
|
|
@@ -132,12 +132,12 @@
|
|
|
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": {
|
|
140
|
-
"electron": "
|
|
140
|
+
"electron": "^43.2.0"
|
|
141
141
|
},
|
|
142
142
|
"publishConfig": {
|
|
143
143
|
"access": "public"
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import{C as e,S as t,T as n,_ as r,a as i,c as a,f as o,g as s,h as c,l,m as u,n as d,o as f,r as p,t as m,u as h,w as g,x as _}from"./ipc-transport-CuDJ07aE.js";import{n as v,r as y,t as b}from"./input-c2OcrrZy.js";import{_ as x,a as S,b as C,d as w,f as T,g as E,h as ee,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue,v as de,y as fe}from"./select-DKqzMtTh.js";import{n as pe}from"./constants-EAMiwL9_.js";import{l as me}from"./settings-api-qpXKDRXt.js";var he=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ge=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),_e=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ve=e=>{let t=_e(e);return t.charAt(0).toUpperCase()+t.slice(1)},ye={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`},be=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=n(g()),xe=(0,D.createContext)({}),Se=()=>(0,D.useContext)(xe),Ce=(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=``}=Se()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,D.createElement)(`svg`,{ref:c,...ye,width:t??l??ye.width,height:t??l??ye.height,stroke:e??f,strokeWidth:m,className:he(`lucide`,p,i),...!a&&!be(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,D.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),we=(e,t)=>{let n=(0,D.forwardRef)(({className:n,...r},i)=>(0,D.createElement)(Ce,{ref:i,iconNode:t,className:he(`lucide-${ge(ve(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ve(e),n},Te=we(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ee=we(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),De=n(t(),1),O=_();function Oe({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:y(e.lastOpened)})]}),i&&(0,O.jsx)(C,{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 ke(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 Ae({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)(Te,{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)(b,{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)(C,{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)(ke,{onClick:l}),c.map(e=>(0,O.jsx)(Oe,{project:e,onOpen:r,onRemove:i,thumbnail:a?.[e.path]},e.path))]})]})})}function je(e){return e.trim().replace(/[\\/:*?"<>|]+/g,`-`).replace(/\s+/g,`-`).replace(/-{2,}/g,`-`).replace(/^[-.]+|[-.]+$/g,``)}function Me(e,t){return t?e?e.endsWith(`/`)?`${e}${t}`:`${e}/${t}`:t:``}function Ne(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=je(e);u(t?Me(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 Pe(){return m(i.GetBranding)}function Fe(){return d(l.List)}function Ie(){return m(f.OpenDirectory)}function Le(e){return d(l.Add,e)}function Re(e){return m(l.Remove,e)}function ze(e){return d(a.Open,e)}function Be(e){return d(a.GetPages,e)}function Ve(e){return d(a.GetCompileConfig,e)}function He(e,t){return d(a.SaveCompileConfig,e,t)}function Ue(e){return p(a.Status,t=>e(t))}function We(e){return p(a.CompileLog,t=>e(t))}function Ge(e){return p(h.RuntimeStatus,t=>e(t))}function Ke(e){return m(a.CaptureThumbnail,e)}function qe(e){return m(a.GetThumbnail,e)}function Je(){return d(l.ListTemplates)}function Ye(){return m(l.OpenCreateDialog)}function Xe(e){return d(l.Create,e)}function Ze(){return d(l.GetCreateDefaults)}var Qe={selected:`simulator`,simulatorVisible:!0};function $e(e){return e+48}function et(e,t){return Math.max(200,Math.min(t-200,e))}function tt(e){let{initialDevice:t}=e,[n,r]=(0,D.useState)(t),[i,a]=(0,D.useState)(85),[o,s]=(0,D.useState)(()=>$e(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=>{oe({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=de.find(t=>t.name===e.target.value)??de[1];r(t),u(t),s($e(t.width))},[u]),handleZoomChange:(0,D.useCallback)(e=>{a(e.target.value===`auto`?E: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(et(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 nt=200,rt=300;function it(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:pe,queryParams:[]});(0,D.useEffect)(()=>{let e=!1;async function n(){try{let n=await ze(t);if(e)return;if(!n.success){r({status:`error`,message:n.error});return}let[i,o]=await Promise.all([Be(t),Ve(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)(()=>Ue(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>nt?i.slice(i.length-nt):i}),e.hotReload===!0&&(b(null),p(e=>e+1))}),[]),(0,D.useEffect)(()=>Ge(e=>{i?.appId&&e.appId!==i.appId||b(e)}),[i]),(0,D.useEffect)(()=>We(e=>{let t=++v.current;_(n=>{let r=[...n,{...e,seq:t}];return r.length>rt?r.slice(r.length-rt):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 He(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 at=[`appId`,`entry`,`page`];function ot(e){return encodeURIComponent(e).replace(/%2F/g,`/`).replace(/%2C/g,`,`)}function st(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 ct(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 lt(e,t,n={}){let r=st(t),i=[`appId=${ot(e)}`,`entry=${ot(r)}`,`page=${ot(r)}`];for(let[e,t]of Object.entries(n))at.includes(e)||i.push(`${encodeURIComponent(e)}=${ot(t)}`);return i.join(`&`)}function ut(e){let t=e.host??`localhost`,n=e.pathname??`/simulator.html`,r=lt(e.appId,e.page,e.extras??{});return`http://${t}:${e.port}${n}?${r}`}function dt(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(`,`)),ut({appId:e,page:{pagePath:i,query:a},port:n,extras:o})}function ft(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=ct(r),a=t.get(`page`);return{appId:n,entry:i,current:a&&a!==r?ct(a):i}}function pt(e){if(!e)return null;try{return ft(new URL(e).search)}catch{return null}}function mt(e){return pt(e)?.current.pagePath??``}function ht(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?``:dt(a.appId,o,s),[a,o,s]),[f,p]=(0,D.useState)(()=>mt(d));(0,D.useEffect)(()=>{p(mt(d))},[d]),(0,D.useEffect)(()=>ue(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=dt(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||Ke(c).catch(()=>{})},3e3))},f=()=>{ie(a,r.current).then(u).catch(()=>{})};return e?ee(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 gt(){return{getSnapshot:async()=>await m(s.GetSnapshot)??null,subscribe:e=>p(s.Event,e),setActive:e=>{m(s.SetActive,e)},inspect:async e=>await m(u.Inspect,e)??null,clearInspection:async()=>{await m(u.Clear)}}}var _t={ok:!1,error:`ipc transport failed`};function vt(){return{getSnapshot:async()=>await m(c.GetSnapshot)??[],subscribe:e=>p(c.Event,e),setActive:()=>{},setItem:async(e,t)=>await m(c.Set,{key:e,value:t})??_t,removeItem:async e=>await m(c.Remove,{key:e})??_t,clear:async()=>await m(c.Clear)??_t,clearAll:async()=>await m(c.ClearAll)??_t,getPrefix:async()=>await m(c.GetActivePrefix)??``}}var yt={bridges:[],entries:{}};function bt(){return{getSnapshot:async()=>await m(o.GetSnapshot)??yt,subscribe:e=>p(o.Event,e),setActive:()=>{},setData:async(e,t)=>await m(o.SetData,{bridgeId:e,data:t})??!1}}function xt(e){let{compileStatus:t}=e,n=t.status===`ready`;return{wxmlSource:(0,D.useMemo)(()=>gt(),[]),wxmlEnabled:n,storageSource:(0,D.useMemo)(()=>vt(),[]),storageEnabled:n,appDataSource:(0,D.useMemo)(()=>bt(),[]),appDataEnabled:n}}function St(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 Ct(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=ce(()=>o(!1)),t=ne(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 te(),!1;let t=i.current;if(!t)return e;let n=t.getBoundingClientRect();return re({top:Math.round(n.bottom-40+6),left:Math.round(n.left),config:c.current,pages:l.current}),!0})},[i])}}function wt(e){let{projectPath:t,initialDevice:n=de[1],initialRightPane:r=Qe}=e,i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=tt({initialDevice:n}),s=it({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=ht({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=xt({compileStatus:s.compileStatus,activePagePath:c.currentPage}),u=St({initialRightPane:r}),d=Ct({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 Tt={dockTree:null,simulatorAlignment:`left`,devtoolsPosition:`inEditor`},Et=`dimina-devtools.layout.v1`;function Dt(){try{let e=window.localStorage.getItem(Et);if(!e)return Tt;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 Tt}}function Ot(e){try{window.localStorage.setItem(Et,JSON.stringify(e))}catch{}}function kt(){let[e,t]=(0,D.useState)(Dt);return(0,D.useEffect)(()=>{Ot(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 At={compiling:`bg-status-warn animate-[pulse_1s_infinite]`,ready:`bg-accent`,error:`bg-status-error`};function jt({status:e}){return(0,O.jsx)(`span`,{className:v(`w-1.5 h-1.5 rounded-full shrink-0`,At[e]??`bg-border`)})}function Mt(){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 Nt=64;function Pt(e){return JSON.stringify(e)}function Ft(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 It(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 Lt(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)It(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 Rt(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 zt(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)Rt(e,t,n)||(i=!1);i&&n.push(`split ${t??`?`}: all children are px-sized constraints; at least one must be weight-sized`)}function Bt(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 Vt(e,t){let n=[],r={seenIds:new Set,seenObjects:new Set,panelOwners:new Map,knownPanelIds:t},i=(e,t,a)=>{if(t>Nt){n.push(`depth exceeds ${Nt}`);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;Ft(l,c,r,n),c===`tabs`?Lt(e,l,r,n):c===`split`?Ht(e,l,t,a,o,r,n,i):n.push(`unknown node kind: ${String(c)}`)};return i(e,0,new Set),n}function Ht(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&&zt(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}`),Bt(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 Ut(e,t){return typeof e!=`object`||!e?[`tree is not an object`]:e.version===1?Vt(e.root,t):[`unsupported version: ${String(e.version)}`]}function Wt(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=Vt(n.root,null);if(r.length>0)throw Error(`parseLayout: illegal layout — ${r.join(`; `)}`);return{version:1,root:n.root}}var Gt=1;function Kt(e,t){return(e.constraints?.[t]??null)===null}function qt(e){if(e.kind===`tabs`)return e;let t=e.children.map(qt),n=t.some((t,n)=>t!==e.children[n]),r=e.sizes.map((t,r)=>!Kt(e,r)||typeof t==`number`&&Number.isFinite(t)&&t>0?t:(n=!0,Gt));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 Jt(e){let t=qt(e.root);return t===e.root?e:{version:1,root:t}}function Yt(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 Xt(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 Zt(e,t){return Xt(e,t)?.id}function Qt(e){return e.kind===`tabs`?e.panels.length:e.children.reduce((e,t)=>e+Qt(t),0)}function k(e,t,n){return{kind:`tabs`,id:e,panels:t,active:n}}function $t(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 en(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=en(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 tn(e){let t=en(e);if(t===null)throw Error(`mutation would empty the entire layout`);return t}function nn(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 rn(e,t){return nn(e).has(t)}function an(e){let t=new Set,n=e=>{t.add(e.id),e.kind===`split`&&e.children.forEach(n)};return n(e),t}function A(e,t){let n=t,r=2;for(;e.has(n);)n=`${t}#${r}`,r+=1;return e.add(n),n}function on(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 j(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=>j(e,t,n)),sizes:[...e.sizes]};return e.constraints===void 0?r:{...r,constraints:[...e.constraints]}}function sn(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(sn),sizes:[...e.sizes]};return e.constraints===void 0?t:{...t,constraints:[...e.constraints]}}function M(e){return{version:1,root:e}}function cn(e,t,n){let r=on(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(sn),sizes:[...n]},a=r.constraints===void 0?i:{...i,constraints:[...r.constraints]};return M(j(e.root,t,a))}function ln(e,t,n,r){let i=on(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(sn),sizes:[...i.sizes],constraints:a};return M(j(e.root,t,o))}function un(e,t,n){let r=Yt(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 M(j(e.root,t,i))}function dn(e,t){let n=Xt(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,$t(i,n.active,r));return tn(j(e,n.id,a))}function fn(e,t){let n=nn(e.root);return n.size===1&&n.has(t)?e:M(dn(e.root,t))}function pn(e,t){if(!Xt(e.root,t))throw Error(`extractPanel: panel not found: ${t}`);return{tree:M(dn(e.root,t)),extracted:t}}function mn(e,t,n){if(rn(e.root,t))throw Error(`insertPanel: panel already exists in the tree: ${t}`);let r=Yt(e.root,n.groupId);if(!r)throw Error(`insertPanel: dest group not found: ${n.groupId}`);let i=[...r.panels],a=hn(n.index,i.length);i.splice(a,0,t);let o=k(r.id,i,r.active);return M(tn(j(e.root,r.id,o)))}function hn(e,t){return e===void 0?t:e<0?0:e>t?t:e}function gn(e,t,n){let r=Xt(e.root,t);if(!r)throw Error(`movePanel: panel not found: ${t}`);let i=Yt(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=hn(n.index,i.length),o=[...i];o.splice(a,0,t);let s=k(r.id,o,r.active);return M(tn(j(e.root,r.id,s)))}let a=r.panels.indexOf(t),o=r.panels.filter(e=>e!==t),s=k(r.id,o,$t(o,r.active,a)),c=[...i.panels],l=hn(n.index,c.length);c.splice(l,0,t);let u=k(i.id,c,i.active),d=j(e.root,r.id,s);return d=j(d,i.id,u),M(tn(d))}function _n(e,t,n,r){if(rn(e.root,t))throw Error(`wrapRoot: new panel already exists in the tree: ${t}`);let i=an(e.root),a=e.root.id,o=k(A(i,`${a}__new`),[t],t),s=sn(e.root),c=r===`after`?[s,o]:[o,s];return M({kind:`split`,id:A(i,`${a}__wrap`),orientation:n,children:c,sizes:[1,1]})}function vn(e,t,n,r,i){if(rn(e.root,r))throw Error(`splitGroup: new panel already exists in the tree: ${r}`);let a=Yt(e.root,t);if(!a)throw Error(`splitGroup: group not found: ${t}`);let o=an(e.root),s=k(A(o,`${t}__new`),[r],r),c=sn(a),l=i===`after`?[c,s]:[s,c],u={kind:`split`,id:A(o,`${t}__sp`),orientation:n,children:l,sizes:[1,1]};return M(tn(j(e.root,t,u)))}function N(e,t,n,r,i){if(rn(e.root,r))throw Error(`splitPanel: new panel already exists in the tree: ${r}`);let a=Xt(e.root,t);if(!a)throw Error(`splitPanel: panel not found: ${t}`);let o=an(e.root),s=a.id,c=k(A(o,`${s}__split`),[t],t),l=k(A(o,`${s}__new`),[r],r),u=i===`after`?[c,l]:[l,c],d={kind:`split`,id:A(o,`${s}__sp`),orientation:n,children:u,sizes:[1,1]};if(a.panels.length===1)return M(tn(j(e.root,s,d)));let f=a.panels.indexOf(t),p=a.panels.filter(e=>e!==t),m=k(s,p,$t(p,a.active,f)),h=i===`after`?[m,d]:[d,m],g={kind:`split`,id:A(o,`${s}__outer`),orientation:n,children:h,sizes:[1,1]};return M(tn(j(e.root,s,g)))}function yn(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 bn(e,t,n){return n.get(t)?.closable===!1?e:fn(e,t)}function xn(){let e=Mt();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 Sn(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 Cn={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},wn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),Tn=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),En=()=>({...Cn,panels:[...Cn.panels]});function Dn(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 On(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[wn(),En()]};return r?Dn([t,Tn()],0,e,[1,6]):Dn([Tn(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?Dn([wn(),En(),Tn()],0,e,[1,4,5]):Dn([Tn(),En(),wn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[Tn(),En()]};return r?Dn([wn(),i],0,e,[1,6]):Dn([i,wn()],1,e,[6,1])}function kn(e,t,n){return yn(An(e,t,n))}function An(e,t,n){if(e===null)return Sn(t);try{let r=Wt(e);if(Ut(r,n).length===0)return jn(Jt(r),t)}catch{}return Sn(t)}function jn(e,t){let n=Pn(e);return Mn.some(e=>n.has(e))?Mn.reduce((e,r)=>n.has(r)?e:zn(e,r,t),e):e}var Mn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Nn(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)Nn(n,t)}function Pn(e){let t=new Set;return Nn(e.root,t),t}function Fn(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=Fn(n,t);if(e!==void 0)return e}}function In(e,t){return t.find(t=>e.has(t))}function Ln(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=Ln(e.children[n],t);if(r)return r}return null}function Rn(e,t){let n=Fn(e.root,`simulator`);if(!n)return e;let r=Ln(e.root,n);return r?ln(e,r.splitId,r.childIndex,{minPx:t}):e}function zn(e,t,n){let r=Pn(e);if(r.has(t))return e;if(Mn.includes(t)){let n=Mn.find(e=>e!==t&&r.has(e));return n?mn(e,t,{groupId:Fn(e.root,n)}):r.has(`editor`)?N(e,`editor`,`column`,t,`after`):r.has(`simulator`)?N(e,`simulator`,`row`,t,`after`):N(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=In(r,Mn);return t?vn(e,Fn(e.root,t),`column`,`editor`,`before`):r.has(`simulator`)?N(e,`simulator`,`row`,`editor`,`after`):N(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?Rn(_n(e,`simulator`,`row`,`before`),n):N(e,[...r][0],`column`,t,`after`)}function Bn(e,t){let n=Pn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Vn=Mn;function Hn({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(Bn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Vn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?bn(e,r,t):zn(e,r,n))}function u(){if(s){let t=Vn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>fn(e,t),e))}else{let t=Vn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>zn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Gn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(Kn,{filled:a})}),(0,O.jsx)(Gn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(qn,{filled:o})}),(0,O.jsx)(Gn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Jn,{filled:s})})]})}function Un({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(()=>On(n,r,i))}return(0,O.jsx)(C,{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)(Yn,{side:r})})}function Wn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>On(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)(Gn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Xn,{variant:e.id})},e.id))})}function Gn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(C,{variant:`icon`,size:`icon`,onClick:n,disabled:t,title:r,"aria-pressed":e,"data-testid":i,"data-active":e?`true`:`false`,className:v(`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 Kn({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 qn({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 Jn({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 Yn({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 Xn({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 Zn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function Qn({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)(C,{variant:`outline`,size:`sm`,onClick:n,className:v(t&&`border-accent`),title:`编译模式`,children:[`普通编译 `,(0,O.jsx)(`span`,{className:`text-[10px] text-text-secondary`,children:`▾`})]})}),(0,O.jsx)(Zn,{}),(0,O.jsx)(C,{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)(jt,{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)(Hn,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Zn,{}),(0,O.jsx)(Un,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Zn,{}),(0,O.jsx)(Wn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Zn,{}),(0,O.jsx)(C,{variant:`icon`,size:`icon`,onClick:()=>{me(!0)},title:`设置`,children:`⚙`})]})})}var $n={x:0,y:0,width:0,height:0},er=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 tr(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return er({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($n))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function nr(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:er({x:t.left,y:t.top,width:t.width,height:t.height})}}var rr=(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 ir(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=nr(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&&rr(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&&rr(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 ar(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=tr(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=tr(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}var or=(0,D.createContext)(null);function sr(){return(0,D.useContext)(or)}var P={simulator:`simulator`,simulatorDevtools:`simulator-devtools`,workbench:`workbench`,hostToolbar:`host-toolbar`,settings:`settings`,popover:`popover`},cr={base:0,hostToolbar:5,settings:10,popover:20};function lr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ur(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function dr(e){return e/100*window.innerHeight}function fr(e){return e/100*window.innerWidth}function pr(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 mr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=pr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ur(t,i);break;case`em`:r=lr(t,i);break;case`vh`:r=dr(i);break;case`vw`:r=fr(i);break}return r}function F(e){return parseFloat(e.toFixed(3))}function hr({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 gr(e){let{panels:t}=e,n=hr({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=F(mr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=F(mr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=F(mr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=F(mr({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 I(e,t=`Assertion error`){if(!e)throw Error(t)}function _r(e,t){return Array.from(t).sort(e===`horizontal`?vr:yr)}function vr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function yr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function br(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function xr(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 Sr({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}=xr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return I(i,`No rect found`),i}var Cr;function wr(){return Cr===void 0&&(Cr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Cr}function Tr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=_r(n,Array.from(t.children).filter(br).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,Sr({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=wr()?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:hr({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 Er=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)}}},L=new Map,Dr=new Er;function Or(e){L=new Map(L),L.delete(e)}function kr(e,t){for(let[t]of L)if(t.id===e)return t}function R(e,t){for(let[t,n]of L)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function z(){return L}function Ar(e,t){return Dr.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function B(e,t){let n=L.get(e);L=new Map(L),L.set(e,t),Dr.emit(`groupChange`,{group:e,prev:n,next:t})}function jr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=xr(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 Mr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Nr(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:zr(e),b:zr(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();I(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Rr(Lr(n.a)),b:Rr(Lr(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 Pr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Fr(e){let t=getComputedStyle(Br(e)??e).display;return t===`flex`||t===`inline-flex`}function Ir(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Fr(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`||Pr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Lr(e){let t=e.length;for(;t--;){let n=e[t];if(I(n,`Missing node`),Ir(n))return n}return null}function Rr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function zr(e){let t=[];for(;e;)t.push(e),e=Br(e);return t}function Br(e){let{parentNode:t}=e;return Mr(t)?t.host:t}function Vr(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 Hr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!br(n)||n.contains(e)||e.contains(n))return!0;if(Nr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Vr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Ur(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Tr(r),a=jr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Hr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Wr(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 V(e,t,n=0){return Math.abs(F(e)-F(t))<=n}function H(e,t){return V(e,t)?0:e>t?1:-1}function Gr({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(H(r,c)<0)if(a){let e=(i+c)/2;r=H(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=F(r),r}function Kr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(V(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;I(u!=null,`Invalid first pivot index`),I(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];I(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(I(n!=null,`Previous layout not found for panel index ${t}`),V(n,i)){let t=o-n;H(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];I(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(I(n!=null,`Previous layout not found for panel index ${t}`),V(n,o)){let t=n-i;H(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];I(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&H(i,c)<0)if(e>0){let t=c-o,n=t/2;H(i+e,c)<0&&(e=H(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;H(i-e,c)<0&&(e=H(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];I(e!=null,`Previous layout not found for panel index ${r}`);let a=Gr({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];I(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Gr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!V(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(Wr(c,l))return i;{let t=e<0?d:u,r=s[t];I(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Gr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!V(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];I(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Gr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(V(i,s)||(t-=s-i,l[r]=s),V(t,0))break;e>0?r--:r++}}}if(!V(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 U(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||H(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(!V(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];I(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];I(i!=null,`No layout data found for index ${e}`);let o=r[e];I(o!=null,`No layout data found for index ${e}`);let s=Gr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!V(a,0))for(let e=0;e<t.length;e++){let n=r[e];I(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Gr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,V(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function qr({groupId:e,panelId:t}){let n=()=>{let t=z();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:Kr({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});U(l,p)||B(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&&V(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=hr({group:t});o(F(mr({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Jr(e){e.defaultPrevented||Ur(e,z()).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=qr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Yr(e){let t=z();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 Xr({groupId:e}){let t=()=>{let t=z();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:(U(o,c)||B(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function G(e,t){let n=Yr(e),r=R(n.id,!0),i=n.separators.find(t=>t.element===e);I(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);I(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Xr({groupId:n.id}).getLayout(),c=W({layout:Kr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});U(s,c)||B(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Zr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Yr(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=Yr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=R(n.id,!0),o=n.separators.find(e=>e.element===t);I(o,`Matching separator not found`);let s=a.get(o);I(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(I(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=Yr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);I(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 Qr={cursorFlags:0,state:`inactive`},$r=new Er;function K(){return Qr}function ei(e){return $r.addListener(`change`,e)}function ti(e){let t=Qr,n={...Qr};n.cursorFlags=e,Qr=n,$r.emit(`change`,{prev:t,next:n})}function ni(e){let t=Qr;Qr=e,$r.emit(`change`,{prev:t,next:e})}function ri(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=z(),n=Ur(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)}),ni({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ii=e=>e,ai=()=>{},oi=1,si=2,ci=4,li=8,ui=3,di=12,fi;function pi(){return fi===void 0&&(fi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(fi=!0)),fi}function mi({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&&pi()){let t=(e&oi)!==0,n=(e&si)!==0,r=(e&ci)!==0,i=(e&li)!==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 pi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var hi=new WeakMap;function gi(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=hi.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=mi({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}hi.set(e,{prevStyle:t,styleSheet:n})}function _i({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=Kr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(U(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?oi:si;break;case`vertical`:s|=d<0?ci:li;break}}else B(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ui:c|=s&ui,t.movementY===0?c|=o&di:c|=s&di,ti(c),gi(e)}function vi(e){let t=z(),n=K();switch(n.state){case`active`:_i({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function yi(e){if(e.defaultPrevented)return;let t=K(),n=z();switch(t.state){case`active`:if(e.buttons===0){ni({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=R(e.group.id,!0);B(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)}_i({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ur(e,n);r.length===0?t.state!==`inactive`&&ni({cursorFlags:0,state:`inactive`}):ni({cursorFlags:0,hitRegions:r,state:`hover`}),gi(e.currentTarget);break}}}function bi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(K().state){case`hover`:ni({cursorFlags:0,state:`inactive`})}}function xi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=K();switch(t.state){case`active`:ni({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(gi(e.currentTarget),t.hitRegions.forEach(e=>{let t=R(e.group.id,!0);B(e.group,t)}),e.preventDefault())}}function Si(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=F(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=F((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ci(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=hr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:F(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function wi(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 Ti({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=F(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]=F((r[e]??0)/a*l);else{let e=F(l/c.length);for(let t of c)u[t]=e}return u}function Ei(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 Di=new Map;function Oi(e){let t=!0;I(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=hr({group:e});if(t===0)return;let n=R(e.id);if(!n)return;let r=gr(e),i=n.defaultLayoutDeferred?Si(r):n.layout,a=W({layout:Ti({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&U(n.layout,a)&&wi(n.derivedPanelConstraints,r)&&n.groupSize===t)return;B(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ci(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{I(!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=hr({group:e}),s=gr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ei(e.panels,l)||(l=void 0));let u=W({layout:e.mutableState.layouts[c]??l??Si(s),panelConstraints:s}),d=e.element.ownerDocument;Di.set(d,(Di.get(d)??0)+1);let f=new Map;return Tr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),B(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{I(!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`,Zr)}),Di.get(d)===1&&(d.addEventListener(`dblclick`,Jr,!0),d.addEventListener(`pointerdown`,ri,!0),d.addEventListener(`pointerleave`,vi),d.addEventListener(`pointermove`,yi),d.addEventListener(`pointerout`,bi),d.addEventListener(`pointerup`,xi,!0)),function(){t=!1,Di.set(d,Math.max(0,(Di.get(d)??0)-1)),Or(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Zr)}),Di.get(d)||(d.removeEventListener(`dblclick`,Jr,!0),d.removeEventListener(`pointerdown`,ri,!0),d.removeEventListener(`pointerleave`,vi),d.removeEventListener(`pointermove`,yi),d.removeEventListener(`pointerout`,bi),d.removeEventListener(`pointerup`,xi,!0)),a.disconnect()}}function ki(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Ai(e){let t=(0,D.useId)();return`${e??t}`}var q=typeof window<`u`?D.useLayoutEffect:D.useEffect;function ji(e){let t=(0,D.useRef)(e);return q(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Mi(...e){return ji(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ni(e){let t=(0,D.useRef)({...e});return q(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Pi=(0,D.createContext)(null);function Fi(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:ii});(0,D.useImperativeHandle)(t,()=>n.current,[]),q(()=>{Object.assign(n.current,Xr({groupId:e}))})}function Ii({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=ji(e=>{U(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=ji(e=>{U(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ai(s),v=(0,D.useRef)(null),[y,b]=ki(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Mi(v,a);Fi(_,o);let C=ji((e,t)=>{let r=K(),i=kr(e),a=R(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=Ni({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=_r(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=_r(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=kr(_),i=R(_);r&&i&&B(r,{...i,derivedPanelConstraints:gr(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=Oi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=R(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Ar(_,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=V(t.collapsedSize,i[t.panelId]),a=V(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)(Pi.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})})}Ii.displayName=`Group`;function Li(){let e=(0,D.useContext)(Pi);return I(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Ri(e,t){let{id:n}=Li(),r=(0,D.useRef)({collapse:ai,expand:ai,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ai});(0,D.useImperativeHandle)(t,()=>r.current,[]),q(()=>{Object.assign(r.current,qr({groupId:n,panelId:e}))})}function zi({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=Ai(c),_=Ni({disabled:a}),v=(0,D.useRef)(null),y=Mi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Li(),T=d!==null,E=ji((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]),Ri(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>Ar(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:{...Bi,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})})}zi.displayName=`Panel`;var Bi={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Vi({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:Kr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=W({layout:Kr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Hi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ai(a),l=Ni({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),_=Mi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Li(),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=ei(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ar(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(Vi({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})}Hi.displayName=`Separator`;function Ui(e,t,n,r){return!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)}function Wi(e){return Number.isFinite(e)?Math.max(0,Math.min(.5,e)):.25}function Gi(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 Ki(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 qi(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 Ji(e,t,n,r,i){let{inLeft:a,inTop:o,activeHoriz:s,activeVert:c}=Ki(e,t,n,r,i);return!s&&!c?`center`:s&&!c?a?`left`:`right`:c&&!s?o?`top`:`bottom`:qi(e,t,n,r,a,o)}function Yi(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(Ui(r,i,a,o))return`center`;let s=Wi(n),c=Gi(r,i,a,o);return c===void 0?Ji(r,i,a,o,s):c}function Xi(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 Zi(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function Qi(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 $i(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 ea=.5;function ta(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 na(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=ta(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function ra(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function ia(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=ra(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function aa(e,t,n,r=ea){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 oa(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=sa(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):ca(t[n]??0,c,l,u)}return d}function sa(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 ca(e,t,n,r){return n<=0?r>0?t/r:t:t*(e>0?e:0)/n}function la(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:ta(i)}}function ua(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=na(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(ra(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)(Hi,{"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)(zi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Sa(e,n)},da(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;u.push((0,O.jsx)(zi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Sa(e,n)},da(e)))}else{let t=i.get(r);u.push((0,O.jsx)(zi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:Sa(e,n)},da(e)))}});let d=e=>{let t=l.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=la(r,t.constraints,e);if(!a)return;let o=na(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,ia(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,ia(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=oa(r,n.sizes,n.constraints,i,u);return d?aa(i,d,r)?{pushed:!1,stuck:!0}:(t.setLayout(d),{pushed:!0,stuck:aa(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)(Ii,{groupRef:s,orientation:r,onLayoutChanged:d,style:{width:`100%`,height:`100%`},children:u},t.children.length)})}function da(e){return e.id}function fa(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(pa,{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 pa(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 ma=`application/x-deck-panel`;function ha(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(ma))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(Yi({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=Yi({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer?.getData(ma);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=Qi(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(ma)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer?.getData(ma);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=Qi(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(ma,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,fa(t,n),r?(0,O.jsx)(_a,{zone:r}):null]})}function ga(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 _a(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:ga(e.zone)})}var va=(0,D.createContext)(0);function ya(){return(0,D.useContext)(va)}function ba(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=Yt(e.get().root,r),u;if(c!==void 0&&l){let e=l.panels.filter(e=>t.get(e)?.hideTab!==!0);u=$i(l.panels,e,a,c)}else u=l?l.panels.indexOf(i):void 0;e.apply(e=>gn(e,a,{groupId:r,index:u}))}function xa(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=>un(t,e,n))},[t]),p=(0,D.useCallback)(e=>{t.apply(t=>bn(t,e,n))},[t,n]),m=Qt(s.root)>1,h=(0,D.useCallback)(e=>Zt(s.root,e)!==void 0,[s]),g=(0,D.useCallback)((e,n)=>{t.apply(t=>cn(t,e,n))},[t]),_=(0,D.useCallback)((e,r,i,a,o)=>{let s={groupId:e,panelId:r},c=Zt(t.get().root,i);if(n.get(i)?.draggable===!1||n.get(r)?.draggable===!1)return;if(n.get(i)?.dropPolicy===`reorder-only`){ba(t,n,{groupId:e,activePanelId:r,draggedPanelId:i,draggedGroupId:c,zone:a,reorderIndex:o});return}if(Zi(i,c,s,a))return;let l=Xi(a,i,s);if(l.kind===`move`){t.apply(e=>gn(e,l.panelId,{groupId:l.destGroupId}));return}t.apply(e=>{let{tree:t}=pn(e,l.newPanelId);return Zt(t.root,l.atPanelId)===void 0?e:N(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(va.Provider,{value:l,children:Sa(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 Sa(e,t){return e.kind===`split`?Ca(e,t):wa(e,t)}function Ca(e,t){return(0,O.jsx)(ua,{node:e,ctx:t},e.id)}function wa(e,t){return(0,O.jsx)(ha,{node:e,ctx:t},e.id)}function Ta({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 Ea({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 Da(){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 Oa=50;function ka(e,t,n){if(e.width<=0||e.height<=0)return n;let r=Math.min(e.width/(t.width+Oa),e.height/(t.height+Oa));return Math.max(1,Math.min(100,Math.floor(r*100)))}function Aa({device:e,zoom:t,onDeviceChange:n,onZoomChange:r,compileStatus:i,currentPage:a,copied:o,onCopyPagePath:s,runtimeStatus:c=null,watcherDead:l=!1,onRelaunch:u=()=>{}}){let d=(0,D.useRef)(typeof t==`number`?t:100),f=(0,D.useRef)(t),p=(0,D.useRef)(e),m=(0,D.useRef)(null),[h,g]=(0,D.useState)(!1);(0,D.useEffect)(()=>{i.status===`ready`&&g(!0)},[i.status]);let _=c?.phase===`launch-failed`||c?.phase===`crashed`,[y,b]=(0,D.useState)(!1);(0,D.useEffect)(()=>{c||b(!1)},[c]);let x=!!c?.pageFallback&&!_&&!y,S=i.status===`compiling`&&h,C=sr(),w=(0,D.useCallback)(e=>{if(e.visible){let t=f.current;d.current=t===`auto`?ka(e.bounds,p.current,d.current):t}C?.set({viewId:P.simulator,placement:e,layer:cr.base,extra:{zoom:d.current}})},[C]),T=(0,D.useCallback)(e=>{let t=m.current;if(t){e?(t.dispose(),m.current=ir(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:w})):(t.update({visible:!1,publish:w}),t.dispose(),m.current=null);return}e&&(m.current=ir(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:w}))},[w]);return(0,D.useLayoutEffect)(()=>{f.current=t,p.current=e}),(0,D.useLayoutEffect)(()=>{m.current?.update({visible:!0,publish:w})},[t,e,w]),(0,D.useEffect)(()=>{m.current?.pulse(300)},[ya()]),(0,D.useEffect)(()=>()=>{m.current?.dispose(),m.current=null,C?.remove(P.simulator)},[C]),(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)(le,{value:e.name,onChange:n,children:de.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,O.jsxs)(le,{value:t,onChange:r,className:`w-[76px] shrink-0`,children:[fe.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,`%`]},e)),(0,O.jsx)(`option`,{value:E,children:`自适应`})]})]}),l&&(0,O.jsx)(Da,{}),x&&c?.pageFallback&&(0,O.jsx)(Ea,{requested:c.pageFallback.requested,resolved:c.pageFallback.resolved,onDismiss:()=>b(!0)}),(0,O.jsxs)(`div`,{ref:T,className:`flex-1 min-h-0 bg-sim-bg relative`,"data-area":`native-simulator`,children:[i.status===`compiling`&&!h&&(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:`正在编译中...`})}),S&&(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)(Ta,{phase:c.phase,code:c.code,reason:c.reason,onRelaunch:u})]}),(0,O.jsx)(`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:v(`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`})]})})]})})]})}function ja(){let e=(0,D.useRef)(null),t=sr(),n=(0,D.useCallback)(e=>{t?.set({viewId:P.workbench,placement:e,layer:cr.base})},[t]),r=(0,D.useCallback)(t=>{let r=e.current;if(r){t?(r.dispose(),e.current=ir(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=ir(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[n]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[ya()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null,t?.remove(P.workbench)},[t]),(0,O.jsx)(`div`,{ref:r,className:`h-full w-full`,"data-area":`editor`})}function Ma(e,t){return!!(t===0||e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function Na({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 Pa({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 Fa({node:e,depth:t,inspectedSid:n,onInspect:r}){return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(Ba,{node:e,depth:t,inspectedSid:n,onInspect:r},i))})}function Ia({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ma(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)(Ba,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}function La({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)(Na,{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 Ra({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)(Na,{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)(Ba,{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 za({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ma(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)(La,{node:e,indent:o,attrEntries:l,isInspected:s,onMouseEnter:u,inlineText:d}):(0,O.jsx)(Ra,{node:e,depth:t,indent:o,attrEntries:l,hasChildren:c,expanded:i,isInspected:s,inspectedSid:n,onInspect:r,onToggle:()=>a(!i),onMouseEnter:u})}function Ba({node:e,depth:t,inspectedSid:n,onInspect:r}){return e.tagName===`#text`?(0,O.jsx)(Pa,{node:e,depth:t}):e.tagName===`#fragment`?(0,O.jsx)(Fa,{node:e,depth:t,inspectedSid:n,onInspect:r}):e.tagName===`#shadow-root`?(0,O.jsx)(Ia,{node:e,depth:t,inspectedSid:n,onInspect:r}):(0,O.jsx)(za,{node:e,depth:t,inspectedSid:n,onInspect:r})}function Va({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 Ha({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)(Ba,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(Va,{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 Ua(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 Wa({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)(null);return Ua({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(a),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}}),(0,O.jsx)(Ha,{tree:i,onInspectElement:t=>e.inspect(t),onClearInspection:async()=>{await e.clearInspection()},isRuntimeRunning:r})}var Ga=`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 Ka({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:`${Ga} 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:`${Ga} 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:`${Ga} hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function qa(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 Ja({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)([]);Ua({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(e=>{a(t=>qa(t,e))}),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}});let o=e.clearAll?.bind(e);return(0,O.jsx)(Ka,{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 Ya(e,t){return typeof t==`number`?`${e}[${t}]`:e===``?t:`${e}.${t}`}function Xa(e){return typeof e==`object`&&!!e}function Za(e){return Array.isArray(e)?e.map((e,t)=>[t,e]):Object.keys(e).sort().map(t=>[t,e[t]])}function Qa(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}var $a=``;function eo(e,t){let n=e.overrides.get(t);return n===void 0?e.baseline===`expanded`?!0:e.baseline===`collapsed`?!1:t===$a:n}function to({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 no(e){return typeof e==`string`&&(e===``||/[.[\]]/.test(e))}function ro({path:e,label:t,value:n,depth:r,unsafeSegments:i,ctx:a}){let o={paddingLeft:r*14};if(Xa(n)){let s=eo(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:Qa(n)})]}),s&&Za(n).map(([t,n])=>(0,O.jsx)(ro,{path:Ya(e,t),label:String(t),value:n,depth:r+1,unsafeSegments:i||no(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)(to,{path:e,value:n,editable:l,ctx:a})]})}function io({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)(ro,{path:$a,label:`object`,value:e,depth:0,unsafeSegments:!1,ctx:{state:m,toggle:(e,t)=>{let n=new Map(o),r=!eo(m,e);n.set(e,r),r&&Array.isArray(t)&&t.forEach((t,r)=>{Xa(t)&&n.set(Ya(e,r),!0)}),s(n)},beginEdit:(e,t)=>{d(e),p(t)},setDraft:p,endEdit:()=>d(null),onCommit:r}})})}function ao(e){return e.pagePath??e.id}function oo(e){return e!=null&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function so(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 co({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 lo({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(oo(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:ao(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)(co,{title:`全部展开`,onClick:()=>_(`expanded`),children:`⊕`}),(0,O.jsx)(co,{title:`全部收起`,onClick:()=>_(`collapsed`),children:`⊖`}),(0,O.jsx)(co,{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)(co,{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)(io,{root:so(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 uo(e){return(e??``).replace(/^\/+/,``)}function fo(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=>uo(e.pagePath)===uo(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}var po={bridges:[],entries:{}};function mo({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0,activePagePath:i=``}){let[a,o]=(0,D.useState)(po);Ua({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}=fo(a.bridges,i),l=e.setData?.bind(e),u=l?(e,t)=>l(e,t):void 0;return(0,O.jsx)(lo,{state:{bridges:a.bridges,activeBridgeId:s,entries:a.entries},onSelectBridge:c,isRuntimeRunning:r,onSetData:u})}function ho(...e){return e.filter(Boolean).join(` `)}function go(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function _o(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function vo(e){return e.kind===`event`?e.event.message:e.log.text}function yo({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=>vo(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:ho(`truncate font-medium shrink-0`,_o(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:go(e.at)}),(0,O.jsx)(`span`,{className:ho(`break-all`,_o(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:go(e.at)}),(0,O.jsx)(`span`,{className:ho(`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 bo(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)(Wa,{source:n,enabled:r,active:l,isRuntimeRunning:p});case`appdata`:return(0,O.jsx)(mo,{source:o,enabled:s,active:l,isRuntimeRunning:p,activePagePath:c});case`storage`:return(0,O.jsx)(Ja,{source:i,enabled:a,active:l,isRuntimeRunning:p});case`compile`:return(0,O.jsx)(yo,{events:u,logs:d,onClear:f??(()=>{})})}}function xo(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 So=0,Co=new Set([`simulator`,`editor`,`wxml`,`appdata`,`storage`,`console`,`compile`]);function wo({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}=wt({projectPath:e.path}),u=kt(),{state:d}=u,[f]=(0,D.useState)(()=>kn(d.dockTree??null,a.simPanelWidth,Co)),p=(0,D.useMemo)(()=>xn(),[]),[m]=(0,D.useState)(()=>++So),h=(0,D.useMemo)(()=>xo({generation:m,publish:e=>{T(e)}}),[m]);(0,D.useEffect)(()=>()=>h.dispose(),[h]);let[g,_]=(0,D.useState)(0);(0,D.useEffect)(()=>{let e=!1,t=ae(t=>{e=!0,_(t)});return se().then(t=>{e||typeof t==`number`&&_(t)}),t},[]);let v=ar({present:g>0,publish:e=>{let t=g>0&&e.width>0&&e.height>0;h.set({viewId:P.hostToolbar,placement:t?{visible:!0,bounds:e}:{visible:!1},layer:cr.hostToolbar})},deps:[g,h]});(0,D.useEffect)(()=>{let t=`Dimina DevTools`;return document.title=`${e.name} - ${t}`,Pe().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),x)}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)(or.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)(Qn,{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)(ko,{dockModel:f,dockRegistry:p,simPanelWidth:a.simPanelWidth,renderDomPanel:(e,t)=>e===`simulator`?(0,O.jsx)(Aa,{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()}):e===`editor`?(0,O.jsx)(ja,{}):e===`wxml`||e===`appdata`||e===`storage`||e===`compile`?(0,O.jsx)(Oo,{tabId:e,active:t.active,panelProps:b}):null,onPersistTree:u.setDockTree,persistedTree:d.dockTree??null})})]})})}function To(e){return e.kind===`tabs`?e.panels.includes(`simulator`):e.children.some(To)}function Eo(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 Do(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&&To(n))return{splitId:e.id,childIndex:t};let r=Do(n);if(r)return r}return null}function Oo({tabId:e,active:t,panelProps:n}){return(0,O.jsx)(bo,{tabId:e,...n,tabActive:t})}function ko(e){let{dockModel:t,dockRegistry:n,simPanelWidth:r,renderDomPanel:i,onPersistTree:a,persistedTree:o}=e,s=(0,D.useRef)(null),c=sr(),l=(0,D.useCallback)(e=>{c?.set({viewId:P.simulatorDevtools,placement:e,layer:cr.base})},[c]),u=(0,D.useCallback)((e,t,n)=>{if(e.current){t?(e.current.dispose(),e.current=ir(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=ir(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=Do(e);n&&Eo(e,n)!==r&&t.apply(e=>{let t=Do(e.root);return!t||Eo(e.root,t)===r?e:ln(e,t.splitId,t.childIndex,{minPx:r})})},[t,r]),(0,D.useEffect)(()=>()=>{s.current?.dispose(),s.current=null,c?.remove(P.simulatorDevtools)},[c]),(0,D.useEffect)(()=>t.subscribe(e=>{a(Pt(e.tree))}),[t,a]),(0,D.useEffect)(()=>{let e=Pt(t.get());e!==o&&a(e)},[]),(0,O.jsx)(xa,{model:t,registry:n,renderDomPanel:i,bindNativeSlot:d,onActiveTabClick:(0,D.useCallback)(e=>{e===`simulator`||e===`editor`||t.apply(t=>bn(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 Ao(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function jo(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ao(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():Ao(e[t],null)}}}}function Y(...e){return D.useCallback(jo(...e),e)}function Mo(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 No(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,Po(i,...t)]}function Po(...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 Fo=globalThis?.document?D.useLayoutEffect:()=>{},Io=D.useId||(()=>void 0),Lo=0;function Ro(e){let[t,n]=D.useState(Io());return Fo(()=>{e||n(e=>e??String(Lo++))},[e]),e||(t?`radix-${t}`:``)}var zo=D.useInsertionEffect||Fo;function Bo({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Vo({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=Ho(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Vo({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return zo(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ho(e){return typeof e==`function`}var Uo=n(e(),1);function Wo(e){let t=Go(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(qo);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 Go(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=Yo(n),i=Jo(r,n.props);return n.type!==D.Fragment&&(i.ref=t?jo(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 Ko=Symbol(`radix.slottable`);function qo(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ko}function Jo(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 Yo(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=Wo(`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 Xo(e,t){e&&Uo.flushSync(()=>e.dispatchEvent(t))}function Zo(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}function Qo(e,t=globalThis?.document){let n=Zo(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 $o=`DismissableLayer`,es=`dismissableLayer.update`,ts=`dismissableLayer.pointerDownOutside`,ns=`dismissableLayer.focusOutside`,rs,is=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),as=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(is),[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=cs(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=ls(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Qo(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&&(rs=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),us(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=rs)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),us())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(es,e),()=>document.removeEventListener(es,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)})});as.displayName=$o;var os=`DismissableLayerBranch`,ss=D.forwardRef((e,t)=>{let n=D.useContext(is),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})});ss.displayName=os;function cs(e,t=globalThis?.document){let n=Zo(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ds(ts,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 ls(e,t=globalThis?.document){let n=Zo(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&ds(ns,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 us(){let e=new CustomEvent(es);document.dispatchEvent(e)}function ds(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?Xo(i,a):i.dispatchEvent(a)}var fs=`focusScope.autoFocusOnMount`,ps=`focusScope.autoFocusOnUnmount`,ms={bubbles:!1,cancelable:!0},hs=`FocusScope`,gs=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=Zo(i),u=Zo(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){Cs.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(fs,ms);s.addEventListener(fs,l),s.dispatchEvent(t),t.defaultPrevented||(_s(Es(ys(s)),{select:!0}),document.activeElement===e&&Z(s))}return()=>{s.removeEventListener(fs,l),setTimeout(()=>{let t=new CustomEvent(ps,ms);s.addEventListener(ps,u),s.dispatchEvent(t),t.defaultPrevented||Z(e??document.body,{select:!0}),s.removeEventListener(ps,u),Cs.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]=vs(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})});gs.displayName=hs;function _s(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Z(r,{select:t}),document.activeElement!==n)return}function vs(e){let t=ys(e);return[bs(t,e),bs(t.reverse(),e)]}function ys(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 bs(e,t){for(let n of e)if(!xs(n,{upTo:t}))return n}function xs(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 Ss(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&&Ss(e)&&t&&e.select()}}var Cs=ws();function ws(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Ts(e,t),e.unshift(t)},remove(t){e=Ts(e,t),e[0]?.resume()}}}function Ts(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Es(e){return e.filter(e=>e.tagName!==`A`)}var Ds=`Portal`,Os=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);Fo(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Uo.createPortal((0,O.jsx)(X.div,{...r,ref:t}),o):null});Os.displayName=Ds;function ks(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var As=e=>{let{present:t,children:n}=e,r=js(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=Y(r.ref,Ns(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};As.displayName=`Presence`;function js(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=ks(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=Ms(r.current);a.current=o===`mounted`?e:`none`},[o]),Fo(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ms(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Fo(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ms(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=Ms(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 Ms(e){return e?.animationName||`none`}function Ns(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 Ps=0;function Fs(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Is()),document.body.insertAdjacentElement(`beforeend`,e[1]??Is()),Ps++,()=>{Ps===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ps--}},[])}function Is(){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 Ls(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 Rs(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 zs=`right-scroll-bar-position`,Bs=`width-before-scroll-bar`,Vs=`with-scroll-bars-hidden`,Hs=`--removed-body-scroll-bar-size`;function Us(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ws(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 Gs=typeof window<`u`?D.useLayoutEffect:D.useEffect,Ks=new WeakMap;function qs(e,t){var n=Ws(t||null,function(t){return e.forEach(function(e){return Us(e,t)})});return Gs(function(){var t=Ks.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Us(e,null)}),i.forEach(function(e){r.has(e)||Us(e,a)})}Ks.set(n,e)},[e]),n}function Js(e){return e}function Ys(e,t){t===void 0&&(t=Js);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 Xs(e){e===void 0&&(e={});var t=Ys(null);return t.options=Q({async:!0,ssr:!1},e),t}var Zs=function(e){var t=e.sideCar,n=Ls(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))};Zs.isSideCarExport=!0;function Qs(e,t){return e.useMedium(t),Zs}var $s=Xs(),ec=function(){},tc=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:ec,onWheelCapture:ec,onTouchMoveCapture:ec}),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=Ls(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=qs([n,t]),C=Q(Q({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:$s,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))});tc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},tc.classNames={fullWidth:Bs,zeroRight:zs};var nc,rc=function(){if(nc)return nc;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ic(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=rc();return t&&e.setAttribute(`nonce`,t),e}function ac(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function oc(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var sc=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ic())&&(ac(t,n),oc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cc=function(){var e=sc();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lc=function(){var e=cc();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},uc={left:0,top:0,right:0,gap:0},dc=function(e){return parseInt(e||``,10)||0},fc=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[dc(n),dc(r),dc(i)]},pc=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return uc;var t=fc(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])}},mc=lc(),hc=`data-scroll-locked`,gc=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
|
-
.${Vs} {
|
|
6
|
-
overflow: hidden ${r};
|
|
7
|
-
padding-right: ${s}px ${r};
|
|
8
|
-
}
|
|
9
|
-
body[${hc}] {
|
|
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
|
-
.${zs} {
|
|
23
|
-
right: ${s}px ${r};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.${Bs} {
|
|
27
|
-
margin-right: ${s}px ${r};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.${zs} .${zs} {
|
|
31
|
-
right: 0 ${r};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.${Bs} .${Bs} {
|
|
35
|
-
margin-right: 0 ${r};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
body[${hc}] {
|
|
39
|
-
${Hs}: ${s}px;
|
|
40
|
-
}
|
|
41
|
-
`},_c=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},vc=function(){D.useEffect(function(){return document.body.setAttribute(hc,(_c()+1).toString()),function(){var e=_c()-1;e<=0?document.body.removeAttribute(hc):document.body.setAttribute(hc,e.toString())}},[])},yc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;vc();var a=D.useMemo(function(){return pc(i)},[i]);return D.createElement(mc,{styles:gc(a,!t,i,n?``:`!important`)})},bc=!1;if(typeof window<`u`)try{var xc=Object.defineProperty({},`passive`,{get:function(){return bc=!0,!0}});window.addEventListener(`test`,xc,xc),window.removeEventListener(`test`,xc,xc)}catch{bc=!1}var Sc=bc?{passive:!1}:!1,Cc=function(e){return e.tagName===`TEXTAREA`},wc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Cc(e)&&n[t]===`visible`)},Tc=function(e){return wc(e,`overflowY`)},Ec=function(e){return wc(e,`overflowX`)},Dc=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ac(e,r)){var i=jc(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Oc=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},kc=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ac=function(e,t){return e===`v`?Tc(t):Ec(t)},jc=function(e,t){return e===`v`?Oc(t):kc(t)},Mc=function(e,t){return e===`h`&&t===`rtl`?-1:1},Nc=function(e,t,n,r,i){var a=Mc(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=jc(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ac(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},Pc=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Fc=function(e){return[e.deltaX,e.deltaY]},Ic=function(e){return e&&`current`in e?e.current:e},Lc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Rc=function(e){return`
|
|
42
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
43
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
44
|
-
`},zc=0,Bc=[];function Vc(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(zc++)[0],a=D.useState(lc)[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=Rs([e.lockRef.current],(e.shards||[]).map(Ic),!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=Pc(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=Dc(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Dc(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 Nc(h,t,e,h===`h`?s:c,!0)},[]),c=D.useCallback(function(e){var n=e;if(!(!Bc.length||Bc[Bc.length-1]!==a)){var r=`deltaY`in n?Fc(n):Pc(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Lc(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ic).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:Hc(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=Pc(e),r.current=void 0},[]),d=D.useCallback(function(t){l(t.type,Fc(t),t.target,s(t,e.lockRef.current))},[]),f=D.useCallback(function(t){l(t.type,Pc(t),t.target,s(t,e.lockRef.current))},[]);D.useEffect(function(){return Bc.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Sc),document.addEventListener(`touchmove`,c,Sc),document.addEventListener(`touchstart`,u,Sc),function(){Bc=Bc.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Sc),document.removeEventListener(`touchmove`,c,Sc),document.removeEventListener(`touchstart`,u,Sc)}},[]);var p=e.removeScrollBar,m=e.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:Rc(i)}):null,p?D.createElement(yc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Hc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Uc=Qs($s,Vc),Wc=D.forwardRef(function(e,t){return D.createElement(tc,Q({},e,{ref:t,sideCar:Uc}))});Wc.classNames=tc.classNames;var Gc=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Kc=new WeakMap,qc=new WeakMap,Jc={},Yc=0,Xc=function(e){return e&&(e.host||Xc(e.parentNode))},Zc=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Xc(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})},Qc=function(e,t,n,r){var i=Zc(t,Array.isArray(e)?e:[e]);Jc[n]||(Jc[n]=new WeakMap);var a=Jc[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=(Kc.get(e)||0)+1,l=(a.get(e)||0)+1;Kc.set(e,c),a.set(e,l),o.push(e),c===1&&i&&qc.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(),Yc++,function(){o.forEach(function(e){var t=Kc.get(e)-1,i=a.get(e)-1;Kc.set(e,t),a.set(e,i),t||(qc.has(e)||e.removeAttribute(r),qc.delete(e)),i||e.removeAttribute(n)}),Yc--,Yc||(Kc=new WeakMap,Kc=new WeakMap,qc=new WeakMap,Jc={})}},$c=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Gc(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Qc(r,i,n,`aria-hidden`)):function(){return null}},el=`Dialog`,[tl,nl]=No(el),[rl,$]=tl(el),il=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]=Bo({prop:r,defaultProp:i??!1,onChange:a,caller:el});return(0,O.jsx)(rl,{scope:t,triggerRef:s,contentRef:c,contentId:Ro(),titleId:Ro(),descriptionId:Ro(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};il.displayName=el;var al=`DialogTrigger`,ol=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(al,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":El(i.open),...r,ref:a,onClick:J(e.onClick,i.onOpenToggle)})});ol.displayName=al;var sl=`DialogPortal`,[cl,ll]=tl(sl,{forceMount:void 0}),ul=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=$(sl,t);return(0,O.jsx)(cl,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(As,{present:n||a.open,children:(0,O.jsx)(Os,{asChild:!0,container:i,children:e})}))})};ul.displayName=sl;var dl=`DialogOverlay`,fl=D.forwardRef((e,t)=>{let n=ll(dl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(dl,e.__scopeDialog);return a.modal?(0,O.jsx)(As,{present:r||a.open,children:(0,O.jsx)(ml,{...i,ref:t})}):null});fl.displayName=dl;var pl=Wo(`DialogOverlay.RemoveScroll`),ml=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(dl,n);return(0,O.jsx)(Wc,{as:pl,allowPinchZoom:!0,shards:[i.contentRef],children:(0,O.jsx)(X.div,{"data-state":El(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),hl=`DialogContent`,gl=D.forwardRef((e,t)=>{let n=ll(hl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(hl,e.__scopeDialog);return(0,O.jsx)(As,{present:r||a.open,children:a.modal?(0,O.jsx)(_l,{...i,ref:t}):(0,O.jsx)(vl,{...i,ref:t})})});gl.displayName=hl;var _l=D.forwardRef((e,t)=>{let n=$(hl,e.__scopeDialog),r=D.useRef(null),i=Y(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return $c(e)},[]),(0,O.jsx)(yl,{...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())})}),vl=D.forwardRef((e,t)=>{let n=$(hl,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(yl,{...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()}})}),yl=D.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=$(hl,n),c=D.useRef(null),l=Y(t,c);return Fs(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(gs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(as,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":El(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Al,{titleId:s.titleId}),(0,O.jsx)(Ml,{contentRef:c,descriptionId:s.descriptionId})]})]})}),bl=`DialogTitle`,xl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(bl,n);return(0,O.jsx)(X.h2,{id:i.titleId,...r,ref:t})});xl.displayName=bl;var Sl=`DialogDescription`,Cl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(Sl,n);return(0,O.jsx)(X.p,{id:i.descriptionId,...r,ref:t})});Cl.displayName=Sl;var wl=`DialogClose`,Tl=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(wl,n);return(0,O.jsx)(X.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});Tl.displayName=wl;function El(e){return e?`open`:`closed`}var Dl=`DialogTitleWarning`,[Ol,kl]=Mo(Dl,{contentName:hl,titleName:bl,docsSlug:`dialog`}),Al=({titleId:e})=>{let t=kl(Dl),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},jl=`DialogDescriptionWarning`,Ml=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${kl(jl).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Nl=il,Pl=ul,Fl=fl,Il=gl,Ll=xl,Rl=Cl,zl=Tl,Bl=Nl,Vl=Pl,Hl=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Fl,{ref:n,className:v(`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}));Hl.displayName=Fl.displayName;var Ul=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Vl,{children:[(0,O.jsx)(Hl,{}),(0,O.jsxs)(Il,{ref:r,className:v(`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)(zl,{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)(Ee,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Ul.displayName=Il.displayName;var Wl=({className:e,...t})=>(0,O.jsx)(`div`,{className:v(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Wl.displayName=`DialogHeader`;var Gl=({className:e,...t})=>(0,O.jsx)(`div`,{className:v(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Gl.displayName=`DialogFooter`;var Kl=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ll,{ref:n,className:v(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Kl.displayName=Ll.displayName;var ql=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Rl,{ref:n,className:v(`text-sm text-text-muted`,e),...t}));ql.displayName=Rl.displayName;function Jl(){let[e,t]=(0,D.useState)(!1),[n,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(`prompt`),[s,c]=(0,D.useState)(0),[l,u]=(0,D.useState)(``),[f,m]=(0,D.useState)(`download`);(0,D.useEffect)(()=>p(r.Available,e=>{i(e),o(`prompt`),c(0),u(``),t(!0)}),[]),(0,D.useEffect)(()=>p(r.DownloadProgress,e=>{c(Math.round(e.percent))}),[]);let h=(0,D.useCallback)(async()=>{o(`downloading`),c(0);try{let e=await d(r.Download);e.success?o(`ready`):(u(e.error||`Download failed`),m(`download`),o(`error`))}catch(e){u(e instanceof Error?e.message:String(e)),m(`download`),o(`error`)}},[]),g=(0,D.useCallback)(async()=>{try{let e=await d(r.Install);e.success||(u(e.error||`Install failed`),m(`install`),o(`error`))}catch(e){u(e instanceof Error?e.message:String(e)),m(`install`),o(`error`)}},[]),_=(0,D.useCallback)(()=>{n?.mandatory&&a!==`ready`||t(!1)},[n,a]);return n?(0,O.jsx)(Bl,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&a!==`ready`||t(e)},children:(0,O.jsxs)(Ul,{className:`max-w-md`,children:[(0,O.jsxs)(Wl,{children:[(0,O.jsx)(Kl,{children:a===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(ql,{children:[a===`prompt`&&`New version ${n.version} is available.`,a===`downloading`&&`Downloading... ${s}%`,a===`ready`&&`Download complete. Click install to restart and apply the update.`,a===`error`&&`${f===`install`?`Install`:`Download`} failed: ${l}`]})]}),n.releaseNotes&&a===`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}),a===`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:`${s}%`}})}),(0,O.jsxs)(Gl,{children:[a===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(C,{variant:`outline`,onClick:_,children:`Later`}),(0,O.jsx)(C,{onClick:h,children:`Download`})]}),a===`ready`&&(0,O.jsx)(C,{onClick:g,children:`Install & Restart`}),a===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:_,children:`Close`}),(0,O.jsx)(C,{onClick:f===`install`?g:h,children:`Retry`})]})]})]})}):null}var Yl=`Dimina DevTools`;function Xl(){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)(Yl),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(``);async function g(){a(await Fe())}(0,D.useEffect)(()=>{g(),Pe().then(e=>{e?.appName&&(l(e.appName),document.title=e.appName)}).catch(()=>{})},[]),(0,D.useEffect)(()=>{i.length!==0&&Promise.all(i.map(e=>qe(e.path).then(t=>[e.path,t]))).then(e=>s(Object.fromEntries(e)))},[i]),(0,D.useEffect)(()=>{S(e===`project`?`project`:`list`)},[e]),(0,D.useEffect)(()=>w(()=>{document.title=c,t(`list`),r(null),Fe().then(a)}),[c]);async function _(){let e=await Ie();if(!e)return;let t;try{t=await Le(e)}catch{return}await g(),x(t)}async function v(){let e;try{e=await Ye()}catch{e=null}if(e&&`ready`in e){await g(),x(e.ready);return}if(e){let t;try{t=await Xe(e)}catch{return}await g(),x(t);return}let[t,n]=await Promise.allSettled([Je(),Ze()]);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 Xe(e)}catch{return}await g(),x(t)}async function b(e){await Re(e.path),await g()}function x(e){r(e),t(`project`)}return e===`list`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Jl,{}),(0,O.jsx)(Ae,{projects:i,onAdd:_,onCreate:v,onOpen:x,onRemove:b,thumbnails:o}),(0,O.jsx)(Ne,{open:u,templates:f,defaultBaseDir:m,onSubmit:y,onCancel:()=>d(!1),onBrowse:Ie})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Jl,{}),(0,O.jsx)(wo,{project:n},n?.path)]})}De.createRoot(document.getElementById(`root`)).render((0,O.jsx)(Xl,{}));
|
|
49
|
-
//# sourceMappingURL=index-DfDIvgvK.js.map
|