@dimina-kit/devtools 0.4.0-dev.20260716163758 → 0.4.0-dev.20260716214527
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.
|
@@ -1,4 +1,4 @@
|
|
|
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-DTEmLpxx.js";import{n as v,r as y,t as b}from"./input-7P0WbXyg.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-Bzbhbg9Z.js";import{n as pe}from"./constants-EAMiwL9_.js";import{l as me}from"./settings-api-B1wVFAPB.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:()=>{}}}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 yn(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 bn(e){let t=structuredClone(e),n=0,r=new Set,i=!1,a=[],o=e=>{let i=e(t);if(i===t)return;t=i,n+=1;let a={tree:t,revision:n};for(let e of[...r])try{e(a)}catch{}};return{get(){return t},apply(e){if(i){a.push(e);return}i=!0;try{for(o(e);a.length>0;){let e=a.shift();try{o(e)}catch{}}}finally{i=!1}},subscribe(e){return r.add(e),()=>{r.delete(e)}}}}function xn(e,t,n){return n.get(t)?.closable===!1?e:fn(e,t)}function Sn(){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 Cn(e){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:[1,6],constraints:[{minPx:e},null],children:[{kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`},{kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[{kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`},{kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`}]}]}}}var wn={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},Tn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),En=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),Dn=()=>({...wn,panels:[...wn.panels]});function On(e,t,n,r){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:e.map((e,t)=>r[t]??1),constraints:e.map((e,r)=>r===t?{minPx:n}:null),children:e}}}function kn(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[Tn(),Dn()]};return r?On([t,En()],0,e,[1,6]):On([En(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?On([Tn(),Dn(),En()],0,e,[1,4,5]):On([En(),Dn(),Tn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[En(),Dn()]};return r?On([Tn(),i],0,e,[1,6]):On([i,Tn()],1,e,[6,1])}function An(e,t,n){return bn(jn(e,t,n))}function jn(e,t,n){if(e===null)return Cn(t);try{let r=Wt(e);if(Ut(r,n).length===0)return Mn(Jt(r),t)}catch{}return Cn(t)}function Mn(e,t){let n=Fn(e);return Nn.some(e=>n.has(e))?Nn.reduce((e,r)=>n.has(r)?e:Bn(e,r,t),e):e}var Nn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Pn(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)Pn(n,t)}function Fn(e){let t=new Set;return Pn(e.root,t),t}function In(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=In(n,t);if(e!==void 0)return e}}function Ln(e,t){return t.find(t=>e.has(t))}function Rn(e,t){if(e.kind===`tabs`)return null;for(let n=0;n<e.children.length;n++){if(e.children[n].id===t)return{splitId:e.id,childIndex:n};let r=Rn(e.children[n],t);if(r)return r}return null}function zn(e,t){let n=In(e.root,`simulator`);if(!n)return e;let r=Rn(e.root,n);return r?ln(e,r.splitId,r.childIndex,{minPx:t}):e}function Bn(e,t,n){let r=Fn(e);if(r.has(t))return e;if(Nn.includes(t)){let n=Nn.find(e=>e!==t&&r.has(e));return n?mn(e,t,{groupId:In(e.root,n)}):r.has(`editor`)?yn(e,`editor`,`column`,t,`after`):r.has(`simulator`)?yn(e,`simulator`,`row`,t,`after`):yn(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=Ln(r,Nn);return t?vn(e,In(e.root,t),`column`,`editor`,`before`):r.has(`simulator`)?yn(e,`simulator`,`row`,`editor`,`after`):yn(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?zn(_n(e,`simulator`,`row`,`before`),n):yn(e,[...r][0],`column`,t,`after`)}function Vn(e,t){let n=Fn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Hn=Nn;function Un({model:e,registry:t,simPanelWidth:n}){let[,r]=(0,D.useState)(0);(0,D.useEffect)(()=>e.subscribe(()=>r(e=>e+1)),[e]);let i=new Set(Vn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Hn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?xn(e,r,t):Bn(e,r,n))}function u(){if(s){let t=Hn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>fn(e,t),e))}else{let t=Hn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>Bn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Kn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(qn,{filled:a})}),(0,O.jsx)(Kn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(Jn,{filled:o})}),(0,O.jsx)(Kn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Yn,{filled:s})})]})}function Wn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state,a=r===`left`;function o(){let r=a?`right`:`left`;t.setSimulatorAlignment(r),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(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)(Xn,{side:r})})}function Gn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`调试器位置`,children:[{id:`inEditor`,title:`调试器位置:在编辑器面板中`},{id:`belowSimulator`,title:`调试器位置:在模拟器下方`},{id:`rightOfSimulator`,title:`调试器位置:在模拟器右侧`}].map(e=>(0,O.jsx)(Kn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Zn,{variant:e.id})},e.id))})}function Kn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(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 qn({filled:e}){return(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`,fill:`currentColor`,stroke:`currentColor`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`,stroke:`var(--color-surface-2)`,strokeWidth:`1.2`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`})]})})}function Jn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:e?2:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`polyline`,{points:`5,4 1.5,8 5,12`}),(0,O.jsx)(`polyline`,{points:`11,4 14.5,8 11,12`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`6.5`,y2:`13`})]})}function Yn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[e?(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`,fill:`currentColor`,stroke:`currentColor`}):(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3.5`,x2:`5`,y2:`2`}),(0,O.jsx)(`line`,{x1:`10`,y1:`3.5`,x2:`11`,y2:`2`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`7.5`,x2:`2`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`9.5`,x2:`2`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`11.5`,x2:`2`,y2:`12.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`7.5`,x2:`14`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`9.5`,x2:`14`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`11.5`,x2:`14`,y2:`12.5`})]})}function Xn({side:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),e===`left`?(0,O.jsx)(`rect`,{x:`2.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`}):(0,O.jsx)(`rect`,{x:`8.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`})]})}function Zn({variant:e}){return e===`inEditor`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`7.1`,y:`8.5`,width:`6.3`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):e===`belowSimulator`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`8`,y1:`3`,x2:`8`,y2:`13`}),(0,O.jsx)(`rect`,{x:`2.6`,y:`8.5`,width:`4.8`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`13`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`9.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`6.3`,y:`3.6`,width:`3`,height:`8.8`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]})}function Qn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function $n({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,dockModel:a,dockRegistry:o,layout:s,simPanelWidth:c}){return(0,O.jsx)(`div`,{className:`flex flex-col shrink-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 bg-surface-2 border-b border-border shrink-0`,style:{height:40},children:[(0,O.jsx)(`div`,{ref:e,children:(0,O.jsxs)(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)(Qn,{}),(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)(Un,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Wn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Gn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(C,{variant:`icon`,size:`icon`,onClick:()=>{me(!0)},title:`设置`,children:`⚙`})]})})}var er={x:0,y:0,width:0,height:0},tr=e=>({x:Math.round(e.x),y:Math.round(e.y),width:Math.max(0,Math.round(e.width)),height:Math.max(0,Math.round(e.height))});function nr(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return tr({x:t.left,y:t.top,width:t.width,height:t.height})},c=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,l=()=>{if(o||!n)return;let e=s();a&&c(a,e)||(a=e,r(e))},u=()=>{i||(i=new ResizeObserver(l),i.observe(e),window.addEventListener(`resize`,l))},d=()=>{i&&=(i.disconnect(),null),window.removeEventListener(`resize`,l)},f=()=>{a=null,n?(u(),a=s(),r(a)):(d(),r(er))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function rr(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:tr({x:t.left,y:t.top,width:t.width,height:t.height})}}var ir=(e,t)=>e.visible===t.visible?e.visible&&t.visible?e.bounds.x===t.bounds.x&&e.bounds.y===t.bounds.y&&e.bounds.width===t.bounds.width&&e.bounds.height===t.bounds.height:!0:!1;function ar(e,t){let n=t.visible,r=t.publish,i=t.guardDisplayNone??!1,a=t.followScroll??!1,o=t.followGeometry??!1,s=null,c=null,l=null,u=!1,d=null,f=0,p=!1,m=null,h=()=>{let t=rr(e);return i&&t.visible&&(t.bounds.width===0||t.bounds.height===0)?{visible:!1}:t},g=()=>{if(u||!n)return;let e=h();l&&ir(l,e)||(l=e,r(e))},_=()=>l?.visible===!1?!0:f++>=30,v=()=>{if(d=null,u||!n){m=null;return}if(m!==null&&performance.now()>=m){m=null;return}let e=h();if(!e.visible){if(_()){m=null;return}d=requestAnimationFrame(v);return}if(l&&ir(l,e)){if(f++,f>=2&&!p){m=null;return}}else l=e,r(e),f=0;!u&&n?d=requestAnimationFrame(v):m=null},y=()=>{!o||u||(f=0,d===null&&(d=requestAnimationFrame(v)))},b=()=>{d!==null&&(cancelAnimationFrame(d),d=null),f=0,m=null,p=!1},x=()=>{o?y():g()},S=e=>{let t=e.target;t&&t.closest&&t.closest(`[role="separator"]`)&&(p=!0,y())},C=()=>{p&&(p=!1,y())},w=()=>{s||(s=new ResizeObserver(g),s.observe(e),window.addEventListener(`resize`,g),i&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(g),c.observe(e)),a&&window.addEventListener(`scroll`,x,{capture:!0,passive:!0}),o&&(window.addEventListener(`pointerdown`,S,{capture:!0}),window.addEventListener(`pointerup`,C,{capture:!0})))},T=()=>{s&&=(s.disconnect(),null),c&&=(c.disconnect(),null),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,x,{capture:!0}),window.removeEventListener(`pointerdown`,S,{capture:!0}),window.removeEventListener(`pointerup`,C,{capture:!0}),b()},E=()=>{if(l=null,n)w(),l=h(),r(l);else{T();let e={visible:!1};l=e,r(e)}};return E(),{update(e){u||(r=e.publish,n=e.visible,E())},dispose(){u||(u=!0,T())},pulse(e){if(!(u||!o)){if(e!==void 0&&e>0){let t=performance.now()+e;m=m===null?t:Math.max(m,t)}y()}}}}function or(e){let t=(0,D.useRef)(null),n=(0,D.useRef)(null),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)([e.present,e.publish,...e.deps??[]]),a=(0,D.useRef)(()=>{let e=t.current;e&&(e.update({present:!1,publish:r.current.publish}),e.dispose(),t.current=null)}),o=(0,D.useCallback)(e=>{e!==n.current&&(n.current=e,t.current&&(e?(t.current.dispose(),t.current=null):a.current()),e&&(t.current=nr(e,{present:r.current.present,publish:r.current.publish}),i.current=[r.current.present,r.current.publish,...r.current.deps??[]]))},[]);return(0,D.useEffect)(()=>{let n=[e.present,e.publish,...e.deps??[]],r=i.current;(n.length!==r.length||n.some((e,t)=>!Object.is(e,r[t])))&&(i.current=n,t.current?.update({present:e.present,publish:e.publish}))},[e.present,e.publish,...e.deps??[]]),(0,D.useEffect)(()=>{let e=a.current;return n.current&&!t.current&&(t.current=nr(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}var sr=(0,D.createContext)(null);function cr(){return(0,D.useContext)(sr)}var lr={simulator:`simulator`,simulatorDevtools:`simulator-devtools`,workbench:`workbench`,hostToolbar:`host-toolbar`,settings:`settings`,popover:`popover`},ur={base:0,hostToolbar:5,settings:10,popover:20};function dr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function fr(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function pr(e){return e/100*window.innerHeight}function mr(e){return e/100*window.innerWidth}function hr(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 gr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=hr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=fr(t,i);break;case`em`:r=dr(t,i);break;case`vh`:r=pr(i);break;case`vw`:r=mr(i);break}return r}function N(e){return parseFloat(e.toFixed(3))}function _r({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 vr(e){let{panels:t}=e,n=_r({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=N(gr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=N(gr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=N(gr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=N(gr({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 P(e,t=`Assertion error`){if(!e)throw Error(t)}function yr(e,t){return Array.from(t).sort(e===`horizontal`?br:xr)}function br(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function xr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Sr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Cr(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 wr({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}=Cr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P(i,`No rect found`),i}var Tr;function Er(){return Tr===void 0&&(Tr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Tr}function Dr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=yr(n,Array.from(t.children).filter(Sr).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,wr({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=Er()?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:_r({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 Or=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)}}},F=new Map,kr=new Or;function Ar(e){F=new Map(F),F.delete(e)}function jr(e,t){for(let[t]of F)if(t.id===e)return t}function I(e,t){for(let[t,n]of F)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Mr(){return F}function Nr(e,t){return kr.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function L(e,t){let n=F.get(e);F=new Map(F),F.set(e,t),kr.emit(`groupChange`,{group:e,prev:n,next:t})}function Pr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Cr(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 Fr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ir(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Hr(e),b:Hr(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Vr(Br(n.a)),b:Vr(Br(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 Lr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Rr(e){let t=getComputedStyle(Ur(e)??e).display;return t===`flex`||t===`inline-flex`}function zr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Rr(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`||Lr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Br(e){let t=e.length;for(;t--;){let n=e[t];if(P(n,`Missing node`),zr(n))return n}return null}function Vr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hr(e){let t=[];for(;e;)t.push(e),e=Ur(e);return t}function Ur(e){let{parentNode:t}=e;return Fr(t)?t.host:t}function Wr(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 Gr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Sr(n)||n.contains(e)||e.contains(n))return!0;if(Ir(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Wr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Kr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Dr(r),a=Pr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Gr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qr(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 R(e,t,n=0){return Math.abs(N(e)-N(t))<=n}function z(e,t){return R(e,t)?0:e>t?1:-1}function Jr({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(z(r,c)<0)if(a){let e=(i+c)/2;r=z(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=N(r),r}function Yr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(R(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P(u!=null,`Invalid first pivot index`),P(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P(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(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,i)){let t=o-n;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P(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(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,o)){let t=n-i;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&z(i,c)<0)if(e>0){let t=c-o,n=t/2;z(i+e,c)<0&&(e=z(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;z(i-e,c)<0&&(e=z(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];P(e!=null,`Previous layout not found for panel index ${r}`);let a=Jr({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];P(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Jr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!R(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(qr(c,l))return i;{let t=e<0?d:u,r=s[t];P(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Jr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!R(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Jr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(R(i,s)||(t-=s-i,l[r]=s),R(t,0))break;e>0?r--:r++}}}if(!R(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 Xr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||z(e[n],t[n])!==0)return!1;return!0}function Zr({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(!R(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P(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];P(i!=null,`No layout data found for index ${e}`);let o=r[e];P(o!=null,`No layout data found for index ${e}`);let s=Jr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!R(a,0))for(let e=0;e<t.length;e++){let n=r[e];P(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Jr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,R(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=Mr();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=Zr({layout:Yr({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});Xr(l,p)||L(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&&R(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=_r({group:t});o(N(gr({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function $r(e){e.defaultPrevented||Kr(e,Mr()).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 ei(e){let t=Mr();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 ti({groupId:e}){let t=()=>{let t=Mr();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=Zr({layout:e,panelConstraints:r});return n?o:(Xr(o,c)||L(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function ni(e,t){let n=ei(e),r=I(n.id,!0),i=n.separators.find(t=>t.element===e);P(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=ti({groupId:n.id}).getLayout(),c=Zr({layout:Yr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Xr(s,c)||L(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ri(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ei(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&ni(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&ni(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&ni(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&ni(t,-5);break;case`End`:e.preventDefault(),ni(t,100);break;case`Enter`:{e.preventDefault();let n=ei(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=I(n.id,!0),o=n.separators.find(e=>e.element===t);P(o,`Matching separator not found`);let s=a.get(o);P(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];ni(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ei(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P(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(),ni(t,-100);break}}var ii={cursorFlags:0,state:`inactive`},ai=new Or;function oi(){return ii}function si(e){return ai.addListener(`change`,e)}function ci(e){let t=ii,n={...ii};n.cursorFlags=e,ii=n,ai.emit(`change`,{prev:t,next:n})}function li(e){let t=ii;ii=e,ai.emit(`change`,{prev:t,next:e})}function ui(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Mr(),n=Kr(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)}),li({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var di=e=>e,fi=()=>{},pi=1,mi=2,hi=4,gi=8,_i=3,vi=12,yi;function bi(){return yi===void 0&&(yi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(yi=!0)),yi}function xi({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&&bi()){let t=(e&pi)!==0,n=(e&mi)!==0,r=(e&hi)!==0,i=(e&gi)!==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 bi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Si=new WeakMap;function Ci(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Si.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=oi();switch(r.state){case`active`:case`hover`:{let e=xi({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}Si.set(e,{prevStyle:t,styleSheet:n})}function wi({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=Yr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Xr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?pi:mi;break;case`vertical`:s|=d<0?hi:gi;break}}else L(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&_i:c|=s&_i,t.movementY===0?c|=o&vi:c|=s&vi,ci(c),Ci(e)}function Ti(e){let t=Mr(),n=oi();switch(n.state){case`active`:wi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ei(e){if(e.defaultPrevented)return;let t=oi(),n=Mr();switch(t.state){case`active`:if(e.buttons===0){li({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(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)}wi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Kr(e,n);r.length===0?t.state!==`inactive`&&li({cursorFlags:0,state:`inactive`}):li({cursorFlags:0,hitRegions:r,state:`hover`}),Ci(e.currentTarget);break}}}function Di(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(oi().state){case`hover`:li({cursorFlags:0,state:`inactive`})}}function Oi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=oi();switch(t.state){case`active`:li({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ci(e.currentTarget),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)}),e.preventDefault())}}function ki(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=N(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=N((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ai(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=_r({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:N(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ji(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 Mi({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=N(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]=N((r[e]??0)/a*l);else{let e=N(l/c.length);for(let t of c)u[t]=e}return u}function Ni(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 Pi=new Map;function Fi(e){let t=!0;P(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=_r({group:e});if(t===0)return;let n=I(e.id);if(!n)return;let r=vr(e),i=n.defaultLayoutDeferred?ki(r):n.layout,a=Zr({layout:Mi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Xr(n.layout,a)&&ji(n.derivedPanelConstraints,r)&&n.groupSize===t)return;L(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ai(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P(!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=_r({group:e}),s=vr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ni(e.panels,l)||(l=void 0));let u=Zr({layout:e.mutableState.layouts[c]??l??ki(s),panelConstraints:s}),d=e.element.ownerDocument;Pi.set(d,(Pi.get(d)??0)+1);let f=new Map;return Dr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),L(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P(!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`,ri)}),Pi.get(d)===1&&(d.addEventListener(`dblclick`,$r,!0),d.addEventListener(`pointerdown`,ui,!0),d.addEventListener(`pointerleave`,Ti),d.addEventListener(`pointermove`,Ei),d.addEventListener(`pointerout`,Di),d.addEventListener(`pointerup`,Oi,!0)),function(){t=!1,Pi.set(d,Math.max(0,(Pi.get(d)??0)-1)),Ar(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ri)}),Pi.get(d)||(d.removeEventListener(`dblclick`,$r,!0),d.removeEventListener(`pointerdown`,ui,!0),d.removeEventListener(`pointerleave`,Ti),d.removeEventListener(`pointermove`,Ei),d.removeEventListener(`pointerout`,Di),d.removeEventListener(`pointerup`,Oi,!0)),a.disconnect()}}function Ii(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Li(e){let t=(0,D.useId)();return`${e??t}`}var Ri=typeof window<`u`?D.useLayoutEffect:D.useEffect;function zi(e){let t=(0,D.useRef)(e);return Ri(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Bi(...e){return zi(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Vi(e){let t=(0,D.useRef)({...e});return Ri(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Hi=(0,D.createContext)(null);function Ui(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:di});(0,D.useImperativeHandle)(t,()=>n.current,[]),Ri(()=>{Object.assign(n.current,ti({groupId:e}))})}function Wi({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=zi(e=>{Xr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=zi(e=>{Xr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Li(s),v=(0,D.useRef)(null),[y,b]=Ii(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Bi(v,a);Ui(_,o);let C=zi((e,t)=>{let r=oi(),i=jr(e),a=I(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=Vi({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=yr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=yr(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=jr(_),i=I(_);r&&i&&L(r,{...i,derivedPanelConstraints:vr(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 Ri(()=>{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=Fi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=I(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Nr(_,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=R(t.collapsedSize,i[t.panelId]),a=R(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=oi().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)(Hi.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})})}Wi.displayName=`Group`;function Gi(){let e=(0,D.useContext)(Hi);return P(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Ki(e,t){let{id:n}=Gi(),r=(0,D.useRef)({collapse:fi,expand:fi,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fi});(0,D.useImperativeHandle)(t,()=>r.current,[]),Ri(()=>{Object.assign(r.current,Qr({groupId:n,panelId:e}))})}function qi({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=Li(c),_=Vi({disabled:a}),v=(0,D.useRef)(null),y=Bi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Gi(),T=d!==null,E=zi((e,t,n)=>{d?.(e,c,n)});Ri(()=>{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]),Ki(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>Nr(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:{...Ji,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})})}qi.displayName=`Panel`;var Ji={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Yi({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=Zr({layout:Yr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Zr({layout:Yr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Xi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Li(a),l=Vi({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),_=Bi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Gi(),C=b===`horizontal`?`vertical`:`horizontal`;Ri(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=si(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Nr(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(Yi({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})}Xi.displayName=`Separator`;function Zi(e,t,n,r){return!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)}function Qi(e){return Number.isFinite(e)?Math.max(0,Math.min(.5,e)):.25}function $i(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 ea(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 ta(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 na(e,t,n,r,i){let{inLeft:a,inTop:o,activeHoriz:s,activeVert:c}=ea(e,t,n,r,i);return!s&&!c?`center`:s&&!c?a?`left`:`right`:c&&!s?o?`top`:`bottom`:ta(e,t,n,r,a,o)}function ra(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(Zi(r,i,a,o))return`center`;let s=Qi(n),c=$i(r,i,a,o);return c===void 0?na(r,i,a,o,s):c}function ia(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 aa(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function oa(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 sa(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 ca=.5;function la(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 ua(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=la(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function da(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function fa(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=da(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function pa(e,t,n,r=ca){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 ma(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=ha(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):ga(t[n]??0,c,l,u)}return d}function ha(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 ga(e,t,n,r){return n<=0?r>0?t/r:t:t*(e>0?e:0)/n}function _a(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:la(i)}}function va(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=ua(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(da(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)(Xi,{"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)(qi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Aa(e,n)},ya(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;u.push((0,O.jsx)(qi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Aa(e,n)},ya(e)))}else{let t=i.get(r);u.push((0,O.jsx)(qi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:Aa(e,n)},ya(e)))}});let d=e=>{let t=l.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=_a(r,t.constraints,e);if(!a)return;let o=ua(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,fa(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,fa(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=ma(r,n.sizes,n.constraints,i,u);return d?pa(i,d,r)?{pushed:!1,stuck:!0}:(t.setLayout(d),{pushed:!0,stuck:pa(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)(Wi,{groupRef:s,orientation:r,onLayoutChanged:d,style:{width:`100%`,height:`100%`},children:u},t.children.length)})}function ya(e){return e.id}function ba(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(xa,{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 xa(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 Sa=`application/x-deck-panel`;function Ca(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(Sa))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(ra({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=ra({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer?.getData(Sa);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=oa(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(Sa)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer?.getData(Sa);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=oa(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(Sa,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,ba(t,n),r?(0,O.jsx)(Ta,{zone:r}):null]})}function wa(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 Ta(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:wa(e.zone)})}var Ea=(0,D.createContext)(0);function Da(){return(0,D.useContext)(Ea)}function Oa(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=sa(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 ka(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=>xn(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`){Oa(t,n,{groupId:e,activePanelId:r,draggedPanelId:i,draggedGroupId:c,zone:a,reorderIndex:o});return}if(aa(i,c,s,a))return;let l=ia(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:yn(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(Ea.Provider,{value:l,children:Aa(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 Aa(e,t){return e.kind===`split`?ja(e,t):Ma(e,t)}function ja(e,t){return(0,O.jsx)(va,{node:e,ctx:t},e.id)}function Ma(e,t){return(0,O.jsx)(Ca,{node:e,ctx:t},e.id)}function Na({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 Pa({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 Fa(){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 Ia=50;function La(e,t,n){if(e.width<=0||e.height<=0)return n;let r=Math.min(e.width/(t.width+Ia),e.height/(t.height+Ia));return Math.max(1,Math.min(100,Math.floor(r*100)))}function Ra({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=cr(),w=(0,D.useCallback)(e=>{if(e.visible){let t=f.current;d.current=t===`auto`?La(e.bounds,p.current,d.current):t}C?.set({viewId:lr.simulator,placement:e,layer:ur.base,extra:{zoom:d.current}})},[C]),T=(0,D.useCallback)(e=>{let t=m.current;if(t){e?(t.dispose(),m.current=ar(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:w})):(t.update({visible:!1,publish:w}),t.dispose(),m.current=null);return}e&&(m.current=ar(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)},[Da()]),(0,D.useEffect)(()=>()=>{m.current?.dispose(),m.current=null,C?.remove(lr.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)(Fa,{}),x&&c?.pageFallback&&(0,O.jsx)(Pa,{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)(Na,{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 za(){let e=(0,D.useRef)(null),t=cr(),n=(0,D.useCallback)(e=>{t?.set({viewId:lr.workbench,placement:e,layer:ur.base})},[t]),r=(0,D.useCallback)(t=>{let r=e.current;if(r){t?(r.dispose(),e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(r.update({visible:!1,publish:n}),r.dispose(),e.current=null);return}t&&(e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[n]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[Da()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null,t?.remove(lr.workbench)},[t]),(0,O.jsx)(`div`,{ref:r,className:`h-full w-full`,"data-area":`editor`})}function Ba(e){return!!(e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function Va({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 Ha({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 Ua({node:e,depth:t,inspectedSid:n,onInspect:r}){return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(Ja,{node:e,depth:t,inspectedSid:n,onInspect:r},i))})}function Wa({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ba(e)),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)(Ja,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}function Ga({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)(Va,{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 Ka({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)(Va,{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)(Ja,{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 qa({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ba(e)),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)(Ga,{node:e,indent:o,attrEntries:l,isInspected:s,onMouseEnter:u,inlineText:d}):(0,O.jsx)(Ka,{node:e,depth:t,indent:o,attrEntries:l,hasChildren:c,expanded:i,isInspected:s,inspectedSid:n,onInspect:r,onToggle:()=>a(!i),onMouseEnter:u})}function Ja({node:e,depth:t,inspectedSid:n,onInspect:r}){return e.tagName===`#text`?(0,O.jsx)(Ha,{node:e,depth:t}):e.tagName===`#fragment`?(0,O.jsx)(Ua,{node:e,depth:t,inspectedSid:n,onInspect:r}):e.tagName===`#shadow-root`?(0,O.jsx)(Wa,{node:e,depth:t,inspectedSid:n,onInspect:r}):(0,O.jsx)(qa,{node:e,depth:t,inspectedSid:n,onInspect:r})}function Ya({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 Xa({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)(Ja,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(Ya,{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 Za(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 Qa({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)(null);return Za({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(a),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}}),(0,O.jsx)(Xa,{tree:i,onInspectElement:t=>e.inspect(t),onClearInspection:async()=>{await e.clearInspection()},isRuntimeRunning:r})}var $a=`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 eo({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:`${$a} 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:`${$a} 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:`${$a} hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function to(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 no({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)([]);Za({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(e=>{a(t=>to(t,e))}),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}});let o=e.clearAll?.bind(e);return(0,O.jsx)(eo,{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 B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ro={},io=(0,D.createContext)(ro),ao=(e,t)=>B({},e,t),oo=()=>(0,D.useContext)(io),so=(0,D.createContext)(()=>{});so.displayName=`JVR.DispatchShowTools`;function co(){return(0,D.useReducer)(ao,ro)}function lo(){return(0,D.useContext)(so)}var uo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(io.Provider,{value:t,children:(0,O.jsx)(so.Provider,{value:n,children:r})})};uo.displayName=`JVR.ShowTools`;var fo={},po=(0,D.createContext)(fo),mo=(e,t)=>B({},e,t),ho=()=>(0,D.useContext)(po),go=(0,D.createContext)(()=>{});go.displayName=`JVR.DispatchExpands`;function _o(){return(0,D.useReducer)(mo,fo)}function vo(){return(0,D.useContext)(go)}var yo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(po.Provider,{value:t,children:(0,O.jsx)(go.Provider,{value:n,children:r})})};yo.displayName=`JVR.Expands`;var bo={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},xo=(0,D.createContext)(bo),So=(e,t)=>B({},e,t),H=()=>(0,D.useContext)(xo),Co=(0,D.createContext)(()=>{});Co.displayName=`JVR.DispatchTypes`;function wo(){return(0,D.useReducer)(So,bo)}function To(){return(0,D.useContext)(Co)}function Eo(e){var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(xo.Provider,{value:t,children:(0,O.jsx)(Co.Provider,{value:n,children:r})})}Eo.displayName=`JVR.Types`;var Do=[`style`];function Oo(e){var{style:t}=e,n=V(e,Do);return(0,O.jsx)(`svg`,B({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:B({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,O.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}Oo.displayName=`JVR.TriangleArrow`;var ko={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,O.jsx)(Oo,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},Ao=(0,D.createContext)(ko),jo=(e,t)=>B({},e,t),U=()=>(0,D.useContext)(Ao),Mo=(0,D.createContext)(()=>{});Mo.displayName=`JVR.DispatchSymbols`;function No(){return(0,D.useReducer)(jo,ko)}function Po(){return(0,D.useContext)(Mo)}var Fo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ao.Provider,{value:t,children:(0,O.jsx)(Mo.Provider,{value:n,children:r})})};Fo.displayName=`JVR.Symbols`;var Io={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},Lo=(0,D.createContext)(Io),Ro=(e,t)=>B({},e,t),W=()=>(0,D.useContext)(Lo),zo=(0,D.createContext)(()=>{});zo.displayName=`JVR.DispatchSection`;function Bo(){return(0,D.useReducer)(Ro,Io)}function Vo(){return(0,D.useContext)(zo)}var Ho=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Lo.Provider,{value:t,children:(0,O.jsx)(zo.Provider,{value:n,children:r})})};Ho.displayName=`JVR.Section`;var Uo={objectSortKeys:!1,indentWidth:15},Wo=(0,D.createContext)(Uo);Wo.displayName=`JVR.Context`;var Go=(0,D.createContext)(()=>{});Go.displayName=`JVR.DispatchContext`;function Ko(e,t){return B({},e,t)}var qo=()=>(0,D.useContext)(Wo),Jo=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,D.useReducer)(Ko,Object.assign({},Uo,n)),[o,s]=co(),[c,l]=_o(),[u,d]=wo(),[f,p]=No(),[m,h]=Bo();return(0,D.useEffect)(()=>a(B({},n)),[n]),(0,O.jsx)(Wo.Provider,{value:i,children:(0,O.jsx)(Go.Provider,{value:a,children:(0,O.jsx)(uo,{initial:o,dispatch:s,children:(0,O.jsx)(yo,{initial:c,dispatch:l,children:(0,O.jsx)(Eo,{initial:B({},u,r),dispatch:d,children:(0,O.jsx)(Fo,{initial:f,dispatch:p,children:(0,O.jsx)(Ho,{initial:m,dispatch:h,children:t})})})})})})})};Jo.displayName=`JVR.Provider`;function Yo(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var Xo=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Zo=[`as`,`render`],Qo=[`as`,`render`],$o=[`as`,`render`],es=[`as`,`style`,`render`],ts=[`as`,`render`],ns=[`as`,`render`],rs=[`as`,`render`],is=[`as`,`render`],as=e=>{var{Quote:t={}}=U(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=V(e,Xo);if(n)return null;var{as:c,render:l}=t,u=V(t,Zo),d=c||`span`,f=B({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,O.jsx)(d,B({},f))};as.displayName=`JVR.Quote`;var os=e=>{var{ValueQuote:t={}}=U(),n=B({},(Yo(e),e)),{as:r,render:i}=t,a=V(t,Qo),o=r||`span`,s=B({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,O.jsx)(o,B({},s))};os.displayName=`JVR.ValueQuote`;var ss=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=U(),{as:o,render:s}=a,c=V(a,$o),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,O.jsx)(l,B({},c))};ss.displayName=`JVR.Colon`;var cs=e=>{var{Arrow:t={}}=U(),n=ho(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=V(t,es),m=u||`span`,h=f&&typeof f==`function`,g=B({},p,{"data-expanded":l,style:B({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,O.jsx)(m,B({},p,{style:B({},d,i)}))};cs.displayName=`JVR.Arrow`;var ls=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=U(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=V(o,ts),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,O.jsx)(f,B({},d))}var{as:p,render:m}=s,h=V(s,ns),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,O.jsx)(g,B({},h))};ls.displayName=`JVR.BracketsOpen`;var us=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=U();if(t){var{as:u,render:d}=c,f=V(c,rs),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,O.jsx)(p,B({},f))}var{as:m,render:h}=l,g=V(l,is),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,O.jsx)(_,B({},g))};us.displayName=`JVR.BracketsClose`;var ds=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=ho(),{collapsed:c,shouldExpandNodeInitially:l}=qo(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,O.jsx)(`div`,{style:m,children:(0,O.jsx)(us,B({isBrackets:g||_},h,{isVisiable:!0}))})};ds.displayName=`JVR.NestedClose`;var fs=[`as`,`render`],ps=[`as`,`render`],ms=[`as`,`render`],hs=[`as`,`render`],gs=[`as`,`render`],_s=[`as`,`render`],vs=[`as`,`render`],ys=[`as`,`render`],bs=[`as`,`render`],xs=[`as`,`render`],Ss=[`as`,`render`],Cs=[`as`,`render`],ws=[`as`,`render`],Ts=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},Es=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=H();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=V(r,fs);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Es.displayName=`JVR.SetComp`;var Ds=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=H();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=V(r,ps);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Ds.displayName=`JVR.MapComp`;var G={opacity:.75,paddingRight:4},Os=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=H(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=qo(),{as:c,render:l}=i,u=V(i,ms),d=t,[f,p]=(0,D.useState)(o&&d.length>o);(0,D.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=B({},G,i.style||{});o>0&&(u.style=B({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(B({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(B({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(v||(0,O.jsx)(m,B({},u,{style:h}))),b||(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(os,{}),(0,O.jsx)(m,B({},u,{className:y,children:g})),(0,O.jsx)(os,{})]})]})};Os.displayName=`JVR.TypeString`;var ks=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,hs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ks.displayName=`JVR.TypeTrue`;var As=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,gs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};As.displayName=`JVR.TypeFalse`;var js=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,_s),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};js.displayName=`JVR.TypeFloat`;var Ms=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,vs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Ms.displayName=`JVR.TypeInt`;var Ns=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,ys),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:Ts(t?.toString())}))]})};Ns.displayName=`JVR.TypeFloat`;var Ps=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,bs),l=o||`span`,u=B({},G,i.style),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsxs)(`a`,B({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,O.jsx)(os,{}),t?.href,(0,O.jsx)(os,{})]}))]})};Ps.displayName=`JVR.TypeUrl`;var Fs=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,xs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(B({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),m||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:p}))]})};Fs.displayName=`JVR.TypeDate`;var Is=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ss),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Is.displayName=`JVR.TypeUndefined`;var Ls=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Cs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Ls.displayName=`JVR.TypeNull`;var Rs=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,ws),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Rs.displayName=`JVR.TypeNan`;var zs=e=>Number(e)===e&&e%1!=0||isNaN(e),Bs=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,O.jsx)(Ps,B({},i,{children:t})):typeof t==`string`?(0,O.jsx)(Os,B({},i,{children:t})):t===!0?(0,O.jsx)(ks,B({},i,{children:t})):t===!1?(0,O.jsx)(As,B({},i,{children:t})):t===null?(0,O.jsx)(Ls,B({},i,{children:t})):t===void 0?(0,O.jsx)(Is,B({},i,{children:t})):t instanceof Date?(0,O.jsx)(Fs,B({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,O.jsx)(Rs,B({},i,{children:t})):typeof t==`number`&&zs(t)?(0,O.jsx)(js,B({},i,{children:t})):typeof t==`bigint`?(0,O.jsx)(Ns,B({},i,{children:t})):typeof t==`number`?(0,O.jsx)(Ms,B({},i,{children:t})):null};Bs.displayName=`JVR.Value`;function K(e,t,n){var r=Po(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function q(e,t,n){var r=To(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function Vs(e,t,n){var r=Vo(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}var Hs=[`as`,`render`],Us=e=>{var{KeyName:t={}}=W();return Vs(t,e,`KeyName`),null};Us.displayName=`JVR.KeyName`;var Ws=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=W(),{as:c,render:l}=s,u=V(s,Hs);u.style=B({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(B({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,O.jsx)(d,B({},u,{children:t}))};Ws.displayName=`JVR.KeyNameComp`;var Gs=[`children`,`value`,`parentValue`,`keyName`,`keys`],Ks=[`as`,`render`,`children`],qs=e=>{var{Row:t={}}=W();return Vs(t,e,`Row`),null};qs.displayName=`JVR.Row`;var Js=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=V(e,Gs),{Row:s={}}=W(),{as:c,render:l}=s,u=V(s,Ks),d=c||`div`;return l&&typeof l==`function`&&l(B({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,O.jsx)(d,B({},o,u,{children:t}))};Js.displayName=`JVR.RowComp`;function Ys(e){var t=(0,D.useRef)();return(0,D.useEffect)(()=>{t.current=e}),t.current}function Xs(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Ys(t),a=(0,D.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,D.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Zs=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Qs=[`as`,`render`],$s=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=V(e,Zs),{onCopied:c,enableClipboard:l,beforeCopy:u}=qo(),d=oo()[i],[f,p]=(0,D.useState)(!1),{Copied:m={}}=W(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?Ts(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?Ts(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=V(m,Qs),y=B({},v,s,g,{style:B({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(B({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};$s.displayName=`JVR.Copied`;function ec(){var e=(0,D.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var tc=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=ho(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=qo(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,O.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,O.jsx)(rc,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};tc.displayName=`JVR.KeyValues`;var nc=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=qo(),o=typeof t==`number`,s=(0,D.useRef)(null);Xs({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`span`,{ref:s,children:[(0,O.jsx)(as,B({isNumber:o,"data-placement":`left`},c)),(0,O.jsx)(Ws,B({},c,{children:t})),(0,O.jsx)(as,B({isNumber:o,"data-placement":`right`},c))]}),(0,O.jsx)(ss,B({},c))]})};nc.displayName=`JVR.KayName`;var rc=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=lo(),s=ec(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,O.jsx)(_c,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,O.jsxs)(Js,B({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,O.jsx)(nc,{keyName:t,value:n,keys:a,parentValue:r}),(0,O.jsx)(Bs,{keyName:t,value:n,keys:a}),(0,O.jsx)($s,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};rc.displayName=`JVR.KeyValuesItem`;var ic=[`value`,`keyName`],ac=[`as`,`render`],oc=e=>{var{CountInfoExtra:t={}}=W();return Vs(t,e,`CountInfoExtra`),null};oc.displayName=`JVR.CountInfoExtra`;var sc=e=>{var{value:t={},keyName:n}=e,r=V(e,ic),{CountInfoExtra:i={}}=W(),{as:a,render:o}=i,s=V(i,ac);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=B({},s,r);return l&&o(u,{value:t,keyName:n})||(0,O.jsx)(c,B({},u))};sc.displayName=`JVR.CountInfoExtraComps`;var cc=[`value`,`keyName`],lc=[`as`,`render`],uc=e=>{var{CountInfo:t={}}=W();return Vs(t,e,`CountInfo`),null};uc.displayName=`JVR.CountInfo`;var dc=e=>{var{value:t={},keyName:n}=e,r=V(e,cc),{displayObjectSize:i}=qo(),{CountInfo:a={}}=W();if(!i)return null;var{as:o,render:s}=a,c=V(a,lc),l=o||`span`;c.style=B({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=B({},c,r);return s&&typeof s==`function`&&s(B({},d,{"data-length":u}),{value:t,keyName:n})||(0,O.jsx)(l,B({},d))};dc.displayName=`JVR.CountInfoComp`;var fc=[`as`,`render`],pc=e=>{var{Ellipsis:t={}}=W();return Vs(t,e,`Ellipsis`),null};pc.displayName=`JVR.Ellipsis`;var mc=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=W(),{as:a,render:o}=i,s=V(i,fc),c=a||`span`;return o&&typeof o==`function`&&o(B({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,O.jsx)(c,B({},s)))};mc.displayName=`JVR.EllipsisComp`;var hc=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=ho(),l=vo(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=qo(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),w={style:_};C&&(w.onClick=g);var T={keyName:t,value:a,keys:r,parentValue:o};return(0,O.jsxs)(`span`,B({},w,{children:[C&&(0,O.jsx)(cs,B({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,O.jsx)(nc,B({},T)),(0,O.jsx)(Es,{value:i,keyName:t}),(0,O.jsx)(Ds,{value:i,keyName:t}),(0,O.jsx)(ls,B({isBrackets:x||S},T)),(0,O.jsx)(mc,{keyName:t,value:a,isExpanded:m}),(0,O.jsx)(us,B({isVisiable:m||!C,isBrackets:x||S},T)),(0,O.jsx)(dc,{value:a,keyName:t}),(0,O.jsx)(sc,{value:a,keyName:t}),(0,O.jsx)($s,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};hc.displayName=`JVR.NestedOpen`;var gc=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],_c=(0,D.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=V(e,gc),u=lo(),d=ec();return(0,O.jsxs)(`div`,B({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,O.jsx)(hc,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,O.jsx)(tc,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,O.jsx)(ds,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});_c.displayName=`JVR.Container`;var vc=e=>{var{BraceLeft:t={}}=U();return K(t,e,`BraceLeft`),null};vc.displayName=`JVR.BraceLeft`;var yc=e=>{var{BraceRight:t={}}=U();return K(t,e,`BraceRight`),null};yc.displayName=`JVR.BraceRight`;var bc=e=>{var{BracketsLeft:t={}}=U();return K(t,e,`BracketsLeft`),null};bc.displayName=`JVR.BracketsLeft`;var xc=e=>{var{BracketsRight:t={}}=U();return K(t,e,`BracketsRight`),null};xc.displayName=`JVR.BracketsRight`;var Sc=e=>{var{Arrow:t={}}=U();return K(t,e,`Arrow`),null};Sc.displayName=`JVR.Arrow`;var Cc=e=>{var{Colon:t={}}=U();return K(t,e,`Colon`),null};Cc.displayName=`JVR.Colon`;var wc=e=>{var{Quote:t={}}=U();return K(t,e,`Quote`),null};wc.displayName=`JVR.Quote`;var Tc=e=>{var{ValueQuote:t={}}=U();return K(t,e,`ValueQuote`),null};Tc.displayName=`JVR.ValueQuote`;var Ec=e=>{var{Bigint:t={}}=H();return q(t,e,`Bigint`),null};Ec.displayName=`JVR.Bigint`;var Dc=e=>{var{Date:t={}}=H();return q(t,e,`Date`),null};Dc.displayName=`JVR.Date`;var Oc=e=>{var{False:t={}}=H();return q(t,e,`False`),null};Oc.displayName=`JVR.False`;var kc=e=>{var{Float:t={}}=H();return q(t,e,`Float`),null};kc.displayName=`JVR.Float`;var Ac=e=>{var{Int:t={}}=H();return q(t,e,`Int`),null};Ac.displayName=`JVR.Int`;var jc=e=>{var{Map:t={}}=H();return q(t,e,`Map`),null};jc.displayName=`JVR.Map`;var Mc=e=>{var{Nan:t={}}=H();return q(t,e,`Nan`),null};Mc.displayName=`JVR.Nan`;var Nc=e=>{var{Null:t={}}=H();return q(t,e,`Null`),null};Nc.displayName=`JVR.Null`;var Pc=e=>{var{Set:t={}}=H();return q(t,e,`Set`),null};Pc.displayName=`JVR.Set`;var Fc=e=>{var{Str:t={}}=H();return q(t,e,`Str`),null};Fc.displayName=`JVR.StringText`;var Ic=e=>{var{True:t={}}=H();return q(t,e,`True`),null};Ic.displayName=`JVR.True`;var Lc=e=>{var{Undefined:t={}}=H();return q(t,e,`Undefined`),null};Lc.displayName=`JVR.Undefined`;var Rc=e=>{var{Url:t={}}=H();return q(t,e,`Url`),null};Rc.displayName=`JVR.Url`;var zc=e=>{var{Copied:t={}}=W();return Vs(t,e,`Copied`),null};zc.displayName=`JVR.Copied`;var Bc=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],J=(0,D.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=V(e,Bc),b=B({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,O.jsxs)(Jo,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,O.jsx)(_c,B({value:i},y,{ref:t,className:x,style:b})),a]})});J.Bigint=Ec,J.Date=Dc,J.False=Oc,J.Float=kc,J.Int=Ac,J.Map=jc,J.Nan=Mc,J.Null=Nc,J.Set=Pc,J.String=Fc,J.True=Ic,J.Undefined=Lc,J.Url=Rc,J.ValueQuote=Tc,J.Arrow=Sc,J.Colon=Cc,J.Quote=wc,J.Ellipsis=pc,J.BraceLeft=vc,J.BraceRight=yc,J.BracketsLeft=bc,J.BracketsRight=xc,J.Copied=zc,J.CountInfo=uc,J.CountInfoExtra=oc,J.KeyName=Us,J.Row=qs,J.displayName=`JVR.JsonView`;var Vc=J;function Hc(e){return`default`in e}var Uc=Hc(Vc)?Vc.default:Vc;function Wc(e){return e.pagePath??e.id}var Gc={"--w-rjv-font-family":`var(--font-family-mono)`,"--w-rjv-background-color":`transparent`,"--w-rjv-color":`var(--color-code-blue)`,"--w-rjv-key-string":`var(--color-code-blue)`,"--w-rjv-line-color":`var(--color-border-subtle)`,"--w-rjv-arrow-color":`var(--color-text-secondary)`,"--w-rjv-info-color":`var(--color-code-label)`,"--w-rjv-curlybraces-color":`var(--color-text-secondary)`,"--w-rjv-brackets-color":`var(--color-text-secondary)`,"--w-rjv-quotes-color":`var(--color-code-orange)`,"--w-rjv-quotes-string-color":`var(--color-code-orange)`,"--w-rjv-type-string-color":`var(--color-code-orange)`,"--w-rjv-type-int-color":`var(--color-code-number)`,"--w-rjv-type-float-color":`var(--color-code-number)`,"--w-rjv-type-bigint-color":`var(--color-code-number)`,"--w-rjv-type-boolean-color":`var(--color-code-keyword)`,"--w-rjv-type-null-color":`var(--color-code-keyword)`,"--w-rjv-type-nan-color":`var(--color-code-keyword)`,"--w-rjv-type-undefined-color":`var(--color-code-keyword)`,"--w-rjv-type-date-color":`var(--color-code-label)`,"--w-rjv-type-url-color":`var(--color-code-blue)`,fontSize:12,padding:`6px 8px`,wordBreak:`break-all`,whiteSpace:`pre-wrap`};function Kc({state:e,onSelectBridge:t,isRuntimeRunning:n=!0}){let{bridges:r,activeBridgeId:i,entries:a}=e;return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`appdata-panel`,children:[r.length>1&&(0,O.jsx)(`div`,{className:`flex gap-1 px-2 py-1 border-b border-border-subtle shrink-0 overflow-x-auto bg-bg-panel`,children:r.map(e=>{let n=e.id===i;return(0,O.jsx)(`button`,{onClick:()=>t(e.id),title:e.id,className:`shrink-0 px-2 py-0.5 text-[11px] rounded border transition-colors `+(n?`border-accent text-accent bg-surface-3`:`border-border-subtle text-text-dim hover:border-accent hover:text-accent`),children:Wc(e)},e.id)})}),r.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:n?`暂无页面数据(仅显示 Page 级 data)`:`小程序未运行`}):(0,O.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:r.map(e=>{let t=e.id===i,r=a[e.id]??{},o=Object.keys(r);return(0,O.jsx)(`div`,{"data-bridge-id":e.id,className:`absolute inset-0 flex flex-col gap-2 p-2 overflow-y-auto`,style:{display:t?`flex`:`none`},children:o.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:n?`暂无页面数据(仅显示 Page 级 data)`:`小程序未运行`}):o.map(t=>(0,O.jsxs)(`div`,{className:`border border-border-subtle rounded overflow-hidden shrink-0`,children:[(0,O.jsx)(`div`,{className:`bg-surface-3 px-2 py-0.5 text-[11px] text-code-label truncate`,children:t}),(0,O.jsx)(Uc,{value:r[t]??{},collapsed:1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,indentWidth:12,style:Gc})]},`${e.id}::${t}`))},e.id)})})]})}function qc(e){return(e??``).replace(/^\/+/,``)}function Jc(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=>qc(e.pagePath)===qc(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}var Yc={bridges:[],entries:{}};function Xc({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0,activePagePath:i=``}){let[a,o]=(0,D.useState)(Yc);Za({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}=Jc(a.bridges,i);return(0,O.jsx)(Kc,{state:{bridges:a.bridges,activeBridgeId:s,entries:a.entries},onSelectBridge:c,isRuntimeRunning:r})}function Zc(...e){return e.filter(Boolean).join(` `)}function Qc(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function $c(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function el(e){return e.kind===`event`?e.event.message:e.log.text}function tl({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=>el(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:Zc(`truncate font-medium shrink-0`,$c(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
|
|
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-DTEmLpxx.js";import{n as v,r as y,t as b}from"./input-7P0WbXyg.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-Bzbhbg9Z.js";import{n as pe}from"./constants-EAMiwL9_.js";import{l as me}from"./settings-api-B1wVFAPB.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:()=>{}}}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 yn(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 bn(e){let t=structuredClone(e),n=0,r=new Set,i=!1,a=[],o=e=>{let i=e(t);if(i===t)return;t=i,n+=1;let a={tree:t,revision:n};for(let e of[...r])try{e(a)}catch{}};return{get(){return t},apply(e){if(i){a.push(e);return}i=!0;try{for(o(e);a.length>0;){let e=a.shift();try{o(e)}catch{}}}finally{i=!1}},subscribe(e){return r.add(e),()=>{r.delete(e)}}}}function xn(e,t,n){return n.get(t)?.closable===!1?e:fn(e,t)}function Sn(){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 Cn(e){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:[1,6],constraints:[{minPx:e},null],children:[{kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`},{kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[{kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`},{kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`}]}]}}}var wn={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},Tn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),En=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),Dn=()=>({...wn,panels:[...wn.panels]});function On(e,t,n,r){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:e.map((e,t)=>r[t]??1),constraints:e.map((e,r)=>r===t?{minPx:n}:null),children:e}}}function kn(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[Tn(),Dn()]};return r?On([t,En()],0,e,[1,6]):On([En(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?On([Tn(),Dn(),En()],0,e,[1,4,5]):On([En(),Dn(),Tn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[En(),Dn()]};return r?On([Tn(),i],0,e,[1,6]):On([i,Tn()],1,e,[6,1])}function An(e,t,n){return bn(jn(e,t,n))}function jn(e,t,n){if(e===null)return Cn(t);try{let r=Wt(e);if(Ut(r,n).length===0)return Mn(Jt(r),t)}catch{}return Cn(t)}function Mn(e,t){let n=Fn(e);return Nn.some(e=>n.has(e))?Nn.reduce((e,r)=>n.has(r)?e:Bn(e,r,t),e):e}var Nn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Pn(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)Pn(n,t)}function Fn(e){let t=new Set;return Pn(e.root,t),t}function In(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=In(n,t);if(e!==void 0)return e}}function Ln(e,t){return t.find(t=>e.has(t))}function Rn(e,t){if(e.kind===`tabs`)return null;for(let n=0;n<e.children.length;n++){if(e.children[n].id===t)return{splitId:e.id,childIndex:n};let r=Rn(e.children[n],t);if(r)return r}return null}function zn(e,t){let n=In(e.root,`simulator`);if(!n)return e;let r=Rn(e.root,n);return r?ln(e,r.splitId,r.childIndex,{minPx:t}):e}function Bn(e,t,n){let r=Fn(e);if(r.has(t))return e;if(Nn.includes(t)){let n=Nn.find(e=>e!==t&&r.has(e));return n?mn(e,t,{groupId:In(e.root,n)}):r.has(`editor`)?yn(e,`editor`,`column`,t,`after`):r.has(`simulator`)?yn(e,`simulator`,`row`,t,`after`):yn(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=Ln(r,Nn);return t?vn(e,In(e.root,t),`column`,`editor`,`before`):r.has(`simulator`)?yn(e,`simulator`,`row`,`editor`,`after`):yn(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?zn(_n(e,`simulator`,`row`,`before`),n):yn(e,[...r][0],`column`,t,`after`)}function Vn(e,t){let n=Fn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Hn=Nn;function Un({model:e,registry:t,simPanelWidth:n}){let[,r]=(0,D.useState)(0);(0,D.useEffect)(()=>e.subscribe(()=>r(e=>e+1)),[e]);let i=new Set(Vn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Hn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?xn(e,r,t):Bn(e,r,n))}function u(){if(s){let t=Hn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>fn(e,t),e))}else{let t=Hn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>Bn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Kn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(qn,{filled:a})}),(0,O.jsx)(Kn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(Jn,{filled:o})}),(0,O.jsx)(Kn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Yn,{filled:s})})]})}function Wn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state,a=r===`left`;function o(){let r=a?`right`:`left`;t.setSimulatorAlignment(r),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(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)(Xn,{side:r})})}function Gn({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>kn(n,r,i))}return(0,O.jsx)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`调试器位置`,children:[{id:`inEditor`,title:`调试器位置:在编辑器面板中`},{id:`belowSimulator`,title:`调试器位置:在模拟器下方`},{id:`rightOfSimulator`,title:`调试器位置:在模拟器右侧`}].map(e=>(0,O.jsx)(Kn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Zn,{variant:e.id})},e.id))})}function Kn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(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 qn({filled:e}){return(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`,fill:`currentColor`,stroke:`currentColor`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`,stroke:`var(--color-surface-2)`,strokeWidth:`1.2`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`})]})})}function Jn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:e?2:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`polyline`,{points:`5,4 1.5,8 5,12`}),(0,O.jsx)(`polyline`,{points:`11,4 14.5,8 11,12`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`6.5`,y2:`13`})]})}function Yn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[e?(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`,fill:`currentColor`,stroke:`currentColor`}):(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3.5`,x2:`5`,y2:`2`}),(0,O.jsx)(`line`,{x1:`10`,y1:`3.5`,x2:`11`,y2:`2`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`7.5`,x2:`2`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`9.5`,x2:`2`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`11.5`,x2:`2`,y2:`12.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`7.5`,x2:`14`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`9.5`,x2:`14`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`11.5`,x2:`14`,y2:`12.5`})]})}function Xn({side:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),e===`left`?(0,O.jsx)(`rect`,{x:`2.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`}):(0,O.jsx)(`rect`,{x:`8.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`})]})}function Zn({variant:e}){return e===`inEditor`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`7.1`,y:`8.5`,width:`6.3`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):e===`belowSimulator`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`8`,y1:`3`,x2:`8`,y2:`13`}),(0,O.jsx)(`rect`,{x:`2.6`,y:`8.5`,width:`4.8`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`13`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`9.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`6.3`,y:`3.6`,width:`3`,height:`8.8`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]})}function Qn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function $n({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,dockModel:a,dockRegistry:o,layout:s,simPanelWidth:c}){return(0,O.jsx)(`div`,{className:`flex flex-col shrink-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 bg-surface-2 border-b border-border shrink-0`,style:{height:40},children:[(0,O.jsx)(`div`,{ref:e,children:(0,O.jsxs)(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)(Qn,{}),(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)(Un,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Wn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(Gn,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Qn,{}),(0,O.jsx)(C,{variant:`icon`,size:`icon`,onClick:()=>{me(!0)},title:`设置`,children:`⚙`})]})})}var er={x:0,y:0,width:0,height:0},tr=e=>({x:Math.round(e.x),y:Math.round(e.y),width:Math.max(0,Math.round(e.width)),height:Math.max(0,Math.round(e.height))});function nr(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return tr({x:t.left,y:t.top,width:t.width,height:t.height})},c=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,l=()=>{if(o||!n)return;let e=s();a&&c(a,e)||(a=e,r(e))},u=()=>{i||(i=new ResizeObserver(l),i.observe(e),window.addEventListener(`resize`,l))},d=()=>{i&&=(i.disconnect(),null),window.removeEventListener(`resize`,l)},f=()=>{a=null,n?(u(),a=s(),r(a)):(d(),r(er))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function rr(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:tr({x:t.left,y:t.top,width:t.width,height:t.height})}}var ir=(e,t)=>e.visible===t.visible?e.visible&&t.visible?e.bounds.x===t.bounds.x&&e.bounds.y===t.bounds.y&&e.bounds.width===t.bounds.width&&e.bounds.height===t.bounds.height:!0:!1;function ar(e,t){let n=t.visible,r=t.publish,i=t.guardDisplayNone??!1,a=t.followScroll??!1,o=t.followGeometry??!1,s=null,c=null,l=null,u=!1,d=null,f=0,p=!1,m=null,h=()=>{let t=rr(e);return i&&t.visible&&(t.bounds.width===0||t.bounds.height===0)?{visible:!1}:t},g=()=>{if(u||!n)return;let e=h();l&&ir(l,e)||(l=e,r(e))},_=()=>l?.visible===!1?!0:f++>=30,v=()=>{if(d=null,u||!n){m=null;return}if(m!==null&&performance.now()>=m){m=null;return}let e=h();if(!e.visible){if(_()){m=null;return}d=requestAnimationFrame(v);return}if(l&&ir(l,e)){if(f++,f>=2&&!p){m=null;return}}else l=e,r(e),f=0;!u&&n?d=requestAnimationFrame(v):m=null},y=()=>{!o||u||(f=0,d===null&&(d=requestAnimationFrame(v)))},b=()=>{d!==null&&(cancelAnimationFrame(d),d=null),f=0,m=null,p=!1},x=()=>{o?y():g()},S=e=>{let t=e.target;t&&t.closest&&t.closest(`[role="separator"]`)&&(p=!0,y())},C=()=>{p&&(p=!1,y())},w=()=>{s||(s=new ResizeObserver(g),s.observe(e),window.addEventListener(`resize`,g),i&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(g),c.observe(e)),a&&window.addEventListener(`scroll`,x,{capture:!0,passive:!0}),o&&(window.addEventListener(`pointerdown`,S,{capture:!0}),window.addEventListener(`pointerup`,C,{capture:!0})))},T=()=>{s&&=(s.disconnect(),null),c&&=(c.disconnect(),null),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,x,{capture:!0}),window.removeEventListener(`pointerdown`,S,{capture:!0}),window.removeEventListener(`pointerup`,C,{capture:!0}),b()},E=()=>{if(l=null,n)w(),l=h(),r(l);else{T();let e={visible:!1};l=e,r(e)}};return E(),{update(e){u||(r=e.publish,n=e.visible,E())},dispose(){u||(u=!0,T())},pulse(e){if(!(u||!o)){if(e!==void 0&&e>0){let t=performance.now()+e;m=m===null?t:Math.max(m,t)}y()}}}}function or(e){let t=(0,D.useRef)(null),n=(0,D.useRef)(null),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)([e.present,e.publish,...e.deps??[]]),a=(0,D.useRef)(()=>{let e=t.current;e&&(e.update({present:!1,publish:r.current.publish}),e.dispose(),t.current=null)}),o=(0,D.useCallback)(e=>{e!==n.current&&(n.current=e,t.current&&(e?(t.current.dispose(),t.current=null):a.current()),e&&(t.current=nr(e,{present:r.current.present,publish:r.current.publish}),i.current=[r.current.present,r.current.publish,...r.current.deps??[]]))},[]);return(0,D.useEffect)(()=>{let n=[e.present,e.publish,...e.deps??[]],r=i.current;(n.length!==r.length||n.some((e,t)=>!Object.is(e,r[t])))&&(i.current=n,t.current?.update({present:e.present,publish:e.publish}))},[e.present,e.publish,...e.deps??[]]),(0,D.useEffect)(()=>{let e=a.current;return n.current&&!t.current&&(t.current=nr(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}var sr=(0,D.createContext)(null);function cr(){return(0,D.useContext)(sr)}var lr={simulator:`simulator`,simulatorDevtools:`simulator-devtools`,workbench:`workbench`,hostToolbar:`host-toolbar`,settings:`settings`,popover:`popover`},ur={base:0,hostToolbar:5,settings:10,popover:20};function dr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function fr(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function pr(e){return e/100*window.innerHeight}function mr(e){return e/100*window.innerWidth}function hr(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 gr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=hr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=fr(t,i);break;case`em`:r=dr(t,i);break;case`vh`:r=pr(i);break;case`vw`:r=mr(i);break}return r}function N(e){return parseFloat(e.toFixed(3))}function _r({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 vr(e){let{panels:t}=e,n=_r({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=N(gr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=N(gr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=N(gr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=N(gr({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 P(e,t=`Assertion error`){if(!e)throw Error(t)}function yr(e,t){return Array.from(t).sort(e===`horizontal`?br:xr)}function br(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function xr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Sr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Cr(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 wr({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}=Cr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P(i,`No rect found`),i}var Tr;function Er(){return Tr===void 0&&(Tr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Tr}function Dr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=yr(n,Array.from(t.children).filter(Sr).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,wr({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=Er()?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:_r({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 Or=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)}}},F=new Map,kr=new Or;function Ar(e){F=new Map(F),F.delete(e)}function jr(e,t){for(let[t]of F)if(t.id===e)return t}function I(e,t){for(let[t,n]of F)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Mr(){return F}function Nr(e,t){return kr.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function L(e,t){let n=F.get(e);F=new Map(F),F.set(e,t),kr.emit(`groupChange`,{group:e,prev:n,next:t})}function Pr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Cr(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 Fr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ir(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Hr(e),b:Hr(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Vr(Br(n.a)),b:Vr(Br(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 Lr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Rr(e){let t=getComputedStyle(Ur(e)??e).display;return t===`flex`||t===`inline-flex`}function zr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Rr(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`||Lr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Br(e){let t=e.length;for(;t--;){let n=e[t];if(P(n,`Missing node`),zr(n))return n}return null}function Vr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hr(e){let t=[];for(;e;)t.push(e),e=Ur(e);return t}function Ur(e){let{parentNode:t}=e;return Fr(t)?t.host:t}function Wr(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 Gr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Sr(n)||n.contains(e)||e.contains(n))return!0;if(Ir(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Wr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Kr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Dr(r),a=Pr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Gr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qr(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 R(e,t,n=0){return Math.abs(N(e)-N(t))<=n}function z(e,t){return R(e,t)?0:e>t?1:-1}function Jr({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(z(r,c)<0)if(a){let e=(i+c)/2;r=z(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=N(r),r}function Yr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(R(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P(u!=null,`Invalid first pivot index`),P(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P(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(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,i)){let t=o-n;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P(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(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,o)){let t=n-i;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&z(i,c)<0)if(e>0){let t=c-o,n=t/2;z(i+e,c)<0&&(e=z(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;z(i-e,c)<0&&(e=z(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];P(e!=null,`Previous layout not found for panel index ${r}`);let a=Jr({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];P(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Jr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!R(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(qr(c,l))return i;{let t=e<0?d:u,r=s[t];P(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Jr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!R(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Jr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(R(i,s)||(t-=s-i,l[r]=s),R(t,0))break;e>0?r--:r++}}}if(!R(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 Xr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||z(e[n],t[n])!==0)return!1;return!0}function Zr({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(!R(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P(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];P(i!=null,`No layout data found for index ${e}`);let o=r[e];P(o!=null,`No layout data found for index ${e}`);let s=Jr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!R(a,0))for(let e=0;e<t.length;e++){let n=r[e];P(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Jr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,R(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=Mr();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=Zr({layout:Yr({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});Xr(l,p)||L(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&&R(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=_r({group:t});o(N(gr({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function $r(e){e.defaultPrevented||Kr(e,Mr()).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 ei(e){let t=Mr();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 ti({groupId:e}){let t=()=>{let t=Mr();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=Zr({layout:e,panelConstraints:r});return n?o:(Xr(o,c)||L(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function ni(e,t){let n=ei(e),r=I(n.id,!0),i=n.separators.find(t=>t.element===e);P(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=ti({groupId:n.id}).getLayout(),c=Zr({layout:Yr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Xr(s,c)||L(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ri(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ei(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&ni(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&ni(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&ni(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&ni(t,-5);break;case`End`:e.preventDefault(),ni(t,100);break;case`Enter`:{e.preventDefault();let n=ei(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=I(n.id,!0),o=n.separators.find(e=>e.element===t);P(o,`Matching separator not found`);let s=a.get(o);P(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];ni(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ei(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P(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(),ni(t,-100);break}}var ii={cursorFlags:0,state:`inactive`},ai=new Or;function oi(){return ii}function si(e){return ai.addListener(`change`,e)}function ci(e){let t=ii,n={...ii};n.cursorFlags=e,ii=n,ai.emit(`change`,{prev:t,next:n})}function li(e){let t=ii;ii=e,ai.emit(`change`,{prev:t,next:e})}function ui(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Mr(),n=Kr(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)}),li({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var di=e=>e,fi=()=>{},pi=1,mi=2,hi=4,gi=8,_i=3,vi=12,yi;function bi(){return yi===void 0&&(yi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(yi=!0)),yi}function xi({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&&bi()){let t=(e&pi)!==0,n=(e&mi)!==0,r=(e&hi)!==0,i=(e&gi)!==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 bi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Si=new WeakMap;function Ci(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Si.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=oi();switch(r.state){case`active`:case`hover`:{let e=xi({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}Si.set(e,{prevStyle:t,styleSheet:n})}function wi({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=Yr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Xr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?pi:mi;break;case`vertical`:s|=d<0?hi:gi;break}}else L(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&_i:c|=s&_i,t.movementY===0?c|=o&vi:c|=s&vi,ci(c),Ci(e)}function Ti(e){let t=Mr(),n=oi();switch(n.state){case`active`:wi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ei(e){if(e.defaultPrevented)return;let t=oi(),n=Mr();switch(t.state){case`active`:if(e.buttons===0){li({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(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)}wi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Kr(e,n);r.length===0?t.state!==`inactive`&&li({cursorFlags:0,state:`inactive`}):li({cursorFlags:0,hitRegions:r,state:`hover`}),Ci(e.currentTarget);break}}}function Di(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(oi().state){case`hover`:li({cursorFlags:0,state:`inactive`})}}function Oi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=oi();switch(t.state){case`active`:li({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ci(e.currentTarget),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)}),e.preventDefault())}}function ki(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=N(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=N((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ai(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=_r({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:N(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ji(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 Mi({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=N(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]=N((r[e]??0)/a*l);else{let e=N(l/c.length);for(let t of c)u[t]=e}return u}function Ni(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 Pi=new Map;function Fi(e){let t=!0;P(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=_r({group:e});if(t===0)return;let n=I(e.id);if(!n)return;let r=vr(e),i=n.defaultLayoutDeferred?ki(r):n.layout,a=Zr({layout:Mi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Xr(n.layout,a)&&ji(n.derivedPanelConstraints,r)&&n.groupSize===t)return;L(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ai(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P(!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=_r({group:e}),s=vr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ni(e.panels,l)||(l=void 0));let u=Zr({layout:e.mutableState.layouts[c]??l??ki(s),panelConstraints:s}),d=e.element.ownerDocument;Pi.set(d,(Pi.get(d)??0)+1);let f=new Map;return Dr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),L(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P(!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`,ri)}),Pi.get(d)===1&&(d.addEventListener(`dblclick`,$r,!0),d.addEventListener(`pointerdown`,ui,!0),d.addEventListener(`pointerleave`,Ti),d.addEventListener(`pointermove`,Ei),d.addEventListener(`pointerout`,Di),d.addEventListener(`pointerup`,Oi,!0)),function(){t=!1,Pi.set(d,Math.max(0,(Pi.get(d)??0)-1)),Ar(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ri)}),Pi.get(d)||(d.removeEventListener(`dblclick`,$r,!0),d.removeEventListener(`pointerdown`,ui,!0),d.removeEventListener(`pointerleave`,Ti),d.removeEventListener(`pointermove`,Ei),d.removeEventListener(`pointerout`,Di),d.removeEventListener(`pointerup`,Oi,!0)),a.disconnect()}}function Ii(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Li(e){let t=(0,D.useId)();return`${e??t}`}var Ri=typeof window<`u`?D.useLayoutEffect:D.useEffect;function zi(e){let t=(0,D.useRef)(e);return Ri(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Bi(...e){return zi(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Vi(e){let t=(0,D.useRef)({...e});return Ri(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Hi=(0,D.createContext)(null);function Ui(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:di});(0,D.useImperativeHandle)(t,()=>n.current,[]),Ri(()=>{Object.assign(n.current,ti({groupId:e}))})}function Wi({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=zi(e=>{Xr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=zi(e=>{Xr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Li(s),v=(0,D.useRef)(null),[y,b]=Ii(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Bi(v,a);Ui(_,o);let C=zi((e,t)=>{let r=oi(),i=jr(e),a=I(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=Vi({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=yr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=yr(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=jr(_),i=I(_);r&&i&&L(r,{...i,derivedPanelConstraints:vr(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 Ri(()=>{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=Fi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=I(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Nr(_,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=R(t.collapsedSize,i[t.panelId]),a=R(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=oi().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)(Hi.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})})}Wi.displayName=`Group`;function Gi(){let e=(0,D.useContext)(Hi);return P(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Ki(e,t){let{id:n}=Gi(),r=(0,D.useRef)({collapse:fi,expand:fi,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fi});(0,D.useImperativeHandle)(t,()=>r.current,[]),Ri(()=>{Object.assign(r.current,Qr({groupId:n,panelId:e}))})}function qi({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=Li(c),_=Vi({disabled:a}),v=(0,D.useRef)(null),y=Bi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Gi(),T=d!==null,E=zi((e,t,n)=>{d?.(e,c,n)});Ri(()=>{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]),Ki(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>Nr(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:{...Ji,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})})}qi.displayName=`Panel`;var Ji={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Yi({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=Zr({layout:Yr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Zr({layout:Yr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Xi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Li(a),l=Vi({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),_=Bi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Gi(),C=b===`horizontal`?`vertical`:`horizontal`;Ri(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=si(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Nr(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(Yi({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})}Xi.displayName=`Separator`;function Zi(e,t,n,r){return!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)}function Qi(e){return Number.isFinite(e)?Math.max(0,Math.min(.5,e)):.25}function $i(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 ea(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 ta(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 na(e,t,n,r,i){let{inLeft:a,inTop:o,activeHoriz:s,activeVert:c}=ea(e,t,n,r,i);return!s&&!c?`center`:s&&!c?a?`left`:`right`:c&&!s?o?`top`:`bottom`:ta(e,t,n,r,a,o)}function ra(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(Zi(r,i,a,o))return`center`;let s=Qi(n),c=$i(r,i,a,o);return c===void 0?na(r,i,a,o,s):c}function ia(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 aa(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function oa(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 sa(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 ca=.5;function la(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 ua(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=la(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function da(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function fa(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=da(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function pa(e,t,n,r=ca){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 ma(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=ha(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):ga(t[n]??0,c,l,u)}return d}function ha(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 ga(e,t,n,r){return n<=0?r>0?t/r:t:t*(e>0?e:0)/n}function _a(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:la(i)}}function va(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=ua(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(da(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)(Xi,{"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)(qi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Aa(e,n)},ya(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;u.push((0,O.jsx)(qi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:Aa(e,n)},ya(e)))}else{let t=i.get(r);u.push((0,O.jsx)(qi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:Aa(e,n)},ya(e)))}});let d=e=>{let t=l.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=_a(r,t.constraints,e);if(!a)return;let o=ua(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,fa(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,fa(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=ma(r,n.sizes,n.constraints,i,u);return d?pa(i,d,r)?{pushed:!1,stuck:!0}:(t.setLayout(d),{pushed:!0,stuck:pa(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)(Wi,{groupRef:s,orientation:r,onLayoutChanged:d,style:{width:`100%`,height:`100%`},children:u},t.children.length)})}function ya(e){return e.id}function ba(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(xa,{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 xa(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 Sa=`application/x-deck-panel`;function Ca(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(Sa))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(ra({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=ra({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer?.getData(Sa);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=oa(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(Sa)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer?.getData(Sa);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=oa(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(Sa,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,ba(t,n),r?(0,O.jsx)(Ta,{zone:r}):null]})}function wa(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 Ta(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:wa(e.zone)})}var Ea=(0,D.createContext)(0);function Da(){return(0,D.useContext)(Ea)}function Oa(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=sa(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 ka(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=>xn(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`){Oa(t,n,{groupId:e,activePanelId:r,draggedPanelId:i,draggedGroupId:c,zone:a,reorderIndex:o});return}if(aa(i,c,s,a))return;let l=ia(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:yn(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(Ea.Provider,{value:l,children:Aa(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 Aa(e,t){return e.kind===`split`?ja(e,t):Ma(e,t)}function ja(e,t){return(0,O.jsx)(va,{node:e,ctx:t},e.id)}function Ma(e,t){return(0,O.jsx)(Ca,{node:e,ctx:t},e.id)}function Na({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 Pa({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 Fa(){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 Ia=50;function La(e,t,n){if(e.width<=0||e.height<=0)return n;let r=Math.min(e.width/(t.width+Ia),e.height/(t.height+Ia));return Math.max(1,Math.min(100,Math.floor(r*100)))}function Ra({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=cr(),w=(0,D.useCallback)(e=>{if(e.visible){let t=f.current;d.current=t===`auto`?La(e.bounds,p.current,d.current):t}C?.set({viewId:lr.simulator,placement:e,layer:ur.base,extra:{zoom:d.current}})},[C]),T=(0,D.useCallback)(e=>{let t=m.current;if(t){e?(t.dispose(),m.current=ar(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:w})):(t.update({visible:!1,publish:w}),t.dispose(),m.current=null);return}e&&(m.current=ar(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)},[Da()]),(0,D.useEffect)(()=>()=>{m.current?.dispose(),m.current=null,C?.remove(lr.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)(Fa,{}),x&&c?.pageFallback&&(0,O.jsx)(Pa,{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)(Na,{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 za(){let e=(0,D.useRef)(null),t=cr(),n=(0,D.useCallback)(e=>{t?.set({viewId:lr.workbench,placement:e,layer:ur.base})},[t]),r=(0,D.useCallback)(t=>{let r=e.current;if(r){t?(r.dispose(),e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(r.update({visible:!1,publish:n}),r.dispose(),e.current=null);return}t&&(e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[n]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[Da()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null,t?.remove(lr.workbench)},[t]),(0,O.jsx)(`div`,{ref:r,className:`h-full w-full`,"data-area":`editor`})}function Ba(e,t){return!!(t===0||e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function Va({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 Ha({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 Ua({node:e,depth:t,inspectedSid:n,onInspect:r}){return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(Ja,{node:e,depth:t,inspectedSid:n,onInspect:r},i))})}function Wa({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ba(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)(Ja,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}function Ga({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)(Va,{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 Ka({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)(Va,{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)(Ja,{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 qa({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>Ba(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)(Ga,{node:e,indent:o,attrEntries:l,isInspected:s,onMouseEnter:u,inlineText:d}):(0,O.jsx)(Ka,{node:e,depth:t,indent:o,attrEntries:l,hasChildren:c,expanded:i,isInspected:s,inspectedSid:n,onInspect:r,onToggle:()=>a(!i),onMouseEnter:u})}function Ja({node:e,depth:t,inspectedSid:n,onInspect:r}){return e.tagName===`#text`?(0,O.jsx)(Ha,{node:e,depth:t}):e.tagName===`#fragment`?(0,O.jsx)(Ua,{node:e,depth:t,inspectedSid:n,onInspect:r}):e.tagName===`#shadow-root`?(0,O.jsx)(Wa,{node:e,depth:t,inspectedSid:n,onInspect:r}):(0,O.jsx)(qa,{node:e,depth:t,inspectedSid:n,onInspect:r})}function Ya({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 Xa({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)(Ja,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(Ya,{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 Za(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 Qa({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)(null);return Za({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(a),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}}),(0,O.jsx)(Xa,{tree:i,onInspectElement:t=>e.inspect(t),onClearInspection:async()=>{await e.clearInspection()},isRuntimeRunning:r})}var $a=`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 eo({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:`${$a} 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:`${$a} 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:`${$a} hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function to(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 no({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0}){let[i,a]=(0,D.useState)([]);Za({source:e,enabled:n,active:t,subscribe:e=>e.subscribe(e=>{a(t=>to(t,e))}),seed:(e,t)=>{e.getSnapshot().then(e=>{t()||a(e)})}});let o=e.clearAll?.bind(e);return(0,O.jsx)(eo,{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 B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ro={},io=(0,D.createContext)(ro),ao=(e,t)=>B({},e,t),oo=()=>(0,D.useContext)(io),so=(0,D.createContext)(()=>{});so.displayName=`JVR.DispatchShowTools`;function co(){return(0,D.useReducer)(ao,ro)}function lo(){return(0,D.useContext)(so)}var uo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(io.Provider,{value:t,children:(0,O.jsx)(so.Provider,{value:n,children:r})})};uo.displayName=`JVR.ShowTools`;var fo={},po=(0,D.createContext)(fo),mo=(e,t)=>B({},e,t),ho=()=>(0,D.useContext)(po),go=(0,D.createContext)(()=>{});go.displayName=`JVR.DispatchExpands`;function _o(){return(0,D.useReducer)(mo,fo)}function vo(){return(0,D.useContext)(go)}var yo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(po.Provider,{value:t,children:(0,O.jsx)(go.Provider,{value:n,children:r})})};yo.displayName=`JVR.Expands`;var bo={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},xo=(0,D.createContext)(bo),So=(e,t)=>B({},e,t),H=()=>(0,D.useContext)(xo),Co=(0,D.createContext)(()=>{});Co.displayName=`JVR.DispatchTypes`;function wo(){return(0,D.useReducer)(So,bo)}function To(){return(0,D.useContext)(Co)}function Eo(e){var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(xo.Provider,{value:t,children:(0,O.jsx)(Co.Provider,{value:n,children:r})})}Eo.displayName=`JVR.Types`;var Do=[`style`];function Oo(e){var{style:t}=e,n=V(e,Do);return(0,O.jsx)(`svg`,B({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:B({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,O.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}Oo.displayName=`JVR.TriangleArrow`;var ko={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,O.jsx)(Oo,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},Ao=(0,D.createContext)(ko),jo=(e,t)=>B({},e,t),U=()=>(0,D.useContext)(Ao),Mo=(0,D.createContext)(()=>{});Mo.displayName=`JVR.DispatchSymbols`;function No(){return(0,D.useReducer)(jo,ko)}function Po(){return(0,D.useContext)(Mo)}var Fo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ao.Provider,{value:t,children:(0,O.jsx)(Mo.Provider,{value:n,children:r})})};Fo.displayName=`JVR.Symbols`;var Io={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},Lo=(0,D.createContext)(Io),Ro=(e,t)=>B({},e,t),W=()=>(0,D.useContext)(Lo),zo=(0,D.createContext)(()=>{});zo.displayName=`JVR.DispatchSection`;function Bo(){return(0,D.useReducer)(Ro,Io)}function Vo(){return(0,D.useContext)(zo)}var Ho=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Lo.Provider,{value:t,children:(0,O.jsx)(zo.Provider,{value:n,children:r})})};Ho.displayName=`JVR.Section`;var Uo={objectSortKeys:!1,indentWidth:15},Wo=(0,D.createContext)(Uo);Wo.displayName=`JVR.Context`;var Go=(0,D.createContext)(()=>{});Go.displayName=`JVR.DispatchContext`;function Ko(e,t){return B({},e,t)}var qo=()=>(0,D.useContext)(Wo),Jo=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,D.useReducer)(Ko,Object.assign({},Uo,n)),[o,s]=co(),[c,l]=_o(),[u,d]=wo(),[f,p]=No(),[m,h]=Bo();return(0,D.useEffect)(()=>a(B({},n)),[n]),(0,O.jsx)(Wo.Provider,{value:i,children:(0,O.jsx)(Go.Provider,{value:a,children:(0,O.jsx)(uo,{initial:o,dispatch:s,children:(0,O.jsx)(yo,{initial:c,dispatch:l,children:(0,O.jsx)(Eo,{initial:B({},u,r),dispatch:d,children:(0,O.jsx)(Fo,{initial:f,dispatch:p,children:(0,O.jsx)(Ho,{initial:m,dispatch:h,children:t})})})})})})})};Jo.displayName=`JVR.Provider`;function Yo(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var Xo=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Zo=[`as`,`render`],Qo=[`as`,`render`],$o=[`as`,`render`],es=[`as`,`style`,`render`],ts=[`as`,`render`],ns=[`as`,`render`],rs=[`as`,`render`],is=[`as`,`render`],as=e=>{var{Quote:t={}}=U(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=V(e,Xo);if(n)return null;var{as:c,render:l}=t,u=V(t,Zo),d=c||`span`,f=B({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,O.jsx)(d,B({},f))};as.displayName=`JVR.Quote`;var os=e=>{var{ValueQuote:t={}}=U(),n=B({},(Yo(e),e)),{as:r,render:i}=t,a=V(t,Qo),o=r||`span`,s=B({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,O.jsx)(o,B({},s))};os.displayName=`JVR.ValueQuote`;var ss=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=U(),{as:o,render:s}=a,c=V(a,$o),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,O.jsx)(l,B({},c))};ss.displayName=`JVR.Colon`;var cs=e=>{var{Arrow:t={}}=U(),n=ho(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=V(t,es),m=u||`span`,h=f&&typeof f==`function`,g=B({},p,{"data-expanded":l,style:B({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,O.jsx)(m,B({},p,{style:B({},d,i)}))};cs.displayName=`JVR.Arrow`;var ls=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=U(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=V(o,ts),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,O.jsx)(f,B({},d))}var{as:p,render:m}=s,h=V(s,ns),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,O.jsx)(g,B({},h))};ls.displayName=`JVR.BracketsOpen`;var us=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=U();if(t){var{as:u,render:d}=c,f=V(c,rs),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,O.jsx)(p,B({},f))}var{as:m,render:h}=l,g=V(l,is),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,O.jsx)(_,B({},g))};us.displayName=`JVR.BracketsClose`;var ds=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=ho(),{collapsed:c,shouldExpandNodeInitially:l}=qo(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,O.jsx)(`div`,{style:m,children:(0,O.jsx)(us,B({isBrackets:g||_},h,{isVisiable:!0}))})};ds.displayName=`JVR.NestedClose`;var fs=[`as`,`render`],ps=[`as`,`render`],ms=[`as`,`render`],hs=[`as`,`render`],gs=[`as`,`render`],_s=[`as`,`render`],vs=[`as`,`render`],ys=[`as`,`render`],bs=[`as`,`render`],xs=[`as`,`render`],Ss=[`as`,`render`],Cs=[`as`,`render`],ws=[`as`,`render`],Ts=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},Es=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=H();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=V(r,fs);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Es.displayName=`JVR.SetComp`;var Ds=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=H();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=V(r,ps);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Ds.displayName=`JVR.MapComp`;var G={opacity:.75,paddingRight:4},Os=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=H(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=qo(),{as:c,render:l}=i,u=V(i,ms),d=t,[f,p]=(0,D.useState)(o&&d.length>o);(0,D.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=B({},G,i.style||{});o>0&&(u.style=B({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(B({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(B({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(v||(0,O.jsx)(m,B({},u,{style:h}))),b||(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(os,{}),(0,O.jsx)(m,B({},u,{className:y,children:g})),(0,O.jsx)(os,{})]})]})};Os.displayName=`JVR.TypeString`;var ks=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,hs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ks.displayName=`JVR.TypeTrue`;var As=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,gs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};As.displayName=`JVR.TypeFalse`;var js=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,_s),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};js.displayName=`JVR.TypeFloat`;var Ms=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,vs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Ms.displayName=`JVR.TypeInt`;var Ns=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,ys),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:Ts(t?.toString())}))]})};Ns.displayName=`JVR.TypeFloat`;var Ps=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,bs),l=o||`span`,u=B({},G,i.style),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsxs)(`a`,B({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,O.jsx)(os,{}),t?.href,(0,O.jsx)(os,{})]}))]})};Ps.displayName=`JVR.TypeUrl`;var Fs=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,xs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(B({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),m||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:p}))]})};Fs.displayName=`JVR.TypeDate`;var Is=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ss),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Is.displayName=`JVR.TypeUndefined`;var Ls=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Cs),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Ls.displayName=`JVR.TypeNull`;var Rs=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,ws),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};Rs.displayName=`JVR.TypeNan`;var zs=e=>Number(e)===e&&e%1!=0||isNaN(e),Bs=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,O.jsx)(Ps,B({},i,{children:t})):typeof t==`string`?(0,O.jsx)(Os,B({},i,{children:t})):t===!0?(0,O.jsx)(ks,B({},i,{children:t})):t===!1?(0,O.jsx)(As,B({},i,{children:t})):t===null?(0,O.jsx)(Ls,B({},i,{children:t})):t===void 0?(0,O.jsx)(Is,B({},i,{children:t})):t instanceof Date?(0,O.jsx)(Fs,B({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,O.jsx)(Rs,B({},i,{children:t})):typeof t==`number`&&zs(t)?(0,O.jsx)(js,B({},i,{children:t})):typeof t==`bigint`?(0,O.jsx)(Ns,B({},i,{children:t})):typeof t==`number`?(0,O.jsx)(Ms,B({},i,{children:t})):null};Bs.displayName=`JVR.Value`;function K(e,t,n){var r=Po(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function q(e,t,n){var r=To(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function Vs(e,t,n){var r=Vo(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}var Hs=[`as`,`render`],Us=e=>{var{KeyName:t={}}=W();return Vs(t,e,`KeyName`),null};Us.displayName=`JVR.KeyName`;var Ws=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=W(),{as:c,render:l}=s,u=V(s,Hs);u.style=B({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(B({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,O.jsx)(d,B({},u,{children:t}))};Ws.displayName=`JVR.KeyNameComp`;var Gs=[`children`,`value`,`parentValue`,`keyName`,`keys`],Ks=[`as`,`render`,`children`],qs=e=>{var{Row:t={}}=W();return Vs(t,e,`Row`),null};qs.displayName=`JVR.Row`;var Js=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=V(e,Gs),{Row:s={}}=W(),{as:c,render:l}=s,u=V(s,Ks),d=c||`div`;return l&&typeof l==`function`&&l(B({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,O.jsx)(d,B({},o,u,{children:t}))};Js.displayName=`JVR.RowComp`;function Ys(e){var t=(0,D.useRef)();return(0,D.useEffect)(()=>{t.current=e}),t.current}function Xs(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Ys(t),a=(0,D.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,D.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Zs=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Qs=[`as`,`render`],$s=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=V(e,Zs),{onCopied:c,enableClipboard:l,beforeCopy:u}=qo(),d=oo()[i],[f,p]=(0,D.useState)(!1),{Copied:m={}}=W(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?Ts(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?Ts(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=V(m,Qs),y=B({},v,s,g,{style:B({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(B({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};$s.displayName=`JVR.Copied`;function ec(){var e=(0,D.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var tc=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=ho(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=qo(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,O.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,O.jsx)(rc,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};tc.displayName=`JVR.KeyValues`;var nc=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=qo(),o=typeof t==`number`,s=(0,D.useRef)(null);Xs({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`span`,{ref:s,children:[(0,O.jsx)(as,B({isNumber:o,"data-placement":`left`},c)),(0,O.jsx)(Ws,B({},c,{children:t})),(0,O.jsx)(as,B({isNumber:o,"data-placement":`right`},c))]}),(0,O.jsx)(ss,B({},c))]})};nc.displayName=`JVR.KayName`;var rc=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=lo(),s=ec(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,O.jsx)(_c,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,O.jsxs)(Js,B({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,O.jsx)(nc,{keyName:t,value:n,keys:a,parentValue:r}),(0,O.jsx)(Bs,{keyName:t,value:n,keys:a}),(0,O.jsx)($s,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};rc.displayName=`JVR.KeyValuesItem`;var ic=[`value`,`keyName`],ac=[`as`,`render`],oc=e=>{var{CountInfoExtra:t={}}=W();return Vs(t,e,`CountInfoExtra`),null};oc.displayName=`JVR.CountInfoExtra`;var sc=e=>{var{value:t={},keyName:n}=e,r=V(e,ic),{CountInfoExtra:i={}}=W(),{as:a,render:o}=i,s=V(i,ac);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=B({},s,r);return l&&o(u,{value:t,keyName:n})||(0,O.jsx)(c,B({},u))};sc.displayName=`JVR.CountInfoExtraComps`;var cc=[`value`,`keyName`],lc=[`as`,`render`],uc=e=>{var{CountInfo:t={}}=W();return Vs(t,e,`CountInfo`),null};uc.displayName=`JVR.CountInfo`;var dc=e=>{var{value:t={},keyName:n}=e,r=V(e,cc),{displayObjectSize:i}=qo(),{CountInfo:a={}}=W();if(!i)return null;var{as:o,render:s}=a,c=V(a,lc),l=o||`span`;c.style=B({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=B({},c,r);return s&&typeof s==`function`&&s(B({},d,{"data-length":u}),{value:t,keyName:n})||(0,O.jsx)(l,B({},d))};dc.displayName=`JVR.CountInfoComp`;var fc=[`as`,`render`],pc=e=>{var{Ellipsis:t={}}=W();return Vs(t,e,`Ellipsis`),null};pc.displayName=`JVR.Ellipsis`;var mc=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=W(),{as:a,render:o}=i,s=V(i,fc),c=a||`span`;return o&&typeof o==`function`&&o(B({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,O.jsx)(c,B({},s)))};mc.displayName=`JVR.EllipsisComp`;var hc=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=ho(),l=vo(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=qo(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),w={style:_};C&&(w.onClick=g);var T={keyName:t,value:a,keys:r,parentValue:o};return(0,O.jsxs)(`span`,B({},w,{children:[C&&(0,O.jsx)(cs,B({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,O.jsx)(nc,B({},T)),(0,O.jsx)(Es,{value:i,keyName:t}),(0,O.jsx)(Ds,{value:i,keyName:t}),(0,O.jsx)(ls,B({isBrackets:x||S},T)),(0,O.jsx)(mc,{keyName:t,value:a,isExpanded:m}),(0,O.jsx)(us,B({isVisiable:m||!C,isBrackets:x||S},T)),(0,O.jsx)(dc,{value:a,keyName:t}),(0,O.jsx)(sc,{value:a,keyName:t}),(0,O.jsx)($s,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};hc.displayName=`JVR.NestedOpen`;var gc=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],_c=(0,D.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=V(e,gc),u=lo(),d=ec();return(0,O.jsxs)(`div`,B({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,O.jsx)(hc,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,O.jsx)(tc,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,O.jsx)(ds,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});_c.displayName=`JVR.Container`;var vc=e=>{var{BraceLeft:t={}}=U();return K(t,e,`BraceLeft`),null};vc.displayName=`JVR.BraceLeft`;var yc=e=>{var{BraceRight:t={}}=U();return K(t,e,`BraceRight`),null};yc.displayName=`JVR.BraceRight`;var bc=e=>{var{BracketsLeft:t={}}=U();return K(t,e,`BracketsLeft`),null};bc.displayName=`JVR.BracketsLeft`;var xc=e=>{var{BracketsRight:t={}}=U();return K(t,e,`BracketsRight`),null};xc.displayName=`JVR.BracketsRight`;var Sc=e=>{var{Arrow:t={}}=U();return K(t,e,`Arrow`),null};Sc.displayName=`JVR.Arrow`;var Cc=e=>{var{Colon:t={}}=U();return K(t,e,`Colon`),null};Cc.displayName=`JVR.Colon`;var wc=e=>{var{Quote:t={}}=U();return K(t,e,`Quote`),null};wc.displayName=`JVR.Quote`;var Tc=e=>{var{ValueQuote:t={}}=U();return K(t,e,`ValueQuote`),null};Tc.displayName=`JVR.ValueQuote`;var Ec=e=>{var{Bigint:t={}}=H();return q(t,e,`Bigint`),null};Ec.displayName=`JVR.Bigint`;var Dc=e=>{var{Date:t={}}=H();return q(t,e,`Date`),null};Dc.displayName=`JVR.Date`;var Oc=e=>{var{False:t={}}=H();return q(t,e,`False`),null};Oc.displayName=`JVR.False`;var kc=e=>{var{Float:t={}}=H();return q(t,e,`Float`),null};kc.displayName=`JVR.Float`;var Ac=e=>{var{Int:t={}}=H();return q(t,e,`Int`),null};Ac.displayName=`JVR.Int`;var jc=e=>{var{Map:t={}}=H();return q(t,e,`Map`),null};jc.displayName=`JVR.Map`;var Mc=e=>{var{Nan:t={}}=H();return q(t,e,`Nan`),null};Mc.displayName=`JVR.Nan`;var Nc=e=>{var{Null:t={}}=H();return q(t,e,`Null`),null};Nc.displayName=`JVR.Null`;var Pc=e=>{var{Set:t={}}=H();return q(t,e,`Set`),null};Pc.displayName=`JVR.Set`;var Fc=e=>{var{Str:t={}}=H();return q(t,e,`Str`),null};Fc.displayName=`JVR.StringText`;var Ic=e=>{var{True:t={}}=H();return q(t,e,`True`),null};Ic.displayName=`JVR.True`;var Lc=e=>{var{Undefined:t={}}=H();return q(t,e,`Undefined`),null};Lc.displayName=`JVR.Undefined`;var Rc=e=>{var{Url:t={}}=H();return q(t,e,`Url`),null};Rc.displayName=`JVR.Url`;var zc=e=>{var{Copied:t={}}=W();return Vs(t,e,`Copied`),null};zc.displayName=`JVR.Copied`;var Bc=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],J=(0,D.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=V(e,Bc),b=B({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,O.jsxs)(Jo,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,O.jsx)(_c,B({value:i},y,{ref:t,className:x,style:b})),a]})});J.Bigint=Ec,J.Date=Dc,J.False=Oc,J.Float=kc,J.Int=Ac,J.Map=jc,J.Nan=Mc,J.Null=Nc,J.Set=Pc,J.String=Fc,J.True=Ic,J.Undefined=Lc,J.Url=Rc,J.ValueQuote=Tc,J.Arrow=Sc,J.Colon=Cc,J.Quote=wc,J.Ellipsis=pc,J.BraceLeft=vc,J.BraceRight=yc,J.BracketsLeft=bc,J.BracketsRight=xc,J.Copied=zc,J.CountInfo=uc,J.CountInfoExtra=oc,J.KeyName=Us,J.Row=qs,J.displayName=`JVR.JsonView`;var Vc=J;function Hc(e){return`default`in e}var Uc=Hc(Vc)?Vc.default:Vc;function Wc(e){return e.pagePath??e.id}var Gc={"--w-rjv-font-family":`var(--font-family-mono)`,"--w-rjv-background-color":`transparent`,"--w-rjv-color":`var(--color-code-blue)`,"--w-rjv-key-string":`var(--color-code-blue)`,"--w-rjv-line-color":`var(--color-border-subtle)`,"--w-rjv-arrow-color":`var(--color-text-secondary)`,"--w-rjv-info-color":`var(--color-code-label)`,"--w-rjv-curlybraces-color":`var(--color-text-secondary)`,"--w-rjv-brackets-color":`var(--color-text-secondary)`,"--w-rjv-quotes-color":`var(--color-code-orange)`,"--w-rjv-quotes-string-color":`var(--color-code-orange)`,"--w-rjv-type-string-color":`var(--color-code-orange)`,"--w-rjv-type-int-color":`var(--color-code-number)`,"--w-rjv-type-float-color":`var(--color-code-number)`,"--w-rjv-type-bigint-color":`var(--color-code-number)`,"--w-rjv-type-boolean-color":`var(--color-code-keyword)`,"--w-rjv-type-null-color":`var(--color-code-keyword)`,"--w-rjv-type-nan-color":`var(--color-code-keyword)`,"--w-rjv-type-undefined-color":`var(--color-code-keyword)`,"--w-rjv-type-date-color":`var(--color-code-label)`,"--w-rjv-type-url-color":`var(--color-code-blue)`,fontSize:12,padding:`6px 8px`,wordBreak:`break-all`,whiteSpace:`pre-wrap`};function Kc({state:e,onSelectBridge:t,isRuntimeRunning:n=!0}){let{bridges:r,activeBridgeId:i,entries:a}=e;return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`appdata-panel`,children:[r.length>1&&(0,O.jsx)(`div`,{className:`flex gap-1 px-2 py-1 border-b border-border-subtle shrink-0 overflow-x-auto bg-bg-panel`,children:r.map(e=>{let n=e.id===i;return(0,O.jsx)(`button`,{onClick:()=>t(e.id),title:e.id,className:`shrink-0 px-2 py-0.5 text-[11px] rounded border transition-colors `+(n?`border-accent text-accent bg-surface-3`:`border-border-subtle text-text-dim hover:border-accent hover:text-accent`),children:Wc(e)},e.id)})}),r.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:n?`暂无页面数据(仅显示 Page 级 data)`:`小程序未运行`}):(0,O.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:r.map(e=>{let t=e.id===i,r=a[e.id]??{},o=Object.keys(r);return(0,O.jsx)(`div`,{"data-bridge-id":e.id,className:`absolute inset-0 flex flex-col gap-2 p-2 overflow-y-auto`,style:{display:t?`flex`:`none`},children:o.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:n?`暂无页面数据(仅显示 Page 级 data)`:`小程序未运行`}):o.map(t=>(0,O.jsxs)(`div`,{className:`border border-border-subtle rounded overflow-hidden shrink-0`,children:[(0,O.jsx)(`div`,{className:`bg-surface-3 px-2 py-0.5 text-[11px] text-code-label truncate`,children:t}),(0,O.jsx)(Uc,{value:r[t]??{},collapsed:1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,indentWidth:12,style:Gc})]},`${e.id}::${t}`))},e.id)})})]})}function qc(e){return(e??``).replace(/^\/+/,``)}function Jc(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=>qc(e.pagePath)===qc(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}var Yc={bridges:[],entries:{}};function Xc({source:e,active:t=!0,enabled:n=!0,isRuntimeRunning:r=!0,activePagePath:i=``}){let[a,o]=(0,D.useState)(Yc);Za({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}=Jc(a.bridges,i);return(0,O.jsx)(Kc,{state:{bridges:a.bridges,activeBridgeId:s,entries:a.entries},onSelectBridge:c,isRuntimeRunning:r})}function Zc(...e){return e.filter(Boolean).join(` `)}function Qc(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function $c(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function el(e){return e.kind===`event`?e.event.message:e.log.text}function tl({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=>el(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:Zc(`truncate font-medium shrink-0`,$c(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
2
|
text-text placeholder:text-text-dim
|
|
3
3
|
focus:outline-none focus:border-text-muted
|
|
4
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:Qc(e.at)}),(0,O.jsx)(`span`,{className:Zc(`break-all`,$c(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:Qc(e.at)}),(0,O.jsx)(`span`,{className:Zc(`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 nl(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)(Qa,{source:n,enabled:r,active:l,isRuntimeRunning:p});case`appdata`:return(0,O.jsx)(Xc,{source:o,enabled:s,active:l,isRuntimeRunning:p,activePagePath:c});case`storage`:return(0,O.jsx)(no,{source:i,enabled:a,active:l,isRuntimeRunning:p});case`compile`:return(0,O.jsx)(tl,{events:u,logs:d,onClear:f??(()=>{})})}}function rl(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 il=0,al=new Set([`simulator`,`editor`,`wxml`,`appdata`,`storage`,`console`,`compile`]);function ol({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)(()=>An(d.dockTree??null,a.simPanelWidth,al)),p=(0,D.useMemo)(()=>Sn(),[]),[m]=(0,D.useState)(()=>++il),h=(0,D.useMemo)(()=>rl({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=or({present:g>0,publish:e=>{let t=g>0&&e.width>0&&e.height>0;h.set({viewId:lr.hostToolbar,placement:t?{visible:!0,bounds:e}:{visible:!1},layer:ur.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)(sr.Provider,{value:h,children:(0,O.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,O.jsx)(`div`,{ref:v,style:{height:g},className:`shrink-0 w-full`,"data-area":`host-toolbar`}),(0,O.jsx)($n,{compileDropdownRef:l.compileDropdownRef,showCompilePanel:l.showCompilePanel,onToggleCompilePanel:l.toggleCompilePanel,onRelaunch:()=>i.relaunch(),compileStatus:i.compileStatus,dockModel:f,dockRegistry:p,layout:u,simPanelWidth:a.simPanelWidth}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,O.jsx)(dl,{dockModel:f,dockRegistry:p,simPanelWidth:a.simPanelWidth,renderDomPanel:(e,t)=>e===`simulator`?(0,O.jsx)(Ra,{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)(za,{}):e===`wxml`||e===`appdata`||e===`storage`||e===`compile`?(0,O.jsx)(ul,{tabId:e,active:t.active,panelProps:b}):null,onPersistTree:u.setDockTree,persistedTree:d.dockTree??null})})]})})}function sl(e){return e.kind===`tabs`?e.panels.includes(`simulator`):e.children.some(sl)}function cl(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 ll(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&&sl(n))return{splitId:e.id,childIndex:t};let r=ll(n);if(r)return r}return null}function ul({tabId:e,active:t,panelProps:n}){return(0,O.jsx)(nl,{tabId:e,...n,tabActive:t})}function dl(e){let{dockModel:t,dockRegistry:n,simPanelWidth:r,renderDomPanel:i,onPersistTree:a,persistedTree:o}=e,s=(0,D.useRef)(null),c=cr(),l=(0,D.useCallback)(e=>{c?.set({viewId:lr.simulatorDevtools,placement:e,layer:ur.base})},[c]),u=(0,D.useCallback)((e,t,n)=>{if(e.current){t?(e.current.dispose(),e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(e.current.update({visible:!1,publish:n}),e.current.dispose(),e.current=null);return}t&&(e.current=ar(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[]),d=(0,D.useCallback)((e,t)=>{e===`console`&&u(s,t,l)},[u,l]);return(0,D.useEffect)(()=>{let e=t.get().root,n=ll(e);n&&cl(e,n)!==r&&t.apply(e=>{let t=ll(e.root);return!t||cl(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(lr.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)(ka,{model:t,registry:n,renderDomPanel:i,bindNativeSlot:d,onActiveTabClick:(0,D.useCallback)(e=>{e===`simulator`||e===`editor`||t.apply(t=>xn(t,e,n))},[t,n])})}typeof window<`u`&&window.document&&window.document.createElement;function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function pl(...e){return t=>{let n=!1,r=e.map(e=>{let r=fl(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():fl(e[t],null)}}}}function ml(...e){return D.useCallback(pl(...e),e)}function hl(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 gl(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,_l(i,...t)]}function _l(...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 vl=globalThis?.document?D.useLayoutEffect:()=>{},yl=D.useId||(()=>void 0),bl=0;function xl(e){let[t,n]=D.useState(yl());return vl(()=>{e||n(e=>e??String(bl++))},[e]),e||(t?`radix-${t}`:``)}var Sl=D.useInsertionEffect||vl;function Cl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=wl({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=Tl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function wl({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return Sl(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Tl(e){return typeof e==`function`}var El=n(e(),1);function Dl(e){let t=Ol(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(Al);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 Ol(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=Ml(n),i=jl(r,n.props);return n.type!==D.Fragment&&(i.ref=t?pl(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 kl=Symbol(`radix.slottable`);function Al(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kl}function jl(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 Ml(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=Dl(`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 Nl(e,t){e&&El.flushSync(()=>e.dispatchEvent(t))}function Pl(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}function Fl(e,t=globalThis?.document){let n=Pl(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 Il=`DismissableLayer`,Ll=`dismissableLayer.update`,Rl=`dismissableLayer.pointerDownOutside`,zl=`dismissableLayer.focusOutside`,Bl,Vl=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hl=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(Vl),[u,d]=D.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=D.useState({}),m=ml(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=Gl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Kl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Fl(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&&(Bl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ql(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Bl)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ql())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(Ll,e),()=>document.removeEventListener(Ll,e)},[]),(0,O.jsx)(X.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,x.onPointerDownCapture)})});Hl.displayName=Il;var Ul=`DismissableLayerBranch`,Wl=D.forwardRef((e,t)=>{let n=D.useContext(Vl),r=D.useRef(null),i=ml(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})});Wl.displayName=Ul;function Gl(e,t=globalThis?.document){let n=Pl(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Jl(Rl,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 Kl(e,t=globalThis?.document){let n=Pl(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&Jl(zl,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 ql(){let e=new CustomEvent(Ll);document.dispatchEvent(e)}function Jl(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?Nl(i,a):i.dispatchEvent(a)}var Yl=`focusScope.autoFocusOnMount`,Xl=`focusScope.autoFocusOnUnmount`,Zl={bubbles:!1,cancelable:!0},Ql=`FocusScope`,$l=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=Pl(i),u=Pl(a),d=D.useRef(null),f=ml(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){ou.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Yl,Zl);s.addEventListener(Yl,l),s.dispatchEvent(t),t.defaultPrevented||(eu(lu(nu(s)),{select:!0}),document.activeElement===e&&Z(s))}return()=>{s.removeEventListener(Yl,l),setTimeout(()=>{let t=new CustomEvent(Xl,Zl);s.addEventListener(Xl,u),s.dispatchEvent(t),t.defaultPrevented||Z(e??document.body,{select:!0}),s.removeEventListener(Xl,u),ou.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]=tu(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})});$l.displayName=Ql;function eu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Z(r,{select:t}),document.activeElement!==n)return}function tu(e){let t=nu(e);return[ru(t,e),ru(t.reverse(),e)]}function nu(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 ru(e,t){for(let n of e)if(!iu(n,{upTo:t}))return n}function iu(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 au(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&&au(e)&&t&&e.select()}}var ou=su();function su(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=cu(e,t),e.unshift(t)},remove(t){e=cu(e,t),e[0]?.resume()}}}function cu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lu(e){return e.filter(e=>e.tagName!==`A`)}var uu=`Portal`,du=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);vl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?El.createPortal((0,O.jsx)(X.div,{...r,ref:t}),o):null});du.displayName=uu;function fu(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var pu=e=>{let{present:t,children:n}=e,r=mu(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=ml(r.ref,gu(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};pu.displayName=`Presence`;function mu(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=fu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=hu(r.current);a.current=o===`mounted`?e:`none`},[o]),vl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=hu(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),vl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=hu(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=hu(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 hu(e){return e?.animationName||`none`}function gu(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 _u=0;function vu(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??yu()),document.body.insertAdjacentElement(`beforeend`,e[1]??yu()),_u++,()=>{_u===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),_u--}},[])}function yu(){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 bu(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 xu(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 Su=`right-scroll-bar-position`,Cu=`width-before-scroll-bar`,wu=`with-scroll-bars-hidden`,Tu=`--removed-body-scroll-bar-size`;function Eu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Du(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 Ou=typeof window<`u`?D.useLayoutEffect:D.useEffect,ku=new WeakMap;function Au(e,t){var n=Du(t||null,function(t){return e.forEach(function(e){return Eu(e,t)})});return Ou(function(){var t=ku.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Eu(e,null)}),i.forEach(function(e){r.has(e)||Eu(e,a)})}ku.set(n,e)},[e]),n}function ju(e){return e}function Mu(e,t){t===void 0&&(t=ju);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 Nu(e){e===void 0&&(e={});var t=Mu(null);return t.options=Q({async:!0,ssr:!1},e),t}var Pu=function(e){var t=e.sideCar,n=bu(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))};Pu.isSideCarExport=!0;function Fu(e,t){return e.useMedium(t),Pu}var Iu=Nu(),Lu=function(){},Ru=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:Lu,onWheelCapture:Lu,onTouchMoveCapture:Lu}),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=bu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Au([n,t]),C=Q(Q({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:Iu,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))});Ru.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ru.classNames={fullWidth:Cu,zeroRight:Su};var zu,Bu=function(){if(zu)return zu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Vu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Bu();return t&&e.setAttribute(`nonce`,t),e}function Hu(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Uu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Wu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vu())&&(Hu(t,n),Uu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Gu=function(){var e=Wu();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ku=function(){var e=Gu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},qu={left:0,top:0,right:0,gap:0},Ju=function(e){return parseInt(e||``,10)||0},Yu=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[Ju(n),Ju(r),Ju(i)]},Xu=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return qu;var t=Yu(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])}},Zu=Ku(),Qu=`data-scroll-locked`,$u=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
@@ -46,4 +46,4 @@ 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
|
|
|
46
46
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
47
47
|
|
|
48
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},hf=`DialogDescriptionWarning`,gf=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pf(hf).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},_f=Vd,vf=qd,yf=Yd,bf=$d,xf=af,Sf=sf,Cf=lf,wf=_f,Tf=vf,Ef=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(yf,{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}));Ef.displayName=yf.displayName;var Df=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Tf,{children:[(0,O.jsx)(Ef,{}),(0,O.jsxs)(bf,{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)(Cf,{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`})]})]})]}));Df.displayName=bf.displayName;var Of=({className:e,...t})=>(0,O.jsx)(`div`,{className:v(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Of.displayName=`DialogHeader`;var kf=({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});kf.displayName=`DialogFooter`;var Af=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(xf,{ref:n,className:v(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Af.displayName=xf.displayName;var jf=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Sf,{ref:n,className:v(`text-sm text-text-muted`,e),...t}));jf.displayName=Sf.displayName;function Mf(){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)(``);(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 f=(0,D.useCallback)(async()=>{o(`downloading`),c(0);try{let e=await d(r.Download);e.success?o(`ready`):(u(e.error||`Download failed`),o(`error`))}catch(e){u(e instanceof Error?e.message:String(e)),o(`error`)}},[]),m=(0,D.useCallback)(()=>{d(r.Install).catch(e=>{console.warn(`[update] install failed:`,e)})},[]),h=(0,D.useCallback)(()=>{n?.mandatory&&a!==`ready`||t(!1)},[n,a]);return n?(0,O.jsx)(wf,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&a!==`ready`||t(e)},children:(0,O.jsxs)(Df,{className:`max-w-md`,children:[(0,O.jsxs)(Of,{children:[(0,O.jsx)(Af,{children:a===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(jf,{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`&&`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)(kf,{children:[a===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(C,{variant:`outline`,onClick:h,children:`Later`}),(0,O.jsx)(C,{onClick:f,children:`Download`})]}),a===`ready`&&(0,O.jsx)(C,{onClick:m,children:`Install & Restart`}),a===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:h,children:`Close`}),(0,O.jsx)(C,{onClick:f,children:`Retry`})]})]})]})}):null}var Nf=`Dimina DevTools`;function Pf(){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)(Nf),[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)(Mf,{}),(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)(Mf,{}),(0,O.jsx)(ol,{project:n},n?.path)]})}De.createRoot(document.getElementById(`root`)).render((0,O.jsx)(Pf,{}));
|
|
49
|
-
//# sourceMappingURL=index-
|
|
49
|
+
//# sourceMappingURL=index-CZd3LyY8.js.map
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
}
|
|
28
28
|
</style>
|
|
29
|
-
<script type="module" crossorigin src="../../assets/index-
|
|
29
|
+
<script type="module" crossorigin src="../../assets/index-CZd3LyY8.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-DTEmLpxx.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="../../assets/input-7P0WbXyg.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="../../assets/select-Bzbhbg9Z.js">
|
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.20260716214527",
|
|
4
4
|
"description": "Dimina DevTools - modular developer tools for mini app debugging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dimina",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"chrome-remote-interface": "^0.34.0",
|
|
86
86
|
"ws": "^8.20.0",
|
|
87
87
|
"zod": "^4.3.6",
|
|
88
|
-
"@dimina-kit/devkit": "0.1.2-dev.
|
|
89
|
-
"@dimina-kit/view-anchor": "0.1.0-dev.
|
|
90
|
-
"@dimina-kit/inspect": "0.4.0-dev.
|
|
91
|
-
"@dimina-kit/electron-deck": "0.1.0-dev.
|
|
88
|
+
"@dimina-kit/devkit": "0.1.2-dev.20260716214527",
|
|
89
|
+
"@dimina-kit/view-anchor": "0.1.0-dev.20260716214527",
|
|
90
|
+
"@dimina-kit/inspect": "0.4.0-dev.20260716214527",
|
|
91
|
+
"@dimina-kit/electron-deck": "0.1.0-dev.20260716214527"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@playwright/test": "^1.59.1",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"vite": "^8.0.8",
|
|
134
134
|
"vitest": "^4.1.4",
|
|
135
135
|
"@dimina-kit/eslint-config": "0.1.0",
|
|
136
|
-
"@dimina-kit/
|
|
137
|
-
"@dimina-kit/
|
|
136
|
+
"@dimina-kit/typescript-config": "0.1.0",
|
|
137
|
+
"@dimina-kit/workbench": "0.1.0"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
140
|
"electron": ">=36"
|