@visulima/dev-toolbar 1.0.0-alpha.2 → 1.0.0-alpha.20

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +249 -0
  2. package/LICENSE.md +137 -5
  3. package/README.md +70 -43
  4. package/bin/mcp.js +29 -0
  5. package/dist/apps/a11y/index.d.ts +3 -2
  6. package/dist/apps/a11y/index.js +3 -3
  7. package/dist/apps/annotations/index.d.ts +4 -0
  8. package/dist/apps/annotations/index.js +18 -0
  9. package/dist/apps/assets/index.d.ts +4 -0
  10. package/dist/apps/assets/index.js +16 -0
  11. package/dist/apps/inspector/index.d.ts +4 -0
  12. package/dist/apps/inspector/index.js +30 -0
  13. package/dist/apps/module-graph/index.d.ts +3 -2
  14. package/dist/apps/module-graph/index.js +2 -2
  15. package/dist/apps/performance/index.d.ts +3 -2
  16. package/dist/apps/performance/index.js +2 -2
  17. package/dist/apps/seo/index.d.ts +3 -2
  18. package/dist/apps/seo/index.js +2 -2
  19. package/dist/apps/settings/index.d.ts +3 -2
  20. package/dist/apps/settings/index.js +2 -2
  21. package/dist/apps/tailwind/index.d.ts +4 -0
  22. package/dist/apps/tailwind/index.js +7 -0
  23. package/dist/apps/timeline/index.d.ts +3 -2
  24. package/dist/apps/timeline/index.js +2 -2
  25. package/dist/apps/vite-config/index.d.ts +3 -2
  26. package/dist/apps/vite-config/index.js +2 -2
  27. package/dist/client/overlay.d.ts +1 -1
  28. package/dist/client/overlay.js +1 -1
  29. package/dist/index.d.ts +143 -6
  30. package/dist/index.js +1 -1
  31. package/dist/mcp/server.d.ts +2 -0
  32. package/dist/mcp/server.js +1 -0
  33. package/dist/packem_chunks/inject-source.js +9 -0
  34. package/dist/packem_shared/Alert-D2CvX4fw.js +1 -0
  35. package/dist/packem_shared/Badge-BEgU04nl.js +1 -0
  36. package/dist/packem_shared/Button-Bkx66Co7.js +1 -0
  37. package/dist/packem_shared/Card-CJa4vHVc.js +1 -0
  38. package/dist/packem_shared/Icon-B6UHkC0o.js +1 -0
  39. package/dist/packem_shared/Input-Cs6aduTi.js +1 -0
  40. package/dist/packem_shared/Label-DyCng4Cp.js +1 -0
  41. package/dist/packem_shared/Popover-BtFVaZYg.js +1 -0
  42. package/dist/packem_shared/Progress-DN6zn-0l.js +1 -0
  43. package/dist/packem_shared/Select-DgQ4ss-s.js +1 -0
  44. package/dist/packem_shared/Separator-D38mKeZv.js +1 -0
  45. package/dist/packem_shared/Skeleton-Dv-tcA1P.js +1 -0
  46. package/dist/packem_shared/Switch-C3NTpeoR.js +1 -0
  47. package/dist/packem_shared/Tabs-DKWMiawt.js +1 -0
  48. package/dist/packem_shared/Textarea-Yfg3dLZi.js +1 -0
  49. package/dist/packem_shared/Tooltip-CioncSXj.js +1 -0
  50. package/dist/packem_shared/annotation-settings-Bv0TH4WI.js +1 -0
  51. package/dist/packem_shared/annotation-store-bLQRYMaI.js +1 -0
  52. package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
  53. package/dist/packem_shared/clsx-wGlvpUfw.js +1 -0
  54. package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +1 -0
  55. package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +1 -0
  56. package/dist/packem_shared/createServerRPCContext-D-yZrEjs.js +1 -0
  57. package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +1 -0
  58. package/dist/packem_shared/global-api.d-BLfn-OUA.d.ts +547 -0
  59. package/dist/packem_shared/{setupGlobalHook-CFuxsCyl.js → setupGlobalHook-CCf9Logv.js} +1 -1
  60. package/dist/packem_shared/sharedToolbarStylesheet-Bx1muJAh.js +2 -0
  61. package/dist/packem_shared/store-DaUtLjf3.js +1 -0
  62. package/dist/packem_shared/use-frame-state-CxrlPUM5.js +1 -0
  63. package/dist/packem_shared/use-theme-zpm4zmqP.js +1 -0
  64. package/dist/toolbar/index.d.ts +152 -56
  65. package/dist/toolbar/index.js +3 -4
  66. package/dist/ui/index.d.ts +382 -0
  67. package/dist/ui/index.js +1 -0
  68. package/dist/vite-plugin.d.ts +155 -103
  69. package/dist/vite-plugin.js +5 -2
  70. package/package.json +53 -14
  71. package/dist/apps/a11y/a11y-app.d.ts +0 -5
  72. package/dist/apps/a11y/a11y-store.d.ts +0 -46
  73. package/dist/apps/a11y/a11y-tooltip.d.ts +0 -11
  74. package/dist/apps/module-graph/module-graph-app.d.ts +0 -5
  75. package/dist/apps/more/index.d.ts +0 -3
  76. package/dist/apps/more/index.js +0 -19
  77. package/dist/apps/more/more-app.d.ts +0 -5
  78. package/dist/apps/performance/performance-app.d.ts +0 -5
  79. package/dist/apps/performance/performance-tooltip.d.ts +0 -5
  80. package/dist/apps/seo/seo-app.d.ts +0 -5
  81. package/dist/apps/settings/settings-app.d.ts +0 -5
  82. package/dist/apps/timeline/timeline-app.d.ts +0 -5
  83. package/dist/apps/vite-config/vite-config-app.d.ts +0 -5
  84. package/dist/hooks/create-hook.d.ts +0 -10
  85. package/dist/hooks/events.d.ts +0 -5
  86. package/dist/hooks/global-hook.d.ts +0 -15
  87. package/dist/hooks/index.d.ts +0 -6
  88. package/dist/packem_shared/TimelineStore-BgBrirKd.js +0 -1
  89. package/dist/packem_shared/cn-BEsR6GkP.js +0 -1
  90. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +0 -1
  91. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +0 -1
  92. package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +0 -1
  93. package/dist/packem_shared/icon-BUQ92HaT.js +0 -1
  94. package/dist/packem_shared/store-BxE0w51s.js +0 -1
  95. package/dist/performance/monitor.d.ts +0 -115
  96. package/dist/rpc/client.d.ts +0 -7
  97. package/dist/rpc/functions/module-graph.d.ts +0 -17
  98. package/dist/rpc/functions/open-in-editor.d.ts +0 -9
  99. package/dist/rpc/functions/vite-config.d.ts +0 -7
  100. package/dist/rpc/index.d.ts +0 -8
  101. package/dist/rpc/server.d.ts +0 -9
  102. package/dist/timeline/index.d.ts +0 -6
  103. package/dist/timeline/store.d.ts +0 -52
  104. package/dist/toolbar/app-manager.d.ts +0 -95
  105. package/dist/toolbar/components/app-button.d.ts +0 -19
  106. package/dist/toolbar/components/app-canvas.d.ts +0 -13
  107. package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -13
  108. package/dist/toolbar/components/first-visit-hint.d.ts +0 -16
  109. package/dist/toolbar/components/index.d.ts +0 -4
  110. package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -23
  111. package/dist/toolbar/components/toolbar-bar.d.ts +0 -15
  112. package/dist/toolbar/components/toolbar-container.d.ts +0 -55
  113. package/dist/toolbar/components/vite-overlay-button.d.ts +0 -15
  114. package/dist/toolbar/context/index.d.ts +0 -2
  115. package/dist/toolbar/context/toolbar-context.d.ts +0 -106
  116. package/dist/toolbar/global-api.d.ts +0 -23
  117. package/dist/toolbar/helpers.d.ts +0 -6
  118. package/dist/toolbar/hooks/index.d.ts +0 -10
  119. package/dist/toolbar/hooks/use-apps.d.ts +0 -13
  120. package/dist/toolbar/hooks/use-frame-state.d.ts +0 -94
  121. package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -21
  122. package/dist/toolbar/hooks/use-position.d.ts +0 -22
  123. package/dist/toolbar/hooks/use-theme.d.ts +0 -13
  124. package/dist/toolbar/hooks/use-toolbar.d.ts +0 -14
  125. package/dist/toolbar/settings.d.ts +0 -17
  126. package/dist/toolbar/stylesheet.d.ts +0 -1
  127. package/dist/toolbar/utils/index.d.ts +0 -12
  128. package/dist/types/app.d.ts +0 -163
  129. package/dist/types/global-api.d.ts +0 -95
  130. package/dist/types/hooks.d.ts +0 -88
  131. package/dist/types/index.d.ts +0 -12
  132. package/dist/types/messaging.d.ts +0 -43
  133. package/dist/types/rpc.d.ts +0 -95
  134. package/dist/types/timeline.d.ts +0 -62
  135. package/dist/types/toolbar.d.ts +0 -56
  136. package/dist/ui/components/icon.d.ts +0 -21
  137. package/dist/utils/cn.d.ts +0 -8
package/bin/mcp.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * MCP server for `@visulima/dev-toolbar` annotations.
5
+ *
6
+ * Usage:
7
+ * npx visulima-dev-toolbar-mcp
8
+ *
9
+ * Configure in .mcp.json:
10
+ * {
11
+ * "mcpServers": {
12
+ * "dev-toolbar": {
13
+ * "command": "npx",
14
+ * "args": ["visulima-dev-toolbar-mcp"],
15
+ * "cwd": "/absolute/path/to/project"
16
+ * }
17
+ * }
18
+ * }
19
+ *
20
+ * Requires @modelcontextprotocol/sdk to be installed.
21
+ */
22
+
23
+ // eslint-disable-next-line antfu/no-import-dist -- bin entry point runs after build
24
+ import { startMcpServer } from "../dist/mcp/server";
25
+
26
+ startMcpServer().catch((error) => {
27
+ console.error("Failed to start MCP server:", error);
28
+ process.exit(1);
29
+ });
@@ -1,3 +1,4 @@
1
- import type { DevToolbarApp } from "../../types/app.d.ts";
1
+ import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
2
+ import 'preact';
2
3
  declare const a11yApp: DevToolbarApp;
3
- export default a11yApp;
4
+ export { a11yApp as default };
@@ -1,4 +1,4 @@
1
- var K=Object.defineProperty;var C=(o,e)=>K(o,"name",{value:e,configurable:!0});import{addHookName as v}from"preact/devtools";import{useState as S,useEffect as U}from"preact/hooks";import{m as u}from"../../packem_shared/cn-BEsR6GkP.js";import{jsxs as a,jsx as t,Fragment as G}from"preact/jsx-runtime";const Q=`<!-- @license lucide-static v0.575.0 - ISC -->
1
+ var X=Object.defineProperty;var O=(a,e)=>X(a,"name",{value:e,configurable:!0});import{addHookName as k}from"preact/devtools";import{clsx as d}from"../../packem_shared/clsx-wGlvpUfw.js";import{useState as C,useEffect as L}from"preact/hooks";import{jsxs as i,jsx as t,Fragment as W}from"preact/jsx-runtime";import w from"../../packem_shared/Button-Bkx66Co7.js";import{Alert as Y,AlertDescription as Z}from"../../packem_shared/Alert-D2CvX4fw.js";const ee=`<!-- @license lucide-static v1.14.0 - ISC -->
2
2
  <svg
3
3
  class="lucide lucide-accessibility"
4
4
  xmlns="http://www.w3.org/2000/svg"
@@ -17,5 +17,5 @@ var K=Object.defineProperty;var C=(o,e)=>K(o,"name",{value:e,configurable:!0});i
17
17
  <path d="M4.24 14.5a5 5 0 0 0 6.88 6" />
18
18
  <path d="M13.76 17.5a5 5 0 0 0-6.88-6" />
19
19
  </svg>
