@visulima/dev-toolbar 1.0.21 → 1.1.0

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 (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/apps/assets/index.js +2 -2
  3. package/dist/apps/inspector/index.js +9 -9
  4. package/dist/apps/module-graph/index.js +2 -2
  5. package/dist/apps/performance/index.js +2 -2
  6. package/dist/apps/seo/index.js +2 -2
  7. package/dist/apps/tailwind/index.js +4 -4
  8. package/dist/apps/vite-config/index.js +2 -2
  9. package/dist/packem_shared/BoolValue-CKN2S4KV.js +1 -0
  10. package/dist/packem_shared/CodeBlock-DVDIfOgE.js +1 -0
  11. package/dist/packem_shared/CopyButton-_TtOAEvr.js +1 -0
  12. package/dist/packem_shared/DisclosureHeader-z3hDqnts.js +1 -0
  13. package/dist/packem_shared/EmptyState-DMT9PjPE.js +1 -0
  14. package/dist/packem_shared/HeaderBar-DPwJb8W_.js +1 -0
  15. package/dist/packem_shared/KeyValue-12PL9nf8.js +1 -0
  16. package/dist/packem_shared/LoadingState-DQzchtCU.js +1 -0
  17. package/dist/packem_shared/MessageList-CWE27CLz.js +1 -0
  18. package/dist/packem_shared/MetaRow-D3xz3WXV.js +1 -0
  19. package/dist/packem_shared/Note-DN-sxFDq.js +1 -0
  20. package/dist/packem_shared/PairTable-CIV3iFyG.js +1 -0
  21. package/dist/packem_shared/Row-BAdM4zwe.js +1 -0
  22. package/dist/packem_shared/Section-B9rL8rvP.js +1 -0
  23. package/dist/packem_shared/SerpSnippet-D7Etg0sj.js +1 -0
  24. package/dist/packem_shared/SocialCard-GEUteejR.js +1 -0
  25. package/dist/packem_shared/Stack-C_H0Unm4.js +1 -0
  26. package/dist/packem_shared/StatStrip-DQJPlsQ8.js +1 -0
  27. package/dist/packem_shared/TabView-BgRrdV2b.js +1 -0
  28. package/dist/packem_shared/TagCard--5HMFUc1.js +1 -0
  29. package/dist/packem_shared/Text-DLdg2mRx.js +1 -0
  30. package/dist/packem_shared/builder-CPG-rrRv.js +1 -0
  31. package/dist/packem_shared/index-DMbUhqea.js +1 -0
  32. package/dist/packem_shared/sharedToolbarStylesheet-D6f2SgkO.js +2 -0
  33. package/dist/packem_shared/useCopy-3LQUaNDI.js +1 -0
  34. package/dist/toolbar/index.js +3 -3
  35. package/dist/ui/index.d.ts +258 -3
  36. package/dist/ui/index.js +1 -1
  37. package/package.json +18 -18
  38. package/dist/packem_shared/sharedToolbarStylesheet-DN0y3B5k.js +0 -2
@@ -1,4 +1,4 @@
1
- import{addHookName as n}from"preact/devtools";import{clsx as k}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as l,useRef as M,useEffect as R}from"preact/hooks";import{jsxs as t,jsx as r}from"preact/jsx-runtime";import g from"../../packem_shared/Button-C47WESqv.js";import S from"../../packem_shared/Input-ChP0V9d9.js";const z=`<!-- @license lucide-static v1.31.0 - ISC -->
1
+ import{addHookName as l}from"preact/devtools";import{clsx as k}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as i,useRef as M,useEffect as j}from"preact/hooks";import{jsx as r,jsxs as t}from"preact/jsx-runtime";import E from"../../packem_shared/LoadingState-DQzchtCU.js";import g from"../../packem_shared/Button-C47WESqv.js";import R from"../../packem_shared/Input-ChP0V9d9.js";const S=`<!-- @license lucide-static v1.31.0 - ISC -->
2
2
  <svg
3
3
  class="lucide lucide-network"
4
4
  xmlns="http://www.w3.org/2000/svg"
@@ -17,4 +17,4 @@ import{addHookName as n}from"preact/devtools";import{clsx as k}from"../../packem
17
17
  <path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" />
18
18
  <path d="M12 12V8" />
19
19
  </svg>
