@visulima/dev-toolbar 1.0.0-alpha.4 → 1.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +321 -0
- package/LICENSE.md +137 -5
- package/README.md +75 -18
- package/bin/mcp.js +29 -0
- package/dist/apps/a11y/index.d.ts +3 -2
- package/dist/apps/a11y/index.js +21 -2
- package/dist/apps/annotations/index.d.ts +4 -0
- package/dist/apps/annotations/index.js +18 -0
- package/dist/apps/assets/index.d.ts +4 -0
- package/dist/apps/assets/index.js +16 -0
- package/dist/apps/inspector/index.d.ts +3 -2
- package/dist/apps/inspector/index.js +30 -1
- package/dist/apps/module-graph/index.d.ts +3 -2
- package/dist/apps/module-graph/index.js +20 -1
- package/dist/apps/performance/index.d.ts +3 -2
- package/dist/apps/performance/index.js +17 -1
- package/dist/apps/seo/index.d.ts +3 -2
- package/dist/apps/seo/index.js +17 -1
- package/dist/apps/settings/index.d.ts +3 -2
- package/dist/apps/settings/index.js +17 -1
- package/dist/apps/tailwind/index.d.ts +3 -2
- package/dist/apps/tailwind/index.js +5 -5
- package/dist/apps/timeline/index.d.ts +3 -2
- package/dist/apps/timeline/index.js +18 -1
- package/dist/apps/vite-config/index.d.ts +3 -2
- package/dist/apps/vite-config/index.js +16 -1
- package/dist/client/overlay.d.ts +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +133 -8
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +1 -0
- package/dist/packem_chunks/inject-source.js +7 -1
- package/dist/packem_shared/Alert-CZq7C43v.js +1 -0
- package/dist/packem_shared/Badge-PpblpNWg.js +1 -0
- package/dist/packem_shared/Button-CAKvtfij.js +1 -0
- package/dist/packem_shared/Card-BSy2oRiS.js +1 -0
- package/dist/packem_shared/Icon-0XYV-4AL.js +1 -0
- package/dist/packem_shared/Input-Dc1WiT01.js +1 -0
- package/dist/packem_shared/Label-BZh8XxUb.js +1 -0
- package/dist/packem_shared/Popover-DuiU8EPg.js +1 -0
- package/dist/packem_shared/Progress-C90LC--2.js +1 -0
- package/dist/packem_shared/Select-CwD-d0pi.js +1 -0
- package/dist/packem_shared/Separator-PSjfhX_W.js +1 -0
- package/dist/packem_shared/Skeleton-BAFrGUR1.js +1 -0
- package/dist/packem_shared/Switch-Wpsp5M3p.js +1 -0
- package/dist/packem_shared/Tabs-BdNFQd3c.js +1 -0
- package/dist/packem_shared/Textarea-DP9gpte-.js +1 -0
- package/dist/packem_shared/Tooltip-DVeuszoY.js +1 -0
- package/dist/packem_shared/annotation-settings-DlLZO5Zp.js +1 -0
- package/dist/packem_shared/annotation-store-CXMIg0dM.js +1 -0
- package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
- package/dist/packem_shared/clsx-CtZWcPHt.js +1 -0
- package/dist/packem_shared/createClientRPCContext-80V9c3Qu.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-CzejbqD2.js +1 -0
- package/dist/packem_shared/createServerRPCContext-C30tqEfQ.js +1 -0
- package/dist/packem_shared/getGlobalHook-GRSqUNJ3.js +1 -0
- package/dist/packem_shared/getTimelineStore-BT5sImVb.js +1 -0
- package/dist/packem_shared/global-api.d-DeaCvII9.d.ts +546 -0
- package/dist/packem_shared/loadSettings-C0pUyx9j.js +1 -0
- package/dist/packem_shared/server.d-ZkcY0pge.d.ts +39 -0
- package/dist/packem_shared/sharedToolbarStylesheet-DNABzHAf.js +2 -0
- package/dist/packem_shared/store-Dqy0FbGw.js +1 -0
- package/dist/packem_shared/use-theme-DIqZkPAe.js +1 -0
- package/dist/toolbar/index.d.ts +152 -49
- package/dist/toolbar/index.js +3 -3
- package/dist/ui/index.d.ts +382 -17
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +183 -141
- package/dist/vite-plugin.js +5 -2
- package/package.json +41 -22
- package/dist/apps/a11y/a11y-app.d.ts +0 -5
- package/dist/apps/a11y/a11y-store.d.ts +0 -42
- package/dist/apps/a11y/a11y-tooltip.d.ts +0 -11
- package/dist/apps/inspector/inspector-app.d.ts +0 -12
- package/dist/apps/module-graph/module-graph-app.d.ts +0 -5
- package/dist/apps/more/index.d.ts +0 -3
- package/dist/apps/more/index.js +0 -2
- package/dist/apps/more/more-app.d.ts +0 -5
- package/dist/apps/performance/performance-app.d.ts +0 -5
- package/dist/apps/performance/performance-tooltip.d.ts +0 -5
- package/dist/apps/seo/seo-app.d.ts +0 -5
- package/dist/apps/settings/settings-app.d.ts +0 -4
- package/dist/apps/tailwind/tailwind-app.d.ts +0 -5
- package/dist/apps/timeline/timeline-app.d.ts +0 -5
- package/dist/apps/vite-config/vite-config-app.d.ts +0 -5
- package/dist/hooks/create-hook.d.ts +0 -12
- package/dist/hooks/events.d.ts +0 -7
- package/dist/hooks/global-hook.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -6
- package/dist/packem_shared/Alert-H-x1JuZ0.js +0 -1
- package/dist/packem_shared/Badge-C30mDKKG.js +0 -1
- package/dist/packem_shared/Button-DODNCTPZ.js +0 -1
- package/dist/packem_shared/Card-DdI7Wn3t.js +0 -1
- package/dist/packem_shared/Icon-DWFLZkwW.js +0 -1
- package/dist/packem_shared/Input-GfbOwAkK.js +0 -1
- package/dist/packem_shared/Label-Bzi47aUf.js +0 -1
- package/dist/packem_shared/Popover-CLt7YhUF.js +0 -1
- package/dist/packem_shared/Progress-vGfFpxRn.js +0 -1
- package/dist/packem_shared/Separator-DQGeJPQg.js +0 -1
- package/dist/packem_shared/Skeleton-BYXau6jM.js +0 -1
- package/dist/packem_shared/Switch-BeC78S_T.js +0 -1
- package/dist/packem_shared/Tabs-CXERaeAp.js +0 -1
- package/dist/packem_shared/Textarea-DvbSX13V.js +0 -1
- package/dist/packem_shared/Tooltip-tlBN-NdK.js +0 -1
- package/dist/packem_shared/cn-DWLJYh3h.js +0 -1
- package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +0 -1
- package/dist/packem_shared/createServerRPCContext-CEm1Ymkn.js +0 -1
- package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +0 -1
- package/dist/packem_shared/loadSettings-hvjR4fcS.js +0 -1
- package/dist/packem_shared/setupGlobalHook-CCf9Logv.js +0 -1
- package/dist/packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js +0 -2
- package/dist/packem_shared/store-DaUtLjf3.js +0 -1
- package/dist/packem_shared/use-theme-BOw3dPpY.js +0 -1
- package/dist/performance/monitor.d.ts +0 -116
- package/dist/rpc/client.d.ts +0 -9
- package/dist/rpc/functions/module-graph.d.ts +0 -17
- package/dist/rpc/functions/open-in-editor.d.ts +0 -16
- package/dist/rpc/functions/tailwind-config.d.ts +0 -15
- package/dist/rpc/functions/vite-config.d.ts +0 -9
- package/dist/rpc/server.d.ts +0 -15
- package/dist/timeline/capture.d.ts +0 -8
- package/dist/timeline/index.d.ts +0 -8
- package/dist/timeline/store.d.ts +0 -42
- package/dist/toolbar/app-manager.d.ts +0 -104
- package/dist/toolbar/components/app-button.d.ts +0 -19
- package/dist/toolbar/components/app-canvas.d.ts +0 -12
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -12
- package/dist/toolbar/components/first-visit-hint.d.ts +0 -16
- package/dist/toolbar/components/index.d.ts +0 -4
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -22
- package/dist/toolbar/components/toolbar-bar.d.ts +0 -14
- package/dist/toolbar/components/toolbar-container.d.ts +0 -55
- package/dist/toolbar/components/vite-overlay-button.d.ts +0 -14
- package/dist/toolbar/context/index.d.ts +0 -2
- package/dist/toolbar/context/toolbar-context.d.ts +0 -107
- package/dist/toolbar/global-api.d.ts +0 -24
- package/dist/toolbar/helpers.d.ts +0 -8
- package/dist/toolbar/hooks/index.d.ts +0 -10
- package/dist/toolbar/hooks/use-apps.d.ts +0 -15
- package/dist/toolbar/hooks/use-frame-state.d.ts +0 -100
- package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -23
- package/dist/toolbar/hooks/use-position.d.ts +0 -24
- package/dist/toolbar/hooks/use-theme.d.ts +0 -15
- package/dist/toolbar/hooks/use-toolbar.d.ts +0 -16
- package/dist/toolbar/settings.d.ts +0 -17
- package/dist/toolbar/stylesheet.d.ts +0 -3
- package/dist/toolbar/utils/index.d.ts +0 -12
- package/dist/types/app.d.ts +0 -175
- package/dist/types/global-api.d.ts +0 -91
- package/dist/types/hooks.d.ts +0 -86
- package/dist/types/index.d.ts +0 -12
- package/dist/types/messaging.d.ts +0 -43
- package/dist/types/rpc.d.ts +0 -97
- package/dist/types/timeline.d.ts +0 -62
- package/dist/types/toolbar.d.ts +0 -56
- package/dist/ui/components/alert.d.ts +0 -20
- package/dist/ui/components/badge.d.ts +0 -10
- package/dist/ui/components/button.d.ts +0 -12
- package/dist/ui/components/card.d.ts +0 -17
- package/dist/ui/components/icon.d.ts +0 -20
- package/dist/ui/components/input.d.ts +0 -8
- package/dist/ui/components/label.d.ts +0 -8
- package/dist/ui/components/popover.d.ts +0 -27
- package/dist/ui/components/progress.d.ts +0 -8
- package/dist/ui/components/separator.d.ts +0 -9
- package/dist/ui/components/skeleton.d.ts +0 -7
- package/dist/ui/components/switch.d.ts +0 -12
- package/dist/ui/components/tabs.d.ts +0 -29
- package/dist/ui/components/textarea.d.ts +0 -8
- package/dist/ui/components/tooltip.d.ts +0 -19
- package/dist/utils/cn.d.ts +0 -8
- package/dist/vite/inject-source.d.ts +0 -24
- package/dist/vite/matcher.d.ts +0 -6
package/dist/toolbar/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Xe=Object.defineProperty;var N=(e,t)=>Xe(e,"name",{value:t,configurable:!0});import{createContext as Fe,render as Pe}from"preact";import{createClientRPCContext as $e}from"../packem_shared/createClientRPCContext-DgRxrllw.js";import{updateSettings as Je,loadSettings as Ve}from"../packem_shared/loadSettings-hvjR4fcS.js";import{getGlobalHook as Ue,setupGlobalHook as Qe}from"../packem_shared/setupGlobalHook-CCf9Logv.js";import ue from"../packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js";import{jsx as i,jsxs as g,Fragment as ze}from"preact/jsx-runtime";import{m as qe}from"../packem_shared/store-DaUtLjf3.js";import{addHookName as l}from"preact/devtools";import{useContext as Ke,useEffect as L,useMemo as re,useState as E,useRef as m,useCallback as pe,useLayoutEffect as et}from"preact/hooks";import u from"../packem_shared/cn-DWLJYh3h.js";import Le from"lucide-static/icons/chevron-right.svg?data-uri&encoding=css";import tt from"lucide-static/icons/layers.svg?data-uri&encoding=css";import rt from"lucide-static/icons/maximize.svg?data-uri&encoding=css";import it from"lucide-static/icons/maximize-2.svg?data-uri&encoding=css";import nt from"lucide-static/icons/minimize.svg?data-uri&encoding=css";import ot from"lucide-static/icons/minimize-2.svg?data-uri&encoding=css";import at from"lucide-static/icons/picture-in-picture-2.svg?data-uri&encoding=css";import Ee from"lucide-static/icons/x.svg?data-uri&encoding=css";import te from"../packem_shared/Icon-DWFLZkwW.js";import{h as Te,_ as He}from"../packem_shared/use-theme-BOw3dPpY.js";import st from"lucide-static/icons/pin.svg?data-uri&encoding=css";import lt from"lucide-static/icons/pin-off.svg?data-uri&encoding=css";import ct from"lucide-static/icons/more-horizontal.svg?data-uri&encoding=css";import pt from"lucide-static/icons/alert-triangle.svg?data-uri&encoding=css";var dt=Object.defineProperty,ut=N((e,t)=>dt(e,"name",{value:t,configurable:!0}),"t$4");const be=ut(()=>{const e=$e();return{rpc:new Proxy({},{get(t,r){return(...o)=>e.callServer(r,...o)}})}},"createServerHelpers");var ht=Object.defineProperty,gt=N((e,t)=>ht(e,"name",{value:t,configurable:!0}),"n$3");let ft=class{static{N(this,"p")}static{gt(this,"AppManager")}apps=new Map;activeAppId=void 0;initializedApps=new Set;appCanvases=new Map;registerApp(t,r=!1){this.apps.has(t.id)&&(this.initializedApps.delete(t.id),this.appCanvases.delete(t.id),this.activeAppId===t.id&&(this.activeAppId=void 0));const o=new EventTarget,a={...t,active:!1,builtIn:r,eventTarget:o,notification:{state:!1},status:"ready"};this.apps.set(t.id,a)}async unregisterApp(t){const r=this.apps.get(t);if(r?.destroy&&this.initializedApps.has(t)){const o=this.appCanvases.get(t);if(o)try{await r.destroy(o.shadowRoot)}catch(a){console.error(`[dev-toolbar] destroy() failed for app ${t}:`,a)}}this.apps.delete(t),this.initializedApps.delete(t),this.appCanvases.delete(t),this.activeAppId===t&&(this.activeAppId=void 0)}getApp(t){return this.apps.get(t)}getAllApps(){return[...this.apps.values()]}getActiveApp(){if(this.activeAppId)return this.apps.get(this.activeAppId)}async toggleApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.onClick??r.onDeactivate){const o=r.active;return r.active=!o,!o&&r.onClick?await r.onClick():o&&r.onDeactivate&&await r.onDeactivate(),!0}return r.active?await this.closeApp(t):this.activeAppId&&!await this.closeApp(this.activeAppId)?!1:await this.openApp(t)}setAppActive(t,r){const o=this.apps.get(t);o&&(o.active=r)}isAppInitialized(t){return this.initializedApps.has(t)}markAppInitialized(t){this.initializedApps.add(t)}async openApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.active=!0,r.status="loading",this.activeAppId=t,r.init&&!this.isAppInitialized(t))try{const o=this.getAppCanvas(t);if(o){const a=be(),n=r.init(o.shadowRoot,r.eventTarget,a);n&&typeof n.then=="function"&&await n,this.markAppInitialized(t),r.status="ready"}else r.status="pending"}catch(o){return console.error(`[dev-toolbar] Failed to init app ${t}:`,o),r.status="error",r.active=!1,this.activeAppId=void 0,!1}else r.status="ready";return!0}async closeApp(t){const r=this.apps.get(t);if(!r||!r.active)return!1;if(r.beforeTogglingOff){const o=this.getAppCanvas(t);if(o)try{const a=r.beforeTogglingOff(o.shadowRoot);if(!(a&&typeof a.then=="function"?await a:a))return!1}catch(a){console.error(`[dev-toolbar] beforeTogglingOff() threw for app ${t}:`,a)}}return r.active=!1,this.activeAppId===t&&(this.activeAppId=void 0),!0}setNotification(t,r,o){const a=this.apps.get(t);a&&(a.notification={level:o,state:r})}clearNotification(t){const r=this.apps.get(t);r&&(r.notification={state:!1})}getAppCanvas(t){return this.appCanvases.get(t)}setAppCanvas(t,r){this.appCanvases.set(t,r)}};var mt=Object.defineProperty,bt=N((e,t)=>mt(e,"name",{value:t,configurable:!0}),"t$3");const We=Fe(void 0),Re=bt(()=>{const e=Ke(We);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},"useToolbarContext");var vt=Object.defineProperty,yt=N((e,t)=>vt(e,"name",{value:t,configurable:!0}),"t$2");const je=yt(()=>{const e=Re();return{activeAppId:e.activeAppId,apps:e.apps,clearNotification:e.clearNotification,registerApp:e.registerApp,setNotification:e.setNotification,toggleApp:e.toggleApp,unregisterApp:e.unregisterApp}},"useApps");var xt=Object.defineProperty,fe=N((e,t)=>xt(e,"name",{value:t,configurable:!0}),"s");const wt=fe((e,t)=>{const r=t.split("+"),o=r.at(-1)??"",a=r.includes("Alt"),n=r.includes("Shift"),c=r.includes("Control")||r.includes("Ctrl"),d=r.includes("Meta")||r.includes("Cmd");return(e.key===o||e.code===`Key${o.toUpperCase()}`)&&e.altKey===a&&e.shiftKey===n&&e.ctrlKey===c&&e.metaKey===d},"matchesBinding"),It=fe(()=>{const{state:e,updateState:t}=Te(),r=fe((n,c)=>{const d=c??!e.open;t({open:d,...d?{}:{viewMode:"default"}})},"togglePanelVisible"),o=fe(()=>{e.open&&t({open:!1,viewMode:"default"})},"closePanel");L(()=>{const n=e.keybindings?.toggle??"Alt+Shift+D",c=fe(d=>{wt(d,n)&&r()},"handleKeyDown");return globalThis.window?.addEventListener("keydown",c),()=>{globalThis.window?.removeEventListener("keydown",c)}},[e.open,e.keybindings?.toggle]);const a=l(re(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:o,panelVisible:a,togglePanelVisible:r}},"usePanelVisible");var At=Object.defineProperty,De=N((e,t)=>At(e,"name",{value:t,configurable:!0}),"e");const ve=De((e,t,r)=>Math.min(Math.max(e,t),r),"clamp");De(()=>navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome"),"checkIsSafari");const ye=De(e=>typeof e=="string"?e.endsWith("px")?Number(e.slice(0,-2)):Number(e):e,"pixelToNumber");var Mt=Object.defineProperty,ee=N((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"h$1");const _e=ee(e=>e<5?0:e>95?100:Math.abs(e-50)<2?50:e,"snapToPoints"),Tt=ee(()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:ye(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:ye(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:ye(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:ye(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},"getSafeAreaInsets"),kt=ee(()=>{const[e,t]=l(E(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return L(()=>{const r=ee(()=>{t({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})},"updateSize");return r(),globalThis.window?.addEventListener("resize",r),()=>{globalThis.window?.removeEventListener("resize",r)}},[]),e},"useWindowSize"),Ct=ee(e=>{const{state:t,updateState:r}=Te(),{height:o,width:a}=kt(),[n,c]=l(E(!1),"isHovering"),[d,h]=l(E(!1),"isDragging"),[W,I]=l(E(!1),"isViteOverlayOpen"),Y=l(m({x:0,y:0}),"draggingOffsetRef"),A=l(m({x:0,y:0}),"mousePositionRef"),P=l(m(void 0),"timerRef"),S=l(m(void 0),"capturedPointerIdRef"),$=l(m(!1),"isDraggingRef"),j=l(m(a),"windowWidthRef"),V=l(m(o),"windowHeightRef"),G=l(m(r),"updateStateRef");L(()=>{j.current=a,V.current=o},[a,o]),L(()=>{G.current=r},[r]);const[y,F]=l(E(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");L(()=>{const v=Tt();F({bottom:v.bottom+10,left:v.left+10,right:v.right+10,top:v.top+10})},[]),L(()=>{const v=ee(()=>{const D=globalThis.__v_o__current;if(D?.parentNode){const s=D.shadowRoot?.querySelector("#__v_o__root");I(!!s&&!s.classList.contains("hidden"))}else I(!1)},"check"),C=setInterval(v,300);return v(),()=>clearInterval(C)},[]);const Q=pe(v=>{v.preventDefault(),v.stopPropagation(),h(!0),$.current=!0;const C=e.current;if(C){const{height:D,left:s,top:p,width:f}=C.getBoundingClientRect();Y.current={x:v.clientX-s-f/2,y:v.clientY-p-D/2};const x=v.target;try{x&&x.setPointerCapture?(x.setPointerCapture(v.pointerId),S.current=v.pointerId):C.setPointerCapture&&(C.setPointerCapture(v.pointerId),S.current=v.pointerId)}catch(z){console.warn("Failed to capture pointer:",z)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),O=pe(()=>{c(!0),!(t.minimizePanelInactive<0)&&(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);L(()=>{O()},[O]),L(()=>{const v=ee(()=>{if(S.current!==void 0){try{const x=e.current;x&&S.current!==void 0&&x.releasePointerCapture(S.current)}catch{}S.current=void 0}},"releaseCapture"),C=ee(()=>{$.current&&(h(!1),$.current=!1,document.body.style.cursor="",document.body.style.userSelect="",v())},"finishDrag"),D=ee(x=>{C()},"handlePointerUp"),s=ee(x=>{C()},"handlePointerCancel"),p=ee(()=>{$.current&&(h(!1),$.current=!1,S.current=void 0,document.body.style.cursor="",document.body.style.userSelect="")},"handleLostPointerCapture"),f=ee(x=>{if(!$.current)return;x.preventDefault();const z=j.current,U=V.current,X=z/2,w=U/2,ae=x.clientX,ne=x.clientY,K=ae-Y.current.x,oe=ne-Y.current.y;A.current={x:K,y:oe};const se=Math.max(0,Math.min(ae,z)),ke=Math.max(0,Math.min(ne,U)),b=Math.atan2(ke-w,se-X),R=70,k=Math.atan2(0-w+R,0-X),B=Math.atan2(0-w+R,z-X),le=Math.atan2(U-R-w,0-X),he=Math.atan2(U-R-w,z-X);let ge;b>=k&&b<=B?ge="top":b>=B&&b<=he?ge="right":b>=he&&b<=le?ge="bottom":ge="left";const Ye=Math.max(0,Math.min(100,K/z*100)),Oe=Math.max(0,Math.min(100,oe/U*100));G.current({left:_e(Ye),position:ge,top:_e(Oe)})},"handlePointerMove");return document.addEventListener("pointermove",f,{capture:!0,passive:!1}),document.addEventListener("pointerup",D,{capture:!0}),document.addEventListener("pointercancel",s,{capture:!0}),document.addEventListener("lostpointercapture",p,{capture:!0}),()=>{document.removeEventListener("pointermove",f,{capture:!0}),document.removeEventListener("pointerup",D,{capture:!0}),document.removeEventListener("pointercancel",s,{capture:!0}),document.removeEventListener("lostpointercapture",p,{capture:!0})}},[]);const T=l(re(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),M=l(re(()=>{if(t.minimizePanelInactive<0)return!1;if(t.minimizePanelInactive===0)return!0;const v=globalThis.window!==void 0&&("ontouchstart"in globalThis.window||(globalThis.navigator?.maxTouchPoints??0)>0);return!d&&!t.open&&!n&&!v&&t.minimizePanelInactive>0&&!W},[d,t.open,t.minimizePanelInactive,n,W]),"isHidden"),Z=l(re(()=>{const v=e.current,C=(v?.clientWidth??0)/2,D=(v?.clientHeight??0)/2,s=T?D:C,p=T?C:D,f=t.left*a/100,x=t.top*o/100;switch(t.position){case"left":return{left:y.left+s-(M?30:0),top:ve(x,p+y.top,o-p-y.bottom)};case"right":return{left:a-y.right-s+(M?15:0)-(M?0:10),top:ve(x,p+y.top,o-p-y.bottom)};case"top":return{left:ve(f,s+y.left,a-s-y.right),top:y.top+p-(M?30:0)};default:return{left:ve(f,s+y.left,a-s-y.right),top:o-y.bottom-p+(M?30:0)}}},[t.left,t.open,t.position,t.top,o,a,y,e,M,T]),"anchorPos"),ie=l(re(()=>({left:`${Z.left}px`,top:`${Z.top}px`,transition:d?"none":"left 0.3s ease, top 0.3s ease"}),[Z,d]),"anchorStyle"),q=l(re(()=>{const v=e.current,C=(v?.clientWidth??0)/2,D=(v?.clientHeight??0)/2,s=T?D:C,p=T?C:D,f={bottom:y.bottom+p,left:y.left+s,right:y.right+s,top:y.top+p},x=f.left+f.right,z=f.top+f.bottom,U=a-x,X=o-z,w={height:`min(${t.height}vh, calc(100vh - ${z}px))`,pointerEvents:d?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${x}px))`,zIndex:"-1"},ae=Z,ne=Math.min(U,t.width*a/100),K=Math.min(X,t.height*o/100),oe=ae?.left??0,se=ae?.top??0;switch(t.position){case"bottom":case"top":{w.left="0",w.transform="translate(-50%, 0)",oe-f.left<ne/2?w.left=`${ne/2-oe+f.left}px`:a-oe-f.right<ne/2&&(w.left=`${a-oe-ne/2-f.right}px`);break}default:{w.top="0",w.transform="translate(0, -50%)",se-f.top<K/2?w.top=`${K/2-se+f.top}px`:o-se-f.bottom<K/2&&(w.top=`${o-se-K/2-f.bottom}px`);break}}switch(t.position){case"left":{w.left="0";break}case"right":{w.right="0";break}case"top":{w.top="0";break}default:{w.bottom="0";break}}return w},[Z,d,y,t.height,t.position,t.width,o,a,e,T]),"iframeStyle"),J=l(re(()=>{const v={transform:T?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return d&&(v.transition="none !important"),v},[d,T]),"panelStyle");return{anchorStyle:ie,bringUp:O,iframeStyle:q,isDragging:d,isHidden:M,isVertical:T,onPointerDown:Q,panelStyle:J}},"usePosition");var Pt=Object.defineProperty,xe=N((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"t$1");const zt=xe(({app:e})=>{const{toggleApp:t}=je(),{isVisible:r,setHoveredApp:o}=Re(),a=l(m(null),"buttonRef"),n=xe(()=>{o(void 0),t(e.id).catch(h=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,h)})},"handleClick"),c=xe(()=>{!e.tooltip||r||o(e,a.current?.getBoundingClientRect())},"handleMouseEnter"),d=xe(()=>{e.tooltip&&o(void 0)},"handleMouseLeave");return i("button",{"aria-label":e.name,class:u("relative flex justify-center items-center","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-primary/8 hover:text-primary","active:scale-[0.94]",e.active&&"bg-primary/12 text-primary","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":e.id,onClick:n,onMouseEnter:c,onMouseLeave:d,ref:a,title:e.tooltip?void 0:e.name,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i("div",{class:"size-6 flex items-center justify-center [&_svg]:size-4.5",dangerouslySetInnerHTML:{__html:e.icon}}),e.notification.state&&i("span",{class:u("absolute -top-1 -right-1 size-1.5 rounded-full border border-background",e.notification.level==="error"&&"bg-destructive",e.notification.level==="warning"&&"bg-warning",(!e.notification.level||e.notification.level==="info")&&"bg-info"),"data-level":e.notification.level||"info"})]})})},"AppButton");var St=Object.defineProperty,_=N((e,t)=>St(e,"name",{value:t,configurable:!0}),"a");const Ze=_(({app:e})=>{const t=l(m(null),"contentRef"),r=l(m(!1),"initializedRef"),o=l(m(be()),"helpersRef");return L(()=>{if(!t.current||r.current||e.component)return;const a=t.current;if(e.init){const n=document.createElement("div");n.style.cssText="width:100%;height:100%;",a.append(n);const c=n.attachShadow({mode:"open"});ue&&(c.adoptedStyleSheets=[ue]);const d=be(),h=e.init(c,e.eventTarget,d);return h&&typeof h.then=="function"?h.then(()=>{r.current=!0}).catch(W=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,W)}):r.current=!0,()=>{for(;a.firstChild;)a.firstChild.remove();r.current=!1}}},[e]),e.component?i(e.component,{eventTarget:e.eventTarget,helpers:o.current}):i("div",{class:"w-full h-full",ref:t})},"AppContent"),Ge=_(e=>e==="error"?"bg-destructive":e==="warning"?"bg-warning":"bg-info","getNotificationColor"),Rt=_(({apps:e,initialActiveAppId:t,onClose:r})=>{const[o,a]=l(E(t),"activeAppId"),[n,c]=l(E(!1),"sidebarCollapsed"),d=l(re(()=>e.find(h=>h.id===o),[e,o]),"activeApp");return g("div",{class:"flex flex-row w-full h-full bg-background font-mono antialiased text-foreground",children:[g("nav",{"aria-label":"DevTools apps",class:u("flex flex-col shrink-0 bg-accent border-r border-border/60","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",n?"w-12.5":"w-62.5"),children:[i("div",{class:u("flex items-center shrink-0 border-b border-border/50 h-12",n?"justify-center px-2":"px-3"),children:n?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:e.filter(h=>h.component??h.init).map(h=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":h.name,"aria-pressed":o===h.id,class:u("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",n?"justify-center px-0":"gap-2.5 px-3",o===h.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:_(()=>a(h.id),"onClick"),type:"button",children:[h.icon?i("span",{class:u("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",o===h.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:h.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:h.name.slice(0,2)}),!n&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:h.name})]}),h.notification.state&&i("span",{"aria-hidden":"true",class:u("pointer-events-none absolute top-1.5 rounded-full",n?"right-1.5":"right-2.5","size-1.5",Ge(h.notification.level))}),n&&i("div",{class:u("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:h.name})})]},h.id))})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":n?"Expand sidebar":"Collapse sidebar",class:u("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:_(()=>c(h=>!h),"onClick"),type:"button",children:i(te,{class:u("size-3.5 transition-transform duration-300",!n&&"rotate-180"),size:14,src:Le})}),d?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:d.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),d?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),i("button",{"aria-label":"Close floating window",class:u("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close floating window",type:"button",children:i(te,{size:12,src:Ee})})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:d?i(Ze,{app:d},d.id):i("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none text-muted-foreground",children:i("p",{class:"text-[0.8rem]",children:"Select a tool from the sidebar"})})})]})]})},"PipPanel"),we=20,Ie=95,Ae=_((e,t,r)=>Math.min(Math.max(e,t),r),"clamp"),jt=_(e=>{switch(e){case"bottom":return"bottom-14";case"left":return"left-14 top-4 bottom-4";case"right":return"right-14 top-4 bottom-4";case"top":return"top-14";default:return"bottom-14"}},"getPanelPositionClasses"),Dt=_(e=>{switch(e){case"bottom":return"origin-[bottom_center]";case"left":return"origin-[left_center]";case"right":return"origin-[right_center]";case"top":return"origin-[top_center]";default:return"origin-[bottom_center]"}},"getOriginClass"),_t=_((e,t)=>t?"opacity-100 scale-100":u("opacity-0 pointer-events-none scale-[0.99]",{bottom:"translate-y-2",left:"-translate-x-2",right:"translate-x-2",top:"-translate-y-2"}[e]??"translate-y-2"),"getVisibilityClasses"),Nt=_(({activeAppId:e,apps:t,onClose:r,onToggleApp:o,panelVisible:a,position:n})=>{const[c,d]=l(E(!1),"isRendered"),[h,W]=l(E(!1),"isVisible"),[I,Y]=l(E(!1),"sidebarCollapsed"),[,A]=l(E(0),"rerender"),{state:P,updateState:S}=Te(),{resolvedTheme:$}=He(),j=l(m(null),"panelDivRef"),V=l(m(!1),"isResizingRef"),G=l(m({height:P.height,width:P.width}),"dimensionsRef"),y=l(m(void 0),"enteringFromRectRef"),F=l(m(void 0),"lastDockedRectRef"),Q=l(m(!1),"previousIsFullscreenRef"),O=l(m(!1),"isExitAnimatingRef"),T=l(m(void 0),"fsTimerRef"),M=P.viewMode==="fullscreen",Z=P.viewMode==="wide",ie=globalThis.window?.documentPictureInPicture!==void 0,q=l(m(void 0),"pipWindowRef"),J=l(re(()=>{if(M)return{};const s=globalThis.window?.innerWidth??1920,p=globalThis.window?.innerHeight??1080,f=`${G.current.height/100*p}px`;return n==="left"||n==="right"?{width:`${G.current.width/100*s}px`}:{height:f,left:"50%",transform:"translateX(-50%)",width:Z?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}},[M,Z,n,A]),"panelSizeStyle");L(()=>{const s=_(f=>{if(!V.current||!j.current)return;const x=j.current.getBoundingClientRect(),z=window.innerWidth,U=window.innerHeight,X={...G.current};if(V.current.top){const w=Math.abs(x.bottom-f.clientY);X.height=Ae(w/U*100,we,Ie)}else if(V.current.bottom){const w=Math.abs(f.clientY-x.top);X.height=Ae(w/U*100,we,Ie)}else if(V.current.right){const w=Math.abs(f.clientX-x.left);X.width=Ae(w/z*100,we,Ie)}else if(V.current.left){const w=Math.abs(x.right-f.clientX);X.width=Ae(w/z*100,we,Ie)}G.current=X,A(w=>w+1)},"handleMouseMove"),p=_(()=>{V.current&&(S({height:G.current.height,width:G.current.width}),V.current=!1)},"handleMouseUp");return globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",p),()=>{globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",p)}},[S]),et(()=>{const s=Q.current;Q.current=M,T.current!==void 0&&(clearTimeout(T.current),T.current=void 0);const p=j.current;if(p)if(M&&!s&&y.current){const f=y.current;y.current=void 0;const x=globalThis.window?.innerWidth??0,z=globalThis.window?.innerHeight??0;p.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",p.style.clipPath=`inset(${f.top}px ${x-f.right}px ${z-f.bottom}px ${f.left}px)`,requestAnimationFrame(()=>{p.style.clipPath="inset(0px 0px 0px 0px)",T.current=setTimeout(()=>{p.style.clipPath="",p.style.transition="",T.current=void 0},380)})}else!M&&s&&!O.current&&(p.style.transition="none",p.style.clipPath="",requestAnimationFrame(()=>{p.style.transition=""}))},[M]),L(()=>{if(a){d(!0);const p=setTimeout(W,16,!0);return()=>clearTimeout(p)}W(!1);const s=setTimeout(d,220,!1);return()=>clearTimeout(s)},[a]);const v=_(async()=>{const s=globalThis.window?.documentPictureInPicture;if(s)try{const p=await s.requestWindow({height:600,width:900});if(q.current=p,ue){const x=p.document.createElement("style");x.textContent=Array.from(ue.cssRules,z=>z.cssText).join(`
|
|
2
|
-
`),p.document.head.append(x)}const f=p.document.createElement("div");f.style.cssText="width:100%;height:100%;display:flex;",$==="dark"&&(p.document.documentElement.classList.add("dark"),f.classList.add("dark")),p.document.body.style.cssText="margin:0;padding:0;height:100vh;",p.document.body.append(f),Pe(i(Rt,{apps:t,initialActiveAppId:e,onClose:_(()=>{p.close()},"onClose")}),f),S({isPip:!0}),p.addEventListener("pagehide",()=>{S({isPip:!1}),q.current=void 0})}catch(p){console.error("[dev-toolbar] PiP activation failed:",p)}},"activatePip");L(()=>{if(!a)return;const s=_(p=>{p.key==="Escape"&&r()},"handleKeyDown");return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[a,r]);const C=l(re(()=>t.find(s=>s.id===e),[t,e]),"activeApp");if(!c)return;const D=_(s=>p=>{p.preventDefault(),V.current=s},"startResize");return g(ze,{children:[i("div",{"aria-hidden":"true",class:u("fixed inset-0 z-[2147483646]","transition-opacity duration-200",h&&!M?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:P.closeOnOutsideClick?r:void 0,role:"presentation"}),g("div",{"aria-label":"DevTools panel","aria-modal":"true",class:u("fixed z-[2147483647] pointer-events-auto antialiased font-mono",M?"inset-0":jt(n),"bg-background overflow-hidden",M?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!M&&Dt(n),_t(n,h),"flex flex-row"),ref:j,role:"dialog",style:J,children:[!M&&g(ze,{children:[n!=="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 top-0 h-2.5 -mt-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:D({top:!0})}),n==="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 bottom-0 h-2.5 -mb-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:D({bottom:!0})}),n==="left"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 right-0 w-2.5 -mr-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:D({right:!0})}),n==="right"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 left-0 w-2.5 -ml-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:D({left:!0})})]}),g("nav",{"aria-label":"DevTools apps",class:u("flex flex-col shrink-0 overflow-hidden","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]","bg-accent border-r border-border/60",I?"w-12.5":"w-62.5"),children:[i("div",{class:u("flex items-center shrink-0 border-b border-border/50 h-12",I?"justify-center px-2":"px-3"),children:I?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:t.filter(s=>s.component??s.init).map(s=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":s.name,"aria-pressed":e===s.id,class:u("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",I?"justify-center px-0":"gap-2.5 px-3",e===s.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:_(()=>{s.id!==e&&o(s.id).catch(console.error)},"onClick"),type:"button",children:[s.icon?i("span",{class:u("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",e===s.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:s.name.slice(0,2)}),!I&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:s.name})]}),s.notification.state&&i("span",{"aria-hidden":"true",class:u("pointer-events-none absolute top-1.5 rounded-full",I?"right-1.5":"right-2.5","size-1.5",Ge(s.notification.level))}),I&&i("div",{class:u("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:s.name})})]},s.id))}),!I&&i("div",{class:"px-3 py-2.5 border-t border-border/40 shrink-0",children:g("span",{class:"text-[0.58rem] text-muted-foreground/50 leading-none select-none",children:[P.keybindings?.toggle??"Alt+Shift+D"," to toggle"]})})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":I?"Expand sidebar":"Collapse sidebar",class:u("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:_(()=>Y(s=>!s),"onClick"),type:"button",children:i(te,{class:u("size-3.5 transition-transform duration-300",!I&&"rotate-180"),size:14,src:Le})}),C?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:C.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),C?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),g("div",{class:"flex items-center gap-1 shrink-0",children:[(n==="bottom"||n==="top")&&!M&&i("button",{"aria-label":Z?"Switch to container width":"Expand to full width",class:u("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>S({viewMode:Z?"default":"wide"}),"onClick"),title:Z?"Container width":"Full width",type:"button",children:i(te,{size:13,src:Z?ot:it})}),i("button",{"aria-label":M?"Exit fullscreen":"Enter fullscreen",class:u("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>{if(M){const s=j.current,p=F.current;if(s&&p){const f=globalThis.window?.innerWidth??0,x=globalThis.window?.innerHeight??0,z=`inset(${p.top}px ${f-p.right}px ${x-p.bottom}px ${p.left}px)`;T.current!==void 0&&(clearTimeout(T.current),T.current=void 0),O.current=!0,s.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",s.style.clipPath="inset(0px 0px 0px 0px)",requestAnimationFrame(()=>{s.style.clipPath=z,T.current=setTimeout(()=>{s.style.clipPath="",s.style.transition="",O.current=!1,T.current=void 0,S({viewMode:"default"})},380)})}else S({viewMode:"default"})}else{if(j.current){const s=j.current.getBoundingClientRect();y.current=s,F.current=s}S({viewMode:"fullscreen"})}},"onClick"),title:M?"Exit fullscreen":"Fullscreen",type:"button",children:i(te,{size:13,src:M?nt:rt})}),ie&&!M&&i("button",{"aria-label":"Open in Picture-in-Picture window",class:u("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent",P.isPip?"text-primary hover:bg-primary/7":"text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>{v().then(()=>r()).catch(console.error)},"onClick"),title:"Open in floating window (PiP)",type:"button",children:i(te,{size:13,src:at})}),i("button",{"aria-label":"Close DevTools panel",class:u("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close (Esc)",type:"button",children:i(te,{size:12,src:Ee})})]})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:C?i(Ze,{app:C},C.id):g("div",{class:"flex flex-col items-center justify-center h-full gap-7 p-8 select-none",children:[g("div",{class:"flex flex-col items-center gap-3",children:[i("div",{class:"size-14 border border-primary/25 bg-primary/5 flex items-center justify-center",children:i(te,{class:"text-primary/45",size:26,src:tt})}),g("div",{class:"text-center space-y-1",children:[i("p",{class:"text-[0.8rem] font-medium text-foreground/65",children:"No tool selected"}),i("p",{class:"text-[0.7rem] text-muted-foreground",children:"Choose a tool from the sidebar to get started"})]})]}),t.length>0&&g("div",{class:"w-full max-w-[220px]",children:[g("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-1.5",children:[i("span",{class:"text-primary/50",children:"// "}),"available"]}),i("div",{class:"flex flex-col gap-0.5",children:t.map(s=>g("button",{class:u("flex items-center gap-2.5 px-3 py-2","border border-border/40 bg-card/50","hover:border-primary/30 hover:bg-primary/4","cursor-pointer transition-all duration-150 text-left"),onClick:_(()=>o(s.id).catch(console.error),"onClick"),type:"button",children:[s.icon?i("span",{class:"size-3.5 shrink-0 flex items-center justify-center [&_svg]:size-3.5 text-muted-foreground",dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-3.5 text-[0.5rem] font-bold text-muted-foreground shrink-0 text-center",children:s.name.slice(0,2).toUpperCase()}),i("span",{class:"text-[0.75rem] font-medium text-muted-foreground",children:s.name})]},s.id))})]})]})})]})]})]})},"DevPanel");var $t=Object.defineProperty,Ce=N((e,t)=>$t(e,"name",{value:t,configurable:!0}),"n$1");const Vt=Ce(()=>{const[e,t]=l(E(0),"errorCount"),[r,o]=l(E(!1),"isOverlayOpen");if(L(()=>{const c=Ce(()=>{const h=globalThis.__v_o_error_history,W=Array.isArray(h)?h.length:0;t(W);const I=globalThis.__v_o__current;if(I?.parentNode){const Y=I.shadowRoot?.querySelector("#__v_o__root");o(!!Y&&!Y.classList.contains("hidden"))}else o(!1)},"sync"),d=setInterval(c,300);return c(),()=>clearInterval(d)},[]),e===0)return;const a=Ce(()=>{const c=globalThis.__v_o__current;if(!c?.parentNode)return;const d=c.shadowRoot?.querySelector("#__v_o__root");d?.classList.contains("hidden")?(d.classList.remove("hidden"),o(!0)):typeof c.close=="function"&&(c.close(),o(!1))},"handleClick"),n=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return g(ze,{children:[i("div",{"aria-hidden":"true",class:"w-px h-5 bg-primary/20 shrink-0 mx-0.5"}),i("button",{"aria-label":n,class:u("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-destructive","transition-all duration-150","hover:bg-destructive/8","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),onClick:a,title:n,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i(te,{size:16,src:pt}),i("span",{class:"absolute -top-0.5 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-destructive text-white text-[9px] font-bold leading-none flex items-center justify-center border border-background",children:e>9?"9+":e})]})})]})},"ViteOverlayButton");var Lt=Object.defineProperty,Se=N((e,t)=>Lt(e,"name",{value:t,configurable:!0}),"n");const Et=Se(()=>{const{toggleApp:e}=je();return i("button",{class:u("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-foreground/8 hover:text-foreground","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":"dev-toolbar:more",onClick:Se(()=>{e("dev-toolbar:more").catch(t=>{console.error("[dev-toolbar] Failed to toggle more app:",t)})},"onClick"),title:"More apps",type:"button",children:i("div",{class:"relative size-6 flex items-center justify-center select-none",children:i(te,{size:16,src:ct})})})},"MoreButton"),Ht=Se(({customAppsToShow:e=3})=>{const{apps:t}=je(),r=t.filter(c=>c.builtIn),o=t.filter(c=>!c.builtIn),a=[...r,...o.slice(0,e)],n=o.slice(e);return i("div",{class:"flex items-center pointer-events-auto",id:"__v_dt__bar",children:g("div",{class:"flex flex-row items-center justify-start gap-1",id:"__v_dt__bar_container",children:[a.map(c=>i(zt,{app:c},c.id)),n.length>0&&i(Et,{}),i(Vt,{})]})})},"ToolbarBar"),Wt="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==";var Zt=Object.defineProperty,me=N((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"o$1");const Gt=me((e,t)=>{switch(t){case"left":return{left:`${e.right+10}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"right":return{right:`${globalThis.window?globalThis.window.innerWidth-e.left+10:0}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"top":return{left:`${e.left+e.width/2}px`,top:`${e.bottom+10}px`,transform:"translateX(-50%)"};default:return{bottom:`${globalThis.window?globalThis.window.innerHeight-e.top+10:0}px`,left:`${e.left+e.width/2}px`,transform:"translateX(-50%)"}}},"getTooltipStyle"),Bt=me(({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:o,setHoveredApp:a}=Re(),n=l(m(null),"overlayRef"),c=l(m(be()),"helpersRef"),[d,h]=l(E(!1),"isRendered"),[W,I]=l(E(!1),"isVisible"),Y=!!(t?.tooltip&&r);if(L(()=>{if(Y){h(!0);const V=setTimeout(I,16,!0);return()=>clearTimeout(V)}I(!1);const j=setTimeout(h,200,!1);return()=>clearTimeout(j)},[Y]),!d||!t?.tooltip||!r)return;const A=t.tooltip,P=Gt(r,e),S=e==="left"||e==="right",$=me(()=>{const j=n.current?.getBoundingClientRect();j&&o(t,j.left,j.top),a(void 0)},"handlePin");return g("div",{"aria-label":`${t.name} quick preview`,class:u("fixed z-[2147483647] pointer-events-auto","antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-border shadow-2xl","transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]",W?"opacity-100 translate-y-0 scale-100":u("opacity-0 scale-[0.97]",e==="bottom"&&"translate-y-1",e==="top"&&"-translate-y-1",S&&"translate-x-[-2px]")),onMouseEnter:me(()=>a(t,r),"onMouseEnter"),onMouseLeave:me(()=>a(void 0),"onMouseLeave"),ref:n,role:"tooltip",style:P,children:[g("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-foreground/3",children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-muted-foreground truncate",children:t.name})]}),i("button",{"aria-label":`Pin ${t.name} tooltip`,class:u("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/60 hover:text-primary","transition-colors duration-150"),onClick:$,title:"Pin (keep visible)",type:"button",children:i(te,{size:11,src:st})})]}),i("div",{class:"p-3",children:i(A,{helpers:c.current})})]})},"AppTooltipOverlay");var Yt=Object.defineProperty,Me=N((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"o");const Ot=Me(e=>{switch(e){case"left":return{left:"0",top:"50%",transform:"translateX(24px) translateY(-50%)"};case"right":return{left:"0",top:"50%",transform:"translateX(calc(-100% - 24px)) translateY(-50%)"};case"top":return{left:"50%",top:"0",transform:"translateX(-50%) translateY(24px)"};default:return{left:"50%",top:"0",transform:"translateX(-50%) translateY(calc(-100% - 24px))"}}},"getHintStyle"),Xt=Me(({position:e})=>{const t="absolute w-2.5 h-2.5 bg-card border-border";switch(e){case"left":return i("div",{"aria-hidden":"true",class:u(t,"left-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-b border-l")});case"right":return i("div",{"aria-hidden":"true",class:u(t,"right-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-t border-r")});case"top":return i("div",{"aria-hidden":"true",class:u(t,"top-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-t border-l")});default:return i("div",{"aria-hidden":"true",class:u(t,"bottom-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-b border-r")})}},"Arrow"),Ft=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],Jt=Me(({onDismiss:e,position:t})=>{const[r,o]=l(E(!1),"visible"),a=l(m(void 0),"dismissTimeoutRef");L(()=>{const c=setTimeout(o,600,!0);return()=>clearTimeout(c)},[]),L(()=>()=>{a.current!==void 0&&(clearTimeout(a.current),a.current=void 0)},[]);const n=Me(()=>{o(!1),a.current=setTimeout(e,180)},"handleDismiss");return g("div",{"aria-hidden":!r,"aria-label":"DevTools quick start",class:u("absolute pointer-events-auto","w-[240px]","bg-card border border-border","shadow-xl","p-3","font-mono","transition-all duration-200",r?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),style:Ot(t),children:[i(Xt,{position:t}),g("p",{class:"flex items-center gap-1.5 mb-2.5",children:[i("span",{"aria-hidden":"true",class:"text-primary text-[0.6rem]",children:"▶"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.12em] text-foreground",children:"Quick start"})]}),i("ul",{class:"space-y-1.5 mb-3 list-none p-0 m-0",children:Ft.map(({icon:c,text:d})=>g("li",{class:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[i("span",{"aria-hidden":"true",class:"text-primary shrink-0 w-3 text-center leading-none",children:c}),d]},d))}),i("button",{class:u("w-full h-6 text-[0.6rem] font-bold uppercase tracking-[0.1em]","border border-primary/30 bg-primary/6","text-primary cursor-pointer","hover:bg-primary/12 hover:border-primary/50","transition-all duration-150 active:scale-[0.98]"),onClick:n,tabIndex:r?void 0:-1,type:"button",children:"Got it"})]})},"FirstVisitHint");var Ut=Object.defineProperty,de=N((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"i");const Qt=de(({onMove:e,onUnpin:t,pinned:r})=>{const o=l(m(null),"cardRef"),a=l(m(null),"headerRef"),n=l(m({x:r.initialX,y:r.initialY}),"posRef"),c=l(m(void 0),"dragRef"),d=l(m(be()),"helpersRef"),h=l(m(e),"onMoveRef"),W=l(m(r.id),"pinnedIdRef");h.current=e,W.current=r.id,L(()=>{const A="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",P=de($=>{if(!c.current||!o.current)return;const j=globalThis.window?.innerWidth??9999,V=globalThis.window?.innerHeight??9999,{cardH:G,cardW:y}=c.current,F=Math.min(80,y),Q=Math.min(36,G);let O=c.current.origX+($.clientX-c.current.startX),T=c.current.origY+($.clientY-c.current.startY);O=Math.max(F-y,Math.min(j-F,O)),T=Math.max(Q-G,Math.min(V-Q,T));const M=[0,j-y,F-y,j-F],Z=[0,V-G,Q-G,V-Q];let ie=O,q=T;for(const J of M)if(Math.abs(O-J)<28){ie=J;break}for(const J of Z)if(Math.abs(T-J)<28){q=J;break}o.current.style.transition=ie!==O||q!==T?A:"",o.current.style.transform=`translate(${ie}px, ${q}px)`,n.current={x:ie,y:q}},"handleMove"),S=de(()=>{c.current&&(c.current=void 0,o.current&&(o.current.style.transition=""),a.current&&(a.current.style.cursor=""),h.current(W.current,n.current.x,n.current.y))},"handleUp");return document.addEventListener("mousemove",P),document.addEventListener("mouseup",S),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",S)}},[]);const I=r.app.tooltip;if(!I)return;const Y=de(A=>{A.button===0&&(c.current={cardH:o.current?.offsetHeight??200,cardW:o.current?.offsetWidth??300,origX:n.current.x,origY:n.current.y,startX:A.clientX,startY:A.clientY},a.current&&(a.current.style.cursor="grabbing"),A.preventDefault())},"handleDragStart");return g("div",{"aria-label":`${r.app.name} pinned tooltip`,class:u("fixed z-[2147483647] pointer-events-auto antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-primary/40 shadow-2xl"),ref:o,style:{left:0,top:0,transform:`translate(${n.current.x}px, ${n.current.y}px)`},children:[g("div",{class:u("flex items-center justify-between gap-2 px-3 py-2","border-b border-primary/20 bg-primary/4","select-none cursor-grab"),onMouseDown:Y,ref:a,children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-primary/70 truncate",children:r.app.name})]}),i("button",{"aria-label":`Unpin ${r.app.name}`,class:u("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/50 hover:text-destructive","transition-colors duration-150"),onClick:de(()=>t(r.id),"onClick"),onMouseDown:de(A=>A.stopPropagation(),"onMouseDown"),title:"Unpin",type:"button",children:i(te,{size:11,src:lt})})]}),i("div",{class:"p-3",children:i(I,{helpers:d.current})})]})},"PinnedTooltipCard");var qt=Object.defineProperty,ce=N((e,t)=>qt(e,"name",{value:t,configurable:!0}),"p");const Ne="__v_dt__pinned_tooltips",Kt=ce((e,t,r,o,a)=>{const n=t*o/100,c=r*a/100,d=o/4;switch(e){case"bottom":return n<d?"bottom-left":n>o-d?"bottom-right":"bottom-center";case"left":return c<a/2?"top-left":"bottom-left";case"right":return c<a/2?"top-right":"bottom-right";case"top":return n<d?"top-left":n>o-d?"top-right":"top-center";default:return"bottom-center"}},"computePlacement"),er=ce(({activeAppId:e,apps:t,customAppsToShow:r=3,onClearNotification:o,onRegisterApp:a,onSetNotification:n,onToggleApp:c,onUnregisterApp:d})=>{const h=l(m(null),"anchorRef"),W=l(m(null),"panelRef"),I=l(m(void 0),"leaveTimerRef"),{resolvedTheme:Y}=He(),{state:A,updateState:P}=Te(),{closePanel:S,panelVisible:$,togglePanelVisible:j}=It(),{anchorStyle:V,bringUp:G,isDragging:y,isHidden:F,isVertical:Q,onPointerDown:O,panelStyle:T}=Ct(W),[M,Z]=l(E(void 0),"hoveredApp"),[ie,q]=l(E(void 0),"hoveredAppRect"),J=l(m(new Map),"pinPositionsRef"),v=pe(b=>{try{const R=b.map(k=>{const B=J.current.get(k.id);return{appId:k.app.id,x:B?.x??k.initialX,y:B?.y??k.initialY}});localStorage.setItem(Ne,JSON.stringify(R))}catch{}},[]),[C,D]=l(E([]),"pinnedTooltips"),s=l(m([]),"pinnedTooltipsRef");s.current=C;const p=pe((b,R,k)=>{const B=`${b.id}-${Date.now()}`;D(le=>{const he=[...le,{app:b,id:B,initialX:R,initialY:k}];return v(he),he})},[v]),f=pe(b=>{D(R=>{const k=R.filter(B=>B.id!==b);return J.current.delete(b),v(k),k})},[v]),x=pe((b,R,k)=>{J.current.set(b,{x:R,y:k}),v(s.current)},[v]),z=l(m(void 0),"storedPinsRef"),U=l(m(new Set),"restoredAppIdsRef");L(()=>{if(t.length===0)return;if(z.current===void 0)try{const k=localStorage.getItem(Ne);z.current=k?JSON.parse(k):[]}catch{z.current=[]}const b=z.current;if(b.length===0)return;const R=[];for(const k of b){if(U.current.has(k.appId))continue;const B=t.find(le=>le.id===k.appId&&le.tooltip);B&&(U.current.add(k.appId),R.push({app:B,id:`${B.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:k.x,initialY:k.y}))}R.length>0&&D(k=>[...k,...R])},[t]),L(()=>()=>{I.current!==void 0&&clearTimeout(I.current)},[]);const X=pe((b,R)=>{I.current!==void 0&&(clearTimeout(I.current),I.current=void 0),b?(Z(b),q(R)):I.current=setTimeout(()=>{Z(void 0),q(void 0),I.current=void 0},180)},[]),w=l(m(t),"appsRef");w.current=t;const ae=l(m($),"panelVisibleRef");ae.current=$;const ne=l(m(e),"activeAppIdRef");ne.current=e;const K=l(m(c),"onToggleAppRef");K.current=c;const oe=l(re(()=>{const b=globalThis.window?.innerWidth??1920,R=globalThis.window?.innerHeight??1080;return Kt(A.position,A.left,A.top,b,R)},[A.left,A.position,A.top]),"placement"),se=pe(async b=>{const R=ae.current,k=ne.current,B=w.current.find(le=>le.id===b);if(B?.onClick??B?.onDeactivate){await K.current(b);return}if(b===k&&R){await K.current(b),P({open:!1,viewMode:"default"});return}b!==k&&await K.current(b),R||P({open:!0})},[P]),ke={activeAppId:e,apps:t,clearNotification:o,hoveredApp:M,hoveredAppRect:ie,isDragging:y,isVisible:$,pinnedTooltips:C,pinTooltip:p,placement:oe,registerApp:a,setDragging:ce(()=>{},"setDragging"),setHoveredApp:X,setNotification:n,setPlacement:ce(()=>{},"setPlacement"),setVisible:ce(b=>P({open:b}),"setVisible"),toggleApp:se,unpinTooltip:f,unregisterApp:d};if(!(!A.preferShowFloatingPanel&&!$))return i(We.Provider,{value:ke,children:g("div",{class:u(Y==="dark"&&"dark"),style:{display:"contents"},children:[g("div",{class:u("fixed z-[2147483647]","pointer-events-auto","origin-center","transition-[left_0.3s_cubic-bezier(0.4,0,0.2,1),top_0.3s_cubic-bezier(0.4,0,0.2,1)]","data-[dragging]:transition-none!","group","toolbar-font text-[13px]! leading-[1.6]! antialiased box-border [&_*]:box-border print:hidden",A.reduceMotion&&"transition-none! animate-none! [&_*]:transition-none! [&_*]:animate-none!"),"data-dragging":y?"":void 0,"data-placement":oe,id:"__v_dt__root",onMouseMove:G,ref:h,style:V,children:[g("div",{class:u("group/panel","absolute left-0 top-0","flex flex-row justify-start items-center","gap-1 p-1","box-border","overflow-hidden","rounded-none","text-foreground select-none",y?"cursor-grabbing":"cursor-grab","bg-background border-0",Q?"shadow-pill-vertical!":"shadow-pill",F?"max-w-12!":"","transition-pill"),"data-vertical":Q||void 0,onPointerDown:ce(b=>{A.isFirstVisit&&P({isFirstVisit:!1}),O(b)},"onPointerDown"),ref:W,style:T,children:[i("button",{"aria-label":"Toggle devtools panel",class:u("size-8 flex justify-center items-center shrink-0","cursor-pointer p-0 m-0 border-0","bg-transparent","transition-all duration-150","hover:bg-primary/8 active:scale-[0.95]","group-data-[vertical]/panel:rotate-[-90deg]",$?"opacity-100":"opacity-60"),onClick:ce(b=>{b.stopPropagation(),A.isFirstVisit&&P({isFirstVisit:!1}),j()},"onClick"),title:"Toggle devtools panel",type:"button",children:i("img",{alt:"Visulima",class:"size-6",src:Wt})}),i("div",{"aria-hidden":"true",class:u("w-px h-5 bg-primary/20 shrink-0",F&&"hidden")}),i("div",{class:u("px-0.5",F&&"hidden"),children:i(Ht,{customAppsToShow:r})})]}),A.isFirstVisit&&i(Jt,{onDismiss:ce(()=>P({isFirstVisit:!1}),"onDismiss"),position:A.position})]}),i(Nt,{activeAppId:e,apps:t,onClose:S,onToggleApp:c,panelVisible:$,position:A.position}),i(Bt,{position:A.position}),C.map(b=>i(Qt,{onMove:x,onUnpin:f,pinned:b},b.id))]})})},"ToolbarContainer");var tr=Object.defineProperty,Be=N((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r");const rr=Be((e,t)=>{const r=$e(),o=Ue();if(!o)throw new Error("Global hook not initialized");return{clearNotification(a){e.clearNotification(a)},async closeApp(){const a=e.getActiveApp();a&&await e.toggleApp(a.id)},getActiveApp(){return e.getActiveApp()?.id},getApps(){return e.getApps()},getSettings(){return Ve()},hide(){t.hide()},hook:o,notify(a,n){e.setNotification(a,!0,n)},async openApp(a){await e.toggleApp(a)},registerApp(a){e.registerApp(a)},rpc:new Proxy({},{get(a,n){return(...c)=>r.callServer(n,...c)}}),setAppActive(a,n){e.setAppActive(a,n)},show(){t.show()},toggle(){t.toggle()},unregisterApp(a){e.unregisterApp(a)},updateSettings(a){Je(a)},version:"0.0.0"}},"createGlobalAPI"),ir=Be(e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)},"setupGlobalAPI");var nr=Object.defineProperty,H=N((e,t)=>nr(e,"name",{value:t,configurable:!0}),"t");class or extends HTMLElement{static{N(this,"DevToolbar")}static{H(this,"DevToolbar")}appManager;hasBeenInitialized=!1;customAppsToShow=3;renderRoot=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new ft}connectedCallback(){this.hasBeenInitialized&&this.shadowRoot&&!this.renderRoot&&this.render()}disconnectedCallback(){this.renderRoot&&(Pe(null,this.renderRoot),this.renderRoot=void 0)}init(){if(this.hasBeenInitialized)return;this.hasBeenInitialized=!0;const t=Qe(n=>{this.appManager.registerApp(n),this.render()},(n,c)=>{qe().addEvent(n,c)}),r=rr({clearNotification:H(n=>{this.appManager.clearNotification(n),this.render()},"clearNotification"),getActiveApp:H(()=>this.appManager.getActiveApp(),"getActiveApp"),getApps:H(()=>this.appManager.getAllApps(),"getApps"),registerApp:H(n=>{this.appManager.registerApp(n),this.render()},"registerApp"),setAppActive:H((n,c)=>{this.appManager.setAppActive(n,c),this.render()},"setAppActive"),setNotification:H((n,c,d)=>{this.appManager.setNotification(n,c,d),this.render()},"setNotification"),toggleApp:H(n=>this.appManager.toggleApp(n),"toggleApp"),unregisterApp:H(n=>{this.appManager.unregisterApp(n),this.render()},"unregisterApp")},{hide:H(()=>this.setToolbarVisible(!1),"hide"),show:H(()=>this.setToolbarVisible(!0),"show"),toggle:H(()=>{const n=this.isHidden();this.setToolbarVisible(!n)},"toggle")});ir(r),t.emit("devtools:init");const o=Ve(),a=this.appManager.getAllApps().find(n=>n.defaultOpen);a&&!this.appManager.getActiveApp()&&this.appManager.openApp(a.id).catch(n=>{console.error(`[dev-toolbar] Failed to auto-open defaultOpen app ${a.id}:`,n)}),this.render(),this.setupEventListeners(),o.defaultVisible&&this.setToolbarVisible(!0)}isHidden(){return this.shadowRoot.querySelector("#__v_dt__root")?.hasAttribute("data-hidden")??!0}setToolbarVisible(t){const r=this.shadowRoot.querySelector("#__v_dt__root");r&&(t?delete r.dataset.hidden:r.dataset.hidden=""),this.render()}registerApp(t,r=!1){this.appManager.registerApp(t,r),this.render()}getAppManager(){return this.appManager}render(){const t=this.appManager.getAllApps(),r=this.shadowRoot;ue&&(r.adoptedStyleSheets=[ue]);let o=r.querySelector("style");o||(o=document.createElement("style"),o.textContent=`
|
|
1
|
+
import{createContext as je,render as me}from"preact";import{createClientRPCContext as De}from"../packem_shared/createClientRPCContext-80V9c3Qu.js";import{updateSettings as Se,loadSettings as Ie}from"../packem_shared/loadSettings-C0pUyx9j.js";import{getGlobalHook as Pe,setupGlobalHook as _e}from"../packem_shared/getGlobalHook-GRSqUNJ3.js";import ae from"../packem_shared/sharedToolbarStylesheet-DNABzHAf.js";import{jsx as i,jsxs as g,Fragment as ve}from"preact/jsx-runtime";import{addHookName as l}from"preact/devtools";import{clsx as h}from"../packem_shared/clsx-CtZWcPHt.js";import{useContext as Ne,useEffect as _,useMemo as q,useState as N,useRef as f,useCallback as oe,useLayoutEffect as Ve}from"preact/hooks";import K from"../packem_shared/Icon-0XYV-4AL.js";import{p as fe,u as Ae}from"../packem_shared/use-theme-DIqZkPAe.js";import{u as He}from"../packem_shared/store-Dqy0FbGw.js";const le=()=>{const e=De();return{rpc:new Proxy({},{get(t,r){return(...o)=>e.callServer(r,...o)}})}};class Le{apps=new Map;activeAppId=void 0;initializedApps=new Set;appCanvases=new Map;registerApp(t,r=!1){this.apps.has(t.id)&&(this.initializedApps.delete(t.id),this.appCanvases.delete(t.id),this.activeAppId===t.id&&(this.activeAppId=void 0));const o=new EventTarget,a={...t,active:!1,builtIn:r,eventTarget:o,notification:{state:!1},status:"ready"};this.apps.set(t.id,a)}async unregisterApp(t){const r=this.apps.get(t);if(r?.destroy&&this.initializedApps.has(t)){const o=this.appCanvases.get(t);if(o)try{await r.destroy(o.shadowRoot)}catch(a){console.error(`[dev-toolbar] destroy() failed for app ${t}:`,a)}}this.apps.delete(t),this.initializedApps.delete(t),this.appCanvases.delete(t),this.activeAppId===t&&(this.activeAppId=void 0)}getApp(t){return this.apps.get(t)}getAllApps(){return[...this.apps.values()]}getActiveApp(){if(this.activeAppId)return this.apps.get(this.activeAppId)}async toggleApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.onClick??r.onDeactivate){const o=r.active;return r.active=!o,!o&&r.onClick?await r.onClick():o&&r.onDeactivate&&await r.onDeactivate(),!0}return r.active?await this.closeApp(t):this.activeAppId&&!await this.closeApp(this.activeAppId)?!1:await this.openApp(t)}setAppActive(t,r){const o=this.apps.get(t);o&&(o.active=r)}isAppInitialized(t){return this.initializedApps.has(t)}markAppInitialized(t){this.initializedApps.add(t)}async openApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.active=!0,r.status="loading",this.activeAppId=t,r.init&&!this.isAppInitialized(t))try{const o=this.getAppCanvas(t);if(o){const a=le(),n=r.init(o.shadowRoot,r.eventTarget,a);n&&typeof n.then=="function"&&await n,this.markAppInitialized(t),r.status="ready"}else r.status="pending"}catch(o){return console.error(`[dev-toolbar] Failed to init app ${t}:`,o),r.status="error",r.active=!1,this.activeAppId=void 0,!1}else r.status="ready";return!0}async closeApp(t){const r=this.apps.get(t);if(!r?.active)return!1;if(r.beforeTogglingOff){const o=this.getAppCanvas(t);if(o)try{const a=r.beforeTogglingOff(o.shadowRoot);if(!(a&&typeof a.then=="function"?await a:a))return!1}catch(a){console.error(`[dev-toolbar] beforeTogglingOff() threw for app ${t}:`,a)}}return r.active=!1,this.activeAppId===t&&(this.activeAppId=void 0),!0}setNotification(t,r,o){const a=this.apps.get(t);a&&(a.notification={level:o,state:r})}clearNotification(t){const r=this.apps.get(t);r&&(r.notification={state:!1})}getAppCanvas(t){return this.appCanvases.get(t)}setAppCanvas(t,r){this.appCanvases.set(t,r)}}const Me=je(void 0),be=()=>{const e=Ne(Me);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},ke=()=>{const e=be();return{activeAppId:e.activeAppId,apps:e.apps,clearNotification:e.clearNotification,registerApp:e.registerApp,setNotification:e.setNotification,toggleApp:e.toggleApp,unregisterApp:e.unregisterApp}},We=(e,t)=>{const r=t.split("+"),o=r.at(-1)??"",a=r.includes("Alt"),n=r.includes("Shift"),c=r.includes("Control")||r.includes("Ctrl"),p=r.includes("Meta")||r.includes("Cmd");return(e.key===o||e.code===`Key${o.toUpperCase()}`)&&e.altKey===a&&e.shiftKey===n&&e.ctrlKey===c&&e.metaKey===p},Be=()=>{const{state:e,updateState:t}=fe(),r=(n,c)=>{const p=c??!e.open;t({open:p,...p?{}:{viewMode:"default"}})},o=()=>{e.open&&t({open:!1,viewMode:"default"})};_(()=>{const n=e.keybindings?.toggle??"Alt+Shift+D",c=p=>{We(p,n)&&r()};return globalThis.window?.addEventListener("keydown",c),()=>{globalThis.window?.removeEventListener("keydown",c)}},[e.open,e.keybindings?.toggle]);const a=l(q(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:o,panelVisible:a,togglePanelVisible:r}},de=(e,t,r)=>Math.min(Math.max(e,t),r),pe=e=>typeof e=="string"?e.endsWith("px")?Number(e.slice(0,-2)):Number(e):e,we=e=>e<5?0:e>95?100:Math.abs(e-50)<2?50:e,Ze=()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:pe(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:pe(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:pe(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:pe(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},Ge=()=>{const[e,t]=l(N(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return _(()=>{const r=()=>{t({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})};return r(),globalThis.window?.addEventListener("resize",r),()=>{globalThis.window?.removeEventListener("resize",r)}},[]),e},Ye=e=>{const{state:t,updateState:r}=fe(),{height:o,width:a}=Ge(),[n,c]=l(N(!1),"isHovering"),[p,u]=l(N(!1),"isDragging"),[E,z]=l(N(!1),"isViteOverlayOpen"),A=l(f({x:0,y:0}),"draggingOffsetRef"),F=l(f({x:0,y:0}),"mousePositionRef"),V=l(f(void 0),"timerRef"),M=l(f(void 0),"capturedPointerIdRef"),Z=l(f(!1),"isDraggingRef"),R=l(f(a),"windowWidthRef"),P=l(f(o),"windowHeightRef"),H=l(f(r),"updateStateRef");_(()=>{R.current=a,P.current=o},[a,o]),_(()=>{H.current=r},[r]);const[w,$]=l(N(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");_(()=>{const v=Ze();$({bottom:v.bottom+10,left:v.left+10,right:v.right+10,top:v.top+10})},[]),_(()=>{const v=()=>{const S=globalThis.__v_o__current;if(S?.parentNode){const s=S.shadowRoot?.querySelector("#__v_o__root");z(!!s&&!s.classList.contains("hidden"))}else z(!1)},C=setInterval(v,300);return v(),()=>{clearInterval(C)}},[]);const U=oe(v=>{v.preventDefault(),v.stopPropagation(),u(!0),Z.current=!0;const C=e.current;if(C){const{height:S,left:s,top:d,width:m}=C.getBoundingClientRect();A.current={x:v.clientX-s-m/2,y:v.clientY-d-S/2};const b=v.target;try{b&&b.setPointerCapture?(b.setPointerCapture(v.pointerId),M.current=v.pointerId):C.setPointerCapture&&(C.setPointerCapture(v.pointerId),M.current=v.pointerId)}catch(j){console.warn("Failed to capture pointer:",j)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),G=oe(()=>{c(!0),!(t.minimizePanelInactive<0)&&(V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);_(()=>{G()},[G]),_(()=>{const v=()=>{if(M.current!==void 0){try{const b=e.current;b&&M.current!==void 0&&b.releasePointerCapture(M.current)}catch{}M.current=void 0}},C=()=>{Z.current&&(u(!1),Z.current=!1,document.body.style.cursor="",document.body.style.userSelect="",v())},S=b=>{C()},s=b=>{C()},d=()=>{Z.current&&(u(!1),Z.current=!1,M.current=void 0,document.body.style.cursor="",document.body.style.userSelect="")},m=b=>{if(!Z.current)return;b.preventDefault();const j=R.current,J=P.current,B=j/2,y=J/2,ie=b.clientX,O=b.clientY,ee=ie-A.current.x,te=O-A.current.y;F.current={x:ee,y:te};const ne=Math.max(0,Math.min(ie,j)),x=Math.max(0,Math.min(O,J)),T=Math.atan2(x-y,ne-B),I=70,Y=Math.atan2(0-y+I,0-B),re=Math.atan2(0-y+I,j-B),ce=Math.atan2(J-I-y,0-B),xe=Math.atan2(J-I-y,j-B);let se;T>=Y&&T<=re?se="top":T>=re&&T<=xe?se="right":T>=xe&&T<=ce?se="bottom":se="left";const Ee=Math.max(0,Math.min(100,ee/j*100)),Re=Math.max(0,Math.min(100,te/J*100));H.current({left:we(Ee),position:se,top:we(Re)})};return document.addEventListener("pointermove",m,{capture:!0,passive:!1}),document.addEventListener("pointerup",S,{capture:!0}),document.addEventListener("pointercancel",s,{capture:!0}),document.addEventListener("lostpointercapture",d,{capture:!0}),()=>{document.removeEventListener("pointermove",m,{capture:!0}),document.removeEventListener("pointerup",S,{capture:!0}),document.removeEventListener("pointercancel",s,{capture:!0}),document.removeEventListener("lostpointercapture",d,{capture:!0})}},[]);const k=l(q(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),D=l(q(()=>{if(t.minimizePanelInactive<0)return!1;if(t.minimizePanelInactive===0)return!0;const v=globalThis.window!==void 0&&("ontouchstart"in globalThis.window||(globalThis.navigator?.maxTouchPoints??0)>0);return!p&&!t.open&&!n&&!v&&t.minimizePanelInactive>0&&!E},[p,t.open,t.minimizePanelInactive,n,E]),"isHidden"),L=l(q(()=>{const v=e.current,C=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=k?S:C,d=k?C:S,m=t.left*a/100,b=t.top*o/100;switch(t.position){case"left":return{left:w.left+s-(D?30:0),top:de(b,d+w.top,o-d-w.bottom)};case"right":return{left:a-w.right-s+(D?15:0)-(D?0:10),top:de(b,d+w.top,o-d-w.bottom)};case"top":return{left:de(m,s+w.left,a-s-w.right),top:w.top+d-(D?30:0)};default:return{left:de(m,s+w.left,a-s-w.right),top:o-w.bottom-d+(D?30:0)}}},[t.left,t.open,t.position,t.top,o,a,w,e,D,k]),"anchorPos"),Q=l(q(()=>({left:`${L.left}px`,top:`${L.top}px`,transition:p?"none":"left 0.3s ease, top 0.3s ease"}),[L,p]),"anchorStyle"),X=l(q(()=>{const v=e.current,C=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=k?S:C,d=k?C:S,m={bottom:w.bottom+d,left:w.left+s,right:w.right+s,top:w.top+d},b=m.left+m.right,j=m.top+m.bottom,J=a-b,B=o-j,y={height:`min(${t.height}vh, calc(100vh - ${j}px))`,pointerEvents:p?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${b}px))`,zIndex:"-1"},ie=L,O=Math.min(J,t.width*a/100),ee=Math.min(B,t.height*o/100),te=ie?.left??0,ne=ie?.top??0;switch(t.position){case"bottom":case"top":{y.left="0",y.transform="translate(-50%, 0)",te-m.left<O/2?y.left=`${O/2-te+m.left}px`:a-te-m.right<O/2&&(y.left=`${a-te-O/2-m.right}px`);break}default:{y.top="0",y.transform="translate(0, -50%)",ne-m.top<ee/2?y.top=`${ee/2-ne+m.top}px`:o-ne-m.bottom<ee/2&&(y.top=`${o-ne-ee/2-m.bottom}px`);break}}switch(t.position){case"left":{y.left="0";break}case"right":{y.right="0";break}case"top":{y.top="0";break}default:{y.bottom="0";break}}return y},[L,p,w,t.height,t.position,t.width,o,a,e,k]),"iframeStyle"),W=l(q(()=>{const v={transform:k?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return p&&(v.transition="none !important"),v},[p,k]),"panelStyle");return{anchorStyle:Q,bringUp:G,iframeStyle:X,isDragging:p,isHidden:D,isVertical:k,onPointerDown:U,panelStyle:W}},Xe=({app:e})=>{const{toggleApp:t}=ke(),{isVisible:r,setHoveredApp:o}=be(),a=l(f(null),"buttonRef"),n=()=>{o(void 0),t(e.id).catch(u=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,u)})},c=()=>{!e.tooltip||r||o(e,a.current?.getBoundingClientRect())},p=()=>{e.tooltip&&o(void 0)};return i("button",{"aria-label":e.name,class:h("relative flex justify-center items-center","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-primary/8 hover:text-primary","active:scale-[0.94]",e.active&&"bg-primary/12 text-primary","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":e.id,onClick:n,onMouseEnter:c,onMouseLeave:p,ref:a,title:e.tooltip?void 0:e.name,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i("div",{class:"size-6 flex items-center justify-center [&_svg]:size-4.5",dangerouslySetInnerHTML:{__html:e.icon}}),e.notification.state&&i("span",{class:h("absolute -top-1 -right-1 size-1.5 rounded-full border border-background",e.notification.level==="error"&&"bg-destructive",e.notification.level==="warning"&&"bg-warning",(!e.notification.level||e.notification.level==="info")&&"bg-info"),"data-level":e.notification.level||"info"})]})})},Ce="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-chevron-right%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m9%2018%206-6-6-6%22%20%2F%3E%20%3C%2Fsvg%3E",$e="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-layers%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12.83%202.18a2%202%200%200%200-1.66%200L2.6%206.08a1%201%200%200%200%200%201.83l8.58%203.91a2%202%200%200%200%201.66%200l8.58-3.9a1%201%200%200%200%200-1.83z%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2012a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2012%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2017a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2017%22%20%2F%3E%20%3C%2Fsvg%3E",Je="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203H5a2%202%200%200%200-2%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208V5a2%202%200%200%200-2-2h-3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016v3a2%202%200%200%200%202%202h3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021h3a2%202%200%200%200%202-2v-3%22%20%2F%3E%20%3C%2Fsvg%3E",Oe="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%203h6v6%22%20%2F%3E%20%3Cpath%20d%3D%22m21%203-7%207%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2021H3v-6%22%20%2F%3E%20%3C%2Fsvg%3E",Ue="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203v3a2%202%200%200%201-2%202H3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208h-3a2%202%200%200%201-2-2V3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016h3a2%202%200%200%201%202%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021v-3a2%202%200%200%201%202-2h3%22%20%2F%3E%20%3C%2Fsvg%3E",Qe="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m14%2010%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M20%2010h-6V4%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M4%2014h6v6%22%20%2F%3E%20%3C%2Fsvg%3E",qe="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-picture-in-picture-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M21%209V6a2%202%200%200%200-2-2H4a2%202%200%200%200-2%202v10c0%201.1.9%202%202%202h4%22%20%2F%3E%20%3Crect%20width%3D%2210%22%20height%3D%227%22%20x%3D%2212%22%20y%3D%2213%22%20rx%3D%222%22%20%2F%3E%20%3C%2Fsvg%3E",Te="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-x%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M18%206%206%2018%22%20%2F%3E%20%3Cpath%20d%3D%22m6%206%2012%2012%22%20%2F%3E%20%3C%2Fsvg%3E",ze=({app:e})=>{const t=l(f(null),"contentRef"),r=l(f(!1),"initializedRef"),o=l(f(le()),"helpersRef");return _(()=>{if(!t.current||r.current||e.component||e.view?.type==="iframe")return;const a=t.current;if(e.init){const n=document.createElement("div");n.style.cssText="width:100%;height:100%;",a.append(n);const c=n.attachShadow({mode:"open"});ae&&(c.adoptedStyleSheets=[ae]);const p=le(),u=e.init(c,e.eventTarget,p);return u&&typeof u.then=="function"?u.then(()=>{r.current=!0}).catch(E=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,E)}):r.current=!0,()=>{for(;a.firstChild;)a.firstChild.remove();r.current=!1}}},[e]),e.view?.type==="iframe"?i("iframe",{class:"w-full h-full block border-0",src:e.view.src,title:e.name}):e.component?i(e.component,{eventTarget:e.eventTarget,helpers:o.current}):i("div",{class:"w-full h-full",ref:t})},Fe=e=>e==="error"?"bg-destructive":e==="warning"?"bg-warning":"bg-info",Ke=({apps:e,initialActiveAppId:t,onClose:r})=>{const[o,a]=l(N(t),"activeAppId"),[n,c]=l(N(!1),"sidebarCollapsed"),p=l(q(()=>e.find(u=>u.id===o),[e,o]),"activeApp");return g("div",{class:"flex flex-row w-full h-full bg-background font-mono antialiased text-foreground",children:[g("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 bg-accent border-r border-border/60","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",n?"w-12.5":"w-62.5"),children:[i("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",n?"justify-center px-2":"px-3"),children:n?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:e.filter(u=>u.component||u.init||u.view?.type==="iframe").map(u=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":u.name,"aria-pressed":o===u.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",n?"justify-center px-0":"gap-2.5 px-3",o===u.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:()=>{a(u.id)},type:"button",children:[u.icon?i("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",o===u.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:u.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:u.name.slice(0,2)}),!n&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:u.name})]}),u.notification.state&&i("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",n?"right-1.5":"right-2.5","size-1.5",Fe(u.notification.level))}),n&&i("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:u.name})})]},u.id))})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":n?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:()=>{c(u=>!u)},type:"button",children:i(K,{class:h("size-3.5 transition-transform duration-300",!n&&"rotate-180"),size:14,src:Ce})}),p?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:p.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),p?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),i("button",{"aria-label":"Close floating window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close floating window",type:"button",children:i(K,{size:12,src:Te})})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:p?i(ze,{app:p},p.id):i("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none text-muted-foreground",children:i("p",{class:"text-[0.8rem]",children:"Select a tool from the sidebar"})})})]})]})},ue=20,he=95,ge=(e,t,r)=>Math.min(Math.max(e,t),r),et=e=>{switch(e){case"bottom":return"bottom-14";case"left":return"left-14 top-4 bottom-4";case"right":return"right-14 top-4 bottom-4";case"top":return"top-14";default:return"bottom-14"}},tt=e=>{switch(e){case"bottom":return"origin-[bottom_center]";case"left":return"origin-[left_center]";case"right":return"origin-[right_center]";case"top":return"origin-[top_center]";default:return"origin-[bottom_center]"}},rt=(e,t)=>t?"opacity-100 scale-100":h("opacity-0 pointer-events-none scale-[0.99]",{bottom:"translate-y-2",left:"-translate-x-2",right:"translate-x-2",top:"-translate-y-2"}[e]??"translate-y-2"),it=({activeAppId:e,apps:t,onClose:r,onToggleApp:o,panelVisible:a,position:n})=>{const[c,p]=l(N(!1),"isRendered"),[u,E]=l(N(!1),"isVisible"),[z,A]=l(N(!1),"sidebarCollapsed"),[,F]=l(N(0),"rerender"),{state:V,updateState:M}=fe(),{resolvedTheme:Z}=Ae(),R=l(f(null),"panelDivRef"),P=l(f(!1),"isResizingRef"),H=l(f({height:V.height,width:V.width}),"dimensionsRef"),w=l(f(void 0),"enteringFromRectRef"),$=l(f(void 0),"lastDockedRectRef"),U=l(f(!1),"previousIsFullscreenRef"),G=l(f(!1),"isExitAnimatingRef"),k=l(f(void 0),"fsTimerRef"),D=V.viewMode==="fullscreen",L=V.viewMode==="wide",Q=globalThis.window?.documentPictureInPicture!==void 0,X=l(f(void 0),"pipWindowRef"),W=l(q(()=>{if(D)return{};const s=globalThis.window?.innerWidth??1920,d=globalThis.window?.innerHeight??1080,m=`${H.current.height/100*d}px`;return n==="left"||n==="right"?{width:`${H.current.width/100*s}px`}:{height:m,left:"50%",transform:"translateX(-50%)",width:L?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}},[D,L,n,F]),"panelSizeStyle");_(()=>{const s=m=>{if(!P.current||!R.current)return;const b=R.current.getBoundingClientRect(),j=window.innerWidth,J=window.innerHeight,B={...H.current};if(P.current.top){const y=Math.abs(b.bottom-m.clientY);B.height=ge(y/J*100,ue,he)}else if(P.current.bottom){const y=Math.abs(m.clientY-b.top);B.height=ge(y/J*100,ue,he)}else if(P.current.right){const y=Math.abs(m.clientX-b.left);B.width=ge(y/j*100,ue,he)}else if(P.current.left){const y=Math.abs(b.right-m.clientX);B.width=ge(y/j*100,ue,he)}H.current=B,F(y=>y+1)},d=()=>{P.current&&(M({height:H.current.height,width:H.current.width}),P.current=!1)};return globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",d),()=>{globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",d)}},[M]),Ve(()=>{const s=U.current;U.current=D,k.current!==void 0&&(clearTimeout(k.current),k.current=void 0);const d=R.current;if(d)if(D&&!s&&w.current){const m=w.current;w.current=void 0;const b=globalThis.window?.innerWidth??0,j=globalThis.window?.innerHeight??0;d.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",d.style.clipPath=`inset(${m.top}px ${b-m.right}px ${j-m.bottom}px ${m.left}px)`,requestAnimationFrame(()=>{d.style.clipPath="inset(0px 0px 0px 0px)",k.current=setTimeout(()=>{d.style.clipPath="",d.style.transition="",k.current=void 0},380)})}else!D&&s&&!G.current&&(d.style.transition="none",d.style.clipPath="",requestAnimationFrame(()=>{d.style.transition=""}))},[D]),_(()=>{if(a){p(!0);const d=setTimeout(E,16,!0);return()=>{clearTimeout(d)}}E(!1);const s=setTimeout(p,220,!1);return()=>{clearTimeout(s)}},[a]);const v=async()=>{const s=globalThis.window?.documentPictureInPicture;if(s)try{const d=await s.requestWindow({height:600,width:900});if(X.current=d,ae){const b=d.document.createElement("style");b.textContent=Array.from(ae.cssRules,j=>j.cssText).join(`
|
|
2
|
+
`),d.document.head.append(b)}const m=d.document.createElement("div");m.style.cssText="width:100%;height:100%;display:flex;",Z==="dark"&&(d.document.documentElement.classList.add("dark"),m.classList.add("dark")),d.document.body.style.cssText="margin:0;padding:0;height:100vh;",d.document.body.append(m),me(i(Ke,{apps:t,initialActiveAppId:e,onClose:()=>{d.close()}}),m),M({isPip:!0}),d.addEventListener("pagehide",()=>{M({isPip:!1}),X.current=void 0})}catch(d){console.error("[dev-toolbar] PiP activation failed:",d)}};_(()=>{if(!a)return;const s=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[a,r]);const C=l(q(()=>t.find(s=>s.id===e),[t,e]),"activeApp");if(!c)return;const S=s=>d=>{d.preventDefault(),P.current=s};return g(ve,{children:[i("div",{"aria-hidden":"true",class:h("fixed inset-0 z-[2147483646]","transition-opacity duration-200",u&&!D?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:V.closeOnOutsideClick?r:void 0,role:"presentation"}),g("div",{"aria-label":"DevTools panel","aria-modal":"true",class:h("fixed z-[2147483647] pointer-events-auto antialiased font-mono",D?"inset-0":et(n),"bg-background overflow-hidden",D?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!D&&tt(n),rt(n,u),"flex flex-row"),ref:R,role:"dialog",style:W,children:[!D&&g(ve,{children:[n!=="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 top-0 h-2.5 -mt-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({top:!0})}),n==="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 bottom-0 h-2.5 -mb-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({bottom:!0})}),n==="left"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 right-0 w-2.5 -mr-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({right:!0})}),n==="right"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 left-0 w-2.5 -ml-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({left:!0})})]}),g("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 overflow-hidden","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]","bg-accent border-r border-border/60",z?"w-12.5":"w-62.5"),children:[i("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",z?"justify-center px-2":"px-3"),children:z?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:t.filter(s=>s.component||s.init||s.view?.type==="iframe").map(s=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":s.name,"aria-pressed":e===s.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",z?"justify-center px-0":"gap-2.5 px-3",e===s.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:()=>{s.id!==e&&o(s.id).catch(console.error)},type:"button",children:[s.icon?i("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",e===s.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:s.name.slice(0,2)}),!z&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:s.name})]}),s.notification.state&&i("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",z?"right-1.5":"right-2.5","size-1.5",Fe(s.notification.level))}),z&&i("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:s.name})})]},s.id))}),!z&&i("div",{class:"px-3 py-2.5 border-t border-border/40 shrink-0",children:g("span",{class:"text-[0.58rem] text-muted-foreground/50 leading-none select-none",children:[V.keybindings?.toggle??"Alt+Shift+D"," to toggle"]})})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":z?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:()=>{A(s=>!s)},type:"button",children:i(K,{class:h("size-3.5 transition-transform duration-300",!z&&"rotate-180"),size:14,src:Ce})}),C?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:C.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),C?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),g("div",{class:"flex items-center gap-1 shrink-0",children:[(n==="bottom"||n==="top")&&!D&&i("button",{"aria-label":L?"Switch to container width":"Expand to full width",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:()=>{M({viewMode:L?"default":"wide"})},title:L?"Container width":"Full width",type:"button",children:i(K,{size:13,src:L?Qe:Oe})}),i("button",{"aria-label":D?"Exit fullscreen":"Enter fullscreen",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:()=>{if(D){const s=R.current,d=$.current;if(s&&d){const m=globalThis.window?.innerWidth??0,b=globalThis.window?.innerHeight??0,j=`inset(${d.top}px ${m-d.right}px ${b-d.bottom}px ${d.left}px)`;k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),G.current=!0,s.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",s.style.clipPath="inset(0px 0px 0px 0px)",requestAnimationFrame(()=>{s.style.clipPath=j,k.current=setTimeout(()=>{s.style.clipPath="",s.style.transition="",G.current=!1,k.current=void 0,M({viewMode:"default"})},380)})}else M({viewMode:"default"})}else{if(R.current){const s=R.current.getBoundingClientRect();w.current=s,$.current=s}M({viewMode:"fullscreen"})}},title:D?"Exit fullscreen":"Fullscreen",type:"button",children:i(K,{size:13,src:D?Ue:Je})}),Q&&!D&&i("button",{"aria-label":"Open in Picture-in-Picture window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent",V.isPip?"text-primary hover:bg-primary/7":"text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:()=>{v().then(()=>{r()}).catch(console.error)},title:"Open in floating window (PiP)",type:"button",children:i(K,{size:13,src:qe})}),i("button",{"aria-label":"Close DevTools panel",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close (Esc)",type:"button",children:i(K,{size:12,src:Te})})]})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:C?i(ze,{app:C},C.id):g("div",{class:"flex flex-col items-center justify-center h-full gap-7 p-8 select-none",children:[g("div",{class:"flex flex-col items-center gap-3",children:[i("div",{class:"size-14 border border-primary/25 bg-primary/5 flex items-center justify-center",children:i(K,{class:"text-primary/45",size:26,src:$e})}),g("div",{class:"text-center space-y-1",children:[i("p",{class:"text-[0.8rem] font-medium text-foreground/65",children:"No tool selected"}),i("p",{class:"text-[0.7rem] text-muted-foreground",children:"Choose a tool from the sidebar to get started"})]})]}),t.length>0&&g("div",{class:"w-full max-w-[220px]",children:[g("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-1.5",children:[i("span",{class:"text-primary/50",children:"// "}),"available"]}),i("div",{class:"flex flex-col gap-0.5",children:t.map(s=>g("button",{class:h("flex items-center gap-2.5 px-3 py-2","border border-border/40 bg-card/50","hover:border-primary/30 hover:bg-primary/4","cursor-pointer transition-all duration-150 text-left"),onClick:()=>o(s.id).catch(console.error),type:"button",children:[s.icon?i("span",{class:"size-3.5 shrink-0 flex items-center justify-center [&_svg]:size-3.5 text-muted-foreground",dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-3.5 text-[0.5rem] font-bold text-muted-foreground shrink-0 text-center",children:s.name.slice(0,2).toUpperCase()}),i("span",{class:"text-[0.75rem] font-medium text-muted-foreground",children:s.name})]},s.id))})]})]})})]})]})]})},nt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-alert-triangle%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%22%20%2F%3E%20%3Cpath%20d%3D%22M12%209v4%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2017h.01%22%20%2F%3E%20%3C%2Fsvg%3E",ot=()=>{const[e,t]=l(N(0),"errorCount"),[r,o]=l(N(!1),"isOverlayOpen");if(_(()=>{const c=()=>{const u=globalThis.__v_o_error_history,E=Array.isArray(u)?u.length:0;t(E);const z=globalThis.__v_o__current;if(z?.parentNode){const A=z.shadowRoot?.querySelector("#__v_o__root");o(!!A&&!A.classList.contains("hidden"))}else o(!1)},p=setInterval(c,300);return c(),()=>{clearInterval(p)}},[]),e===0)return;const a=()=>{const c=globalThis.__v_o__current;if(!c?.parentNode)return;const p=c.shadowRoot?.querySelector("#__v_o__root");p?.classList.contains("hidden")?(p.classList.remove("hidden"),o(!0)):typeof c.close=="function"&&(c.close(),o(!1))},n=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return g(ve,{children:[i("div",{"aria-hidden":"true",class:"w-px h-5 bg-primary/20 shrink-0 mx-0.5"}),i("button",{"aria-label":n,class:h("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-destructive","transition-all duration-150","hover:bg-destructive/8","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),onClick:a,title:n,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i(K,{size:16,src:nt}),i("span",{class:"absolute -top-0.5 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-destructive text-white text-[9px] font-bold leading-none flex items-center justify-center border border-background",children:e>9?"9+":e})]})})]})},at=()=>{const{apps:e}=ke();return i("div",{class:"flex items-center pointer-events-auto",id:"__v_dt__bar",children:g("div",{class:"flex flex-row items-center justify-start gap-1",id:"__v_dt__bar_container",children:[e.map(t=>i(Xe,{app:t},t.id)),i(ot,{})]})})},st="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",lt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2010.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h12a1%201%200%200%200%201-1v-.76a2%202%200%200%200-1.11-1.79l-1.78-.9A2%202%200%200%201%2015%2010.76V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H8a2%202%200%200%200%200%204%201%201%200%200%201%201%201z%22%20%2F%3E%20%3C%2Fsvg%3E",ct=(e,t)=>{switch(t){case"left":return{left:`${e.right+10}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"right":return{right:`${globalThis.window?globalThis.window.innerWidth-e.left+10:0}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"top":return{left:`${e.left+e.width/2}px`,top:`${e.bottom+10}px`,transform:"translateX(-50%)"};default:return{bottom:`${globalThis.window?globalThis.window.innerHeight-e.top+10:0}px`,left:`${e.left+e.width/2}px`,transform:"translateX(-50%)"}}},dt=({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:o,setHoveredApp:a}=be(),n=l(f(null),"overlayRef"),c=l(f(le()),"helpersRef"),[p,u]=l(N(!1),"isRendered"),[E,z]=l(N(!1),"isVisible"),A=!!(t?.tooltip&&r);if(_(()=>{if(A){u(!0);const P=setTimeout(z,16,!0);return()=>{clearTimeout(P)}}z(!1);const R=setTimeout(u,200,!1);return()=>{clearTimeout(R)}},[A]),!p||!t?.tooltip||!r)return;const F=t.tooltip,V=ct(r,e),M=e==="left"||e==="right",Z=()=>{const R=n.current?.getBoundingClientRect();R&&o(t,R.left,R.top),a(void 0)};return g("div",{"aria-label":`${t.name} quick preview`,class:h("fixed z-[2147483647] pointer-events-auto","antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-border shadow-2xl","transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]",E?"opacity-100 translate-y-0 scale-100":h("opacity-0 scale-[0.97]",e==="bottom"&&"translate-y-1",e==="top"&&"-translate-y-1",M&&"translate-x-[-2px]")),onMouseEnter:()=>{a(t,r)},onMouseLeave:()=>{a(void 0)},ref:n,role:"tooltip",style:V,children:[g("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-foreground/3",children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-muted-foreground truncate",children:t.name})]}),i("button",{"aria-label":`Pin ${t.name} tooltip`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/60 hover:text-primary","transition-colors duration-150"),onClick:Z,title:"Pin (keep visible)",type:"button",children:i(K,{size:11,src:lt})})]}),i("div",{class:"p-3",children:i(F,{helpers:c.current})})]})},pt=e=>{switch(e){case"left":return{left:"0",top:"50%",transform:"translateX(24px) translateY(-50%)"};case"right":return{left:"0",top:"50%",transform:"translateX(calc(-100% - 24px)) translateY(-50%)"};case"top":return{left:"50%",top:"0",transform:"translateX(-50%) translateY(24px)"};default:return{left:"50%",top:"0",transform:"translateX(-50%) translateY(calc(-100% - 24px))"}}},ut=({position:e})=>{const t="absolute w-2.5 h-2.5 bg-card border-border";switch(e){case"left":return i("div",{"aria-hidden":"true",class:h(t,"left-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-b border-l")});case"right":return i("div",{"aria-hidden":"true",class:h(t,"right-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-t border-r")});case"top":return i("div",{"aria-hidden":"true",class:h(t,"top-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-t border-l")});default:return i("div",{"aria-hidden":"true",class:h(t,"bottom-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-b border-r")})}},ht=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],gt=({onDismiss:e,position:t})=>{const[r,o]=l(N(!1),"visible"),a=l(f(void 0),"dismissTimeoutRef");_(()=>{const c=setTimeout(o,600,!0);return()=>{clearTimeout(c)}},[]),_(()=>()=>{a.current!==void 0&&(clearTimeout(a.current),a.current=void 0)},[]);const n=()=>{o(!1),a.current=setTimeout(e,180)};return g("div",{"aria-hidden":!r,"aria-label":"DevTools quick start",class:h("absolute pointer-events-auto","w-[240px]","bg-card border border-border","shadow-xl","p-3","font-mono","transition-all duration-200",r?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),style:pt(t),children:[i(ut,{position:t}),g("p",{class:"flex items-center gap-1.5 mb-2.5",children:[i("span",{"aria-hidden":"true",class:"text-primary text-[0.6rem]",children:"▶"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.12em] text-foreground",children:"Quick start"})]}),i("ul",{class:"space-y-1.5 mb-3 list-none p-0 m-0",children:ht.map(({icon:c,text:p})=>g("li",{class:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[i("span",{"aria-hidden":"true",class:"text-primary shrink-0 w-3 text-center leading-none",children:c}),p]},p))}),i("button",{class:h("w-full h-6 text-[0.6rem] font-bold uppercase tracking-[0.1em]","border border-primary/30 bg-primary/6","text-primary cursor-pointer","hover:bg-primary/12 hover:border-primary/50","transition-all duration-150 active:scale-[0.98]"),onClick:n,tabIndex:r?void 0:-1,type:"button",children:"Got it"})]})},ft="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M15%209.34V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H7.89%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3Cpath%20d%3D%22M9%209v1.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h11%22%20%2F%3E%20%3C%2Fsvg%3E",mt=({onMove:e,onUnpin:t,pinned:r})=>{const o=l(f(null),"cardRef"),a=l(f(null),"headerRef"),n=l(f({x:r.initialX,y:r.initialY}),"posRef"),c=l(f(void 0),"dragRef"),p=l(f(le()),"helpersRef"),u=l(f(e),"onMoveRef"),E=l(f(r.id),"pinnedIdRef");u.current=e,E.current=r.id,_(()=>{const F="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",V=Z=>{if(!c.current||!o.current)return;const R=globalThis.window?.innerWidth??9999,P=globalThis.window?.innerHeight??9999,{cardH:H,cardW:w}=c.current,$=Math.min(80,w),U=Math.min(36,H);let G=c.current.origX+(Z.clientX-c.current.startX),k=c.current.origY+(Z.clientY-c.current.startY);G=Math.max($-w,Math.min(R-$,G)),k=Math.max(U-H,Math.min(P-U,k));const D=[0,R-w,$-w,R-$],L=[0,P-H,U-H,P-U];let Q=G,X=k;for(const W of D)if(Math.abs(G-W)<28){Q=W;break}for(const W of L)if(Math.abs(k-W)<28){X=W;break}o.current.style.transition=Q!==G||X!==k?F:"",o.current.style.transform=`translate(${Q}px, ${X}px)`,n.current={x:Q,y:X}},M=()=>{c.current&&(c.current=void 0,o.current&&(o.current.style.transition=""),a.current&&(a.current.style.cursor=""),u.current(E.current,n.current.x,n.current.y))};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",M)}},[]);const z=r.app.tooltip;if(!z)return;const A=F=>{F.button===0&&(c.current={cardH:o.current?.offsetHeight??200,cardW:o.current?.offsetWidth??300,origX:n.current.x,origY:n.current.y,startX:F.clientX,startY:F.clientY},a.current&&(a.current.style.cursor="grabbing"),F.preventDefault())};return g("div",{"aria-label":`${r.app.name} pinned tooltip`,class:h("fixed z-[2147483647] pointer-events-auto antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-primary/40 shadow-2xl"),ref:o,style:{left:0,top:0,transform:`translate(${n.current.x}px, ${n.current.y}px)`},children:[g("div",{class:h("flex items-center justify-between gap-2 px-3 py-2","border-b border-primary/20 bg-primary/4","select-none cursor-grab"),onMouseDown:A,ref:a,children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-primary/70 truncate",children:r.app.name})]}),i("button",{"aria-label":`Unpin ${r.app.name}`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/50 hover:text-destructive","transition-colors duration-150"),onClick:()=>{t(r.id)},onMouseDown:F=>{F.stopPropagation()},title:"Unpin",type:"button",children:i(K,{size:11,src:ft})})]}),i("div",{class:"p-3",children:i(z,{helpers:p.current})})]})},ye="__v_dt__pinned_tooltips",vt=(e,t,r,o,a)=>{const n=t*o/100,c=r*a/100,p=o/4;switch(e){case"bottom":return n<p?"bottom-left":n>o-p?"bottom-right":"bottom-center";case"left":return c<a/2?"top-left":"bottom-left";case"right":return c<a/2?"top-right":"bottom-right";case"top":return n<p?"top-left":n>o-p?"top-right":"top-center";default:return"bottom-center"}},bt=({activeAppId:e,apps:t,onClearNotification:r,onRegisterApp:o,onSetNotification:a,onToggleApp:n,onUnregisterApp:c})=>{const p=l(f(null),"anchorRef"),u=l(f(null),"panelRef"),E=l(f(void 0),"leaveTimerRef"),{resolvedTheme:z}=Ae(),{state:A,updateState:F}=fe(),{closePanel:V,panelVisible:M,togglePanelVisible:Z}=Be(),{anchorStyle:R,bringUp:P,isDragging:H,isHidden:w,isVertical:$,onPointerDown:U,panelStyle:G}=Ye(u),[k,D]=l(N(void 0),"hoveredApp"),[L,Q]=l(N(void 0),"hoveredAppRect"),X=l(f(new Map),"pinPositionsRef"),W=oe(x=>{try{const T=x.map(I=>{const Y=X.current.get(I.id);return{appId:I.app.id,x:Y?.x??I.initialX,y:Y?.y??I.initialY}});localStorage.setItem(ye,JSON.stringify(T))}catch{}},[]),[v,C]=l(N([]),"pinnedTooltips"),S=l(f([]),"pinnedTooltipsRef");S.current=v;const s=oe((x,T,I)=>{const Y=`${x.id}-${Date.now()}`;C(re=>{const ce=[...re,{app:x,id:Y,initialX:T,initialY:I}];return W(ce),ce})},[W]),d=oe(x=>{C(T=>{const I=T.filter(Y=>Y.id!==x);return X.current.delete(x),W(I),I})},[W]),m=oe((x,T,I)=>{X.current.set(x,{x:T,y:I}),W(S.current)},[W]),b=l(f(void 0),"storedPinsRef"),j=l(f(new Set),"restoredAppIdsRef");_(()=>{if(t.length===0)return;if(b.current===void 0)try{const I=localStorage.getItem(ye);b.current=I?JSON.parse(I):[]}catch{b.current=[]}const x=b.current;if(x.length===0)return;const T=[];for(const I of x){if(j.current.has(I.appId))continue;const Y=t.find(re=>re.id===I.appId&&re.tooltip);Y&&(j.current.add(I.appId),T.push({app:Y,id:`${Y.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:I.x,initialY:I.y}))}T.length>0&&C(I=>[...I,...T])},[t]),_(()=>()=>{E.current!==void 0&&clearTimeout(E.current)},[]);const J=oe((x,T)=>{E.current!==void 0&&(clearTimeout(E.current),E.current=void 0),x?(D(x),Q(T)):E.current=setTimeout(()=>{D(void 0),Q(void 0),E.current=void 0},180)},[]),B=l(f(t),"appsRef");B.current=t;const y=l(f(M),"panelVisibleRef");y.current=M;const ie=l(f(e),"activeAppIdRef");ie.current=e;const O=l(f(n),"onToggleAppRef");O.current=n;const ee=l(q(()=>{const x=globalThis.window?.innerWidth??1920,T=globalThis.window?.innerHeight??1080;return vt(A.position,A.left,A.top,x,T)},[A.left,A.position,A.top]),"placement"),te=oe(async x=>{const T=y.current,I=ie.current,Y=B.current.find(re=>re.id===x);if(Y?.onClick??Y?.onDeactivate){await O.current(x);return}if(x===I&&T){await O.current(x),F({open:!1,viewMode:"default"});return}x!==I&&await O.current(x),T||F({open:!0})},[F]),ne={activeAppId:e,apps:t,clearNotification:r,hoveredApp:k,hoveredAppRect:L,isDragging:H,isVisible:M,pinnedTooltips:v,pinTooltip:s,placement:ee,registerApp:o,setDragging:()=>{},setHoveredApp:J,setNotification:a,setPlacement:()=>{},setVisible:x=>{F({open:x})},toggleApp:te,unpinTooltip:d,unregisterApp:c};if(!(!A.preferShowFloatingPanel&&!M))return i(Me.Provider,{value:ne,children:g("div",{class:h(z==="dark"&&"dark"),style:{display:"contents"},children:[g("div",{class:h("fixed z-[2147483647]","pointer-events-auto","origin-center","transition-[left_0.3s_cubic-bezier(0.4,0,0.2,1),top_0.3s_cubic-bezier(0.4,0,0.2,1)]","data-[dragging]:transition-none!","group","toolbar-font text-[13px]! leading-[1.6]! antialiased box-border [&_*]:box-border print:hidden",A.reduceMotion&&"transition-none! animate-none! [&_*]:transition-none! [&_*]:animate-none!"),"data-dragging":H?"":void 0,"data-placement":ee,id:"__v_dt__root",onMouseMove:P,ref:p,style:R,children:[g("div",{class:h("group/panel","absolute left-0 top-0","flex flex-row justify-start items-center","gap-1 p-1","box-border","overflow-hidden","rounded-none","text-foreground select-none",H?"cursor-grabbing":"cursor-grab","bg-background border-0",$?"shadow-pill-vertical!":"shadow-pill",w?"max-w-12!":"","transition-pill"),"data-vertical":$||void 0,onPointerDown:x=>{A.isFirstVisit&&F({isFirstVisit:!1}),U(x)},ref:u,style:G,children:[i("button",{"aria-label":"Toggle devtools panel",class:h("size-8 flex justify-center items-center shrink-0","cursor-pointer p-0 m-0 border-0","bg-transparent","transition-all duration-150","hover:bg-primary/8 active:scale-[0.95]","group-data-[vertical]/panel:rotate-[-90deg]",M?"opacity-100":"opacity-60"),onClick:x=>{x.stopPropagation(),A.isFirstVisit&&F({isFirstVisit:!1}),Z()},title:"Toggle devtools panel",type:"button",children:i("img",{alt:"Visulima",class:"size-6",src:st})}),i("div",{"aria-hidden":"true",class:h("w-px h-5 bg-primary/20 shrink-0",w&&"hidden")}),i("div",{class:h("px-0.5",w&&"hidden"),children:i(at,{})})]}),A.isFirstVisit&&i(gt,{onDismiss:()=>{F({isFirstVisit:!1})},position:A.position})]}),i(it,{activeAppId:e,apps:t,onClose:V,onToggleApp:n,panelVisible:M,position:A.position}),i(dt,{position:A.position}),v.map(x=>i(mt,{onMove:m,onUnpin:d,pinned:x},x.id))]})})},xt=(e,t)=>{const r=De(),o=Pe();if(!o)throw new Error("Global hook not initialized");return{clearNotification(a){e.clearNotification(a)},async closeApp(){const a=e.getActiveApp();a&&await e.toggleApp(a.id)},getActiveApp(){return e.getActiveApp()?.id},getApps(){return e.getApps()},getSettings(){return Ie()},hide(){t.hide()},hook:o,notify(a,n){e.setNotification(a,!0,n)},async openApp(a){await e.toggleApp(a)},registerApp(a){e.registerApp(a)},rpc:new Proxy({},{get(a,n){return(...c)=>r.callServer(n,...c)}}),setAppActive(a,n){e.setAppActive(a,n)},show(){t.show()},toggle(){t.toggle()},unregisterApp(a){e.unregisterApp(a)},updateSettings(a){Se(a)},version:"0.0.0"}},wt=e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)};class yt extends HTMLElement{appManager;hasBeenInitialized=!1;renderRoot=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new Le}connectedCallback(){if(document.querySelectorAll("dev-toolbar").length>1){console.warn("[dev-toolbar] Only one instance is allowed. Removing duplicate."),this.remove();return}this.hasBeenInitialized&&this.shadowRoot&&!this.renderRoot&&this.render()}disconnectedCallback(){this.renderRoot&&(me(null,this.renderRoot),this.renderRoot=void 0)}init(){if(this.hasBeenInitialized)return;this.hasBeenInitialized=!0;const t=_e(n=>{this.appManager.registerApp(n),this.render()},(n,c)=>{He().addEvent(n,c)}),r=xt({clearNotification:n=>{this.appManager.clearNotification(n),this.render()},getActiveApp:()=>this.appManager.getActiveApp(),getApps:()=>this.appManager.getAllApps(),registerApp:n=>{this.appManager.registerApp(n),this.render()},setAppActive:(n,c)=>{this.appManager.setAppActive(n,c),this.render()},setNotification:(n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},toggleApp:n=>this.appManager.toggleApp(n),unregisterApp:n=>{this.appManager.unregisterApp(n),this.render()}},{hide:()=>{this.setToolbarVisible(!1)},show:()=>{this.setToolbarVisible(!0)},toggle:()=>{const n=this.isHidden();this.setToolbarVisible(!n)}});wt(r),t.emit("devtools:init");const o=Ie(),a=this.appManager.getAllApps().find(n=>n.defaultOpen);a&&!this.appManager.getActiveApp()&&this.appManager.openApp(a.id).catch(n=>{console.error(`[dev-toolbar] Failed to auto-open defaultOpen app ${a.id}:`,n)}),this.render(),this.setupEventListeners(),o.defaultVisible&&this.setToolbarVisible(!0)}isHidden(){return this.shadowRoot.querySelector("#__v_dt__root")?.hasAttribute("data-hidden")??!0}setToolbarVisible(t){const r=this.shadowRoot.querySelector("#__v_dt__root");r&&(t?delete r.dataset.hidden:r.dataset.hidden=""),this.render()}registerApp(t,r=!1){this.appManager.registerApp(t,r),this.render()}getAppManager(){return this.appManager}render(){const t=this.appManager.getAllApps(),r=this.shadowRoot;ae&&(r.adoptedStyleSheets=[ae]);let o=r.querySelector("style");o||(o=document.createElement("style"),o.textContent=`
|
|
3
3
|
:host {
|
|
4
4
|
all: initial;
|
|
5
5
|
/* Cover the full viewport so the host establishes a stacking context
|
|
@@ -18,4 +18,4 @@ var Xe=Object.defineProperty;var N=(e,t)=>Xe(e,"name",{value:t,configurable:!0})
|
|
|
18
18
|
display: none;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,r.append(o)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const a=this.appManager.getActiveApp()?.id;
|
|
21
|
+
`,r.append(o)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const a=this.appManager.getActiveApp()?.id;me(i(bt,{activeAppId:a,apps:t,onClearNotification:n=>{this.appManager.clearNotification(n),this.render()},onRegisterApp:n=>{this.render()},onSetNotification:(n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},onToggleApp:async n=>{await this.appManager.toggleApp(n),this.render()},onUnregisterApp:n=>{this.appManager.unregisterApp(n),this.render()}}),this.renderRoot)}setupEventListeners(){document.addEventListener("keyup",t=>{if(t.key!=="Escape"||this.isHidden())return;const r=this.appManager.getActiveApp();r?this.appManager.toggleApp(r.id).then(()=>{this.render()}).catch(o=>{console.error("[dev-toolbar] Error toggling app:",o)}):this.setToolbarVisible(!1)})}}if(globalThis.window!==void 0&&(customElements.get("dev-toolbar")||customElements.define("dev-toolbar",yt),!customElements.get("dev-toolbar-app-canvas"))){class e extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}}customElements.define("dev-toolbar-app-canvas",e)}export{yt as DevToolbar,ae as sharedToolbarStylesheet};
|