20
- `;var X=Object.defineProperty,b=C((o,e)=>X(o,"name",{value:e,configurable:!0}),"i$2");const M=["critical","serious","moderate","minor"],Z={critical:"rgb(239,68,68)",minor:"rgb(100,116,139)",moderate:"rgb(249,115,22)",serious:"rgb(234,179,8)"},ee={"best-practice":["best-practice"],wcag21aa:["wcag2a","wcag2aa","wcag21a","wcag21aa"],wcag22aa:["wcag2a","wcag2aa","wcag21a","wcag21aa","wcag22a","wcag22aa"],wcag2a:["wcag2a"]},H="__vdt_a11y__",te=b(()=>{try{const o=sessionStorage.getItem(H);if(o){const e=JSON.parse(o);if(Array.isArray(e.issues))return{issues:e.issues,lastScan:e.lastScan??null}}}catch{}return{issues:[],lastScan:null}},"loadFromSession"),_=b((o,e)=>{const s=o;s.dataset.vdtA11y=e,s.style.setProperty("outline",`2px solid ${Z[e]}`,"important"),s.style.setProperty("outline-offset","2px","important")},"setHighlight"),E=b(()=>{for(const o of document.querySelectorAll("[data-vdt-a11y]")){const e=o;delete e.dataset.vdtA11y,e.style.removeProperty("outline"),e.style.removeProperty("outline-offset")}},"clearHighlightsDOM"),B=b(o=>{E();for(const e of o)for(const s of e.nodes)try{const r=document.querySelector(s.selector);r&&_(r,e.impact)}catch{}},"applyOverlaysDOM"),re=b(o=>{const e=o[o.length-1];return Array.isArray(e)?e.join(" "):String(e??"")},"nodeSelector"),ne=b((o,e)=>{const s=[];for(const r of o)e.includes(r.id)||s.push({helpUrl:r.helpUrl,id:r.id,impact:r.impact??"minor",message:r.help,nodes:r.nodes.map(i=>({html:i.html,selector:re(i.target)})),wcagTags:r.tags.filter(i=>i.startsWith("wcag")||i==="best-practice")});return s},"convertViolations"),se=b(async o=>{const e=await import("axe-core"),s=typeof e.default?.run=="function"?e.default:e;if(typeof s.run!="function")throw new Error("axe-core could not be loaded — .run is not available");return s.run(document,{exclude:[["dev-toolbar"]],runOnly:{type:"tag",values:ee[o]}})},"runAxeScan");class oe{static{C(this,"f")}static{b(this,"A11yStore")}listeners=new Set;state;constructor(){const{issues:e,lastScan:s}=te();this.state={isScanning:!1,issues:e,lastScan:s,scanError:null,showOverlays:!1,standard:"wcag21aa"}}clearHighlights(){E()}getState(){return this.state}highlightIssue(e){E();let s=!1;for(const r of e.nodes)try{const i=document.querySelector(r.selector);i&&(_(i,e.impact),s||(i.scrollIntoView({behavior:"smooth",block:"center"}),s=!0))}catch{}}async scan(e=[]){if(!this.state.isScanning){this.update({isScanning:!0,scanError:null});try{const s=await se(this.state.standard),r=ne(s.violations,e);this.update({isScanning:!1,issues:r,lastScan:new Date().toISOString()}),this.persist(),this.state.showOverlays&&B(r)}catch(s){this.update({isScanning:!1,scanError:s instanceof Error?s.message:String(s)})}}}setShowOverlays(e){this.update({showOverlays:e}),e?B(this.state.issues):E()}setStandard(e){this.update({standard:e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}persist(){try{sessionStorage.setItem(H,JSON.stringify({issues:this.state.issues,lastScan:this.state.lastScan}))}catch{}}update(e){this.state={...this.state,...e},this.notify()}}const c=new oe;var ae=Object.defineProperty,l=C((o,e)=>ae(o,"name",{value:e,configurable:!0}),"n");const $={critical:"Critical",minor:"Minor",moderate:"Moderate",serious:"Serious"},W={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},ie={critical:"bg-destructive/10 border-destructive/30",minor:"bg-foreground/4 border-border",moderate:"bg-warning/10 border-warning/30",serious:"bg-warning/10 border-warning/30"},le={critical:"bg-destructive",minor:"bg-muted-foreground/50",moderate:"bg-warning",serious:"bg-warning"},ce=l(({count:o,isActive:e,onClick:s,severity:r})=>a("button",{class:u("flex flex-col items-center gap-1 px-3 py-2.5 border cursor-pointer transition-colors",e?"ring-1 ring-inset ring-primary/40":"hover:bg-foreground/6",ie[r]),onClick:s,title:`${e?"Clear":"Filter by"} ${$[r]}`,type:"button",children:[t("span",{class:u("text-xl font-bold tabular-nums leading-none",W[r]),children:o}),t("span",{class:"text-[0.6rem] font-semibold uppercase tracking-wider text-muted-foreground",children:$[r]})]}),"SeverityBucket"),de=l(({isSelected:o,issue:e,onClick:s,onDisable:r})=>a("div",{class:u("p-3 border cursor-pointer transition-colors",o?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:s,children:[a("div",{class:"flex items-start gap-2 mb-1.5",children:[t("span",{class:u("mt-1 size-2 rounded-full shrink-0",le[e.impact])}),t("span",{class:"text-[0.75rem] font-semibold text-foreground flex-1 leading-snug",children:e.id}),t("span",{class:u("text-[0.6rem] font-bold uppercase tracking-wide shrink-0",W[e.impact]),children:$[e.impact]})]}),t("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed mb-2 ml-4",children:e.message}),e.nodes.length>0&&a("div",{class:"mb-2 ml-4 space-y-0.5",children:[e.nodes.slice(0,3).map((i,p)=>t("code",{class:"block text-[0.65rem] text-foreground/70 font-mono bg-foreground/5 px-2 py-1 truncate",children:i.selector},p)),e.nodes.length>3&&a("span",{class:"text-[0.62rem] text-muted-foreground/60",children:["+",e.nodes.length-3," more element",e.nodes.length>4?"s":""]})]}),a("div",{class:"flex items-center gap-2 flex-wrap ml-4",children:[e.wcagTags.slice(0,3).map(i=>t("span",{class:"text-[0.58rem] font-mono uppercase bg-primary/8 text-primary/70 border border-primary/20 px-1.5 py-0.5",children:i},i)),t("span",{class:"flex-1"}),t("a",{class:"text-[0.62rem] text-primary/70 hover:text-primary transition-colors",href:e.helpUrl,onClick:l(i=>i.stopPropagation(),"onClick"),rel:"noopener noreferrer",target:"_blank",children:"Learn more ↗"}),t("button",{class:"text-[0.62rem] text-muted-foreground/60 hover:text-muted-foreground transition-colors cursor-pointer bg-transparent border-0 p-0",onClick:l(i=>{i.stopPropagation(),r(e.id)},"onClick"),title:"Disable this rule for current session",type:"button",children:"Disable"})]})]}),"IssueCard"),ue=l(o=>{const[e,s]=v(S(()=>c.getState()),"storeState"),[r,i]=v(S([]),"disabledRules"),[p,A]=v(S(null),"minSeverity"),[y,w]=v(S(null),"activeIssueId"),[m,d]=v(S(null),"filterSeverity");U(()=>c.subscribe(()=>s(c.getState())),[]),U(()=>c.clearHighlights.bind(c),[]);const{isScanning:h,issues:f,lastScan:J,scanError:j,showOverlays:I,standard:V}=e,N=J!==null||j!==null,L=l(()=>{d(null),w(null),c.scan(r)},"handleScan"),q=l(n=>{y===n.id?(w(null),c.clearHighlights(),I&&c.setShowOverlays(!0)):(w(n.id),c.highlightIssue(n))},"handleIssueClick"),F=l(n=>{i(g=>[...g,n])},"handleDisableRule"),R=f.filter(n=>!(r.includes(n.id)||m&&n.impact!==m||p&&M.indexOf(n.impact)>M.indexOf(p))),Y=l(n=>f.filter(g=>!r.includes(g.id)&&g.impact===n).length,"countBy");return a("div",{class:"flex flex-col h-full",children:[a("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[t("button",{class:u("px-3 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",h?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:h,onClick:L,type:"button",children:h?"Scanning…":"Scan page"}),a("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Standard",a("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>c.setStandard(n.target.value),"onChange"),style:"color-scheme: dark",value:V,children:[t("option",{value:"wcag21aa",children:"WCAG 2.1 AA"}),t("option",{value:"wcag22aa",children:"WCAG 2.2 AA"}),t("option",{value:"wcag2a",children:"WCAG 2.0 A"}),t("option",{value:"best-practice",children:"Best Practice"})]})]}),a("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Min",a("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>{const g=n.target.value;A(g||null)},"onChange"),style:"color-scheme: dark",value:p??"",children:[t("option",{value:"",children:"All"}),t("option",{value:"critical",children:"Critical only"}),t("option",{value:"serious",children:"Serious+"}),t("option",{value:"moderate",children:"Moderate+"})]})]}),t("button",{class:u("px-2.5 py-1.5 text-[0.7rem] border transition-colors cursor-pointer",I?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground"),onClick:l(()=>c.setShowOverlays(!I),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"}),N&&f.length>0&&a(G,{children:[t("button",{class:"ml-auto px-2 py-1.5 text-[0.7rem] border border-border text-muted-foreground bg-transparent hover:text-foreground transition-colors cursor-pointer",onClick:l(()=>{const n=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),g=URL.createObjectURL(n),k=document.createElement("a");k.href=g,k.download="a11y-audit.json",k.click(),URL.revokeObjectURL(g)},"onClick"),title:"Export audit results as JSON",type:"button",children:"JSON"}),t("button",{class:"px-2 py-1.5 text-[0.7rem] border border-border text-muted-foreground bg-transparent hover:text-foreground transition-colors cursor-pointer",onClick:l(()=>{const n=l(x=>`"${x.replaceAll('"','""')}"`,"q"),g=["Rule ID","Severity","Message","Selector","HTML","WCAG Tags"].join(","),k=f.flatMap(x=>x.nodes.map(T=>[n(x.id),n(x.impact),n(x.message),n(T.selector),n(T.html),n(x.wcagTags.join("; "))].join(","))),z=new Blob([[g,...k].join(`
21
- `)],{type:"text/csv"}),P=URL.createObjectURL(z),D=document.createElement("a");D.href=P,D.download="a11y-audit.csv",D.click(),URL.revokeObjectURL(P)},"onClick"),title:"Export audit results as CSV",type:"button",children:"CSV"})]})]}),a("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[j&&t("div",{class:"p-4 bg-destructive/10 border-b border-destructive/30",children:a("p",{class:"text-[0.72rem] text-destructive font-medium",children:["Scan failed: ",j]})}),!N&&!h&&a("div",{class:"flex flex-col items-center justify-center gap-4 p-8 min-h-48 text-center",children:[t("p",{class:"text-[0.8125rem] text-muted-foreground max-w-sm",children:"Run an accessibility audit using axe-core to detect WCAG violations on this page."}),t("button",{class:"px-4 py-2 text-[0.75rem] font-medium border border-border text-foreground bg-transparent hover:bg-foreground/5 transition-colors cursor-pointer",onClick:L,type:"button",children:"Start scan"})]}),h&&t("div",{class:"flex items-center justify-center gap-3 p-8 min-h-48",children:t("span",{class:"text-[0.8rem] text-muted-foreground",children:"Scanning for accessibility issues…"})}),N&&!h&&!j&&a("div",{class:"p-5 space-y-4",children:[t("div",{class:"grid grid-cols-4 gap-2",children:M.map(n=>t(ce,{count:Y(n),isActive:m===n,onClick:l(()=>d(m===n?null:n),"onClick"),severity:n},n))}),R.length===0?a("div",{class:"p-6 text-center border border-border",children:[t("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:f.length===0?"No violations found!":"No issues match the current filters."}),f.length===0&&t("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:"Great — the page passes all rules for the selected standard."})]}):a("section",{children:[a("div",{class:"flex items-center gap-2 mb-2",children:[a("span",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[t("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"})," ",R.length," issue",R.length!==1?"s":"",m?` · ${$[m]} only`:""]}),m&&t("button",{class:"text-[0.62rem] text-primary/70 hover:text-primary cursor-pointer bg-transparent border-0 p-0 transition-colors",onClick:l(()=>d(null),"onClick"),type:"button",children:"Clear ×"})]}),t("div",{class:"space-y-2",children:R.map(n=>t(de,{isSelected:y===n.id,issue:n,onClick:l(()=>q(n),"onClick"),onDisable:F},n.id))})]}),r.length>0&&a("div",{class:"flex items-center gap-2 text-[0.65rem] text-muted-foreground/60",children:[a("span",{children:[r.length," rule",r.length!==1?"s":""," disabled this session."]}),t("button",{class:"text-primary/60 hover:text-primary cursor-pointer bg-transparent border-0 p-0 transition-colors",onClick:l(()=>i([]),"onClick"),type:"button",children:"Reset"})]})]})]})]})},"A11yApp");var ge=Object.defineProperty,O=C((o,e)=>ge(o,"name",{value:e,configurable:!0}),"i$1");const pe={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},me={critical:"Crit",minor:"Min",moderate:"Mod",serious:"Ser"},he=O(o=>{const e=new Date(o).getTime();if(Number.isNaN(e))return"unknown";const s=Math.max(0,Math.floor((Date.now()-e)/1e3));if(s<10)return"just now";if(s<60)return`${s}s ago`;const r=Math.floor(s/60);return r<60?`${r} min ago`:`${Math.floor(r/60)} hr ago`},"formatElapsed"),be=O(o=>{const[e,s]=v(S(()=>c.getState()),"state");U(()=>c.subscribe(()=>s(c.getState())),[]);const{isScanning:r,issues:i,lastScan:p,showOverlays:A}=e,y=i.length,w=i.reduce((d,h)=>(d[h.impact]=(d[h.impact]??0)+1,d),{critical:0,minor:0,moderate:0,serious:0}),m=O(d=>w[d],"countBy");return a("div",{class:"space-y-3 min-w-[200px]",children:[p?a(G,{children:[a("div",{class:"flex items-baseline gap-2",children:[t("span",{class:u("text-2xl font-bold tabular-nums leading-none",y>0?"text-destructive":"text-success-foreground"),children:y}),a("span",{class:"text-[0.65rem] text-muted-foreground",children:["violation",y!==1?"s":""]})]}),t("div",{class:"grid grid-cols-4 gap-1.5",children:M.map(d=>a("div",{class:"flex flex-col items-center gap-0.5",children:[t("span",{class:u("text-[0.85rem] font-bold tabular-nums leading-none",pe[d]),children:m(d)}),t("span",{class:"text-[0.55rem] uppercase tracking-wide text-muted-foreground/70",children:me[d]})]},d))}),a("p",{class:"text-[0.62rem] text-muted-foreground/50",children:["Scanned ",he(p)]})]}):a("div",{children:[t("p",{class:"text-[0.72rem] text-muted-foreground",children:"No scan run yet."}),t("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-0.5",children:"Scan this page to detect WCAG violations."})]}),a("div",{class:"flex items-center gap-2 pt-2 border-t border-border/50",children:[t("button",{class:u("flex-1 px-2.5 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",r?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:r,onClick:O(()=>{c.scan()},"onClick"),type:"button",children:r?"Scanning…":p?"Re-scan":"Scan"}),t("button",{class:u("px-2.5 py-1.5 text-[0.7rem] border transition-colors",i.length===0?"border-border/50 text-muted-foreground/40 bg-transparent cursor-not-allowed":u("cursor-pointer",A?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground")),disabled:i.length===0,onClick:O(()=>c.setShowOverlays(!A),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"})]})]})},"A11yTooltip"),we={component:ue,icon:Q,id:"dev-toolbar:a11y",name:"Accessibility",tooltip:be};export{we as default};
20
+ `;var te=Object.defineProperty,x=O((a,e)=>te(a,"name",{value:e,configurable:!0}),"i$3");const E=["critical","serious","moderate","minor"],re={critical:"rgb(239,68,68)",minor:"rgb(100,116,139)",moderate:"rgb(249,115,22)",serious:"rgb(234,179,8)"},se={"best-practice":["best-practice"],wcag2a:["wcag2a"],wcag21aa:["wcag2a","wcag2aa","wcag21a","wcag21aa"],wcag22aa:["wcag2a","wcag2aa","wcag21a","wcag21aa","wcag22a","wcag22aa"]},_="__vdt_a11y__",ne=x(()=>{try{const a=sessionStorage.getItem(_);if(a){const e=JSON.parse(a);if(Array.isArray(e.issues))return{issues:e.issues,lastScan:e.lastScan??void 0}}}catch{}return{issues:[],lastScan:void 0}},"loadFromSession"),z=x((a,e)=>{const n=a;n.dataset.vdtA11y=e,n.style.setProperty("outline",`2px solid ${re[e]}`,"important"),n.style.setProperty("outline-offset","2px","important")},"setHighlight"),I=x(()=>{for(const a of document.querySelectorAll("[data-vdt-a11y]")){const e=a;delete e.dataset.vdtA11y,e.style.removeProperty("outline"),e.style.removeProperty("outline-offset")}},"clearHighlightsDOM"),H=x(a=>{I();for(const e of a)for(const n of e.nodes)try{const r=document.querySelector(n.selector);r&&z(r,e.impact)}catch{}},"applyOverlaysDOM"),ae=x(a=>{const e=a.at(-1);return Array.isArray(e)?e.join(" "):String(e??"")},"nodeSelector"),ie=x((a,e)=>{const n=[];for(const r of a)e.includes(r.id)||n.push({helpUrl:r.helpUrl,id:r.id,impact:r.impact??"minor",message:r.help,nodes:r.nodes.map(o=>({html:o.html,selector:ae(o.target)})),wcagTags:r.tags.filter(o=>o.startsWith("wcag")||o==="best-practice")});return n},"convertViolations"),oe=x(async a=>{const e=await import("axe-core"),n=typeof e.default?.run=="function"?e.default:e;if(typeof n.run!="function")throw new TypeError("axe-core could not be loaded — .run is not available");return n.run(document,{exclude:[["dev-toolbar"]],runOnly:{type:"tag",values:se[a]}})},"runAxeScan");class ce{static{O(this,"v")}static{x(this,"A11yStore")}listeners=new Set;state;constructor(){const{issues:e,lastScan:n}=ne();this.state={isScanning:!1,issues:e,lastScan:n,scanError:void 0,showOverlays:!1,standard:"wcag21aa"}}clearHighlights(){I()}getState(){return this.state}highlightIssue(e){I();let n=!1;for(const r of e.nodes)try{const o=document.querySelector(r.selector);o&&(z(o,e.impact),n||(o.scrollIntoView({behavior:"smooth",block:"center"}),n=!0))}catch{}}async scan(e=[]){if(!this.state.isScanning){this.update({isScanning:!0,scanError:void 0});try{const n=await oe(this.state.standard),r=ie(n.violations,e);this.update({isScanning:!1,issues:r,lastScan:new Date().toISOString()}),this.persist(),this.state.showOverlays&&H(r)}catch(n){this.update({isScanning:!1,scanError:n instanceof Error?n.message:String(n)})}}}setShowOverlays(e){this.update({showOverlays:e}),e?H(this.state.issues):I()}setStandard(e){this.update({standard:e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}persist(){try{sessionStorage.setItem(_,JSON.stringify({issues:this.state.issues,lastScan:this.state.lastScan}))}catch{}}update(e){this.state={...this.state,...e},this.notify()}}const l=new ce;var le=Object.defineProperty,c=O((a,e)=>le(a,"name",{value:e,configurable:!0}),"i$2");const N={critical:"Critical",minor:"Minor",moderate:"Moderate",serious:"Serious"},J={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},de={critical:"bg-destructive/10 border-destructive/30",minor:"bg-foreground/4 border-border",moderate:"bg-warning/10 border-warning/30",serious:"bg-warning/10 border-warning/30"},ue={critical:"bg-destructive",minor:"bg-muted-foreground/50",moderate:"bg-warning",serious:"bg-warning"},ge=c(({count:a,isActive:e,onClick:n,severity:r})=>i("button",{class:d("flex flex-col items-center gap-1 px-3 py-2.5 border cursor-pointer transition-colors",e?"ring-1 ring-inset ring-primary/40":"hover:bg-foreground/6",de[r]),onClick:n,title:`${e?"Clear":"Filter by"} ${N[r]}`,type:"button",children:[t("span",{class:d("text-xl font-bold tabular-nums leading-none",J[r]),children:a}),t("span",{class:"text-[0.6rem] font-semibold uppercase tracking-wider text-muted-foreground",children:N[r]})]}),"SeverityBucket"),pe=c(({isSelected:a,issue:e,onClick:n,onDisable:r})=>i("div",{class:d("p-3 border cursor-pointer transition-colors",a?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:n,children:[i("div",{class:"flex items-start gap-2 mb-1.5",children:[t("span",{class:d("mt-1 size-2 rounded-full shrink-0",ue[e.impact])}),t("span",{class:"text-[0.75rem] font-semibold text-foreground flex-1 leading-snug",children:e.id}),t("span",{class:d("text-[0.6rem] font-bold uppercase tracking-wide shrink-0",J[e.impact]),children:N[e.impact]})]}),t("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed mb-2 ml-4",children:e.message}),e.nodes.length>0&&i("div",{class:"mb-2 ml-4 space-y-0.5",children:[e.nodes.slice(0,3).map((o,p)=>t("code",{class:"block text-[0.65rem] text-foreground/70 font-mono bg-foreground/5 px-2 py-1 truncate",children:o.selector},p)),e.nodes.length>3&&i("span",{class:"text-[0.62rem] text-muted-foreground/60",children:["+",e.nodes.length-3," more element",e.nodes.length>4?"s":""]})]}),i("div",{class:"flex items-center gap-2 flex-wrap ml-4",children:[e.wcagTags.slice(0,3).map(o=>t("span",{class:"text-[0.58rem] font-mono uppercase bg-primary/8 text-primary/70 border border-primary/20 px-1.5 py-0.5",children:o},o)),t("span",{class:"flex-1"}),t("a",{class:"text-[0.62rem] text-primary/70 hover:text-primary transition-colors",href:e.helpUrl,onClick:c(o=>o.stopPropagation(),"onClick"),rel:"noopener noreferrer",target:"_blank",children:"Learn more ↗"}),t("button",{class:"text-[0.62rem] text-muted-foreground/60 hover:text-muted-foreground transition-colors cursor-pointer bg-transparent border-0 p-0",onClick:c(o=>{o.stopPropagation(),r(e.id)},"onClick"),title:"Disable this rule for current session",type:"button",children:"Disable"})]})]}),"IssueCard"),me=c(a=>{const[e,n]=k(C(()=>l.getState()),"storeState"),[r,o]=k(C([]),"disabledRules"),[p,M]=k(C(void 0),"minSeverity"),[S,v]=k(C(void 0),"activeIssueId"),[m,f]=k(C(void 0),"filterSeverity");L(()=>l.subscribe(()=>n(l.getState())),[]),L(()=>l.clearHighlights.bind(l),[]);const{isScanning:b,issues:h,lastScan:u,scanError:$,showOverlays:T,standard:q}=e,U=u!==void 0||$!==void 0,P=c(()=>{f(void 0),v(void 0),l.scan(r).catch(()=>{})},"handleScan"),V=c(s=>{S===s.id?(v(void 0),l.clearHighlights(),T&&l.setShowOverlays(!0)):(v(s.id),l.highlightIssue(s))},"handleIssueClick"),F=c(s=>{o(g=>[...g,s])},"handleDisableRule"),R=h.filter(s=>!(r.includes(s.id)||m&&s.impact!==m||p&&E.indexOf(s.impact)>E.indexOf(p))),K=c(s=>h.filter(g=>!r.includes(g.id)&&g.impact===s).length,"countBy");return i("div",{class:"flex flex-col h-full",children:[i("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[t(w,{class:d(b?"border-primary/30 text-primary/50 bg-primary/5":""),disabled:b,onClick:P,size:"sm",variant:"outline",children:b?"Scanning…":"Scan page"}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Standard",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:c(s=>l.setStandard(s.target.value),"onChange"),style:"color-scheme: dark",value:q,children:[t("option",{value:"wcag21aa",children:"WCAG 2.1 AA"}),t("option",{value:"wcag22aa",children:"WCAG 2.2 AA"}),t("option",{value:"wcag2a",children:"WCAG 2.0 A"}),t("option",{value:"best-practice",children:"Best Practice"})]})]}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Min",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:c(s=>{const{value:g}=s.target;M(g||void 0)},"onChange"),style:"color-scheme: dark",value:p??"",children:[t("option",{value:"",children:"All"}),t("option",{value:"critical",children:"Critical only"}),t("option",{value:"serious",children:"Serious+"}),t("option",{value:"moderate",children:"Moderate+"})]})]}),t(w,{class:d(T?"border-primary/30 text-primary bg-primary/8":""),onClick:c(()=>l.setShowOverlays(!T),"onClick"),size:"sm",title:"Toggle visual highlights on affected elements",variant:"outline",children:"Overlays"}),U&&h.length>0&&i(W,{children:[t(w,{class:"ml-auto",onClick:c(()=>{const s=new Blob([JSON.stringify(h,void 0,2)],{type:"application/json"}),g=URL.createObjectURL(s),A=document.createElement("a");A.href=g,A.download="a11y-audit.json",A.click(),URL.revokeObjectURL(g)},"onClick"),size:"sm",title:"Export audit results as JSON",variant:"outline",children:"JSON"}),t(w,{onClick:c(()=>{const s=c(y=>`"${y.replaceAll('"','""')}"`,"q"),g=["Rule ID","Severity","Message","Selector","HTML","WCAG Tags"].join(","),A=h.flatMap(y=>y.nodes.map(G=>[s(y.id),s(y.impact),s(y.message),s(G.selector),s(G.html),s(y.wcagTags.join("; "))].join(","))),Q=new Blob([[g,...A].join(`
21
+ `)],{type:"text/csv"}),B=URL.createObjectURL(Q),D=document.createElement("a");D.href=B,D.download="a11y-audit.csv",D.click(),URL.revokeObjectURL(B)},"onClick"),size:"sm",title:"Export audit results as CSV",variant:"outline",children:"CSV"})]})]}),i("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[$&&t(Y,{class:"rounded-none border-x-0 border-t-0",variant:"destructive",children:i(Z,{children:["Scan failed: ",$]})}),!U&&!b&&i("div",{class:"flex flex-col items-center justify-center gap-4 p-8 min-h-48 text-center",children:[t("p",{class:"text-[0.8125rem] text-muted-foreground max-w-sm",children:"Run an accessibility audit using axe-core to detect WCAG violations on this page."}),t(w,{onClick:P,variant:"outline",children:"Start scan"})]}),b&&t("div",{class:"flex items-center justify-center gap-3 p-8 min-h-48",children:t("span",{class:"text-[0.8rem] text-muted-foreground",children:"Scanning for accessibility issues…"})}),U&&!b&&!$&&i("div",{class:"p-5 space-y-4",children:[t("div",{class:"grid grid-cols-4 gap-2",children:E.map(s=>t(ge,{count:K(s),isActive:m===s,onClick:c(()=>f(m===s?void 0:s),"onClick"),severity:s},s))}),R.length===0?i("div",{class:"p-6 text-center border border-border",children:[t("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:h.length===0?"No violations found!":"No issues match the current filters."}),h.length===0&&t("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:"Great — the page passes all rules for the selected standard."})]}):i("section",{children:[i("div",{class:"flex items-center gap-2 mb-2",children:[i("span",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[t("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"})," ",R.length," issue",R.length===1?"":"s",m?` · ${N[m]} only`:""]}),m&&t(w,{class:"h-auto p-0 text-[0.62rem]",onClick:c(()=>f(void 0),"onClick"),variant:"link",children:"Clear ×"})]}),t("div",{class:"space-y-2",children:R.map(s=>t(pe,{isSelected:S===s.id,issue:s,onClick:c(()=>V(s),"onClick"),onDisable:F},s.id))})]}),r.length>0&&i("div",{class:"flex items-center gap-2 text-[0.65rem] text-muted-foreground/60",children:[i("span",{children:[r.length," rule",r.length===1?"":"s"," disabled this session."]}),t(w,{class:"h-auto p-0 text-[0.62rem]",onClick:c(()=>o([]),"onClick"),variant:"link",children:"Reset"})]})]})]})]})},"A11yApp");var he=Object.defineProperty,j=O((a,e)=>he(a,"name",{value:e,configurable:!0}),"i$1");const fe={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},be={critical:"Crit",minor:"Min",moderate:"Mod",serious:"Ser"},xe=j(a=>{const e=new Date(a).getTime();if(Number.isNaN(e))return"unknown";const n=Math.max(0,Math.floor((Date.now()-e)/1e3));if(n<10)return"just now";if(n<60)return`${n}s ago`;const r=Math.floor(n/60);return r<60?`${r} min ago`:`${Math.floor(r/60)} hr ago`},"formatElapsed"),ve=j(a=>{const[e,n]=k(C(()=>l.getState()),"state");L(()=>l.subscribe(()=>n(l.getState())),[]);const{isScanning:r,issues:o,lastScan:p,showOverlays:M}=e,S=o.length,v={critical:0,minor:0,moderate:0,serious:0};for(const u of o)v[u.impact]=(v[u.impact]??0)+1;const m=j(u=>v[u],"countBy");let f;r?f="Scanning…":p?f="Re-scan":f="Scan";const b=M?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground",h=o.length===0?"border-border/50 text-muted-foreground/40 bg-transparent cursor-not-allowed":d("cursor-pointer",b);return i("div",{class:"space-y-3 min-w-[200px]",children:[p?i(W,{children:[i("div",{class:"flex items-baseline gap-2",children:[t("span",{class:d("text-2xl font-bold tabular-nums leading-none",S>0?"text-destructive":"text-success-foreground"),children:S}),i("span",{class:"text-[0.65rem] text-muted-foreground",children:["violation",S===1?"":"s"]})]}),t("div",{class:"grid grid-cols-4 gap-1.5",children:E.map(u=>i("div",{class:"flex flex-col items-center gap-0.5",children:[t("span",{class:d("text-[0.85rem] font-bold tabular-nums leading-none",fe[u]),children:m(u)}),t("span",{class:"text-[0.55rem] uppercase tracking-wide text-muted-foreground/70",children:be[u]})]},u))}),i("p",{class:"text-[0.62rem] text-muted-foreground/50",children:["Scanned ",xe(p)]})]}):i("div",{children:[t("p",{class:"text-[0.72rem] text-muted-foreground",children:"No scan run yet."}),t("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-0.5",children:"Scan this page to detect WCAG violations."})]}),i("div",{class:"flex items-center gap-2 pt-2 border-t border-border/50",children:[t("button",{class:d("flex-1 px-2.5 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",r?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:r,onClick:j(()=>{l.scan().catch(()=>{})},"onClick"),type:"button",children:f}),t("button",{class:d("px-2.5 py-1.5 text-[0.7rem] border transition-colors",h),disabled:o.length===0,onClick:j(()=>l.setShowOverlays(!M),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"})]})]})},"A11yTooltip"),je={component:me,icon:ee,id:"dev-toolbar:a11y",name:"Accessibility",tooltip:ve};export{je as default};
@@ -0,0 +1,4 @@
1
+ import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
2
+ import 'preact';
3
+ declare const annotationsApp: DevToolbarApp;
4
+ export { annotationsApp as default };
@@ -0,0 +1,18 @@
1
+ var j=Object.defineProperty;var z=(t,s)=>j(t,"name",{value:s,configurable:!0});import{addHookName as c}from"preact/devtools";import{clsx as h}from"../../packem_shared/clsx-wGlvpUfw.js";import{useState as p,useCallback as S,useEffect as q}from"preact/hooks";import{s as Q,M as H,l as K}from"../../packem_shared/annotation-settings-Bv0TH4WI.js";import{jsx as e,jsxs as r}from"preact/jsx-runtime";import g from"../../packem_shared/Button-Bkx66Co7.js";import U from"../../packem_shared/Textarea-Yfg3dLZi.js";const V=`<!-- @license lucide-static v1.14.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-message-square-plus"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
15
+ <path d="M12 8v6" />
16
+ <path d="M9 11h6" />
17
+ </svg>
18
+ `;var G=Object.defineProperty,a=z((t,s)=>G(t,"name",{value:s,configurable:!0}),"o");const I={approve:"Approve",change:"Change",fix:"Fix",question:"Question"},M={approve:"bg-green-500/20 text-green-400 border-green-500/30",change:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",fix:"bg-destructive/20 text-destructive border-destructive/30",question:"bg-blue-500/20 text-blue-400 border-blue-500/30"},F={blocking:"Blocking",important:"Important",suggestion:"Suggestion"},$={blocking:"text-destructive",important:"text-warning-foreground",suggestion:"text-muted-foreground"},A={acknowledged:"Acknowledged",dismissed:"Dismissed",pending:"Pending",resolved:"Resolved"},Y=a(({active:t,counts:s,onFilter:i})=>e("div",{class:"flex gap-1.5",children:["all","pending","acknowledged","resolved","dismissed"].map(n=>r("button",{class:h("px-2.5 py-1 text-[0.65rem] font-medium border cursor-pointer transition-colors",t===n?"bg-primary/10 border-primary/30 text-primary":"bg-foreground/3 border-border text-muted-foreground hover:bg-foreground/6"),onClick:a(()=>i(n),"onClick"),type:"button",children:[n==="all"?"All":A[n]," (",s[n],")"]},n))}),"StatusFilters"),_=a(({annotation:t,isSelected:s,onClick:i,onDelete:n,onDismiss:d,onResolve:m})=>r("div",{class:h("p-3 border cursor-pointer transition-colors",s?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:i,children:[r("div",{class:"flex items-start gap-2 mb-1.5",children:[e("span",{class:h("text-[0.6rem] font-bold uppercase px-1.5 py-0.5 border shrink-0",M[t.intent]),children:I[t.intent]}),e("span",{class:h("text-[0.6rem] font-semibold uppercase tracking-wide shrink-0",$[t.severity]),children:F[t.severity]}),e("span",{class:"flex-1"}),t.resolvedBy&&r("span",{class:"text-[0.58rem] text-muted-foreground/60",children:["by ",t.resolvedBy]}),e("span",{class:"text-[0.58rem] text-muted-foreground/60",children:A[t.status]})]}),e("p",{class:"text-[0.7rem] text-foreground leading-relaxed mb-1.5 line-clamp-2",children:t.comment}),e("div",{class:"flex items-center gap-2 mb-1.5",children:r("code",{class:"text-[0.62rem] text-foreground/60 font-mono bg-foreground/5 px-1.5 py-0.5 truncate",children:[t.elementTag,t.elementPath?` · ${t.elementPath}`:""]})}),t.source&&e("div",{class:"mb-1.5",children:e("code",{class:"text-[0.6rem] text-primary/60 font-mono",children:t.source})}),e("div",{class:"text-[0.58rem] text-muted-foreground/50 truncate mb-2",children:t.url}),t.thread&&t.thread.length>0&&r("div",{class:"text-[0.6rem] text-muted-foreground/60 mb-2",children:[t.thread.length," message",t.thread.length===1?"":"s"," in thread"]}),t.status==="pending"&&r("div",{class:"flex items-center gap-1.5",onClick:a(u=>u.stopPropagation(),"onClick"),children:[e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem]",onClick:m,size:"sm",variant:"outline",children:"Resolve"}),e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem]",onClick:d,size:"sm",variant:"outline",children:"Dismiss"}),e("span",{class:"flex-1"}),e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem] text-destructive hover:text-destructive",onClick:n,size:"sm",variant:"ghost",children:"Delete"})]})]}),"AnnotationCard"),J=a(({annotation:t,helpers:s,onBack:i,onRefresh:n})=>{const[d,m]=c(p(""),"message"),u=S(async()=>{const l=d.trim();l&&(await s.rpc.updateAnnotation?.(t.id,{threadMessage:{content:l,role:"human",timestamp:new Date().toISOString()}}),m(""),n())},[t.id,s,d,n]);return r("div",{class:"p-4 space-y-3",children:[e(g,{class:"h-auto py-0.5 px-2 text-[0.65rem]",onClick:i,size:"sm",variant:"ghost",children:"← Back"}),r("div",{class:"flex items-center gap-2 flex-wrap",children:[e("span",{class:h("text-[0.65rem] font-bold uppercase px-2 py-0.5 border",M[t.intent]),children:I[t.intent]}),e("span",{class:h("text-[0.65rem] font-semibold",$[t.severity]),children:F[t.severity]}),e("span",{class:"text-[0.6rem] text-muted-foreground ml-auto",children:A[t.status]})]}),e("div",{class:"text-[0.75rem] text-foreground leading-relaxed border border-border p-3",children:t.comment}),r("div",{class:"space-y-1 text-[0.65rem]",children:[r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Element"}),r("code",{class:"text-foreground/70 font-mono",children:[t.elementTag,t.cssClasses?` .${t.cssClasses}`:""]})]}),t.source&&r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Source"}),e("code",{class:"text-primary/70 font-mono",children:t.source})]}),r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"URL"}),e("span",{class:"text-foreground/60 truncate",children:t.url})]}),r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Created"}),e("span",{class:"text-foreground/60",children:new Date(t.createdAt).toLocaleString()})]})]}),r("div",{children:[r("div",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-2",children:[e("span",{"aria-hidden":"true",class:"text-primary/50",children:"// "}),"Thread (",t.thread?.length??0,")"]}),t.thread&&t.thread.length>0&&e("div",{class:"space-y-2 mb-3",children:t.thread.map(l=>r("div",{class:"border border-border p-2",children:[r("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:"text-[0.62rem] font-semibold text-primary/70",children:l.role}),e("span",{class:"text-[0.55rem] text-muted-foreground/50",children:new Date(l.timestamp).toLocaleString()})]}),e("p",{class:"text-[0.68rem] text-foreground/80 leading-relaxed whitespace-pre-wrap",children:l.content})]},`${l.role}-${l.timestamp}`))}),r("div",{class:"space-y-2",children:[e(U,{class:"text-[0.7rem] min-h-[60px]",onChange:a(l=>m(l.target.value),"onChange"),placeholder:"Add a message to the thread...",value:d}),e(g,{class:"text-[0.65rem]",disabled:!d.trim(),onClick:u,size:"sm",variant:"outline",children:"Send"})]})]})]})},"AnnotationDetail"),W=a(({onChange:t,settings:s})=>{const i=a(n=>{const d={...s,...n};Q(d),t(d)},"update");return r("div",{class:"space-y-3 p-4 border-t border-border",children:[r("div",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[e("span",{"aria-hidden":"true",class:"text-primary/50",children:"// "}),"Settings"]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Output Detail"}),r("select",{class:"flex-1 bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(n=>i({outputDetail:n.target.value}),"onChange"),style:"color-scheme: dark",value:s.outputDetail,children:[e("option",{value:"compact",children:"Compact"}),e("option",{value:"standard",children:"Standard"}),e("option",{value:"detailed",children:"Detailed"}),e("option",{value:"forensic",children:"Forensic"})]})]}),r("div",{class:"flex items-center gap-2 text-[0.7rem]",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Marker Color"}),e("div",{class:"flex gap-1.5",children:H.map(n=>e("button",{class:h("w-5 h-5 rounded-full border-2 cursor-pointer p-0 transition-all",n.name===s.markerColorName?"border-foreground scale-110":"border-transparent hover:scale-110"),onClick:a(()=>i({markerColorName:n.name}),"onClick"),style:{background:n.bg},title:n.label,type:"button"},n.name))})]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Marker Click"}),r("select",{class:"flex-1 bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(n=>i({markerClickBehavior:n.target.value}),"onChange"),style:"color-scheme: dark",value:s.markerClickBehavior,children:[e("option",{value:"detail",children:"Show Detail"}),e("option",{value:"edit",children:"Edit"}),e("option",{value:"delete",children:"Delete"})]})]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground cursor-pointer",children:[e("input",{checked:s.blockInteractions,class:"cursor-pointer",onChange:a(n=>i({blockInteractions:n.target.checked}),"onChange"),type:"checkbox"}),e("span",{children:"Block page interactions while inspecting"})]})]})},"AnnotationSettingsPanel"),X=a(({helpers:t})=>{const[s,i]=c(p([]),"annotations"),[n,d]=c(p(!1),"loading"),[m,u]=c(p(),"error"),[l,E]=c(p("pending"),"filterStatus"),[b,P]=c(p("all"),"filterIntent"),[k,D]=c(p(),"selectedId"),[y,L]=c(p(!1),"showSettings"),[N,O]=c(p(()=>K()),"settings"),x=S(async()=>{d(!0),u(void 0);try{const o=await t.rpc.getAnnotations?.();i(o??[])}catch(o){u(o instanceof Error?o.message:String(o))}finally{d(!1)}},[t]);q(()=>{x().catch(()=>{})},[x]);const R=s.filter(o=>!(l!=="all"&&o.status!==l||b!=="all"&&o.intent!==b)),f=a(o=>s.filter(v=>v.status===o).length,"countByStatus"),T={acknowledged:f("acknowledged"),all:s.length,dismissed:f("dismissed"),pending:f("pending"),resolved:f("resolved")},B=k?s.find(o=>o.id===k):void 0,C=S(async(o,v)=>{try{await(v==="delete"?t.rpc.deleteAnnotation?.(o):t.rpc.updateAnnotation?.(o,{status:v==="resolve"?"resolved":"dismissed"})),await x()}catch(w){console.error(`[annotations] ${v} failed for ${o}:`,w),u(w instanceof Error?w.message:`Failed to ${v} annotation`)}},[t,x]);return B?e(J,{annotation:B,helpers:t,onBack:a(()=>D(void 0),"onBack"),onRefresh:a(()=>x().catch(()=>{}),"onRefresh")}):r("div",{class:"flex flex-col h-full",children:[r("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[e(g,{disabled:n,onClick:a(()=>x().catch(()=>{}),"onClick"),size:"sm",variant:"outline",children:n?"Loading…":"Refresh"}),e(g,{class:h("text-[0.65rem]",y&&"bg-primary/10 text-primary"),onClick:a(()=>L(!y),"onClick"),size:"sm",variant:"ghost",children:"Settings"}),e("span",{class:"flex-1"}),r("select",{class:"bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(o=>P(o.target.value),"onChange"),style:"color-scheme: dark",value:b,children:[e("option",{value:"all",children:"All intents"}),e("option",{value:"fix",children:"Fix"}),e("option",{value:"change",children:"Change"}),e("option",{value:"question",children:"Question"}),e("option",{value:"approve",children:"Approve"})]})]}),r("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[m&&e("div",{class:"p-3 text-[0.7rem] text-destructive bg-destructive/10 border-b border-destructive/20",children:m}),r("div",{class:"p-4 space-y-3",children:[e(Y,{active:l,counts:T,onFilter:E}),R.length===0?r("div",{class:"p-6 text-center border border-border",children:[e("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:s.length===0?"No annotations yet":"No annotations match filters"}),e("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:s.length===0?'Use the Inspector to click an element and select "Annotate".':"Try changing the status or intent filter."})]}):e("div",{class:"space-y-2",children:R.map(o=>e(_,{annotation:o,isSelected:k===o.id,onClick:a(()=>D(o.id),"onClick"),onDelete:a(()=>C(o.id,"delete").catch(()=>{}),"onDelete"),onDismiss:a(()=>C(o.id,"dismiss").catch(()=>{}),"onDismiss"),onResolve:a(()=>C(o.id,"resolve").catch(()=>{}),"onResolve")},o.id))})]})]}),y&&e(W,{onChange:O,settings:N})]})},"AnnotationsApp"),le={component:X,icon:V,id:"dev-toolbar:annotations",name:"Annotations"};export{le as default};
@@ -0,0 +1,4 @@
1
+ import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
2
+ import 'preact';
3
+ declare const assetsApp: DevToolbarApp;
4
+ export { assetsApp as default };
@@ -0,0 +1,16 @@
1
+ var B=Object.defineProperty;var P=(t,i)=>B(t,"name",{value:i,configurable:!0});import{addHookName as a}from"preact/devtools";import{clsx as u}from"../../packem_shared/clsx-wGlvpUfw.js";import{useState as s,useRef as N,useEffect as C}from"preact/hooks";import{jsx as e,jsxs as l}from"preact/jsx-runtime";import c from"../../packem_shared/Button-Bkx66Co7.js";import E from"../../packem_shared/Input-Cs6aduTi.js";const H=`<!-- @license lucide-static v1.14.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-folder-open"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />
15
+ </svg>
16
+ `;var O=Object.defineProperty,o=P((t,i)=>O(t,"name",{value:i,configurable:!0}),"o");const j=o(t=>!Number.isFinite(t)||t<0?"–":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatSize"),A=o(t=>t.startsWith("/")&&!t.includes(":")?t:"#","safePublicPath"),M=[{label:"All",value:"all"},{label:"Images",value:"image"},{label:"Videos",value:"video"},{label:"Audio",value:"audio"},{label:"Fonts",value:"font"},{label:"Text",value:"text"},{label:"Other",value:"other"}],D={audio:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",font:"bg-orange-500/15 text-orange-400 border-orange-500/30",image:"bg-blue-500/15 text-blue-400 border-blue-500/30",other:"bg-foreground/6 text-muted-foreground border-border",text:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",video:"bg-purple-500/15 text-purple-400 border-purple-500/30"},z=o(({type:t})=>e("span",{class:u("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",D[t]),children:t}),"TypeBadge"),V=o(({asset:t})=>{const i=A(t.publicPath);if(i!=="#"){if(t.type==="image")return e("div",{class:"flex items-center justify-center bg-foreground/4 border border-border h-32 overflow-hidden",children:e("img",{alt:t.publicPath,class:"max-w-full max-h-full object-contain",onError:o(p=>{p.target.style.display="none"},"onError"),src:i})});if(t.type==="video")return e("div",{class:"flex items-center justify-center bg-foreground/4 border border-border h-32 overflow-hidden",children:e("video",{class:"max-w-full max-h-full",preload:"metadata",src:i})});if(t.type==="audio")return e("div",{class:"flex items-center justify-center bg-foreground/4 border border-border h-14 px-2",children:e("audio",{class:"w-full",controls:!0,preload:"none",src:i})})}},"AssetPreview"),K=o(({helpers:t})=>{const[i,p]=a(s([]),"assets"),[F,f]=a(s(!0),"loading"),[g,v]=a(s(void 0),"error"),[y,T]=a(s(""),"search"),[d,S]=a(s("all"),"typeFilter"),[n,b]=a(s(void 0),"selected"),[I,w]=a(s(!1),"copied"),m=a(N(void 0),"copyTimerRef");C(()=>()=>{clearTimeout(m.current)},[]);const h=o(()=>{f(!0),v(void 0),b(void 0),t.rpc.getStaticAssets().then(r=>{p(r),f(!1)}).catch(r=>{v(r.message??"Failed to load assets"),f(!1)})},"load");C(()=>{h()},[]);const x=i.filter(r=>{const k=y.toLowerCase(),R=!k||r.publicPath.toLowerCase().includes(k),$=d==="all"||r.type===d;return R&&$}),L=o(r=>{navigator.clipboard.writeText(r.publicPath).then(()=>{clearTimeout(m.current),w(!0),m.current=setTimeout(w,1500,!1)}).catch(()=>{})},"copyPath");return F?l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[e("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(r=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${r}ms`}},r))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Scanning assets…"})]}):g?l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-[0.8rem] text-destructive",children:g}),e(c,{onClick:h,size:"sm",variant:"outline",children:"Retry"})]}):l("div",{class:"flex flex-col h-full",children:[l("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0 flex-wrap",children:[e(E,{class:"flex-1 min-w-32 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:o(r=>{T(r.target.value)},"onInput"),placeholder:"Filter assets…",type:"text",value:y}),l("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[x.length," / ",i.length]}),e(c,{onClick:h,size:"sm",variant:"outline",children:"Refresh"})]}),e("div",{"aria-label":"Filter by type",class:"flex items-center gap-1.5 px-4 py-2 border-b border-border shrink-0 flex-wrap",role:"group",children:M.map(r=>e("button",{"aria-pressed":d===r.value,class:u("px-2.5 py-0.5 text-[0.7rem] font-medium border cursor-pointer transition-colors duration-100",d===r.value?"bg-primary/15 text-primary border-primary/30":"bg-foreground/4 text-muted-foreground border-border hover:bg-foreground/8 hover:text-foreground"),onClick:o(()=>{S(r.value)},"onClick"),type:"button",children:r.label},r.value))}),l("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[e("div",{class:"flex-1 overflow-auto divide-y divide-border/30",role:"list",children:x.length===0?e("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:i.length===0?"No assets found in public directory.":"No assets match the current filter."}):x.map(r=>l("button",{"aria-label":r.publicPath,"aria-selected":n?.publicPath===r.publicPath,class:u("w-full flex items-center gap-3 px-4 py-2.5 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",n?.publicPath===r.publicPath&&"bg-primary/6"),onClick:o(()=>{b(n?.publicPath===r.publicPath?void 0:r)},"onClick"),role:"option",type:"button",children:[e(z,{type:r.type}),e("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:r.publicPath}),e("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground",children:j(r.size)})]},r.publicPath))}),n&&l("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[l("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[e("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Asset Info"}),e(c,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:o(()=>{b(void 0)},"onClick"),size:"icon",variant:"ghost",children:"✕"})]}),l("div",{class:"flex-1 overflow-auto p-4 space-y-4",children:[e(V,{asset:n}),l("div",{children:[e("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Path"}),e("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:n.publicPath})]}),l("div",{children:[e("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),e(z,{type:n.type})]}),l("div",{children:[e("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Size"}),e("span",{class:"text-[0.8rem] font-mono text-foreground",children:j(n.size)})]}),l("div",{children:[e("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Last Modified"}),e("span",{class:"text-[0.75rem] text-foreground/80",children:new Date(n.mtime).toLocaleString()})]}),l("div",{class:"flex flex-col gap-2 pt-1",children:[e(c,{class:"w-full text-[0.75rem]",onClick:o(()=>{L(n)},"onClick"),size:"sm",variant:"outline",children:I?"Copied!":"Copy URL"}),e("a",{class:u("w-full text-[0.75rem] inline-flex items-center justify-center","px-3 py-1.5 border border-border bg-transparent","text-foreground hover:bg-foreground/6 transition-colors duration-100"),href:A(n.publicPath),rel:"noopener noreferrer",target:"_blank",children:"Open in browser"})]})]})]})]})]})},"AssetsApp"),X={component:K,icon:H,id:"dev-toolbar:assets",name:"Assets"};export{X as default};
@@ -0,0 +1,4 @@
1
+ import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
2
+ import 'preact';
3
+ declare const inspectorApp: DevToolbarApp;
4
+ export { inspectorApp as default };
@@ -0,0 +1,30 @@
1
+ var Bn=Object.defineProperty;var ae=(e,t)=>Bn(e,"name",{value:t,configurable:!0});import{l as _t,g as Gt}from"../../packem_shared/annotation-settings-Bv0TH4WI.js";import{b as Mn}from"../../packem_shared/use-frame-state-CxrlPUM5.js";const zn=`<!-- @license lucide-static v1.14.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-inspect"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z" />
15
+ <path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6" />
16
+ </svg>
17
+ `;var Pn=Object.defineProperty,P=ae((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"l$2");const Zt=P(e=>{try{const t=e.contentDocument;return t!==null&&t.body!==null}catch{return!1}},"isSameOriginIframe"),_e=P((e,t)=>{let n=document.elementFromPoint(e,t);if(!n)return null;let o=!0;for(;o;){for(o=!1;n?.shadowRoot;){const i=n.shadowRoot.elementFromPoint(e,t);if(!i||i===n)break;n=i,o=!0}if(n?.tagName==="IFRAME"){const i=n;if(Zt(i)){const r=i.getBoundingClientRect(),a=e-r.left,l=t-r.top;try{const d=i.contentDocument.elementFromPoint(a,l);d&&d!==i&&(n=d,o=!0)}catch{}}}}return n},"deepElementFromPoint"),st=P(e=>{const t=e.getBoundingClientRect();let n=0,o=0,i=e.ownerDocument;for(;i!==document;){const r=i.defaultView?.frameElement;if(!r)break;const a=r.getBoundingClientRect();n+=a.left,o+=a.top,i=r.ownerDocument}return new DOMRect(t.x+n,t.y+o,t.width,t.height)},"getViewportRect"),Rn=new Set(["ARTICLE","ASIDE","DIV","FOOTER","HEADER","MAIN","NAV","SECTION","SPAN"]),gt=P(e=>{if(typeof e.checkVisibility=="function")return!e.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});let t=e;for(;t&&t!==document.body;){if(getComputedStyle(t).opacity==="0")return!0;t=t.parentElement}return!1},"isEffectivelyInvisible"),Dt=P(e=>{if(!Rn.has(e.tagName))return!0;for(const t of e.childNodes)if(t.nodeType===Node.TEXT_NODE&&t.textContent?.trim())return!0;return!1},"hasDirectContent"),rt=P((e,t)=>{const n=document.elementFromPoint(e,t);if(!n)return null;let o=n;for(;o.shadowRoot;){const x=o.shadowRoot.elementFromPoint(e,t);if(!x||x===o)break;o=x}if(Dt(o)&&!gt(o))return o;const i=document.elementsFromPoint(e,t);for(const x of i){if(x===n||x===document.documentElement||x===document.body)continue;let h=x;for(;h.shadowRoot;){const c=h.shadowRoot.elementFromPoint(e,t);if(!c||c===h)break;h=c}if(Dt(h)&&!gt(h))return h}const r=o.getBoundingClientRect(),a=r.width*r.height;let l=null,d=a;for(const x of i){if(x===n||x===document.documentElement||x===document.body||gt(x))continue;const h=x.getBoundingClientRect(),c=h.width*h.height;c>0&&c<d&&(l=x,d=c)}return l??o},"pierceElementFromPoint"),en=P(e=>{if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null},"getParentElement"),tn=P(e=>{let t=e;for(;t;){const{position:n}=getComputedStyle(t);if(n==="fixed"||n==="sticky")return!0;t=en(t)}return!1},"isElementFixed"),Tt=P(e=>{const t=e.tagName.toLowerCase();if(t==="button"||e.type==="submit"){const r=e.textContent?.trim().slice(0,40);return r?`button "${r}"`:"button"}if(t==="a"){const r=e.getAttribute("href"),a=e.textContent?.trim().slice(0,30);return r&&!r.startsWith("javascript:")?a?`link "${a}" to ${r}`:`link to ${r}`:a?`link "${a}"`:"link"}if(t==="img"){const{alt:r}=e;return r?`image "${r.slice(0,40)}"`:"image"}if(t==="input"){const{type:r}=e,{placeholder:a}=e;return a?`input[${r}] "${a.slice(0,30)}"`:`input[${r}]`}if(t==="textarea"){const{placeholder:r}=e;return r?`textarea "${r.slice(0,30)}"`:"textarea"}if(/^h[1-6]$/.test(t)){const r=e.textContent?.trim().slice(0,50);return r?`${t} "${r}"`:t}if(t==="select"){const r=e.getAttribute("aria-label")??e.name;return r?`select "${r}"`:"select"}const n=e.textContent?.trim();if(n&&n.length<=30&&n.length>0)return`${t} "${n}"`;const o=e.id?`#${e.id}`:"",i=e.classList.length>0?`.${[...e.classList].slice(0,2).join(".")}`:"";return`${t}${o}${i}`||t},"getElementLabel"),In=new Set(["active","checked","disabled","focus","hover","selected","visited"]),nn=P(e=>{if(e.id)return`#${CSS.escape(e.id)}`;const t=[...e.classList].filter(i=>!In.has(i)&&!i.startsWith("__")&&!Dn(i));if(t.length>0){const i=e.tagName.toLowerCase();for(const r of t){const a=`${i}.${CSS.escape(r)}`;if(document.querySelectorAll(a).length===1)return a}for(let r=0;r<t.length;r++)for(let a=r+1;a<t.length;a++){const l=`${i}.${CSS.escape(t[r])}.${CSS.escape(t[a])}`;if(document.querySelectorAll(l).length===1)return l}}const n=[];let o=e;for(;o&&o!==document.body&&o!==document.documentElement;){let i=o.tagName.toLowerCase();if(o.id){n.unshift(`#${CSS.escape(o.id)}`);break}const r=o.parentElement;if(r){const a=[...r.children].filter(l=>l.tagName===o.tagName);if(a.length>1){const l=a.indexOf(o)+1;i+=`:nth-of-type(${l})`}}n.unshift(i),o=r}return n.join(" > ")},"generateSelector"),on=/[_-][a-f0-9]{5,}$/i,Dn=P(e=>on.test(e),"isModuleHash"),rn=P(e=>Array.from(e,t=>t.replace(on,"")).filter(Boolean).join(" "),"cleanCssClasses"),an=P(e=>{const t=[];let n=e;for(;n&&n!==document.documentElement;){const o=n.tagName.toLowerCase();if(o==="body"){t.unshift("body");break}const i=n.getRootNode();i instanceof ShadowRoot?(t.unshift(`${o} ⟨shadow⟩`),n=i.host):(t.unshift(o),n=n.parentElement)}return t.join(" > ")},"getFullDomPath"),sn=P(e=>{const t=e.parentElement;return t?[...t.children].filter(n=>n!==e).slice(0,5).map(n=>n.tagName.toLowerCase()+(n.id?`#${n.id}`:"")).join(", "):""},"getNearbyElements"),ln=P((e,t=120)=>{const n=e.textContent?.trim()??"";if(n.length>0)return n.length>t?`${n.slice(0,t)}…`:n;const o=e.getAttribute("aria-label")??e.getAttribute("title")??"";return o?o.length>t?`${o.slice(0,t)}…`:o:e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.placeholder?.slice(0,t)??"":""},"getNearbyText"),cn=P((e=80)=>{const t=globalThis.getSelection();if(!t||t.isCollapsed)return"";const n=t.toString().trim();return n.length>e?`${n.slice(0,e)}…`:n},"getSelectedText"),Fn=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA"]),dn=P(e=>{const t=e,n=t.getAttribute("role")??t.tagName.toLowerCase(),o=t.getAttribute("aria-label")??void 0,i=t.getAttribute("aria-describedby")?document.getElementById(t.getAttribute("aria-describedby"))?.textContent?.trim():void 0,r=t.getAttribute("tabindex"),a=r===null?void 0:Number.parseInt(r,10),l=Fn.has(t.tagName)||a!==void 0&&a>=0;return{ariaDescribedBy:i,ariaLabel:o,focusable:l,role:n===t.tagName.toLowerCase()?void 0:n,tabindex:a}},"captureAccessibility"),On=["display","position","color","background-color","font-size","font-family","font-weight","line-height","padding","margin","border","width","height","overflow","z-index","opacity"],wt=P(e=>{const t=getComputedStyle(e),n=[];for(const o of On){const i=t.getPropertyValue(o);i&&i!=="normal"&&i!=="none"&&i!=="auto"&&i!=="0px"&&n.push(`${o}: ${i}`)}return n.join("; ")},"captureComputedStyles"),jn=P(e=>{const t=Object.keys(e).find(l=>l.startsWith("__reactFiber$")||l.startsWith("__reactInternalInstance$"));if(!t)return;let n=e[t],o,i,r;const a=[];for(;n;){if(typeof n.type=="function"||typeof n.type=="object"){const l=n.type?.displayName??n.type?.name;l&&!l.startsWith("_")&&l!=="Fragment"&&l!=="Suspense"&&l.length>1&&(a.push(l),o||(o=l,n._debugSource&&(i=n._debugSource.fileName,r=n._debugSource.lineNumber)))}n=n.return}if(o)return{componentName:o,componentStack:a.length>1?a.reverse():void 0,framework:"react",sourceFile:i,sourceLine:r}},"detectReact"),Nn=P(e=>{let t=e.__vueParentComponent;if(!t){let r=e;for(;r&&(t=r.__vueParentComponent,!t);)r=r.parentElement}if(!t)return;const n=t.type?.__name??t.type?.name??t.type?.__file?.split("/").pop()?.replace(".vue","");if(!n)return;const o=[n];let{parent:i}=t;for(;i;){const r=i.type?.__name??i.type?.name;r&&o.push(r),i=i.parent}return{componentName:n,componentStack:o.length>1?o.reverse():void 0,framework:"vue",sourceFile:t.type?.__file}},"detectVue"),qn=P(e=>{let t=e;for(;t;){const n=t.__svelte_meta;if(n){const o=n.loc?.file??"";return{componentName:o.split("/").pop()?.replace(".svelte","")??"Unknown",framework:"svelte",sourceFile:o,sourceLine:n.loc?.line}}t=t.parentElement}},"detectSvelte"),pn=P(e=>jn(e)??Nn(e)??qn(e),"detectFrameworkComponent"),un=P(async e=>{try{const t=e.getBoundingClientRect(),n=20,o=window.devicePixelRatio||1,i=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:{displaySurface:"browser"}});if(!i.getVideoTracks()[0])return i.getTracks().forEach(b=>b.stop()),null;const r=document.createElement("video");r.srcObject=i,r.muted=!0,await r.play(),await new Promise(b=>{requestAnimationFrame(()=>b())});const a=document.createElement("canvas");a.width=r.videoWidth,a.height=r.videoHeight;const l=a.getContext("2d");if(!l)return i.getTracks().forEach(b=>b.stop()),null;l.drawImage(r,0,0),i.getTracks().forEach(b=>b.stop());const d=Math.max(0,(t.left-n)*o),x=Math.max(0,(t.top-n)*o),h=Math.min((t.width+n*2)*o,a.width-d),c=Math.min((t.height+n*2)*o,a.height-x),u=document.createElement("canvas");u.width=h,u.height=c;const p=u.getContext("2d");return p?(p.drawImage(a,d,x,h,c,0,0,h,c),u.toDataURL("image/png")):null}catch{return null}},"captureElementScreenshot"),Hn=P(e=>{const t=[],n=P(o=>{for(const i of o.querySelectorAll(e))t.push(i);for(const i of o.querySelectorAll("iframe"))if(Zt(i))try{n(i.contentDocument)}catch{}},"searchDocument");return n(document),t},"querySelectorAllWithIframes"),mn=P(e=>{const t=[],n=Math.max(10,e.width/20),o=Math.max(10,e.height/20),i=new Set;for(let{x:a}=e;a<=e.x+e.width;a+=n)for(let{y:l}=e;l<=e.y+e.height;l+=o){const d=_e(a,l);if(d&&!i.has(d)&&d.tagName!=="BODY"&&d.tagName!=="HTML"&&!d.tagName.includes("-")){const x=st(d);x.left>=e.x-5&&x.top>=e.y-5&&x.right<=e.x+e.width+5&&x.bottom<=e.y+e.height+5&&(i.add(d),t.push(d))}}const r="button, a, input, img, p, h1, h2, h3, h4, h5, h6, li, label, td, th";for(const a of Hn(r)){if(i.has(a)||a.tagName==="BODY"||a.tagName==="HTML")continue;const l=st(a);l.width>window.innerWidth*.8&&l.height>window.innerHeight*.5||l.width<10||l.height<10||l.left<e.x+e.width&&l.right>e.x&&l.top<e.y+e.height&&l.bottom>e.y&&(i.add(a),t.push(a))}return t.filter(a=>!t.some(l=>l!==a&&a.contains(l)))},"getElementsInRect"),gn=P(e=>e.map(t=>{const n=st(t);return{height:n.height,width:n.width,x:n.x,y:n.y}}),"getElementBoundingBoxes"),Ct=P((e,t="standard")=>{if(e.length===0)return`# Annotations
18
+
19
+ No annotations found.`;if(t==="compact"){const o=[`# Annotations (${e.length})`,""];for(const i of e){const r=i.elementLabel??i.elementTag,a=i.selectedText?` (re: "${i.selectedText.slice(0,30)}...")`:"";o.push(`- **${r}:** ${i.comment}${a}`)}return o.join(`
20
+ `)}const n=["# Annotations","",`> ${e.length} annotation(s)`,""];for(const[o,i]of e.entries()){const r=i.elementLabel??i.elementTag;if(n.push(`## ${o+1}. [${i.intent.toUpperCase()}] ${i.severity} — ${r}`,"",`**Status:** ${i.status}`,`**URL:** ${i.url}`),i.elementPath&&n.push(`**Selector:** \`${i.elementPath}\``),i.source&&n.push(`**Source:** \`${i.source}\``),i.frameworkContext){const a=i.frameworkContext;n.push(`**Component:** ${a.componentName} (${a.framework})`),a.componentStack&&a.componentStack.length>1&&n.push(`**Stack:** ${a.componentStack.join(" > ")}`),a.sourceFile&&n.push(`**File:** \`${a.sourceFile}${a.sourceLine?`:${a.sourceLine}`:""}\``)}i.selectedText&&n.push(`**Selected:** "${i.selectedText}"`),(t==="detailed"||t==="forensic")&&(i.cssClasses&&n.push(`**Classes:** \`${i.cssClasses}\``),i.nearbyText&&n.push(`**Context:** ${i.nearbyText}`),i.fullPath&&n.push(`**DOM Path:** \`${i.fullPath}\``)),t==="forensic"&&(i.accessibility?.role&&n.push(`**Role:** ${i.accessibility.role}`),i.nearbyElements&&n.push(`**Nearby:** ${i.nearbyElements}`),i.computedStyles&&n.push(`**Styles:** \`${i.computedStyles}\``)),n.push("",i.comment,"","---","")}return n.join(`
21
+ `)},"annotationsToMarkdown"),Vn=Object.defineProperty({__proto__:null,annotationsToMarkdown:Ct,captureAccessibility:dn,captureComputedStyles:wt,captureElementScreenshot:un,cleanCssClasses:rn,deepElementFromPoint:_e,detectFrameworkComponent:pn,generateSelector:nn,getElementBoundingBoxes:gn,getElementLabel:Tt,getElementsInRect:mn,getFullDomPath:an,getNearbyElements:sn,getNearbyText:ln,getParentElement:en,getSelectedText:cn,getViewportRect:st,isElementFixed:tn,pierceElementFromPoint:rt},Symbol.toStringTag,{value:"Module"});var Yn=Object.defineProperty,ue=ae((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"r$1");const Xn=["id^='__vdt_'","class*='__vdt_'"],xt=Xn.flatMap(e=>[`:not([${e}])`,`:not([${e}] *)`]).join(""),$t="__vdt_freeze_styles",ht="__vdt_freeze_state",ce=1e3,Un=ue(()=>{if(globalThis.window===void 0)return{frozen:!1,frozenRAFQueue:[],frozenTimeoutQueue:[],installed:!0,origRAF:ue(()=>0,"origRAF"),origSetInterval:ue((()=>0),"origSetInterval"),origSetTimeout:ue((()=>0),"origSetTimeout"),pausedAnimations:[]};const e=globalThis;return e[ht]||(e[ht]={frozen:!1,frozenRAFQueue:[],frozenTimeoutQueue:[],installed:!1,origRAF:null,origSetInterval:null,origSetTimeout:null,pausedAnimations:[]}),e[ht]},"getState"),E=Un();globalThis.window!==void 0&&!E.installed&&(E.origSetTimeout=globalThis.setTimeout.bind(globalThis),E.origSetInterval=globalThis.setInterval.bind(globalThis),E.origRAF=globalThis.requestAnimationFrame.bind(globalThis),globalThis.setTimeout=(e,t,...n)=>typeof e=="string"?E.origSetTimeout(e,t):E.origSetTimeout((...o)=>{E.frozen?E.frozenTimeoutQueue.length<ce?E.frozenTimeoutQueue.push(()=>e(...o)):E.frozenTimeoutQueue.length===ce&&(E.frozenTimeoutQueue.push(()=>{}),console.warn(`[dev-toolbar] frozenTimeoutQueue exceeded ${ce} entries — further callbacks are being dropped.`)):e(...o)},t,...n),globalThis.setInterval=(e,t,...n)=>typeof e=="string"?E.origSetInterval(e,t):E.origSetInterval((...o)=>{E.frozen||e(...o)},t,...n),globalThis.requestAnimationFrame=e=>E.origRAF(t=>{E.frozen?E.frozenRAFQueue.length<ce?E.frozenRAFQueue.push(e):E.frozenRAFQueue.length===ce&&(E.frozenRAFQueue.push(()=>{}),console.warn(`[dev-toolbar] frozenRAFQueue exceeded ${ce} entries — further callbacks are being dropped.`)):e(t)}),E.installed=!0);const xn=E.origSetTimeout,Qn=ue(()=>E.frozen,"isFrozen"),Kn=ue(()=>{if(typeof document>"u"||E.frozen)return;E.frozen=!0,E.frozenTimeoutQueue=[],E.frozenRAFQueue=[];let e=document.getElementById($t);e||(e=document.createElement("style"),e.id=$t),e.textContent=`
22
+ *${xt},
23
+ *${xt}::before,
24
+ *${xt}::after {
25
+ animation-play-state: paused !important;
26
+ transition: none !important;
27
+ }
28
+ `,document.head.append(e),E.pausedAnimations=[];try{for(const t of document.getAnimations()){if(t.playState!=="running")continue;const n=t.effect?.target;n&&!n.closest?.("[id^='__vdt_']")&&!n.closest?.("dev-toolbar")&&(t.pause(),E.pausedAnimations.push(t))}}catch{}for(const t of document.querySelectorAll("video"))t.paused||(t.dataset.wasPaused="false",t.pause())},"freezeAll"),hn=ue(()=>{if(typeof document>"u"||!E.frozen)return;E.frozen=!1;const e=E.frozenTimeoutQueue;E.frozenTimeoutQueue=[];for(const n of e)E.origSetTimeout(()=>{if(E.frozen){E.frozenTimeoutQueue.length<ce&&E.frozenTimeoutQueue.push(n);return}try{n()}catch{}},0);const t=E.frozenRAFQueue;E.frozenRAFQueue=[];for(const n of t)E.origRAF(o=>{if(E.frozen){E.frozenRAFQueue.length<ce&&E.frozenRAFQueue.push(n);return}n(o)});for(const n of E.pausedAnimations)try{n.play()}catch{}E.pausedAnimations=[],document.getElementById($t)?.remove();for(const n of document.querySelectorAll("video[data-was-paused='false']"))n.play().catch(()=>{}),delete n.dataset.wasPaused},"unfreezeAll"),Jn=ue(()=>E.frozen?(hn(),!1):(Kn(),!0),"toggleFreeze");var Wn=Object.defineProperty,Je=ae((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"r");const fn={bg:"#212121",btnBg:"rgba(196,181,253,0.08)",btnBgHover:"rgba(196,181,253,0.16)",btnBorder:"rgba(196,181,253,0.25)",btnBorderHover:"rgba(196,181,253,0.5)",fg:"#fafafa",muted:"#a1a1aa",primary:"#c4b5fd",shadow:"0 6px 24px rgba(0,0,0,.7),0 2px 8px rgba(0,0,0,.5)"},bn={bg:"#f2f2f2",btnBg:"rgba(124,58,237,0.08)",btnBgHover:"rgba(124,58,237,0.16)",btnBorder:"rgba(124,58,237,0.25)",btnBorderHover:"rgba(124,58,237,0.5)",fg:"#18181b",muted:"#52525b",primary:"#7c3aed",shadow:"0 4px 20px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.08)"},yn={...fn,overlayBg:"rgba(196,181,253,0.06)",overlayBorder:"rgba(196,181,253,0.7)"},Gn={...bn,overlayBg:"rgba(124,58,237,0.06)",overlayBorder:"rgba(124,58,237,0.7)"},Zn={...fn,danger:"#ef4444",success:"#22c55e"},eo={...bn,danger:"#dc2626",success:"#16a34a"};let de;const St=Je(()=>{if(de!==void 0)return de;try{const e=localStorage.getItem("__v_dt__theme");if(e==="light")return de=!1,!1;if(e==="dark")return de=!0,!0}catch{}return de=globalThis.window?.matchMedia("(prefers-color-scheme: dark)").matches??!0,de},"resolveIsDark");Je(()=>St(),"isDarkTheme");const to=Je(()=>St()?yn:Gn,"getInspectorPalette"),no=Je(()=>St()?Zn:eo,"getAnnotationPalette");Je(()=>{de=void 0},"resetPaletteCache");const Ft="__vdt_palette_listener";globalThis.window!==void 0&&!globalThis[Ft]&&(globalThis[Ft]=!0,globalThis.addEventListener("storage",e=>{e.key==="__v_dt__theme"&&(de=void 0)}));var oo=Object.defineProperty,_=ae((e,t)=>oo(e,"name",{value:t,configurable:!0}),"p");const fe="__vdt_annotation_marker",be="__vdt_annotation_form",Lt="__vdt_annotation_detail",it="__vdt_area_outline",U={approve:{bg:"rgba(34,197,94,0.15)",border:"rgba(34,197,94,0.6)",fg:"#22c55e"},change:{bg:"rgba(234,179,8,0.15)",border:"rgba(234,179,8,0.6)",fg:"#eab308"},fix:{bg:"rgba(239,68,68,0.15)",border:"rgba(239,68,68,0.6)",fg:"#ef4444"},question:{bg:"rgba(59,130,246,0.15)",border:"rgba(59,130,246,0.6)",fg:"#3b82f6"}},Qe={approve:"Approve",change:"Change",fix:"Fix",question:"Question"},Ke={blocking:"Blocking",important:"Important",suggestion:"Suggestion"},We=no,Y=_(()=>globalThis.__VISULIMA_DEVTOOLS__?.rpc,"getRpc"),ft=_(e=>{if(!e)return null;try{return document.querySelector(e)}catch{return null}},"safeQuerySelector"),K=_((e,t="success")=>{const n="__vdt_toast";document.getElementById(n)?.remove();const o=document.createElement("div");o.id=n,o.textContent=e,o.style.cssText=`position:fixed;z-index:2147483648;bottom:1rem;right:1rem;padding:6px 14px;background:${t==="success"?"#22c55e":"#ef4444"};color:#fff;font:12px/1 "JetBrains Mono","Geist Mono",ui-monospace,"Cascadia Code","Fira Code",monospace;font-weight:600;pointer-events:none;opacity:0;transition:opacity 0.2s,transform 0.2s;transform:translateY(4px);`,document.body.append(o),requestAnimationFrame(()=>{o.style.opacity="1",o.style.transform="translateY(0)"}),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),200)},1500)},"showToast"),ro=_(e=>{try{const t=new URL(e),n=globalThis.location;return t.origin===n.origin&&t.pathname===n.pathname}catch{return e===globalThis.location.href}},"matchesCurrentPage"),he=_((e,t,n)=>{const o=We(),i=document.createElement("button");return i.type="button",i.textContent=e,i.style.cssText=`background:${o.btnBg};border:1px solid ${o.btnBorder};color:${n??o.primary};cursor:pointer;font:11px/1 'JetBrains Mono',monospace;padding:5px 10px;white-space:nowrap;`,i.addEventListener("pointerover",()=>{i.style.background=o.btnBgHover,i.style.borderColor=o.btnBorderHover}),i.addEventListener("pointerout",()=>{i.style.background=o.btnBg,i.style.borderColor=o.btnBorder}),i.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),t()}),i},"makeButton"),se=_((e,t,n,o)=>{const i=document.createElement("div"),r=document.createElement("b");r.textContent=`${t}: `;const a=document.createElement("span");a.textContent=n,o&&(a.style.color=o),i.append(r,a),e.append(i)},"addMetaRow"),At=_((e,t)=>{const n=document.createElement("button");return n.type="button",n.textContent="×",n.style.cssText=`position:absolute;top:6px;right:8px;background:transparent;border:none;color:${e.muted};cursor:pointer;font:16px/1 monospace;padding:0;`,n.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),t()}),n},"makeCloseButton"),io=_(()=>globalThis.__VISULIMA_DEVTOOLS__?.getApps?.().some(e=>e.id==="dev-toolbar:annotations")??!1,"isAnnotationsAppEnabled");let W=[],Te,je,ge;const Bt=_((e,t,n=!1)=>({x:e/window.innerWidth*100,y:n?t:t+window.scrollY}),"toPageCoords"),Ne=_((e,t,n=!1)=>({left:e/100*window.innerWidth,top:n?t:t-window.scrollY}),"toViewportCoords"),ao=_(()=>{const e=document.querySelectorAll(`.${fe}`);for(const t of e){const n=Number.parseFloat(t.dataset.pageX??"0"),o=Number.parseFloat(t.dataset.pageY??"0"),i=t.dataset.isFixed==="true",{left:r,top:a}=Ne(n,o,i);t.style.left=`${r-11}px`,t.style.top=`${a-11}px`,t.style.display=a<-24||a>window.innerHeight+24?"none":"flex"}},"repositionMarkers");let bt=!1;const Ot=_(()=>{bt||(bt=!0,xn(()=>{ao(),bt=!1},16))},"throttledReposition"),so=_(()=>{Te||(Te=Ot,je=Ot,window.addEventListener("scroll",Te,{passive:!0}),window.addEventListener("resize",je,{passive:!0}))},"attachScrollListeners"),lo=_(()=>{Te&&(window.removeEventListener("scroll",Te),Te=void 0),je&&(window.removeEventListener("resize",je),je=void 0)},"detachScrollListeners");let qe,He,pe=[];const co=_(()=>{if(ge)return;ge=_(()=>{X().catch(()=>{})},"navigationHandler"),globalThis.addEventListener("popstate",ge),qe=history.pushState.bind(history),He=history.replaceState.bind(history);const e=ge;history.pushState=(...t)=>{qe(...t);const n=setTimeout(()=>{e(),pe=pe.filter(o=>o!==n)},50);pe.push(n)},history.replaceState=(...t)=>{He(...t);const n=setTimeout(()=>{e(),pe=pe.filter(o=>o!==n)},50);pe.push(n)}},"attachNavigationListener"),po=_(()=>{ge&&(globalThis.removeEventListener("popstate",ge),ge=void 0);for(const e of pe)clearTimeout(e);pe=[],qe&&(history.pushState=qe,qe=void 0),He&&(history.replaceState=He,He=void 0)},"detachNavigationListener");let xe;const uo=_(()=>{if(!xe)try{xe=new EventSource("/__devtoolbar/events"),xe.addEventListener("annotations.changed",()=>{const e=Y();e?.getAnnotations&&e.getAnnotations().then(t=>{W=t,lt()}).catch(()=>{})}),xe.addEventListener("error",()=>{})}catch{}},"attachSSE"),mo=_(()=>{xe&&(xe.close(),xe=void 0)},"detachSSE"),X=_(async()=>{if(!io())return;const e=Y();if(e?.getAnnotations)try{W=await e.getAnnotations(),lt(),so(),co(),uo()}catch{}},"loadAndShowMarkers"),vn=_(()=>{for(const e of document.querySelectorAll(`.${fe}`))e.remove();wn(),lo(),po(),mo(),hn()},"removeAllMarkers"),wn=_(()=>{q(),N(),document.getElementById(it)?.remove()},"closeAnnotationPopups"),lt=_(()=>{for(const t of document.querySelectorAll(`.${fe}`))t.remove();const e=W.filter(t=>(t.status==="pending"||t.status==="acknowledged")&&ro(t.url));for(const[t,n]of e.entries())xo(n,t+1)},"renderMarkers"),ne="__vdt_annotation_highlight",go={bg:"#22c55e",border:"#16a34a",fg:"#fff",highlightBg:"rgba(34,197,94,0.12)"},xo=_((e,t)=>{const n=_t(),o=e.isMultiSelect&&t>1?go:Gt(n),i=e.isFixed??!1,{left:r,top:a}=Ne(e.x,e.y,i),l=e.status==="acknowledged",d=document.createElement("div");d.className=fe,d.dataset.annotationId=e.id,d.dataset.pageX=String(e.x),d.dataset.pageY=String(e.y),d.dataset.isFixed=String(i),d.title=(e.elementLabel??e.comment.slice(0,60))||"Annotation",d.style.cssText=["position:fixed",`top:${a-11}px`,`left:${r-11}px`,"width:22px","height:22px","z-index:2147483643","pointer-events:auto","cursor:pointer","display:flex","align-items:center","justify-content:center",`background:${o.bg}`,"border:none","border-radius:50%","transition:transform 0.18s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.18s,opacity 0.15s",`box-shadow:0 1px 3px rgba(0,0,0,0.3),0 4px 12px ${o.border}66,inset 0 1px 0 rgba(255,255,255,0.2)`,l?"opacity:0.55":"",e.screenshot?`outline:2px solid ${o.bg};outline-offset:2px`:""].join(";");const x=document.createElement("span");x.style.cssText=[`color:${o.fg}`,"font-size:11px","font-weight:700","line-height:1","font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif","letter-spacing:-0.02em"].join(";"),x.textContent=String(t),d.append(x),d.addEventListener("pointerover",()=>{d.style.transform="scale(1.25)",d.style.boxShadow=`0 2px 8px rgba(0,0,0,0.35),0 6px 20px ${o.border}88,inset 0 1px 0 rgba(255,255,255,0.25)`,x.style.display="none";let h=d.querySelector(".__vdt_edit_icon");if(h)h.style.display="flex";else{h=document.createElement("span"),h.className="__vdt_edit_icon",h.style.cssText="display:flex;align-items:center;justify-content:center;";const c=new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="${o.fg}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>`,"image/svg+xml");h.append(c.documentElement),d.append(h)}if(e.isMultiSelect&&e.boundingBox&&!e.elementBoundingBoxes?.length){const c=e.boundingBox,u=i?c.y:c.y-window.scrollY;let p=document.getElementById(ne);p||(p=document.createElement("div"),p.id=ne,document.body.append(p)),p.style.cssText=`position:fixed;pointer-events:none;z-index:2147483642;box-sizing:border-box;border:2px dashed ${o.bg};background:${o.highlightBg};transition:all 0.1s;top:${u}px;left:${c.x}px;width:${c.width}px;height:${c.height}px;`}else{let c=null;if(e.elementPath&&(c=ft(e.elementPath)),!c&&e.boundingBox){const u=e.boundingBox,p=u.x+u.width/2,b=i?u.y+u.height/2:u.y+u.height/2-window.scrollY;if(c=_e(p,b),c){const T=c.getBoundingClientRect(),v=u.width>0?T.width/u.width:1,D=u.height>0?T.height/u.height:1;(v<.5||D<.5)&&(c=null)}}if(c){const u=c.getBoundingClientRect();let p=document.getElementById(ne);p||(p=document.createElement("div"),p.id=ne,document.body.append(p)),p.style.cssText=`position:fixed;pointer-events:none;z-index:2147483642;box-sizing:border-box;border:2px solid ${o.bg};background:${o.highlightBg};transition:all 0.1s;top:${u.top}px;left:${u.left}px;width:${u.width}px;height:${u.height}px;`}else if(e.boundingBox){const u=e.boundingBox,p=i?u.y:u.y-window.scrollY;let b=document.getElementById(ne);b||(b=document.createElement("div"),b.id=ne,document.body.append(b)),b.style.cssText=`position:fixed;pointer-events:none;z-index:2147483642;box-sizing:border-box;border:2px dashed ${o.bg};background:${o.highlightBg};transition:all 0.1s;top:${p}px;left:${u.x}px;width:${u.width}px;height:${u.height}px;`}}if(e.elementBoundingBoxes&&e.elementBoundingBoxes.length>0)for(const[c,u]of e.elementBoundingBoxes.entries()){const p=`${ne}_${c}`;let b=document.getElementById(p);b||(b=document.createElement("div"),b.id=p,document.body.append(b));const T=u.y-window.scrollY;b.style.cssText=`position:fixed;pointer-events:none;z-index:2147483642;box-sizing:border-box;border:2px solid ${o.bg};background:${o.highlightBg};transition:all 0.1s;top:${T}px;left:${u.x}px;width:${u.width}px;height:${u.height}px;`}}),d.addEventListener("pointerout",()=>{if(d.dataset.popupOpen==="true")return;d.style.transform="",d.style.boxShadow=`0 1px 3px rgba(0,0,0,0.3),0 4px 12px ${o.border}66,inset 0 1px 0 rgba(255,255,255,0.2)`,x.style.display="";const h=d.querySelector(".__vdt_edit_icon");if(h&&(h.style.display="none"),document.getElementById(ne)?.remove(),e.elementBoundingBoxes)for(let c=0;c<e.elementBoundingBoxes.length;c++)document.getElementById(`${ne}_${c}`)?.remove()}),d.addEventListener("click",h=>{if(h.stopPropagation(),h.preventDefault(),n.markerClickBehavior==="delete")Y()?.deleteAnnotation?.(e.id)?.then(()=>{X().catch(()=>{})});else if(n.markerClickBehavior==="edit"){const c=ft(e.elementPath),{left:u,top:p}=Ne(e.x,e.y,e.isFixed),b=c?.getBoundingClientRect()??new DOMRect(u,p,100,20);ct(c??document.body,b,e.source,e)}else $e(e)}),d.addEventListener("contextmenu",h=>{if(h.preventDefault(),h.stopPropagation(),n.markerClickBehavior==="delete"){const c=ft(e.elementPath),{left:u,top:p}=Ne(e.x,e.y,e.isFixed),b=c?.getBoundingClientRect()??new DOMRect(u,p,100,20);ct(c??document.body,b,e.source,e)}else $e(e)}),(a<-24||a>window.innerHeight+24)&&(d.style.display="none"),document.body.append(d)},"createMarkerElement"),ho=_(e=>{e&&e.__resizeObserver?.disconnect()},"cleanupResizeObserver"),q=_(()=>{const e=document.querySelector(`#${be}`),t=!!e;e?.annotationId&&ut(e.annotationId,!1),ho(e),e?.remove(),document.querySelector("#__vdt_pending_marker")?.remove(),t&&document.dispatchEvent(new CustomEvent("__vdt_annotation_form_closed"))},"removeAnnotationForm"),Ze=_(()=>!!document.querySelector(`#${be}`),"isAnnotationFormOpen"),fo=_(()=>{const e=document.querySelector(`#${be}`);if(!e)return;const t="__vdt_shake_kf";if(!document.getElementById(t)){const n=document.createElement("style");n.id=t,n.textContent="@keyframes __vdt_shake{0%,100%{transform:translateX(0)}15%{transform:translateX(-6px)}30%{transform:translateX(5px)}45%{transform:translateX(-4px)}60%{transform:translateX(3px)}75%{transform:translateX(-2px)}90%{transform:translateX(1px)}}",document.head.append(n)}e.style.animation="none",e.style.animation="__vdt_shake 0.4s ease",e.addEventListener("animationend",()=>{e.style.animation=""},{once:!0})},"shakeAnnotationForm"),ct=_((e,t,n,o,i)=>{q(),N();const r=We(),a=e.tagName.toLowerCase(),l=e.id?`#${e.id}`:"",d=e.classList.length>0?`.${[...e.classList].slice(0,3).join(".")}`:"",x=nn(e),h=ln(e),c=cn(),u=pn(e),p=document.createElement("div");p.id=be,o&&(p.annotationId=o.id,ut(o.id,!0)),p.style.cssText=["position:fixed","z-index:2147483647",`background:${r.bg}`,`border:1px solid ${r.btnBorder}`,"padding:12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${r.fg}`,`box-shadow:${r.shadow}`,"min-width:300px","max-width:400px","pointer-events:auto"].join(";");const b=i?.y??t.bottom,T=i?.x??t.left,v="__vdt_pending_marker";if(document.getElementById(v)?.remove(),i&&!o){const f=Gt(),M=document.createElement("div");M.id=v,M.style.cssText=["position:fixed",`top:${i.y-11}px`,`left:${i.x-11}px`,"width:22px","height:22px","z-index:2147483643","pointer-events:none","display:flex","align-items:center","justify-content:center",`background:${f.bg}`,"border:none","border-radius:50%",`box-shadow:0 1px 3px rgba(0,0,0,0.3),0 4px 12px ${f.border}66,inset 0 1px 0 rgba(255,255,255,0.2)`,"animation:__vdt_pulse 1.4s ease-in-out infinite"].join(";");const L=document.createElement("span");L.style.cssText=`color:${f.fg};font-size:13px;font-weight:700;line-height:1;`,L.textContent="+",M.append(L),document.body.append(M)}const D=document.createElement("div");D.style.cssText=`color:${r.primary};font-weight:bold;margin-bottom:8px;font-size:12px;`,D.textContent=o?"Edit Annotation":"Annotate Element",p.append(D);const k=document.createElement("div");k.style.cssText=`color:${r.muted};font-size:10px;margin-bottom:8px;padding:4px 6px;background:${r.btnBg};border:1px solid ${r.btnBorder};word-break:break-all;`;const C=document.createElement("span");if(C.textContent=`${a}${l}${d}`,k.append(C),n){const f=document.createElement("div");f.style.cssText=`color:${r.primary};opacity:0.6;margin-top:2px;`,f.textContent=n,k.append(f)}if(u){const f=document.createElement("div");f.style.cssText=`color:${r.success};margin-top:2px;`,f.textContent=`${u.framework}: <${u.componentName}>`,k.append(f)}if(c){const f=document.createElement("div");f.style.cssText=`color:${r.fg};opacity:0.5;margin-top:2px;font-style:italic;`,f.textContent=`"${c}"`,k.append(f)}if(p.append(k),!o){const f=wt(e);if(f){const M=document.createElement("details");M.style.cssText=`margin-bottom:8px;font-size:10px;color:${r.muted};`;const L=document.createElement("summary");L.style.cssText="cursor:pointer;font-size:10px;padding:2px 0;",L.textContent="Computed Styles",L.addEventListener("click",te=>te.stopPropagation());const Q=document.createElement("div");Q.style.cssText=`padding:4px 6px;margin-top:4px;background:${r.btnBg};border:1px solid ${r.btnBorder};font-family:'JetBrains Mono',monospace;white-space:pre-wrap;word-break:break-all;line-height:1.6;`,Q.textContent=f.replaceAll("; ",`;
29
+ `),M.append(L,Q),p.append(M)}}let F=o?.intent??"fix";const R=Se(r,"Intent",["fix","change","question","approve"].map(f=>({active:f===F,activeStyle:`background:${U[f].bg};border-color:${U[f].border};color:${U[f].fg}`,key:f,label:Qe[f]})),f=>{F=f});p.append(R);let $=o?.severity??"important";const B=Se(r,"Severity",["blocking","important","suggestion"].map(f=>({active:f===$,activeStyle:`background:${r.btnBg};border-color:${r.primary};color:${r.primary}`,key:f,label:Ke[f]})),f=>{$=f});p.append(B);let A=o?.screenshot?"existing":null;const s=document.createElement("div");s.style.cssText="margin-bottom:8px;";const g=document.createElement("button");g.type="button",g.textContent=A?"Remove Screenshot":"Capture Screenshot",g.style.cssText=`cursor:pointer;font:10px/1 'JetBrains Mono',monospace;padding:4px 8px;background:${r.btnBg};border:1px solid ${r.btnBorder};color:${r.primary};`,g.addEventListener("click",async f=>{if(f.preventDefault(),f.stopPropagation(),A)A=null,g.textContent="Capture Screenshot",m.style.display="none";else{g.textContent="Capturing...",g.disabled=!0;const M=await un(e);M?(A=M,g.textContent="Remove Screenshot",m.style.display="block",m.style.backgroundImage=`url(${M})`):g.textContent="Capture Failed — Retry",g.disabled=!1}}),s.append(g);const m=document.createElement("div");m.style.cssText=`margin-top:4px;height:80px;background-size:contain;background-repeat:no-repeat;background-position:center;border:1px solid ${r.btnBorder};display:${A?"block":"none"};`,s.append(m),p.append(s);const y=document.createElement("textarea");y.placeholder=h?`Feedback about "${h.slice(0,40)}..."`:"Describe the issue or feedback...",y.value=o?.comment??"",y.style.cssText=`width:100%;min-height:60px;resize:vertical;margin-bottom:8px;padding:6px 8px;background:${r.btnBg};border:1px solid ${r.btnBorder};color:${r.fg};font:11px/1.4 'JetBrains Mono',monospace;box-sizing:border-box;outline:none;`,y.addEventListener("focus",()=>{y.style.borderColor=r.primary}),y.addEventListener("blur",()=>{y.style.borderColor=r.btnBorder}),y.addEventListener("click",f=>f.stopPropagation()),y.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),z.click()),f.key==="Escape"&&(f.preventDefault(),q())}),p.append(y);const w=document.createElement("div");w.style.cssText="display:flex;gap:6px;";const z=he(o?"Save":"Create",async()=>{const f=y.value.trim();if(!f){y.style.borderColor=r.danger;return}const M=Y();if(M){z.textContent=o?"Saving...":"Creating...",z.disabled=!0;try{if(o)await M.updateAnnotation(o.id,{comment:f,intent:F,severity:$,...A!=="existing"&&{screenshot:A}}),A&&A!=="existing"&&await M.saveScreenshot(o.id,A).catch(()=>{});else{const L=tn(e),Q=i?.x??t.x+t.width/2,te=i?.y??t.y+t.height/2,re=Bt(Q,te,L),ye=dn(e),Me=wt(e),ze=an(e),Pe=sn(e),Ge=Tt(e),Re={accessibility:ye,boundingBox:{height:t.height,width:t.width,x:t.x+(L?0:window.scrollX),y:t.y+(L?0:window.scrollY)},comment:f,computedStyles:Me||void 0,cssClasses:rn(e.classList),elementLabel:Ge,elementPath:x,elementTag:a,frameworkContext:u,fullPath:ze,intent:F,isFixed:L||void 0,nearbyElements:Pe||void 0,nearbyText:h||void 0,selectedText:c||void 0,severity:$,source:n,url:globalThis.location.href,x:re.x,y:re.y},j=await M.createAnnotation(Re);A&&A!=="existing"&&await M.saveScreenshot(j.id,A).catch(()=>{}),W.push(j)}await X(),q(),K(o?"Annotation saved":"Annotation created")}catch{z.textContent="Error — retry",z.disabled=!1}}});w.append(z,he("Cancel",()=>q())),o&&w.append(he("Delete",async()=>{await Y()?.deleteAnnotation?.(o.id),await X(),q()},r.danger)),p.append(w),p.append(At(r,()=>q())),pt(p,T,b,y)},"showAnnotationForm"),jt=_((e,t,n)=>{q(),N();const o=We(),i=e.slice(0,5).map(p=>p.tagName.toLowerCase()).join(", "),r=document.createElement("div");r.id=be,r.style.cssText=["position:fixed","z-index:2147483647",`background:${o.bg}`,`border:1px solid ${o.btnBorder}`,"padding:12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${o.fg}`,`box-shadow:${o.shadow}`,"min-width:300px","max-width:400px","pointer-events:auto"].join(";");const a=document.createElement("div");a.style.cssText=`color:${o.primary};font-weight:bold;margin-bottom:8px;font-size:12px;`,a.textContent=`Multi-Select: ${e.length} elements`,r.append(a);const l=document.createElement("div");l.style.cssText=`color:${o.muted};font-size:10px;margin-bottom:8px;padding:4px 6px;background:${o.btnBg};border:1px solid ${o.btnBorder};`,l.textContent=i+(e.length>5?` +${e.length-5} more`:""),r.append(l);let d="fix";r.append(Se(o,"Intent",["fix","change","question","approve"].map(p=>({active:p===d,activeStyle:`background:${U[p].bg};border-color:${U[p].border};color:${U[p].fg}`,key:p,label:Qe[p]})),p=>{d=p}));let x="important";r.append(Se(o,"Severity",["blocking","important","suggestion"].map(p=>({active:p===x,activeStyle:`background:${o.btnBg};border-color:${o.primary};color:${o.primary}`,key:p,label:Ke[p]})),p=>{x=p}));const h=document.createElement("textarea");h.placeholder=`Feedback about ${e.length} selected elements...`,h.style.cssText=`width:100%;min-height:60px;resize:vertical;margin-bottom:8px;padding:6px 8px;background:${o.btnBg};border:1px solid ${o.btnBorder};color:${o.fg};font:11px/1.4 'JetBrains Mono',monospace;box-sizing:border-box;outline:none;`,h.addEventListener("click",p=>p.stopPropagation()),h.addEventListener("keydown",p=>{p.stopPropagation(),p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),u.click()),p.key==="Escape"&&(p.preventDefault(),q())}),r.append(h);const c=document.createElement("div");c.style.cssText="display:flex;gap:6px;";const u=he("Create",async()=>{const p=h.value.trim();if(!p){h.style.borderColor=o.danger;return}const b=Y();if(!b)return;const T=Bt(t.x+t.width/2,t.y+t.height/2),v={boundingBox:{height:t.height,width:t.width,x:t.x+window.scrollX,y:t.y+window.scrollY},comment:p,elementBoundingBoxes:n,elementTag:"multi-select",intent:d,isMultiSelect:!0,severity:x,url:globalThis.location.href,x:T.x,y:T.y};await b.createAnnotation(v),await X(),q(),K("Annotation created")});c.append(u),c.append(he("Cancel",()=>q())),r.append(c),r.append(At(o,()=>q())),pt(r,t.x+t.width/2,t.bottom,h)},"showMultiSelectForm"),bo=_(e=>{q(),N();const t=We();document.getElementById(it)?.remove();const n=document.createElement("div");n.id=it,n.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`top:${e.y}px`,`left:${e.x}px`,`width:${e.width}px`,`height:${e.height}px`,"border:2px dashed rgba(34,197,94,0.7)","background:rgba(34,197,94,0.04)","transition:opacity 0.15s"].join(";");const o=document.createElement("div");o.style.cssText="position:absolute;top:-10px;right:-10px;width:20px;height:20px;border-radius:50%;background:#22c55e;color:#fff;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:bold;line-height:1;pointer-events:none;",o.textContent="+",n.append(o),document.body.append(n);const i=document.createElement("div");i.id=be,i.style.cssText=["position:fixed","z-index:2147483647",`background:${t.bg}`,`border:1px solid ${t.btnBorder}`,"padding:12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${t.fg}`,`box-shadow:${t.shadow}`,"min-width:280px","max-width:360px","pointer-events:auto"].join(";");const r=document.createElement("div");r.style.cssText=`color:${t.primary};font-weight:bold;margin-bottom:8px;font-size:12px;`,r.textContent="Area selection",i.append(r);let a="fix";i.append(Se(t,"Intent",["fix","change","question","approve"].map(u=>({active:u===a,activeStyle:`background:${U[u].bg};border-color:${U[u].border};color:${U[u].fg}`,key:u,label:Qe[u]})),u=>{a=u}));let l="important";i.append(Se(t,"Severity",["blocking","important","suggestion"].map(u=>({active:u===l,activeStyle:`background:${t.btnBg};border-color:${t.primary};color:${t.primary}`,key:u,label:Ke[u]})),u=>{l=u}));const d=document.createElement("textarea");d.placeholder="Describe what should change in this area...",d.style.cssText=`width:100%;min-height:60px;resize:vertical;margin-bottom:8px;padding:6px 8px;background:${t.btnBg};border:1px solid ${t.btnBorder};color:${t.fg};font:11px/1.4 'JetBrains Mono',monospace;box-sizing:border-box;outline:none;`,d.addEventListener("click",u=>u.stopPropagation()),d.addEventListener("keydown",u=>{u.stopPropagation(),u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),c.click()),u.key==="Escape"&&(u.preventDefault(),x())}),i.append(d);const x=_(()=>{q(),document.getElementById(it)?.remove()},"cleanup"),h=document.createElement("div");h.style.cssText="display:flex;gap:6px;justify-content:flex-end;",h.append(he("Cancel",x));const c=he("Add",async()=>{const u=d.value.trim();if(!u){d.style.borderColor=t.danger;return}const p=Y();if(p){c.textContent="Adding...",c.disabled=!0;try{const b=Bt(e.x+e.width/2,e.y+e.height/2),T={boundingBox:{height:e.height,width:e.width,x:e.x+window.scrollX,y:e.y+window.scrollY},comment:u,elementLabel:"Area selection",elementPath:`region at (${Math.round(e.x)}, ${Math.round(e.y)})`,elementTag:"area",intent:a,isMultiSelect:!0,severity:l,url:globalThis.location.href,x:b.x,y:b.y};await p.createAnnotation(T),await X(),x(),K("Annotation created")}catch{c.textContent="Error — retry",c.disabled=!1}}},"#22c55e");h.append(c),i.append(h),i.append(At(t,x)),pt(i,e.x+e.width/2,e.bottom,d)},"showAreaSelectionForm"),yo=_((e,t,n)=>{const o=window.innerWidth,i=window.innerHeight,r=8;let a;n+r+e.height<=i-r?a=n+r:n-r-e.height>=r?a=n-r-e.height:a=Math.max(r,i-e.height-r);let l;return t+e.width<=o-r?l=t:t-e.width>=r?l=t-e.width:l=Math.max(r,o-e.width-r),{left:l,top:a}},"computePopupPosition"),pt=_((e,t,n,o)=>{e.style.top="-9999px",e.style.left="-9999px",e.parentElement||document.body.append(e);const i=_(()=>{if(!document.contains(e))return;const a=e.getBoundingClientRect(),{left:l,top:d}=yo(a,t,n);e.style.top=`${d}px`,e.style.left=`${l}px`},"applyPosition");requestAnimationFrame(()=>{i(),o?.focus()});const r=new ResizeObserver(()=>{i()});r.observe(e),e.__resizeObserver=r},"positionFormNearAnchor"),Se=_((e,t,n,o)=>{const i=document.createElement("div");i.style.cssText="margin-bottom:8px;";const r=document.createElement("div");r.style.cssText=`color:${e.muted};font-size:10px;margin-bottom:4px;`,r.textContent=t,i.append(r);const a=document.createElement("div");a.style.cssText="display:flex;gap:4px;";const l=[];for(const d of n){const x=document.createElement("button");x.type="button",x.textContent=d.label,x.dataset.key=d.key,x.style.cssText=`cursor:pointer;font:10px/1 'JetBrains Mono',monospace;padding:4px 8px;border:1px solid;white-space:nowrap;${d.active?d.activeStyle:`background:${e.btnBg};border-color:${e.btnBorder};color:${e.muted}`}`,x.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),o(d.key);for(const c of l){const u=n.find(p=>p.key===c.dataset.key);c.dataset.key===d.key&&u?Object.assign(c.style,vo(u.activeStyle)):(c.style.background=e.btnBg,c.style.borderColor=e.btnBorder,c.style.color=e.muted)}}),l.push(x),a.append(x)}return i.append(a),i},"createToggleGroup"),vo=_(e=>{const t={};for(const n of e.split(";")){const o=n.indexOf(":");if(o===-1)continue;const i=n.slice(0,o).trim(),r=n.slice(o+1).trim();if(i&&r){const a=i.replaceAll(/-([a-z])/g,(l,d)=>d.toUpperCase());t[a]=r}}return t},"parseInlineStyle"),N=_(()=>{const e=document.querySelector(`#${Lt}`);e?.annotationId&&ut(e.annotationId,!1),e?.__cleanup?.(),e?.__resizeObserver?.disconnect(),e?.remove()},"removeAnnotationDetail"),ut=_((e,t)=>{const n=document.querySelector(`.${fe}[data-annotation-id="${e}"]`);if(n)if(t){n.dataset.popupOpen="true",n.style.transform="scale(1.25)";const o=n.querySelector("span:not(.__vdt_edit_icon)");if(o&&(o.style.display="none"),n.querySelector(".__vdt_edit_icon"))n.querySelector(".__vdt_edit_icon").style.display="flex";else{const i=document.createElement("span");i.className="__vdt_edit_icon",i.style.cssText="display:flex;align-items:center;justify-content:center;";const r=new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>',"image/svg+xml");i.append(r.documentElement),n.append(i)}}else{delete n.dataset.popupOpen,n.style.transform="";const o=n.querySelector("span:not(.__vdt_edit_icon)");o&&(o.style.display="");const i=n.querySelector(".__vdt_edit_icon");i&&(i.style.display="none")}},"setMarkerPopupOpen"),$e=_(e=>{N(),q(),ut(e.id,!0);const t=We(),n=U[e.intent],o=t.bg==="#18181b",i=document.createElement("div");i.id=Lt,i.annotationId=e.id,i.style.cssText=["position:fixed","z-index:2147483647",`background:${t.bg}`,`border:1px solid ${o?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.1)"}`,"padding:0","font:12px/1.5 -apple-system,BlinkMacSystemFont,system-ui,sans-serif",`color:${t.fg}`,`box-shadow:0 8px 32px rgba(0,0,0,${o?"0.5":"0.15"}),0 0 0 1px rgba(${o?"255,255,255,0.06":"0,0,0,0.06"})`,"width:360px","max-height:70vh","overflow:hidden","display:flex","flex-direction:column","pointer-events:auto"].join(";");const{left:r,top:a}=Ne(e.x,e.y,e.isFixed??!1),l=document.createElement("div");l.style.cssText=`display:flex;align-items:center;gap:6px;padding:10px 12px;border-bottom:1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"};flex-shrink:0;`;const d=document.createElement("span");d.textContent=Qe[e.intent].toUpperCase(),d.style.cssText=`font-size:10px;font-weight:700;letter-spacing:0.05em;padding:2px 6px;background:${n.bg};color:${n.fg};`,l.append(d);const x=document.createElement("span");x.textContent=Ke[e.severity],x.style.cssText=`font-size:10px;font-weight:600;color:${e.severity==="blocking"?t.danger:t.muted};`,l.append(x);const h=document.createElement("span");h.textContent=e.status.toUpperCase(),h.style.cssText=`font-size:10px;font-weight:700;letter-spacing:0.08em;padding:2px 6px;margin-left:auto;background:${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"};color:${t.muted};`,l.append(h);const c=document.createElement("button");c.type="button",c.textContent="×",c.style.cssText=`background:none;border:none;color:${t.muted};cursor:pointer;font-size:16px;padding:0 0 0 4px;line-height:1;`,c.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation(),N()}),l.append(c),i.append(l);const u=document.createElement("div");u.style.cssText="flex:1;overflow-y:auto;padding:10px 12px;";const p=document.createElement("div");p.style.cssText=`padding:8px 10px;background:${o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)"};font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-word;margin-bottom:10px;`,p.textContent=e.comment,u.append(p);const b=document.createElement("details");b.style.cssText=`margin-bottom:10px;font-size:10px;color:${t.muted};`;const T=document.createElement("summary");T.textContent=`${e.elementLabel??e.elementTag}${e.source?` • ${e.source.split("/").pop()}`:""}`,T.style.cssText=`cursor:pointer;font-size:10px;color:${t.muted};padding:4px 0;list-style:none;`,T.addEventListener("click",m=>m.stopPropagation()),b.append(T);const v=document.createElement("div");if(v.style.cssText="padding:6px 0;line-height:1.7;",se(v,"Element",`${e.elementTag}${e.cssClasses?` .${e.cssClasses}`:""}`),e.elementPath&&se(v,"Selector",e.elementPath),e.source&&se(v,"Source",e.source,t.primary),e.frameworkContext&&se(v,"Component",`${e.frameworkContext.componentName} (${e.frameworkContext.framework})`,t.success),e.nearbyText&&se(v,"Context",e.nearbyText),e.selectedText&&se(v,"Selected",`"${e.selectedText}"`),se(v,"URL",e.url),se(v,"Created",new Date(e.createdAt).toLocaleString()),b.append(v),u.append(b),e.thread&&e.thread.length>0){const m=document.createElement("div");m.style.cssText=`font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:${t.muted};margin-bottom:6px;`,m.textContent=`Thread · ${e.thread.length}`,u.append(m);const y=document.createElement("div");y.style.cssText="max-height:160px;overflow-y:auto;margin-bottom:8px;display:flex;flex-direction:column;gap:4px;";for(const w of e.thread){const z=w.role==="human",f=document.createElement("div");f.style.cssText=["max-width:85%","padding:6px 10px",`border-radius:${z?"2px 2px 0 2px":"2px 2px 2px 0"}`,"font-size:11px","line-height:1.45","white-space:pre-wrap","word-break:break-word",`align-self:${z?"flex-end":"flex-start"}`,z?`background:${t.primary};color:#18181b`:`background:${o?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"};color:${t.fg}`].join(";"),f.textContent=w.content;const M=document.createElement("div");M.style.cssText=`font-size:10px;color:${t.muted};margin-top:2px;opacity:0.6;text-align:${z?"right":"left"};`,M.textContent=new Date(w.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});const L=document.createElement("div");L.style.cssText=`display:flex;flex-direction:column;align-items:${z?"flex-end":"flex-start"};`,L.append(f,M),y.append(L)}requestAnimationFrame(()=>{y.scrollTop=y.scrollHeight}),u.append(y)}i.append(u);const D=document.createElement("div");D.style.cssText=`display:flex;gap:6px;align-items:flex-end;padding:8px 12px;border-top:1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"};flex-shrink:0;`;const k=document.createElement("textarea");k.placeholder="Message...",k.rows=1,k.style.cssText=`flex:1;min-height:28px;max-height:80px;resize:none;padding:5px 8px;background:${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)"};border:1px solid transparent;color:${t.fg};font:11px/1.4 -apple-system,BlinkMacSystemFont,system-ui,sans-serif;box-sizing:border-box;outline:none;`,k.addEventListener("click",m=>m.stopPropagation()),k.addEventListener("keydown",m=>m.stopPropagation()),k.addEventListener("focus",()=>{k.style.borderColor=t.primary}),k.addEventListener("blur",()=>{k.style.borderColor="transparent"}),k.addEventListener("input",()=>{k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,80)}px`}),D.append(k);const C=document.createElement("button");C.type="button",C.style.cssText=`width:28px;height:28px;border-radius:50%;border:none;background:${t.primary};color:#18181b;cursor:not-allowed;opacity:0.3;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:opacity 0.15s,background 0.15s;`;const F=new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>',"image/svg+xml");C.append(F.documentElement),C.disabled=!0,k.addEventListener("input",()=>{const m=k.value.trim().length>0;C.disabled=!m,C.style.opacity=m?"1":"0.3",C.style.cursor=m?"pointer":"not-allowed"}),C.addEventListener("click",async m=>{m.preventDefault(),m.stopPropagation();const y=k.value.trim();if(!y)return;await Y()?.updateAnnotation?.(e.id,{threadMessage:{content:y,role:"human",timestamp:new Date().toISOString()}}),K("Message sent"),await X();const w=W.find(z=>z.id===e.id);w&&$e(w)}),D.append(C),i.append(D);const R=document.createElement("div");if(R.style.cssText=`display:flex;align-items:center;gap:4px;padding:6px 12px;border-top:1px solid ${o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)"};flex-shrink:0;`,e.status==="pending"){const m=document.createElement("button");m.type="button",m.textContent="Resolve",m.style.cssText=`padding:4px 10px;border:none;background:${t.success};color:#fff;font-size:10px;font-weight:600;cursor:pointer;`,m.addEventListener("click",async w=>{w.stopPropagation(),await Y()?.updateAnnotation?.(e.id,{status:"resolved"}),K("Annotation resolved"),await X(),N()}),R.append(m);const y=document.createElement("button");y.type="button",y.textContent="Edit",y.style.cssText=`padding:4px 10px;border:1px solid ${t.btnBorder};background:transparent;color:${t.fg};font-size:10px;font-weight:500;cursor:pointer;`,y.addEventListener("click",w=>{for(w.stopPropagation();i.firstChild;)i.firstChild.remove();i.style.padding="0",i.style.overflow="hidden",i.style.display="flex";const z=document.createElement("div");z.style.cssText=`display:flex;align-items:center;padding:10px 12px;border-bottom:1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"};flex-shrink:0;`;const f=document.createElement("span");f.textContent="Edit Annotation",f.style.cssText=`font-size:12px;font-weight:700;color:${t.fg};`,z.append(f);const M=document.createElement("button");M.type="button",M.textContent="×",M.style.cssText=`background:none;border:none;color:${t.muted};cursor:pointer;font-size:16px;padding:0;line-height:1;margin-left:auto;`,M.addEventListener("click",I=>{I.preventDefault(),I.stopPropagation(),N(),$e(e)}),z.append(M),i.append(z);const L=document.createElement("div");L.style.cssText="flex:1;overflow-y:auto;padding:12px;";const Q=document.createElement("div");Q.style.cssText=`font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:${t.muted};margin-bottom:6px;`,Q.textContent="Intent",L.append(Q);let te=e.intent;const re=document.createElement("div");re.style.cssText="display:flex;gap:4px;margin-bottom:12px;";const ye=[];for(const I of["fix","change","question","approve"]){const O=U[I],V=document.createElement("button");V.type="button",V.textContent=Qe[I],V.dataset.intent=I,V.style.cssText=`padding:4px 10px;border:none;font-size:10px;font-weight:600;cursor:pointer;transition:all 0.15s;${I===te?`background:${O.bg};color:${O.fg};box-shadow:0 0 0 1px ${O.border};`:`background:${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"};color:${t.muted};`}`,V.addEventListener("click",G=>{G.preventDefault(),G.stopPropagation(),te=I;for(const ie of ye){const mt=U[ie.dataset.intent];ie.dataset.intent===I?(ie.style.background=mt.bg,ie.style.color=mt.fg,ie.style.boxShadow=`0 0 0 1px ${mt.border}`):(ie.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie.style.color=t.muted,ie.style.boxShadow="none")}}),ye.push(V),re.append(V)}L.append(re);const Me=document.createElement("div");Me.style.cssText=`font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:${t.muted};margin-bottom:6px;`,Me.textContent="Severity",L.append(Me);let ze=e.severity;const Pe=document.createElement("div");Pe.style.cssText="display:flex;gap:4px;margin-bottom:12px;";const Ge=[];for(const I of["blocking","important","suggestion"]){const O=document.createElement("button");O.type="button",O.textContent=Ke[I],O.dataset.severity=I,O.style.cssText=`padding:4px 10px;border:none;font-size:10px;font-weight:600;cursor:pointer;transition:all 0.15s;${I===ze?`background:${t.primary};color:#18181b;`:`background:${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"};color:${t.muted};`}`,O.addEventListener("click",V=>{V.preventDefault(),V.stopPropagation(),ze=I;for(const G of Ge)G.dataset.severity===I?(G.style.background=t.primary,G.style.color="#18181b"):(G.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",G.style.color=t.muted)}),Ge.push(O),Pe.append(O)}L.append(Pe);const Re=document.createElement("div");Re.style.cssText=`font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:${t.muted};margin-bottom:6px;`,Re.textContent="Comment",L.append(Re);const j=document.createElement("textarea");j.value=e.comment,j.style.cssText=`width:100%;min-height:90px;resize:vertical;padding:8px 10px;background:${o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)"};border:1px solid ${o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"};color:${t.fg};font:12px/1.5 -apple-system,BlinkMacSystemFont,system-ui,sans-serif;box-sizing:border-box;outline:none;transition:border-color 0.15s;`,j.addEventListener("click",I=>I.stopPropagation()),j.addEventListener("keydown",I=>I.stopPropagation()),j.addEventListener("focus",()=>{j.style.borderColor=t.primary}),j.addEventListener("blur",()=>{j.style.borderColor=o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"}),L.append(j),i.append(L);const Ie=document.createElement("div");Ie.style.cssText=`display:flex;align-items:center;gap:6px;padding:8px 12px;border-top:1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"};flex-shrink:0;`;const De=document.createElement("button");De.type="button",De.textContent="Save",De.style.cssText=`padding:4px 10px;border:none;background:${t.primary};color:#18181b;font-size:10px;font-weight:600;cursor:pointer;`,De.addEventListener("click",async I=>{I.stopPropagation();const O=j.value.trim();if(!O){j.style.borderColor=t.danger;return}await Y()?.updateAnnotation?.(e.id,{comment:O,intent:te,severity:ze}),K("Annotation saved"),await X();const V=W.find(G=>G.id===e.id);V?(N(),$e(V)):N()}),Ie.append(De);const Fe=document.createElement("button");Fe.type="button",Fe.textContent="Cancel",Fe.style.cssText=`padding:4px 10px;border:1px solid ${t.btnBorder};background:transparent;color:${t.fg};font-size:10px;font-weight:500;cursor:pointer;`,Fe.addEventListener("click",I=>{I.stopPropagation(),N(),$e(e)}),Ie.append(Fe);const Oe=document.createElement("button");Oe.type="button",Oe.textContent="Delete",Oe.style.cssText=`padding:4px 10px;border:none;background:transparent;color:${t.danger};font-size:10px;cursor:pointer;margin-left:auto;`,Oe.addEventListener("click",async I=>{I.stopPropagation(),await Y()?.deleteAnnotation?.(e.id),W=W.filter(O=>O.id!==e.id),K("Annotation deleted"),N(),lt()}),Ie.append(Oe),i.append(Ie),setTimeout(()=>j.focus(),50)}),R.append(y)}const $=document.createElement("div");if($.style.cssText="display:flex;gap:2px;margin-left:auto;",e.status==="pending"){const m=document.createElement("button");m.type="button",m.textContent="Dismiss",m.style.cssText=`padding:4px 8px;border:none;background:transparent;color:${t.muted};font-size:10px;cursor:pointer;`,m.addEventListener("click",async y=>{y.stopPropagation(),await Y()?.updateAnnotation?.(e.id,{status:"dismissed"}),K("Annotation dismissed"),await X(),N()}),$.append(m)}const B=document.createElement("button");B.type="button",B.textContent="Copy",B.style.cssText=`padding:4px 8px;border:none;background:transparent;color:${t.muted};font-size:10px;cursor:pointer;`,B.addEventListener("click",async m=>{m.stopPropagation();try{await navigator.clipboard.writeText(Ct([e])),K("Copied to clipboard")}catch{K("Copy failed","error")}}),$.append(B);const A=document.createElement("button");A.type="button",A.textContent="Delete",A.style.cssText=`padding:4px 8px;border:none;background:transparent;color:${t.danger};font-size:10px;cursor:pointer;`,A.addEventListener("click",async m=>{m.stopPropagation(),await Y()?.deleteAnnotation?.(e.id),W=W.filter(y=>y.id!==e.id),K("Annotation deleted"),N(),lt()}),$.append(A),R.append($),i.append(R),pt(i,r+16,a);const s=_(m=>{!i.contains(m.target)&&!m.target?.classList.contains(fe)&&N()},"outsideHandler"),g=setTimeout(()=>{document.addEventListener("click",s,!0)},100);i.__cleanup=()=>{clearTimeout(g),document.removeEventListener("click",s,!0)}},"showAnnotationDetail");let Ce;const wo=_(()=>{Ce||(Ce=_(e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key==="C"){e.preventDefault();const t=Ct(W);navigator.clipboard.writeText(t).catch(()=>{})}},"markdownShortcutHandler"),document.addEventListener("keydown",Ce))},"attachMarkdownShortcut"),$n=_(()=>{Ce&&(document.removeEventListener("keydown",Ce),Ce=void 0)},"detachMarkdownShortcut"),Nt=_(e=>{if(!e)return!1;for(const t of[be,Lt]){const n=document.querySelector(`#${t}`);if(n&&(e===n||n.contains(e)))return!0}return!!e.closest?.(`.${fe}`)},"isOverAnnotationOverlay");var $o=Object.defineProperty,kn=ae((e,t)=>$o(e,"name",{value:t,configurable:!0}),"o");const ko=kn(e=>{const t={};for(const h of e.attributes)h.name.startsWith("aria-")&&(t[h.name]=h.value);const n=e.getAttribute("role"),o=e.getAttribute("tabindex"),i=o===null?null:Number.parseInt(o,10),r=new Set(["a","button","details","input","select","summary","textarea"]),a=e.tagName.toLowerCase(),l=r.has(a)&&!e.hasAttribute("disabled"),d=e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false",x=l||d||i!==null&&i>=0;return{ariaAttributes:t,focusable:x,role:n,tabindex:i}},"captureA11yInfo"),Eo=kn(e=>{const t=[];e.role&&t.push(`role: ${e.role}`),t.push(`focusable: ${e.focusable}`),e.tabindex!==null&&t.push(`tabindex: ${e.tabindex}`);for(const[n,o]of Object.entries(e.ariaAttributes))t.push(`${n}: ${o}`);return t.join(`
30
+ `)},"formatA11yText");var _o=Object.defineProperty,H=ae((e,t)=>_o(e,"name",{value:t,configurable:!0}),"u");const Mt="__vdt_ruler_corner",zt="__vdt_ruler_h",Pt="__vdt_ruler_v",Rt="__vdt_guideline",En='9px "JetBrains Mono","Geist Mono",ui-monospace,monospace';let Le=!1,ke=null,Z=null,ee=null,dt=new Set,Ve=null,Ye=null,Xe=null;const _n=H(e=>{const t=80/e,n=10**Math.floor(Math.log10(t)),o=t/n;let i;o<=1?i=1:o<=2?i=2:o<=5?i=5:i=10;const r=i*n,a=10,l=r/a;return{major:r,minor:l,stepsPerMajor:a}},"computeTickIntervals"),Tn=H((e,t)=>{const n=window.devicePixelRatio||1,o=e.clientWidth,i=20;e.width=o*n,e.height=i*n;const r=e.getContext("2d");if(!r)return;r.scale(n,n),r.clearRect(0,0,o,i),r.strokeStyle=t.btnBorder,r.lineWidth=1,r.beginPath(),r.moveTo(0,i-.5),r.lineTo(o,i-.5),r.stroke();const{scrollX:a}=globalThis,{minor:l,stepsPerMajor:d}=_n(1);r.fillStyle=t.muted,r.strokeStyle=t.muted,r.lineWidth=1,r.font=En,r.textAlign="center",r.textBaseline="top";const x=Math.floor(a/l),h=Math.ceil((a+o)/l);for(let c=x;c<=h;c++){const u=c*l,p=u-a;if(p<0||p>o)continue;const b=c%d===0,T=c%(d/2)===0;let v;b?v=10:T?v=7:v=4,r.beginPath(),r.moveTo(Math.round(p)+.5,i),r.lineTo(Math.round(p)+.5,i-v),r.stroke(),b&&(r.fillStyle=t.fg,r.fillText(String(Math.round(u)),Math.round(p),2),r.fillStyle=t.muted)}},"drawHorizontalRuler"),Cn=H((e,t)=>{const n=window.devicePixelRatio||1,o=20,i=e.clientHeight;e.width=o*n,e.height=i*n;const r=e.getContext("2d");if(!r)return;r.scale(n,n),r.clearRect(0,0,o,i),r.strokeStyle=t.btnBorder,r.lineWidth=1,r.beginPath(),r.moveTo(o-.5,0),r.lineTo(o-.5,i),r.stroke();const{scrollY:a}=globalThis,{minor:l,stepsPerMajor:d}=_n(1);r.fillStyle=t.muted,r.strokeStyle=t.muted,r.lineWidth=1,r.font=En;const x=Math.floor(a/l),h=Math.ceil((a+i)/l);for(let c=x;c<=h;c++){const u=c*l,p=u-a;if(p<0||p>i)continue;const b=c%d===0,T=c%(d/2)===0;let v;b?v=10:T?v=7:v=4,r.beginPath(),r.moveTo(o,Math.round(p)+.5),r.lineTo(o-v,Math.round(p)+.5),r.stroke(),b&&(r.save(),r.fillStyle=t.fg,r.translate(9,Math.round(p)),r.rotate(-Math.PI/2),r.textAlign="center",r.textBaseline="top",r.fillText(String(Math.round(u)),0,0),r.restore())}},"drawVerticalRuler"),qt=H(()=>{Xe&&(Z&&Tn(Z,Xe),ee&&Cn(ee,Xe))},"redraw"),To=H(e=>{const t=[],n=document.querySelectorAll("body *"),o=2e3;let i=0;for(const r of n){if(i>=o)break;if(r.id===Mt||r.id===zt||r.id===Pt||r.classList.contains(Rt))continue;const a=r.getBoundingClientRect();a.width===0&&a.height===0||(e==="horizontal"?t.push(a.top,a.bottom):t.push(a.left,a.right),i++)}return t},"collectSnapEdges"),Co=H((e,t)=>{let n=null,o=6;for(const i of t){const r=Math.abs(i-e);r<o&&(o=r,n=i)}return n},"findSnapEdge"),et=9,Ht=H((e,t,n)=>{const o=document.createElement("div");o.className=Rt;const i=e==="horizontal";o.style.cssText=["position:fixed","z-index:2147483644","pointer-events:none",i?`top:${t}px;left:0;width:100vw;height:0`:`left:${t}px;top:0;width:0;height:100vh`].join(";");const r=document.createElement("div");r.style.cssText=["position:absolute","pointer-events:none",i?"left:0;right:0;height:1px;top:0;transform:translateY(-0.5px)":"top:0;bottom:0;width:1px;left:0;transform:translateX(-0.5px)",`background:${n.primary}`].join(";"),o.append(r);const a=document.createElement("div");a.style.cssText=["position:absolute","pointer-events:auto",i?`left:0;right:0;height:${et*2+1}px;top:${-et}px`:`top:0;bottom:0;width:${et*2+1}px;left:${-et}px`,"background:transparent",i?"cursor:row-resize":"cursor:col-resize"].join(";"),o.append(a);const l=document.createElement("div");l.style.cssText=["position:absolute",`background:${n.primary}`,"color:#fff",'font:9px/1 "JetBrains Mono","Geist Mono",ui-monospace,monospace',"padding:2px 4px","white-space:nowrap","pointer-events:none",i?"left:24px;top:2px":"top:24px;left:2px"].join(";"),o.append(l),document.body.append(o),dt.add(o);let d=t;const x=H(c=>{d=c,i?o.style.top=`${d}px`:o.style.left=`${d}px`;const u=i?d+window.scrollY:d+window.scrollX;l.textContent=`${Math.round(u)}px`},"updatePosition"),h=H(()=>{let c=performance.now(),u=d,p=!1,b=null;l.style.display="";const T=H(D=>{const k=performance.now(),C=i?D.clientY:D.clientX,F=Math.abs(C-u)/Math.max(1,k-c);if(c=k,u=C,b===null&&(b=To(e)),F<3){const R=Co(C,b);if(R!==null){x(R),p||(p=!0,r.style.background="#0D99FF",l.style.background="#0D99FF");return}}p&&(p=!1,r.style.background=n.primary,l.style.background=n.primary),x(C)},"onPointerMove"),v=H(()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",v),l.style.display="none",r.style.background=n.primary,l.style.background=n.primary,(i&&d<20||!i&&d<20)&&(o.remove(),dt.delete(o))},"onPointerUp");document.addEventListener("pointermove",T),document.addEventListener("pointerup",v)},"startDrag");a.addEventListener("pointerdown",c=>{c.preventDefault(),c.stopPropagation(),h()}),x(d),h()},"spawnGuideline"),So=H(e=>{Le||(Xe=e,ke=document.createElement("div"),ke.id=Mt,ke.style.cssText=["position:fixed","top:0","left:0","width:20px","height:20px",`background:${e.bg}`,`border-right:1px solid ${e.btnBorder}`,`border-bottom:1px solid ${e.btnBorder}`,"z-index:2147483646","pointer-events:none"].join(";"),document.body.append(ke),Z=document.createElement("canvas"),Z.id=zt,Z.style.cssText=["position:fixed","top:0","left:20px","height:20px","width:calc(100vw - 20px)",`background:${e.bg}`,"z-index:2147483646","pointer-events:auto","cursor:s-resize"].join(";"),Z.addEventListener("pointerdown",t=>{t.preventDefault(),Ht("horizontal",t.clientY,e)}),document.body.append(Z),ee=document.createElement("canvas"),ee.id=Pt,ee.style.cssText=["position:fixed","top:20px","left:0","width:20px","height:calc(100vh - 20px)",`background:${e.bg}`,"z-index:2147483646","pointer-events:auto","cursor:e-resize"].join(";"),ee.addEventListener("pointerdown",t=>{t.preventDefault(),Ht("vertical",t.clientX,e)}),document.body.append(ee),Tn(Z,e),Cn(ee,e),Ve=qt,window.addEventListener("resize",Ve),Ye=qt,window.addEventListener("scroll",Ye,{passive:!0}),Le=!0)},"createRulers"),Sn=H(()=>{if(Le){ke?.remove(),Z?.remove(),ee?.remove();for(const e of dt)e.remove();dt.clear(),Ve&&(window.removeEventListener("resize",Ve),Ve=null),Ye&&(window.removeEventListener("scroll",Ye),Ye=null),ke=null,Z=null,ee=null,Xe=null,Le=!1}},"removeRulers"),Vt=H(()=>Le,"areRulersVisible"),yt=H(e=>{if(!Le)return!1;const{id:t}=e;return t===Mt||t===zt||t===Pt?!0:e.classList.contains(Rt)},"isRulerElement");var Lo=Object.defineProperty,S=ae((e,t)=>Lo(e,"name",{value:t,configurable:!0}),"l");const Ae=to,Ao=yn,me="__vdt_inspector_overlay",Bo=new Set(["A","B","BLOCKQUOTE","CITE","CODE","EM","FIGCAPTION","H1","H2","H3","H4","H5","H6","I","LABEL","LI","MARK","P","PRE","Q","S","SMALL","SPAN","STRONG","TD","TH","TIME","U"]),Ln="__vdt_inspector_label",kt="__vdt_inspector_cursor",J="__vdt_inspector_badge",Yt="__vdt_inspector_kf",Be="__vdt_inspector_result",tt=S(e=>{if(!e)return!1;if(e.tagName==="DEV-TOOLBAR")return!0;let t=e;for(;t;)if(t instanceof ShadowRoot){if(t.host?.tagName==="DEV-TOOLBAR")return!0;t=t.host}else t=t.parentNode;return!1},"isInsideDevToolbar"),Mo=S(()=>{let e=document.querySelector(`#${me}`);if(!e){const t=Ae();e=document.createElement("div"),e.id=me,e.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`border:1px solid ${t.overlayBorder}`,`background:${t.overlayBg}`,"transition:top 60ms,left 60ms,width 60ms,height 60ms","display:none"].join(";");const n=document.createElement("div");n.id=Ln,n.style.cssText=["position:absolute","bottom:calc(100% + 2px)","left:0",`background:${t.bg}`,`color:${t.primary}`,"font:11px/1.2 'JetBrains Mono',monospace","padding:2px 6px","white-space:nowrap","pointer-events:none",`border:1px solid ${t.btnBorder}`].join(";"),e.append(n),document.body.append(e)}return e},"getOrCreateOverlay"),Et=S(e=>{let t=e;for(;t;){const n=t.dataset.vdtSource;if(n)return n;t=t.parentElement??void 0}},"findSource"),zo=S(e=>{const t=e.split(":");if(t.length<3)return e;const n=t[t.length-2],o=t.slice(0,-2).join(":");return`${o.split("/").pop()??o}:${n}`},"formatSourceShort"),nt=S(e=>{const t=document.querySelector(`#${me}`);if(!t)return;const n=e.getBoundingClientRect();t.style.display="block",t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`;const o=document.querySelector(`#${Ln}`);if(o){const i=e.tagName.toLowerCase(),r=e.id?`#${e.id}`:"",a=e.classList.length>0?`.${[...e.classList].slice(0,3).join(".")}`:"",l=`${i}${r}${a}`,d=Et(e);o.textContent=d?`${l} · ${zo(d)}`:l,n.top<28?(o.style.bottom="auto",o.style.top="calc(100% + 2px)"):(o.style.top="",o.style.bottom="calc(100% + 2px)")}},"updateOverlayPosition"),ve=S(()=>{const e=document.querySelector(`#${me}`);e&&(e.style.display="none")},"hideOverlay"),Po=S(()=>{document.querySelector(`#${me}`)?.remove(),document.querySelector(`#${kt}`)?.remove()},"removeOverlay"),Xt=S(e=>{let t=document.querySelector(`#${kt}`);e?(t||(t=document.createElement("style"),t.id=kt,document.head.append(t)),t.textContent=["*, *::before, *::after { cursor: crosshair !important; }",`#${J}, #${J} * { cursor: pointer !important; }`,`#${Be}, #${Be} * { cursor: pointer !important; }`,".__vdt_annotation_marker, .__vdt_annotation_marker * { cursor: pointer !important; }","#__vdt_annotation_form, #__vdt_annotation_form * { cursor: auto !important; }","#__vdt_annotation_form textarea { cursor: text !important; }","#__vdt_annotation_form button, #__vdt_annotation_form select { cursor: pointer !important; }","#__vdt_annotation_detail, #__vdt_annotation_detail * { cursor: auto !important; }","#__vdt_annotation_detail textarea { cursor: text !important; }","#__vdt_annotation_detail button { cursor: pointer !important; }","#__vdt_clear_confirm, #__vdt_clear_confirm * { cursor: auto !important; }","#__vdt_clear_confirm button { cursor: pointer !important; }","#__vdt_area_outline { cursor: auto !important; }","#__vdt_ruler_h { cursor: s-resize !important; }","#__vdt_ruler_v { cursor: e-resize !important; }",".__vdt_guideline { cursor: row-resize !important; }"].join(" ")):t&&t.remove()},"setCrosshairCursor");let Ue="inspect";const An=S(()=>{document.querySelector(`#${J}`)?.remove()},"removeFloatingBadge"),It=S(e=>new DOMParser().parseFromString(e,"image/svg+xml").documentElement,"parseSvg"),Ut='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/></svg>',Qt='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"/></svg>',Kt='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>',Ro='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/></svg>',Io='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',Do='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>',Fo='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',Oo='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',jo='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/><path d="M12 8v4"/><path d="M12 16h.01"/></svg>',No='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/></svg>';let oe=!0;const we=S((e,t,n,o,i=!1)=>{const r=document.createElement("button");r.type="button",r.title=n,r.dataset.active=i?"1":"",r.style.cssText=["position:relative","display:flex","justify-content:center","align-items:center","border:0","white-space:nowrap","padding:0","margin:0","cursor:pointer",`background:${i?`${e.primary}1f`:"transparent"}`,`color:${i?e.primary:e.muted}`,"transition:all 150ms"].join(";");const a=document.createElement("div");return a.style.cssText="width:24px;height:24px;display:flex;align-items:center;justify-content:center;user-select:none;",a.append(It(t)),r.append(a),r.addEventListener("pointerover",()=>{r.style.background=`${e.primary}14`,r.style.color=e.primary}),r.addEventListener("pointerout",()=>{const l=r.dataset.active==="1";r.style.background=l?`${e.primary}1f`:"transparent",r.style.color=l?e.primary:e.muted}),r.addEventListener("pointerdown",()=>{r.style.transform="scale(0.94)"}),r.addEventListener("pointerup",()=>{r.style.transform=""}),r.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),o()}),r},"makeToolbarButton"),Jt=S((e,t)=>{const n=e.querySelector("svg");n&&n.replaceWith(It(t))},"setButtonIcon"),vt=S((e,t="success")=>{const n="__vdt_toast";document.getElementById(n)?.remove();const o=document.createElement("div");o.id=n,o.textContent=e,o.style.cssText=["position:fixed","z-index:2147483646","bottom:1rem","right:1rem","padding:6px 14px","border-radius:4px",`background:${t==="success"?"#22c55e":"#ef4444"}`,"color:#fff",'font:12px/1 "JetBrains Mono","Geist Mono",ui-monospace,"Cascadia Code","Fira Code",monospace',"font-weight:600","pointer-events:none","opacity:0","transition:opacity 0.2s,transform 0.2s","transform:translateY(4px)"].join(";"),document.body.append(o),requestAnimationFrame(()=>{o.style.opacity="1",o.style.transform="translateY(0)"}),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),200)},1500)},"showToast"),qo=S(e=>{if(!document.querySelector(`#${Yt}`)){const $=document.createElement("style");$.id=Yt,$.textContent="@keyframes __vdt_pulse{0%,100%{opacity:1}50%{opacity:.3}}",document.head.append($)}An(),oe=!0;const t=Ae(),n=document.createElement("div"),o=t===Ao,i=o?"0 6px 24px rgba(0,0,0,.7),0 2px 8px rgba(0,0,0,.5)":"0 4px 20px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.08)";n.id=J,n.style.cssText=["position:fixed","bottom:4rem","left:50%","transform:translateX(-50%)","z-index:2147483645","display:flex","align-items:center","gap:4px","padding:4px",`background:${t.bg}`,"border:0",`box-shadow:${i}`,"pointer-events:auto","user-select:none",'font:13px/1.6 "JetBrains Mono","Geist Mono",ui-monospace,"Cascadia Code","Fira Code",monospace'].join(";"),n.addEventListener("click",$=>$.stopPropagation()),n.addEventListener("mousedown",$=>$.stopPropagation());let r=0,a=0;const l=S($=>{n.style.left=`${$.clientX-r}px`,n.style.top=`${$.clientY-a}px`,n.style.transform="none",n.style.bottom="auto",n.style.cursor="grabbing"},"onDragMove"),d=S(()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",d),n.style.cursor=""},"onDragEnd");n.addEventListener("pointerdown",$=>{if($.target.closest("button"))return;const B=n.getBoundingClientRect();r=$.clientX-B.left,a=$.clientY-B.top,document.addEventListener("pointermove",l),document.addEventListener("pointerup",d)});const x=document.createElement("div");x.style.cssText=["display:flex","flex-direction:column","gap:2px","padding:2px 4px","cursor:grab",`color:${t.muted}`,"opacity:0.4","transition:opacity 0.15s"].join(";"),x.addEventListener("pointerover",()=>{x.style.opacity="0.8"}),x.addEventListener("pointerout",()=>{x.style.opacity="0.4"});for(let $=0;$<3;$++){const B=document.createElement("div");B.style.cssText="display:flex;gap:2px;";for(let A=0;A<2;A++){const s=document.createElement("div");s.style.cssText=`width:2px;height:2px;border-radius:50%;background:${t.muted};`,B.append(s)}x.append(B)}n.append(x),Ue="inspect";const h=S(($,B,A)=>{const s=document.createElement("button");s.type="button",s.title=B;const g=document.createElement("div");g.style.cssText="width:24px;height:24px;display:flex;align-items:center;justify-content:center;user-select:none;",g.append(It($)),s.append(g);const m=S(()=>{const y=Ue===A;s.style.cssText=["position:relative","display:flex","justify-content:center","align-items:center","border:0","white-space:nowrap","padding:0","margin:0","cursor:pointer",`background:${y?`${t.primary}1f`:"transparent"}`,`color:${y?t.primary:t.muted}`,"transition:all 150ms"].join(";")},"applyState");return m(),s.addEventListener("pointerover",()=>{s.style.background=`${t.primary}14`,s.style.color=t.primary}),s.addEventListener("pointerout",m),s.addEventListener("pointerdown",()=>{s.style.transform="scale(0.94)"}),s.addEventListener("pointerup",()=>{s.style.transform=""}),s.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),Ue=A,m();for(const w of n.querySelectorAll("[data-mode]"))w!==s&&w.dispatchEvent(new Event("pointerout"))}),s.dataset.mode=A,s},"createModeButton"),c=h(Oo,"Inspect mode — click to view source & info","inspect");n.append(c);const u=h(jo,"Annotate mode — click to add feedback","annotate");n.append(u);const p=document.createElement("span");p.style.cssText=`width:1px;height:20px;background:${o?"rgba(196,181,253,0.2)":"rgba(124,58,237,0.2)"};flex-shrink:0;`,n.append(p);const b=Qn(),T=we(t,b?Qt:Ut,b?"Resume animations (P)":"Pause animations (P)",()=>{const $=Jn();Jt(T,$?Qt:Ut),T.title=$?"Resume animations (P)":"Pause animations (P)",T.dataset.active=$?"1":"",T.style.color=$?t.primary:t.muted,T.style.background=$?`${t.primary}22`:"transparent"},b);n.append(T);const v=we(t,Kt,"Toggle markers (H)",()=>{oe=!oe;for(const $ of document.querySelectorAll(".__vdt_annotation_marker"))$.style.visibility=oe?"visible":"hidden";Jt(v,oe?Kt:Ro),v.title=oe?"Hide markers (H)":"Show markers (H)",v.dataset.active=oe?"":"1",v.style.color=oe?t.muted:t.primary,v.style.background=oe?"transparent":`${t.primary}22`});n.append(v);const D=we(t,Io,"Copy annotations (C)",async()=>{const $=globalThis.__VISULIMA_DEVTOOLS__?.rpc;if($?.getAnnotations)try{const B=await $.getAnnotations(),{annotationsToMarkdown:A}=await Promise.resolve().then(()=>Vn),s=A(B,_t().outputDetail);await navigator.clipboard.writeText(s),vt("Copied to clipboard")}catch{vt("Copy failed","error")}});n.append(D);const k=Vt(),C=we(t,No,"Toggle rulers (R)",()=>{Vt()?(Sn(),C.dataset.active="",C.style.color=t.muted,C.style.background="transparent"):(So(t),C.dataset.active="1",C.style.color=t.primary,C.style.background=`${t.primary}22`)},k);n.append(C);const F="__vdt_clear_confirm";n.append(we(t,Do,"Clear all annotations (X)",()=>{document.getElementById(F)?.remove();const $=n.getBoundingClientRect(),B=document.createElement("div");B.id=F,B.style.cssText=["position:fixed","z-index:2147483646",`bottom:${window.innerHeight-$.top+6}px`,`left:${$.left}px`,`background:${t.bg}`,`box-shadow:${i}`,"padding:6px 12px","display:flex","align-items:center","gap:8px",'font:12px/1 "JetBrains Mono","Geist Mono",ui-monospace,"Cascadia Code","Fira Code",monospace',`color:${t.fg}`,"pointer-events:auto"].join(";"),B.addEventListener("click",m=>m.stopPropagation()),B.addEventListener("mousedown",m=>m.stopPropagation());const A=document.createElement("span");A.textContent="Clear all annotations?",A.style.cssText=`color:${t.muted};font-size:11px;`;const s=document.createElement("button");s.type="button",s.textContent="Yes, clear",s.style.cssText="background:#ef4444;color:#fff;border:none;padding:4px 10px;cursor:pointer;font-size:11px;font-weight:600;",s.addEventListener("click",async m=>{m.stopPropagation(),B.remove();const y=globalThis.__VISULIMA_DEVTOOLS__?.rpc;if(!y?.getAnnotations||!y?.deleteAnnotation)return;const w=await y.getAnnotations();await Promise.all(w.map(z=>y.deleteAnnotation(z.id))),await X(),vt(`${w.length} annotation${w.length===1?"":"s"} cleared`)});const g=document.createElement("button");g.type="button",g.textContent="Cancel",g.style.cssText=`background:transparent;color:${t.muted};border:1px solid ${t.btnBorder};padding:4px 10px;cursor:pointer;font-size:11px;`,g.addEventListener("click",m=>{m.stopPropagation(),B.remove()}),B.append(A,s,g),document.body.append(B),setTimeout(()=>B.remove(),5e3)}));const R=document.createElement("span");R.style.cssText=`width:1px;height:20px;background:${o?"rgba(196,181,253,0.2)":"rgba(124,58,237,0.2)"};flex-shrink:0;`,n.append(R),n.append(we(t,Fo,"Close inspector (Esc)",()=>{e()})),document.body.append(n)},"createFloatingBadge"),Ho=S((e,t)=>{const n=document.createElement("div");n.style.cssText=`margin-bottom:10px;padding:6px 8px;background:${t.btnBg};border:1px solid ${t.btnBorder};font-size:10px;line-height:1.6;`;const o=document.createElement("div");o.style.cssText=`color:${t.primary};font-weight:bold;margin-bottom:2px;font-size:11px;`,o.textContent="Accessibility",n.append(o);const i=S((a,l,d=!1)=>{const x=document.createElement("div");x.style.cssText="display:flex;gap:6px;align-items:baseline;";const h=document.createElement("span");h.style.cssText=`color:${t.muted};min-width:70px;`,h.textContent=a;const c=document.createElement("span");c.style.cssText=`color:${d?t.primary:t.fg};word-break:break-all;`,c.textContent=l,x.append(h,c),n.append(x)},"addRow");e.role&&i("role",e.role,!0),i("focusable",String(e.focusable)),e.tabindex!==null&&i("tabindex",String(e.tabindex));const r=Object.keys(e.ariaAttributes);for(const a of r)i(a,e.ariaAttributes[a]);if(!e.role&&r.length===0&&e.tabindex===null){const a=document.createElement("div");a.style.cssText=`color:${t.muted};font-style:italic;`,a.textContent="No ARIA attributes",n.append(a)}return n},"renderA11ySection");let Ee;const Vo=S(e=>{const t=e.split(":"),n=Number.parseInt(t.at(-1)??"0",10)||void 0,o=Number.parseInt(t.at(-2)??"0",10)||void 0,i=t.slice(0,-2).join(":");globalThis.__VISULIMA_DEVTOOLS__?.rpc?.openInEditor?.(i,o,n,Mn()).catch(()=>{})},"openInEditor"),le=S(()=>{Ee?.(),Ee=void 0,document.querySelector(`#${Be}`)?.remove()},"removeResultPopup"),ot=S((e,t)=>{const n=Ae(),o=document.createElement("button");return o.textContent=e,o.style.cssText=[`background:${n.btnBg}`,`border:1px solid ${n.btnBorder}`,`color:${n.primary}`,"cursor:pointer","font:11px/1 'JetBrains Mono',monospace","padding:5px 10px","white-space:nowrap"].join(";"),o.addEventListener("pointerover",()=>{o.style.background=n.btnBgHover,o.style.borderColor=n.btnBorderHover}),o.addEventListener("pointerout",()=>{o.style.background=n.btnBg,o.style.borderColor=n.btnBorder}),o.addEventListener("click",i=>{i.stopPropagation(),t()}),o},"makeActionButton"),Wt=S((e,t,n,o,i)=>{Ee?.(),Ee=void 0,le();const r=Ae(),a=document.createElement("div");a.id=Be,a.style.cssText=["position:fixed","z-index:2147483646",`background:${r.bg}`,`border:1px solid ${r.btnBorder}`,"padding:10px 32px 10px 12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${r.fg}`,`box-shadow:${r.shadow}`,"min-width:200px","max-width:400px","pointer-events:auto"].join(";");const l=o??t.left,d=i??t.bottom,x=e.tagName.toLowerCase(),h=e.id?`#${e.id}`:"",c=e.classList.length>0?`.${[...e.classList].slice(0,3).join(".")}`:"",u=document.createElement("div");if(u.style.cssText=`color:${r.primary};font-weight:bold;margin-bottom:4px;word-break:break-all;`,u.textContent=`${x}${h}${c}`,a.append(u),n){const k=document.createElement("div");k.style.cssText=`color:${r.muted};margin-bottom:10px;word-break:break-all;font-size:10px;`,k.textContent=n,a.append(k)}const p=ko(e);a.append(Ho(p,r));const b=document.createElement("div");b.style.cssText="display:flex;gap:6px;flex-wrap:wrap;",n&&b.append(ot("Open in editor",()=>{Vo(n),le()})),b.append(ot("Copy HTML",()=>{navigator.clipboard.writeText(e.outerHTML).catch(()=>{}),le()})),n&&b.append(ot("Copy path",()=>{navigator.clipboard.writeText(n).catch(()=>{}),le()})),b.append(ot("Copy A11y",()=>{navigator.clipboard.writeText(Eo(p)).catch(()=>{}),le()})),a.append(b);const T=document.createElement("button");T.textContent="×",T.style.cssText=["position:absolute","top:6px","right:8px","background:transparent","border:none",`color:${r.muted}`,"cursor:pointer","font:16px/1 'JetBrains Mono',monospace","padding:0","line-height:1","transition:color 0.15s"].join(";"),T.addEventListener("pointerover",()=>{T.style.color=r.fg}),T.addEventListener("pointerout",()=>{T.style.color=r.muted}),T.addEventListener("click",k=>{k.stopPropagation(),le()}),a.append(T),a.style.top="-9999px",a.style.left="-9999px",document.body.append(a),xn(()=>{if(!document.contains(a))return;const k=a.getBoundingClientRect(),C=window.innerWidth,F=window.innerHeight,R=8;let $;d+R+k.height<=F-R?$=d+R:d-t.height-R-k.height>=R?$=d-t.height-R-k.height:$=Math.max(R,F-k.height-R);let B;B=l+k.width<=C-R?l:Math.max(R,C-k.width-R),a.style.top=`${$}px`,a.style.left=`${B}px`},0);const v=S(k=>{a.contains(k.target)||(le(),document.removeEventListener("click",v,!0),Ee=void 0)},"handleOutside"),D=setTimeout(()=>{document.addEventListener("click",v,!0)},100);Ee=S(()=>{clearTimeout(D),document.removeEventListener("click",v,!0)},"removePopupOutsideHandler")},"showResultPopup");let at;const Yo=S(e=>{at?.(),Mo(),Xt(!0),X().catch(()=>{}),wo();const t=S(()=>document.querySelector(`#${J}`)??void 0,"badgeElement"),n=S(s=>{if(!s)return!1;const g=t();return!!(g&&(s===g||g.contains(s)))},"isOverBadge"),o=S(s=>{if(!s)return!1;const g=document.querySelector(`#${Be}`);return!!(g&&(s===g||g.contains(s)))},"isOverResultPopup"),i=new MutationObserver(s=>{for(const g of s)for(const m of g.addedNodes)if(m instanceof HTMLElement&&(m.tagName==="VITE-ERROR-OVERLAY"||m.id==="vite-error-overlay")){C.cleanup(),e();return}});i.observe(document.body,{childList:!0});const r="__vdt_multi_select_outline";let a=[];const l={cmd:!1,shift:!1},d=S(()=>{for(const g of document.querySelectorAll(`.${r}`))g.remove();const s=a.length>1;for(const g of a){const m=g.element.getBoundingClientRect(),y=document.createElement("div");y.className=r,y.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`top:${m.top}px`,`left:${m.left}px`,`width:${m.width}px`,`height:${m.height}px`,s?"border:2px solid rgba(34,197,94,0.7);background:rgba(34,197,94,0.08);":`border:2px solid ${Ae().overlayBorder};background:${Ae().overlayBg};`,"transition:all 0.1s;"].join(""),document.body.append(y)}},"renderMultiSelectOutlines"),x=S(()=>{for(const s of document.querySelectorAll(`.${r}`))s.remove()},"removeMultiSelectOutlines"),h=S(()=>{if(a.length!==0)if(ve(),a.length===1){const s=a[0],g=s.element.getBoundingClientRect(),m=Et(s.element);x(),a=[],Ue==="annotate"?ct(s.element,g,m,void 0,{x:g.left+g.width/2,y:g.top+g.height/2}):Wt(s.element,g,m)}else{const s=a.map(w=>w.element),g=s.map(w=>w.getBoundingClientRect()),m=g.map(w=>({height:w.height,width:w.width,x:w.x,y:w.y})),y=new DOMRect(Math.min(...g.map(w=>w.left)),Math.min(...g.map(w=>w.top)),Math.max(...g.map(w=>w.right))-Math.min(...g.map(w=>w.left)),Math.max(...g.map(w=>w.bottom))-Math.min(...g.map(w=>w.top)));x(),a=[],jt(s,y,m)}},"commitMultiSelect"),c={hasMoved:!1,x:0,y:0},u=S(s=>{if((s.key==="Meta"||s.key==="Control")&&(l.cmd=!0,c.hasMoved&&!Ze())){const g=rt(c.x,c.y);if(g&&!tt(g)){nt(g);const m=document.querySelector(`#${me}`);m&&(m.style.borderStyle="dashed")}}s.key==="Shift"&&(l.shift=!0)},"handleModifierKeyDown"),p=S(s=>{const g=l.cmd&&l.shift;if((s.key==="Meta"||s.key==="Control")&&(l.cmd=!1,c.hasMoved&&!Ze())){const y=_e(c.x,c.y);if(y&&!tt(y)){nt(y);const w=document.querySelector(`#${me}`);w&&(w.style.borderStyle="solid")}}s.key==="Shift"&&(l.shift=!1);const m=l.cmd&&l.shift;g&&!m&&a.length>0&&h()},"handleModifierKeyUp"),b=S(()=>{l.cmd=!1,l.shift=!1,a.length>0&&(x(),a=[])},"handleModifierBlur");document.addEventListener("keydown",u),document.addEventListener("keyup",p),window.addEventListener("blur",b);const T="__vdt_drag_rect";let v,D=!1;const k=S(()=>{document.querySelector(`#${T}`)?.remove(),v=void 0,D=!1},"removeDragRect"),C={cleanup(){document.removeEventListener("mousemove",C.handleMouseMove),document.removeEventListener("mousedown",C.handleMouseDown),document.removeEventListener("mouseup",C.handleMouseUp,!0),document.removeEventListener("click",C.handleClick,!0),document.removeEventListener("keydown",C.handleKeyDown),i.disconnect(),ve(),Po(),k(),x(),a=[],document.removeEventListener("__vdt_annotation_form_closed",A),document.removeEventListener("keydown",u),document.removeEventListener("keyup",p),window.removeEventListener("blur",b),Xt(!1),Sn(),An(),at=void 0},handleClick(s){const g=((s.metaKey||s.ctrlKey)&&!s.shiftKey?rt(s.clientX,s.clientY):_e(s.clientX,s.clientY))??s.target;if(!g||tt(g)||n(g)||o(g)||Nt(g)||yt(g))return;if((s.metaKey||s.ctrlKey)&&s.shiftKey){s.preventDefault(),s.stopPropagation();const w=a.findIndex(z=>z.element===g);w===-1?a.push({element:g,name:Tt(g),rect:g.getBoundingClientRect()}):a.splice(w,1),d();return}if(s.preventDefault(),s.stopPropagation(),Ze()){fo();return}if(!_t().blockInteractions&&g.closest?.("button, a, input, select, textarea, [role='button'], [onclick]"))return;wn();const m=g.getBoundingClientRect(),y=Et(g);Ue==="annotate"?(nt(g),ct(g,m,y,void 0,{x:s.clientX,y:s.clientY})):(ve(),Wt(g,m,y,s.clientX,s.clientY))},handleKeyDown(s){const g=s.target?.tagName;if(g==="INPUT"||g==="TEXTAREA"||g==="SELECT")return;if(s.key==="Escape"){if(a.length>0){x(),a=[];return}C.cleanup(),e();return}const m=s.key.toLowerCase();if(m==="p"){s.preventDefault(),document.querySelector(`#${J} button[title*="animations"]`)?.click();return}if(m==="h"){s.preventDefault(),document.querySelector(`#${J} button[title*="markers"]`)?.click();return}if(m==="c"&&!s.ctrlKey&&!s.metaKey){s.preventDefault(),document.querySelector(`#${J} button[title*="Copy"]`)?.click();return}if(m==="r"){s.preventDefault(),document.querySelector(`#${J} button[title*="rulers"]`)?.click();return}m==="x"&&(s.preventDefault(),document.querySelector(`#${J} button[title*="Clear"]`)?.click())},handleMouseDown(s){const g=s.composedPath()[0]||s.target;g.closest?.(`#${J}`)||g.closest?.(`#${Be}`)||g.classList?.contains("__vdt_annotation_marker")||yt(g)||g.closest?.("#__vdt_annotation_form")||g.closest?.("#__vdt_annotation_detail")||Bo.has(g.tagName)||g.isContentEditable||(v={x:s.clientX,y:s.clientY},D=!1)},handleMouseMove(s){if(Ze())return;if(v){const w=s.clientX-v.x,z=s.clientY-v.y,f=w*w+z*z,M=8;if(!D&&f<M*M)return;D=!0;let L=document.querySelector(`#${T}`);L||(L=document.createElement("div"),L.id=T,L.style.cssText="position:fixed;pointer-events:none;z-index:2147483644;border:2px dashed rgba(99,102,241,0.7);background:rgba(99,102,241,0.1);",document.body.append(L));const Q=Math.min(v.x,s.clientX),te=Math.min(v.y,s.clientY),re=Math.abs(s.clientX-v.x),ye=Math.abs(s.clientY-v.y);L.style.left=`${Q}px`,L.style.top=`${te}px`,L.style.width=`${re}px`,L.style.height=`${ye}px`;return}c.x=s.clientX,c.y=s.clientY,c.hasMoved=!0;const g=(s.metaKey||s.ctrlKey)&&!s.shiftKey,m=(g?rt(s.clientX,s.clientY):_e(s.clientX,s.clientY))??s.target;if(!m||tt(m)||n(m)||o(m)||Nt(m)||yt(m)){ve();return}nt(m);const y=document.querySelector(`#${me}`);y&&(y.style.borderStyle=g?"dashed":"solid")},handleMouseUp(s){if(!v||!D){k();return}s.preventDefault(),s.stopPropagation();const g=Math.min(v.x,s.clientX),m=Math.min(v.y,s.clientY),y=Math.abs(s.clientX-v.x),w=Math.abs(s.clientY-v.y);if(k(),y<20||w<20)return;const z=new DOMRect(g,m,y,w),f=mn(z);if(ve(),f.length===0)bo(z);else{const M=gn(f);jt(f,z,M)}}},{cleanup:F,handleClick:R,handleKeyDown:$,handleMouseMove:B}=C;qo(()=>{F(),e()});const A=S(()=>{ve()},"onFormClosed");document.addEventListener("__vdt_annotation_form_closed",A),document.addEventListener("mousemove",B),document.addEventListener("mousedown",C.handleMouseDown),document.addEventListener("mouseup",C.handleMouseUp,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",$),at=F},"startGlobalInspection"),Xo=S(()=>{at?.(),le(),vn(),$n();const e=globalThis.__VISULIMA_DEVTOOLS__;e?.getActiveApp?.()==="dev-toolbar:annotations"&&e.setAppActive?.("dev-toolbar:annotations",!1)},"stopGlobalInspection"),Jo={icon:zn,id:"dev-toolbar:inspector",name:"Inspector",onClick(){const e=globalThis.__VISULIMA_DEVTOOLS__;Yo(async()=>{try{if(vn(),$n(),e?.getActiveApp?.()==="dev-toolbar:annotations")try{await e.closeApp?.()}catch{}}finally{e?.setAppActive&&e.setAppActive("dev-toolbar:inspector",!1)}})},onDeactivate(){Xo()}};export{Jo as default};
@@ -1,3 +1,4 @@
1
- import type { DevToolbarApp } from "../../types/app.d.ts";
1
+ import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
2
+ import 'preact';
2
3
  declare const moduleGraphApp: DevToolbarApp;
3
- export default moduleGraphApp;
4
+ export { moduleGraphApp as default };