20
- `,U={css:"bg-purple-500/15 text-purple-400 border-purple-500/30",js:"bg-green-500/15 text-green-400 border-green-500/30",json:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",jsx:"bg-green-500/15 text-green-400 border-green-500/30",svg:"bg-orange-500/15 text-orange-400 border-orange-500/30",ts:"bg-blue-500/15 text-blue-400 border-blue-500/30",tsx:"bg-blue-500/15 text-blue-400 border-blue-500/30",vue:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"},A=/\.([a-z]+)(?:\?|$)/i,G=s=>s.match(A)?.[1]?.toLowerCase()??"?",y=({ext:s})=>r("span",{class:k("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",U[s]??"bg-foreground/6 text-muted-foreground border-border"),children:s}),B=({helpers:s})=>{const[i,C]=n(l([]),"modules"),[I,p]=n(l(!0),"loading"),[b,v]=n(l(void 0),"error"),[h,j]=n(l(""),"search"),[c,a]=n(l(void 0),"selectedId"),[w,x]=n(l([]),"importersList"),L=n(M(null),"searchRef"),m=()=>{p(!0),v(void 0),a(void 0),s.rpc.getModuleGraph().then(e=>{const d=e.map(o=>({ext:G(o.url??o.id??""),id:o.id??o.url??"",importers:o.importerCount??0,importerUrls:Array.isArray(o.importerUrls)?o.importerUrls:[],url:o.url??o.id??""}));C(d),p(!1)}).catch(e=>{v(e.message??"Failed to load module graph"),p(!1)})};R(()=>{m()},[]);const f=i.filter(e=>{const d=h.toLowerCase();return!d||e.url.toLowerCase().includes(d)||e.ext.includes(d)}),u=c?i.find(e=>e.id===c):void 0,E=e=>{if(c===e.id){a(void 0),x([]);return}a(e.id),x(e.importerUrls)};return I?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[r("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(e=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${e}ms`}},e))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Scanning module graph…"})]}):b?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:b}),r(g,{onClick:m,size:"sm",variant:"outline",children:"Retry"})]}):t("div",{class:"flex flex-col h-full",children:[t("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0",children:[r(S,{class:"flex-1 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:e=>{j(e.target.value)},placeholder:"Filter modules…",ref:L,type:"text",value:h}),t("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[f.length," / ",i.length]}),r(g,{onClick:m,size:"sm",variant:"outline",children:"Refresh"})]}),t("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto divide-y divide-border/30",children:f.length===0?t("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:['No modules match "',h,'"']}):f.map(e=>t("button",{class:k("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",c===e.id&&"bg-primary/6"),onClick:()=>{E(e)},type:"button",children:[r(y,{ext:e.ext}),r("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:e.url}),e.importers>0&&t("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground px-1.5 py-0.5 bg-foreground/6 border border-border/50",children:[e.importers,"↑"]})]},e.id))}),u&&t("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[t("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Module Info"}),r(g,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:()=>{a(void 0),x([])},size:"icon",variant:"ghost",children:"✕"})]}),t("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"URL"}),r("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:u.url})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),r(y,{ext:u.ext})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Importers"}),r("span",{class:"text-[0.8rem] font-mono text-foreground",children:u.importers})]}),w.length>0&&t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Imported by"}),r("div",{class:"space-y-1",children:w.map(e=>r("code",{class:"block text-[0.65rem] font-mono text-muted-foreground break-all",children:e},e))})]})]})]})]})]})},q={component:B,icon:z,id:"dev-toolbar:module-graph",name:"Modules"};export{q as default};
20
+ `,U=/\.([a-z]+)(?:\?|$)/i,z=n=>n.match(U)?.[1]?.toLowerCase()??"?",A=n=>n.map(s=>{const o=s??{},d=o.url??o.id??"";return{ext:z(d),id:o.id??o.url??"",importers:o.importerCount??0,importerUrls:Array.isArray(o.importerUrls)?o.importerUrls:[],url:d}}),G=(n,s)=>{const o=s.toLowerCase();return o?n.filter(d=>d.url.toLowerCase().includes(o)||d.ext.includes(o)):n},B={css:"bg-purple-500/15 text-purple-400 border-purple-500/30",js:"bg-green-500/15 text-green-400 border-green-500/30",json:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",jsx:"bg-green-500/15 text-green-400 border-green-500/30",svg:"bg-orange-500/15 text-orange-400 border-orange-500/30",ts:"bg-blue-500/15 text-blue-400 border-blue-500/30",tsx:"bg-blue-500/15 text-blue-400 border-blue-500/30",vue:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"},y=({ext:n})=>r("span",{class:k("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",B[n]??"bg-foreground/6 text-muted-foreground border-border"),children:n}),T=({helpers:n})=>{const[s,o]=l(i([]),"modules"),[d,p]=l(i(!0),"loading"),[b,v]=l(i(void 0),"error"),[m,C]=l(i(""),"search"),[c,a]=l(i(void 0),"selectedId"),[w,h]=l(i([]),"importersList"),I=l(M(null),"searchRef"),x=()=>{p(!0),v(void 0),a(void 0),n.rpc.getModuleGraph().then(e=>{o(A(e)),p(!1)}).catch(e=>{v(e.message??"Failed to load module graph"),p(!1)})};j(()=>{x()},[]);const f=G(s,m),u=c?s.find(e=>e.id===c):void 0,L=e=>{if(c===e.id){a(void 0),h([]);return}a(e.id),h(e.importerUrls)};return d?r(E,{label:"Scanning module graph…"}):b?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:b}),r(g,{onClick:x,size:"sm",variant:"outline",children:"Retry"})]}):t("div",{class:"flex flex-col h-full",children:[t("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0",children:[r(R,{class:"flex-1 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:e=>{C(e.target.value)},placeholder:"Filter modules…",ref:I,type:"text",value:m}),t("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[f.length," / ",s.length]}),r(g,{onClick:x,size:"sm",variant:"outline",children:"Refresh"})]}),t("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto divide-y divide-border/30",children:f.length===0?t("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:['No modules match "',m,'"']}):f.map(e=>t("button",{class:k("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",c===e.id&&"bg-primary/6"),onClick:()=>{L(e)},type:"button",children:[r(y,{ext:e.ext}),r("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:e.url}),e.importers>0&&t("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground px-1.5 py-0.5 bg-foreground/6 border border-border/50",children:[e.importers,"↑"]})]},e.id))}),u&&t("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[t("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Module Info"}),r(g,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:()=>{a(void 0),h([])},size:"icon",variant:"ghost",children:"✕"})]}),t("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"URL"}),r("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:u.url})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),r(y,{ext:u.ext})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Importers"}),r("span",{class:"text-[0.8rem] font-mono text-foreground",children:u.importers})]}),w.length>0&&t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Imported by"}),r("div",{class:"space-y-1",children:w.map(e=>r("code",{class:"block text-[0.65rem] font-mono text-muted-foreground break-all",children:e},e))})]})]})]})]})]})},q={component:T,icon:S,id:"dev-toolbar:module-graph",name:"Modules"};export{q as default};
@@ -1,4 +1,4 @@
1
- import{addHookName as x}from"preact/devtools";import{clsx as c}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as H,useRef as T,useEffect as M}from"preact/hooks";import{jsxs as i,jsx as t}from"preact/jsx-runtime";const C=`<!-- @license lucide-static v1.31.0 - ISC -->
1
+ import{addHookName as x}from"preact/devtools";import{clsx as c}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as H,useRef as T,useEffect as C}from"preact/hooks";import{f as S}from"../../packem_shared/index-DMbUhqea.js";import{jsxs as i,jsx as t}from"preact/jsx-runtime";const M=`<!-- @license lucide-static v1.31.0 - ISC -->
2
2
  <svg
3
3
  class="lucide lucide-gauge"
4
4
  xmlns="http://www.w3.org/2000/svg"
@@ -14,4 +14,4 @@ import{addHookName as x}from"preact/devtools";import{clsx as c}from"../../packem
14
14
  <path d="m12 14 4-4" />
15
15
  <path d="M3.34 19a10 10 0 1 1 17.32 0" />
16
16
  </svg>
17
- `,F=60,I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},b=(s,e)=>{const{good:r,poor:n}=I[s];return e<=r?"good":e<=n?"needs-improvement":"poor"};class L{clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=void 0;memoryInterval=void 0;observers=[];rafId=void 0;running=!1;vitals={cls:void 0,fcp:void 0,fid:void 0,lcp:void 0,ttfb:void 0};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||globalThis.window===void 0||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==void 0&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),this.memoryInterval!==void 0&&(clearInterval(this.memoryInterval),this.memoryInterval=void 0);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let r=0,n=0;for(let o=1;o<e.length;o+=1){const a=e[o]-e[o-1];a>0&&a<500&&(r+=a,n+=1)}return n===0?0:Math.min(60,Math.round(1e3/(r/n)))}emit(){const e=this.getSnapshot();for(const r of this.listeners)r(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");if(e.length>0&&e[0]){const r=e[0];this.vitals.ttfb=Math.round(r.responseStart-r.requestStart),this.emit()}}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const n=e.getEntries().at(-1);n&&(this.vitals.lcp=Math.round(n.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const r of e.getEntries()){const n=r;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const r=e.getEntries()[0];r&&(this.vitals.fid=Math.round(r.processingStart-r.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const r of e.getEntries())r.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(r.startTime),this.emit())})}startFps(){let e;const r=n=>{this.running&&(e!==void 0&&(this.fpsSamples.push(n),this.fpsSamples.length>F&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}startLongTasks(){this.tryObserve("longtask",e=>{for(const r of e.getEntries())this.longTaskIdCounter+=1,this.longTasks.push({duration:Math.round(r.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(r.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const r=()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())};r(),this.memoryInterval=setInterval(r,1e3)}tryObserve(e,r){try{const n=new PerformanceObserver(r);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new L,S=s=>s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`,$=s=>`${s} ms`,w={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},R={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},j=({samples:s})=>{if(s.length<2)return t("svg",{height:36,width:120});const o=120/(s.length-1),a=s.map((l,d)=>{const f=d*o,h=36-l/60*36;return`${f.toFixed(1)},${h.toFixed(1)}`}).join(" ");return t("svg",{height:36,style:"overflow: visible",width:120,children:t("polyline",{fill:"none",points:a,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},z=({memory:s})=>{const e=s.usedJSHeapSize/s.jsHeapSizeLimit*100,r=s.totalJSHeapSize/s.jsHeapSizeLimit*100,n=e>50?"bg-warning":"bg-success",o=e>80?"bg-destructive":n;return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[t("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${r}%`}}),t("div",{class:c("absolute left-0 top-0 h-full rounded-full",o),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",t("span",{class:"text-foreground font-medium",children:S(s.usedJSHeapSize)})]}),i("span",{children:["Total: ",t("span",{class:"text-foreground font-medium",children:S(s.totalJSHeapSize)})]}),i("span",{children:["Limit: ",t("span",{class:"text-foreground font-medium",children:S(s.jsHeapSizeLimit)})]})]})]})},P=({label:s,metric:e,unit:r,value:n})=>{if(n===void 0)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:s}),t("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const o=b(e,n),a=e==="cls"?n.toFixed(3):$(n);return i("div",{class:c("flex flex-col items-center gap-1 p-3 border min-w-0",R[o]),children:[t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:s}),t("span",{class:c("text-[0.9rem] font-bold tabular-nums",w[o]),children:a}),t("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:r})]})},B=({task:s})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[s.startTime.toLocaleString()," ms"]}),t("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:t("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,s.duration/200*100)}%`},title:`${s.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[s.duration," ms"]})]}),m=({action:s,children:e,title:r})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[t("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:r}),s]}),t("div",{class:"p-4",children:e})]}),E=120,A=s=>{const[e,r]=x(H(()=>p.getSnapshot()),"snapshot"),n=x(T([]),"fpsHistoryRef");M(()=>(p.start(),p.subscribe(y=>{n.current.push(y.fps),n.current.length>E&&n.current.shift(),r(y)})),[]);const{fps:o,longTasks:a,memory:l,vitals:d}=e,f=o>=30?"needs-improvement":"poor",h=o>=50?"good":f,v=[{label:"LCP",metric:"lcp",unit:"ms",value:d.lcp},{label:"FID",metric:"fid",unit:"ms",value:d.fid},{label:"CLS",metric:"cls",unit:"score",value:d.cls},{label:"FCP",metric:"fcp",unit:"ms",value:d.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:d.ttfb}];return i("div",{class:"p-5 space-y-4",children:[t(m,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[t("span",{class:c("text-3xl font-bold tabular-nums leading-none",w[h]),children:o}),t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),t("div",{class:c("flex-1 min-w-0",w[h]),children:t(j,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[t("span",{children:"60"}),t("span",{children:"30"}),t("span",{children:"0"})]})]})}),l?t(m,{title:"JS Heap Memory",children:t(z,{memory:l})}):t(m,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable ",t("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(m,{title:"Core Web Vitals",children:[t("div",{class:"grid grid-cols-3 gap-2",children:v.map(u=>t(P,{label:u.label,metric:u.metric,unit:u.unit,value:u.value},u.metric))}),t("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),t(m,{action:a.length>0?t("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:()=>{p.clearLongTasks()},type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?t("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):t("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(u=>t(B,{task:u},u.id))})})]})},k=s=>s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`,g={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},J=({samples:s})=>{if(s.length<2)return t("svg",{height:24,width:60});const n=60/(s.length-1),o=s.map((a,l)=>`${(l*n).toFixed(1)},${(24-a/60*24).toFixed(1)}`).join(" ");return t("svg",{height:24,style:"overflow:visible",width:60,children:t("polyline",{fill:"none",points:o,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},_=({memory:s})=>{const e=s.usedJSHeapSize/s.jsHeapSizeLimit*100,r=e>50?"bg-warning":"bg-success",n=e>80?"bg-destructive":r;return i("div",{class:"flex items-center gap-2",children:[t("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:t("div",{class:c("h-full rounded-full",n),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[k(s.usedJSHeapSize)," / ",k(s.jsHeapSizeLimit)]})]})},W=60,O=s=>{const[e,r]=x(H(()=>p.getSnapshot()),"snapshot"),n=x(T([]),"fpsHistoryRef");M(()=>(p.start(),p.subscribe(v=>{n.current.push(v.fps),n.current.length>W&&n.current.shift(),r(v)})),[]);const{fps:o,memory:a,vitals:l}=e,d=o>=30?"needs-improvement":"poor",f=o>=50?"good":d;return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[t("span",{class:c("text-2xl font-bold tabular-nums leading-none",g[f]),children:o}),t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),t("div",{class:c("flex-1 min-w-0",g[f]),children:t(J,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[l.lcp!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("lcp",l.lcp)]),children:[l.lcp," ms"]})]}),l.fcp!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("fcp",l.fcp)]),children:[l.fcp," ms"]})]}),l.cls!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),t("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("cls",l.cls)]),children:l.cls.toFixed(3)})]}),l.lcp===void 0&&l.fcp===void 0&&l.cls===void 0&&t("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),t(_,{memory:a})]})]})},q={component:A,icon:C,id:"dev-toolbar:performance",name:"Performance",tooltip:O};export{q as default};
17
+ `,F=60,I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},b=(r,e)=>{const{good:s,poor:n}=I[r];return e<=s?"good":e<=n?"needs-improvement":"poor"};class L{clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=void 0;memoryInterval=void 0;observers=[];rafId=void 0;running=!1;vitals={cls:void 0,fcp:void 0,fid:void 0,lcp:void 0,ttfb:void 0};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||globalThis.window===void 0||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==void 0&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),this.memoryInterval!==void 0&&(clearInterval(this.memoryInterval),this.memoryInterval=void 0);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,n=0;for(let o=1;o<e.length;o+=1){const a=e[o]-e[o-1];a>0&&a<500&&(s+=a,n+=1)}return n===0?0:Math.min(60,Math.round(1e3/(s/n)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");if(e.length>0&&e[0]){const s=e[0];this.vitals.ttfb=Math.round(s.responseStart-s.requestStart),this.emit()}}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const n=e.getEntries().at(-1);n&&(this.vitals.lcp=Math.round(n.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const n=s;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e;const s=n=>{this.running&&(e!==void 0&&(this.fpsSamples.push(n),this.fpsSamples.length>F&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(s))};this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter+=1,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())};s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const n=new PerformanceObserver(s);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new L,R=r=>`${r} ms`,w={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},j={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},z=({samples:r})=>{if(r.length<2)return t("svg",{height:36,width:120});const o=120/(r.length-1),a=r.map((l,d)=>{const f=d*o,h=36-l/60*36;return`${f.toFixed(1)},${h.toFixed(1)}`}).join(" ");return t("svg",{height:36,style:"overflow: visible",width:120,children:t("polyline",{fill:"none",points:a,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},P=({memory:r})=>{const e=r.usedJSHeapSize/r.jsHeapSizeLimit*100,s=r.totalJSHeapSize/r.jsHeapSizeLimit*100,n=e>50?"bg-warning":"bg-success",o=e>80?"bg-destructive":n;return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[t("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),t("div",{class:c("absolute left-0 top-0 h-full rounded-full",o),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",t("span",{class:"text-foreground font-medium",children:S(r.usedJSHeapSize)})]}),i("span",{children:["Total: ",t("span",{class:"text-foreground font-medium",children:S(r.totalJSHeapSize)})]}),i("span",{children:["Limit: ",t("span",{class:"text-foreground font-medium",children:S(r.jsHeapSizeLimit)})]})]})]})},$=({label:r,metric:e,unit:s,value:n})=>{if(n===void 0)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:r}),t("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const o=b(e,n),a=e==="cls"?n.toFixed(3):R(n);return i("div",{class:c("flex flex-col items-center gap-1 p-3 border min-w-0",j[o]),children:[t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:r}),t("span",{class:c("text-[0.9rem] font-bold tabular-nums",w[o]),children:a}),t("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},E=({task:r})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[r.startTime.toLocaleString()," ms"]}),t("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:t("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,r.duration/200*100)}%`},title:`${r.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[r.duration," ms"]})]}),m=({action:r,children:e,title:s})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[t("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:s}),r]}),t("div",{class:"p-4",children:e})]}),A=120,J=r=>{const[e,s]=x(H(()=>p.getSnapshot()),"snapshot"),n=x(T([]),"fpsHistoryRef");C(()=>(p.start(),p.subscribe(y=>{n.current.push(y.fps),n.current.length>A&&n.current.shift(),s(y)})),[]);const{fps:o,longTasks:a,memory:l,vitals:d}=e,f=o>=30?"needs-improvement":"poor",h=o>=50?"good":f,v=[{label:"LCP",metric:"lcp",unit:"ms",value:d.lcp},{label:"FID",metric:"fid",unit:"ms",value:d.fid},{label:"CLS",metric:"cls",unit:"score",value:d.cls},{label:"FCP",metric:"fcp",unit:"ms",value:d.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:d.ttfb}];return i("div",{class:"p-5 space-y-4",children:[t(m,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[t("span",{class:c("text-3xl font-bold tabular-nums leading-none",w[h]),children:o}),t("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),t("div",{class:c("flex-1 min-w-0",w[h]),children:t(z,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[t("span",{children:"60"}),t("span",{children:"30"}),t("span",{children:"0"})]})]})}),l?t(m,{title:"JS Heap Memory",children:t(P,{memory:l})}):t(m,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable ",t("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(m,{title:"Core Web Vitals",children:[t("div",{class:"grid grid-cols-3 gap-2",children:v.map(u=>t($,{label:u.label,metric:u.metric,unit:u.unit,value:u.value},u.metric))}),t("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),t(m,{action:a.length>0?t("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:()=>{p.clearLongTasks()},type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?t("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):t("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(u=>t(E,{task:u},u.id))})})]})},k=r=>r<1024*1024?`${(r/1024).toFixed(0)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`,g={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},_=({samples:r})=>{if(r.length<2)return t("svg",{height:24,width:60});const n=60/(r.length-1),o=r.map((a,l)=>`${(l*n).toFixed(1)},${(24-a/60*24).toFixed(1)}`).join(" ");return t("svg",{height:24,style:"overflow:visible",width:60,children:t("polyline",{fill:"none",points:o,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},B=({memory:r})=>{const e=r.usedJSHeapSize/r.jsHeapSizeLimit*100,s=e>50?"bg-warning":"bg-success",n=e>80?"bg-destructive":s;return i("div",{class:"flex items-center gap-2",children:[t("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:t("div",{class:c("h-full rounded-full",n),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[k(r.usedJSHeapSize)," / ",k(r.jsHeapSizeLimit)]})]})},W=60,O=r=>{const[e,s]=x(H(()=>p.getSnapshot()),"snapshot"),n=x(T([]),"fpsHistoryRef");C(()=>(p.start(),p.subscribe(v=>{n.current.push(v.fps),n.current.length>W&&n.current.shift(),s(v)})),[]);const{fps:o,memory:a,vitals:l}=e,d=o>=30?"needs-improvement":"poor",f=o>=50?"good":d;return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[t("span",{class:c("text-2xl font-bold tabular-nums leading-none",g[f]),children:o}),t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),t("div",{class:c("flex-1 min-w-0",g[f]),children:t(_,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[l.lcp!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("lcp",l.lcp)]),children:[l.lcp," ms"]})]}),l.fcp!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("fcp",l.fcp)]),children:[l.fcp," ms"]})]}),l.cls!==void 0&&i("div",{class:"flex flex-col gap-0.5",children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),t("span",{class:c("text-[0.8rem] font-semibold tabular-nums",g[b("cls",l.cls)]),children:l.cls.toFixed(3)})]}),l.lcp===void 0&&l.fcp===void 0&&l.cls===void 0&&t("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[t("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),t(B,{memory:a})]})]})},U={component:J,icon:M,id:"dev-toolbar:performance",name:"Performance",tooltip:O};export{U as default};
@@ -1,4 +1,4 @@
1
- import{addHookName as y}from"preact/devtools";import{clsx as h}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as b,useEffect as F,useRef as G}from"preact/hooks";import{jsxs as o,jsx as r,Fragment as _}from"preact/jsx-runtime";import I from"../../packem_shared/Badge-DdZ-eO1L.js";import X from"../../packem_shared/Button-C47WESqv.js";const W=`<!-- @license lucide-static v1.31.0 - ISC -->
1
+ import{addHookName as A}from"preact/devtools";import{useState as W,useEffect as z,useMemo as Q}from"preact/hooks";import{clsx as k}from"../../packem_shared/clsx-BGQISBxA.js";import{jsxs as w,jsx as m}from"preact/jsx-runtime";import Z from"../../packem_shared/CopyButton-_TtOAEvr.js";import{c as ee,J as te,b as re,a as ie}from"../../packem_shared/builder-CPG-rrRv.js";import se from"../../packem_shared/LoadingState-DQzchtCU.js";const oe=`<!-- @license lucide-static v1.31.0 - ISC -->
2
2
  <svg
3
3
  class="lucide lucide-search"
4
4
  xmlns="http://www.w3.org/2000/svg"
@@ -14,4 +14,4 @@ import{addHookName as y}from"preact/devtools";import{clsx as h}from"../../packem
14
14
  <path d="m21 21-4.34-4.34" />
15
15
  <circle cx="11" cy="11" r="8" />
16
16
  </svg>
17
- `,H=()=>{const t=n=>document.querySelector(`meta[name="${n}"]`)?.content??"",e=n=>document.querySelector(`meta[property="og:${n}"]`)?.content??"",s=n=>document.querySelector(`meta[name="twitter:${n}"]`)?.content??document.querySelector(`meta[property="twitter:${n}"]`)?.content??"",i=n=>document.querySelector(`meta[property="article:${n}"]`)?.content??"";return{articleAuthor:i("author"),articleModifiedTime:i("modified_time"),articlePublishedTime:i("published_time"),articleSection:i("section"),canonical:document.querySelector('link[rel="canonical"]')?.href??"",description:t("description"),ogDescription:e("description"),ogImage:e("image"),ogImageAlt:e("image:alt"),ogLocale:e("locale"),ogSiteName:e("site_name"),ogTitle:e("title"),ogType:e("type"),ogUrl:e("url"),title:document.title??"",twitterCard:s("card"),twitterCreator:s("creator"),twitterDescription:s("description"),twitterImage:s("image"),twitterImageAlt:s("image:alt"),twitterSite:s("site"),twitterTitle:s("title")}},Q=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2})?(?:[+-]\d{2}:\d{2}|Z)?)?$/,q=t=>typeof t=="string"&&Q.test(t),l=(t,e)=>t[e]!==void 0&&t[e]!==null&&t[e]!=="",D=t=>Array.isArray(t)&&t.length>0,A=t=>{const e=[];if(!l(t,"headline")&&!l(t,"name")&&e.push({message:"headline (or name) is required",property:"headline",severity:"error"}),l(t,"author")){const s=t.author;typeof s=="object"&&!Array.isArray(s)&&!l(s,"name")&&e.push({message:"author.name is missing",property:"author.name",severity:"warning"})}else e.push({message:"author is required",property:"author",severity:"error"});return l(t,"datePublished")?q(t.datePublished)||e.push({message:"datePublished should be ISO 8601 format (e.g. 2024-01-15T09:00:00Z)",property:"datePublished",severity:"warning"}):e.push({message:"datePublished is required",property:"datePublished",severity:"error"}),l(t,"image")||e.push({message:"image is recommended for rich results",property:"image",severity:"warning"}),l(t,"description")||e.push({message:"description is recommended",property:"description",severity:"suggestion"}),e},Z=t=>{const e=[];l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"});const s=l(t,"offers"),i=l(t,"aggregateRating"),n=l(t,"review");if(!s&&!i&&!n&&e.push({message:"At least one of: offers, aggregateRating, or review is required for rich results",property:"offers",severity:"error"}),s){const a=Array.isArray(t.offers)?t.offers[0]:t.offers;a&&typeof a=="object"&&(!l(a,"price")&&!l(a,"priceSpecification")&&e.push({message:"offers.price is required",property:"offers.price",severity:"error"}),l(a,"priceCurrency")||e.push({message:"offers.priceCurrency is required (e.g. 'USD')",property:"offers.priceCurrency",severity:"error"}))}if(i){const a=t.aggregateRating;l(a,"ratingValue")||e.push({message:"aggregateRating.ratingValue is required",property:"aggregateRating.ratingValue",severity:"error"}),!l(a,"reviewCount")&&!l(a,"ratingCount")&&e.push({message:"aggregateRating.reviewCount (or ratingCount) is required",property:"aggregateRating.reviewCount",severity:"error"})}return l(t,"image")||e.push({message:"image is recommended for rich results",property:"image",severity:"suggestion"}),e},ee=t=>{const e=[],s=t.itemListElement;return D(s)?(s.length<2&&e.push({message:"itemListElement should have at least 2 items",property:"itemListElement",severity:"warning"}),s.forEach((i,n)=>{i.position!==n+1&&e.push({message:`itemListElement[${n}].position should be ${n+1}`,property:`itemListElement[${n}].position`,severity:"warning"}),i.name||i.item?.name||e.push({message:`itemListElement[${n}].name is required`,property:`itemListElement[${n}].name`,severity:"error"})}),e):(e.push({message:"itemListElement array is required",property:"itemListElement",severity:"error"}),e)},te=t=>{const e=[],s=t.mainEntity;return D(s)?(s.forEach((i,n)=>{l(i,"name")||e.push({message:`mainEntity[${n}].name (question text) is required`,property:`mainEntity[${n}].name`,severity:"error"});const a=i.acceptedAnswer;(!a||!l(a,"text"))&&e.push({message:`mainEntity[${n}].acceptedAnswer.text is required`,property:`mainEntity[${n}].acceptedAnswer.text`,severity:"error"})}),e):(e.push({message:"mainEntity array with at least one Question is required",property:"mainEntity",severity:"error"}),e)},O=t=>{const e=[];l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"startDate")?q(t.startDate)||e.push({message:"startDate should be ISO 8601 format",property:"startDate",severity:"warning"}):e.push({message:"startDate is required",property:"startDate",severity:"error"});const s=t.location;return s?l(s,"name")||e.push({message:"location.name is required",property:"location.name",severity:"error"}):e.push({message:"location is required",property:"location",severity:"error"}),l(t,"description")||e.push({message:"description is recommended",property:"description",severity:"suggestion"}),e},K=t=>{const e=[];return l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"url")||e.push({message:"url is recommended",property:"url",severity:"warning"}),l(t,"logo")||e.push({message:"logo is recommended for Knowledge Panel eligibility",property:"logo",severity:"suggestion"}),e},re=t=>{const e=[];return l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"url")||e.push({message:"url is recommended",property:"url",severity:"suggestion"}),e},ie=t=>{const e=[];return l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"image")||e.push({message:"image is required for rich results",property:"image",severity:"error"}),!l(t,"recipeIngredient")&&!l(t,"ingredients")&&e.push({message:"recipeIngredient is recommended",property:"recipeIngredient",severity:"suggestion"}),l(t,"recipeInstructions")||e.push({message:"recipeInstructions is recommended",property:"recipeInstructions",severity:"suggestion"}),l(t,"author")||e.push({message:"author is recommended",property:"author",severity:"suggestion"}),e},L=t=>{const e=[];return l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"url")||e.push({message:"url is recommended",property:"url",severity:"warning"}),e},se=t=>{const e=[];return l(t,"name")||e.push({message:"name is required",property:"name",severity:"error"}),l(t,"description")||e.push({message:"description is required",property:"description",severity:"error"}),l(t,"thumbnailUrl")||e.push({message:"thumbnailUrl is required for rich results",property:"thumbnailUrl",severity:"error"}),l(t,"uploadDate")?q(t.uploadDate)||e.push({message:"uploadDate should be ISO 8601 format",property:"uploadDate",severity:"warning"}):e.push({message:"uploadDate is required",property:"uploadDate",severity:"error"}),e},Y={Article:A,BlogPosting:A,BreadcrumbList:ee,Event:O,EventSeries:O,FAQPage:te,LocalBusiness:K,NewsArticle:A,Organization:K,Person:re,Product:Z,Recipe:ie,VideoObject:se,WebPage:L,WebSite:L},oe=new Set(Object.keys(Y)),ne=t=>{const e=[],s=String(t["@context"]??""),i=String(t["@type"]??"");if(s){let a=!1;try{const g=new URL(s).hostname.toLowerCase();a=g==="schema.org"||g.endsWith(".schema.org")}catch{}a||e.push({message:"@context should reference schema.org",property:"@context",severity:"warning"})}else e.push({message:"@context is missing — should be 'https://schema.org'",property:"@context",severity:"error"});if(!i)return e.push({message:"@type is required",property:"@type",severity:"error"}),e;oe.has(i)||e.push({message:`@type '${i}' is not validated — no known rules for this type`,property:"@type",severity:"suggestion"});const n=Y[i];return n&&e.push(...n(t)),e},ae=t=>t.some(e=>e.severity==="error")?"error":t.some(e=>e.severity==="warning")?"warning":t.some(e=>e.severity==="suggestion")?"suggestion":"ok",N=(t,e,s,i)=>{const n=ne(t),a=String(t["@type"]??"Unknown");return{context:String(t["@context"]??""),graphIndex:s,index:e,messages:n,parsed:t,raw:i??JSON.stringify(t,void 0,2),status:ae(n),type:a}},le=/^\/\/<!\[CDATA\[/,ce=/\/\/\]\]>$/,de=/^<!\[CDATA\[/,pe=/\]\]>$/,ge=()=>{const t=document.querySelectorAll('script[type="application/ld+json"]'),e=[];return t.forEach((s,i)=>{let n=(s.textContent??"").trim();n=n.replace(le,"").replace(ce,""),n=n.replace(de,"").replace(pe,"");try{const a=JSON.parse(n);if(D(a["@graph"])){const g=String(a["@context"]??"");a["@graph"].forEach((d,u)=>{const m={"@context":d["@context"]??g,...d};e.push(N(m,i,u,void 0))})}else e.push(N(a,i,void 0,n))}catch{e.push({context:"",index:i,messages:[{message:"Could not parse JSON content",property:"",severity:"error"}],parsed:{},raw:n,status:"error",type:"Invalid JSON"})}}),e},P=[{description:"Page title shown in browser tabs and search engine results",key:"title",label:"title",priority:"required",snippet:"<title>Your Page Title</title>"},{description:"Title shown when your page is shared on social media",key:"ogTitle",label:"og:title",priority:"required",snippet:'<meta property="og:title" content="Your Page Title" />'},{description:"Description shown when sharing on social media (max 200 chars)",key:"ogDescription",label:"og:description",priority:"required",snippet:'<meta property="og:description" content="Your page description" />'},{description:"Image shown when sharing (recommended: 1200 × 630 px)",key:"ogImage",label:"og:image",priority:"required",snippet:'<meta property="og:image" content="https://yoursite.com/og-image.jpg" />'},{description:"Twitter card format — controls how link previews appear on X / Twitter",key:"twitterCard",label:"twitter:card",priority:"required",snippet:'<meta name="twitter:card" content="summary_large_image" />'},{description:"Meta description used by search engines (max 160 chars)",key:"description",label:"description",priority:"recommended",snippet:'<meta name="description" content="Your page description" />'},{description:"Canonical URL to prevent duplicate content issues with search engines",key:"canonical",label:"canonical",priority:"recommended",snippet:'<link rel="canonical" href="https://yoursite.com/page" />'},{description:"Canonical page URL for Open Graph — should match the canonical link tag",key:"ogUrl",label:"og:url",priority:"recommended",snippet:'<meta property="og:url" content="https://yoursite.com/page" />'},{description:"Type of content: website, article, product, video.movie, etc.",key:"ogType",label:"og:type",priority:"recommended",snippet:'<meta property="og:type" content="website" />'},{description:"Your website name — shown for consistent branding on social platforms",key:"ogSiteName",label:"og:site_name",priority:"recommended",snippet:'<meta property="og:site_name" content="Your Site Name" />'},{description:"Language and territory of page content (e.g. en_US, de_DE, fr_FR)",key:"ogLocale",label:"og:locale",priority:"recommended",snippet:'<meta property="og:locale" content="en_US" />'},{description:"Alt text for the OG image — important for accessibility on social platforms",key:"ogImageAlt",label:"og:image:alt",priority:"recommended",snippet:'<meta property="og:image:alt" content="Description of the shared image" />'},{description:"Override title specifically for X / Twitter cards (falls back to og:title)",key:"twitterTitle",label:"twitter:title",priority:"recommended",snippet:'<meta name="twitter:title" content="Your Page Title" />'},{description:"Override description for X / Twitter cards (falls back to og:description)",key:"twitterDescription",label:"twitter:description",priority:"recommended",snippet:'<meta name="twitter:description" content="Your page description" />'},{description:"Override image for X / Twitter cards (falls back to og:image)",key:"twitterImage",label:"twitter:image",priority:"recommended",snippet:'<meta name="twitter:image" content="https://yoursite.com/twitter-card.jpg" />'},{description:"X / Twitter handle of the website owner (e.g. @yourhandle)",key:"twitterSite",label:"twitter:site",priority:"recommended",snippet:'<meta name="twitter:site" content="@yourhandle" />'}],ue=[{accentClass:"border-blue-500/30",descKey:"ogDescription",id:"facebook",imageKey:"ogImage",name:"Facebook",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-foreground/20",descKey:"twitterDescription",id:"twitter",imageKey:"twitterImage",name:"X / Twitter",requiredKeys:["twitterTitle","twitterDescription","twitterImage","twitterCard"],titleKey:"twitterTitle",urlKey:"ogUrl"},{accentClass:"border-blue-600/30",descKey:"ogDescription",id:"linkedin",imageKey:"ogImage",name:"LinkedIn",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-indigo-500/30",descKey:"ogDescription",id:"discord",imageKey:"ogImage",name:"Discord",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-green-500/30",descKey:"ogDescription",id:"slack",imageKey:"ogImage",name:"Slack",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-purple-500/30",descKey:"ogDescription",id:"mastodon",imageKey:"ogImage",name:"Mastodon",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-sky-500/30",descKey:"ogDescription",id:"bluesky",imageKey:"ogImage",name:"Bluesky",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"}],me=({meta:t,platform:e})=>{const s=t[e.titleKey]||t.title||"No title",i=t[e.descKey]||t.description||"",n=t[e.imageKey]||"",a=t[e.urlKey]||t.canonical||"",g=e.requiredKeys.filter(d=>!t[d]);return o("div",{class:h("border bg-card overflow-hidden",e.accentClass),children:[o("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50 bg-foreground/2",children:[r("span",{class:"text-[0.65rem] font-bold uppercase tracking-wider text-muted-foreground",children:e.name}),g.length>0&&o("span",{class:"text-[0.6rem] px-1.5 py-0.5 bg-warning/10 text-warning border border-warning/20 font-medium",children:["Missing: ",g.join(", ")]})]}),o("div",{class:"p-3",children:[r("div",{class:"w-full aspect-[1200/630] bg-foreground/6 border border-border/50 mb-2.5 overflow-hidden relative",children:n?r("img",{alt:"OG image preview",class:"w-full h-full object-cover",loading:"lazy",src:n}):r("div",{class:"absolute inset-0 flex items-center justify-center",children:r("span",{class:"text-[0.65rem] text-muted-foreground/40 uppercase tracking-wider",children:"No image"})})}),a&&r("div",{class:"text-[0.6rem] text-muted-foreground/60 uppercase tracking-wider truncate mb-1",children:a}),r("div",{class:"text-[0.8rem] font-semibold text-foreground line-clamp-1",children:s}),i&&r("div",{class:"text-[0.7rem] text-muted-foreground line-clamp-2 mt-0.5",children:i})]})]})},p=({label:t,required:e=!1,value:s})=>o("div",{class:"flex items-start gap-3 py-2 border-b border-border/30 last:border-0",children:[r("div",{class:"w-44 shrink-0",children:r("span",{class:"text-[0.7rem] font-mono text-muted-foreground",children:t})}),r("div",{class:"flex-1 min-w-0",children:s?r("span",{class:"text-[0.75rem] text-foreground break-all",children:s}):r("span",{class:h("text-[0.7rem]",e?"text-warning":"text-muted-foreground/40"),children:e?"⚠ Missing":"—"})})]}),w=({children:t})=>o("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-2",children:[r("span",{class:"text-primary/50",children:"// "}),t]}),z=({text:t})=>{const[e,s]=y(b(!1),"copied"),i=y(G(void 0),"timerRef"),n=()=>{navigator.clipboard.writeText(t).then(()=>{s(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(s,2e3,!1)}).catch(()=>{})};return r(X,{class:h("text-[0.6rem] font-mono shrink-0",e?"border-success/40 text-success bg-success/8":""),onClick:n,size:"sm",variant:"outline",children:e?"Copied!":"Copy"})},j=({def:t})=>o("div",{class:"border border-border/60 bg-card p-3 space-y-2",children:[o("div",{class:"flex items-start justify-between gap-3",children:[r("code",{class:"text-[0.7rem] font-mono font-bold text-foreground",children:t.label}),r(I,{class:"text-[0.58rem] uppercase tracking-wide shrink-0",variant:t.priority==="required"?"destructive":"warning",children:t.priority})]}),r("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed",children:t.description}),o("div",{class:"flex items-center gap-2",children:[r("code",{class:"flex-1 min-w-0 text-[0.65rem] font-mono text-muted-foreground bg-foreground/4 border border-border/40 px-2 py-1 overflow-x-auto whitespace-nowrap block",children:t.snippet}),r(z,{text:t.snippet})]})]}),M={error:{color:"text-destructive",icon:"✖",label:"Error"},ok:{color:"text-success",icon:"✔",label:"OK"},suggestion:{color:"text-primary",icon:"ℹ",label:"Info"},warning:{color:"text-warning",icon:"⚠",label:"Warning"}},he={error:"destructive",ok:"success",suggestion:"outline",warning:"warning"},ye=({schema:t})=>{const[e,s]=y(b(!1),"open"),[i,n]=y(b(!1),"showRaw"),a=M[t.status],g=t.graphIndex===void 0?`Script ${t.index+1}`:`Script ${t.index+1} @graph[${t.graphIndex}]`;return o("div",{class:"border border-border bg-card overflow-hidden",children:[o("button",{class:"w-full flex items-center justify-between gap-3 px-4 py-3 bg-transparent border-0 cursor-pointer text-left hover:bg-foreground/3 transition-colors",onClick:()=>{s(d=>!d)},type:"button",children:[o("div",{class:"flex items-center gap-2 min-w-0",children:[r("span",{class:h("text-base shrink-0 leading-none",a.color),children:a.icon}),r("span",{class:"text-[0.7rem] text-muted-foreground font-mono shrink-0",children:g}),r("code",{class:"text-[0.75rem] font-mono font-semibold text-foreground truncate",children:t.type})]}),o("div",{class:"flex items-center gap-2 shrink-0",children:[r(I,{variant:he[t.status],children:a.label}),r("span",{class:h("text-muted-foreground text-[0.65rem] transition-transform duration-150",e?"rotate-90":""),children:"▶"})]})]}),e&&o("div",{class:"border-t border-border",children:[t.messages.length>0?r("div",{class:"px-4 py-3 space-y-1.5",children:t.messages.map((d,u)=>{const m=M[d.severity];return o("div",{class:"flex items-start gap-2 text-[0.72rem]",children:[r("span",{class:h("shrink-0 leading-none mt-px",m.color),children:m.icon}),o("div",{class:"min-w-0",children:[d.property&&o("code",{class:"text-[0.65rem] font-mono text-muted-foreground mr-1.5",children:[d.property,":"]}),r("span",{class:"text-foreground/80",children:d.message})]})]},u)})}):o("div",{class:"px-4 py-3 flex items-center gap-2 text-[0.72rem] text-success",children:[r("span",{children:"✔"}),r("span",{children:"No issues found"})]}),o("div",{class:"border-t border-border/50 px-4 py-2 flex items-center justify-between",children:[o("button",{class:"text-[0.65rem] text-muted-foreground hover:text-foreground transition-colors bg-transparent border-0 cursor-pointer p-0",onClick:()=>{n(d=>!d)},type:"button",children:[i?"Hide":"Show"," raw JSON"]}),r(z,{text:t.raw})]}),i&&r("pre",{class:"text-[0.65rem] font-mono leading-relaxed bg-foreground/3 border-t border-border/50 px-4 py-3 overflow-x-auto max-h-60 text-muted-foreground whitespace-pre-wrap break-all m-0",children:t.raw})]})]})},U=60,$=158,B=120,T="...",fe=[{hasIssue:t=>!t.favicon,message:"No favicon or icon set on the page."},{hasIssue:t=>!t.title.trim(),message:"No title tag set on the page."},{hasIssue:t=>!t.description.trim(),message:"No meta description set on the page."},{hasIssue:(t,e)=>e.titleOverflow,message:"The title exceeds ~60 characters and may be truncated in search results."}],be=[{extraChecks:[{hasIssue:(t,e)=>e.descriptionOverflow,message:"The meta description exceeds ~158 characters and may be trimmed on desktop."}],isMobile:!1,label:"Desktop preview"},{extraChecks:[{hasIssue:(t,e)=>e.descriptionOverflowMobile,message:"Description exceeds the 3-line limit for mobile view (~120 characters)."}],isMobile:!0,label:"Mobile preview"}],C=(t,e)=>t.length<=e?t:e<=T.length?T:t.slice(0,e-T.length)+T,ve=t=>{const e=globalThis.window===void 0?"":globalThis.location.href,s=t.ogSiteName||(globalThis.window===void 0?"":globalThis.location.hostname.replace(/^www\./,""));let a=[...document.head.querySelectorAll("link")].find(g=>g.getAttribute("rel")?.toLowerCase().split(/\s+/).includes("icon"))?.getAttribute("href")||null;if(a&&globalThis.window!==void 0)try{a=new URL(a,e).href}catch{a=null}return{description:t.description,favicon:a,siteName:s,title:t.title,url:e}},xe=(t,e,s)=>s.filter(i=>i.hasIssue(t,e)).map(i=>i.message),we=({data:t,displayDescription:e,displayTitle:s,isMobile:i,issues:n,label:a})=>o("div",{class:"border border-border bg-card p-4 mb-4",children:[r("p",{class:"text-[0.7rem] font-semibold text-muted-foreground mb-3",children:a}),o("div",{class:h("border border-border/50 bg-background p-4 font-sans",i?"max-w-[380px]":"max-w-[600px]"),children:[o("div",{class:"flex items-center gap-3 mb-2",children:[t.favicon?r("img",{alt:"favicon",class:"size-7 rounded-full shrink-0 object-contain",src:t.favicon}):r("div",{class:"size-7 rounded-full shrink-0 bg-foreground/10 flex items-center justify-center"}),o("div",{class:"flex flex-col min-w-0",children:[r("span",{class:"text-[0.875rem] text-foreground leading-snug",children:t.siteName||t.url}),r("span",{class:"text-[0.75rem] text-muted-foreground leading-snug truncate",children:t.url})]})]}),r("p",{class:"text-[1.25rem] font-normal leading-snug mb-1 m-0",style:{color:"var(--color-info, #1a0dab)"},children:s||"No title"}),r("p",{class:h("text-[0.875rem] text-muted-foreground leading-relaxed m-0",i&&"line-clamp-3"),children:e||"No meta description."})]}),n.length>0&&o("div",{class:"mt-3",children:[r("p",{class:"text-[0.7rem] font-semibold text-destructive mb-1",children:"Issues:"}),r("ul",{class:"m-0 pl-5 list-disc",children:n.map((g,d)=>r("li",{class:"text-[0.75rem] text-destructive/80 mt-0.5",children:g},d))})]})]}),Te=({meta:t})=>{const e=ve(t),s=e.title||"No title",i=e.description||"No meta description.",n=C(s,U),a=C(i,$),g={descriptionOverflow:i.length>$,descriptionOverflowMobile:i.length>B,titleOverflow:s.length>U};return o("div",{children:[r("p",{class:"text-[0.7rem] text-muted-foreground mb-3 leading-relaxed",children:"See how your title tag and meta description may look in Google search results. Data is read from the current page."}),be.map(d=>{const u=xe(e,g,[...fe,...d.extraChecks]);return r(we,{data:e,displayDescription:d.isMobile?C(i,B):a,displayTitle:n,isMobile:d.isMobile,issues:u,label:d.label},d.label)})]})},Se=t=>{const[e,s]=y(b(void 0),"meta"),[i,n]=y(b([]),"schemas"),[a,g]=y(b("preview"),"activeTab"),d=()=>{s(H()),n(ge())};if(F(()=>{d()},[]),!e)return o("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[r("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(c=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${c}ms`}},c))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Reading meta tags…"})]});const u=P.filter(c=>c.priority==="required"&&!e[c.key]),m=P.filter(c=>c.priority==="recommended"&&!e[c.key]),S=u.length+m.length,f=i.filter(c=>c.status==="error").length,E=i.filter(c=>c.status==="warning").length;let v;f>0?v=f:E>0&&(v=E);const J=e.ogType==="article"||!!(e.articleAuthor||e.articlePublishedTime||e.articleModifiedTime||e.articleSection);return o("div",{class:"flex flex-col h-full",children:[o("div",{class:"flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[r("div",{class:"flex items-center gap-0",children:["preview","serp","tags","missing","jsonld"].map(c=>{const V={jsonld:"Structured Data",missing:"Missing",preview:"Social Previews",serp:"SERP",tags:"Meta Tags"}[c];let x;c==="missing"&&S>0?x=S:c==="jsonld"&&v!==void 0&&(x=v);let k;return c==="missing"?k=u.length>0?"destructive":"warning":k=f>0?"destructive":"warning",o("button",{class:h("flex items-center gap-1.5 px-3 py-1.5 text-[0.75rem] font-medium border-0 cursor-pointer transition-colors capitalize",a===c?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:()=>{g(c)},type:"button",children:[V,x!==void 0&&r(I,{class:"text-[0.58rem] min-w-[1.1rem] text-center",variant:k,children:x})]},c)})}),r(X,{onClick:d,size:"sm",variant:"outline",children:"Refresh"})]}),o("div",{class:"flex-1 overflow-auto",children:[a==="preview"&&r("div",{class:"p-4 grid grid-cols-2 gap-4",children:ue.map(c=>r(me,{meta:e,platform:c},c.id))}),a==="serp"&&r("div",{class:"p-4",children:r(Te,{meta:e})}),a==="tags"&&o("div",{class:"p-5 space-y-5",children:[o("div",{children:[r(w,{children:"Basic"}),r("div",{class:"border border-border bg-card",children:o("div",{class:"px-4",children:[r(p,{label:"title",required:!0,value:e.title}),r(p,{label:"description",required:!0,value:e.description}),r(p,{label:"canonical",value:e.canonical})]})})]}),o("div",{children:[r(w,{children:"Open Graph"}),r("div",{class:"border border-border bg-card",children:o("div",{class:"px-4",children:[r(p,{label:"og:title",required:!0,value:e.ogTitle}),r(p,{label:"og:description",required:!0,value:e.ogDescription}),r(p,{label:"og:image",required:!0,value:e.ogImage}),r(p,{label:"og:image:alt",value:e.ogImageAlt}),r(p,{label:"og:url",value:e.ogUrl}),r(p,{label:"og:type",value:e.ogType}),r(p,{label:"og:site_name",value:e.ogSiteName}),r(p,{label:"og:locale",value:e.ogLocale})]})})]}),J&&o("div",{children:[r(w,{children:"Article"}),r("div",{class:"border border-border bg-card",children:o("div",{class:"px-4",children:[r(p,{label:"article:author",value:e.articleAuthor}),r(p,{label:"article:published_time",value:e.articlePublishedTime}),r(p,{label:"article:modified_time",value:e.articleModifiedTime}),r(p,{label:"article:section",value:e.articleSection})]})})]}),o("div",{children:[r(w,{children:"X / Twitter"}),r("div",{class:"border border-border bg-card",children:o("div",{class:"px-4",children:[r(p,{label:"twitter:card",required:!0,value:e.twitterCard}),r(p,{label:"twitter:title",value:e.twitterTitle}),r(p,{label:"twitter:description",value:e.twitterDescription}),r(p,{label:"twitter:image",value:e.twitterImage}),r(p,{label:"twitter:image:alt",value:e.twitterImageAlt}),r(p,{label:"twitter:site",value:e.twitterSite}),r(p,{label:"twitter:creator",value:e.twitterCreator})]})})]})]}),a==="jsonld"&&r("div",{class:"p-5 space-y-3",children:i.length===0?o("div",{class:"flex flex-col items-center justify-center py-12 gap-3",children:[r("div",{class:"size-10 border border-border flex items-center justify-center text-muted-foreground/40 text-lg select-none",children:"{}"}),r("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"No structured data found"}),o("p",{class:"text-[0.7rem] text-muted-foreground text-center max-w-xs leading-relaxed",children:["Add a ",r("code",{class:"font-mono bg-foreground/6 px-1",children:'<script type="application/ld+json">'})," block to help search engines understand your content."]})]}):o(_,{children:[o("div",{class:"flex items-center justify-between mb-1",children:[o("p",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[i.length," schema",i.length===1?"":"s"," detected"]}),f>0&&o("span",{class:"text-[0.65rem] text-destructive font-medium",children:[f," error",f===1?"":"s"]})]}),i.map((c,R)=>r(ye,{schema:c},R))]})}),a==="missing"&&r("div",{class:"p-5 space-y-5",children:S===0?o("div",{class:"flex flex-col items-center justify-center py-12 gap-3",children:[r("div",{class:"size-10 border border-success/30 bg-success/8 flex items-center justify-center text-success text-lg select-none",children:"✓"}),r("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"All recommended tags are present"}),r("p",{class:"text-[0.7rem] text-muted-foreground",children:"Your page has all required and recommended meta tags."})]}):o(_,{children:[u.length>0&&o("div",{children:[o("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-destructive/80 mb-2 flex items-center gap-1.5",children:[r("span",{children:"Required"}),r("span",{class:"bg-destructive/10 border border-destructive/25 text-destructive px-1 font-bold",children:u.length})]}),r("div",{class:"space-y-2",children:u.map(c=>r(j,{def:c},c.key))})]}),m.length>0&&o("div",{children:[o("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-warning/80 mb-2 flex items-center gap-1.5",children:[r("span",{children:"Recommended"}),r("span",{class:"bg-warning/10 border border-warning/25 text-warning px-1 font-bold",children:m.length})]}),r("div",{class:"space-y-2",children:m.map(c=>r(j,{def:c},c.key))})]})]})})]})]})},Ee={component:Se,icon:W,id:"dev-toolbar:seo",name:"SEO"};export{Ee as default};
17
+ `,ne=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2})?(?:[+-]\d{2}:\d{2}|Z)?)?$/,S=e=>typeof e=="string"&&ne.test(e),s=(e,t)=>e[t]!==void 0&&e[t]!==null&&e[t]!=="",T=e=>Array.isArray(e)&&e.length>0,v=e=>{const t=[];if(!s(e,"headline")&&!s(e,"name")&&t.push({message:"headline (or name) is required",property:"headline",severity:"error"}),s(e,"author")){const r=e.author;typeof r=="object"&&!Array.isArray(r)&&!s(r,"name")&&t.push({message:"author.name is missing",property:"author.name",severity:"warning"})}else t.push({message:"author is required",property:"author",severity:"error"});return s(e,"datePublished")?S(e.datePublished)||t.push({message:"datePublished should be ISO 8601 format (e.g. 2024-01-15T09:00:00Z)",property:"datePublished",severity:"warning"}):t.push({message:"datePublished is required",property:"datePublished",severity:"error"}),s(e,"image")||t.push({message:"image is recommended for rich results",property:"image",severity:"warning"}),s(e,"description")||t.push({message:"description is recommended",property:"description",severity:"suggestion"}),t},ae=e=>{const t=[];s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"});const r=s(e,"offers"),o=s(e,"aggregateRating"),i=s(e,"review");if(!r&&!o&&!i&&t.push({message:"At least one of: offers, aggregateRating, or review is required for rich results",property:"offers",severity:"error"}),r){const a=Array.isArray(e.offers)?e.offers[0]:e.offers;a&&typeof a=="object"&&(!s(a,"price")&&!s(a,"priceSpecification")&&t.push({message:"offers.price is required",property:"offers.price",severity:"error"}),s(a,"priceCurrency")||t.push({message:"offers.priceCurrency is required (e.g. 'USD')",property:"offers.priceCurrency",severity:"error"}))}if(o){const a=e.aggregateRating;s(a,"ratingValue")||t.push({message:"aggregateRating.ratingValue is required",property:"aggregateRating.ratingValue",severity:"error"}),!s(a,"reviewCount")&&!s(a,"ratingCount")&&t.push({message:"aggregateRating.reviewCount (or ratingCount) is required",property:"aggregateRating.reviewCount",severity:"error"})}return s(e,"image")||t.push({message:"image is recommended for rich results",property:"image",severity:"suggestion"}),t},le=e=>{const t=[],r=e.itemListElement;return T(r)?(r.length<2&&t.push({message:"itemListElement should have at least 2 items",property:"itemListElement",severity:"warning"}),r.forEach((o,i)=>{o.position!==i+1&&t.push({message:`itemListElement[${i}].position should be ${i+1}`,property:`itemListElement[${i}].position`,severity:"warning"}),o.name||o.item?.name||t.push({message:`itemListElement[${i}].name is required`,property:`itemListElement[${i}].name`,severity:"error"})}),t):(t.push({message:"itemListElement array is required",property:"itemListElement",severity:"error"}),t)},ce=e=>{const t=[],r=e.mainEntity;return T(r)?(r.forEach((o,i)=>{s(o,"name")||t.push({message:`mainEntity[${i}].name (question text) is required`,property:`mainEntity[${i}].name`,severity:"error"});const a=o.acceptedAnswer;(!a||!s(a,"text"))&&t.push({message:`mainEntity[${i}].acceptedAnswer.text is required`,property:`mainEntity[${i}].acceptedAnswer.text`,severity:"error"})}),t):(t.push({message:"mainEntity array with at least one Question is required",property:"mainEntity",severity:"error"}),t)},I=e=>{const t=[];s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"startDate")?S(e.startDate)||t.push({message:"startDate should be ISO 8601 format",property:"startDate",severity:"warning"}):t.push({message:"startDate is required",property:"startDate",severity:"error"});const r=e.location;return r?s(r,"name")||t.push({message:"location.name is required",property:"location.name",severity:"error"}):t.push({message:"location is required",property:"location",severity:"error"}),s(e,"description")||t.push({message:"description is recommended",property:"description",severity:"suggestion"}),t},C=e=>{const t=[];return s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"url")||t.push({message:"url is recommended",property:"url",severity:"warning"}),s(e,"logo")||t.push({message:"logo is recommended for Knowledge Panel eligibility",property:"logo",severity:"suggestion"}),t},pe=e=>{const t=[];return s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"url")||t.push({message:"url is recommended",property:"url",severity:"suggestion"}),t},ge=e=>{const t=[];return s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"image")||t.push({message:"image is required for rich results",property:"image",severity:"error"}),!s(e,"recipeIngredient")&&!s(e,"ingredients")&&t.push({message:"recipeIngredient is recommended",property:"recipeIngredient",severity:"suggestion"}),s(e,"recipeInstructions")||t.push({message:"recipeInstructions is recommended",property:"recipeInstructions",severity:"suggestion"}),s(e,"author")||t.push({message:"author is recommended",property:"author",severity:"suggestion"}),t},D=e=>{const t=[];return s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"url")||t.push({message:"url is recommended",property:"url",severity:"warning"}),t},de=e=>{const t=[];return s(e,"name")||t.push({message:"name is required",property:"name",severity:"error"}),s(e,"description")||t.push({message:"description is required",property:"description",severity:"error"}),s(e,"thumbnailUrl")||t.push({message:"thumbnailUrl is required for rich results",property:"thumbnailUrl",severity:"error"}),s(e,"uploadDate")?S(e.uploadDate)||t.push({message:"uploadDate should be ISO 8601 format",property:"uploadDate",severity:"warning"}):t.push({message:"uploadDate is required",property:"uploadDate",severity:"error"}),t},$={Article:v,BlogPosting:v,BreadcrumbList:le,Event:I,EventSeries:I,FAQPage:ce,LocalBusiness:C,NewsArticle:v,Organization:C,Person:pe,Product:ae,Recipe:ge,VideoObject:de,WebPage:D,WebSite:D},ue=new Set(Object.keys($)),me=e=>{const t=[],r=String(e["@context"]??""),o=String(e["@type"]??"");if(r){let a=!1;try{const l=new URL(r).hostname.toLowerCase();a=l==="schema.org"||l.endsWith(".schema.org")}catch{}a||t.push({message:"@context should reference schema.org",property:"@context",severity:"warning"})}else t.push({message:"@context is missing — should be 'https://schema.org'",property:"@context",severity:"error"});if(!o)return t.push({message:"@type is required",property:"@type",severity:"error"}),t;ue.has(o)||t.push({message:`@type '${o}' is not validated — no known rules for this type`,property:"@type",severity:"suggestion"});const i=$[o];return i&&t.push(...i(e)),t},ye=e=>e.some(t=>t.severity==="error")?"error":e.some(t=>t.severity==="warning")?"warning":e.some(t=>t.severity==="suggestion")?"suggestion":"ok",E=(e,t,r,o)=>{const i=me(e),a=String(e["@type"]??"Unknown");return{context:String(e["@context"]??""),graphIndex:r,index:t,messages:i,parsed:e,raw:o??JSON.stringify(e,void 0,2),status:ye(i),type:a}},he=/^\/\/<!\[CDATA\[/,fe=/\/\/\]\]>$/,we=/^<!\[CDATA\[/,be=/\]\]>$/,ve=()=>{const e=document.querySelectorAll('script[type="application/ld+json"]'),t=[];return e.forEach((r,o)=>{let i=(r.textContent??"").trim();i=i.replace(he,"").replace(fe,""),i=i.replace(we,"").replace(be,"");try{const a=JSON.parse(i);if(T(a["@graph"])){const l=String(a["@context"]??"");a["@graph"].forEach((y,p)=>{const h={"@context":y["@context"]??l,...y};t.push(E(h,o,p,void 0))})}else t.push(E(a,o,void 0,i))}catch{t.push({context:"",index:o,messages:[{message:"Could not parse JSON content",property:"",severity:"error"}],parsed:{},raw:i,status:"error",type:"Invalid JSON"})}}),t},Se=()=>{const e=i=>document.querySelector(`meta[name="${i}"]`)?.content??"",t=i=>document.querySelector(`meta[property="og:${i}"]`)?.content??"",r=i=>document.querySelector(`meta[name="twitter:${i}"]`)?.content??document.querySelector(`meta[property="twitter:${i}"]`)?.content??"",o=i=>document.querySelector(`meta[property="article:${i}"]`)?.content??"";return{articleAuthor:o("author"),articleModifiedTime:o("modified_time"),articlePublishedTime:o("published_time"),articleSection:o("section"),canonical:document.querySelector('link[rel="canonical"]')?.href??"",description:e("description"),ogDescription:t("description"),ogImage:t("image"),ogImageAlt:t("image:alt"),ogLocale:t("locale"),ogSiteName:t("site_name"),ogTitle:t("title"),ogType:t("type"),ogUrl:t("url"),title:document.title??"",twitterCard:r("card"),twitterCreator:r("creator"),twitterDescription:r("description"),twitterImage:r("image"),twitterImageAlt:r("image:alt"),twitterSite:r("site"),twitterTitle:r("title")}},Te=[{accentClass:"border-blue-500/30",descKey:"ogDescription",imageKey:"ogImage",name:"Facebook",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-foreground/20",descKey:"twitterDescription",imageKey:"twitterImage",name:"X / Twitter",requiredKeys:["twitterTitle","twitterDescription","twitterImage","twitterCard"],titleKey:"twitterTitle",urlKey:"ogUrl"},{accentClass:"border-blue-600/30",descKey:"ogDescription",imageKey:"ogImage",name:"LinkedIn",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-indigo-500/30",descKey:"ogDescription",imageKey:"ogImage",name:"Discord",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-green-500/30",descKey:"ogDescription",imageKey:"ogImage",name:"Slack",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-purple-500/30",descKey:"ogDescription",imageKey:"ogImage",name:"Mastodon",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-sky-500/30",descKey:"ogDescription",imageKey:"ogImage",name:"Bluesky",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"}],R=60,_=158,K=120,f="...",xe=[{hasIssue:e=>!e.favicon,message:"No favicon or icon set on the page."},{hasIssue:e=>!e.title.trim(),message:"No title tag set on the page."},{hasIssue:e=>!e.description.trim(),message:"No meta description set on the page."},{hasIssue:(e,t)=>t.titleOverflow,message:"The title exceeds ~60 characters and may be truncated in search results."}],qe=[{extraChecks:[{hasIssue:(e,t)=>t.descriptionOverflow,message:"The meta description exceeds ~158 characters and may be trimmed on desktop."}],isMobile:!1,label:"Desktop preview"},{extraChecks:[{hasIssue:(e,t)=>t.descriptionOverflowMobile,message:"Description exceeds the 3-line limit for mobile view (~120 characters)."}],isMobile:!0,label:"Mobile preview"}],L=(e,t)=>e.length<=t?e:t<=f.length?f:e.slice(0,t-f.length)+f,Ae=e=>{const t=globalThis.window===void 0?"":globalThis.location.href,r=e.ogSiteName||(globalThis.window===void 0?"":globalThis.location.hostname.replace(/^www\./,""));let a=[...document.head.querySelectorAll("link")].find(l=>l.getAttribute("rel")?.toLowerCase().split(/\s+/).includes("icon"))?.getAttribute("href")||null;if(a&&globalThis.window!==void 0)try{a=new URL(a,t).href}catch{a=null}return{description:e.description,favicon:a,siteName:r,title:e.title,url:t}},ke=(e,t,r)=>r.filter(o=>o.hasIssue(e,t)).map(o=>o.message),O=[{description:"Page title shown in browser tabs and search engine results",key:"title",label:"title",priority:"required",snippet:"<title>Your Page Title</title>"},{description:"Title shown when your page is shared on social media",key:"ogTitle",label:"og:title",priority:"required",snippet:'<meta property="og:title" content="Your Page Title" />'},{description:"Description shown when sharing on social media (max 200 chars)",key:"ogDescription",label:"og:description",priority:"required",snippet:'<meta property="og:description" content="Your page description" />'},{description:"Image shown when sharing (recommended: 1200 × 630 px)",key:"ogImage",label:"og:image",priority:"required",snippet:'<meta property="og:image" content="https://yoursite.com/og-image.jpg" />'},{description:"Twitter card format — controls how link previews appear on X / Twitter",key:"twitterCard",label:"twitter:card",priority:"required",snippet:'<meta name="twitter:card" content="summary_large_image" />'},{description:"Meta description used by search engines (max 160 chars)",key:"description",label:"description",priority:"recommended",snippet:'<meta name="description" content="Your page description" />'},{description:"Canonical URL to prevent duplicate content issues with search engines",key:"canonical",label:"canonical",priority:"recommended",snippet:'<link rel="canonical" href="https://yoursite.com/page" />'},{description:"Canonical page URL for Open Graph — should match the canonical link tag",key:"ogUrl",label:"og:url",priority:"recommended",snippet:'<meta property="og:url" content="https://yoursite.com/page" />'},{description:"Type of content: website, article, product, video.movie, etc.",key:"ogType",label:"og:type",priority:"recommended",snippet:'<meta property="og:type" content="website" />'},{description:"Your website name — shown for consistent branding on social platforms",key:"ogSiteName",label:"og:site_name",priority:"recommended",snippet:'<meta property="og:site_name" content="Your Site Name" />'},{description:"Language and territory of page content (e.g. en_US, de_DE, fr_FR)",key:"ogLocale",label:"og:locale",priority:"recommended",snippet:'<meta property="og:locale" content="en_US" />'},{description:"Alt text for the OG image — important for accessibility on social platforms",key:"ogImageAlt",label:"og:image:alt",priority:"recommended",snippet:'<meta property="og:image:alt" content="Description of the shared image" />'},{description:"Override title specifically for X / Twitter cards (falls back to og:title)",key:"twitterTitle",label:"twitter:title",priority:"recommended",snippet:'<meta name="twitter:title" content="Your Page Title" />'},{description:"Override description for X / Twitter cards (falls back to og:description)",key:"twitterDescription",label:"twitter:description",priority:"recommended",snippet:'<meta name="twitter:description" content="Your page description" />'},{description:"Override image for X / Twitter cards (falls back to og:image)",key:"twitterImage",label:"twitter:image",priority:"recommended",snippet:'<meta name="twitter:image" content="https://yoursite.com/twitter-card.jpg" />'},{description:"X / Twitter handle of the website owner (e.g. @yourhandle)",key:"twitterSite",label:"twitter:site",priority:"recommended",snippet:'<meta name="twitter:site" content="@yourhandle" />'}],P={destructive:{chip:"bg-destructive/10 border-destructive/25 text-destructive",label:"text-destructive/80"},warning:{chip:"bg-warning/10 border-warning/25 text-warning",label:"text-warning/80"}},Ie=({count:e,label:t,tone:r})=>w("p",{class:k("text-[0.58rem] font-bold uppercase tracking-[0.12em] mb-2 flex items-center gap-1.5",P[r].label),children:[m("span",{children:t}),m("span",{class:k("px-1 font-bold border",P[r].chip),children:e})]}),Ce=({expanded:e=!1,onClick:t,text:r})=>w("div",{class:"border-t border-border/50 px-4 py-2 flex items-center justify-between",children:[w("button",{"aria-expanded":e,class:"text-[0.65rem] text-muted-foreground hover:text-foreground transition-colors bg-transparent border-0 cursor-pointer p-0",onClick:t,type:"button",children:[e?"Hide":"Show"," raw JSON"]}),m(Z,{text:r})]}),De=({left:e,right:t})=>w("div",{class:"flex items-center justify-between mb-1",children:[m("p",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:e}),t!==void 0&&m("span",{class:"text-[0.65rem] text-destructive font-medium",children:t})]}),N=(e,t)=>`${e} ${t}${e===1?"":"s"}`,Ee=()=>{const{add:e,elements:t}=ee();return{add:e,elements:t,pane:(o,i="pane")=>e({children:o,props:{variant:i},type:"Stack"})}},Re=e=>{const t=e.ogType==="article"||!!(e.articleAuthor||e.articlePublishedTime||e.articleModifiedTime||e.articleSection),r=[{rows:[{label:"title",required:!0,value:e.title},{label:"description",required:!0,value:e.description},{label:"canonical",value:e.canonical}],title:"Basic"},{rows:[{label:"og:title",required:!0,value:e.ogTitle},{label:"og:description",required:!0,value:e.ogDescription},{label:"og:image",required:!0,value:e.ogImage},{label:"og:image:alt",value:e.ogImageAlt},{label:"og:url",value:e.ogUrl},{label:"og:type",value:e.ogType},{label:"og:site_name",value:e.ogSiteName},{label:"og:locale",value:e.ogLocale}],title:"Open Graph"}];return t&&r.push({rows:[{label:"article:author",value:e.articleAuthor},{label:"article:published_time",value:e.articlePublishedTime},{label:"article:modified_time",value:e.articleModifiedTime},{label:"article:section",value:e.articleSection}],title:"Article"}),r.push({rows:[{label:"twitter:card",required:!0,value:e.twitterCard},{label:"twitter:title",value:e.twitterTitle},{label:"twitter:description",value:e.twitterDescription},{label:"twitter:image",value:e.twitterImage},{label:"twitter:image:alt",value:e.twitterImageAlt},{label:"twitter:site",value:e.twitterSite},{label:"twitter:creator",value:e.twitterCreator}],title:"X / Twitter"}),r},_e=({meta:e,schemas:t})=>{const{add:r,elements:o,pane:i}=Ee(),a=O.filter(n=>n.priority==="required"&&!e[n.key]),l=O.filter(n=>n.priority==="recommended"&&!e[n.key]),y=a.length+l.length,p=t.filter(n=>n.status==="error").length,h=t.filter(n=>n.status==="warning").length,M=i(Te.map(n=>r({props:{accentClass:n.accentClass,description:e[n.descKey]||e.description||"",image:e[n.imageKey]||"",missing:n.requiredKeys.filter(g=>!e[g]),name:n.name,title:e[n.titleKey]||e.title||"No title",url:e[n.urlKey]||e.canonical||""},type:"SocialCard"})),"grid"),u=Ae(e),x=u.title||"No title",b=u.description||"No meta description.",U={descriptionOverflow:b.length>_,descriptionOverflowMobile:b.length>K,titleOverflow:x.length>R},j=i([r({props:{text:"See how your title tag and meta description may look in Google search results. Data is read from the current page."},type:"Text"}),...qe.map(n=>r({props:{description:L(b,n.isMobile?K:_),...u.favicon===null?{}:{favicon:u.favicon},isMobile:n.isMobile,issues:ke(u,U,[...xe,...n.extraChecks]),label:n.label,siteName:u.siteName,title:L(x,R),url:u.url},type:"SerpSnippet"}))]),B=i(Re(e).map(({rows:n,title:g})=>r({children:n.map(c=>r({props:c,type:"MetaRow"})),props:{title:g,variant:"plain"},type:"Section"}))),q=(n,g,c)=>c.length===0?[]:[r({props:{count:c.length,label:n,tone:g},type:"GroupHeading"}),r({children:c.map(d=>r({props:{description:d.description,label:d.label,priority:d.priority,snippet:d.snippet},type:"TagCard"})),props:{class:"space-y-2"},type:"Stack"})],J=i(y===0?[r({props:{hint:"Your page has all required and recommended meta tags.",icon:"✓",title:"All recommended tags are present",tone:"success"},type:"EmptyState"})]:[...q("Required","destructive",a),...q("Recommended","warning",l)]),X=t.map((n,g)=>{const c=`/expanded/${g}`,d=`/raw/${g}`,G=n.graphIndex===void 0?`Script ${n.index+1}`:`Script ${n.index+1} @graph[${n.graphIndex}]`,H=r({on:{click:{action:"toggle",params:{path:c}}},props:{expanded:{$state:c},label:G,severity:n.status,title:n.type},type:"DisclosureHeader"}),F=r({children:[r({props:{messages:n.messages},type:"MessageList"}),r({on:{click:{action:"toggle",params:{path:d}}},props:{expanded:{$state:d},text:n.raw},type:"RawToggleRow"}),r({props:{code:n.raw},type:"CodeBlock",visible:{$state:d}})],props:{class:"border-t border-border"},type:"Stack",visible:{$state:c}});return r({children:[H,F],props:{variant:"card"},type:"Section"})}),V=i(t.length===0?[r({props:{hint:'Add a <script type="application/ld+json"> block to help search engines understand your content.',icon:"{}",title:"No structured data found"},type:"EmptyState"})]:[r({props:{left:`${N(t.length,"schema")} detected`,...p>0?{right:N(p,"error")}:{}},type:"SummaryRow"}),...X]),Y=r({children:[M,j,B,J,V],on:{action:{action:"refresh"}},props:{actionLabel:"Refresh",tabs:[{label:"Social Previews",value:"preview"},{label:"SERP",value:"serp"},{label:"Meta Tags",value:"tags"},{...y>0?{badge:y,badgeVariant:a.length>0?"destructive":"warning"}:{},label:"Missing",value:"missing"},{...p>0||h>0?{badge:p>0?p:h,badgeVariant:p>0?"destructive":"warning"}:{},label:"Structured Data",value:"jsonld"}]},type:"TabView"});return{elements:o,root:Y,state:{expanded:[],raw:[]}}},Ke={...re,GroupHeading:Ie,RawToggleRow:Ce,SummaryRow:De},Le=e=>{const[t,r]=A(W(void 0),"snapshot"),o=()=>{r({meta:Se(),schemas:ve()})};z(()=>{o()},[]);const i=A(Q(()=>t?_e(t):void 0,[t]),"spec");return i?m(te,{actions:{...ie,refresh:o},registry:Ke,spec:i}):m(se,{label:"Reading meta tags…"})},Be={component:Le,icon:oe,id:"dev-toolbar:seo",name:"SEO"};export{Be as default};
@@ -1,7 +1,7 @@
1
- import{addHookName as g}from"preact/devtools";import{clsx as C}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as k,useRef as D,useEffect as K,useMemo as U}from"preact/hooks";import{jsxs as s,jsx as e,Fragment as Q}from"preact/jsx-runtime";const Y=/^\w+-\d+$/,q=/-\d+$/,F=/-(\d+)$/,Z=/^--/,ee=n=>n.split(",").some(o=>{const r=o.trim();return r===":root"||r==="html"}),te=(n,o)=>{for(let r=0;r<n.length;r+=1){const c=n[r];if(c.startsWith("--")&&!c.startsWith("--tw-")&&!c.startsWith("--brand-")){const a=n.getPropertyValue(c).trim();a&&o.set(c,a)}}},G=(n,o)=>{for(const r of n)r instanceof CSSStyleRule?ee(r.selectorText)&&te(r.style,o):"cssRules"in r&&r.cssRules instanceof CSSRuleList&&G(r.cssRules,o)},re=()=>{const n=new Map;for(const o of document.styleSheets)try{G(o.cssRules,n)}catch{}return n},x=n=>n.endsWith("rem")?Number.parseFloat(n)*16:n.endsWith("px")?Number.parseFloat(n):n.endsWith("em")?Number.parseFloat(n)*16:0,ne=n=>{const o=[],r=[],c=[],a=[],p=[],h=[];for(const[d,l]of n)d.startsWith("--color-")?o.push({cssVar:d,name:d.slice(8),value:l}):d.startsWith("--spacing-")?r.push({cssVar:d,name:d.slice(10),numericPx:x(l),value:l}):d.startsWith("--text-")&&!d.includes("--line-height")&&!d.endsWith("--font-weight")?c.push({cssVar:d,name:d.slice(7),sizePx:x(l),value:l}):d.startsWith("--font-")?a.push({cssVar:d,name:d.slice(7),value:l}):d.startsWith("--radius-")?p.push({cssVar:d,name:d.slice(9),value:l}):(d.startsWith("--shadow-")||d.startsWith("--drop-shadow-"))&&h.push({cssVar:d,name:d.slice(2),value:l});const f=r.toSorted((d,l)=>d.numericPx-l.numericPx),v=c.toSorted((d,l)=>d.sizePx-l.sizePx);return{colors:o,fontFamilies:a,fontSizes:v,radii:p,shadows:h,spacing:f}},P=n=>Y.test(n),oe=n=>{const o=[],r=new Map;for(const c of n)if(P(c.name)){const a=c.name.replace(q,""),p=r.get(a)??[];p.push(c),r.set(a,p)}else o.push(c);for(const[c,a]of r)r.set(c,a.toSorted((p,h)=>{const f=Number.parseInt(p.name.match(F)?.[1]??"0",10),v=Number.parseInt(h.name.match(F)?.[1]??"0",10);return f-v}));return{scales:r,semantic:o}},O=()=>{const[n,o]=g(k(!1),"copied"),r=g(D(null),"timer");return{copied:n,copy:a=>{navigator.clipboard.writeText(a).catch(()=>{}),o(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(o,1500,!1)}}},T=({count:n,title:o})=>s("div",{class:"flex items-center gap-2 px-3 py-1.5 bg-foreground/3 border-b border-border/40",children:[s("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70",children:[e("span",{class:"text-primary/50",children:"// "}),o]}),n!==void 0&&n>0&&e("span",{class:"ml-auto text-[0.58rem] font-mono text-muted-foreground/50",children:n})]}),se=({token:n})=>{const{copied:o,copy:r}=O();return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{r(n.cssVar)},title:`Click to copy ${n.cssVar}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10 dark:border-white/10",style:{background:`var(${n.cssVar})`}}),s("span",{class:"flex-1 min-w-0",children:[e("span",{class:"block text-[0.68rem] font-mono text-foreground truncate",children:n.name}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:n.value})]}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity",o?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:o?"copied!":"copy"})]})},ce=({name:n,tokens:o})=>{const{copied:r,copy:c}=O();return s("div",{class:"px-3 py-2",children:[s("div",{class:"flex items-center gap-2 mb-1.5",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:n}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(a=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{c(a.cssVar)},style:{background:`var(${a.cssVar})`,minWidth:0},title:`${a.name}
1
+ import{addHookName as y}from"preact/devtools";import{clsx as k}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as R,useRef as J,useEffect as K,useMemo as D}from"preact/hooks";import{jsxs as s,jsx as e,Fragment as Q}from"preact/jsx-runtime";import Y from"../../packem_shared/EmptyState-DMT9PjPE.js";import Z from"../../packem_shared/LoadingState-DQzchtCU.js";import{useCopy as E}from"../../packem_shared/useCopy-3LQUaNDI.js";const ee=/^\w+-\d+$/,U=/-\d+$/,F=/-(\d+)$/,P=r=>ee.test(r),te=r=>{const o=[],n=new Map;for(const c of r)if(P(c.name)){const a=c.name.replace(U,""),p=n.get(a)??[];p.push(c),n.set(a,p)}else o.push(c);for(const[c,a]of n)n.set(c,a.toSorted((p,h)=>{const f=Number.parseInt(p.name.match(F)?.[1]??"0",10),v=Number.parseInt(h.name.match(F)?.[1]??"0",10);return f-v}));return{scales:n,semantic:o}},re=r=>r.split(",").some(o=>{const n=o.trim();return n===":root"||n==="html"}),ne=(r,o)=>{for(let n=0;n<r.length;n+=1){const c=r[n];if(c.startsWith("--")&&!c.startsWith("--tw-")&&!c.startsWith("--brand-")){const a=r.getPropertyValue(c).trim();a&&o.set(c,a)}}},q=(r,o)=>{for(const n of r)n instanceof CSSStyleRule?re(n.selectorText)&&ne(n.style,o):"cssRules"in n&&n.cssRules instanceof CSSRuleList&&q(n.cssRules,o)},oe=()=>{const r=new Map;for(const o of document.styleSheets)try{q(o.cssRules,r)}catch{}return r},x=r=>r.endsWith("rem")?Number.parseFloat(r)*16:r.endsWith("px")?Number.parseFloat(r):r.endsWith("em")?Number.parseFloat(r)*16:0,se=r=>{const o=[],n=[],c=[],a=[],p=[],h=[];for(const[d,l]of r)d.startsWith("--color-")?o.push({cssVar:d,name:d.slice(8),value:l}):d.startsWith("--spacing-")?n.push({cssVar:d,name:d.slice(10),numericPx:x(l),value:l}):d.startsWith("--text-")&&!d.includes("--line-height")&&!d.endsWith("--font-weight")?c.push({cssVar:d,name:d.slice(7),sizePx:x(l),value:l}):d.startsWith("--font-")?a.push({cssVar:d,name:d.slice(7),value:l}):d.startsWith("--radius-")?p.push({cssVar:d,name:d.slice(9),value:l}):(d.startsWith("--shadow-")||d.startsWith("--drop-shadow-"))&&h.push({cssVar:d,name:d.slice(2),value:l});const f=n.toSorted((d,l)=>d.numericPx-l.numericPx),v=c.toSorted((d,l)=>d.sizePx-l.sizePx);return{colors:o,fontFamilies:a,fontSizes:v,radii:p,shadows:h,spacing:f}},ce=/^--/,T=({count:r,title:o})=>s("div",{class:"flex items-center gap-2 px-3 py-1.5 bg-foreground/3 border-b border-border/40",children:[s("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70",children:[e("span",{class:"text-primary/50",children:"// "}),o]}),r!==void 0&&r>0&&e("span",{class:"ml-auto text-[0.58rem] font-mono text-muted-foreground/50",children:r})]}),ie=({token:r})=>{const{copied:o,copy:n}=E();return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{n(r.cssVar)},title:`Click to copy ${r.cssVar}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10 dark:border-white/10",style:{background:`var(${r.cssVar})`}}),s("span",{class:"flex-1 min-w-0",children:[e("span",{class:"block text-[0.68rem] font-mono text-foreground truncate",children:r.name}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:r.value})]}),e("span",{class:k("text-[0.6rem] font-mono shrink-0 transition-opacity",o?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:o?"copied!":"copy"})]})},le=({name:r,tokens:o})=>{const{copied:n,copy:c}=E();return s("div",{class:"px-3 py-2",children:[s("div",{class:"flex items-center gap-2 mb-1.5",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:r}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(a=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{c(a.cssVar)},style:{background:`var(${a.cssVar})`,minWidth:0},title:`${a.name}
2
2
  ${a.value}
3
- Click to copy ${a.cssVar}`,type:"button"},a.cssVar))})]}),r&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},ie=({colors:n})=>{const{scales:o,semantic:r}=g(U(()=>oe(n),[n]),"scales");return n.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◫"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No color tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Color tokens are read from ",e("code",{class:"font-mono",children:"--color-*"})," CSS variables on ",e("code",{class:"font-mono",children:":root"})]})]}):s("div",{children:[r.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:r.length,title:"Semantic"}),e("div",{class:"py-1",children:r.map(c=>e(se,{token:c},c.cssVar))})]}),o.size>0&&s("div",{children:[e(T,{count:o.size,title:"Palette"}),e("div",{class:"py-1 divide-y divide-border/20",children:Array.from(o.entries(),([c,a])=>e(ce,{name:c,tokens:a},c))})]})]})},le=({spacing:n})=>{const o=g(U(()=>Math.max(...n.map(r=>r.numericPx),1),[n]),"maxPx");return n.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"↔"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No spacing tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Spacing tokens are read from ",e("code",{class:"font-mono",children:"--spacing-*"})," CSS variables"]})]}):e("div",{class:"p-3 space-y-1",children:n.map(r=>{const c=o>0?Math.max(r.numericPx/o*100,2):2;return s("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-8 shrink-0 text-right",children:r.name}),e("div",{class:"flex-1 flex items-center gap-1.5",children:e("div",{class:"flex-1 h-3.5 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${c}%`}})})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:r.value})]},r.cssVar)})})},ae=({fontFamilies:n,fontSizes:o})=>o.length===0&&n.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"Aa"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No typography tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Font size tokens are read from ",e("code",{class:"font-mono",children:"--text-*"})," and font family tokens from ",e("code",{class:"font-mono",children:"--font-*"})]})]}):s("div",{children:[o.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:o.length,title:"Font Sizes"}),e("div",{class:"p-3 space-y-1.5",children:o.map(r=>{const c=Math.min(r.sizePx||14,48);return s("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-10 shrink-0 text-right",children:r.name}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${c}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:r.value})]},r.cssVar)})})]}),n.length>0&&s("div",{children:[e(T,{count:n.length,title:"Font Families"}),e("div",{class:"p-3 space-y-2",children:n.map(r=>s("div",{class:"space-y-0.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:r.name})}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:`var(${r.cssVar})`},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:r.value})]},r.cssVar))})]})]}),de=({radii:n,shadows:o})=>n.length===0&&o.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◻"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No effect tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Radius tokens from ",e("code",{class:"font-mono",children:"--radius-*"})," and shadow tokens from ",e("code",{class:"font-mono",children:"--shadow-*"})]})]}):s("div",{children:[n.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:n.length,title:"Border Radius"}),e("div",{class:"p-3 flex flex-wrap gap-3",children:n.map(r=>s("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:`var(${r.cssVar})`}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:r.name}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:r.value})]},r.cssVar))})]}),o.length>0&&s("div",{children:[e(T,{count:o.length,title:"Shadows"}),e("div",{class:"p-3 space-y-3",children:o.map(r=>s("div",{class:"space-y-1.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:r.name})}),e("div",{class:"h-10 bg-card border border-border/40",style:{boxShadow:`var(${r.cssVar})`}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:r.value})]},r.cssVar))})]})]}),pe=({name:n,tokens:o})=>{const{copied:r,copy:c}=O();return s("div",{class:"px-3 py-2",children:[s("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:n}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(([a,p])=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{c(a)},style:{background:p},title:`${a}
3
+ Click to copy ${a.cssVar}`,type:"button"},a.cssVar))})]}),n&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},ae=({colors:r})=>{const{scales:o,semantic:n}=y(D(()=>te(r),[r]),"scales");return r.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◫"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No color tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Color tokens are read from ",e("code",{class:"font-mono",children:"--color-*"})," CSS variables on ",e("code",{class:"font-mono",children:":root"})]})]}):s("div",{children:[n.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:n.length,title:"Semantic"}),e("div",{class:"py-1",children:n.map(c=>e(ie,{token:c},c.cssVar))})]}),o.size>0&&s("div",{children:[e(T,{count:o.size,title:"Palette"}),e("div",{class:"py-1 divide-y divide-border/20",children:Array.from(o.entries(),([c,a])=>e(le,{name:c,tokens:a},c))})]})]})},de=({spacing:r})=>{const o=y(D(()=>Math.max(...r.map(n=>n.numericPx),1),[r]),"maxPx");return r.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"↔"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No spacing tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Spacing tokens are read from ",e("code",{class:"font-mono",children:"--spacing-*"})," CSS variables"]})]}):e("div",{class:"p-3 space-y-1",children:r.map(n=>{const c=o>0?Math.max(n.numericPx/o*100,2):2;return s("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-8 shrink-0 text-right",children:n.name}),e("div",{class:"flex-1 flex items-center gap-1.5",children:e("div",{class:"flex-1 h-3.5 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${c}%`}})})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:n.value})]},n.cssVar)})})},pe=({fontFamilies:r,fontSizes:o})=>o.length===0&&r.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"Aa"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No typography tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Font size tokens are read from ",e("code",{class:"font-mono",children:"--text-*"})," and font family tokens from ",e("code",{class:"font-mono",children:"--font-*"})]})]}):s("div",{children:[o.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:o.length,title:"Font Sizes"}),e("div",{class:"p-3 space-y-1.5",children:o.map(n=>{const c=Math.min(n.sizePx||14,48);return s("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-10 shrink-0 text-right",children:n.name}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${c}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:n.value})]},n.cssVar)})})]}),r.length>0&&s("div",{children:[e(T,{count:r.length,title:"Font Families"}),e("div",{class:"p-3 space-y-2",children:r.map(n=>s("div",{class:"space-y-0.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:n.name})}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:`var(${n.cssVar})`},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:n.value})]},n.cssVar))})]})]}),fe=({radii:r,shadows:o})=>r.length===0&&o.length===0?s("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◻"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No effect tokens found"}),s("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Radius tokens from ",e("code",{class:"font-mono",children:"--radius-*"})," and shadow tokens from ",e("code",{class:"font-mono",children:"--shadow-*"})]})]}):s("div",{children:[r.length>0&&s("div",{class:"border-b border-border/40",children:[e(T,{count:r.length,title:"Border Radius"}),e("div",{class:"p-3 flex flex-wrap gap-3",children:r.map(n=>s("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:`var(${n.cssVar})`}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:n.name}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:n.value})]},n.cssVar))})]}),o.length>0&&s("div",{children:[e(T,{count:o.length,title:"Shadows"}),e("div",{class:"p-3 space-y-3",children:o.map(n=>s("div",{class:"space-y-1.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:n.name})}),e("div",{class:"h-10 bg-card border border-border/40",style:{boxShadow:`var(${n.cssVar})`}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:n.value})]},n.cssVar))})]})]}),me=({name:r,tokens:o})=>{const{copied:n,copy:c}=E();return s("div",{class:"px-3 py-2",children:[s("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:r}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(([a,p])=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{c(a)},style:{background:p},title:`${a}
4
4
  ${p}
5
- Click to copy`,type:"button"},a))})]}),r&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},_=({cssVar:n,isCustom:o,value:r})=>{const{copied:c,copy:a}=O(),p=n.slice(8);return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(n)},title:`Click to copy ${n}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10",style:{background:r}}),s("span",{class:"flex-1 min-w-0",children:[s("span",{class:"flex items-center gap-1.5",children:[e("span",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1",children:"custom"})]}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:r})]}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity",c?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:c?"copied!":"copy"})]})},u=({children:n,count:o,defaultOpen:r=!0,title:c})=>{const[a,p]=g(k(r),"open");return s("div",{class:"border-b border-border/40",children:[s("button",{class:"w-full flex items-center gap-2 px-3 py-1.5 bg-foreground/3 hover:bg-foreground/5 transition-colors cursor-pointer border-0 text-left",onClick:()=>{p(h=>!h)},type:"button",children:[s("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70 flex-1",children:[e("span",{class:"text-primary/50",children:"// "}),c]}),e("span",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:o}),e("span",{class:C("text-muted-foreground/40 text-[0.6rem] transition-transform duration-150 ml-1",a&&"rotate-90"),children:"▶"})]}),a&&n]})},j=({cssVar:n,isCustom:o,value:r})=>{const{copied:c,copy:a}=O(),p=n.replace(Z,"");return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(n)},type:"button",children:[e("span",{class:"flex-1 min-w-0",children:s("span",{class:"flex items-center gap-1.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1 shrink-0",children:"custom"})]})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 truncate max-w-[160px] shrink-0",children:r}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity w-8 text-right",c?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:c?"✓":"copy"})]})},fe=({configData:n,error:o,loading:r,onRetry:c})=>{const[a,p]=g(k(""),"colorSearch");if(r)return s("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(t=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Loading Tailwind config…"})]});if(o||!n)return s("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:o??"No config available"}),e("button",{class:"px-3 py-1.5 text-[0.75rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent",onClick:c,type:"button",children:"Retry"})]});const{cssFiles:h,customTheme:f,defaultTheme:v,version:d}=n,l={...v,...f},W=Object.entries(l).filter(([t])=>t.startsWith("--color-")),w=W.filter(([t])=>!P(t.slice(8))),z=W.filter(([t])=>P(t.slice(8))),b=new Map;for(const[t,i]of z){const y=t.slice(8).replace(q,""),R=b.get(y)??[];R.push([t,i]),b.set(y,R)}for(const[t,i]of b)b.set(t,i.toSorted((y,R)=>{const X=Number.parseInt(y[0].match(F)?.[1]??"0",10),J=Number.parseInt(R[0].match(F)?.[1]??"0",10);return X-J}));const m=a?[...b.entries()].filter(([t])=>t.toLowerCase().includes(a.toLowerCase())):[...b.entries()],S=Object.entries(l).filter(([t])=>t.startsWith("--spacing-")).toSorted(([,t],[,i])=>x(t)-x(i)),N=Object.entries(l).filter(([t])=>t.startsWith("--font-")),$=Object.entries(l).filter(([t])=>t.startsWith("--text-")&&!t.includes("--line-height")&&!t.endsWith("--font-weight")).toSorted(([,t],[,i])=>x(t)-x(i)),M=Object.entries(l).filter(([t])=>t.startsWith("--breakpoint-")).toSorted(([,t],[,i])=>x(t)-x(i)),A=Object.entries(l).filter(([t])=>t.startsWith("--radius-")),I=Object.entries(l).filter(([t])=>t.startsWith("--shadow-")||t.startsWith("--drop-shadow-")),V=Object.entries(l).filter(([t])=>t.startsWith("--blur-")),B=Object.entries(l).filter(([t])=>t.startsWith("--animate-")),H=["--color-","--spacing-","--font-","--text-","--breakpoint-","--radius-","--shadow-","--drop-shadow-","--blur-","--animate-","--tw-","--brand-"],L=Object.entries(l).filter(([t])=>!H.some(i=>t.startsWith(i)));let E=1;for(const[,t]of S)E=Math.max(E,x(t));return s("div",{children:[s("div",{class:"flex items-center gap-2 px-3 py-2 border-b border-border/40 bg-foreground/2 shrink-0",children:[e("span",{class:C("text-[0.6rem] font-bold uppercase tracking-wide px-1.5 py-0.5 shrink-0",d==="v4"&&"bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border border-cyan-500/20",d==="v3"&&"bg-primary/10 text-primary border border-primary/20",d==="unknown"&&"bg-foreground/8 text-muted-foreground border border-border"),children:d==="unknown"?"Tailwind":`Tailwind ${d}`}),h.length>0&&s("code",{class:"text-[0.62rem] font-mono text-muted-foreground/70 truncate flex-1",children:[h[0],h.length>1&&s("span",{class:"text-muted-foreground/40",children:[" +",h.length-1]})]}),s("span",{class:"text-[0.6rem] font-mono text-muted-foreground/50 shrink-0",children:[Object.keys(l).length," tokens"]})]}),Object.keys(f).length>0&&e(u,{count:Object.keys(f).length,title:"Custom Overrides",children:e("div",{class:"py-1",children:Object.entries(f).map(([t,i])=>t.startsWith("--color-")&&!P(t.slice(8))?e(_,{cssVar:t,isCustom:!0,value:i},t):e(j,{cssVar:t,isCustom:!0,value:i},t))})}),w.length>0&&e(u,{count:w.length,title:"Semantic Colors",children:e("div",{class:"py-1",children:w.map(([t,i])=>e(_,{cssVar:t,isCustom:t in f,value:i},t))})}),b.size>0&&s(u,{count:b.size,defaultOpen:!1,title:"Color Palette",children:[e("div",{class:"px-3 pt-2 pb-1 border-b border-border/20",children:e("input",{class:"w-full bg-foreground/4 border border-border/40 px-2 py-1 text-[0.68rem] font-mono text-foreground placeholder:text-muted-foreground/40 outline-none focus:border-primary/40",onInput:t=>{p(t.target.value)},placeholder:"Filter scales…",type:"text",value:a})}),s("div",{class:"py-1 divide-y divide-border/20",children:[m.map(([t,i])=>e(pe,{name:t,tokens:i},t)),m.length===0&&e("p",{class:"text-center text-[0.7rem] text-muted-foreground/50 py-4",children:"No colors match"})]})]}),S.length>0&&e(u,{count:S.length,defaultOpen:!1,title:"Spacing",children:e("div",{class:"p-3 space-y-1",children:S.map(([t,i])=>{const y=x(i),R=E>0?Math.max(y/E*100,1):1;return s("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-10 shrink-0 text-right",children:t.slice(10)}),e("div",{class:"flex-1 h-3 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${R}%`}})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:i})]},t)})})}),M.length>0&&e(u,{count:M.length,defaultOpen:!1,title:"Breakpoints",children:e("div",{class:"p-3 space-y-1.5",children:M.map(([t,i])=>e(j,{cssVar:t,isCustom:t in f,value:i},t))})}),N.length>0&&e(u,{count:N.length,defaultOpen:!1,title:"Font Families",children:e("div",{class:"p-3 space-y-2",children:N.map(([t,i])=>s("div",{class:"space-y-0.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(7)}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:i.startsWith("--theme(")?"inherit":i},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:i})]},t))})}),$.length>0&&e(u,{count:$.length,defaultOpen:!1,title:"Font Sizes",children:e("div",{class:"p-3 space-y-1.5",children:$.map(([t,i])=>{const y=Math.min(x(i)||14,48);return s("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-12 shrink-0 text-right",children:t.slice(7)}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${y}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:i})]},t)})})}),A.length>0&&e(u,{count:A.length,defaultOpen:!1,title:"Border Radius",children:e("div",{class:"p-3 flex flex-wrap gap-3",children:A.map(([t,i])=>s("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:i.startsWith("--theme(")?"4px":i}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:t.slice(9)}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:i})]},t))})}),I.length>0&&e(u,{count:I.length,defaultOpen:!1,title:"Shadows",children:e("div",{class:"p-3 space-y-3",children:I.map(([t,i])=>s("div",{class:"space-y-1",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(2)}),!i.startsWith("--theme(")&&e("div",{class:"h-8 bg-card border border-border/40",style:{boxShadow:i}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:i})]},t))})}),V.length>0&&e(u,{count:V.length,defaultOpen:!1,title:"Blur",children:e("div",{class:"py-1",children:V.map(([t,i])=>e(j,{cssVar:t,isCustom:t in f,value:i},t))})}),B.length>0&&e(u,{count:B.length,defaultOpen:!1,title:"Animations",children:e("div",{class:"py-1",children:B.map(([t,i])=>e(j,{cssVar:t,isCustom:t in f,value:i},t))})}),L.length>0&&e(u,{count:L.length,defaultOpen:!1,title:"Other",children:e("div",{class:"py-1",children:L.map(([t,i])=>e(j,{cssVar:t,isCustom:t in f,value:i},t))})})]})},me=()=>s("div",{class:"flex flex-col items-center justify-center h-full gap-4 py-16 px-8 text-center select-none",children:[e("div",{class:"size-12 border border-primary/20 bg-primary/5 flex items-center justify-center text-primary/30 text-2xl",children:"◻"}),s("div",{class:"space-y-1.5",children:[e("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"No design tokens detected"}),s("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed max-w-[240px]",children:["This app reads CSS custom properties from your page's ",e("code",{class:"font-mono text-[0.65rem]",children:":root"})," selector. Make sure your app uses Tailwind CSS v4 or defines custom properties."]})]})]}),he=({helpers:n})=>{const[o,r]=g(k("colors"),"tab"),[c,a]=g(k(void 0),"configData"),[p,h]=g(k(!1),"configLoading"),[f,v]=g(k(void 0),"configError"),d=g(D(void 0),"tokensRef");if(!d.current){const m=re();d.current=ne(m)}const l=d.current,W=()=>{h(!0),v(void 0),n.rpc.getTailwindConfig().then(m=>(a(m),h(!1),m)).catch(m=>{v(m.message??"Failed to load Tailwind config"),h(!1)})};K(()=>{o==="config"&&!c&&!p&&!f&&W()},[o]);const w=l.colors.length+l.spacing.length+l.fontSizes.length+l.radii.length,z={colors:l.colors.length,config:c?Object.keys(c.defaultTheme).length+Object.keys(c.customTheme).length:0,effects:l.radii.length+l.shadows.length,spacing:l.spacing.length,type:l.fontSizes.length+l.fontFamilies.length},b=[{id:"colors",label:"Colors"},{id:"spacing",label:"Spacing"},{id:"type",label:"Type"},{id:"effects",label:"Effects"},{id:"config",label:"Config"}];return s("div",{class:"flex flex-col h-full",children:[s("div",{class:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border shrink-0",children:[e("span",{class:"text-[0.75rem] font-medium text-foreground",children:"Design Tokens"}),w>0&&s("span",{class:"text-[0.65rem] font-mono text-muted-foreground/60 bg-foreground/5 px-2 py-0.5 border border-border/40",children:[w," page tokens"]})]}),w===0&&o!=="config"?e(me,{}):s(Q,{children:[e("div",{class:"flex border-b border-border shrink-0 overflow-x-auto",children:b.map(({id:m,label:S})=>s("button",{class:C("flex-shrink-0 px-3 py-2 text-[0.68rem] font-medium transition-colors cursor-pointer border-0 border-b-2 -mb-px",o===m?"text-primary border-primary bg-primary/4":"text-muted-foreground hover:text-foreground border-transparent bg-transparent"),onClick:()=>{r(m)},type:"button",children:[S,z[m]>0&&e("span",{class:C("ml-1.5 text-[0.58rem] font-mono",o===m?"text-primary/70":"text-muted-foreground/50"),children:z[m]})]},m))}),s("div",{class:"flex-1 overflow-auto devtools-content-scroll",children:[o==="colors"&&e(ie,{colors:l.colors}),o==="spacing"&&e(le,{spacing:l.spacing}),o==="type"&&e(ae,{fontFamilies:l.fontFamilies,fontSizes:l.fontSizes}),o==="effects"&&e(de,{radii:l.radii,shadows:l.shadows}),o==="config"&&e(fe,{configData:c,error:f,loading:p,onRetry:W})]})]})]})},ue=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 54 33">
5
+ Click to copy`,type:"button"},a))})]}),n&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},_=({cssVar:r,isCustom:o,value:n})=>{const{copied:c,copy:a}=E(),p=r.slice(8);return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(r)},title:`Click to copy ${r}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10",style:{background:n}}),s("span",{class:"flex-1 min-w-0",children:[s("span",{class:"flex items-center gap-1.5",children:[e("span",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1",children:"custom"})]}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:n})]}),e("span",{class:k("text-[0.6rem] font-mono shrink-0 transition-opacity",c?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:c?"copied!":"copy"})]})},u=({children:r,count:o,defaultOpen:n=!0,title:c})=>{const[a,p]=y(R(n),"open");return s("div",{class:"border-b border-border/40",children:[s("button",{class:"w-full flex items-center gap-2 px-3 py-1.5 bg-foreground/3 hover:bg-foreground/5 transition-colors cursor-pointer border-0 text-left",onClick:()=>{p(h=>!h)},type:"button",children:[s("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70 flex-1",children:[e("span",{class:"text-primary/50",children:"// "}),c]}),e("span",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:o}),e("span",{class:k("text-muted-foreground/40 text-[0.6rem] transition-transform duration-150 ml-1",a&&"rotate-90"),children:"▶"})]}),a&&r]})},O=({cssVar:r,isCustom:o,value:n})=>{const{copied:c,copy:a}=E(),p=r.replace(ce,"");return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(r)},type:"button",children:[e("span",{class:"flex-1 min-w-0",children:s("span",{class:"flex items-center gap-1.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1 shrink-0",children:"custom"})]})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 truncate max-w-[160px] shrink-0",children:n}),e("span",{class:k("text-[0.6rem] font-mono shrink-0 transition-opacity w-8 text-right",c?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:c?"✓":"copy"})]})},he=({configData:r,error:o,loading:n,onRetry:c})=>{const[a,p]=y(R(""),"colorSearch");if(n)return e(Z,{label:"Loading Tailwind config…"});if(o||!r)return s("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:o??"No config available"}),e("button",{class:"px-3 py-1.5 text-[0.75rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent",onClick:c,type:"button",children:"Retry"})]});const{cssFiles:h,customTheme:f,defaultTheme:v,version:d}=r,l={...v,...f},W=Object.entries(l).filter(([t])=>t.startsWith("--color-")),w=W.filter(([t])=>!P(t.slice(8))),j=W.filter(([t])=>P(t.slice(8))),g=new Map;for(const[t,i]of j){const b=t.slice(8).replace(U,""),S=g.get(b)??[];S.push([t,i]),g.set(b,S)}for(const[t,i]of g)g.set(t,i.toSorted((b,S)=>{const H=Number.parseInt(b[0].match(F)?.[1]??"0",10),X=Number.parseInt(S[0].match(F)?.[1]??"0",10);return H-X}));const m=a?[...g.entries()].filter(([t])=>t.toLowerCase().includes(a.toLowerCase())):[...g.entries()],C=Object.entries(l).filter(([t])=>t.startsWith("--spacing-")).toSorted(([,t],[,i])=>x(t)-x(i)),N=Object.entries(l).filter(([t])=>t.startsWith("--font-")),$=Object.entries(l).filter(([t])=>t.startsWith("--text-")&&!t.includes("--line-height")&&!t.endsWith("--font-weight")).toSorted(([,t],[,i])=>x(t)-x(i)),M=Object.entries(l).filter(([t])=>t.startsWith("--breakpoint-")).toSorted(([,t],[,i])=>x(t)-x(i)),A=Object.entries(l).filter(([t])=>t.startsWith("--radius-")),I=Object.entries(l).filter(([t])=>t.startsWith("--shadow-")||t.startsWith("--drop-shadow-")),V=Object.entries(l).filter(([t])=>t.startsWith("--blur-")),L=Object.entries(l).filter(([t])=>t.startsWith("--animate-")),G=["--color-","--spacing-","--font-","--text-","--breakpoint-","--radius-","--shadow-","--drop-shadow-","--blur-","--animate-","--tw-","--brand-"],B=Object.entries(l).filter(([t])=>!G.some(i=>t.startsWith(i)));let z=1;for(const[,t]of C)z=Math.max(z,x(t));return s("div",{children:[s("div",{class:"flex items-center gap-2 px-3 py-2 border-b border-border/40 bg-foreground/2 shrink-0",children:[e("span",{class:k("text-[0.6rem] font-bold uppercase tracking-wide px-1.5 py-0.5 shrink-0",d==="v4"&&"bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border border-cyan-500/20",d==="v3"&&"bg-primary/10 text-primary border border-primary/20",d==="unknown"&&"bg-foreground/8 text-muted-foreground border border-border"),children:d==="unknown"?"Tailwind":`Tailwind ${d}`}),h.length>0&&s("code",{class:"text-[0.62rem] font-mono text-muted-foreground/70 truncate flex-1",children:[h[0],h.length>1&&s("span",{class:"text-muted-foreground/40",children:[" +",h.length-1]})]}),s("span",{class:"text-[0.6rem] font-mono text-muted-foreground/50 shrink-0",children:[Object.keys(l).length," tokens"]})]}),Object.keys(f).length>0&&e(u,{count:Object.keys(f).length,title:"Custom Overrides",children:e("div",{class:"py-1",children:Object.entries(f).map(([t,i])=>t.startsWith("--color-")&&!P(t.slice(8))?e(_,{cssVar:t,isCustom:!0,value:i},t):e(O,{cssVar:t,isCustom:!0,value:i},t))})}),w.length>0&&e(u,{count:w.length,title:"Semantic Colors",children:e("div",{class:"py-1",children:w.map(([t,i])=>e(_,{cssVar:t,isCustom:t in f,value:i},t))})}),g.size>0&&s(u,{count:g.size,defaultOpen:!1,title:"Color Palette",children:[e("div",{class:"px-3 pt-2 pb-1 border-b border-border/20",children:e("input",{class:"w-full bg-foreground/4 border border-border/40 px-2 py-1 text-[0.68rem] font-mono text-foreground placeholder:text-muted-foreground/40 outline-none focus:border-primary/40",onInput:t=>{p(t.target.value)},placeholder:"Filter scales…",type:"text",value:a})}),s("div",{class:"py-1 divide-y divide-border/20",children:[m.map(([t,i])=>e(me,{name:t,tokens:i},t)),m.length===0&&e("p",{class:"text-center text-[0.7rem] text-muted-foreground/50 py-4",children:"No colors match"})]})]}),C.length>0&&e(u,{count:C.length,defaultOpen:!1,title:"Spacing",children:e("div",{class:"p-3 space-y-1",children:C.map(([t,i])=>{const b=x(i),S=z>0?Math.max(b/z*100,1):1;return s("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-10 shrink-0 text-right",children:t.slice(10)}),e("div",{class:"flex-1 h-3 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${S}%`}})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:i})]},t)})})}),M.length>0&&e(u,{count:M.length,defaultOpen:!1,title:"Breakpoints",children:e("div",{class:"p-3 space-y-1.5",children:M.map(([t,i])=>e(O,{cssVar:t,isCustom:t in f,value:i},t))})}),N.length>0&&e(u,{count:N.length,defaultOpen:!1,title:"Font Families",children:e("div",{class:"p-3 space-y-2",children:N.map(([t,i])=>s("div",{class:"space-y-0.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(7)}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:i.startsWith("--theme(")?"inherit":i},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:i})]},t))})}),$.length>0&&e(u,{count:$.length,defaultOpen:!1,title:"Font Sizes",children:e("div",{class:"p-3 space-y-1.5",children:$.map(([t,i])=>{const b=Math.min(x(i)||14,48);return s("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-12 shrink-0 text-right",children:t.slice(7)}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${b}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:i})]},t)})})}),A.length>0&&e(u,{count:A.length,defaultOpen:!1,title:"Border Radius",children:e("div",{class:"p-3 flex flex-wrap gap-3",children:A.map(([t,i])=>s("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:i.startsWith("--theme(")?"4px":i}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:t.slice(9)}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:i})]},t))})}),I.length>0&&e(u,{count:I.length,defaultOpen:!1,title:"Shadows",children:e("div",{class:"p-3 space-y-3",children:I.map(([t,i])=>s("div",{class:"space-y-1",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(2)}),!i.startsWith("--theme(")&&e("div",{class:"h-8 bg-card border border-border/40",style:{boxShadow:i}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:i})]},t))})}),V.length>0&&e(u,{count:V.length,defaultOpen:!1,title:"Blur",children:e("div",{class:"py-1",children:V.map(([t,i])=>e(O,{cssVar:t,isCustom:t in f,value:i},t))})}),L.length>0&&e(u,{count:L.length,defaultOpen:!1,title:"Animations",children:e("div",{class:"py-1",children:L.map(([t,i])=>e(O,{cssVar:t,isCustom:t in f,value:i},t))})}),B.length>0&&e(u,{count:B.length,defaultOpen:!1,title:"Other",children:e("div",{class:"py-1",children:B.map(([t,i])=>e(O,{cssVar:t,isCustom:t in f,value:i},t))})})]})},ue=({helpers:r})=>{const[o,n]=y(R("colors"),"tab"),[c,a]=y(R(void 0),"configData"),[p,h]=y(R(!1),"configLoading"),[f,v]=y(R(void 0),"configError"),d=y(J(void 0),"tokensRef");if(!d.current){const m=oe();d.current=se(m)}const l=d.current,W=()=>{h(!0),v(void 0),r.rpc.getTailwindConfig().then(m=>(a(m),h(!1),m)).catch(m=>{v(m.message??"Failed to load Tailwind config"),h(!1)})};K(()=>{o==="config"&&!c&&!p&&!f&&W()},[o]);const w=l.colors.length+l.spacing.length+l.fontSizes.length+l.radii.length,j={colors:l.colors.length,config:c?Object.keys(c.defaultTheme).length+Object.keys(c.customTheme).length:0,effects:l.radii.length+l.shadows.length,spacing:l.spacing.length,type:l.fontSizes.length+l.fontFamilies.length},g=[{id:"colors",label:"Colors"},{id:"spacing",label:"Spacing"},{id:"type",label:"Type"},{id:"effects",label:"Effects"},{id:"config",label:"Config"}];return s("div",{class:"flex flex-col h-full",children:[s("div",{class:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border shrink-0",children:[e("span",{class:"text-[0.75rem] font-medium text-foreground",children:"Design Tokens"}),w>0&&s("span",{class:"text-[0.65rem] font-mono text-muted-foreground/60 bg-foreground/5 px-2 py-0.5 border border-border/40",children:[w," page tokens"]})]}),w===0&&o!=="config"?e(Y,{icon:"◻",title:"No design tokens detected",tone:"accent",children:s("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed max-w-[240px] text-center",children:["This app reads CSS custom properties from your page's ",e("code",{class:"font-mono text-[0.65rem]",children:":root"})," selector. Make sure your app uses Tailwind CSS v4 or defines custom properties."]})}):s(Q,{children:[e("div",{class:"flex border-b border-border shrink-0 overflow-x-auto",children:g.map(({id:m,label:C})=>s("button",{class:k("flex-shrink-0 px-3 py-2 text-[0.68rem] font-medium transition-colors cursor-pointer border-0 border-b-2 -mb-px",o===m?"text-primary border-primary bg-primary/4":"text-muted-foreground hover:text-foreground border-transparent bg-transparent"),onClick:()=>{n(m)},type:"button",children:[C,j[m]>0&&e("span",{class:k("ml-1.5 text-[0.58rem] font-mono",o===m?"text-primary/70":"text-muted-foreground/50"),children:j[m]})]},m))}),s("div",{class:"flex-1 overflow-auto devtools-content-scroll",children:[o==="colors"&&e(ae,{colors:l.colors}),o==="spacing"&&e(de,{spacing:l.spacing}),o==="type"&&e(pe,{fontFamilies:l.fontFamilies,fontSizes:l.fontSizes}),o==="effects"&&e(fe,{radii:l.radii,shadows:l.shadows}),o==="config"&&e(he,{configData:c,error:f,loading:p,onRetry:W})]})]})]})},xe=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 54 33">
6
6
  <path fill-rule="evenodd" clip-rule="evenodd" d="M27 0c-7.2 0-11.7 3.6-13.5 10.8 2.7-3.6 5.85-4.95 9.45-4.05 2.054.513 3.522 2.004 5.147 3.653C30.744 13.09 33.808 16.2 40.5 16.2c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C36.756 3.11 33.692 0 27 0zM13.5 16.2C6.3 16.2 1.8 19.8 0 27c2.7-3.6 5.85-4.95 9.45-4.05 2.054.514 3.522 2.004 5.147 3.653C17.244 29.29 20.308 32.4 27 32.4c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C23.256 19.31 20.192 16.2 13.5 16.2z" fill="#06B6D4"/>
7
- </svg>`,ve={component:he,icon:ue,id:"dev-toolbar:tailwind",name:"Design Tokens"};export{ve as default};
7
+ </svg>`,Se={component:ue,icon:xe,id:"dev-toolbar:tailwind",name:"Design Tokens"};export{Se as default};
@@ -1,4 +1,4 @@
1
- import{addHookName as u}from"preact/devtools";import{clsx as v}from"../../packem_shared/clsx-BGQISBxA.js";import{useState as p,useEffect as L,useRef as O}from"preact/hooks";import D from"../../packem_shared/Icon-CpjIHGY8.js";import{jsx as e,jsxs as l}from"preact/jsx-runtime";import w from"../../packem_shared/Badge-DdZ-eO1L.js";import F from"../../packem_shared/Button-C47WESqv.js";import{Tabs as V,TabsList as z,TabsTrigger as I,TabsContent as g}from"../../packem_shared/Tabs-k8RYlor_.js";import P from"../../packem_shared/Input-ChP0V9d9.js";import{Tooltip as B,TooltipTrigger as N,TooltipContent as M}from"../../packem_shared/Tooltip-DmnO5Vmb.js";const _=`<!-- @license lucide-static v1.31.0 - ISC -->
1
+ import{addHookName as u}from"preact/devtools";import{useState as m,useEffect as T,useMemo as z}from"preact/hooks";import{clsx as x}from"../../packem_shared/clsx-BGQISBxA.js";import y from"../../packem_shared/Icon-CpjIHGY8.js";import{jsxs as i,jsx as s}from"preact/jsx-runtime";import D from"../../packem_shared/Section-B9rL8rvP.js";import{COLUMN_LABEL as b}from"../../packem_shared/BoolValue-CKN2S4KV.js";import{Tooltip as O,TooltipTrigger as I,TooltipContent as B}from"../../packem_shared/Tooltip-DmnO5Vmb.js";import N from"../../packem_shared/CopyButton-_TtOAEvr.js";import M from"../../packem_shared/Input-ChP0V9d9.js";import{c as $,J as H,b as _,a as U}from"../../packem_shared/builder-CPG-rrRv.js";import J from"../../packem_shared/LoadingState-DQzchtCU.js";import K from"../../packem_shared/Button-C47WESqv.js";const q=`<!-- @license lucide-static v1.31.0 - ISC -->
2
2
  <svg
3
3
  class="lucide lucide-zap"
4
4
  xmlns="http://www.w3.org/2000/svg"
@@ -13,4 +13,4 @@ import{addHookName as u}from"preact/devtools";import{clsx as v}from"../../packem
13
13
  >
14
14
  <path d="M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z" />
15
15
  </svg>
16
- `,j="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M2.062%2012.348a1%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%2019.876%200%201%201%200%200%201%200%20.696%2010.75%2010.75%200%200%201-19.876%200%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%20%2F%3E%20%3C%2Fsvg%3E",A="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M10.733%205.076a10.744%2010.744%200%200%201%2011.205%206.575%201%201%200%200%201%200%20.696%2010.747%2010.747%200%200%201-1.444%202.49%22%20%2F%3E%20%3Cpath%20d%3D%22M14.084%2014.158a3%203%200%200%201-4.242-4.242%22%20%2F%3E%20%3Cpath%20d%3D%22M17.479%2017.499a10.75%2010.75%200%200%201-15.417-5.151%201%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%204.446-5.143%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3C%2Fsvg%3E",H="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-search%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21%2021-4.34-4.34%22%20%2F%3E%20%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228%22%20%2F%3E%20%3C%2Fsvg%3E",a=({children:t,title:r})=>l("section",{class:"space-y-1.5",children:[r&&l("h3",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground px-1 flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:"text-primary opacity-50",children:"//"}),r]}),e("div",{class:"rounded-none border border-border bg-card divide-y divide-border overflow-hidden border-l-2 border-l-primary/20",children:t})]}),k=({text:t})=>{const[r,n]=u(p(!1),"copied"),s=()=>{navigator.clipboard.writeText(t).then(()=>{n(!0),setTimeout(n,1500,!1)}).catch(()=>{})};return e("button",{class:v("inline-flex items-center px-1.5 py-0.5 text-xxs font-mono border transition-colors duration-150 cursor-pointer",r?"border-primary text-primary bg-card":"border-border text-muted-foreground hover:text-foreground hover:border-foreground bg-transparent"),onClick:s,title:"Copy to clipboard",type:"button",children:r?"copied":"copy"})},$=({value:t})=>l("span",{class:"inline-flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:v("inline-block size-1.5 rounded-full",t?"bg-success":"bg-border")}),e("span",{class:v("text-xs font-mono font-medium",t?"text-success":"text-muted-foreground"),children:t?"true":"false"})]}),K=({items:t})=>t.length===0?e("span",{class:"text-muted-foreground text-xs italic opacity-50",children:"empty"}):e("div",{class:"flex flex-wrap gap-1",children:t.map(r=>e("span",{class:"inline-flex items-center px-1.5 py-0.5 text-xxs font-mono font-medium bg-secondary border border-border text-secondary-foreground",children:r},r))}),R=({path:t})=>{const r=t.replaceAll("\\","/").split("/").filter(Boolean),n=r.length>3?`…/${r.slice(-3).join("/")}`:t;return e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",title:t,children:n})},T=/^\/|^[A-Z]:\\/i,U=({value:t})=>{if(t==null)return e("span",{class:"text-muted-foreground text-xs opacity-40",children:"—"});if(typeof t=="boolean")return e($,{value:t});if(Array.isArray(t))return e(K,{items:t.map(String)});if(typeof t=="object"){const n=JSON.stringify(t,void 0,2);return l("div",{class:"flex items-start gap-2",children:[e("pre",{class:"text-xs font-mono text-foreground bg-secondary border border-border px-2 py-1 overflow-auto max-h-24 flex-1 leading-relaxed",children:n}),e(k,{text:n})]})}const r=String(t);return T.test(r)&&r.length>40?e(R,{path:r}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:r})},o=({label:t,value:r})=>{if(r!=null)return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xs text-muted-foreground font-mono select-none self-center",children:t}),e("div",{class:"text-xs min-w-0 self-center",children:e(U,{value:r})})]})},J=()=>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(t=>e("span",{class:"size-1.5 bg-primary rounded-full animate-pulse opacity-50",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-xs text-muted-foreground",children:"Loading Vite config…"})]}),q=({error:t,onRetry:r})=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-sm text-destructive",children:t}),e(F,{onClick:r,size:"sm",variant:"outline",children:"Retry"})]}),W={post:"bg-blue-500/15 text-blue-400 border-blue-500/30",pre:"bg-amber-500/15 text-amber-400 border-amber-500/30"},G=({index:t,plugin:r})=>l("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xxs text-muted-foreground font-mono tabular-nums w-5 shrink-0 text-right select-none opacity-40",children:t+1}),e("span",{class:"text-xs font-mono text-foreground flex-1 truncate",children:r.name}),r.enforce?e("span",{class:v("text-xxs font-mono font-bold px-1.5 py-0.5 border uppercase tracking-wide",W[r.enforce]),children:r.enforce}):e("span",{class:"text-xxs font-mono text-muted-foreground px-1.5 py-0.5 bg-secondary border border-border",children:"normal"})]}),Q=({plugins:t})=>{const[r,n]=u(p(""),"query"),s=u(O(null),"inputRef"),d=r?t.filter(i=>i.name.toLowerCase().includes(r.toLowerCase())):t;return l(a,{children:[l("div",{class:"flex items-center gap-2 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-6 shrink-0",children:"#"}),l("div",{class:"flex-1 flex items-center gap-2",children:[e(D,{class:"text-muted-foreground shrink-0",size:11,src:H}),e(P,{class:"h-5 text-xs bg-transparent border-0 border-b border-border rounded-none px-0 py-0 focus-visible:ring-0 focus-visible:border-foreground placeholder:text-muted-foreground",onInput:i=>{n(i.target.value)},placeholder:`filter ${t.length} plugins…`,ref:s,type:"search",value:r})]}),e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-14 text-right",children:"Enforce"})]}),d.length===0?l("div",{class:"px-4 py-6 text-center text-xs text-muted-foreground",children:['No plugins match "',r,'"']}):d.map(i=>e(G,{index:t.indexOf(i),plugin:i},i.name)),r&&d.length>0&&e("div",{class:"px-4 py-1.5 bg-secondary border-t border-border text-right",children:l("span",{class:"text-xxs text-muted-foreground",children:[d.length," of ",t.length]})})]})},E="text-xxs font-bold uppercase tracking-widest text-muted-foreground",C=({col1:t,col2:r,extra:n})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:E,children:t}),l("div",{class:"flex items-center justify-between gap-2",children:[e("span",{class:E,children:r}),n]})]}),Y=({alias:t})=>{if(!t)return;let r=[];if(Array.isArray(t)?r=t.filter(n=>n?.find!==void 0):typeof t=="object"&&t!==null&&(r=Object.entries(t).map(([n,s])=>({find:n,replacement:s}))),r.length!==0)return l(a,{title:"Alias",children:[e(C,{col1:"Find",col2:"Replacement"}),r.map(({find:n,replacement:s})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary break-all leading-relaxed self-center",children:n}),e("div",{class:"self-center",children:T.test(s)&&s.length>40?e(R,{path:s}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:s})})]},n??s))]})},Z=new Set(["BASE_URL","DEV","MODE","PROD","SSR"]),X=36,ee=({forceVisible:t,tag:r,value:n})=>{const[s,d]=u(p(!1),"localRevealed"),i=t||s,b=i&&n.length>X,x=i?e("code",{class:"text-xs font-mono text-foreground truncate block",children:n}):e("span",{class:"text-xs font-mono text-muted-foreground tracking-widest select-none",children:"••••••••"});return l("div",{class:"flex items-center gap-2 w-full min-w-0",children:[e("span",{class:"flex-1 min-w-0 overflow-hidden",children:b?l(B,{children:[e(N,{class:"w-full block cursor-default",children:x}),e(M,{side:"top",children:e("code",{class:"text-xs font-mono break-all max-w-xs block",children:n})})]}):x}),r,e("button",{"aria-label":i?"Hide value":"Reveal value",class:"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer p-0.5",onClick:()=>{d(f=>!f)},title:i?"Hide value":"Reveal value",type:"button",children:e(D,{size:11,src:i?A:j})}),e(k,{text:n})]})},re=({entries:t})=>{const[r,n]=u(p(!1),"revealAll");return l(a,{title:"Environment Variables",children:[e(C,{col1:"Key",col2:"Value",extra:l("button",{class:"inline-flex items-center gap-1 text-xxs font-mono text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer",onClick:()=>{n(s=>!s)},type:"button",children:[e(D,{size:10,src:r?A:j}),r?"hide all":"reveal all"]})}),t.map(([s,d])=>{const i=Z.has(s);return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary truncate self-center",children:s}),e("div",{class:"self-center min-w-0",children:e(ee,{forceVisible:r,tag:e("span",{class:"text-xxs font-mono text-muted-foreground px-1 py-0.5 bg-secondary border border-border uppercase tracking-wide shrink-0 mr-5",children:i?"built-in":"user"}),value:d})})]},s)})]})},te=({entries:t})=>{if(t.length!==0)return l(a,{title:"Define Constants",children:[e(C,{col1:"Identifier",col2:"Replacement"}),t.map(([r,n])=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-amber-400 break-all leading-relaxed self-center",children:r}),l("div",{class:"flex items-center gap-2 self-center min-w-0",children:[e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed flex-1",children:JSON.stringify(n)}),e(k,{text:`${r}=${JSON.stringify(n)}`})]})]},r))]})},le=({helpers:t})=>{const[r,n]=u(p(void 0),"config"),[s,d]=u(p(void 0),"error"),[i,b]=u(p(!0),"loading"),x=()=>{b(!0),d(void 0),t.rpc.getViteConfig().then(c=>{n(c),b(!1)}).catch(c=>{d(c.message??"Failed to load Vite config"),b(!1)})};if(L(()=>{x()},[]),i)return e(J,{});if(s||!r)return e(q,{error:s??"No config available",onRetry:x});const f=r.plugins?.length??0,m=Object.keys(r.env??{}).length,S=Object.keys(r.define??{}).length;let y=0;return Array.isArray(r.resolve?.alias)?y=r.resolve.alias.length:typeof r.resolve?.alias=="object"&&r.resolve.alias!==null&&(y=Object.keys(r.resolve.alias).length),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:[r.mode&&e(w,{class:"uppercase tracking-wider text-xxs",variant:r.mode==="production"?"destructive":"default",children:r.mode}),r.server?.https&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"success",children:"HTTPS"}),r.ssr&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"secondary",children:"SSR"}),l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border truncate max-w-xs",title:r.root,children:["…/",r.root.replaceAll("\\","/").split("/").slice(-2).join("/")]}),r.base&&r.base!=="/"&&l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border",children:["base: ",r.base]}),e(F,{class:"ml-auto shrink-0 text-xs",onClick:x,size:"sm",variant:"outline",children:"Refresh"})]}),e("div",{class:"grid grid-cols-4 divide-x divide-border border-b border-border shrink-0",children:[{label:"plugins",value:f},{label:"env vars",value:m},{label:"defines",value:S},{label:"aliases",value:y}].map(({label:c,value:h})=>l("div",{class:"flex flex-col items-center py-2 gap-0.5",children:[e("span",{class:"text-sm font-semibold tabular-nums leading-none text-foreground",children:h}),e("span",{class:"text-xxs uppercase tracking-wider text-muted-foreground font-medium",children:c})]},c))}),l(V,{class:"flex flex-col flex-1 min-h-0",defaultValue:"server",children:[e("div",{class:"shrink-0 border-b border-border bg-muted",children:e(z,{class:"w-full rounded-none h-auto p-0 bg-transparent justify-start gap-0 overflow-x-auto",children:[{label:"Server",value:"server"},{label:`Plugins (${f})`,value:"plugins"},{label:"Build",value:"build"},{label:"Resolve",value:"resolve"},{label:`Env & Define (${m+S})`,value:"env"}].map(({label:c,value:h})=>e(I,{class:"rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none px-4 py-2 text-xs font-medium shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",value:h,children:c},h))})}),l(g,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"server",children:[l(a,{children:[e(o,{label:"host",value:r.server?.host??!1}),e(o,{label:"port",value:r.server?.port}),e(o,{label:"strictPort",value:r.server?.strictPort}),e(o,{label:"https",value:r.server?.https}),e(o,{label:"open",value:r.server?.open}),e(o,{label:"cors",value:r.server?.cors}),e(o,{label:"origin",value:r.server?.origin}),e(o,{label:"middlewareMode",value:r.server?.middlewareMode})]}),l(a,{title:"HMR",children:[e(o,{label:"enabled",value:r.server?.hmrEnabled??!0}),r.server?.hmrPort!==void 0&&e(o,{label:"port",value:r.server.hmrPort})]}),r.server?.proxy&&r.server.proxy.length>0&&e(a,{title:"Proxy Routes",children:r.server.proxy.map(c=>e("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:e("code",{class:"text-xs font-mono text-primary",children:c})},c))})]}),e(g,{class:"flex-1 overflow-auto p-4 mt-0",value:"plugins",children:f===0?e("p",{class:"text-sm text-muted-foreground text-center py-8",children:"No plugins registered"}):e(Q,{plugins:r.plugins??[]})}),l(g,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"build",children:[l(a,{children:[e(o,{label:"outDir",value:r.build?.outDir}),e(o,{label:"target",value:r.build?.target}),e(o,{label:"minify",value:r.build?.minify}),e(o,{label:"sourcemap",value:r.build?.sourcemap}),e(o,{label:"cssCodeSplit",value:r.build?.cssCodeSplit}),e(o,{label:"assetsDir",value:r.build?.assetsDir}),e(o,{label:"assetsInlineLimit",value:r.build?.assetsInlineLimit}),e(o,{label:"chunkSizeWarningLimit",value:r.build?.chunkSizeWarningLimit}),e(o,{label:"emptyOutDir",value:r.build?.emptyOutDir}),e(o,{label:"reportCompressedSize",value:r.build?.reportCompressedSize})]}),r.esbuild&&l(a,{title:"esbuild Transform",children:[e(o,{label:"jsx",value:r.esbuild.jsx}),e(o,{label:"jsxFactory",value:r.esbuild.jsxFactory}),e(o,{label:"jsxFragment",value:r.esbuild.jsxFragment}),e(o,{label:"jsxImportSource",value:r.esbuild.jsxImportSource}),e(o,{label:"target",value:r.esbuild.target})]}),l(a,{title:"CSS",children:[e(o,{label:"devSourcemap",value:r.css?.devSourcemap}),e(o,{label:"preprocessors",value:r.css?.preprocessors})]}),(r.optimizeDeps?.include?.length??0)>0||(r.optimizeDeps?.exclude?.length??0)>0?l(a,{title:"Optimize Deps",children:[e(o,{label:"include",value:r.optimizeDeps?.include}),e(o,{label:"exclude",value:r.optimizeDeps?.exclude})]}):void 0,r.ssr&&l(a,{title:"SSR",children:[e(o,{label:"target",value:r.ssr.target}),e(o,{label:"external",value:r.ssr.external}),e(o,{label:"noExternal",value:r.ssr.noExternal})]})]}),l(g,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"resolve",children:[l(a,{children:[e(o,{label:"extensions",value:r.resolve?.extensions}),e(o,{label:"conditions",value:r.resolve?.conditions}),e(o,{label:"mainFields",value:r.resolve?.mainFields}),e(o,{label:"dedupe",value:r.resolve?.dedupe}),e(o,{label:"preserveSymlinks",value:r.resolve?.preserveSymlinks})]}),e(Y,{alias:r.resolve?.alias}),l(a,{title:"Paths",children:[e(o,{label:"root",value:r.root}),e(o,{label:"publicDir",value:r.publicDir}),e(o,{label:"cacheDir",value:r.cacheDir}),e(o,{label:"envDir",value:r.envDir}),e(o,{label:"envPrefix",value:r.envPrefix})]})]}),l(g,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"env",children:[m>0?e(re,{entries:Object.entries(r.env??{})}):e("div",{class:"rounded-none border border-border bg-card border-l-2 border-l-primary/20 px-4 py-3",children:e("p",{class:"text-xs text-muted-foreground",children:"No environment variables exposed to the client."})}),e(te,{entries:Object.entries(r.define??{})})]})]})]})},be={component:le,icon:_,id:"dev-toolbar:vite-config",name:"Vite Config"};export{be as default};
16
+ `,w="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M2.062%2012.348a1%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%2019.876%200%201%201%200%200%201%200%20.696%2010.75%2010.75%200%200%201-19.876%200%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%20%2F%3E%20%3C%2Fsvg%3E",k="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M10.733%205.076a10.744%2010.744%200%200%201%2011.205%206.575%201%201%200%200%201%200%20.696%2010.747%2010.747%200%200%201-1.444%202.49%22%20%2F%3E%20%3Cpath%20d%3D%22M14.084%2014.158a3%203%200%200%201-4.242-4.242%22%20%2F%3E%20%3Cpath%20d%3D%22M17.479%2017.499a10.75%2010.75%200%200%201-15.417-5.151%201%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%204.446-5.143%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3C%2Fsvg%3E",W=new Set(["BASE_URL","DEV","MODE","PROD","SSR"]),Q=36,Y=({forceVisible:e,tag:t,value:a})=>{const[o,l]=u(m(!1),"localRevealed"),r=e||o,n=r&&a.length>Q,d=r?s("code",{class:"text-xs font-mono text-foreground truncate block",children:a}):s("span",{class:"text-xs font-mono text-muted-foreground tracking-widest select-none",children:"••••••••"});return i("div",{class:"flex items-center gap-2 w-full min-w-0",children:[s("span",{class:"flex-1 min-w-0 overflow-hidden",children:n?i(O,{children:[s(I,{class:"w-full block cursor-default",children:d}),s(B,{side:"top",children:s("code",{class:"text-xs font-mono break-all max-w-xs block",children:a})})]}):d}),t,s("button",{"aria-label":r?"Hide value":"Reveal value",class:"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer p-0.5",onClick:()=>{l(c=>!c)},title:r?"Hide value":"Reveal value",type:"button",children:s(y,{size:11,src:r?k:w})}),s(N,{text:a})]})},G=({rows:e})=>{const[t,a]=u(m(!1),"revealAll");return i(D,{title:"Environment Variables",children:[i("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 bg-secondary border-b border-border",children:[s("span",{class:b,children:"Key"}),i("div",{class:"flex items-center justify-between gap-2",children:[s("span",{class:b,children:"Value"}),i("button",{class:"inline-flex items-center gap-1 text-xxs font-mono text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer",onClick:()=>{a(o=>!o)},type:"button",children:[s(y,{size:10,src:t?k:w}),t?"hide all":"reveal all"]})]})]}),e.map(({key:o,value:l})=>i("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[s("code",{class:"text-xs font-mono text-primary truncate self-center",children:o}),s("div",{class:"self-center min-w-0",children:s(Y,{forceVisible:t,tag:s("span",{class:x(b,"font-mono px-1 py-0.5 bg-secondary border border-border shrink-0 mr-5 normal-case tracking-wide"),children:W.has(o)?"built-in":"user"}),value:l})})]},o))]})},X="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-search%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21%2021-4.34-4.34%22%20%2F%3E%20%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228%22%20%2F%3E%20%3C%2Fsvg%3E",Z={post:"bg-blue-500/15 text-blue-400 border-blue-500/30",pre:"bg-amber-500/15 text-amber-400 border-amber-500/30"},ee=({index:e,plugin:t})=>i("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[s("span",{class:"text-xxs text-muted-foreground font-mono tabular-nums w-5 shrink-0 text-right select-none opacity-40",children:e+1}),s("span",{class:"text-xs font-mono text-foreground flex-1 truncate",children:t.name}),t.enforce?s("span",{class:x("text-xxs font-mono font-bold px-1.5 py-0.5 border uppercase tracking-wide",Z[t.enforce]),children:t.enforce}):s("span",{class:"text-xxs font-mono text-muted-foreground px-1.5 py-0.5 bg-secondary border border-border",children:"normal"})]}),te=({plugins:e})=>{const[t,a]=u(m(""),"query"),o=e.map((r,n)=>({index:n,plugin:r})),l=t?o.filter(({plugin:r})=>r.name.toLowerCase().includes(t.toLowerCase())):o;return i(D,{children:[i("div",{class:"flex items-center gap-2 px-4 py-1.5 bg-secondary border-b border-border",children:[s("span",{class:x(b,"w-6 shrink-0"),children:"#"}),i("div",{class:"flex-1 flex items-center gap-2",children:[s(y,{class:"text-muted-foreground shrink-0",size:11,src:X}),s(M,{class:"h-5 text-xs bg-transparent border-0 border-b border-border rounded-none px-0 py-0 focus-visible:ring-0 focus-visible:border-foreground placeholder:text-muted-foreground",onInput:r=>{a(r.target.value)},placeholder:`filter ${e.length} plugins…`,type:"search",value:t})]}),s("span",{class:x(b,"w-14 text-right"),children:"Enforce"})]}),l.length===0?i("div",{class:"px-4 py-6 text-center text-xs text-muted-foreground",children:['No plugins match "',t,'"']}):l.map(({index:r,plugin:n})=>s(ee,{index:r,plugin:n},`${r}:${n.name}`)),t&&l.length>0&&s("div",{class:"px-4 py-1.5 bg-secondary border-t border-border text-right",children:i("span",{class:"text-xxs text-muted-foreground",children:[l.length," of ",e.length]})})]})},re=(e,t)=>`…/${e.replaceAll("\\","/").split("/").slice(-2).join("/")}`,se=e=>Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0,oe=e=>Array.isArray(e)?e.filter(t=>t?.find!==void 0).map(t=>({key:String(t.find),value:String(t.replacement??"")})):typeof e=="object"&&e!==null?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[],ne=()=>{const{add:e,elements:t}=$();return{add:e,elements:t,keyValues:r=>r.filter(([,n])=>n!=null).map(([n,d])=>e({props:{label:n,value:d},type:"KeyValue"})),pane:r=>e({children:r,props:{variant:"pane"},type:"Stack"}),section:(r,n)=>n.length===0?[]:[e({children:n,props:r===void 0?{}:{title:r},type:"Section"})]}},le=e=>{const{add:t,elements:a,keyValues:o,pane:l,section:r}=ne(),n=e.plugins??[],d=Object.entries(e.env??{}),c=Object.entries(e.define??{}),p=oe(e.resolve?.alias),C=(e.optimizeDeps?.include?.length??0)>0||(e.optimizeDeps?.exclude?.length??0)>0,v=[];e.mode&&v.push(e.mode==="production"?{label:e.mode,variant:"destructive"}:{label:e.mode}),e.server?.https&&v.push({label:"HTTPS",variant:"success"}),e.ssr&&v.push({label:"SSR",variant:"secondary"});const f=[{label:re(e.root),title:e.root}];e.base&&e.base!=="/"&&f.push({label:`base: ${e.base}`,title:e.base});const S=t({on:{action:{action:"refresh"}},props:{actionLabel:"Refresh",badges:v,chips:f},type:"HeaderBar"}),E=t({props:{stats:[{label:"plugins",value:n.length},{label:"env vars",value:d.length},{label:"defines",value:c.length},{label:"aliases",value:se(e.resolve?.alias)}]},type:"StatStrip"}),F=l([...r(void 0,[...o([["host",e.server?.host??!1],["port",e.server?.port],["strictPort",e.server?.strictPort],["https",e.server?.https],["open",e.server?.open],["cors",e.server?.cors],["origin",e.server?.origin],["middlewareMode",e.server?.middlewareMode]])]),...r("HMR",o([["enabled",e.server?.hmrEnabled??!0],["port",e.server?.hmrPort]])),...r("Proxy Routes",(e.server?.proxy??[]).map(h=>t({props:{value:h},type:"Row"})))]),R=l([n.length===0?t({props:{text:"No plugins registered"},type:"Note"}):t({props:{plugins:n},type:"PluginList"})]),L=l([...r(void 0,o([["outDir",e.build?.outDir],["target",e.build?.target],["minify",e.build?.minify],["sourcemap",e.build?.sourcemap],["cssCodeSplit",e.build?.cssCodeSplit],["assetsDir",e.build?.assetsDir],["assetsInlineLimit",e.build?.assetsInlineLimit],["chunkSizeWarningLimit",e.build?.chunkSizeWarningLimit],["emptyOutDir",e.build?.emptyOutDir],["reportCompressedSize",e.build?.reportCompressedSize]])),...r("esbuild Transform",o([["jsx",e.esbuild?.jsx],["jsxFactory",e.esbuild?.jsxFactory],["jsxFragment",e.esbuild?.jsxFragment],["jsxImportSource",e.esbuild?.jsxImportSource],["target",e.esbuild?.target]])),...r("CSS",o([["devSourcemap",e.css?.devSourcemap],["preprocessors",e.css?.preprocessors]])),...r("Optimize Deps",C?o([["include",e.optimizeDeps?.include],["exclude",e.optimizeDeps?.exclude]]):[]),...r("SSR",o([["target",e.ssr?.target],["external",e.ssr?.external],["noExternal",e.ssr?.noExternal]]))]),j=l([...r(void 0,o([["extensions",e.resolve?.extensions],["conditions",e.resolve?.conditions],["mainFields",e.resolve?.mainFields],["dedupe",e.resolve?.dedupe],["preserveSymlinks",e.resolve?.preserveSymlinks]])),...r("Alias",p.length===0?[]:[t({props:{keyLabel:"Find",rows:p,valueLabel:"Replacement"},type:"PairTable"})]),...r("Paths",o([["root",e.root],["publicDir",e.publicDir],["cacheDir",e.cacheDir],["envDir",e.envDir],["envPrefix",e.envPrefix]]))]),A=l([d.length===0?t({props:{text:"No environment variables exposed to the client."},type:"Note"}):t({props:{rows:d.map(([h,g])=>({key:h,value:g}))},type:"EnvTable"}),...r("Define Constants",c.length===0?[]:[t({props:{keyLabel:"Identifier",keyTone:"amber",rows:c.map(([h,g])=>({key:h,value:JSON.stringify(g)})),showCopy:!0,valueLabel:"Replacement"},type:"PairTable"})])]),V=t({children:[F,R,L,j,A],props:{tabs:[{label:"Server",value:"server"},{label:`Plugins (${n.length})`,value:"plugins"},{label:"Build",value:"build"},{label:"Resolve",value:"resolve"},{label:`Env & Define (${d.length+c.length})`,value:"env"}]},type:"TabView"}),P=t({children:[S,E,V],props:{class:"flex flex-col h-full space-y-0"},type:"Stack"});return{elements:a,root:P,state:{}}},ae={..._,EnvTable:G,PluginList:te},ie=({error:e,onRetry:t})=>i("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[s("p",{class:"text-sm text-destructive",children:e}),s(K,{onClick:t,size:"sm",variant:"outline",children:"Retry"})]}),de=({helpers:e})=>{const[t,a]=u(m(void 0),"config"),[o,l]=u(m(void 0),"error"),[r,n]=u(m(!0),"loading"),d=()=>{n(!0),l(void 0),e.rpc.getViteConfig().then(p=>{a(p),n(!1)}).catch(p=>{l(p instanceof Error?p.message:"Failed to load Vite config"),n(!1)})};T(()=>{d()},[]);const c=u(z(()=>t?le(t):void 0,[t]),"spec");return r?s(J,{label:"Loading Vite config…"}):o!==void 0||!c?s(ie,{error:o??"No config available",onRetry:d}):s(H,{actions:{...U,refresh:d},registry:ae,spec:c})},ke={component:de,icon:q,id:"dev-toolbar:vite-config",name:"Vite Config"};export{ke as default};
@@ -0,0 +1 @@
1
+ import{clsx as n}from"./clsx-BGQISBxA.js";import i from"./CopyButton-_TtOAEvr.js";import{jsxs as s,jsx as t}from"preact/jsx-runtime";const m="text-xxs font-bold uppercase tracking-widest text-muted-foreground",l=/^\/|^[A-Z]:\\/i,c=40,d=({value:e})=>s("span",{class:"inline-flex items-center gap-1.5",children:[t("span",{"aria-hidden":"true",class:n("inline-block size-1.5 rounded-full",e?"bg-success":"bg-border")}),t("span",{class:n("text-xs font-mono font-medium",e?"text-success":"text-muted-foreground"),children:e?"true":"false"})]}),a=({items:e})=>e.length===0?t("span",{class:"text-muted-foreground text-xs italic opacity-50",children:"empty"}):t("div",{class:"flex flex-wrap gap-1",children:e.map(r=>t("span",{class:"inline-flex items-center px-1.5 py-0.5 text-xxs font-mono font-medium bg-secondary border border-border text-secondary-foreground",children:r},r))}),x=({path:e})=>{const r=e.replaceAll("\\","/").split("/").filter(Boolean),o=r.length>3?`…/${r.slice(-3).join("/")}`:e;return t("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",title:e,children:o})},u=({value:e})=>{if(e==null)return t("span",{class:"text-muted-foreground text-xs opacity-40",children:"—"});if(typeof e=="boolean")return t(d,{value:e});if(Array.isArray(e))return t(a,{items:e.map(String)});if(typeof e=="object"){const o=JSON.stringify(e,void 0,2);return s("div",{class:"flex items-start gap-2",children:[t("pre",{class:"text-xs font-mono text-foreground bg-secondary border border-border px-2 py-1 overflow-auto max-h-24 flex-1 leading-relaxed",children:o}),t(i,{text:o})]})}const r=String(e);return l.test(r)&&r.length>c?t(x,{path:r}):t("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:r})};export{d as BoolValue,m as COLUMN_LABEL,x as ShortPath,a as TagList,u as ValueCell};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"preact/jsx-runtime";const t=({code:e})=>r("pre",{class:"text-[0.65rem] font-mono leading-relaxed bg-foreground/3 border-t border-border/50 px-4 py-3 overflow-x-auto max-h-60 text-muted-foreground whitespace-pre-wrap break-all m-0",children:e});export{t as default};
@@ -0,0 +1 @@
1
+ import{clsx as e}from"./clsx-BGQISBxA.js";import{useCopy as n}from"./useCopy-3LQUaNDI.js";import{jsx as p}from"preact/jsx-runtime";const s=({text:r})=>{const{copied:o,copy:t}=n();return p("button",{class:e("inline-flex items-center px-1.5 py-0.5 text-xxs font-mono border transition-colors duration-150 cursor-pointer",o?"border-primary text-primary bg-card":"border-border text-muted-foreground hover:text-foreground hover:border-foreground bg-transparent"),onClick:()=>{t(r)},title:"Copy to clipboard",type:"button",children:o?"copied":"copy"})};export{s as default};
@@ -0,0 +1 @@
1
+ import{clsx as s}from"./clsx-BGQISBxA.js";import c from"./Badge-DdZ-eO1L.js";import{SEVERITY_CONFIG as t}from"./MessageList-CWE27CLz.js";import{jsxs as n,jsx as e}from"preact/jsx-runtime";const d={error:"destructive",ok:"success",suggestion:"outline",warning:"warning"},x=({expanded:o=!1,label:i,onClick:a,severity:r,title:l})=>n("button",{"aria-expanded":o,class:"w-full flex items-center justify-between gap-3 px-4 py-3 bg-transparent border-0 cursor-pointer text-left hover:bg-foreground/3 transition-colors",onClick:a,type:"button",children:[n("div",{class:"flex items-center gap-2 min-w-0",children:[e("span",{class:s("text-base shrink-0 leading-none",t[r].color),children:t[r].icon}),e("span",{class:"text-[0.7rem] text-muted-foreground font-mono shrink-0",children:i}),e("code",{class:"text-[0.75rem] font-mono font-semibold text-foreground truncate",children:l})]}),n("div",{class:"flex items-center gap-2 shrink-0",children:[e(c,{variant:d[r],children:t[r].label}),e("span",{class:s("text-muted-foreground text-[0.65rem] transition-transform duration-150",o?"rotate-90":""),children:"▶"})]})]});export{x as default};
@@ -0,0 +1 @@
1
+ import{clsx as m}from"./clsx-BGQISBxA.js";import{jsxs as o,jsx as r}from"preact/jsx-runtime";const l=({children:s,hint:t,icon:c,title:d,tone:e="muted"})=>o("div",{class:"flex flex-col items-center justify-center py-12 gap-3",children:[r("div",{class:m("size-10 border flex items-center justify-center text-lg select-none",e==="success"&&"border-success/30 bg-success/8 text-success",e==="accent"&&"border-primary/20 bg-primary/5 text-primary/30",e==="muted"&&"border-border text-muted-foreground/40"),children:c}),r("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:d}),t!==void 0&&r("p",{class:"text-[0.7rem] text-muted-foreground text-center max-w-xs leading-relaxed",children:t}),s]});export{l as default};
@@ -0,0 +1 @@
1
+ import n from"./Badge-DdZ-eO1L.js";import x from"./Button-C47WESqv.js";import{jsxs as i,jsx as t}from"preact/jsx-runtime";const l=({actionLabel:o,badges:s=[],chips:d=[],onAction:a})=>i("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0 flex-wrap",children:[s.map(({label:r,variant:e="default"})=>t(n,{class:"uppercase tracking-wider text-xxs",variant:e,children:r},r)),d.map(({label:r,title:e})=>t("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border truncate max-w-xs",title:e,children:r},r)),o&&t(x,{class:"ml-auto shrink-0 text-xs",onClick:a,size:"sm",variant:"outline",children:o})]});export{l as default};
@@ -0,0 +1 @@
1
+ import{ValueCell as s}from"./BoolValue-CKN2S4KV.js";import{jsxs as t,jsx as r}from"preact/jsx-runtime";const i=({label:n,value:e})=>e==null?null:t("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[r("span",{class:"text-xs text-muted-foreground font-mono select-none self-center",children:n}),r("div",{class:"text-xs min-w-0 self-center",children:r(s,{value:e})})]});export{i as default};
@@ -0,0 +1 @@
1
+ import{jsxs as a,jsx as e}from"preact/jsx-runtime";const l=[0,160,320],i=({label:t})=>a("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:l.map(s=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${s}ms`}},s))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:t})]});export{i as default};
@@ -0,0 +1 @@
1
+ import{clsx as l}from"./clsx-BGQISBxA.js";import{jsxs as r,jsx as e}from"preact/jsx-runtime";const t={error:{color:"text-destructive",icon:"✖",label:"Error"},ok:{color:"text-success",icon:"✔",label:"OK"},suggestion:{color:"text-primary",icon:"ℹ",label:"Info"},warning:{color:"text-warning",icon:"⚠",label:"Warning"}},x=({emptyText:i="No issues found",messages:s})=>s.length===0?r("div",{class:"px-4 py-3 flex items-center gap-2 text-[0.72rem] text-success",children:[e("span",{children:"✔"}),e("span",{children:i})]}):e("div",{class:"px-4 py-3 space-y-1.5",children:s.map(({message:c,property:n,severity:o})=>r("div",{class:"flex items-start gap-2 text-[0.72rem]",children:[e("span",{class:l("shrink-0 leading-none mt-px",t[o].color),children:t[o].icon}),r("div",{class:"min-w-0",children:[n!==void 0&&n!==""&&r("code",{class:"text-[0.65rem] font-mono text-muted-foreground mr-1.5",children:[n,":"]}),e("span",{class:"text-foreground/80",children:c})]})]},`${n??""}:${c}`))});export{x as MessageList,t as SEVERITY_CONFIG};