foss-design 0.1.0 → 0.2.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.
@@ -54,26 +54,14 @@ Error generating stack: `+e.message+`
54
54
  `},Th=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Eh=function(){m.useEffect(function(){return document.body.setAttribute(Ch,(Th()+1).toString()),function(){var e=Th()-1;e<=0?document.body.removeAttribute(Ch):document.body.setAttribute(Ch,e.toString())}},[])},Dh=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Eh();var a=m.useMemo(function(){return xh(i)},[i]);return m.createElement(Sh,{styles:wh(a,!t,i,n?``:`!important`)})},Oh=!1;if(typeof window<`u`)try{var kh=Object.defineProperty({},"passive",{get:function(){return Oh=!0,!0}});window.addEventListener(`test`,kh,kh),window.removeEventListener(`test`,kh,kh)}catch{Oh=!1}var Ah=Oh?{passive:!1}:!1,jh=function(e){return e.tagName===`TEXTAREA`},Mh=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!jh(e)&&n[t]===`visible`)},Nh=function(e){return Mh(e,`overflowY`)},Ph=function(e){return Mh(e,`overflowX`)},Fh=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Rh(e,r)){var i=zh(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ih=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Lh=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Rh=function(e,t){return e===`v`?Nh(t):Ph(t)},zh=function(e,t){return e===`v`?Ih(t):Lh(t)},Bh=function(e,t){return e===`h`&&t===`rtl`?-1:1},Vh=function(e,t,n,r,i){var a=Bh(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=zh(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Rh(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Hh=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uh=function(e){return[e.deltaX,e.deltaY]},Wh=function(e){return e&&`current`in e?e.current:e},Gh=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Kh=function(e){return`
55
55
  .block-interactivity-${e} {pointer-events: none;}
56
56
  .allow-interactivity-${e} {pointer-events: all;}
57
- `},qh=0,Jh=[];function Yh(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(qh++)[0],a=m.useState(_h)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qm([e.lockRef.current],(e.shards||[]).map(Wh),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hh(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fh(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fh(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vh(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(Jh.length&&Jh[Jh.length-1]===a){var r=`deltaY`in n?Uh(n):Hh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Wh).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Xh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=Hh(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Uh(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Hh(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return Jh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ah),document.addEventListener(`touchmove`,c,Ah),document.addEventListener(`touchstart`,u,Ah),function(){Jh=Jh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ah),document.removeEventListener(`touchmove`,c,Ah),document.removeEventListener(`touchstart`,u,Ah)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:Kh(i)}):null,p?m.createElement(Dh,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Zh=sh(ch,Yh),Qh=m.forwardRef(function(e,t){return m.createElement(uh,Gm({},e,{ref:t,sideCar:Zh}))});Qh.classNames=uh.classNames;var $h=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},eg=new WeakMap,tg=new WeakMap,ng={},rg=0,ig=function(e){return e&&(e.host||ig(e.parentNode))},ag=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ig(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},og=function(e,t,n,r){var i=ag(t,Array.isArray(e)?e:[e]);ng[n]||(ng[n]=new WeakMap);var a=ng[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(eg.get(e)||0)+1,l=(a.get(e)||0)+1;eg.set(e,c),a.set(e,l),o.push(e),c===1&&i&&tg.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),rg++,function(){o.forEach(function(e){var t=eg.get(e)-1,i=a.get(e)-1;eg.set(e,t),a.set(e,i),t||(tg.has(e)||e.removeAttribute(r),tg.delete(e)),i||e.removeAttribute(n)}),rg--,rg||(eg=new WeakMap,eg=new WeakMap,tg=new WeakMap,ng={})}},sg=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||$h(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),og(r,i,n,`aria-hidden`)):function(){return null}},cg=Object.defineProperty,lg=(e,t)=>cg(e,`name`,{value:t,configurable:!0}),ug=`Dialog`,[dg,fg]=op(ug),[pg,mg]=dg(ug),hg=lg(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=Sp({prop:r,defaultProp:i??!1,onChange:a,caller:ug}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(pg,{scope:t,triggerRef:s,contentRef:c,contentId:pp(),titleId:pp(),descriptionId:pp(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),gg=`DialogPortal`,[_g,vg]=dg(gg,{forceMount:void 0}),yg=lg(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=mg(gg,t);return(0,h.jsx)(_g,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),bg=`DialogOverlay`,xg=m.forwardRef(lg(function(e,t){let n=vg(bg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mg(bg,e.__scopeDialog);return a.modal?(0,h.jsx)(Mm,{present:r||a.open,children:(0,h.jsx)(Cg,{...i,ref:t})}):null},`DialogOverlay`)),Sg=Ap(`DialogOverlay.RemoveScroll`),Cg=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,...r}=e,i=mg(bg,n),a=rp(t,im());return(0,h.jsx)(Qh,{as:Sg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Gp.div,{"data-state":jg(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),wg=`DialogContent`,Tg=m.forwardRef(lg(function(e,t){let n=vg(wg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mg(wg,e.__scopeDialog);return(0,h.jsx)(Mm,{present:r||a.open,children:a.modal?(0,h.jsx)(Eg,{...i,ref:t}):(0,h.jsx)(Dg,{...i,ref:t})})},`DialogContent`)),Eg=m.forwardRef(lg(function(e,t){let n=mg(wg,e.__scopeDialog),r=m.useRef(null),i=rp(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Og,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Dg=m.forwardRef(lg(function(e,t){let n=mg(wg,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Og,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Og=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=mg(wg,n);return Um(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(rm,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":jg(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),kg=`DialogTitle`,Ag=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,...r}=e,i=mg(kg,n),{setTitleCount:a}=i;return cp(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gp.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`));function jg(e){return e?`open`:`closed`}lg(jg,`getState`);var Mg=window.__DESIGN_STATIC__===!0,Ng=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Pg(e){let t=await fetch(e,{cache:Mg?`default`:`no-store`});if(!t.ok){let e=`${t.status} ${t.statusText}`;try{let n=await t.json();n.error&&(e=n.error)}catch{}throw new Ng(t.status,e)}return await t.json()}var Fg=null,Ig={project:()=>Pg(Mg?`api/project.json`:`/api/project`),canvas:e=>Pg(Mg?`api/canvas/${encodeURIComponent(e)}.json`:`/api/canvas/${encodeURIComponent(e)}`),system:()=>Pg(Mg?`api/system.json`:`/api/system`),async source(e){if(Mg){Fg??=Pg(`api/sources.json`).catch(()=>({}));let t=(await Fg)[e];if(t===void 0)throw new Ng(404,`${e} is not in this build`);return t}let t=await fetch(`/api/source?path=${encodeURIComponent(e)}`,{cache:`no-store`});if(!t.ok)throw new Ng(t.status,`Could not read ${e}`);return t.text()}},Lg=new Ue({defaultOptions:{queries:{staleTime:Mg?1/0:0,retry:1,refetchOnWindowFocus:!1}}}),Rg={project:[`project`],canvas:e=>[`canvas`,e],system:[`system`],source:e=>[`source`,e]};function zg(){return nt({queryKey:Rg.project,queryFn:Ig.project})}function Bg(e){return nt({queryKey:Rg.canvas(e),queryFn:()=>Ig.canvas(e),placeholderData:e=>e})}function Vg(e=!0){return nt({queryKey:Rg.system,queryFn:Ig.system,enabled:e})}function Hg(e){return nt({queryKey:Rg.source(e??``),queryFn:()=>Ig.source(e),enabled:!!e})}function Ug(){if(Mg)return()=>{};let e=null,t=!1;return e=new EventSource(`/api/events`),e.onopen=()=>{t&&(t=!1,Lg.invalidateQueries())},e.onerror=()=>{t=!0},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`project`)Lg.invalidateQueries({queryKey:Rg.project});else if(t.type===`system`)Lg.invalidateQueries({queryKey:Rg.system}),Lg.invalidateQueries({queryKey:[`source`]});else if(t.type===`canvas`||t.type===`snapshot`){let e=t.type===`canvas`?t.id:t.canvas;Lg.invalidateQueries({queryKey:Rg.canvas(e)}),t.type===`snapshot`&&Lg.invalidateQueries({queryKey:Rg.project})}},()=>e?.close()}function X(...e){return e.filter(Boolean).join(` `)}var Wg=null;function Gg(e,t){Wg={canvas:e,item:t},window.dispatchEvent(new CustomEvent(`design:focus`,{detail:Wg}))}function Kg(e){if(!Wg||Wg.canvas!==e)return null;let t=Wg.item;return Wg=null,t}var qg=class{value;listeners=new Set;constructor(e){this.value=e}get=()=>this.value;set=e=>{let t=typeof e==`function`?e(this.value):e;if(!Object.is(t,this.value)){this.value=t;for(let e of this.listeners)e()}};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})};function Jg(e,t=e=>e){return(0,m.useSyncExternalStore)(e.subscribe,()=>t(e.get()),()=>t(e.get()))}var Yg=`foss-design.theme`;function Xg(){try{let e=localStorage.getItem(Yg);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var Zg=new qg(Xg()),Qg=window.matchMedia(`(prefers-color-scheme: dark)`);function $g(e){return e===`system`?Qg.matches?`dark`:`light`:e}function e_(){document.documentElement.dataset.theme=$g(Zg.get())}Qg.addEventListener(`change`,e_),Zg.subscribe(e_);function t_(e){try{localStorage.setItem(Yg,e)}catch{}Zg.set(e)}function n_(){return Jg(Zg)}function r_(){let e=Jg(Zg),t=(0,m.useSyncExternalStore)(e=>(Qg.addEventListener(`change`,e),()=>Qg.removeEventListener(`change`,e)),()=>Qg.matches);return e===`system`?t?`dark`:`light`:e}var i_={plus:`<path d="M5 12h14"/><path d="M12 5v14"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,"chevron-down":`<path d="m6 9 6 6 6-6"/>`,"chevron-up":`<path d="m18 15-6-6-6 6"/>`,"chevron-right":`<path d="m9 18 6-6-6-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,chevrons:`<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>`,copy:`<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,bell:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,refresh:`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`,"up-right":`<path d="M7 7h10v10"/><path d="M7 17 17 7"/>`,"down-left":`<path d="M17 7 7 17"/><path d="M17 17H7V7"/>`,external:`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"user-plus":`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M19 8v6"/><path d="M22 11h-6"/>`,user:`<circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`,more:`<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>`,alert:`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>`,info:`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,upload:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>`,download:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>`,shield:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`,logout:`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>`,loader:`<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,"circle-check":`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,"circle-dashed":`<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`,send:`<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>`,chat:`<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>`,wallet:`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>`,"file-code":`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/>`,ban:`<circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/>`,code:`<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>`,"chevron-left":`<path d="m15 18-6-6 6-6"/>`,bluetooth:`<path d="m7 7 10 10-5 5V2l5 5L7 17"/>`,face:`<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>`,eye:`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`,clipboard:`<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>`,grip:`<circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/>`,list:`<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>`,lock:`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,hw:`<rect width="20" height="10" x="2" y="7" rx="2"/><path d="M15 7v10"/><circle cx="8" cy="12" r="1.5"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,signal:`<path d="M2 20h.01"/><path d="M7 20v-4"/><path d="M12 20v-8"/><path d="M17 20V8"/>`,grid:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>`,coins:`<circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="m16.71 13.88.7.71-2.82 2.82"/>`,arrows:`<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>`,key:`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`,blocks:`<rect width="7" height="7" x="14" y="3" rx="1"/><path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"/>`,settings:`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,qr:`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`,edit:`<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>`,home:`<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,"arrow-left":`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`,play:`<polygon points="6 3 20 12 6 21 6 3"/>`,"zoom-in":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>`,"zoom-out":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M8 11h6"/>`,fit:`<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>`,"panel-left":`<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>`,layers:`<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,file:`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>`,palette:`<circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.96 6.01 17.46 2 12 2z"/>`,type:`<path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/>`,shape:`<path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M21 19a2 2 0 0 1-2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h1"/><path d="M14 3h1"/><path d="M14 21h1"/><path d="M3 9v1"/><path d="M21 9v1"/><path d="M3 14v1"/><path d="M21 14v1"/>`,motion:`<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 6c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>`,book:`<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,image:`<rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>`,monitor:`<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/>`,tablet:`<rect width="16" height="20" x="4" y="2" rx="2"/><path d="M12 18h.01"/>`,note:`<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,pointer:`<path d="M4.04 4.69a.5.5 0 0 1 .65-.65l16 6.5a.5.5 0 0 1-.06.95l-6.12 1.58a2 2 0 0 0-1.44 1.44l-1.58 6.12a.5.5 0 0 1-.95.06z"/>`,component:`<path d="M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5Z"/><path d="m12 2 3.5 3.5L12 9 8.5 5.5 12 2Z"/><path d="M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5Z"/><path d="m12 15 3.5 3.5L12 22l-3.5-3.5L12 15Z"/>`,keyboard:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>`,folder:`<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>`,canvas:`<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>`};function Z({name:e,size:t=16,strokeWidth:n=1.75,className:r}){return(0,h.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`shrink-0 ${e===`loader`?`animate-spin`:``} ${r??``}`,dangerouslySetInnerHTML:{__html:i_[e]}})}function Q({children:e,size:t=12.5,className:n,title:r,wrap:i}){return(0,h.jsx)(`span`,{title:r,className:X(i?`break-all`:`whitespace-nowrap`,`font-mono`,n),style:{fontSize:t},children:e})}function a_({children:e}){return(0,h.jsx)(`kbd`,{className:`rounded-[4px] border border-rule bg-surface px-[5px] py-px font-mono text-[11px] text-ink2`,children:e})}function o_({top:e,bottom:t,weight:n=500}){return(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px`,children:[(0,h.jsx)(`span`,{className:`truncate leading-[1.35]`,style:{fontWeight:n},children:e}),t?(0,h.jsx)(`span`,{className:`flex min-w-0 items-center gap-2.5 overflow-hidden whitespace-nowrap text-[12.5px] leading-[1.35] text-muted`,children:t}):null]})}var s_={canvas:`This canvas`,canvases:`Canvases`,system:`Design system`,actions:`Actions`};function c_(e){let t=/^\/c\/([^/]+)/.exec(e);return t?decodeURIComponent(t[1]):null}function l_({onClose:e}){let[t,n]=jf(),r=zg().data,i=c_(t),a=nt({queryKey:Rg.canvas(i??``),queryFn:()=>Ig.canvas(i),enabled:!!i}).data,o=nt({queryKey:Rg.system,queryFn:Ig.system,enabled:!!r?.system}).data,[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(0),d=t=>()=>{e(),t()},f=[];if(a)for(let e of a.pages){f.push({id:`page:${e.id}`,group:`canvas`,label:e.title,icon:`file`,hint:`Page`,run:d(()=>n(`/c/${encodeURIComponent(a.id)}/p/${encodeURIComponent(e.id)}`))});for(let t of e.sections)for(let r of t.items)(r.kind===`screen`||r.kind===`url`)&&f.push({id:`item:${e.id}:${r.id}`,group:`canvas`,label:r.title,icon:r.kind===`url`?`globe`:`monitor`,hint:t.title?`${e.title} · ${t.title}`:e.title,keywords:`${r.id} ${t.title??``}`,searchOnly:!0,run:d(()=>{n(`/c/${encodeURIComponent(a.id)}/p/${encodeURIComponent(e.id)}`),Gg(a.id,r.id)})})}for(let e of r?.canvases??[])e.id!==i&&f.push({id:`canvas:${e.id}`,group:`canvases`,label:e.title,icon:`canvas`,hint:`${e.screens} screens`,keywords:e.id,run:d(()=>n(`/c/${encodeURIComponent(e.id)}`))});if(r?.system){for(let[e,t,r]of[[`Overview`,`/system`,`book`],[`Colors`,`/system/colors`,`palette`],[`Typography`,`/system/typography`,`type`],[`Spacing & shape`,`/system/shape`,`shape`]])f.push({id:`sys:${t}`,group:`system`,label:e,icon:r,run:d(()=>n(t))});for(let e of o?.components??[])f.push({id:`component:${e.id}`,group:`system`,label:e.title,icon:`component`,hint:e.group,searchOnly:!0,run:d(()=>n(`/system/components/${encodeURIComponent(e.id)}`))});for(let e of o?.guidelines??[])f.push({id:`guide:${e.slug}`,group:`system`,label:e.title,icon:`book`,hint:`Guideline`,searchOnly:!0,run:d(()=>n(`/system/guidelines/${encodeURIComponent(e.slug)}`))})}f.push({id:`home`,group:`actions`,label:`All canvases`,icon:`home`,run:d(()=>n(`/`))},{id:`light`,group:`actions`,label:`Light appearance`,icon:`sun`,searchOnly:!0,run:d(()=>t_(`light`))},{id:`dark`,group:`actions`,label:`Dark appearance`,icon:`moon`,searchOnly:!0,run:d(()=>t_(`dark`))},{id:`system-theme`,group:`actions`,label:`System appearance`,icon:`monitor`,searchOnly:!0,run:d(()=>t_(`system`))});let p=s.trim().toLowerCase(),g=f.filter(e=>p?`${e.label} ${e.keywords??``} ${typeof e.hint==`string`?e.hint:``}`.toLowerCase().includes(p):!e.searchOnly),_=[`canvas`,`canvases`,`system`,`actions`].map(e=>({group:e,items:g.filter(t=>t.group===e)})).filter(e=>e.items.length),v=_.flatMap(e=>e.items),y=Math.min(l,Math.max(v.length-1,0)),b=-1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ag,{className:`sr-only`,children:`Search and jump`}),(0,h.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-rule px-4`,children:[(0,h.jsx)(Z,{name:`search`,size:16,className:`text-muted`}),(0,h.jsx)(`input`,{value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),u((y+1)%Math.max(v.length,1))):e.key===`ArrowUp`?(e.preventDefault(),u((y-1+v.length)%Math.max(v.length,1))):e.key===`Enter`&&(e.preventDefault(),v[y]?.run())},placeholder:`Canvases, screens, components…`,"aria-label":`Search and jump`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`palette-list`,autoComplete:`off`,spellCheck:!1,className:`h-full min-w-0 grow border-0 bg-transparent text-[15px] text-ink outline-none placeholder:text-muted`}),(0,h.jsx)(a_,{children:`esc`})]}),(0,h.jsx)(`div`,{id:`palette-list`,role:`listbox`,className:`min-h-0 grow overflow-y-auto py-1.5`,children:_.length?_.map(({group:e,items:t})=>(0,h.jsxs)(`div`,{role:`presentation`,children:[(0,h.jsx)(`div`,{className:`px-4 pt-2.5 pb-1 text-[12px] text-muted`,children:s_[e]}),t.map(e=>{b+=1;let t=b,n=t===y;return(0,h.jsxs)(`button`,{type:`button`,role:`option`,tabIndex:-1,"aria-selected":n,ref:n?e=>e?.scrollIntoView({block:`nearest`}):void 0,onMouseMove:()=>n?void 0:u(t),onClick:e.run,className:X(`flex h-10 w-full cursor-pointer items-center gap-3 border-0 px-4 text-left text-[13.5px] text-ink`,n?`bg-soft`:`bg-transparent`),children:[(0,h.jsx)(`span`,{className:`flex w-5 shrink-0 justify-center text-ink2`,children:(0,h.jsx)(Z,{name:e.icon,size:16})}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.label}),e.hint?(0,h.jsx)(`span`,{className:`flex shrink-0 items-center text-[12.5px] text-muted`,children:e.hint}):null]},e.id)})]},e)):(0,h.jsx)(`div`,{className:`px-6 py-10 text-center text-[13px] text-muted`,children:`Nothing matches.`})}),(0,h.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-4 border-t border-rule bg-soft px-4 text-[12px] text-muted`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(a_,{children:`↑`}),(0,h.jsx)(a_,{children:`↓`}),`move`]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(a_,{children:`↵`}),`open`]})]})]})}function u_(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=()=>t(e=>!e),n=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())};return window.addEventListener(`keydown`,n),window.addEventListener(`design:palette`,e),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`design:palette`,e)}},[]),(0,h.jsx)(hg,{open:e,onOpenChange:t,children:(0,h.jsx)(V,{children:e?(0,h.jsx)(yg,{forceMount:!0,children:(0,h.jsx)(xg,{asChild:!0,forceMount:!0,children:(0,h.jsx)($d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.14},className:`fixed inset-0 z-50 flex items-start justify-center bg-overlay p-6 pt-[12vh]`,children:(0,h.jsx)(Tg,{asChild:!0,forceMount:!0,"aria-describedby":void 0,children:(0,h.jsx)($d.div,{initial:{opacity:0,scale:.98,y:-6},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,transition:{duration:.1}},transition:{type:`spring`,stiffness:560,damping:40},className:`flex max-h-[min(560px,76vh)] w-[560px] max-w-full flex-col overflow-hidden rounded-[12px] border border-rule bg-surface shadow-pop outline-none`,children:(0,h.jsx)(l_,{onClose:()=>t(!1)})})})})})}):null})})}var d_=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`;function f_(){window.dispatchEvent(new CustomEvent(`design:palette`))}function p_({width:e=240,label:t=`Search and jump`}){return(0,h.jsxs)(`button`,{type:`button`,onClick:f_,style:{width:e},className:`flex h-ctrl min-w-0 shrink cursor-pointer items-center gap-2 rounded-[6px] border border-rule bg-soft pr-1.5 pl-3 text-ctrl text-muted transition-colors hover:border-rule-strong max-lg:w-auto!`,children:[(0,h.jsx)(Z,{name:`search`,size:15}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate text-left max-lg:hidden`,children:t}),(0,h.jsx)(a_,{children:d_===`⌘`?`⌘K`:`Ctrl K`})]})}var m_={primary:`border border-primary bg-primary text-primary-ink hover:opacity-90`,secondary:`border border-rule-strong bg-surface text-ink hover:bg-soft`,ghost:`border border-transparent bg-transparent text-ink2 hover:bg-soft2`,dashed:`border border-dashed border-rule-strong bg-transparent text-ink2 hover:bg-soft`,danger:`border border-danger bg-danger text-on-danger hover:opacity-90`},h_=(e=`secondary`,t)=>X(`inline-flex h-ctrl shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] px-ctrl text-ctrl font-medium leading-none no-underline transition-[background-color,opacity] duration-100`,`disabled:cursor-not-allowed disabled:opacity-45 aria-disabled:cursor-not-allowed aria-disabled:opacity-45`,m_[e],t),g_=(0,m.forwardRef)(function({kind:e=`secondary`,icon:t,loading:n,disabled:r,className:i,children:a,type:o=`button`,...s},c){return(0,h.jsxs)(`button`,{ref:c,type:o,disabled:r||n,"aria-busy":n||void 0,className:h_(e,i),...s,children:[n?(0,h.jsx)(Z,{name:`loader`,size:15,className:`animate-spin`}):t?(0,h.jsx)(Z,{name:t,size:15}):null,a]})}),__={ghost:`border border-transparent bg-transparent text-muted hover:bg-soft2 hover:text-ink2`,secondary:`border border-rule-strong bg-surface text-ink2 hover:bg-soft`},v_=(e=`ghost`,t)=>X(`inline-flex h-ctrl w-ctrl shrink-0 cursor-pointer items-center justify-center rounded-[6px] p-0 transition-colors duration-100 disabled:cursor-not-allowed disabled:opacity-45`,__[e],t),y_=(0,m.forwardRef)(function({icon:e,label:t,kind:n=`ghost`,size:r=16,className:i,type:a=`button`,...o},s){return(0,h.jsx)(`button`,{ref:s,type:a,"aria-label":t,title:t,className:v_(n,i),...o,children:(0,h.jsx)(Z,{name:e,size:r})})});function b_({to:e,kind:t=`secondary`,icon:n,className:r,children:i}){return(0,h.jsxs)(Lf,{href:e,className:h_(t,r),children:[n?(0,h.jsx)(Z,{name:n,size:15}):null,i]})}function x_({kind:e=`secondary`,icon:t,className:n,children:r,...i}){return(0,h.jsxs)(`a`,{className:h_(e,n),...i,children:[t?(0,h.jsx)(Z,{name:t,size:15}):null,r]})}var S_=Object.defineProperty,C_=(e,t)=>S_(e,`name`,{value:t,configurable:!0});function w_(e){let t=e+`CollectionProvider`,[n,r]=op(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=C_(e=>{let{scope:t,children:n}=e,r=m.useRef(null),a=m.useRef(new Map).current;return(0,h.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Ap(s),l=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=rp(t,a(s,n).collectionRef);return(0,h.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Ap(u),p=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),s=rp(t,o),c=a(u,n);return m.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,h.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function g(t){let n=a(e+`CollectionConsumer`,t);return m.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return C_(g,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},g,r]}C_(w_,`createCollection`);var T_=new WeakMap,E_=class e extends Map{static{C_(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],T_.set(this,!0)}set(e,t){return T_.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=k_(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=D_(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=D_(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return D_(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function D_(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=O_(e,t);return n===-1?void 0:e[n]}C_(D_,`at`);function O_(e,t){let n=e.length,r=k_(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}C_(O_,`toSafeIndex`);function k_(e){return e!==e||e===0?0:Math.trunc(e)}C_(k_,`toSafeInteger`);function A_(e){let t=e+`CollectionProvider`,[n,r]=op(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new E_,setItemMap:C_(()=>void 0,`setItemMap`)}),o=C_(({state:e,...t})=>e?(0,h.jsx)(c,{...t,state:e}):(0,h.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=C_(e=>{let t=_();return(0,h.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=C_(e=>{let{scope:t,children:n,state:r}=e,a=m.useRef(null),[o,s]=m.useState(null),c=rp(a,s),[l,u]=r;return m.useEffect(()=>{if(!o)return;let e=P_(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,h.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=Ap(l),d=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=rp(t,a(l,n).collectionRef);return(0,h.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=Ap(f),g=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),[s,c]=m.useState(null),l=rp(t,o,c),{setItemMap:u}=a(f,n),d=m.useRef(i);j_(d.current,i)||(d.current=i);let g=d.current;return m.useEffect(()=>{let e=g;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(N_):(t.set(s,{...e,element:s}),t.toSorted(N_)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new E_(e)))}},[s,g,u]),(0,h.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});g.displayName=f;function _(){return m.useState(new E_)}C_(_,`useInitCollection`);function v(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return C_(v,`useCollection`),[{Provider:o,Slot:d,ItemSlot:g},{createCollectionScope:r,useCollection:v,useInitCollection:_}]}C_(A_,`createCollection`);function j_(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}C_(j_,`shallowEqual`);function M_(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}C_(M_,`isElementPreceding`);function N_(e,t){return!e[1].element||!t[1].element?0:M_(e[1].element,t[1].element)?-1:1}C_(N_,`sortByDocumentPosition`);function P_(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}C_(P_,`getChildListObserver`);var F_=Object.defineProperty,I_=(e,t)=>F_(e,`name`,{value:t,configurable:!0}),L_=m.createContext(void 0);function R_(e){let t=m.useContext(L_);return e||t||`ltr`}I_(R_,`useDirection`);var z_=[`top`,`right`,`bottom`,`left`],B_=Math.min,V_=Math.max,H_=Math.round,U_=Math.floor,W_=e=>({x:e,y:e}),G_={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function K_(e,t,n){return V_(e,B_(t,n))}function q_(e,t){return typeof e==`function`?e(t):e}function J_(e){return e.split(`-`)[0]}function Y_(e){return e.split(`-`)[1]}function X_(e){return e===`x`?`y`:`x`}function Z_(e){return e===`y`?`height`:`width`}function Q_(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $_(e){return X_(Q_(e))}function ev(e,t,n){n===void 0&&(n=!1);let r=Y_(e),i=$_(e),a=Z_(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lv(o)),[o,lv(o)]}function tv(e){let t=lv(e);return[nv(e),t,nv(t)]}function nv(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rv=[`left`,`right`],iv=[`right`,`left`],av=[`top`,`bottom`],ov=[`bottom`,`top`];function sv(e,t,n){switch(e){case`top`:case`bottom`:return n?t?iv:rv:t?rv:iv;case`left`:case`right`:return t?av:ov;default:return[]}}function cv(e,t,n,r){let i=Y_(e),a=sv(J_(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nv)))),a}function lv(e){let t=J_(e);return G_[t]+e.slice(t.length)}function uv(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function dv(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uv(e)}function fv(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pv(e,t,n){let{reference:r,floating:i}=e,a=Q_(t),o=$_(t),s=Z_(o),c=J_(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Y_(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mv(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=q_(t,e),p=dv(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fv(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hv=50,gv=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mv},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hv&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_v=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=q_(e,t)||{};if(l==null)return{};let d=dv(u),f={x:n,y:r},p=$_(i),m=Z_(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=B_(d[_],T),D=B_(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=K_(E,k,O),j=!c.arrow&&Y_(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),vv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=q_(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=J_(r),_=Q_(o),v=J_(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lv(o)]:tv(o)),x=p!==`none`;!d&&x&&b.push(...cv(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ev(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Q_(t)||T.every(e=>Q_(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Q_(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function yv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bv(e){return z_.some(t=>e[t]>=0)}var xv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=q_(e,t);switch(i){case`referenceHidden`:{let e=yv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bv(e)}}}case`escaped`:{let e=yv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bv(e)}}}default:return{}}}}},Sv=new Set([`left`,`top`]);async function Cv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=J_(n),s=Y_(n),c=Q_(n)===`y`,l=Sv.has(o)?-1:1,u=a&&c?-1:1,d=q_(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=q_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Q_(i),p=X_(f),m=u[p],h=u[f],g=(e,t)=>K_(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ev=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=q_(e,t),u={x:n,y:r},d=Q_(i),f=X_(d),p=u[f],m=u[d],h=q_(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sv.has(J_(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dv=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=q_(e,t),c=await i.detectOverflow(t,s),l=J_(n),u=Y_(n),d=Q_(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=B_(p-c[m],g),y=B_(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*V_(c.left,c.right):S=p-2*V_(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ov(){return typeof window<`u`}function kv(e){return Mv(e)?(e.nodeName||``).toLowerCase():`#document`}function Av(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jv(e){return((Mv(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mv(e){return Ov()?e instanceof Node||e instanceof Av(e).Node:!1}function Nv(e){return Ov()?e instanceof Element||e instanceof Av(e).Element:!1}function Pv(e){return Ov()?e instanceof HTMLElement||e instanceof Av(e).HTMLElement:!1}function Fv(e){return!Ov()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Av(e).ShadowRoot}function Iv(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qv(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lv(e){return/^(table|td|th)$/.test(kv(e))}function Rv(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zv=/transform|translate|scale|rotate|perspective|filter/,Bv=/paint|layout|strict|content/,Vv=e=>!!e&&e!==`none`,Hv;function Uv(e){let t=Nv(e)?qv(e):e;return Vv(t.transform)||Vv(t.translate)||Vv(t.scale)||Vv(t.rotate)||Vv(t.perspective)||!Gv()&&(Vv(t.backdropFilter)||Vv(t.filter))||zv.test(t.willChange||``)||Bv.test(t.contain||``)}function Wv(e){let t=Yv(e);for(;Pv(t)&&!Kv(t);){if(Uv(t))return t;if(Rv(t))return null;t=Yv(t)}return null}function Gv(){return Hv??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Hv}function Kv(e){return/^(html|body|#document)$/.test(kv(e))}function qv(e){return Av(e).getComputedStyle(e)}function Jv(e){return Nv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yv(e){if(kv(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fv(e)&&e.host||jv(e);return Fv(t)?t.host:t}function Xv(e){let t=Yv(e);return Kv(t)?(e.ownerDocument||e).body:Pv(t)&&Iv(t)?t:Xv(t)}function Zv(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xv(e),i=r===e.ownerDocument?.body,a=Av(r);if(i){let e=Qv(a);return t.concat(a,a.visualViewport||[],Iv(r)?r:[],e&&n?Zv(e):[])}return t.concat(r,Zv(r,[],n))}function Qv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $v(e){let t=qv(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Pv(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=H_(n)!==a||H_(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ey(e){return Nv(e)?e:e.contextElement}function ty(e){let t=ey(e);if(!Pv(t))return W_(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$v(t),o=(a?H_(n.width):n.width)/r,s=(a?H_(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ny=W_(0);function ry(e){let t=Av(e);return!Gv()||!t.visualViewport?ny:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Av(e)}function ay(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ey(e),o=W_(1);t&&(r?Nv(r)&&(o=ty(r)):o=ty(e));let s=iy(a,n,r)?ry(a):W_(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Av(a),t=Nv(r)?Av(r):r,n=e,i=Qv(n);for(;i&&t!==n;){let e=ty(i),t=i.getBoundingClientRect(),r=qv(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Av(i),i=Qv(n)}}return fv({width:u,height:d,x:c,y:l})}function oy(e,t){let n=Jv(e).scrollLeft;return t?t.left+n:ay(jv(e)).left+n}function sy(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-oy(e,n),y:n.top+t.scrollTop}}function cy(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jv(r),s=t?Rv(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=W_(1),u=W_(0),d=Pv(r);if((d||!a)&&((kv(r)!==`body`||Iv(o))&&(c=Jv(r)),d)){let e=ay(r);l=ty(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sy(o,c):W_(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ly(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function uy(e){let t=Jv(e),n=e.ownerDocument.body,r=V_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=V_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+oy(e),o=-t.scrollTop;return qv(n).direction===`rtl`&&(a+=V_(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var dy=25;function fy(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Av(e),a=jv(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Gv()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(oy(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=dy&&(s-=o)}return{width:s,height:c,x:l,y:u}}function py(e,t){let n=ay(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ty(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function my(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fy(e,n,t);else if(t===`document`)r=uy(jv(e));else if(Nv(t))r=py(t,n);else{let n=ry(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fv(r)}function hy(e,t){let n=t.get(e);if(n)return n;let r=Zv(e,[],!1).filter(e=>Nv(e)&&kv(e)!==`body`),i=null,a=qv(e).position===`fixed`,o=a?Yv(e):e;for(;Nv(o)&&!Kv(o);){let e=qv(o),t=Uv(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Yv(o)}return t.set(e,r),r}function gy(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rv(t)?[]:hy(t,this._c):[].concat(n),r],o=my(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=my(t,a[e],i);s=V_(n.top,s),c=B_(n.right,c),l=B_(n.bottom,l),u=V_(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _y(e){let{width:t,height:n}=$v(e);return{width:t,height:n}}function vy(e,t,n){let r=Pv(t),i=jv(t),a=n===`fixed`,o=ay(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=W_(0);if((r||!a)&&((kv(t)!==`body`||Iv(i))&&(s=Jv(t)),r)){let e=ay(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=oy(i));let l=i&&!r&&!a?sy(i,s):W_(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function yy(e){return qv(e).position===`static`}function by(e,t){if(!Pv(e)||qv(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jv(e)===n&&(n=n.ownerDocument.body),n}function xy(e,t){let n=Av(e);if(Rv(e))return n;if(!Pv(e)){let t=Yv(e);for(;t&&!Kv(t);){if(Nv(t)&&!yy(t))return t;t=Yv(t)}return n}let r=by(e,t);for(;r&&Lv(r)&&yy(r);)r=by(r,t);return r&&Kv(r)&&yy(r)&&!Uv(r)?n:r||Wv(e)||n}var Sy=async function(e){let t=this.getOffsetParent||xy,n=this.getDimensions,r=await n(e.floating);return{reference:vy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cy(e){return qv(e).direction===`rtl`}var wy={convertOffsetParentRelativeRectToViewportRelativeRect:cy,getDocumentElement:jv,getClippingRect:gy,getOffsetParent:xy,getElementRects:Sy,getClientRects:ly,getDimensions:_y,getScale:ty,isElement:Nv,isRTL:Cy};function Ty(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ey(e,t,n){let r=null,i,a=jv(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=U_(d),h=U_(a.clientWidth-(u+f)),g=U_(a.clientHeight-(d+p)),_=U_(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:V_(0,B_(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ty(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Av(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Dy(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ey(e),u=i||a?[...l?Zv(l):[],...t?Zv(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ey(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?ay(e):null;c&&g();function g(){let t=ay(e);h&&!Ty(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Oy=wv,ky=Tv,Ay=vv,jy=Dv,My=xv,Ny=_v,Py=Ev,Fy=(e,t,n)=>{let r=new Map,i=n??{},a={...wy,...i.platform,_c:r};return gv(e,t,{...i,platform:a})},Iy=typeof document<`u`?m.useLayoutEffect:function(){};function Ly(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ly(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ly(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ry(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zy(e,t){let n=Ry(e);return Math.round(t*n)/n}function By(e){let t=m.useRef(e);return Iy(()=>{t.current=e}),t}function Vy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);Ly(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=By(c),O=By(i),k=By(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Fy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ly(T.current,t)&&(T.current=t,Dp.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Iy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Iy(()=>(j.current=!0,()=>{j.current=!1}),[]),Iy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=m.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=zy(te.floating,u.x),r=zy(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ry(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:ee,elements:te,floatingStyles:ne}),[u,A,ee,te,ne])}var Hy=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ny({element:r.current,padding:i}).fn(n):r?Ny({element:r,padding:i}).fn(n):{}}}},Uy=(e,t)=>{let n=Oy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wy=(e,t)=>{let n=ky(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gy=(e,t)=>({fn:Py(e).fn,options:[e,t]}),Ky=(e,t)=>{let n=Ay(e);return{name:n.name,fn:n.fn,options:[e,t]}},qy=(e,t)=>{let n=jy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jy=(e,t)=>{let n=My(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yy=(e,t)=>{let n=Hy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xy=Object.defineProperty,Zy=(e,t)=>Xy(e,`name`,{value:t,configurable:!0});function Qy(e){let[t,n]=m.useState(void 0);return cp(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}Zy(Qy,`useSize`);var $y=Object.defineProperty,eb=(e,t)=>$y(e,`name`,{value:t,configurable:!0}),tb=`Popper`,[nb,rb]=op(tb),[ib,ab]=nb(tb),ob=eb(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(ib,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),sb=`PopperAnchor`,cb=m.forwardRef(eb(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=ab(sb,n),o=m.useRef(null),s=a.onAnchorChange,c=rp(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&hb(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Gp.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),lb=`PopperContent`,[ub,db]=nb(lb),fb=m.forwardRef(eb(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=ab(lb,n),[y,b]=m.useState(null),x=rp(t,b),[S,C]=m.useState(null),w=Qy(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(pb),altBoundary:A},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:ie}=Vy({strategy:`fixed`,placement:D,whileElementsMounted:eb((...e)=>Dy(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Uy({mainAxis:i+E,alignmentAxis:o}),c&&Wy({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Gy():void 0,...j}),c&&Ky({...j}),qy({...j,apply:eb(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&Yy({element:S,padding:s}),mb({arrowWidth:T,arrowHeight:E}),f&&Jy({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),ae=v.setPlacementState;cp(()=>(ae(ne),()=>{ae(void 0)}),[ne,ae]);let[M,oe]=hb(ne),se=Yp(g);cp(()=>{re&&se?.()},[re,se]);let ce=ie.arrow?.x,le=ie.arrow?.y,ue=ie.arrow?.centerOffset!==0,[de,fe]=m.useState();return cp(()=>{y&&fe(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(ub,{scope:n,placedSide:M,placedAlign:oe,onArrowChange:C,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,h.jsx)(Gp.div,{"data-side":M,"data-align":oe,..._,ref:x,style:{..._.style,animation:re?_.style?.animation:`none`}})})})},`PopperContent`));function pb(e){return e!==null}eb(pb,`isNotNull`);var mb=eb(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=hb(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function hb(e){let[t,n=`center`]=e.split(`-`);return[t,n]}eb(hb,`getSideAndAlignFromPlacement`);var gb=ob,_b=cb,vb=fb,yb=Object.defineProperty,bb=(e,t)=>yb(e,`name`,{value:t,configurable:!0}),xb=!1;function Sb(){let[e,t]=m.useState(xb);return m.useEffect(()=>{xb||(xb=!0,t(!0))},[]),e}bb(Sb,`useIsHydrated`);var Cb=m.useSyncExternalStore;function wb(){return()=>{}}bb(wb,`subscribe`);function Tb(){return Cb(wb,()=>!0,()=>!1)}bb(Tb,`useIsHydratedModern`);var Eb=typeof Cb==`function`?Tb:Sb,Db=Object.defineProperty,Ob=(e,t)=>Db(e,`name`,{value:t,configurable:!0}),kb=`rovingFocusGroup.onEntryFocus`,Ab={bubbles:!1,cancelable:!0},jb=`RovingFocusGroup`,[Mb,Nb,Pb]=w_(jb),[Fb,Ib]=op(jb,[Pb]),[Lb,Rb]=Fb(jb),zb=m.forwardRef(Ob(function(e,t){return(0,h.jsx)(Mb.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Mb.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Bb,{...e,ref:t})})})},`RovingFocusGroup`)),Bb=m.forwardRef(Ob(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=rp(t,f),g=R_(a),[_,v]=Sp({prop:o,defaultProp:s??null,onChange:c,caller:jb}),[y,b]=m.useState(!1),x=Yp(l),S=Nb(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(kb,x),()=>e.removeEventListener(kb,x)},[x]),(0,h.jsx)(Lb,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(Gp.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{C.current=!0}),onFocus:J(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(kb,Ab);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Kb([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:J(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Vb=`RovingFocusGroupItem`,Hb=m.forwardRef(Ob(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=pp(),l=a||c,u=Rb(Vb,n),d=u.currentTabStopId===l,f=Nb(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=Eb();return cp(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(Mb.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Gp.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Gb(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?qb(n,r+1):n.slice(r+1)}setTimeout(()=>Kb(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Ub={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Wb(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Ob(Wb,`getDirectionAwareKey`);function Gb(e,t,n){let r=Wb(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ub[r]}Ob(Gb,`getFocusIntent`);function Kb(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Ob(Kb,`focusFirst`);function qb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ob(qb,`wrapArray`);var Jb=zb,Yb=Hb,Xb=Object.defineProperty,Zb=(e,t)=>Xb(e,`name`,{value:t,configurable:!0}),Qb=[`Enter`,` `],$b=[`ArrowDown`,`PageUp`,`Home`],ex=[`ArrowUp`,`PageDown`,`End`],tx=[...$b,...ex];[...Qb],[...Qb];var nx=`Menu`,[rx,ix,ax]=w_(nx),[ox,sx]=op(nx,[ax,rb,Ib]),cx=rb(),lx=Ib(),[ux,dx]=ox(nx),[fx,px]=ox(nx),mx=Zb(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=cx(t),[c,l]=m.useState(null),u=m.useRef(!1),d=Yp(a),f=R_(i);return m.useEffect(()=>{let e=Zb(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Zb(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=Zb(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(gb,{...s,children:(0,h.jsx)(ux,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(fx,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),hx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e,i=cx(n);return(0,h.jsx)(_b,{...i,...r,ref:t})},`MenuAnchor`)),gx=`MenuPortal`,[_x,vx]=ox(gx,{forceMount:void 0}),yx=Zb(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=dx(gx,t);return(0,h.jsx)(_x,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`MenuPortal`),bx=`MenuContent`,[xx,Sx]=ox(bx),Cx=m.forwardRef(Zb(function(e,t){let n=vx(bx,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=dx(bx,e.__scopeMenu),o=px(bx,e.__scopeMenu);return(0,h.jsx)(rx.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(Mm,{present:r||a.open,children:(0,h.jsx)(rx.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(wx,{...i,ref:t}):(0,h.jsx)(Tx,{...i,ref:t})})})})},`MenuContent`)),wx=m.forwardRef(Zb(function(e,t){let n=dx(bx,e.__scopeMenu),r=m.useRef(null),i=rp(t,r);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Dx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Tx=m.forwardRef(Zb(function(e,t){let n=dx(bx,e.__scopeMenu);return(0,h.jsx)(Dx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ex=Ap(`MenuContent.ScrollLock`),Dx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=dx(bx,n),y=px(bx,n),b=cx(n),x=lx(n),S=ix(n),[C,w]=m.useState(null),T=m.useRef(null),E=rp(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),ee=m.useRef(0),te=g?Qh:m.Fragment,ne=g?{as:Ex,allowPinchZoom:!0}:void 0,re=Zb(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Gx(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Zb((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),Um();let ie=m.useCallback(e=>j.current===A.current?.side&&qx(e,A.current?.area),[]);return(0,h.jsx)(xx,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),onItemLeave:m.useCallback(e=>{ie(e)||(T.current?.focus(),w(null))},[ie]),onTriggerLeave:m.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(te,{...ne,children:(0,h.jsx)(hm,{asChild:!0,trapped:i,onMountAutoFocus:J(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(Jb,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:J(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(vb,{role:`menu`,"aria-orientation":`vertical`,"data-state":Bx(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&re(e.key));let i=T.current;if(e.target!==i||!tx.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);ex.includes(e.key)&&a.reverse(),Ux(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:J(e.onPointerMove,Jx(e=>{let t=e.target,n=ee.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ee.current?`right`:`left`;j.current=t,ee.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),Ox=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gp.div,{...r,ref:t})},`MenuLabel`)),kx=`MenuItem`,Ax=`menu.itemSelect`,jx=m.forwardRef(Zb(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=px(kx,e.__scopeMenu),s=Sx(kx,e.__scopeMenu),c=rp(t,a),l=m.useRef(!1),u=Zb(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ax,{bubbles:!0,cancelable:!0});e.addEventListener(Ax,e=>r?.(e),{once:!0}),Kp(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(Mx,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Qb.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Mx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Sx(kx,n),s=lx(n),c=m.useRef(null),l=rp(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(rx.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(Yb,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Gp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,Jx(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,Jx(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Nx,Px]=ox(`MenuRadioGroup`,{value:void 0,onValueChange:Zb(()=>{},`onValueChange`)}),[Fx,Ix]=ox(`MenuItemIndicator`,{checked:!1}),Lx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Rx,zx]=ox(`MenuSub`);function Bx(e){return e?`open`:`closed`}Zb(Bx,`getOpenState`);function Vx(e){return e===`indeterminate`}Zb(Vx,`isIndeterminate`);function Hx(e){return Vx(e)?`indeterminate`:e?`checked`:`unchecked`}Zb(Hx,`getCheckedState`);function Ux(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Zb(Ux,`focusFirst`);function Wx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Zb(Wx,`wrapArray`);function Gx(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Wx(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Zb(Gx,`getNextMatch`);function Kx(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Zb(Kx,`isPointInPolygon`);function qx(e,t){return t?Kx({x:e.clientX,y:e.clientY},t):!1}Zb(qx,`isPointerInGraceArea`);function Jx(e){return t=>t.pointerType===`mouse`?e(t):void 0}Zb(Jx,`whenMouse`);var Yx=mx,Xx=hx,Zx=yx,Qx=Cx,$x=Ox,eS=jx,tS=Lx,nS=Object.defineProperty,rS=(e,t)=>nS(e,`name`,{value:t,configurable:!0}),iS=`DropdownMenu`,[aS,oS]=op(iS,[sx]),sS=sx(),[cS,lS]=aS(iS),uS=rS(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=sS(t),l=m.useRef(null),[u,d]=Sp({prop:i,defaultProp:a??!1,onChange:o,caller:iS});return(0,h.jsx)(cS,{scope:t,triggerId:pp(),triggerRef:l,contentId:pp(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(Yx,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),dS=`DropdownMenuTrigger`,fS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=lS(dS,n),o=sS(n),s=rp(t,a.triggerRef);return(0,h.jsx)(Xx,{asChild:!0,...o,children:(0,h.jsx)(Gp.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),pS=rS(e=>{let{__scopeDropdownMenu:t,...n}=e,r=sS(t);return(0,h.jsx)(Zx,{...r,...n})},`DropdownMenuPortal`),mS=`DropdownMenuContent`,hS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=lS(mS,n),a=sS(n),o=m.useRef(!1);return(0,h.jsx)(Qx,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),gS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)($x,{...i,...r,ref:t})},`DropdownMenuLabel`)),_S=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)(eS,{...i,...r,ref:t})},`DropdownMenuItem`)),vS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)(tS,{...i,...r,ref:t})},`DropdownMenuSeparator`)),yS=uS,bS=fS,xS=pS,SS=hS,CS=gS,wS=_S,TS=vS,ES=`z-50 overflow-hidden rounded-[8px] border border-rule bg-surface py-1 shadow-pop outline-none data-[state=open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function DS({trigger:e,children:t,width:n=220,align:r=`start`,side:i=`bottom`,sideOffset:a=6,open:o,onOpenChange:s}){return(0,h.jsxs)(yS,{open:o,onOpenChange:s,modal:!1,children:[(0,h.jsx)(bS,{asChild:!0,children:e}),(0,h.jsx)(xS,{children:(0,h.jsx)(SS,{align:r,side:i,sideOffset:a,collisionPadding:12,className:ES,style:{width:n},children:t})})]})}var OS=(e,t)=>X(`flex min-h-9 w-full cursor-pointer items-center gap-2.5 border-0 px-3 py-1.5 text-left text-[13.5px] outline-none select-none`,`data-[highlighted]:bg-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,t?`bg-soft`:`bg-transparent`,e?`text-danger-text`:`text-ink`);function kS({children:e,onSelect:t,danger:n,active:r,disabled:i,hint:a}){return(0,h.jsxs)(wS,{disabled:i,onSelect:t,className:OS(n,r),children:[e,a?(0,h.jsx)(`span`,{className:`ml-auto pl-3 text-[12px] text-muted`,children:a}):null]})}function AS(){return(0,h.jsx)(TS,{className:`my-1 h-px bg-rule`})}function jS({children:e}){return(0,h.jsx)(CS,{className:`px-3 pt-1.5 pb-1 text-[12px] text-muted`,children:e})}var MS=[{value:`system`,label:`System`,icon:`monitor`},{value:`light`,label:`Light`,icon:`sun`},{value:`dark`,label:`Dark`,icon:`moon`}];function NS(){let e=n_(),t=r_();return(0,h.jsxs)(DS,{align:`end`,width:180,trigger:(0,h.jsx)(y_,{icon:t===`dark`?`moon`:`sun`,label:`Appearance`}),children:[(0,h.jsx)(jS,{children:`Appearance`}),MS.map(t=>(0,h.jsxs)(kS,{active:e===t.value,onSelect:()=>t_(t.value),children:[(0,h.jsx)(Z,{name:t.icon,size:15,className:`text-ink2`}),t.label,e===t.value?(0,h.jsx)(Z,{name:`check`,size:15,className:`ml-auto text-ink2`}):null]},t.value))]})}function PS({size:e=24}){return(0,h.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,h.jsx)(`rect`,{width:`32`,height:`32`,rx:`7`,className:`fill-primary`}),(0,h.jsx)(`rect`,{x:`7`,y:`7`,width:`8`,height:`11`,rx:`1.5`,className:`fill-primary-ink`}),(0,h.jsx)(`rect`,{x:`17`,y:`7`,width:`8`,height:`6`,rx:`1.5`,fill:`#f0a040`}),(0,h.jsx)(`rect`,{x:`17`,y:`15`,width:`8`,height:`10`,rx:`1.5`,className:`fill-primary-ink`}),(0,h.jsx)(`rect`,{x:`7`,y:`20`,width:`8`,height:`5`,rx:`1.5`,className:`fill-primary-ink`})]})}function FS({name:e}){return(0,h.jsxs)(Lf,{href:`/`,className:`flex min-w-0 items-center gap-2 text-[14px] font-semibold text-ink no-underline`,children:[(0,h.jsx)(PS,{}),(0,h.jsx)(`span`,{className:`truncate`,children:e??`Design`})]})}function IS({children:e,className:t}){return(0,h.jsx)(`header`,{className:X(`sticky top-0 z-30 flex h-[52px] shrink-0 items-center gap-3 border-b border-rule bg-surface px-4`,t),children:e})}var LS=[{to:`/`,label:`Canvases`,match:e=>e===`/`||e.startsWith(`/c/`)},{to:`/system`,label:`Design system`,match:e=>e.startsWith(`/system`)}];function RS(){let e=zg().data,[t]=jf();return(0,h.jsxs)(IS,{children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-6`,children:[(0,h.jsx)(FS,{name:e?.name}),(0,h.jsx)(`nav`,{className:`flex h-[52px] items-stretch gap-0.5 max-md:hidden`,children:LS.map(e=>{let n=e.match(t);return(0,h.jsxs)(Lf,{href:e.to,className:X(`relative flex items-center px-2.5 text-[14px] no-underline transition-colors`,n?`font-medium text-ink`:`text-ink2 hover:text-ink`),children:[e.label,n?(0,h.jsx)($d.span,{layoutId:`app-tab`,className:`absolute inset-x-2.5 bottom-0 h-[2px] bg-ink`,transition:{type:`spring`,stiffness:520,damping:42}}):null]},e.to)})})]}),(0,h.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,h.jsx)(p_,{}),(0,h.jsx)(NS,{})]})]})}var zS=Object.defineProperty,BS=(e,t)=>zS(e,`name`,{value:t,configurable:!0}),VS=`Popover`,[HS,US]=op(VS,[rb]),WS=rb(),[GS,KS]=HS(VS),qS=BS(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=WS(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Sp({prop:r,defaultProp:i??!1,onChange:a,caller:VS});return(0,h.jsx)(gb,{...s,children:(0,h.jsx)(GS,{scope:t,contentId:pp(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),JS=`PopoverTrigger`,YS=m.forwardRef(BS(function(e,t){let{__scopePopover:n,...r}=e,i=KS(JS,n),a=WS(n),o=rp(t,i.triggerRef),s=(0,h.jsx)(Gp.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":oC(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(_b,{asChild:!0,...a,children:s})},`PopoverTrigger`)),XS=`PopoverPortal`,[ZS,QS]=HS(XS,{forceMount:void 0}),$S=BS(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=KS(XS,t);return(0,h.jsx)(ZS,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),eC=`PopoverContent`,tC=m.forwardRef(BS(function(e,t){let n=QS(eC,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=KS(eC,e.__scopePopover);return(0,h.jsx)(Mm,{present:r||a.open,children:a.modal?(0,h.jsx)(rC,{...i,ref:t}):(0,h.jsx)(iC,{...i,ref:t})})},`PopoverContent`)),nC=Ap(`PopoverContent.RemoveScroll`),rC=m.forwardRef(BS(function(e,t){let n=KS(eC,e.__scopePopover),r=m.useRef(null),i=rp(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Qh,{as:nC,allowPinchZoom:!0,children:(0,h.jsx)(aC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),iC=m.forwardRef(BS(function(e,t){let n=KS(eC,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(aC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),aC=m.forwardRef(BS(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=KS(eC,n),p=WS(n);return Um(),(0,h.jsx)(hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(vb,{"data-state":oC(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function oC(e){return e?`open`:`closed`}BS(oC,`getState`);var sC=qS,cC=YS,lC=$S,uC=tC,dC=new qg([]),fC=1;function pC(e,t){let n=fC++;dC.set(r=>[...r.slice(-2),{id:n,title:e,text:t}]),setTimeout(()=>dC.set(e=>e.filter(e=>e.id!==n)),2200)}function mC(){let e=Jg(dC);return(0,h.jsx)(`div`,{className:`pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col items-center gap-2`,children:(0,h.jsx)(V,{children:e.map(e=>(0,h.jsxs)($d.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,transition:{duration:.12}},transition:{type:`spring`,stiffness:520,damping:40},className:`flex max-w-[420px] items-center gap-2.5 rounded-[8px] border border-rule bg-surface px-3 py-2 text-[13px] text-ink shadow-pop`,children:[(0,h.jsx)(Z,{name:`check`,size:15,className:`text-ok-text`}),(0,h.jsx)(`span`,{className:`font-medium`,children:e.title}),e.text?(0,h.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.text}):null]},e.id))})})}async function hC(e,t=`Copied`){try{await navigator.clipboard.writeText(e),pC(t,e.length>64?void 0:e)}catch{pC(`Could not copy`,`The browser blocked clipboard access`)}}var gC=`design-inspect`;function _C(e){return!!e&&e.tagName.toLowerCase()===gC}function vC(e){return Number.parseFloat(e)||0}function yC(e){return Math.round(e*100)/100}function bC(e){let t=e.tagName.toLowerCase();if(e.id)return`${t}#${e.id}`;let n=xC(e).slice(0,2);return n.length?`${t}.${n.join(`.`)}`:t}function xC(e){let t=e.getAttribute(`class`);return t?t.split(/\s+/).filter(Boolean):[]}function SC(e){let t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/.exec(e);if(!t)return e;let[n,r,i]=[t[1],t[2],t[3]].map(e=>Number(e).toString(16).padStart(2,`0`)),a=t[4]===void 0?1:Number(t[4]);return a===0?`transparent`:a<1?`#${n}${r}${i} · ${Math.round(a*100)}%`:`#${n}${r}${i}`}function CC(e){return e===`transparent`||/^rgba\(\d+,\s*\d+,\s*\d+,\s*0\)$/.test(e)}var wC=class{maps=new Map;constructor(e,t){let n=e.documentElement.dataset.theme===`dark`,r=e.createElement(`span`);r.style.display=`none`,(e.body??e.documentElement).appendChild(r);let i=e.defaultView,a=(e,t,n,a)=>{r.style.setProperty(t,n);let o=i.getComputedStyle(r).getPropertyValue(t);if(r.style.removeProperty(t),!o)return;let s=this.maps.get(e)??new Map;s.set(o,[...s.get(o)??[],{name:a.name,utility:a.utility}]),this.maps.set(e,s)};for(let e of t){let t=(n?e.dark??e.light:e.light)?.value;t&&!t.includes(`var(`)&&(e.kind===`color`?a(`color`,`color`,t,e):e.kind===`radius`?a(`radius`,`border-top-left-radius`,t,e):e.kind===`shadow`?a(`shadow`,`box-shadow`,t,e):e.kind===`font`?a(`font`,`font-family`,t,e):e.kind===`text`&&a(`text`,`font-size`,t,e))}r.remove()}find(e,t,n=[]){let r=this.maps.get(e)?.get(t);if(r?.length)return(r.find(e=>e.utility&&n.some(t=>t.split(`:`).at(-1).endsWith(`-${e.utility}`)))??r[0]).name}},TC=new Set([`Boundary`,`MotionComponent`,`MotionDOMComponent`,`PresenceChild`,`PopChild`,`PopChildMeasure`,`AnimatePresence`,`LayoutGroup`]);function EC(e){let t=Object.keys(e).find(e=>e.startsWith(`__reactFiber$`));return t?e[t]??null:null}function DC(e){let t=e.type;if(!t||typeof t==`string`)return null;let n=t;return typeof t==`function`?n.displayName||n.name||null:n.displayName?n.displayName:n.render?n.render.name||null:n.type&&typeof n.type==`function`&&n.type.name||null}function OC(e){let t=EC(e);if(!t)return;let n=[],r=t._debugOwner??null;for(;r&&n.length<5;){let e=DC(r);e&&!TC.has(e)&&n.at(-1)!==e&&n.push(e),r=r._debugOwner??null}if(!n.length)for(let e=t.return;e&&n.length<5;e=e.return){let t=DC(e);t&&!TC.has(t)&&n.at(-1)!==t&&n.push(t)}let i,a=t._debugStack?.stack??``;for(let e of a.split(`
58
- `)){let t=/\/_fs\/([^?:)\s]+\.(?:tsx|jsx|ts|js|mjs|html))/.exec(e);if(t&&!/node_modules|(^|\/)\.cache\/|@fs\//.test(t[1])){i=`.design/${decodeURIComponent(t[1])}`;break}}return n.length||i?{owners:n,file:i}:void 0}function kC(e){for(let t of Array.from(e.childNodes))if(t.nodeType===3&&t.textContent?.trim())return!0;return!1}var AC=[[`display`,`Display`],[`position`,`Position`],[`flex-direction`,`Direction`],[`flex-wrap`,`Wrap`],[`justify-content`,`Justify`],[`align-items`,`Align`],[`gap`,`Gap`],[`grid-template-columns`,`Columns`],[`grid-template-rows`,`Rows`],[`overflow`,`Overflow`],[`z-index`,`Z-index`]];function jC(e,t){let n=e.ownerDocument.defaultView,r=n.getComputedStyle(e),i=e.getBoundingClientRect(),a=(e,t=``)=>[yC(vC(r.getPropertyValue(`${e}-top${t}`))),yC(vC(r.getPropertyValue(`${e}-right${t}`))),yC(vC(r.getPropertyValue(`${e}-bottom${t}`))),yC(vC(r.getPropertyValue(`${e}-left${t}`)))],o=xC(e),s=e=>({value:SC(e),css:e,token:t?.find(`color`,e,o)}),c=r.display,l=c.includes(`flex`),u=c.includes(`grid`),d=[];for(let[e,t]of AC){let n=r.getPropertyValue(e);n&&(![`flex-direction`,`flex-wrap`].includes(e)||l)&&(![`justify-content`,`align-items`,`gap`].includes(e)||l||u)&&(!e.startsWith(`grid-template`)||u&&n!==`none`)&&(e!==`position`||n!==`static`)&&(e!==`flex-wrap`||n!==`nowrap`)&&(e!==`overflow`||n!==`visible`)&&(e!==`z-index`||n!==`auto`)&&(e!==`justify-content`||n!==`normal`)&&(e!==`align-items`||n!==`normal`)&&(e!==`gap`||n!==`normal`)&&d.push([t,n])}let f=kC(e)||[`INPUT`,`TEXTAREA`,`BUTTON`,`SELECT`].includes(e.tagName),p=vC(r.borderTopWidth),m=r.borderTopLeftRadius,h=r.boxShadow,g=[];for(let t=e.parentElement;t&&t!==e.ownerDocument.documentElement&&t.id!==`root`&&t!==e.ownerDocument.body;t=t.parentElement)g.unshift({el:t,label:bC(t)});return{el:e,tag:e.tagName.toLowerCase(),label:bC(e),text:kC(e)?(e.textContent??``).trim().replace(/\s+/g,` `).slice(0,120):void 0,classes:xC(e),attributes:[`href`,`src`,`alt`,`type`,`role`,`aria-label`,`placeholder`,`name`,`for`].map(t=>[t,e.getAttribute(t)]).filter(e=>e[1]!==null&&e[1]!==``),component:OC(e),rect:{x:yC(i.left+n.scrollX),y:yC(i.top+n.scrollY),w:yC(i.width),h:yC(i.height)},margin:a(`margin`),border:a(`border`,`-width`),padding:a(`padding`),layout:d,typography:f?{family:r.fontFamily,familyToken:t?.find(`font`,r.fontFamily,o),size:r.fontSize,sizeToken:t?.find(`text`,r.fontSize,o),weight:r.fontWeight,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,color:s(r.color),align:r.textAlign,transform:r.textTransform===`none`?void 0:r.textTransform}:void 0,appearance:{background:CC(r.backgroundColor)?void 0:s(r.backgroundColor),backgroundImage:r.backgroundImage===`none`?void 0:r.backgroundImage,border:p>0&&r.borderTopStyle!==`none`?{width:r.borderTopWidth,style:r.borderTopStyle,color:s(r.borderTopColor)}:void 0,radius:vC(m)>0?{value:m,token:t?.find(`radius`,m,o)}:void 0,shadow:h===`none`?void 0:{value:h,token:t?.find(`shadow`,h,o)},opacity:r.opacity===`1`?void 0:r.opacity},path:g,children:Array.from(e.children).filter(e=>!_C(e)&&![`SCRIPT`,`STYLE`].includes(e.tagName)).slice(0,40).map(e=>({el:e,label:bC(e)}))}}function MC(e){let t=e.el.ownerDocument.defaultView.getComputedStyle(e.el),n=[`display`,`flex-direction`,`justify-content`,`align-items`,`gap`,`grid-template-columns`,`width`,`height`,`padding`,`margin`,`font-family`,`font-size`,`font-weight`,`line-height`,`letter-spacing`,`color`,`background-color`,`border`,`border-radius`,`box-shadow`,`opacity`].map(e=>[e,t.getPropertyValue(e)]).filter(([e,t])=>t&&![`normal`,`none`,`0px`,`auto`].includes(t)&&(e!==`opacity`||t!==`1`)).map(([e,t])=>` ${e}: ${t};`);return`${e.label} {\n${n.join(`
59
- `)}\n}`}var NC=`
60
- :host { all: initial; }
61
- .m, .p, .c, .sel, .tag, .stag { position: fixed; pointer-events: none; box-sizing: border-box; display: none; }
62
- .m { border-style: solid; border-color: rgba(246, 178, 107, 0.45); }
63
- .p { border-style: solid; border-color: rgba(147, 196, 125, 0.5); }
64
- .c { background: rgba(111, 168, 220, 0.4); }
65
- .sel { outline: 2px solid #f0a040; outline-offset: -1px; }
66
- .tag, .stag { font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #fff; background: #1b1f24;
67
- padding: 4px 6px; border-radius: 4px; white-space: nowrap; }
68
- .stag { background: #a55700; }
69
- `,PC=class{doc;host;parts;constructor(e){this.doc=e,this.host=e.createElement(gC),this.host.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483647;display:block`;let t=this.host.attachShadow({mode:`open`});t.innerHTML=`<style>${NC}</style><div class="m"></div><div class="p"></div><div class="c"></div><div class="sel"></div><div class="tag"></div><div class="stag"></div>`;let n=e=>t.querySelector(`.${e}`);this.parts={m:n(`m`),p:n(`p`),c:n(`c`),sel:n(`sel`),tag:n(`tag`),stag:n(`stag`)},e.documentElement.appendChild(this.host)}place(e,t,n,r,i){e.style.display=`block`,e.style.left=`${t}px`,e.style.top=`${n}px`,e.style.width=`${Math.max(0,r)}px`,e.style.height=`${Math.max(0,i)}px`}hide(...e){for(let t of e)this.parts[t].style.display=`none`}label(e,t,n){e.textContent=t,e.style.display=`block`;let r=n.top>24;e.style.left=`${Math.max(2,n.left)}px`,e.style.top=`${r?n.top-22:n.bottom+4}px`}hover(e){if(!e)return this.hide(`m`,`p`,`c`,`tag`);let t=this.doc.defaultView.getComputedStyle(e),n=e.getBoundingClientRect(),[r,i,a,o]=[`Top`,`Right`,`Bottom`,`Left`].map(e=>vC(t.getPropertyValue(`margin-${e.toLowerCase()}`))),[s,c,l,u]=[`top`,`right`,`bottom`,`left`].map(e=>vC(t.getPropertyValue(`border-${e}-width`))),[d,f,p,m]=[`top`,`right`,`bottom`,`left`].map(e=>vC(t.getPropertyValue(`padding-${e}`)));this.place(this.parts.m,n.left-o,n.top-r,n.width+o+i,n.height+r+a),this.parts.m.style.borderWidth=`${r}px ${i}px ${a}px ${o}px`,this.place(this.parts.p,n.left+u,n.top+s,n.width-u-c,n.height-s-l),this.parts.p.style.borderWidth=`${d}px ${f}px ${p}px ${m}px`,this.place(this.parts.c,n.left+u+m,n.top+s+d,n.width-u-c-m-f,n.height-s-l-d-p),this.label(this.parts.tag,`${bC(e)} ${yC(n.width)} × ${yC(n.height)}`,n)}select(e){if(!e)return this.hide(`sel`,`stag`);let t=e.getBoundingClientRect();this.place(this.parts.sel,t.left,t.top,t.width,t.height),this.label(this.parts.stag,`${yC(t.width)} × ${yC(t.height)}`,t)}destroy(){this.host.remove()}};function FC(e,t){let n=null;try{n=e.contentDocument}catch{return null}if(!n?.documentElement)return null;let r=new PC(n),i=null,a=null,o=0,s=e=>{let t=e;return t?.nodeType!==1||_C(t)||t===n.documentElement||t===n.body?null:t},c=()=>{a&&!a.isConnected&&(a=null,t.onSelect(null)),r.hover(i&&i!==a?i:null),r.select(a),o=e.contentWindow.requestAnimationFrame(c)};o=e.contentWindow.requestAnimationFrame(c);let l=(e,n=!0)=>{a=e,n&&t.onSelect(e)},u=e=>{i=s(e.target)},d=e=>{e.relatedTarget||(i=null)},f=e=>{e.preventDefault(),e.stopImmediatePropagation()},p=e=>{f(e),l(s(e.target))},m=e=>{f(e),e.ctrlKey&&l(s(e.target))},h=e=>{e.key===`Escape`&&(e.stopImmediatePropagation(),a?l(null):t.onEscape())},g={capture:!0};n.addEventListener(`pointermove`,u,g),n.addEventListener(`mouseout`,d,g);for(let e of[`pointerdown`,`mousedown`,`pointerup`,`mouseup`,`dblclick`,`submit`])n.addEventListener(e,f,g);return n.addEventListener(`click`,p,g),n.addEventListener(`contextmenu`,m,g),n.addEventListener(`keydown`,h,g),n.documentElement.style.setProperty(`cursor`,`crosshair`,`important`),{select:l,detach(){e.contentWindow?.cancelAnimationFrame(o),n.removeEventListener(`pointermove`,u,g),n.removeEventListener(`mouseout`,d,g);for(let e of[`pointerdown`,`mousedown`,`pointerup`,`mouseup`,`dblclick`,`submit`])n.removeEventListener(e,f,g);n.removeEventListener(`click`,p,g),n.removeEventListener(`contextmenu`,m,g),n.removeEventListener(`keydown`,h,g),n.documentElement.style.removeProperty(`cursor`),r.destroy()}}}function IC(e,t,n){let r=zg().data,i=Vg(!!r?.system).data?.tokens,[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(0),l=(0,m.useRef)(new Map),u=(0,m.useRef)(null);u.current=a;let d=(0,m.useRef)(n.onEscape);d.current=n.onEscape,(0,m.useEffect)(()=>{if(!t)return;let n=l.current,r=[];for(let t of e){let e=()=>{n.get(t)?.detach();let e=FC(t,{onSelect:e=>{for(let[e,r]of n)e!==t&&r.select(null,!1);o(e?{el:e,frame:t}:null)},onEscape:()=>d.current()});if(!e){n.delete(t);return}n.set(t,e);let r=u.current;r?.frame===t&&r.el.isConnected&&e.select(r.el,!1)};e(),t.addEventListener(`load`,e),r.push(()=>{t.removeEventListener(`load`,e),n.get(t)?.detach(),n.delete(t)})}return()=>{for(let e of r)e()}},[e,t]),(0,m.useEffect)(()=>{if(!a)return;let e=setInterval(()=>c(e=>e+1),700);return()=>clearInterval(e)},[a]);let f=(0,m.useMemo)(()=>{if(!a?.el.isConnected)return null;let e=a.el.ownerDocument,t=i?.length?new wC(e,i):null;return jC(a.el,t)},[a,i,s]);return{info:f,frame:f?a?.frame??null:null,select(e){let t=u.current?.frame;if(!e||!t){for(let e of l.current.values())e.select(null,!1);o(null);return}l.current.get(t)?.select(e,!1),o({el:e,frame:t})}}}function LC(e){let[t,n]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let t=e=>e===`Meta`||e===`Control`,r=!1,i=!1,a,o=()=>{r=!1,clearTimeout(a),n(!1)},s=e=>{if(t(e.key)){if(r)return;r=!0,i=!1,a=setTimeout(()=>{r&&!i&&n(!0)},150)}else r&&(i=!0,clearTimeout(a),n(!1))},c=e=>{t(e.key)&&o()},l=e=>{e.addEventListener(`keydown`,s,!0),e.addEventListener(`keyup`,c,!0),e.addEventListener(`blur`,o)},u=e=>{e.removeEventListener(`keydown`,s,!0),e.removeEventListener(`keyup`,c,!0),e.removeEventListener(`blur`,o)};l(window);let d=e.map(e=>{let t=null,n=()=>{t&&u(t);try{t=e.contentWindow,t&&l(t)}catch{t=null}};return n(),e.addEventListener(`load`,n),()=>{e.removeEventListener(`load`,n),t&&u(t)}});return()=>{u(window);for(let e of d)e();clearTimeout(a)}},[e]),t}function RC({title:e,children:t,right:n}){return(0,h.jsxs)(`section`,{className:`border-t border-rule pb-2 first:border-t-0`,children:[(0,h.jsxs)(`div`,{className:`flex h-9 items-center justify-between px-4 text-[12px] font-medium text-muted`,children:[e,n]}),t]})}function zC({label:e,children:t}){return(0,h.jsxs)(`div`,{className:`grid min-h-7 grid-cols-[92px_minmax(0,1fr)] items-center gap-x-3 px-4 py-0.5 text-[12.5px]`,children:[(0,h.jsx)(`span`,{className:`text-muted`,children:e}),(0,h.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-ink`,children:t})]})}function BC({name:e}){return e?(0,h.jsx)(`button`,{type:`button`,onClick:()=>void hC(`var(${e})`,`Token copied`),title:`Copy var()`,className:`shrink-0 cursor-pointer truncate rounded-[4px] border-0 bg-action-soft px-1.5 py-px font-mono text-[11px] text-action`,children:e}):null}function VC({children:e,title:t}){return(0,h.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[12px]`,title:t,children:e})}function HC({label:e,color:t}){return(0,h.jsxs)(zC,{label:e,children:[(0,h.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:t.css}}),(0,h.jsx)(VC,{title:t.css,children:t.value}),(0,h.jsx)(BC,{name:t.token})]})}var UC=e=>e?String(e):`–`;function WC({label:e,values:t,className:n,children:r}){let[i,a,o,s]=t;return(0,h.jsxs)(`div`,{className:X(`relative grid grid-cols-[28px_minmax(0,1fr)_28px] grid-rows-[20px_auto_20px] rounded-[4px]`,n),children:[(0,h.jsx)(`span`,{className:`absolute top-1 left-1.5 text-[9.5px] tracking-wide text-muted uppercase`,children:e}),(0,h.jsx)(`span`,{className:`col-start-2 self-center text-center`,children:UC(i)}),(0,h.jsx)(`span`,{className:`row-start-2 self-center text-center`,children:UC(s)}),(0,h.jsx)(`div`,{className:`row-start-2 col-start-2`,children:r}),(0,h.jsx)(`span`,{className:`row-start-2 col-start-3 self-center text-center`,children:UC(a)}),(0,h.jsx)(`span`,{className:`row-start-3 col-start-2 self-center text-center`,children:UC(o)})]})}function GC({info:e}){let t={w:Math.max(0,e.rect.w-e.border[1]-e.border[3]-e.padding[1]-e.padding[3]),h:Math.max(0,e.rect.h-e.border[0]-e.border[2]-e.padding[0]-e.padding[2])};return(0,h.jsx)(`div`,{className:`px-4 pt-1 pb-2 font-mono text-[11px] text-ink2`,children:(0,h.jsx)(WC,{label:`margin`,values:e.margin,className:`border border-dashed border-rule-strong bg-[#f6b26b]/15`,children:(0,h.jsx)(WC,{label:`border`,values:e.border,className:`border border-rule-strong bg-[#f9e27d]/15`,children:(0,h.jsx)(WC,{label:`padding`,values:e.padding,className:`border border-rule-strong bg-[#93c47d]/20`,children:(0,h.jsxs)(`div`,{className:`flex h-8 items-center justify-center rounded-[3px] border border-rule-strong bg-[#6fa8dc]/25 text-ink`,children:[Math.round(t.w*100)/100,` × `,Math.round(t.h*100)/100]})})})})})}function KC({info:e,onSelect:t}){return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-4 pb-2`,children:[e.path.slice(-4).map((e,n)=>(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>t(e.el),className:`cursor-pointer rounded-[4px] border-0 bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2 hover:text-ink`,children:e.label}),(0,h.jsx)(Z,{name:`chevron-right`,size:11,className:`text-muted`})]},n)),(0,h.jsx)(`span`,{className:`rounded-[4px] bg-action-soft px-1.5 py-0.5 font-mono text-[11px] text-action`,children:e.label})]})}function qC({info:e,onSelect:t,onClose:n,active:r}){return(0,h.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[320px] shrink-0 flex-col overflow-hidden border-l border-rule bg-surface`,children:[(0,h.jsxs)(`div`,{className:`flex h-[46px] shrink-0 items-center justify-between border-b border-rule pr-2 pl-4`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-semibold`,children:[(0,h.jsx)(Z,{name:`pointer`,size:15,className:`text-action`}),` Inspect`]}),(0,h.jsx)(y_,{icon:`x`,label:`Close inspector (I)`,onClick:n})]}),e?(0,h.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto`,children:[(0,h.jsxs)(RC,{title:`Element`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2`,children:[(0,h.jsx)(`div`,{className:`flex min-w-0 items-baseline gap-1.5`,children:e.component?.owners[0]?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:[`<`,e.component.owners[0],`>`]}),(0,h.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.tag})]}):(0,h.jsx)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:e.label})}),e.component&&e.component.owners.length>1?(0,h.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[`in `,e.component.owners.slice(1).join(` ← `)]}):null,e.component?.file?(0,h.jsx)(`button`,{type:`button`,onClick:()=>void hC(e.component.file,`Path copied`),className:`w-fit max-w-full cursor-pointer truncate border-0 bg-transparent p-0 text-left font-mono text-[11.5px] text-muted hover:text-ink2`,title:`Copy path`,children:e.component.file}):null,e.text?(0,h.jsxs)(`span`,{className:`line-clamp-2 text-[12.5px] text-ink2`,children:[`“`,e.text,`”`]}):null]}),(0,h.jsx)(KC,{info:e,onSelect:t})]}),(0,h.jsxs)(RC,{title:`Box`,children:[(0,h.jsx)(GC,{info:e}),(0,h.jsx)(zC,{label:`Size`,children:(0,h.jsxs)(VC,{children:[e.rect.w,` × `,e.rect.h]})}),(0,h.jsx)(zC,{label:`Position`,children:(0,h.jsxs)(VC,{children:[`x `,e.rect.x,` · y `,e.rect.y]})})]}),e.layout.length?(0,h.jsx)(RC,{title:`Layout`,children:e.layout.map(([e,t])=>(0,h.jsx)(zC,{label:e,children:(0,h.jsx)(VC,{title:t,children:t})},e))}):null,e.typography?(0,h.jsxs)(RC,{title:`Typography`,children:[(0,h.jsxs)(zC,{label:`Font`,children:[(0,h.jsx)(VC,{title:e.typography.family,children:e.typography.family.split(`,`)[0]?.replace(/["']/g,``)}),(0,h.jsx)(BC,{name:e.typography.familyToken})]}),(0,h.jsxs)(zC,{label:`Size`,children:[(0,h.jsxs)(VC,{children:[e.typography.size,` / `,e.typography.lineHeight]}),(0,h.jsx)(BC,{name:e.typography.sizeToken})]}),(0,h.jsx)(zC,{label:`Weight`,children:(0,h.jsx)(VC,{children:e.typography.weight})}),e.typography.letterSpacing===`normal`?null:(0,h.jsx)(zC,{label:`Tracking`,children:(0,h.jsx)(VC,{children:e.typography.letterSpacing})}),(0,h.jsx)(HC,{label:`Color`,color:e.typography.color}),e.typography.align===`start`?null:(0,h.jsx)(zC,{label:`Align`,children:(0,h.jsx)(VC,{children:e.typography.align})}),e.typography.transform?(0,h.jsx)(zC,{label:`Transform`,children:(0,h.jsx)(VC,{children:e.typography.transform})}):null]}):null,Object.values(e.appearance).some(Boolean)?(0,h.jsxs)(RC,{title:`Appearance`,children:[e.appearance.background?(0,h.jsx)(HC,{label:`Background`,color:e.appearance.background}):null,e.appearance.backgroundImage?(0,h.jsx)(zC,{label:`Image`,children:(0,h.jsx)(VC,{title:e.appearance.backgroundImage,children:e.appearance.backgroundImage})}):null,e.appearance.border?(0,h.jsxs)(zC,{label:`Border`,children:[(0,h.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:e.appearance.border.color.css}}),(0,h.jsxs)(VC,{children:[e.appearance.border.width,` `,e.appearance.border.style,` `,e.appearance.border.color.value]}),(0,h.jsx)(BC,{name:e.appearance.border.color.token})]}):null,e.appearance.radius?(0,h.jsxs)(zC,{label:`Radius`,children:[(0,h.jsx)(VC,{children:e.appearance.radius.value}),(0,h.jsx)(BC,{name:e.appearance.radius.token})]}):null,e.appearance.shadow?(0,h.jsxs)(zC,{label:`Shadow`,children:[(0,h.jsx)(VC,{title:e.appearance.shadow.value,children:e.appearance.shadow.value}),(0,h.jsx)(BC,{name:e.appearance.shadow.token})]}):null,e.appearance.opacity?(0,h.jsx)(zC,{label:`Opacity`,children:(0,h.jsx)(VC,{children:e.appearance.opacity})}):null]}):null,e.classes.length?(0,h.jsx)(RC,{title:`Classes`,right:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void hC(e.classes.join(` `),`Classes copied`),className:`cursor-pointer border-0 bg-transparent text-[12px] text-muted hover:text-ink2`,children:`Copy`}),children:(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 px-4 pb-1`,children:e.classes.map(e=>(0,h.jsx)(`span`,{className:`rounded-[4px] bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2`,children:e},e))})}):null,e.attributes.length?(0,h.jsx)(RC,{title:`Attributes`,children:e.attributes.map(([e,t])=>(0,h.jsx)(zC,{label:e,children:(0,h.jsx)(VC,{title:t,children:t})},e))}):null,e.children.length?(0,h.jsx)(RC,{title:`Children · ${e.children.length}`,children:(0,h.jsx)(`div`,{className:`flex flex-col px-2 pb-1`,children:e.children.map((e,n)=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>t(e.el),className:`flex h-7 cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left font-mono text-[12px] text-ink2 hover:bg-soft2`,children:[(0,h.jsx)(Z,{name:`chevron-right`,size:12,className:`text-muted`}),(0,h.jsx)(`span`,{className:`truncate`,children:e.label})]},n))})}):null]}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-10 text-center`,children:[(0,h.jsx)(Z,{name:`pointer`,size:22,className:`text-muted`}),(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:r?`Click an element in any screen.`:`Hold ${d_} to highlight, click to inspect.`}),(0,h.jsx)(`span`,{className:`text-[12.5px] leading-[1.5] text-muted`,children:`Hover shows margin, padding and content. Clicks go to the inspector, not the screen.`}),(0,h.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,h.jsx)(a_,{children:`I`}),` toggle · hold `,(0,h.jsx)(a_,{children:d_}),` · `,(0,h.jsx)(a_,{children:`esc`}),` clear`]})]}),e?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-rule bg-soft px-4 py-2.5`,children:(0,h.jsx)(g_,{icon:`copy`,onClick:()=>void hC(MC(e),`CSS copied`),className:`grow`,children:`Copy CSS`})}):null]})}var JC={neutral:`bg-soft2 text-ink2`,action:`bg-action-soft text-action`,ok:`bg-ok-soft text-ok-text`,danger:`bg-danger-soft text-danger-text`};function YC({tone:e=`neutral`,children:t,className:n}){return(0,h.jsx)(`span`,{className:X(`inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-[6px] px-2 text-[12px] font-medium`,JC[e],n),children:t})}function XC({value:e,tone:t=`neutral`}){return(0,h.jsx)(`span`,{className:X(`inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[4px] px-[5px] text-[11.5px] font-semibold tabular`,t===`action`?`bg-action-soft text-action`:t===`danger`?`bg-danger-soft text-danger-text`:`bg-soft2 text-ink2`),children:e})}function ZC({children:e,className:t,style:n}){return(0,h.jsx)(`section`,{className:X(`min-w-0 shrink-0 overflow-hidden rounded-[10px] border border-rule bg-surface`,t),style:n,children:e})}function QC({title:e,count:t,sub:n,right:r,as:i=`h2`}){return(0,h.jsxs)(`div`,{className:`flex min-h-[46px] items-center justify-between gap-3 px-4`,children:[(0,h.jsxs)(i,{className:`m-0 flex min-w-0 items-center gap-2 whitespace-nowrap text-[14px] font-semibold`,children:[e,t===void 0?null:(0,h.jsx)(XC,{value:t}),n?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] font-normal text-muted`,children:n}):null]}),r?(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function $C({items:e,value:t,onChange:n,right:r}){let i=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`flex h-[46px] items-center justify-between gap-3 px-4`,children:[(0,h.jsx)(`div`,{role:`tablist`,className:`flex gap-5`,children:e.map(e=>{let r=e.value===t;return(0,h.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.value),className:X(`relative flex h-[46px] cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0.5 text-[14px] transition-colors`,r?`font-semibold text-ink`:`font-medium text-ink2 hover:text-ink`),children:[e.label,e.count===void 0?null:(0,h.jsx)(XC,{value:e.count}),r?(0,h.jsx)($d.span,{layoutId:i,className:`absolute inset-x-0 bottom-0 h-[2px] bg-ink`,transition:{type:`spring`,stiffness:520,damping:42}}):null]},e.value)})}),r?(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function ew({align:e,children:t}){return(0,h.jsx)(`div`,{className:X(`flex min-w-0 items-center gap-2`,e===`r`&&`justify-end text-right`,e===`c`&&`justify-center`),children:t})}function tw(e,t){return m.Children.toArray(e).map((e,n)=>(0,h.jsx)(ew,{align:t?.[n]??`l`,children:e},n))}function nw({cols:e,align:t,labels:n}){return(0,h.jsx)(`div`,{className:`grid h-8 items-center gap-x-4 border-t border-rule bg-soft px-4 text-[12.5px] text-muted`,style:{gridTemplateColumns:e},children:n.map((e,n)=>(0,h.jsx)(ew,{align:t?.[n]??`l`,children:(0,h.jsx)(`span`,{className:`whitespace-nowrap`,children:e})},n))})}var rw=(e,t,n)=>X(`grid items-center gap-x-4 border-rule`,!e&&`border-t`,t&&`cursor-pointer transition-colors hover:bg-soft`,n);function iw({cols:e,align:t,minH:n=44,pad:r=`10px 16px`,children:i,first:a,className:o,onClick:s,title:c}){return(0,h.jsx)(`div`,{className:rw(a,!!s,o),style:{gridTemplateColumns:e,minHeight:n,padding:r},onClick:s,title:c,children:tw(i,t)})}function aw({to:e,cols:t,align:n,minH:r=44,pad:i=`10px 16px`,first:a,className:o,children:s}){return(0,h.jsx)(Lf,{href:e,className:X(rw(a,!0,o),`text-inherit no-underline`),style:{gridTemplateColumns:t,minHeight:r,padding:i},children:tw(s,n)})}function ow({label:e,children:t,labelWidth:n=180,minH:r=40,end:i=!1}){return(0,h.jsxs)(`div`,{className:`grid content-center items-baseline gap-x-4 border-t border-rule px-4 py-2`,style:{gridTemplateColumns:`${n}px minmax(0, 1fr)`,minHeight:r},children:[(0,h.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,h.jsx)(`div`,{className:X(`flex min-w-0 flex-wrap items-center gap-2`,i&&`justify-end`),children:t})]})}function sw({children:e,pad:t=`16px`,gap:n=16,top:r=!0,className:i}){return(0,h.jsx)(`div`,{className:X(`flex flex-col`,r&&`border-t border-rule`,i),style:{padding:t,gap:n},children:e})}function cw({issues:e,className:t}){return(0,h.jsx)(`div`,{className:X(`flex flex-col`,t),children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-start gap-2.5 border-t border-rule px-4 py-2.5 text-[13px] first:border-t-0`,children:[(0,h.jsx)(Z,{name:e.severity===`error`?`alert`:`info`,size:15,className:X(`mt-0.5`,e.severity===`error`?`text-danger-text`:`text-action`)}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(`span`,{className:`text-ink`,children:e.message}),(0,h.jsxs)(`span`,{className:`font-mono text-[12px] break-all text-muted`,children:[e.file,e.at?` · ${e.at}`:``]})]})]},t))})}function lw({issues:e,title:t=`Problems`}){if(!e.length)return null;let n=e.filter(e=>e.severity===`error`).length;return(0,h.jsxs)(ZC,{className:n?`border-danger/40`:void 0,children:[(0,h.jsx)(QC,{title:t,count:e.length,sub:n?`${n} blocking`:`warnings`}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:(0,h.jsx)(cw,{issues:e})})]})}var uw=[.2,.7,.2,1];function dw({open:e,side:t,width:n,children:r}){return(0,h.jsx)(V,{initial:!1,children:e?(0,h.jsx)($d.div,{initial:{width:0,opacity:.6},animate:{width:n,opacity:1},exit:{width:0,opacity:.6},transition:{duration:.22,ease:uw},className:X(`flex min-h-0 shrink-0 overflow-hidden`,t===`right`?`justify-start`:`justify-end`),children:(0,h.jsx)(`div`,{className:`flex min-h-0 shrink-0`,style:{width:n},children:r})},`panel`):null})}var fw=new Map;window.addEventListener(`message`,e=>{let t=e.data;t?.source===`design-runtime`&&e.source&&fw.get(e.source)?.(t)});function pw(e,t){let n=null,r=()=>{n&&fw.delete(n),n=e.contentWindow,n&&fw.set(n,t)};return r(),e.addEventListener(`load`,r),()=>{e.removeEventListener(`load`,r),n&&fw.delete(n)}}function mw(e){e?.contentWindow?.postMessage({source:`design-viewer`,type:`canvas`},`*`)}function hw(e,t){e?.contentWindow?.postMessage({source:`design-viewer`,type:`theme`,theme:t},`*`)}function gw(e,t,n){let[r,i=``]=e.split(`?`),a=new URLSearchParams(i);a.set(`theme`,t);for(let[e,t]of Object.entries(n??{}))a.set(e,t);return`${r}?${a.toString()}`}function _w(e){return new URL(e,document.baseURI).toString()}function vw({items:e,value:t,onChange:n,label:r,stretch:i,size:a=`ctrl`}){let o=(0,m.useId)();return(0,h.jsx)(`div`,{role:`group`,"aria-label":r,className:X(`shrink-0 items-center gap-0.5 rounded-[6px] bg-track p-[3px]`,a===`ctrl`?`h-ctrl`:`h-7`,i?`flex`:`inline-flex`),children:e.map(e=>{let r=e.value===t;return(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":r,title:e.title,onClick:()=>n(e.value),className:X(`relative flex h-full cursor-pointer items-center justify-center whitespace-nowrap rounded-[4px] border-0 bg-transparent font-medium transition-colors`,a===`ctrl`?`px-2.5 text-ctrl`:`px-2 text-[12.5px]`,i&&`flex-1`,r?`text-ink`:`text-muted hover:text-ink2`),children:[r?(0,h.jsx)($d.span,{layoutId:o,className:`absolute inset-0 rounded-[4px] bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.10)]`,transition:{type:`spring`,stiffness:520,damping:42}}):null,(0,h.jsx)(`span`,{className:`relative flex items-center gap-1.5`,children:e.label})]},e.value)})})}function yw({children:e,className:t,gap:n=20,wide:r=!1}){return(0,h.jsx)(`main`,{className:X(`mx-auto flex w-full min-h-0 grow flex-col px-8 pt-6 pb-7 animate-[q-fade-in_160ms_ease-out] max-md:px-4 max-md:pt-4`,r?`max-w-[1440px]`:`max-w-[1200px]`,t),style:{gap:n},children:e})}function bw({title:e,sub:t,right:n,badge:r,crumbs:i}){return(0,h.jsxs)(`div`,{className:`flex shrink-0 items-end justify-between gap-6 max-md:flex-col max-md:items-stretch max-md:gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[i?(0,h.jsx)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:i}):null,(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`h1`,{className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:e}),r]}),t?(0,h.jsx)(`div`,{className:`text-[13px] text-muted`,children:t}):null]}),n?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n}):null]})}function xw({items:e,label:t}){return(0,h.jsx)(`nav`,{"aria-label":t,className:`flex flex-col gap-0.5`,children:e.map(e=>(0,h.jsxs)(Lf,{href:e.to,className:e=>X(`flex h-8 items-center gap-2 whitespace-nowrap rounded-[6px] px-3 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,e?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),e.hint?(0,h.jsx)(`span`,{className:`ml-auto text-[12px] font-normal text-muted`,children:e.hint}):null]},e.to))})}function Sw({children:e}){return(0,h.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[12px] text-muted`,children:e})}function Cw({title:e,text:t,action:n}){return(0,h.jsxs)(ZC,{className:`flex w-[480px] max-w-full flex-col items-center gap-2 px-6 py-8 text-center`,children:[(0,h.jsx)(`h1`,{className:`m-0 text-[16px] font-semibold`,children:e}),t?(0,h.jsx)(`div`,{className:`m-0 max-w-[400px] text-[14px] text-ink2`,children:t}):null,n?(0,h.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:n}):null]})}function ww(e){return(0,h.jsx)(`div`,{className:`flex min-h-[50vh] grow items-center justify-center p-6 max-md:px-4`,children:(0,h.jsx)(Cw,{...e})})}var Tw=Object.defineProperty,Ew=(e,t)=>Tw(e,`name`,{value:t,configurable:!0}),Dw=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Ow=m.forwardRef(Ew(function(e,t){return(0,h.jsx)(Gp.span,{...e,ref:t,style:{...Dw,...e.style}})},`VisuallyHidden`)),kw=Object.defineProperty,Aw=(e,t)=>kw(e,`name`,{value:t,configurable:!0}),[jw,Mw]=op(`Tooltip`,[rb]),Nw=rb(),Pw=`TooltipProvider`,Fw=700,Iw=`tooltip.open`,[Lw,Rw]=jw(Pw),zw=Aw(e=>{let{__scopeTooltip:t,delayDuration:n=Fw,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=m.useRef(!0),s=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,h.jsx)(Lw,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:m.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Bw=`Tooltip`,[Vw,Hw]=jw(Bw),Uw=Aw(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Rw(Bw,e.__scopeTooltip),l=Nw(t),[u,d]=m.useState(null),[f,p]=m.useState(void 0),g=pp(),_=m.useRef(0),v=o??c.disableHoverableContent,y=s??c.delayDuration,b=m.useRef(!1),[x,S]=Sp({prop:r,defaultProp:i??!1,onChange:Aw(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Iw))):c.onClose(),a?.(e)},`onChange`),caller:Bw}),C=m.useMemo(()=>x?b.current?`delayed-open`:`instant-open`:`closed`,[x]),w=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,b.current=!1,S(!0)},[S]),T=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,S(!1)},[S]),E=m.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{b.current=!0,S(!0),_.current=0},y)},[y,S]);m.useEffect(()=>()=>{_.current&&=(window.clearTimeout(_.current),0)},[]);let D=f??g;return(0,h.jsx)(gb,{...l,children:(0,h.jsx)(Vw,{scope:t,contentId:D,setContentId:p,open:x,stateAttribute:C,trigger:u,onTriggerChange:d,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?E():w()},[c.isOpenDelayedRef,E,w]),onTriggerLeave:m.useCallback(()=>{v?T():(window.clearTimeout(_.current),_.current=0)},[T,v]),onOpen:w,onClose:T,disableHoverableContent:v,children:n})})},`Tooltip`),Ww=`TooltipTrigger`,Gw=m.forwardRef(Aw(function(e,t){let{__scopeTooltip:n,...r}=e,i=Hw(Ww,n),a=Rw(Ww,n),o=Nw(n),s=rp(t,m.useRef(null),i.onTriggerChange),c=m.useRef(!1),l=m.useRef(!1),u=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,h.jsx)(_b,{asChild:!0,...o,children:(0,h.jsx)(Gp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})},`TooltipTrigger`)),Kw=`TooltipPortal`,[qw,Jw]=jw(Kw,{forceMount:void 0}),Yw=Aw(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Hw(Kw,t);return(0,h.jsx)(qw,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Xw=`TooltipContent`,Zw=m.forwardRef(Aw(function(e,t){let n=Jw(Xw,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Hw(Xw,e.__scopeTooltip);return(0,h.jsx)(Mm,{present:r||o.open,children:o.disableHoverableContent?(0,h.jsx)(eT,{side:i,...a,ref:t}):(0,h.jsx)(Qw,{side:i,...a,ref:t})})},`TooltipContent`)),Qw=m.forwardRef(Aw(function(e,t){let n=Hw(Xw,e.__scopeTooltip),r=Rw(Xw,e.__scopeTooltip),i=m.useRef(null),a=rp(t,i),[o,s]=m.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=m.useCallback(()=>{s(null),d(!1)},[d]),p=m.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=nT(r,tT(r,n.getBoundingClientRect())),a=rT(t.getBoundingClientRect()),o=aT([...i,...a]);s(o),d(!0)},[d]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&u){let e=Aw(e=>p(e,u),`handleTriggerLeave`),t=Aw(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),m.useEffect(()=>{if(o){let e=Aw(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!iT(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,h.jsx)(eT,{...e,ref:a})},`TooltipContentHoverable`)),$w=Mp(`TooltipContent`),eT=m.forwardRef(Aw(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Hw(Xw,n),u=Nw(n),{onClose:d}=l;m.useEffect(()=>(document.addEventListener(Iw,d),()=>document.removeEventListener(Iw,d)),[d]),m.useEffect(()=>{if(l.trigger){let e=Aw(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return cp(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,h.jsxs)(vb,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,h.jsx)($w,{children:r}),i?(0,h.jsx)(Ow,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function tT(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}Aw(tT,`getExitSideFromRect`);function nT(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}Aw(nT,`getPaddedExitPoints`);function rT(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}Aw(rT,`getPointsFromRect`);function iT(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Aw(iT,`isPointInPolygon`);function aT(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),oT(t)}Aw(aT,`getHull`);function oT(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Aw(oT,`getHullPresorted`);var sT=zw,cT=Uw,lT=Gw,uT=Yw,dT=Zw;function fT({children:e}){return(0,h.jsx)(sT,{delayDuration:250,children:e})}var pT=`z-50 max-w-[280px] rounded-[8px] border border-rule bg-surface px-[10px] py-[7px] text-[12.5px] leading-[1.35] text-ink shadow-pop outline-none data-[state=delayed-open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function mT({content:e,children:t,side:n=`top`,align:r=`center`,className:i}){return(0,h.jsxs)(cT,{children:[(0,h.jsx)(lT,{asChild:!0,children:t}),(0,h.jsx)(uT,{children:(0,h.jsx)(dT,{side:n,align:r,sideOffset:6,collisionPadding:12,className:X(pT,i),children:e})})]})}function hT({title:e=`Nothing here`,text:t}){return(0,h.jsx)(ww,{title:e,text:t??`This address does not match a canvas or a page of the design system.`,action:(0,h.jsx)(b_,{to:`/`,children:`All canvases`})})}var gT=.02,_T=e=>Math.min(8,Math.max(gT,e)),vT=class{camera={x:0,y:0,z:1};listeners=new Set;animation=0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}set(e){this.camera={x:e.x,y:e.y,z:_T(e.z)};for(let e of this.listeners)e(this.camera)}interrupt(){cancelAnimationFrame(this.animation),this.animation=0}panBy(e,t){this.interrupt();let{x:n,y:r,z:i}=this.camera;this.set({x:n+e,y:r+t,z:i})}zoomAt(e,t,n){this.interrupt();let{x:r,y:i,z:a}=this.camera,o=_T(a*n),s=(e-r)/a,c=(t-i)/a;this.set({x:e-s*o,y:t-c*o,z:o})}animateTo(e,t=320){this.interrupt();let n={...this.camera},r={...e,z:_T(e.z)};if(t<=0||matchMedia(`(prefers-reduced-motion: reduce)`).matches){this.set(r);return}let i=performance.now(),a=e=>{let o=Math.min(1,(e-i)/t),s=1-(1-o)**3,c=n.z*(r.z/n.z)**s,l=n.z===r.z?s:(c-n.z)/(r.z-n.z);this.set({x:n.x+(r.x-n.x)*l,y:n.y+(r.y-n.y)*l,z:c}),this.animation=o<1?requestAnimationFrame(a):0};this.animation=requestAnimationFrame(a)}toWorld(e,t){let{x:n,y:r,z:i}=this.camera;return{x:(e-n)/i,y:(t-r)/i}}};function yT(e,t,n,r=72,i=1){let a=_T(Math.min((t-r*2)/Math.max(e.w,1),(n-r*2)/Math.max(e.h,1),i));return{z:a,x:t/2-(e.x+e.w/2)*a,y:n/2-(e.y+e.h/2)*a}}function bT(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}var xT=280,ST=96,CT=150,wT=110,TT=720,ET=e=>e.kind===`screen`||e.kind===`url`;function DT(e,t){let n=t[e.id];if(e.kind===`screen`||e.kind===`url`){let t=e.frame.width;if(e.frame.height!==`auto`)return{w:t,h:e.frame.height};let r=e.kind===`screen`?e.measuredHeight:void 0;return{w:t,h:n?.h??r??900}}if(e.kind===`note`)return{w:e.width,h:n?.h??Math.max(80,Math.ceil(e.text.length/38)*26+40)};let r=e.width??n?.w??480;return{w:r,h:n?.w?n.h/n.w*r:n?.h??r*.62}}function OT(e,t){return!e.title&&!e.description?0:t[`section:${e.id}`]?.h??(e.title?56:0)+(e.description?60:0)}function kT(e,t){let n=[],r=[];if(e.layout===`free`){let r=0;for(let i of e.sections)for(let e of i.items){let{w:a,h:o}=DT(e,t),s=e.x??r,c=e.y??0;r=Math.max(r,s+a+ST),n.push({item:e,section:i,x:s,y:c,w:a,h:o})}}else{let i=0;for(let a of e.sections){let e=OT(a,t),o=i,s=i+(e?e+wT:0),c=0,l=0,u=0,d=0;for(let e of a.items){a.columns&&d===a.columns&&(s+=l+CT,c=0,l=0,d=0);let{w:r,h:i}=DT(e,t);n.push({item:e,section:a,x:c,y:s,w:r,h:i}),c+=r+ST,u=Math.max(u,c-ST),l=Math.max(l,i),d++}let f=s+l;r.push({section:a,x:0,y:o,w:Math.max(u,e?TT:0),h:f-o,header:e}),i=f+xT}}let i=0,a=0,o=0,s=0,c=[...n,...r];return c.length&&(i=Math.min(...c.map(e=>e.x)),a=Math.min(...c.map(e=>e.y)),o=Math.max(...c.map(e=>e.x+e.w)),s=Math.max(...c.map(e=>e.y+e.h))),{items:n,sections:r,bounds:{x:i,y:a,w:o-i,h:s-a}}}function AT(e){return e.items.filter(e=>ET(e.item))}function jT(e){return e.kind===`note`?`note`:e.kind===`image`?`image`:e.kind===`url`?`globe`:e.frame.width<600?`smartphone`:e.frame.width<1100?`tablet`:`monitor`}function MT(e,t){return`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(t.id)}`}function NT({canvas:e,page:t,store:n,onPick:r}){let i=Jg(n,e=>e.selected),a=Jg(n,e=>e.frames);return(0,h.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[264px] shrink-0 flex-col overflow-hidden border-r border-rule bg-surface`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-rule px-4 py-3.5`,children:[(0,h.jsx)(`div`,{className:`truncate text-[14px] font-semibold`,children:e.title}),e.description?(0,h.jsx)(`div`,{className:`line-clamp-3 text-[12.5px] leading-[1.45] text-muted`,children:e.description}):null]}),(0,h.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto pb-4`,children:[e.pages.length>1?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:`Pages`}),(0,h.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2`,children:e.pages.map(n=>{let r=n.sections.reduce((e,t)=>e+t.items.filter(e=>e.kind===`screen`||e.kind===`url`).length,0);return(0,h.jsxs)(Lf,{href:MT(e,n),className:X(`flex h-8 items-center gap-2 rounded-[6px] px-2.5 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,n.id===t.id?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:n.title}),(0,h.jsx)(`span`,{className:`text-[12px] text-muted tabular`,children:r})]},n.id)})})]}):null,(0,h.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:e.pages.length>1?t.title:`Layers`}),(0,h.jsx)(`div`,{className:`flex flex-col px-2`,children:t.sections.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[e.title?(0,h.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-2.5 pt-1 text-[12px] font-medium text-ink2`,children:[(0,h.jsx)(`span`,{className:`truncate`,children:e.title}),(0,h.jsx)(XC,{value:e.items.length})]}):null,e.items.map(t=>{let n=(a[t.id]?.errors.length??0)>0||t.kind===`screen`&&t.missing;return(0,h.jsxs)(`button`,{type:`button`,onClick:()=>r(t.id),className:X(`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 px-2.5 text-left text-[13px] transition-colors focus-visible:outline-offset-[-2px]`,e.title&&`pl-4`,i===t.id?`bg-action-soft text-ink`:`bg-transparent text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(Z,{name:jT(t),size:15,className:`text-muted`}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:t.title||(t.kind===`note`?`Note`:t.id)}),n?(0,h.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`}):null]},t.id)})]},e.id))})]})]})}function PT(){return new qg({selected:null,active:null,hovered:null,sizes:{},frames:{},live:[],panning:!1,zoomTiny:!1,frameEls:{},inspecting:!1})}function FT(e,t,n){e.set(e=>{let r=e.sizes[t];return r&&Math.abs(r.h-n.h)<1&&r.w===n.w?e:{...e,sizes:{...e.sizes,[t]:n}}})}function IT(e,t,n){e.set(e=>{let r=e.frames[t]??{ready:!1,errors:[]};return{...e,frames:{...e.frames,[t]:{...r,...n}}}})}function LT(e,t,n){e.set(e=>e.frameEls[t]===n?e:{...e,frameEls:{...e.frameEls,[t]:n}})}function RT(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var zT=RT();function BT(e){zT=e}var VT={exec:()=>null};function HT(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(WT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var UT=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),WT={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:HT(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:HT(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:HT(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:HT(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:HT(e=>RegExp(`^ {0,${e}}(?:</?(?:${aE})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:HT(e=>RegExp(`^ {0,${e}}>`))},GT=/^(?:[ \t]*(?:\n|$))+/,KT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,JT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,YT=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,XT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ZT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,QT=$(ZT).replace(/bull/g,XT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),$T=$(ZT).replace(/bull/g,XT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),eE=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,tE=/^[^\n]+/,nE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rE=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,nE).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),iE=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,XT).getRegex(),aE=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,oE=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sE=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,oE).replace(`tag`,aE).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cE=e=>$(eE).replace(`hr`,JT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aE).getRegex(),lE=cE(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),uE=cE(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),dE={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,uE).getRegex(),code:KT,def:rE,fences:qT,heading:YT,hr:JT,html:sE,lheading:QT,list:iE,newline:GT,paragraph:lE,table:VT,text:tE},fE=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,JT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aE).getRegex(),pE={...dE,lheading:$T,table:fE,paragraph:$(eE).replace(`hr`,JT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,fE).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aE).getRegex()},mE={...dE,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,oE).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:VT,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(eE).replace(`hr`,JT).replace(`heading`,` *#{1,6} *[^
70
- ]`).replace(`lheading`,QT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},hE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_E=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,vE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yE=/[\p{P}\p{S}]/u,bE=/[\s\p{P}\p{S}]/u,xE=/[^\s\p{P}\p{S}]/u,SE=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,bE).getRegex(),CE=/[\p{Pi}\p{Ps}"']/u,wE=/(?!~)[\p{P}\p{S}]/u,TE=/(?!~)[\s\p{P}\p{S}]/u,EE=/(?:[^\s\p{P}\p{S}]|~)/u,DE=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,UT?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),OE=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kE=$(OE,`u`).replace(/punct/g,yE).getRegex(),AE=$(OE,`u`).replace(/punct/g,wE).getRegex(),jE=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,CE).replace(/punct/g,yE).getRegex(),ME=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,NE=$(ME,`gu`).replace(/notPunctSpace/g,xE).replace(/punctSpace/g,bE).replace(/punct/g,yE).getRegex(),PE=$(ME,`gu`).replace(/notPunctSpace/g,EE).replace(/punctSpace/g,TE).replace(/punct/g,wE).getRegex(),FE=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xE).replace(/punctSpace/g,bE).replace(/punct/g,yE).getRegex(),IE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,xE).replace(/punctSpace/g,bE).replace(/punct/g,yE).getRegex(),LE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xE).replace(/punctSpace/g,bE).replace(/punct/g,yE).getRegex(),RE=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,yE).getRegex(),zE=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xE).replace(/punctSpace/g,bE).replace(/punct/g,yE).getRegex(),BE=$(/\\(punct)/,`gu`).replace(/punct/g,yE).getRegex(),VE=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),HE=$(oE).replace(`(?:-->|$)`,`-->`).getRegex(),UE=$(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,HE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),WE=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,GE=$(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,WE).getRegex(),KE=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,GE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qE=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,GE).replace(`ref`,nE).getRegex(),JE=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,nE).getRegex(),YE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,XE=$(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,WE).getRegex(),ZE=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,XE).replace(`ref`,YE).getRegex()).replace(`nolink`,$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,YE).getRegex()).getRegex(),QE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,$E=$(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),eD={_backpedal:VT,anyPunctuation:BE,autolink:VE,blockSkip:DE,br:_E,code:gE,del:VT,delLDelim:VT,delRDelim:VT,emStrongLDelim:kE,emStrongRDelimAst:NE,emStrongRDelimUnd:IE,escape:hE,link:KE,nolink:JE,punctuation:SE,reflink:qE,reflinkSearch:ZE,tag:UE,text:vE,url:VT},tD={...eD,emStrongLDelim:jE,emStrongRDelimAst:FE,emStrongRDelimUnd:LE,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,GE).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,GE).getRegex()},nD={...eD,emStrongRDelimAst:PE,emStrongLDelim:AE,delLDelim:RE,delRDelim:zE,url:$(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,$E).replace(`protocol`,QE).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,QE).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},rD={...nD,br:$(_E).replace(`{2,}`,`*`).getRegex(),text:$(nD.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},iD={normal:dE,gfm:pE,pedantic:mE},aD={normal:eD,gfm:nD,breaks:rD,pedantic:tD},oD={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},sD=e=>oD[e];function cD(e,t){if(t){if(WT.escapeTest.test(e))return e.replace(WT.escapeReplace,sD)}else if(WT.escapeTestNoEncode.test(e))return e.replace(WT.escapeReplaceNoEncode,sD);return e}function lD(e){return e.replace(WT.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function uD(e){try{e=encodeURI(e).replace(WT.percentDecode,`%`)}catch{return null}return e}function dD(e,t){let n=e.replace(WT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(WT.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(WT.slashPipe,`|`);return n}function fD(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function pD(e){let t=e.split(`
71
- `),n=t.length-1;for(;n>=0&&WT.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
72
- `)}function mD(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function hD(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function gD(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function _D(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function vD(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
57
+ `},qh=0,Jh=[];function Yh(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(qh++)[0],a=m.useState(_h)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qm([e.lockRef.current],(e.shards||[]).map(Wh),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hh(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fh(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fh(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vh(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(Jh.length&&Jh[Jh.length-1]===a){var r=`deltaY`in n?Uh(n):Hh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Wh).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Xh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=Hh(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Uh(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Hh(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return Jh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ah),document.addEventListener(`touchmove`,c,Ah),document.addEventListener(`touchstart`,u,Ah),function(){Jh=Jh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ah),document.removeEventListener(`touchmove`,c,Ah),document.removeEventListener(`touchstart`,u,Ah)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:Kh(i)}):null,p?m.createElement(Dh,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Zh=sh(ch,Yh),Qh=m.forwardRef(function(e,t){return m.createElement(uh,Gm({},e,{ref:t,sideCar:Zh}))});Qh.classNames=uh.classNames;var $h=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},eg=new WeakMap,tg=new WeakMap,ng={},rg=0,ig=function(e){return e&&(e.host||ig(e.parentNode))},ag=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ig(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},og=function(e,t,n,r){var i=ag(t,Array.isArray(e)?e:[e]);ng[n]||(ng[n]=new WeakMap);var a=ng[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(eg.get(e)||0)+1,l=(a.get(e)||0)+1;eg.set(e,c),a.set(e,l),o.push(e),c===1&&i&&tg.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),rg++,function(){o.forEach(function(e){var t=eg.get(e)-1,i=a.get(e)-1;eg.set(e,t),a.set(e,i),t||(tg.has(e)||e.removeAttribute(r),tg.delete(e)),i||e.removeAttribute(n)}),rg--,rg||(eg=new WeakMap,eg=new WeakMap,tg=new WeakMap,ng={})}},sg=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||$h(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),og(r,i,n,`aria-hidden`)):function(){return null}},cg=Object.defineProperty,lg=(e,t)=>cg(e,`name`,{value:t,configurable:!0}),ug=`Dialog`,[dg,fg]=op(ug),[pg,mg]=dg(ug),hg=lg(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=Sp({prop:r,defaultProp:i??!1,onChange:a,caller:ug}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(pg,{scope:t,triggerRef:s,contentRef:c,contentId:pp(),titleId:pp(),descriptionId:pp(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),gg=`DialogPortal`,[_g,vg]=dg(gg,{forceMount:void 0}),yg=lg(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=mg(gg,t);return(0,h.jsx)(_g,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),bg=`DialogOverlay`,xg=m.forwardRef(lg(function(e,t){let n=vg(bg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mg(bg,e.__scopeDialog);return a.modal?(0,h.jsx)(Mm,{present:r||a.open,children:(0,h.jsx)(Cg,{...i,ref:t})}):null},`DialogOverlay`)),Sg=Ap(`DialogOverlay.RemoveScroll`),Cg=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,...r}=e,i=mg(bg,n),a=rp(t,im());return(0,h.jsx)(Qh,{as:Sg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Gp.div,{"data-state":jg(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),wg=`DialogContent`,Tg=m.forwardRef(lg(function(e,t){let n=vg(wg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mg(wg,e.__scopeDialog);return(0,h.jsx)(Mm,{present:r||a.open,children:a.modal?(0,h.jsx)(Eg,{...i,ref:t}):(0,h.jsx)(Dg,{...i,ref:t})})},`DialogContent`)),Eg=m.forwardRef(lg(function(e,t){let n=mg(wg,e.__scopeDialog),r=m.useRef(null),i=rp(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Og,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Dg=m.forwardRef(lg(function(e,t){let n=mg(wg,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Og,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Og=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=mg(wg,n);return Um(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(rm,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":jg(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),kg=`DialogTitle`,Ag=m.forwardRef(lg(function(e,t){let{__scopeDialog:n,...r}=e,i=mg(kg,n),{setTitleCount:a}=i;return cp(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gp.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`));function jg(e){return e?`open`:`closed`}lg(jg,`getState`);var Mg=window.__DESIGN_STATIC__===!0,Ng=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Pg(e){let t=await fetch(e,{cache:Mg?`default`:`no-store`});if(!t.ok){let e=`${t.status} ${t.statusText}`;try{let n=await t.json();n.error&&(e=n.error)}catch{}throw new Ng(t.status,e)}return await t.json()}var Fg=null,Ig={project:()=>Pg(Mg?`api/project.json`:`/api/project`),canvas:e=>Pg(Mg?`api/canvas/${encodeURIComponent(e)}.json`:`/api/canvas/${encodeURIComponent(e)}`),system:()=>Pg(Mg?`api/system.json`:`/api/system`),async source(e){if(Mg){Fg??=Pg(`api/sources.json`).catch(()=>({}));let t=(await Fg)[e];if(t===void 0)throw new Ng(404,`${e} is not in this build`);return t}let t=await fetch(`/api/source?path=${encodeURIComponent(e)}`,{cache:`no-store`});if(!t.ok)throw new Ng(t.status,`Could not read ${e}`);return t.text()}},Lg=new Ue({defaultOptions:{queries:{staleTime:Mg?1/0:0,retry:1,refetchOnWindowFocus:!1}}}),Rg={project:[`project`],canvas:e=>[`canvas`,e],system:[`system`],source:e=>[`source`,e]};function zg(){return nt({queryKey:Rg.project,queryFn:Ig.project})}function Bg(e){return nt({queryKey:Rg.canvas(e),queryFn:()=>Ig.canvas(e),placeholderData:e=>e})}function Vg(e=!0){return nt({queryKey:Rg.system,queryFn:Ig.system,enabled:e})}function Hg(e){return nt({queryKey:Rg.source(e??``),queryFn:()=>Ig.source(e),enabled:!!e})}function Ug(){if(Mg)return()=>{};let e=null,t=!1;return e=new EventSource(`/api/events`),e.onopen=()=>{t&&(t=!1,Lg.invalidateQueries())},e.onerror=()=>{t=!0},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`project`)Lg.invalidateQueries({queryKey:Rg.project});else if(t.type===`system`)Lg.invalidateQueries({queryKey:Rg.system}),Lg.invalidateQueries({queryKey:[`source`]});else if(t.type===`canvas`||t.type===`snapshot`){let e=t.type===`canvas`?t.id:t.canvas;Lg.invalidateQueries({queryKey:Rg.canvas(e)}),t.type===`snapshot`&&Lg.invalidateQueries({queryKey:Rg.project})}},()=>e?.close()}function X(...e){return e.filter(Boolean).join(` `)}var Wg=null;function Gg(e,t){Wg={canvas:e,item:t},window.dispatchEvent(new CustomEvent(`design:focus`,{detail:Wg}))}function Kg(e){if(!Wg||Wg.canvas!==e)return null;let t=Wg.item;return Wg=null,t}var qg=class{value;listeners=new Set;constructor(e){this.value=e}get=()=>this.value;set=e=>{let t=typeof e==`function`?e(this.value):e;if(!Object.is(t,this.value)){this.value=t;for(let e of this.listeners)e()}};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})};function Jg(e,t=e=>e){return(0,m.useSyncExternalStore)(e.subscribe,()=>t(e.get()),()=>t(e.get()))}var Yg=`foss-design.theme`;function Xg(){try{let e=localStorage.getItem(Yg);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var Zg=new qg(Xg()),Qg=window.matchMedia(`(prefers-color-scheme: dark)`);function $g(e){return e===`system`?Qg.matches?`dark`:`light`:e}function e_(){document.documentElement.dataset.theme=$g(Zg.get())}Qg.addEventListener(`change`,e_),Zg.subscribe(e_);function t_(e){try{localStorage.setItem(Yg,e)}catch{}Zg.set(e)}function n_(){return Jg(Zg)}function r_(){let e=Jg(Zg),t=(0,m.useSyncExternalStore)(e=>(Qg.addEventListener(`change`,e),()=>Qg.removeEventListener(`change`,e)),()=>Qg.matches);return e===`system`?t?`dark`:`light`:e}var i_={plus:`<path d="M5 12h14"/><path d="M12 5v14"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,"chevron-down":`<path d="m6 9 6 6 6-6"/>`,"chevron-up":`<path d="m18 15-6-6-6 6"/>`,"chevron-right":`<path d="m9 18 6-6-6-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,chevrons:`<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>`,copy:`<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,bell:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,refresh:`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`,"up-right":`<path d="M7 7h10v10"/><path d="M7 17 17 7"/>`,"down-left":`<path d="M17 7 7 17"/><path d="M17 17H7V7"/>`,external:`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"user-plus":`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M19 8v6"/><path d="M22 11h-6"/>`,user:`<circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`,more:`<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>`,alert:`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>`,info:`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,upload:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>`,download:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>`,shield:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`,logout:`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>`,loader:`<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,"circle-check":`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,"circle-dashed":`<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`,send:`<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>`,chat:`<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>`,wallet:`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>`,"file-code":`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/>`,ban:`<circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/>`,code:`<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>`,"chevron-left":`<path d="m15 18-6-6 6-6"/>`,bluetooth:`<path d="m7 7 10 10-5 5V2l5 5L7 17"/>`,face:`<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>`,eye:`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`,clipboard:`<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>`,grip:`<circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/>`,list:`<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>`,lock:`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,hw:`<rect width="20" height="10" x="2" y="7" rx="2"/><path d="M15 7v10"/><circle cx="8" cy="12" r="1.5"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,signal:`<path d="M2 20h.01"/><path d="M7 20v-4"/><path d="M12 20v-8"/><path d="M17 20V8"/>`,grid:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>`,coins:`<circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="m16.71 13.88.7.71-2.82 2.82"/>`,arrows:`<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>`,key:`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`,blocks:`<rect width="7" height="7" x="14" y="3" rx="1"/><path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"/>`,settings:`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,qr:`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`,edit:`<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>`,home:`<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,"arrow-left":`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`,play:`<polygon points="6 3 20 12 6 21 6 3"/>`,"zoom-in":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>`,"zoom-out":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M8 11h6"/>`,fit:`<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>`,"panel-left":`<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>`,layers:`<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,file:`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>`,palette:`<circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.96 6.01 17.46 2 12 2z"/>`,type:`<path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/>`,shape:`<path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M21 19a2 2 0 0 1-2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h1"/><path d="M14 3h1"/><path d="M14 21h1"/><path d="M3 9v1"/><path d="M21 9v1"/><path d="M3 14v1"/><path d="M21 14v1"/>`,motion:`<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 6c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>`,book:`<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,image:`<rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>`,monitor:`<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/>`,tablet:`<rect width="16" height="20" x="4" y="2" rx="2"/><path d="M12 18h.01"/>`,note:`<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,pointer:`<path d="M4.04 4.69a.5.5 0 0 1 .65-.65l16 6.5a.5.5 0 0 1-.06.95l-6.12 1.58a2 2 0 0 0-1.44 1.44l-1.58 6.12a.5.5 0 0 1-.95.06z"/>`,component:`<path d="M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5Z"/><path d="m12 2 3.5 3.5L12 9 8.5 5.5 12 2Z"/><path d="M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5Z"/><path d="m12 15 3.5 3.5L12 22l-3.5-3.5L12 15Z"/>`,keyboard:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>`,folder:`<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>`,canvas:`<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>`};function Z({name:e,size:t=16,strokeWidth:n=1.75,className:r}){return(0,h.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`shrink-0 ${e===`loader`?`animate-spin`:``} ${r??``}`,dangerouslySetInnerHTML:{__html:i_[e]}})}function Q({children:e,size:t=12.5,className:n,title:r,wrap:i}){return(0,h.jsx)(`span`,{title:r,className:X(i?`break-all`:`whitespace-nowrap`,`font-mono`,n),style:{fontSize:t},children:e})}function a_({children:e}){return(0,h.jsx)(`kbd`,{className:`rounded-[4px] border border-rule bg-surface px-[5px] py-px font-mono text-[11px] text-ink2`,children:e})}function o_({top:e,bottom:t,weight:n=500}){return(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px`,children:[(0,h.jsx)(`span`,{className:`truncate leading-[1.35]`,style:{fontWeight:n},children:e}),t?(0,h.jsx)(`span`,{className:`flex min-w-0 items-center gap-2.5 overflow-hidden whitespace-nowrap text-[12.5px] leading-[1.35] text-muted`,children:t}):null]})}var s_={canvas:`This canvas`,canvases:`Canvases`,system:`Design system`,actions:`Actions`};function c_(e){let t=/^\/c\/([^/]+)/.exec(e);return t?decodeURIComponent(t[1]):null}function l_({onClose:e}){let[t,n]=jf(),r=zg().data,i=c_(t),a=nt({queryKey:Rg.canvas(i??``),queryFn:()=>Ig.canvas(i),enabled:!!i}).data,o=nt({queryKey:Rg.system,queryFn:Ig.system,enabled:!!r?.system}).data,[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(0),d=t=>()=>{e(),t()},f=[];if(a)for(let e of a.pages){f.push({id:`page:${e.id}`,group:`canvas`,label:e.title,icon:`file`,hint:`Page`,run:d(()=>n(`/c/${encodeURIComponent(a.id)}/p/${encodeURIComponent(e.id)}`))});for(let t of e.sections)for(let r of t.items)(r.kind===`screen`||r.kind===`url`)&&f.push({id:`item:${e.id}:${r.id}`,group:`canvas`,label:r.title,icon:r.kind===`url`?`globe`:`monitor`,hint:t.title?`${e.title} · ${t.title}`:e.title,keywords:`${r.id} ${t.title??``}`,searchOnly:!0,run:d(()=>{n(`/c/${encodeURIComponent(a.id)}/p/${encodeURIComponent(e.id)}`),Gg(a.id,r.id)})})}for(let e of r?.canvases??[])e.id!==i&&f.push({id:`canvas:${e.id}`,group:`canvases`,label:e.title,icon:`canvas`,hint:`${e.screens} screens`,keywords:e.id,run:d(()=>n(`/c/${encodeURIComponent(e.id)}`))});if(r?.system){for(let[e,t,r]of[[`Overview`,`/system`,`book`],[`Colors`,`/system/colors`,`palette`],[`Typography`,`/system/typography`,`type`],[`Spacing & shape`,`/system/shape`,`shape`]])f.push({id:`sys:${t}`,group:`system`,label:e,icon:r,run:d(()=>n(t))});for(let e of o?.components??[])f.push({id:`component:${e.id}`,group:`system`,label:e.title,icon:`component`,hint:e.group,searchOnly:!0,run:d(()=>n(`/system/components/${encodeURIComponent(e.id)}`))});for(let e of o?.guidelines??[])f.push({id:`guide:${e.slug}`,group:`system`,label:e.title,icon:`book`,hint:`Guideline`,searchOnly:!0,run:d(()=>n(`/system/guidelines/${encodeURIComponent(e.slug)}`))})}f.push({id:`home`,group:`actions`,label:`All canvases`,icon:`home`,run:d(()=>n(`/`))},{id:`light`,group:`actions`,label:`Light appearance`,icon:`sun`,searchOnly:!0,run:d(()=>t_(`light`))},{id:`dark`,group:`actions`,label:`Dark appearance`,icon:`moon`,searchOnly:!0,run:d(()=>t_(`dark`))},{id:`system-theme`,group:`actions`,label:`System appearance`,icon:`monitor`,searchOnly:!0,run:d(()=>t_(`system`))});let p=s.trim().toLowerCase(),g=f.filter(e=>p?`${e.label} ${e.keywords??``} ${typeof e.hint==`string`?e.hint:``}`.toLowerCase().includes(p):!e.searchOnly),_=[`canvas`,`canvases`,`system`,`actions`].map(e=>({group:e,items:g.filter(t=>t.group===e)})).filter(e=>e.items.length),v=_.flatMap(e=>e.items),y=Math.min(l,Math.max(v.length-1,0)),b=-1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ag,{className:`sr-only`,children:`Search and jump`}),(0,h.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-rule px-4`,children:[(0,h.jsx)(Z,{name:`search`,size:16,className:`text-muted`}),(0,h.jsx)(`input`,{value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),u((y+1)%Math.max(v.length,1))):e.key===`ArrowUp`?(e.preventDefault(),u((y-1+v.length)%Math.max(v.length,1))):e.key===`Enter`&&(e.preventDefault(),v[y]?.run())},placeholder:`Canvases, screens, components…`,"aria-label":`Search and jump`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`palette-list`,autoComplete:`off`,spellCheck:!1,className:`h-full min-w-0 grow border-0 bg-transparent text-[15px] text-ink outline-none placeholder:text-muted`}),(0,h.jsx)(a_,{children:`esc`})]}),(0,h.jsx)(`div`,{id:`palette-list`,role:`listbox`,className:`min-h-0 grow overflow-y-auto py-1.5`,children:_.length?_.map(({group:e,items:t})=>(0,h.jsxs)(`div`,{role:`presentation`,children:[(0,h.jsx)(`div`,{className:`px-4 pt-2.5 pb-1 text-[12px] text-muted`,children:s_[e]}),t.map(e=>{b+=1;let t=b,n=t===y;return(0,h.jsxs)(`button`,{type:`button`,role:`option`,tabIndex:-1,"aria-selected":n,ref:n?e=>e?.scrollIntoView({block:`nearest`}):void 0,onMouseMove:()=>n?void 0:u(t),onClick:e.run,className:X(`flex h-10 w-full cursor-pointer items-center gap-3 border-0 px-4 text-left text-[13.5px] text-ink`,n?`bg-soft`:`bg-transparent`),children:[(0,h.jsx)(`span`,{className:`flex w-5 shrink-0 justify-center text-ink2`,children:(0,h.jsx)(Z,{name:e.icon,size:16})}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.label}),e.hint?(0,h.jsx)(`span`,{className:`flex shrink-0 items-center text-[12.5px] text-muted`,children:e.hint}):null]},e.id)})]},e)):(0,h.jsx)(`div`,{className:`px-6 py-10 text-center text-[13px] text-muted`,children:`Nothing matches.`})}),(0,h.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-4 border-t border-rule bg-soft px-4 text-[12px] text-muted`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(a_,{children:`↑`}),(0,h.jsx)(a_,{children:`↓`}),`move`]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(a_,{children:`↵`}),`open`]})]})]})}function u_(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=()=>t(e=>!e),n=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())};return window.addEventListener(`keydown`,n),window.addEventListener(`design:palette`,e),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`design:palette`,e)}},[]),(0,h.jsx)(hg,{open:e,onOpenChange:t,children:(0,h.jsx)(V,{children:e?(0,h.jsx)(yg,{forceMount:!0,children:(0,h.jsx)(xg,{asChild:!0,forceMount:!0,children:(0,h.jsx)($d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.14},className:`fixed inset-0 z-50 flex items-start justify-center bg-overlay p-6 pt-[12vh]`,children:(0,h.jsx)(Tg,{asChild:!0,forceMount:!0,"aria-describedby":void 0,children:(0,h.jsx)($d.div,{initial:{opacity:0,scale:.98,y:-6},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,transition:{duration:.1}},transition:{type:`spring`,stiffness:560,damping:40},className:`flex max-h-[min(560px,76vh)] w-[560px] max-w-full flex-col overflow-hidden rounded-[12px] border border-rule bg-surface shadow-pop outline-none`,children:(0,h.jsx)(l_,{onClose:()=>t(!1)})})})})})}):null})})}var d_=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`;function f_(){window.dispatchEvent(new CustomEvent(`design:palette`))}function p_({width:e=240,label:t=`Search and jump`}){return(0,h.jsxs)(`button`,{type:`button`,onClick:f_,style:{width:e},className:`flex h-ctrl min-w-0 shrink cursor-pointer items-center gap-2 rounded-[6px] border border-rule bg-soft pr-1.5 pl-3 text-ctrl text-muted transition-colors hover:border-rule-strong max-lg:w-auto!`,children:[(0,h.jsx)(Z,{name:`search`,size:15}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate text-left max-lg:hidden`,children:t}),(0,h.jsx)(a_,{children:d_===`⌘`?`⌘K`:`Ctrl K`})]})}var m_={primary:`border border-primary bg-primary text-primary-ink hover:opacity-90`,secondary:`border border-rule-strong bg-surface text-ink hover:bg-soft`,ghost:`border border-transparent bg-transparent text-ink2 hover:bg-soft2`,dashed:`border border-dashed border-rule-strong bg-transparent text-ink2 hover:bg-soft`,danger:`border border-danger bg-danger text-on-danger hover:opacity-90`},h_=(e=`secondary`,t)=>X(`inline-flex h-ctrl shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] px-ctrl text-ctrl font-medium leading-none no-underline transition-[background-color,opacity] duration-100`,`disabled:cursor-not-allowed disabled:opacity-45 aria-disabled:cursor-not-allowed aria-disabled:opacity-45`,m_[e],t),g_=(0,m.forwardRef)(function({kind:e=`secondary`,icon:t,loading:n,disabled:r,className:i,children:a,type:o=`button`,...s},c){return(0,h.jsxs)(`button`,{ref:c,type:o,disabled:r||n,"aria-busy":n||void 0,className:h_(e,i),...s,children:[n?(0,h.jsx)(Z,{name:`loader`,size:15,className:`animate-spin`}):t?(0,h.jsx)(Z,{name:t,size:15}):null,a]})}),__={ghost:`border border-transparent bg-transparent text-muted hover:bg-soft2 hover:text-ink2`,secondary:`border border-rule-strong bg-surface text-ink2 hover:bg-soft`},v_=(e=`ghost`,t)=>X(`inline-flex h-ctrl w-ctrl shrink-0 cursor-pointer items-center justify-center rounded-[6px] p-0 transition-colors duration-100 disabled:cursor-not-allowed disabled:opacity-45`,__[e],t),y_=(0,m.forwardRef)(function({icon:e,label:t,kind:n=`ghost`,size:r=16,className:i,type:a=`button`,...o},s){return(0,h.jsx)(`button`,{ref:s,type:a,"aria-label":t,title:t,className:v_(n,i),...o,children:(0,h.jsx)(Z,{name:e,size:r})})});function b_({to:e,kind:t=`secondary`,icon:n,className:r,children:i}){return(0,h.jsxs)(Lf,{href:e,className:h_(t,r),children:[n?(0,h.jsx)(Z,{name:n,size:15}):null,i]})}function x_({kind:e=`secondary`,icon:t,className:n,children:r,...i}){return(0,h.jsxs)(`a`,{className:h_(e,n),...i,children:[t?(0,h.jsx)(Z,{name:t,size:15}):null,r]})}var S_=Object.defineProperty,C_=(e,t)=>S_(e,`name`,{value:t,configurable:!0});function w_(e){let t=e+`CollectionProvider`,[n,r]=op(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=C_(e=>{let{scope:t,children:n}=e,r=m.useRef(null),a=m.useRef(new Map).current;return(0,h.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Ap(s),l=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=rp(t,a(s,n).collectionRef);return(0,h.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Ap(u),p=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),s=rp(t,o),c=a(u,n);return m.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,h.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function g(t){let n=a(e+`CollectionConsumer`,t);return m.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return C_(g,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},g,r]}C_(w_,`createCollection`);var T_=new WeakMap,E_=class e extends Map{static{C_(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],T_.set(this,!0)}set(e,t){return T_.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=k_(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=D_(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=D_(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return D_(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function D_(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=O_(e,t);return n===-1?void 0:e[n]}C_(D_,`at`);function O_(e,t){let n=e.length,r=k_(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}C_(O_,`toSafeIndex`);function k_(e){return e!==e||e===0?0:Math.trunc(e)}C_(k_,`toSafeInteger`);function A_(e){let t=e+`CollectionProvider`,[n,r]=op(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new E_,setItemMap:C_(()=>void 0,`setItemMap`)}),o=C_(({state:e,...t})=>e?(0,h.jsx)(c,{...t,state:e}):(0,h.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=C_(e=>{let t=_();return(0,h.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=C_(e=>{let{scope:t,children:n,state:r}=e,a=m.useRef(null),[o,s]=m.useState(null),c=rp(a,s),[l,u]=r;return m.useEffect(()=>{if(!o)return;let e=P_(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,h.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=Ap(l),d=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=rp(t,a(l,n).collectionRef);return(0,h.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=Ap(f),g=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),[s,c]=m.useState(null),l=rp(t,o,c),{setItemMap:u}=a(f,n),d=m.useRef(i);j_(d.current,i)||(d.current=i);let g=d.current;return m.useEffect(()=>{let e=g;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(N_):(t.set(s,{...e,element:s}),t.toSorted(N_)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new E_(e)))}},[s,g,u]),(0,h.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});g.displayName=f;function _(){return m.useState(new E_)}C_(_,`useInitCollection`);function v(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return C_(v,`useCollection`),[{Provider:o,Slot:d,ItemSlot:g},{createCollectionScope:r,useCollection:v,useInitCollection:_}]}C_(A_,`createCollection`);function j_(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}C_(j_,`shallowEqual`);function M_(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}C_(M_,`isElementPreceding`);function N_(e,t){return!e[1].element||!t[1].element?0:M_(e[1].element,t[1].element)?-1:1}C_(N_,`sortByDocumentPosition`);function P_(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}C_(P_,`getChildListObserver`);var F_=Object.defineProperty,I_=(e,t)=>F_(e,`name`,{value:t,configurable:!0}),L_=m.createContext(void 0);function R_(e){let t=m.useContext(L_);return e||t||`ltr`}I_(R_,`useDirection`);var z_=[`top`,`right`,`bottom`,`left`],B_=Math.min,V_=Math.max,H_=Math.round,U_=Math.floor,W_=e=>({x:e,y:e}),G_={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function K_(e,t,n){return V_(e,B_(t,n))}function q_(e,t){return typeof e==`function`?e(t):e}function J_(e){return e.split(`-`)[0]}function Y_(e){return e.split(`-`)[1]}function X_(e){return e===`x`?`y`:`x`}function Z_(e){return e===`y`?`height`:`width`}function Q_(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $_(e){return X_(Q_(e))}function ev(e,t,n){n===void 0&&(n=!1);let r=Y_(e),i=$_(e),a=Z_(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lv(o)),[o,lv(o)]}function tv(e){let t=lv(e);return[nv(e),t,nv(t)]}function nv(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rv=[`left`,`right`],iv=[`right`,`left`],av=[`top`,`bottom`],ov=[`bottom`,`top`];function sv(e,t,n){switch(e){case`top`:case`bottom`:return n?t?iv:rv:t?rv:iv;case`left`:case`right`:return t?av:ov;default:return[]}}function cv(e,t,n,r){let i=Y_(e),a=sv(J_(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nv)))),a}function lv(e){let t=J_(e);return G_[t]+e.slice(t.length)}function uv(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function dv(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uv(e)}function fv(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pv(e,t,n){let{reference:r,floating:i}=e,a=Q_(t),o=$_(t),s=Z_(o),c=J_(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Y_(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mv(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=q_(t,e),p=dv(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fv(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hv=50,gv=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mv},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hv&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_v=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=q_(e,t)||{};if(l==null)return{};let d=dv(u),f={x:n,y:r},p=$_(i),m=Z_(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=B_(d[_],T),D=B_(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=K_(E,k,O),j=!c.arrow&&Y_(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),vv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=q_(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=J_(r),_=Q_(o),v=J_(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lv(o)]:tv(o)),x=p!==`none`;!d&&x&&b.push(...cv(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ev(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Q_(t)||T.every(e=>Q_(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Q_(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function yv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bv(e){return z_.some(t=>e[t]>=0)}var xv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=q_(e,t);switch(i){case`referenceHidden`:{let e=yv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bv(e)}}}case`escaped`:{let e=yv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bv(e)}}}default:return{}}}}},Sv=new Set([`left`,`top`]);async function Cv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=J_(n),s=Y_(n),c=Q_(n)===`y`,l=Sv.has(o)?-1:1,u=a&&c?-1:1,d=q_(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=q_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Q_(i),p=X_(f),m=u[p],h=u[f],g=(e,t)=>K_(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ev=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=q_(e,t),u={x:n,y:r},d=Q_(i),f=X_(d),p=u[f],m=u[d],h=q_(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sv.has(J_(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dv=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=q_(e,t),c=await i.detectOverflow(t,s),l=J_(n),u=Y_(n),d=Q_(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=B_(p-c[m],g),y=B_(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*V_(c.left,c.right):S=p-2*V_(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ov(){return typeof window<`u`}function kv(e){return Mv(e)?(e.nodeName||``).toLowerCase():`#document`}function Av(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jv(e){return((Mv(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mv(e){return Ov()?e instanceof Node||e instanceof Av(e).Node:!1}function Nv(e){return Ov()?e instanceof Element||e instanceof Av(e).Element:!1}function Pv(e){return Ov()?e instanceof HTMLElement||e instanceof Av(e).HTMLElement:!1}function Fv(e){return!Ov()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Av(e).ShadowRoot}function Iv(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qv(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lv(e){return/^(table|td|th)$/.test(kv(e))}function Rv(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zv=/transform|translate|scale|rotate|perspective|filter/,Bv=/paint|layout|strict|content/,Vv=e=>!!e&&e!==`none`,Hv;function Uv(e){let t=Nv(e)?qv(e):e;return Vv(t.transform)||Vv(t.translate)||Vv(t.scale)||Vv(t.rotate)||Vv(t.perspective)||!Gv()&&(Vv(t.backdropFilter)||Vv(t.filter))||zv.test(t.willChange||``)||Bv.test(t.contain||``)}function Wv(e){let t=Yv(e);for(;Pv(t)&&!Kv(t);){if(Uv(t))return t;if(Rv(t))return null;t=Yv(t)}return null}function Gv(){return Hv??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Hv}function Kv(e){return/^(html|body|#document)$/.test(kv(e))}function qv(e){return Av(e).getComputedStyle(e)}function Jv(e){return Nv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yv(e){if(kv(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fv(e)&&e.host||jv(e);return Fv(t)?t.host:t}function Xv(e){let t=Yv(e);return Kv(t)?(e.ownerDocument||e).body:Pv(t)&&Iv(t)?t:Xv(t)}function Zv(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xv(e),i=r===e.ownerDocument?.body,a=Av(r);if(i){let e=Qv(a);return t.concat(a,a.visualViewport||[],Iv(r)?r:[],e&&n?Zv(e):[])}return t.concat(r,Zv(r,[],n))}function Qv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $v(e){let t=qv(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Pv(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=H_(n)!==a||H_(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ey(e){return Nv(e)?e:e.contextElement}function ty(e){let t=ey(e);if(!Pv(t))return W_(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$v(t),o=(a?H_(n.width):n.width)/r,s=(a?H_(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ny=W_(0);function ry(e){let t=Av(e);return!Gv()||!t.visualViewport?ny:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Av(e)}function ay(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ey(e),o=W_(1);t&&(r?Nv(r)&&(o=ty(r)):o=ty(e));let s=iy(a,n,r)?ry(a):W_(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Av(a),t=Nv(r)?Av(r):r,n=e,i=Qv(n);for(;i&&t!==n;){let e=ty(i),t=i.getBoundingClientRect(),r=qv(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Av(i),i=Qv(n)}}return fv({width:u,height:d,x:c,y:l})}function oy(e,t){let n=Jv(e).scrollLeft;return t?t.left+n:ay(jv(e)).left+n}function sy(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-oy(e,n),y:n.top+t.scrollTop}}function cy(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jv(r),s=t?Rv(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=W_(1),u=W_(0),d=Pv(r);if((d||!a)&&((kv(r)!==`body`||Iv(o))&&(c=Jv(r)),d)){let e=ay(r);l=ty(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sy(o,c):W_(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ly(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function uy(e){let t=Jv(e),n=e.ownerDocument.body,r=V_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=V_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+oy(e),o=-t.scrollTop;return qv(n).direction===`rtl`&&(a+=V_(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var dy=25;function fy(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Av(e),a=jv(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Gv()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(oy(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=dy&&(s-=o)}return{width:s,height:c,x:l,y:u}}function py(e,t){let n=ay(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ty(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function my(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fy(e,n,t);else if(t===`document`)r=uy(jv(e));else if(Nv(t))r=py(t,n);else{let n=ry(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fv(r)}function hy(e,t){let n=t.get(e);if(n)return n;let r=Zv(e,[],!1).filter(e=>Nv(e)&&kv(e)!==`body`),i=null,a=qv(e).position===`fixed`,o=a?Yv(e):e;for(;Nv(o)&&!Kv(o);){let e=qv(o),t=Uv(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Yv(o)}return t.set(e,r),r}function gy(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rv(t)?[]:hy(t,this._c):[].concat(n),r],o=my(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=my(t,a[e],i);s=V_(n.top,s),c=B_(n.right,c),l=B_(n.bottom,l),u=V_(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _y(e){let{width:t,height:n}=$v(e);return{width:t,height:n}}function vy(e,t,n){let r=Pv(t),i=jv(t),a=n===`fixed`,o=ay(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=W_(0);if((r||!a)&&((kv(t)!==`body`||Iv(i))&&(s=Jv(t)),r)){let e=ay(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=oy(i));let l=i&&!r&&!a?sy(i,s):W_(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function yy(e){return qv(e).position===`static`}function by(e,t){if(!Pv(e)||qv(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jv(e)===n&&(n=n.ownerDocument.body),n}function xy(e,t){let n=Av(e);if(Rv(e))return n;if(!Pv(e)){let t=Yv(e);for(;t&&!Kv(t);){if(Nv(t)&&!yy(t))return t;t=Yv(t)}return n}let r=by(e,t);for(;r&&Lv(r)&&yy(r);)r=by(r,t);return r&&Kv(r)&&yy(r)&&!Uv(r)?n:r||Wv(e)||n}var Sy=async function(e){let t=this.getOffsetParent||xy,n=this.getDimensions,r=await n(e.floating);return{reference:vy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cy(e){return qv(e).direction===`rtl`}var wy={convertOffsetParentRelativeRectToViewportRelativeRect:cy,getDocumentElement:jv,getClippingRect:gy,getOffsetParent:xy,getElementRects:Sy,getClientRects:ly,getDimensions:_y,getScale:ty,isElement:Nv,isRTL:Cy};function Ty(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ey(e,t,n){let r=null,i,a=jv(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=U_(d),h=U_(a.clientWidth-(u+f)),g=U_(a.clientHeight-(d+p)),_=U_(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:V_(0,B_(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ty(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Av(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Dy(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ey(e),u=i||a?[...l?Zv(l):[],...t?Zv(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ey(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?ay(e):null;c&&g();function g(){let t=ay(e);h&&!Ty(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Oy=wv,ky=Tv,Ay=vv,jy=Dv,My=xv,Ny=_v,Py=Ev,Fy=(e,t,n)=>{let r=new Map,i=n??{},a={...wy,...i.platform,_c:r};return gv(e,t,{...i,platform:a})},Iy=typeof document<`u`?m.useLayoutEffect:function(){};function Ly(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ly(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ly(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ry(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zy(e,t){let n=Ry(e);return Math.round(t*n)/n}function By(e){let t=m.useRef(e);return Iy(()=>{t.current=e}),t}function Vy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);Ly(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=By(c),O=By(i),k=By(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Fy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ly(T.current,t)&&(T.current=t,Dp.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Iy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Iy(()=>(j.current=!0,()=>{j.current=!1}),[]),Iy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=m.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=zy(te.floating,u.x),r=zy(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ry(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:ee,elements:te,floatingStyles:ne}),[u,A,ee,te,ne])}var Hy=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ny({element:r.current,padding:i}).fn(n):r?Ny({element:r,padding:i}).fn(n):{}}}},Uy=(e,t)=>{let n=Oy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wy=(e,t)=>{let n=ky(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gy=(e,t)=>({fn:Py(e).fn,options:[e,t]}),Ky=(e,t)=>{let n=Ay(e);return{name:n.name,fn:n.fn,options:[e,t]}},qy=(e,t)=>{let n=jy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jy=(e,t)=>{let n=My(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yy=(e,t)=>{let n=Hy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xy=Object.defineProperty,Zy=(e,t)=>Xy(e,`name`,{value:t,configurable:!0});function Qy(e){let[t,n]=m.useState(void 0);return cp(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}Zy(Qy,`useSize`);var $y=Object.defineProperty,eb=(e,t)=>$y(e,`name`,{value:t,configurable:!0}),tb=`Popper`,[nb,rb]=op(tb),[ib,ab]=nb(tb),ob=eb(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(ib,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),sb=`PopperAnchor`,cb=m.forwardRef(eb(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=ab(sb,n),o=m.useRef(null),s=a.onAnchorChange,c=rp(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&hb(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Gp.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),lb=`PopperContent`,[ub,db]=nb(lb),fb=m.forwardRef(eb(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=ab(lb,n),[y,b]=m.useState(null),x=rp(t,b),[S,C]=m.useState(null),w=Qy(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(pb),altBoundary:A},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:ie}=Vy({strategy:`fixed`,placement:D,whileElementsMounted:eb((...e)=>Dy(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Uy({mainAxis:i+E,alignmentAxis:o}),c&&Wy({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Gy():void 0,...j}),c&&Ky({...j}),qy({...j,apply:eb(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&Yy({element:S,padding:s}),mb({arrowWidth:T,arrowHeight:E}),f&&Jy({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),ae=v.setPlacementState;cp(()=>(ae(ne),()=>{ae(void 0)}),[ne,ae]);let[M,oe]=hb(ne),se=Yp(g);cp(()=>{re&&se?.()},[re,se]);let ce=ie.arrow?.x,le=ie.arrow?.y,ue=ie.arrow?.centerOffset!==0,[de,fe]=m.useState();return cp(()=>{y&&fe(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(ub,{scope:n,placedSide:M,placedAlign:oe,onArrowChange:C,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,h.jsx)(Gp.div,{"data-side":M,"data-align":oe,..._,ref:x,style:{..._.style,animation:re?_.style?.animation:`none`}})})})},`PopperContent`));function pb(e){return e!==null}eb(pb,`isNotNull`);var mb=eb(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=hb(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function hb(e){let[t,n=`center`]=e.split(`-`);return[t,n]}eb(hb,`getSideAndAlignFromPlacement`);var gb=ob,_b=cb,vb=fb,yb=Object.defineProperty,bb=(e,t)=>yb(e,`name`,{value:t,configurable:!0}),xb=!1;function Sb(){let[e,t]=m.useState(xb);return m.useEffect(()=>{xb||(xb=!0,t(!0))},[]),e}bb(Sb,`useIsHydrated`);var Cb=m.useSyncExternalStore;function wb(){return()=>{}}bb(wb,`subscribe`);function Tb(){return Cb(wb,()=>!0,()=>!1)}bb(Tb,`useIsHydratedModern`);var Eb=typeof Cb==`function`?Tb:Sb,Db=Object.defineProperty,Ob=(e,t)=>Db(e,`name`,{value:t,configurable:!0}),kb=`rovingFocusGroup.onEntryFocus`,Ab={bubbles:!1,cancelable:!0},jb=`RovingFocusGroup`,[Mb,Nb,Pb]=w_(jb),[Fb,Ib]=op(jb,[Pb]),[Lb,Rb]=Fb(jb),zb=m.forwardRef(Ob(function(e,t){return(0,h.jsx)(Mb.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Mb.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Bb,{...e,ref:t})})})},`RovingFocusGroup`)),Bb=m.forwardRef(Ob(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=rp(t,f),g=R_(a),[_,v]=Sp({prop:o,defaultProp:s??null,onChange:c,caller:jb}),[y,b]=m.useState(!1),x=Yp(l),S=Nb(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(kb,x),()=>e.removeEventListener(kb,x)},[x]),(0,h.jsx)(Lb,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(Gp.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{C.current=!0}),onFocus:J(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(kb,Ab);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Kb([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:J(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Vb=`RovingFocusGroupItem`,Hb=m.forwardRef(Ob(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=pp(),l=a||c,u=Rb(Vb,n),d=u.currentTabStopId===l,f=Nb(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=Eb();return cp(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(Mb.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Gp.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Gb(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?qb(n,r+1):n.slice(r+1)}setTimeout(()=>Kb(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Ub={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Wb(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Ob(Wb,`getDirectionAwareKey`);function Gb(e,t,n){let r=Wb(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ub[r]}Ob(Gb,`getFocusIntent`);function Kb(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Ob(Kb,`focusFirst`);function qb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ob(qb,`wrapArray`);var Jb=zb,Yb=Hb,Xb=Object.defineProperty,Zb=(e,t)=>Xb(e,`name`,{value:t,configurable:!0}),Qb=[`Enter`,` `],$b=[`ArrowDown`,`PageUp`,`Home`],ex=[`ArrowUp`,`PageDown`,`End`],tx=[...$b,...ex];[...Qb],[...Qb];var nx=`Menu`,[rx,ix,ax]=w_(nx),[ox,sx]=op(nx,[ax,rb,Ib]),cx=rb(),lx=Ib(),[ux,dx]=ox(nx),[fx,px]=ox(nx),mx=Zb(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=cx(t),[c,l]=m.useState(null),u=m.useRef(!1),d=Yp(a),f=R_(i);return m.useEffect(()=>{let e=Zb(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Zb(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=Zb(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(gb,{...s,children:(0,h.jsx)(ux,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(fx,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),hx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e,i=cx(n);return(0,h.jsx)(_b,{...i,...r,ref:t})},`MenuAnchor`)),gx=`MenuPortal`,[_x,vx]=ox(gx,{forceMount:void 0}),yx=Zb(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=dx(gx,t);return(0,h.jsx)(_x,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`MenuPortal`),bx=`MenuContent`,[xx,Sx]=ox(bx),Cx=m.forwardRef(Zb(function(e,t){let n=vx(bx,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=dx(bx,e.__scopeMenu),o=px(bx,e.__scopeMenu);return(0,h.jsx)(rx.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(Mm,{present:r||a.open,children:(0,h.jsx)(rx.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(wx,{...i,ref:t}):(0,h.jsx)(Tx,{...i,ref:t})})})})},`MenuContent`)),wx=m.forwardRef(Zb(function(e,t){let n=dx(bx,e.__scopeMenu),r=m.useRef(null),i=rp(t,r);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Dx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Tx=m.forwardRef(Zb(function(e,t){let n=dx(bx,e.__scopeMenu);return(0,h.jsx)(Dx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ex=Ap(`MenuContent.ScrollLock`),Dx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=dx(bx,n),y=px(bx,n),b=cx(n),x=lx(n),S=ix(n),[C,w]=m.useState(null),T=m.useRef(null),E=rp(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),ee=m.useRef(0),te=g?Qh:m.Fragment,ne=g?{as:Ex,allowPinchZoom:!0}:void 0,re=Zb(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Gx(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Zb((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),Um();let ie=m.useCallback(e=>j.current===A.current?.side&&qx(e,A.current?.area),[]);return(0,h.jsx)(xx,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),onItemLeave:m.useCallback(e=>{ie(e)||(T.current?.focus(),w(null))},[ie]),onTriggerLeave:m.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(te,{...ne,children:(0,h.jsx)(hm,{asChild:!0,trapped:i,onMountAutoFocus:J(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(Jb,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:J(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(vb,{role:`menu`,"aria-orientation":`vertical`,"data-state":Bx(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&re(e.key));let i=T.current;if(e.target!==i||!tx.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);ex.includes(e.key)&&a.reverse(),Ux(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:J(e.onPointerMove,Jx(e=>{let t=e.target,n=ee.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ee.current?`right`:`left`;j.current=t,ee.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),Ox=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gp.div,{...r,ref:t})},`MenuLabel`)),kx=`MenuItem`,Ax=`menu.itemSelect`,jx=m.forwardRef(Zb(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=px(kx,e.__scopeMenu),s=Sx(kx,e.__scopeMenu),c=rp(t,a),l=m.useRef(!1),u=Zb(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ax,{bubbles:!0,cancelable:!0});e.addEventListener(Ax,e=>r?.(e),{once:!0}),Kp(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(Mx,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Qb.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Mx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Sx(kx,n),s=lx(n),c=m.useRef(null),l=rp(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(rx.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(Yb,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Gp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,Jx(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,Jx(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Nx,Px]=ox(`MenuRadioGroup`,{value:void 0,onValueChange:Zb(()=>{},`onValueChange`)}),[Fx,Ix]=ox(`MenuItemIndicator`,{checked:!1}),Lx=m.forwardRef(Zb(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Rx,zx]=ox(`MenuSub`);function Bx(e){return e?`open`:`closed`}Zb(Bx,`getOpenState`);function Vx(e){return e===`indeterminate`}Zb(Vx,`isIndeterminate`);function Hx(e){return Vx(e)?`indeterminate`:e?`checked`:`unchecked`}Zb(Hx,`getCheckedState`);function Ux(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Zb(Ux,`focusFirst`);function Wx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Zb(Wx,`wrapArray`);function Gx(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Wx(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Zb(Gx,`getNextMatch`);function Kx(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Zb(Kx,`isPointInPolygon`);function qx(e,t){return t?Kx({x:e.clientX,y:e.clientY},t):!1}Zb(qx,`isPointerInGraceArea`);function Jx(e){return t=>t.pointerType===`mouse`?e(t):void 0}Zb(Jx,`whenMouse`);var Yx=mx,Xx=hx,Zx=yx,Qx=Cx,$x=Ox,eS=jx,tS=Lx,nS=Object.defineProperty,rS=(e,t)=>nS(e,`name`,{value:t,configurable:!0}),iS=`DropdownMenu`,[aS,oS]=op(iS,[sx]),sS=sx(),[cS,lS]=aS(iS),uS=rS(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=sS(t),l=m.useRef(null),[u,d]=Sp({prop:i,defaultProp:a??!1,onChange:o,caller:iS});return(0,h.jsx)(cS,{scope:t,triggerId:pp(),triggerRef:l,contentId:pp(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(Yx,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),dS=`DropdownMenuTrigger`,fS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=lS(dS,n),o=sS(n),s=rp(t,a.triggerRef);return(0,h.jsx)(Xx,{asChild:!0,...o,children:(0,h.jsx)(Gp.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),pS=rS(e=>{let{__scopeDropdownMenu:t,...n}=e,r=sS(t);return(0,h.jsx)(Zx,{...r,...n})},`DropdownMenuPortal`),mS=`DropdownMenuContent`,hS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=lS(mS,n),a=sS(n),o=m.useRef(!1);return(0,h.jsx)(Qx,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),gS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)($x,{...i,...r,ref:t})},`DropdownMenuLabel`)),_S=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)(eS,{...i,...r,ref:t})},`DropdownMenuItem`)),vS=m.forwardRef(rS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=sS(n);return(0,h.jsx)(tS,{...i,...r,ref:t})},`DropdownMenuSeparator`)),yS=uS,bS=fS,xS=pS,SS=hS,CS=gS,wS=_S,TS=vS,ES=`z-50 overflow-hidden rounded-[8px] border border-rule bg-surface py-1 shadow-pop outline-none data-[state=open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function DS({trigger:e,children:t,width:n=220,align:r=`start`,side:i=`bottom`,sideOffset:a=6,open:o,onOpenChange:s}){return(0,h.jsxs)(yS,{open:o,onOpenChange:s,modal:!1,children:[(0,h.jsx)(bS,{asChild:!0,children:e}),(0,h.jsx)(xS,{children:(0,h.jsx)(SS,{align:r,side:i,sideOffset:a,collisionPadding:12,className:ES,style:{width:n},children:t})})]})}var OS=(e,t)=>X(`flex min-h-9 w-full cursor-pointer items-center gap-2.5 border-0 px-3 py-1.5 text-left text-[13.5px] outline-none select-none`,`data-[highlighted]:bg-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,t?`bg-soft`:`bg-transparent`,e?`text-danger-text`:`text-ink`);function kS({children:e,onSelect:t,danger:n,active:r,disabled:i,hint:a}){return(0,h.jsxs)(wS,{disabled:i,onSelect:t,className:OS(n,r),children:[e,a?(0,h.jsx)(`span`,{className:`ml-auto pl-3 text-[12px] text-muted`,children:a}):null]})}function AS(){return(0,h.jsx)(TS,{className:`my-1 h-px bg-rule`})}function jS({children:e}){return(0,h.jsx)(CS,{className:`px-3 pt-1.5 pb-1 text-[12px] text-muted`,children:e})}var MS=[{value:`system`,label:`System`,icon:`monitor`},{value:`light`,label:`Light`,icon:`sun`},{value:`dark`,label:`Dark`,icon:`moon`}];function NS(){let e=n_(),t=r_();return(0,h.jsxs)(DS,{align:`end`,width:180,trigger:(0,h.jsx)(y_,{icon:t===`dark`?`moon`:`sun`,label:`Appearance`}),children:[(0,h.jsx)(jS,{children:`Appearance`}),MS.map(t=>(0,h.jsxs)(kS,{active:e===t.value,onSelect:()=>t_(t.value),children:[(0,h.jsx)(Z,{name:t.icon,size:15,className:`text-ink2`}),t.label,e===t.value?(0,h.jsx)(Z,{name:`check`,size:15,className:`ml-auto text-ink2`}):null]},t.value))]})}function PS({size:e=24}){return(0,h.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,h.jsx)(`rect`,{width:`32`,height:`32`,rx:`7`,className:`fill-primary`}),(0,h.jsx)(`rect`,{x:`7`,y:`7`,width:`8`,height:`11`,rx:`1.5`,className:`fill-primary-ink`}),(0,h.jsx)(`rect`,{x:`17`,y:`7`,width:`8`,height:`6`,rx:`1.5`,fill:`#f0a040`}),(0,h.jsx)(`rect`,{x:`17`,y:`15`,width:`8`,height:`10`,rx:`1.5`,className:`fill-primary-ink`}),(0,h.jsx)(`rect`,{x:`7`,y:`20`,width:`8`,height:`5`,rx:`1.5`,className:`fill-primary-ink`})]})}function FS({name:e}){return(0,h.jsxs)(Lf,{href:`/`,className:`flex min-w-0 items-center gap-2 text-[14px] font-semibold text-ink no-underline`,children:[(0,h.jsx)(PS,{}),(0,h.jsx)(`span`,{className:`truncate`,children:e??`Design`})]})}function IS({children:e,className:t}){return(0,h.jsx)(`header`,{className:X(`sticky top-0 z-30 flex h-[52px] shrink-0 items-center gap-3 border-b border-rule bg-surface px-4`,t),children:e})}var LS=[{to:`/`,label:`Canvases`,match:e=>e===`/`||e.startsWith(`/c/`)},{to:`/system`,label:`Design system`,match:e=>e.startsWith(`/system`)}];function RS({location:e}){let t=(0,m.useRef)(null),n=LS.findIndex(t=>t.match(e)),[r,i]=(0,m.useState)(null);return(0,m.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let r=()=>{let t=e.children[n];if(!t?.offsetWidth){i(null);return}let r=t.offsetLeft+10,a=t.offsetWidth-20;i(e=>e?.tab===n&&e.x===r&&e.width===a?e:{tab:n,x:r,width:a,slide:e!==null&&e.tab!==n})};r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[n]),(0,h.jsxs)(`nav`,{ref:t,className:`relative flex h-[52px] items-stretch gap-0.5 max-md:hidden`,children:[LS.map((e,t)=>(0,h.jsx)(Lf,{href:e.to,"aria-current":t===n?`page`:void 0,className:X(`flex items-center px-2.5 text-[14px] no-underline transition-colors`,t===n?`font-medium text-ink`:`text-ink2 hover:text-ink`),children:e.label},e.to)),r?(0,h.jsx)($d.span,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 h-[2px] bg-action`,initial:!1,animate:{x:r.x,width:r.width},transition:r.slide?{type:`spring`,stiffness:520,damping:42}:{duration:0}}):null]})}function zS(){let e=zg().data,[t]=jf();return(0,h.jsxs)(IS,{children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-6`,children:[(0,h.jsx)(FS,{name:e?.name}),(0,h.jsx)(RS,{location:t})]}),(0,h.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,h.jsx)(p_,{}),(0,h.jsx)(NS,{})]})]})}var BS=Object.defineProperty,VS=(e,t)=>BS(e,`name`,{value:t,configurable:!0}),HS=`Popover`,[US,WS]=op(HS,[rb]),GS=rb(),[KS,qS]=US(HS),JS=VS(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=GS(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Sp({prop:r,defaultProp:i??!1,onChange:a,caller:HS});return(0,h.jsx)(gb,{...s,children:(0,h.jsx)(KS,{scope:t,contentId:pp(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),YS=`PopoverTrigger`,XS=m.forwardRef(VS(function(e,t){let{__scopePopover:n,...r}=e,i=qS(YS,n),a=GS(n),o=rp(t,i.triggerRef),s=(0,h.jsx)(Gp.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":sC(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(_b,{asChild:!0,...a,children:s})},`PopoverTrigger`)),ZS=`PopoverPortal`,[QS,$S]=US(ZS,{forceMount:void 0}),eC=VS(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=qS(ZS,t);return(0,h.jsx)(QS,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),tC=`PopoverContent`,nC=m.forwardRef(VS(function(e,t){let n=$S(tC,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=qS(tC,e.__scopePopover);return(0,h.jsx)(Mm,{present:r||a.open,children:a.modal?(0,h.jsx)(iC,{...i,ref:t}):(0,h.jsx)(aC,{...i,ref:t})})},`PopoverContent`)),rC=Ap(`PopoverContent.RemoveScroll`),iC=m.forwardRef(VS(function(e,t){let n=qS(tC,e.__scopePopover),r=m.useRef(null),i=rp(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return sg(e)},[]),(0,h.jsx)(Qh,{as:rC,allowPinchZoom:!0,children:(0,h.jsx)(oC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),aC=m.forwardRef(VS(function(e,t){let n=qS(tC,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(oC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),oC=m.forwardRef(VS(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=qS(tC,n),p=GS(n);return Um(),(0,h.jsx)(hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(vb,{"data-state":sC(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function sC(e){return e?`open`:`closed`}VS(sC,`getState`);var cC=JS,lC=XS,uC=eC,dC=nC,fC=new qg([]),pC=1;function mC(e,t){let n=pC++;fC.set(r=>[...r.slice(-2),{id:n,title:e,text:t}]),setTimeout(()=>fC.set(e=>e.filter(e=>e.id!==n)),2200)}function hC(){let e=Jg(fC);return(0,h.jsx)(`div`,{className:`pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col items-center gap-2`,children:(0,h.jsx)(V,{children:e.map(e=>(0,h.jsxs)($d.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,transition:{duration:.12}},transition:{type:`spring`,stiffness:520,damping:40},className:`flex max-w-[420px] items-center gap-2.5 rounded-[8px] border border-rule bg-surface px-3 py-2 text-[13px] text-ink shadow-pop`,children:[(0,h.jsx)(Z,{name:`check`,size:15,className:`text-ok-text`}),(0,h.jsx)(`span`,{className:`font-medium`,children:e.title}),e.text?(0,h.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.text}):null]},e.id))})})}async function gC(e,t=`Copied`){try{await navigator.clipboard.writeText(e),mC(t,e.length>64?void 0:e)}catch{mC(`Could not copy`,`The browser blocked clipboard access`)}}var _C=new Map;window.addEventListener(`message`,e=>{let t=e.data;if(t?.source===`design-runtime`&&e.source)for(let n of _C.get(e.source)??[])n(t)});function vC(e,t){let n=null,r=()=>{if(!n)return;let e=_C.get(n);e?.delete(t),e?.size||_C.delete(n),n=null},i=()=>{if(r(),n=e.contentWindow,!n)return;let i=_C.get(n)??new Set;i.add(t),_C.set(n,i)};return i(),e.addEventListener(`load`,i),()=>{e.removeEventListener(`load`,i),r()}}function yC(e,t){e?.contentWindow?.postMessage({source:`design-viewer`,...t},`*`)}function bC(e){yC(e,{type:`canvas`})}function xC(e,t){yC(e,{type:`theme`,theme:t})}function SC(e){e&&(e.src=e.src)}var CC=(()=>{if(Mg)return``;let{protocol:e,hostname:t,port:n}=window.location,r=t===`localhost`?`127.0.0.1`:t===`127.0.0.1`?`localhost`:null;return r?`${e}//${r}${n?`:${n}`:``}`:``})();function wC(e,t,n){let[r=``,i=``]=e.split(`?`),a=new URLSearchParams(i);a.set(`theme`,t);for(let[e,t]of Object.entries(n??{}))a.set(e,t);return`${r.startsWith(`/`)?CC:``}${r}?${a.toString()}`}function TC(e){return new URL(e,document.baseURI).toString()}function EC(e,t,n){let r=zg().data,i=Vg(!!r?.system).data?.tokens,[a,o]=(0,m.useState)(null),s=(0,m.useRef)({enabled:t,tokens:i});s.current={enabled:t,tokens:i};let c=(0,m.useRef)(n.onEscape);c.current=n.onEscape;let l=(0,m.useRef)(e);l.current=e;let u=(0,m.useRef)(new Map),d=(e,t=!1)=>{let{enabled:n,tokens:r}=s.current,i=u.current.get(e);(t||i?.on!==n||i.tokens!==r)&&(u.current.set(e,{on:n,tokens:r}),yC(e,{type:`inspect`,on:n,tokens:n?r??[]:void 0}))};(0,m.useEffect)(()=>{for(let t of e)d(t);for(let t of u.current.keys())e.includes(t)||u.current.delete(t)},[e,t,i]),(0,m.useEffect)(()=>{let t=e.map(e=>vC(e,t=>{if(t.type===`ready`)s.current.enabled?d(e,!0):u.current.set(e,{on:!1});else if(t.type===`inspect`){if(t.info){for(let t of l.current)t!==e&&yC(t,{type:`inspect-select`,ref:null});o({info:t.info,frame:e})}else o(t=>t?.frame===e?null:t)}else t.type===`inspect-escape`&&c.current()}));return()=>{for(let e of t)e()}},[e]);let f=a&&e.includes(a.frame)?a.frame:null;return{info:f?a.info:null,frame:f,select(e){if(e===null){for(let e of l.current)yC(e,{type:`inspect-select`,ref:null});o(null)}else a&&yC(a.frame,{type:`inspect-select`,ref:e})}}}function DC(e){let[t,n]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let t=e=>e===`Meta`||e===`Control`,r=!1,i=!1,a,o=()=>{r=!1,clearTimeout(a),n(!1)},s=e=>{if(t(e)){if(r)return;r=!0,i=!1,a=setTimeout(()=>{r&&!i&&n(!0)},150)}else r&&(i=!0,clearTimeout(a),n(!1))},c=e=>s(e.key),l=e=>{t(e.key)&&o()};window.addEventListener(`keydown`,c,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,o);let u=e.map(e=>vC(e,e=>{e.type===`key`?e.down?s(e.name):t(e.name)&&o():e.type===`blur`&&o()}));return()=>{window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,o);for(let e of u)e();clearTimeout(a)}},[e]),t}function OC({title:e,children:t,right:n}){return(0,h.jsxs)(`section`,{className:`border-t border-rule pb-2 first:border-t-0`,children:[(0,h.jsxs)(`div`,{className:`flex h-9 items-center justify-between px-4 text-[12px] font-medium text-muted`,children:[e,n]}),t]})}function kC({label:e,children:t}){return(0,h.jsxs)(`div`,{className:`grid min-h-7 grid-cols-[92px_minmax(0,1fr)] items-center gap-x-3 px-4 py-0.5 text-[12.5px]`,children:[(0,h.jsx)(`span`,{className:`text-muted`,children:e}),(0,h.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-ink`,children:t})]})}function AC({name:e}){return e?(0,h.jsx)(`button`,{type:`button`,onClick:()=>void gC(`var(${e})`,`Token copied`),title:`Copy var()`,className:`shrink-0 cursor-pointer truncate rounded-[4px] border-0 bg-action-soft px-1.5 py-px font-mono text-[11px] text-action`,children:e}):null}function jC({children:e,title:t}){return(0,h.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[12px]`,title:t,children:e})}function MC({label:e,color:t}){return(0,h.jsxs)(kC,{label:e,children:[(0,h.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:t.css}}),(0,h.jsx)(jC,{title:t.css,children:t.value}),(0,h.jsx)(AC,{name:t.token})]})}var NC=e=>e?String(e):`–`;function PC({label:e,values:t,className:n,children:r}){let[i,a,o,s]=t;return(0,h.jsxs)(`div`,{className:X(`relative grid grid-cols-[28px_minmax(0,1fr)_28px] grid-rows-[20px_auto_20px] rounded-[4px]`,n),children:[(0,h.jsx)(`span`,{className:`absolute top-1 left-1.5 text-[9.5px] tracking-wide text-muted uppercase`,children:e}),(0,h.jsx)(`span`,{className:`col-start-2 self-center text-center`,children:NC(i)}),(0,h.jsx)(`span`,{className:`row-start-2 self-center text-center`,children:NC(s)}),(0,h.jsx)(`div`,{className:`row-start-2 col-start-2`,children:r}),(0,h.jsx)(`span`,{className:`row-start-2 col-start-3 self-center text-center`,children:NC(a)}),(0,h.jsx)(`span`,{className:`row-start-3 col-start-2 self-center text-center`,children:NC(o)})]})}function FC({info:e}){let t={w:Math.max(0,e.rect.w-e.border[1]-e.border[3]-e.padding[1]-e.padding[3]),h:Math.max(0,e.rect.h-e.border[0]-e.border[2]-e.padding[0]-e.padding[2])};return(0,h.jsx)(`div`,{className:`px-4 pt-1 pb-2 font-mono text-[11px] text-ink2`,children:(0,h.jsx)(PC,{label:`margin`,values:e.margin,className:`border border-dashed border-rule-strong bg-[#f6b26b]/15`,children:(0,h.jsx)(PC,{label:`border`,values:e.border,className:`border border-rule-strong bg-[#f9e27d]/15`,children:(0,h.jsx)(PC,{label:`padding`,values:e.padding,className:`border border-rule-strong bg-[#93c47d]/20`,children:(0,h.jsxs)(`div`,{className:`flex h-8 items-center justify-center rounded-[3px] border border-rule-strong bg-[#6fa8dc]/25 text-ink`,children:[Math.round(t.w*100)/100,` × `,Math.round(t.h*100)/100]})})})})})}function IC({info:e,onSelect:t}){return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-4 pb-2`,children:[e.path.slice(-4).map((e,n)=>(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`cursor-pointer rounded-[4px] border-0 bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2 hover:text-ink`,children:e.label}),(0,h.jsx)(Z,{name:`chevron-right`,size:11,className:`text-muted`})]},n)),(0,h.jsx)(`span`,{className:`rounded-[4px] bg-action-soft px-1.5 py-0.5 font-mono text-[11px] text-action`,children:e.label})]})}function LC({info:e,onSelect:t,onClose:n,active:r}){return(0,h.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[320px] shrink-0 flex-col overflow-hidden border-l border-rule bg-surface`,children:[(0,h.jsxs)(`div`,{className:`flex h-[46px] shrink-0 items-center justify-between border-b border-rule pr-2 pl-4`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-semibold`,children:[(0,h.jsx)(Z,{name:`pointer`,size:15,className:`text-action`}),` Inspect`]}),(0,h.jsx)(y_,{icon:`x`,label:`Close inspector (I)`,onClick:n})]}),e?(0,h.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto`,children:[(0,h.jsxs)(OC,{title:`Element`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2`,children:[(0,h.jsx)(`div`,{className:`flex min-w-0 items-baseline gap-1.5`,children:e.component?.owners[0]?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:[`<`,e.component.owners[0],`>`]}),(0,h.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.tag})]}):(0,h.jsx)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:e.label})}),e.component&&e.component.owners.length>1?(0,h.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[`in `,e.component.owners.slice(1).join(` ← `)]}):null,e.component?.file?(0,h.jsx)(`button`,{type:`button`,onClick:()=>void gC(e.component.file,`Path copied`),className:`w-fit max-w-full cursor-pointer truncate border-0 bg-transparent p-0 text-left font-mono text-[11.5px] text-muted hover:text-ink2`,title:`Copy path`,children:e.component.file}):null,e.text?(0,h.jsxs)(`span`,{className:`line-clamp-2 text-[12.5px] text-ink2`,children:[`“`,e.text,`”`]}):null]}),(0,h.jsx)(IC,{info:e,onSelect:t})]}),(0,h.jsxs)(OC,{title:`Box`,children:[(0,h.jsx)(FC,{info:e}),(0,h.jsx)(kC,{label:`Size`,children:(0,h.jsxs)(jC,{children:[e.rect.w,` × `,e.rect.h]})}),(0,h.jsx)(kC,{label:`Position`,children:(0,h.jsxs)(jC,{children:[`x `,e.rect.x,` · y `,e.rect.y]})})]}),e.layout.length?(0,h.jsx)(OC,{title:`Layout`,children:e.layout.map(([e,t])=>(0,h.jsx)(kC,{label:e,children:(0,h.jsx)(jC,{title:t,children:t})},e))}):null,e.typography?(0,h.jsxs)(OC,{title:`Typography`,children:[(0,h.jsxs)(kC,{label:`Font`,children:[(0,h.jsx)(jC,{title:e.typography.family,children:e.typography.family.split(`,`)[0]?.replace(/["']/g,``)}),(0,h.jsx)(AC,{name:e.typography.familyToken})]}),(0,h.jsxs)(kC,{label:`Size`,children:[(0,h.jsxs)(jC,{children:[e.typography.size,` / `,e.typography.lineHeight]}),(0,h.jsx)(AC,{name:e.typography.sizeToken})]}),(0,h.jsx)(kC,{label:`Weight`,children:(0,h.jsx)(jC,{children:e.typography.weight})}),e.typography.letterSpacing===`normal`?null:(0,h.jsx)(kC,{label:`Tracking`,children:(0,h.jsx)(jC,{children:e.typography.letterSpacing})}),(0,h.jsx)(MC,{label:`Color`,color:e.typography.color}),e.typography.align===`start`?null:(0,h.jsx)(kC,{label:`Align`,children:(0,h.jsx)(jC,{children:e.typography.align})}),e.typography.transform?(0,h.jsx)(kC,{label:`Transform`,children:(0,h.jsx)(jC,{children:e.typography.transform})}):null]}):null,Object.values(e.appearance).some(Boolean)?(0,h.jsxs)(OC,{title:`Appearance`,children:[e.appearance.background?(0,h.jsx)(MC,{label:`Background`,color:e.appearance.background}):null,e.appearance.backgroundImage?(0,h.jsx)(kC,{label:`Image`,children:(0,h.jsx)(jC,{title:e.appearance.backgroundImage,children:e.appearance.backgroundImage})}):null,e.appearance.border?(0,h.jsxs)(kC,{label:`Border`,children:[(0,h.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:e.appearance.border.color.css}}),(0,h.jsxs)(jC,{children:[e.appearance.border.width,` `,e.appearance.border.style,` `,e.appearance.border.color.value]}),(0,h.jsx)(AC,{name:e.appearance.border.color.token})]}):null,e.appearance.radius?(0,h.jsxs)(kC,{label:`Radius`,children:[(0,h.jsx)(jC,{children:e.appearance.radius.value}),(0,h.jsx)(AC,{name:e.appearance.radius.token})]}):null,e.appearance.shadow?(0,h.jsxs)(kC,{label:`Shadow`,children:[(0,h.jsx)(jC,{title:e.appearance.shadow.value,children:e.appearance.shadow.value}),(0,h.jsx)(AC,{name:e.appearance.shadow.token})]}):null,e.appearance.opacity?(0,h.jsx)(kC,{label:`Opacity`,children:(0,h.jsx)(jC,{children:e.appearance.opacity})}):null]}):null,e.classes.length?(0,h.jsx)(OC,{title:`Classes`,right:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void gC(e.classes.join(` `),`Classes copied`),className:`cursor-pointer border-0 bg-transparent text-[12px] text-muted hover:text-ink2`,children:`Copy`}),children:(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 px-4 pb-1`,children:e.classes.map(e=>(0,h.jsx)(`span`,{className:`rounded-[4px] bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2`,children:e},e))})}):null,e.attributes.length?(0,h.jsx)(OC,{title:`Attributes`,children:e.attributes.map(([e,t])=>(0,h.jsx)(kC,{label:e,children:(0,h.jsx)(jC,{title:t,children:t})},e))}):null,e.children.length?(0,h.jsx)(OC,{title:`Children · ${e.children.length}`,children:(0,h.jsx)(`div`,{className:`flex flex-col px-2 pb-1`,children:e.children.map((e,n)=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`flex h-7 cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left font-mono text-[12px] text-ink2 hover:bg-soft2`,children:[(0,h.jsx)(Z,{name:`chevron-right`,size:12,className:`text-muted`}),(0,h.jsx)(`span`,{className:`truncate`,children:e.label})]},n))})}):null]}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-10 text-center`,children:[(0,h.jsx)(Z,{name:`pointer`,size:22,className:`text-muted`}),(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:r?`Click an element in any screen.`:`Hold ${d_} to highlight, click to inspect.`}),(0,h.jsx)(`span`,{className:`text-[12.5px] leading-[1.5] text-muted`,children:`Hover shows margin, padding and content. Clicks go to the inspector, not the screen.`}),(0,h.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,h.jsx)(a_,{children:`I`}),` toggle · hold `,(0,h.jsx)(a_,{children:d_}),` · `,(0,h.jsx)(a_,{children:`esc`}),` clear`]})]}),e?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-rule bg-soft px-4 py-2.5`,children:(0,h.jsx)(g_,{icon:`copy`,onClick:()=>void gC(e.css,`CSS copied`),className:`grow`,children:`Copy CSS`})}):null]})}var RC={neutral:`bg-soft2 text-ink2`,action:`bg-action-soft text-action`,ok:`bg-ok-soft text-ok-text`,danger:`bg-danger-soft text-danger-text`};function zC({tone:e=`neutral`,children:t,className:n}){return(0,h.jsx)(`span`,{className:X(`inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-[6px] px-2 text-[12px] font-medium`,RC[e],n),children:t})}function BC({value:e,tone:t=`neutral`}){return(0,h.jsx)(`span`,{className:X(`inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[4px] px-[5px] text-[11.5px] font-semibold tabular`,t===`action`?`bg-action-soft text-action`:t===`danger`?`bg-danger-soft text-danger-text`:`bg-soft2 text-ink2`),children:e})}function VC({children:e,className:t,style:n}){return(0,h.jsx)(`section`,{className:X(`min-w-0 shrink-0 overflow-hidden rounded-[10px] border border-rule bg-surface`,t),style:n,children:e})}function HC({title:e,count:t,sub:n,right:r,as:i=`h2`}){return(0,h.jsxs)(`div`,{className:`flex min-h-[46px] items-center justify-between gap-3 px-4`,children:[(0,h.jsxs)(i,{className:`m-0 flex min-w-0 items-center gap-2 whitespace-nowrap text-[14px] font-semibold`,children:[e,t===void 0?null:(0,h.jsx)(BC,{value:t}),n?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] font-normal text-muted`,children:n}):null]}),r?(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function UC({items:e,value:t,onChange:n,right:r}){let i=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`flex h-[46px] items-center justify-between gap-3 px-4`,children:[(0,h.jsx)(`div`,{role:`tablist`,className:`flex gap-5`,children:e.map(e=>{let r=e.value===t;return(0,h.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.value),className:X(`relative flex h-[46px] cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0.5 text-[14px] transition-colors`,r?`font-semibold text-ink`:`font-medium text-ink2 hover:text-ink`),children:[e.label,e.count===void 0?null:(0,h.jsx)(BC,{value:e.count}),r?(0,h.jsx)($d.span,{layoutId:i,className:`absolute inset-x-0 bottom-0 h-[2px] bg-ink`,transition:{type:`spring`,stiffness:520,damping:42}}):null]},e.value)})}),r?(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function WC({align:e,children:t}){return(0,h.jsx)(`div`,{className:X(`flex min-w-0 items-center gap-2`,e===`r`&&`justify-end text-right`,e===`c`&&`justify-center`),children:t})}function GC(e,t){return m.Children.toArray(e).map((e,n)=>(0,h.jsx)(WC,{align:t?.[n]??`l`,children:e},n))}function KC({cols:e,align:t,labels:n}){return(0,h.jsx)(`div`,{className:`grid h-8 items-center gap-x-4 border-t border-rule bg-soft px-4 text-[12.5px] text-muted`,style:{gridTemplateColumns:e},children:n.map((e,n)=>(0,h.jsx)(WC,{align:t?.[n]??`l`,children:(0,h.jsx)(`span`,{className:`whitespace-nowrap`,children:e})},n))})}var qC=(e,t,n)=>X(`grid items-center gap-x-4 border-rule`,!e&&`border-t`,t&&`cursor-pointer transition-colors hover:bg-soft`,n);function JC({cols:e,align:t,minH:n=44,pad:r=`10px 16px`,children:i,first:a,className:o,onClick:s,title:c}){return(0,h.jsx)(`div`,{className:qC(a,!!s,o),style:{gridTemplateColumns:e,minHeight:n,padding:r},onClick:s,title:c,children:GC(i,t)})}function YC({to:e,cols:t,align:n,minH:r=44,pad:i=`10px 16px`,first:a,className:o,children:s}){return(0,h.jsx)(Lf,{href:e,className:X(qC(a,!0,o),`text-inherit no-underline`),style:{gridTemplateColumns:t,minHeight:r,padding:i},children:GC(s,n)})}function XC({label:e,children:t,labelWidth:n=180,minH:r=40,end:i=!1}){return(0,h.jsxs)(`div`,{className:`grid content-center items-baseline gap-x-4 border-t border-rule px-4 py-2`,style:{gridTemplateColumns:`${n}px minmax(0, 1fr)`,minHeight:r},children:[(0,h.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,h.jsx)(`div`,{className:X(`flex min-w-0 flex-wrap items-center gap-2`,i&&`justify-end`),children:t})]})}function ZC({children:e,pad:t=`16px`,gap:n=16,top:r=!0,className:i}){return(0,h.jsx)(`div`,{className:X(`flex flex-col`,r&&`border-t border-rule`,i),style:{padding:t,gap:n},children:e})}function QC({issues:e,className:t}){return(0,h.jsx)(`div`,{className:X(`flex flex-col`,t),children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-start gap-2.5 border-t border-rule px-4 py-2.5 text-[13px] first:border-t-0`,children:[(0,h.jsx)(Z,{name:e.severity===`error`?`alert`:`info`,size:15,className:X(`mt-0.5`,e.severity===`error`?`text-danger-text`:`text-action`)}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(`span`,{className:`text-ink`,children:e.message}),(0,h.jsxs)(`span`,{className:`font-mono text-[12px] break-all text-muted`,children:[e.file,e.at?` · ${e.at}`:``]})]})]},t))})}function $C({issues:e,title:t=`Problems`}){if(!e.length)return null;let n=e.filter(e=>e.severity===`error`).length;return(0,h.jsxs)(VC,{className:n?`border-danger/40`:void 0,children:[(0,h.jsx)(HC,{title:t,count:e.length,sub:n?`${n} blocking`:`warnings`}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:(0,h.jsx)(QC,{issues:e})})]})}var ew=[.2,.7,.2,1];function tw({open:e,side:t,width:n,children:r}){return(0,h.jsx)(V,{initial:!1,children:e?(0,h.jsx)($d.div,{initial:{width:0,opacity:.6},animate:{width:n,opacity:1},exit:{width:0,opacity:.6},transition:{duration:.22,ease:ew},className:X(`flex min-h-0 shrink-0 overflow-hidden`,t===`right`?`justify-start`:`justify-end`),children:(0,h.jsx)(`div`,{className:`flex min-h-0 shrink-0`,style:{width:n},children:r})},`panel`):null})}function nw({items:e,value:t,onChange:n,label:r,stretch:i,size:a=`ctrl`}){let o=(0,m.useId)();return(0,h.jsx)(`div`,{role:`group`,"aria-label":r,className:X(`shrink-0 items-center gap-0.5 rounded-[6px] bg-track p-[3px]`,a===`ctrl`?`h-ctrl`:`h-7`,i?`flex`:`inline-flex`),children:e.map(e=>{let r=e.value===t;return(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":r,title:e.title,onClick:()=>n(e.value),className:X(`relative flex h-full cursor-pointer items-center justify-center whitespace-nowrap rounded-[4px] border-0 bg-transparent font-medium transition-colors`,a===`ctrl`?`px-2.5 text-ctrl`:`px-2 text-[12.5px]`,i&&`flex-1`,r?`text-ink`:`text-muted hover:text-ink2`),children:[r?(0,h.jsx)($d.span,{layoutId:o,className:`absolute inset-0 rounded-[4px] bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.10)]`,transition:{type:`spring`,stiffness:520,damping:42}}):null,(0,h.jsx)(`span`,{className:`relative flex items-center gap-1.5`,children:e.label})]},e.value)})})}function rw({children:e,className:t,gap:n=20,wide:r=!1}){return(0,h.jsx)(`main`,{className:X(`mx-auto flex w-full min-h-0 grow flex-col px-8 pt-6 pb-7 animate-[q-fade-in_160ms_ease-out] max-md:px-4 max-md:pt-4`,r?`max-w-[1440px]`:`max-w-[1200px]`,t),style:{gap:n},children:e})}function iw({title:e,sub:t,right:n,badge:r,crumbs:i}){return(0,h.jsxs)(`div`,{className:`flex shrink-0 items-end justify-between gap-6 max-md:flex-col max-md:items-stretch max-md:gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[i?(0,h.jsx)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:i}):null,(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`h1`,{className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:e}),r]}),t?(0,h.jsx)(`div`,{className:`text-[13px] text-muted`,children:t}):null]}),n?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n}):null]})}function aw({items:e,label:t}){return(0,h.jsx)(`nav`,{"aria-label":t,className:`flex flex-col gap-0.5`,children:e.map(e=>(0,h.jsxs)(Lf,{href:e.to,className:e=>X(`flex h-8 items-center gap-2 whitespace-nowrap rounded-[6px] px-3 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,e?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),e.hint?(0,h.jsx)(`span`,{className:`ml-auto text-[12px] font-normal text-muted`,children:e.hint}):null]},e.to))})}function ow({children:e}){return(0,h.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[12px] text-muted`,children:e})}function sw({title:e,text:t,action:n}){return(0,h.jsxs)(VC,{className:`flex w-[480px] max-w-full flex-col items-center gap-2 px-6 py-8 text-center`,children:[(0,h.jsx)(`h1`,{className:`m-0 text-[16px] font-semibold`,children:e}),t?(0,h.jsx)(`div`,{className:`m-0 max-w-[400px] text-[14px] text-ink2`,children:t}):null,n?(0,h.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:n}):null]})}function cw(e){return(0,h.jsx)(`div`,{className:`flex min-h-[50vh] grow items-center justify-center p-6 max-md:px-4`,children:(0,h.jsx)(sw,{...e})})}var lw=Object.defineProperty,uw=(e,t)=>lw(e,`name`,{value:t,configurable:!0}),dw=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),fw=m.forwardRef(uw(function(e,t){return(0,h.jsx)(Gp.span,{...e,ref:t,style:{...dw,...e.style}})},`VisuallyHidden`)),pw=Object.defineProperty,mw=(e,t)=>pw(e,`name`,{value:t,configurable:!0}),[hw,gw]=op(`Tooltip`,[rb]),_w=rb(),vw=`TooltipProvider`,yw=700,bw=`tooltip.open`,[xw,Sw]=hw(vw),Cw=mw(e=>{let{__scopeTooltip:t,delayDuration:n=yw,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=m.useRef(!0),s=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,h.jsx)(xw,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:m.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),ww=`Tooltip`,[Tw,Ew]=hw(ww),Dw=mw(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Sw(ww,e.__scopeTooltip),l=_w(t),[u,d]=m.useState(null),[f,p]=m.useState(void 0),g=pp(),_=m.useRef(0),v=o??c.disableHoverableContent,y=s??c.delayDuration,b=m.useRef(!1),[x,S]=Sp({prop:r,defaultProp:i??!1,onChange:mw(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(bw))):c.onClose(),a?.(e)},`onChange`),caller:ww}),C=m.useMemo(()=>x?b.current?`delayed-open`:`instant-open`:`closed`,[x]),w=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,b.current=!1,S(!0)},[S]),T=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,S(!1)},[S]),E=m.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{b.current=!0,S(!0),_.current=0},y)},[y,S]);m.useEffect(()=>()=>{_.current&&=(window.clearTimeout(_.current),0)},[]);let D=f??g;return(0,h.jsx)(gb,{...l,children:(0,h.jsx)(Tw,{scope:t,contentId:D,setContentId:p,open:x,stateAttribute:C,trigger:u,onTriggerChange:d,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?E():w()},[c.isOpenDelayedRef,E,w]),onTriggerLeave:m.useCallback(()=>{v?T():(window.clearTimeout(_.current),_.current=0)},[T,v]),onOpen:w,onClose:T,disableHoverableContent:v,children:n})})},`Tooltip`),Ow=`TooltipTrigger`,kw=m.forwardRef(mw(function(e,t){let{__scopeTooltip:n,...r}=e,i=Ew(Ow,n),a=Sw(Ow,n),o=_w(n),s=rp(t,m.useRef(null),i.onTriggerChange),c=m.useRef(!1),l=m.useRef(!1),u=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,h.jsx)(_b,{asChild:!0,...o,children:(0,h.jsx)(Gp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})},`TooltipTrigger`)),Aw=`TooltipPortal`,[jw,Mw]=hw(Aw,{forceMount:void 0}),Nw=mw(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ew(Aw,t);return(0,h.jsx)(jw,{scope:t,forceMount:n,children:(0,h.jsx)(Mm,{present:n||a.open,children:(0,h.jsx)(Om,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Pw=`TooltipContent`,Fw=m.forwardRef(mw(function(e,t){let n=Mw(Pw,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ew(Pw,e.__scopeTooltip);return(0,h.jsx)(Mm,{present:r||o.open,children:o.disableHoverableContent?(0,h.jsx)(Rw,{side:i,...a,ref:t}):(0,h.jsx)(Iw,{side:i,...a,ref:t})})},`TooltipContent`)),Iw=m.forwardRef(mw(function(e,t){let n=Ew(Pw,e.__scopeTooltip),r=Sw(Pw,e.__scopeTooltip),i=m.useRef(null),a=rp(t,i),[o,s]=m.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=m.useCallback(()=>{s(null),d(!1)},[d]),p=m.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Bw(r,zw(r,n.getBoundingClientRect())),a=Vw(t.getBoundingClientRect()),o=Uw([...i,...a]);s(o),d(!0)},[d]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&u){let e=mw(e=>p(e,u),`handleTriggerLeave`),t=mw(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),m.useEffect(()=>{if(o){let e=mw(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Hw(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,h.jsx)(Rw,{...e,ref:a})},`TooltipContentHoverable`)),Lw=Mp(`TooltipContent`),Rw=m.forwardRef(mw(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Ew(Pw,n),u=_w(n),{onClose:d}=l;m.useEffect(()=>(document.addEventListener(bw,d),()=>document.removeEventListener(bw,d)),[d]),m.useEffect(()=>{if(l.trigger){let e=mw(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return cp(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,h.jsx)(rm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,h.jsxs)(vb,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,h.jsx)(Lw,{children:r}),i?(0,h.jsx)(fw,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function zw(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}mw(zw,`getExitSideFromRect`);function Bw(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}mw(Bw,`getPaddedExitPoints`);function Vw(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}mw(Vw,`getPointsFromRect`);function Hw(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}mw(Hw,`isPointInPolygon`);function Uw(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ww(t)}mw(Uw,`getHull`);function Ww(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}mw(Ww,`getHullPresorted`);var Gw=Cw,Kw=Dw,qw=kw,Jw=Nw,Yw=Fw;function Xw({children:e}){return(0,h.jsx)(Gw,{delayDuration:250,children:e})}var Zw=`z-50 max-w-[280px] rounded-[8px] border border-rule bg-surface px-[10px] py-[7px] text-[12.5px] leading-[1.35] text-ink shadow-pop outline-none data-[state=delayed-open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function Qw({content:e,children:t,side:n=`top`,align:r=`center`,className:i}){return(0,h.jsxs)(Kw,{children:[(0,h.jsx)(qw,{asChild:!0,children:t}),(0,h.jsx)(Jw,{children:(0,h.jsx)(Yw,{side:n,align:r,sideOffset:6,collisionPadding:12,className:X(Zw,i),children:e})})]})}function $w({title:e=`Nothing here`,text:t}){return(0,h.jsx)(cw,{title:e,text:t??`This address does not match a canvas or a page of the design system.`,action:(0,h.jsx)(b_,{to:`/`,children:`All canvases`})})}var eT=.02,tT=(e,t=eT)=>Math.min(8,Math.max(t,e)),nT=class{camera={x:0,y:0,z:1};minZoom=eT;listeners=new Set;animation=0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}set(e){this.camera={x:e.x,y:e.y,z:tT(e.z,this.minZoom)};for(let e of this.listeners)e(this.camera)}interrupt(){cancelAnimationFrame(this.animation),this.animation=0}panBy(e,t){this.interrupt();let{x:n,y:r,z:i}=this.camera;this.set({x:n+e,y:r+t,z:i})}zoomAt(e,t,n){this.interrupt();let{x:r,y:i,z:a}=this.camera,o=tT(a*n,this.minZoom),s=(e-r)/a,c=(t-i)/a;this.set({x:e-s*o,y:t-c*o,z:o})}animateTo(e,t=320){this.interrupt();let n={...this.camera},r={...e,z:tT(e.z,this.minZoom)};if(t<=0||matchMedia(`(prefers-reduced-motion: reduce)`).matches){this.set(r);return}let i=performance.now(),a=e=>{let o=Math.min(1,(e-i)/t),s=1-(1-o)**3,c=n.z*(r.z/n.z)**s,l=n.z===r.z?s:(c-n.z)/(r.z-n.z);this.set({x:n.x+(r.x-n.x)*l,y:n.y+(r.y-n.y)*l,z:c}),this.animation=o<1?requestAnimationFrame(a):0};this.animation=requestAnimationFrame(a)}toWorld(e,t){let{x:n,y:r,z:i}=this.camera;return{x:(e-n)/i,y:(t-r)/i}}};function rT(e,t,n,r=72,i=1){let a=tT(Math.min((t-r*2)/Math.max(e.w,1),(n-r*2)/Math.max(e.h,1),i));return{z:a,x:t/2-(e.x+e.w/2)*a,y:n/2-(e.y+e.h/2)*a}}function iT(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}var aT=280,oT=96,sT=150,cT=110,lT=720,uT=e=>e.kind===`screen`||e.kind===`url`;function dT(e,t){let n=t[e.id];if(e.kind===`screen`||e.kind===`url`){let t=e.frame.width;if(e.frame.height!==`auto`)return{w:t,h:e.frame.height};let r=e.kind===`screen`?e.measuredHeight:void 0;return{w:t,h:n?.h??r??900}}if(e.kind===`note`)return{w:e.width,h:n?.h??Math.max(80,Math.ceil(e.text.length/38)*26+40)};let r=e.width??n?.w??480;return{w:r,h:n?.w?n.h/n.w*r:n?.h??r*.62}}function fT(e,t){return!e.title&&!e.description?0:t[`section:${e.id}`]?.h??(e.title?56:0)+(e.description?60:0)}function pT(e,t){let n=[],r=[];if(e.layout===`free`){let r=0;for(let i of e.sections)for(let e of i.items){let{w:a,h:o}=dT(e,t),s=e.x??r,c=e.y??0;r=Math.max(r,s+a+oT),n.push({item:e,section:i,x:s,y:c,w:a,h:o})}}else{let i=0;for(let a of e.sections){let e=fT(a,t),o=i,s=i+(e?e+cT:0),c=0,l=0,u=0,d=0;for(let e of a.items){a.columns&&d===a.columns&&(s+=l+sT,c=0,l=0,d=0);let{w:r,h:i}=dT(e,t);n.push({item:e,section:a,x:c,y:s,w:r,h:i}),c+=r+oT,u=Math.max(u,c-oT),l=Math.max(l,i),d++}let f=s+l;r.push({section:a,x:0,y:o,w:Math.max(u,e?lT:0),h:f-o,header:e}),i=f+aT}}let i=0,a=0,o=0,s=0,c=[...n,...r];return c.length&&(i=Math.min(...c.map(e=>e.x)),a=Math.min(...c.map(e=>e.y)),o=Math.max(...c.map(e=>e.x+e.w)),s=Math.max(...c.map(e=>e.y+e.h))),{items:n,sections:r,bounds:{x:i,y:a,w:o-i,h:s-a}}}function mT(e){return e.items.filter(e=>uT(e.item))}function hT(e){return e.kind===`note`?`note`:e.kind===`image`?`image`:e.kind===`url`?`globe`:e.frame.width<600?`smartphone`:e.frame.width<1100?`tablet`:`monitor`}function gT(e,t){return`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(t.id)}`}function _T({canvas:e,page:t,store:n,onPick:r}){let i=Jg(n,e=>e.selected),a=Jg(n,e=>e.frames);return(0,h.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[264px] shrink-0 flex-col overflow-hidden border-r border-rule bg-surface`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-rule px-4 py-3.5`,children:[(0,h.jsx)(`div`,{className:`truncate text-[14px] font-semibold`,children:e.title}),e.description?(0,h.jsx)(`div`,{className:`line-clamp-3 text-[12.5px] leading-[1.45] text-muted`,children:e.description}):null]}),(0,h.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto pb-4`,children:[e.pages.length>1?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:`Pages`}),(0,h.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2`,children:e.pages.map(n=>{let r=n.sections.reduce((e,t)=>e+t.items.filter(e=>e.kind===`screen`||e.kind===`url`).length,0);return(0,h.jsxs)(Lf,{href:gT(e,n),className:X(`flex h-8 items-center gap-2 rounded-[6px] px-2.5 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,n.id===t.id?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:n.title}),(0,h.jsx)(`span`,{className:`text-[12px] text-muted tabular`,children:r})]},n.id)})})]}):null,(0,h.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:e.pages.length>1?t.title:`Layers`}),(0,h.jsx)(`div`,{className:`flex flex-col px-2`,children:t.sections.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[e.title?(0,h.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-2.5 pt-1 text-[12px] font-medium text-ink2`,children:[(0,h.jsx)(`span`,{className:`truncate`,children:e.title}),(0,h.jsx)(BC,{value:e.items.length})]}):null,e.items.map(t=>{let n=(a[t.id]?.errors.length??0)>0||t.kind===`screen`&&t.missing;return(0,h.jsxs)(`button`,{type:`button`,onClick:()=>r(t.id),className:X(`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 px-2.5 text-left text-[13px] transition-colors focus-visible:outline-offset-[-2px]`,e.title&&`pl-4`,i===t.id?`bg-action-soft text-ink`:`bg-transparent text-ink2 hover:bg-soft2`),children:[(0,h.jsx)(Z,{name:hT(t),size:15,className:`text-muted`}),(0,h.jsx)(`span`,{className:`min-w-0 grow truncate`,children:t.title||(t.kind===`note`?`Note`:t.id)}),n?(0,h.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`}):null]},t.id)})]},e.id))})]})]})}function vT(){return new qg({selected:null,active:null,hovered:null,sizes:{},frames:{},live:[],panning:!1,zoomTiny:!1,frameEls:{},inspecting:!1})}function yT(e,t,n){e.set(e=>{let r=e.sizes[t];return r&&Math.abs(r.h-n.h)<1&&r.w===n.w?e:{...e,sizes:{...e.sizes,[t]:n}}})}function bT(e,t,n){e.set(e=>{let r=e.frames[t]??{ready:!1,errors:[]};return{...e,frames:{...e.frames,[t]:{...r,...n}}}})}function xT(e,t,n){e.set(e=>e.frameEls[t]===n?e:{...e,frameEls:{...e.frameEls,[t]:n}})}function ST(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var CT=ST();function wT(e){CT=e}var TT={exec:()=>null};function ET(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(OT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var DT=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),OT={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ET(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ET(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:ET(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ET(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ET(e=>RegExp(`^ {0,${e}}(?:</?(?:${UT})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:ET(e=>RegExp(`^ {0,${e}}>`))},kT=/^(?:[ \t]*(?:\n|$))+/,AT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,MT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,NT=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,PT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,FT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,IT=$(FT).replace(/bull/g,PT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),LT=$(FT).replace(/bull/g,PT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),RT=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,zT=/^[^\n]+/,BT=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,VT=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,BT).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),HT=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,PT).getRegex(),UT=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,WT=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,GT=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,WT).replace(`tag`,UT).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),KT=e=>$(RT).replace(`hr`,MT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UT).getRegex(),qT=KT(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),JT=KT(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),YT={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,JT).getRegex(),code:AT,def:VT,fences:jT,heading:NT,hr:MT,html:GT,lheading:IT,list:HT,newline:kT,paragraph:qT,table:TT,text:zT},XT=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,MT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UT).getRegex(),ZT={...YT,lheading:LT,table:XT,paragraph:$(RT).replace(`hr`,MT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,XT).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UT).getRegex()},QT={...YT,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,WT).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:TT,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(RT).replace(`hr`,MT).replace(`heading`,` *#{1,6} *[^
58
+ ]`).replace(`lheading`,IT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},$T=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tE=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,nE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rE=/[\p{P}\p{S}]/u,iE=/[\s\p{P}\p{S}]/u,aE=/[^\s\p{P}\p{S}]/u,oE=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,iE).getRegex(),sE=/[\p{Pi}\p{Ps}"']/u,cE=/(?!~)[\p{P}\p{S}]/u,lE=/(?!~)[\s\p{P}\p{S}]/u,uE=/(?:[^\s\p{P}\p{S}]|~)/u,dE=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,DT?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),fE=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pE=$(fE,`u`).replace(/punct/g,rE).getRegex(),mE=$(fE,`u`).replace(/punct/g,cE).getRegex(),hE=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,sE).replace(/punct/g,rE).getRegex(),gE=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,_E=$(gE,`gu`).replace(/notPunctSpace/g,aE).replace(/punctSpace/g,iE).replace(/punct/g,rE).getRegex(),vE=$(gE,`gu`).replace(/notPunctSpace/g,uE).replace(/punctSpace/g,lE).replace(/punct/g,cE).getRegex(),yE=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,aE).replace(/punctSpace/g,iE).replace(/punct/g,rE).getRegex(),bE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,aE).replace(/punctSpace/g,iE).replace(/punct/g,rE).getRegex(),xE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,aE).replace(/punctSpace/g,iE).replace(/punct/g,rE).getRegex(),SE=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,rE).getRegex(),CE=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,aE).replace(/punctSpace/g,iE).replace(/punct/g,rE).getRegex(),wE=$(/\\(punct)/,`gu`).replace(/punct/g,rE).getRegex(),TE=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),EE=$(WT).replace(`(?:-->|$)`,`-->`).getRegex(),DE=$(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,EE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),OE=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,kE=$(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,OE).getRegex(),AE=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,kE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jE=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,kE).replace(`ref`,BT).getRegex(),ME=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,BT).getRegex(),NE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,PE=$(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,OE).getRegex(),FE=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,PE).replace(`ref`,NE).getRegex()).replace(`nolink`,$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,NE).getRegex()).getRegex(),IE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,LE=$(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),RE={_backpedal:TT,anyPunctuation:wE,autolink:TE,blockSkip:dE,br:tE,code:eE,del:TT,delLDelim:TT,delRDelim:TT,emStrongLDelim:pE,emStrongRDelimAst:_E,emStrongRDelimUnd:bE,escape:$T,link:AE,nolink:ME,punctuation:oE,reflink:jE,reflinkSearch:FE,tag:DE,text:nE,url:TT},zE={...RE,emStrongLDelim:hE,emStrongRDelimAst:yE,emStrongRDelimUnd:xE,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,kE).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,kE).getRegex()},BE={...RE,emStrongRDelimAst:vE,emStrongLDelim:mE,delLDelim:SE,delRDelim:CE,url:$(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,LE).replace(`protocol`,IE).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,IE).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},VE={...BE,br:$(tE).replace(`{2,}`,`*`).getRegex(),text:$(BE.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},HE={normal:YT,gfm:ZT,pedantic:QT},UE={normal:RE,gfm:BE,breaks:VE,pedantic:zE},WE={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},GE=e=>WE[e];function KE(e,t){if(t){if(OT.escapeTest.test(e))return e.replace(OT.escapeReplace,GE)}else if(OT.escapeTestNoEncode.test(e))return e.replace(OT.escapeReplaceNoEncode,GE);return e}function qE(e){return e.replace(OT.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function JE(e){try{e=encodeURI(e).replace(OT.percentDecode,`%`)}catch{return null}return e}function YE(e,t){let n=e.replace(OT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(OT.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(OT.slashPipe,`|`);return n}function XE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function ZE(e){let t=e.split(`
59
+ `),n=t.length-1;for(;n>=0&&OT.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
60
+ `)}function QE(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function $E(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function eD(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function tD(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function nD(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
73
61
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
74
- `)}function yD(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var bD=class{options;rules;lexer;constructor(e){this.options=e||zT}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:pD(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=vD(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=fD(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:fD(t[0],`
75
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:fD(t[0],`
76
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=fD(t[0],`
62
+ `)}function rD(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var iD=class{options;rules;lexer;constructor(e){this.options=e||CT}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:ZE(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=nD(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=XE(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:XE(t[0],`
63
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:XE(t[0],`
64
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=XE(t[0],`
77
65
  `).split(`
78
66
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
79
67
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -88,19 +76,19 @@ ${d.join(`
88
76
  `+e.join(`
89
77
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
90
78
  `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
91
- `,1)[0],l=t[1].length,u=this.options.pedantic?gD(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>gD(e,l)),d=e.split(`
79
+ `,1)[0],l=t[1].length,u=this.options.pedantic?eD(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>eD(e,l)),d=e.split(`
92
80
  `,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
93
81
  `,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
94
82
  `,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
95
83
  `+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
96
84
  `+d}f=!d.trim(),r+=l+`
97
- `,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=pD(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=mD(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:fD(t[0],`
98
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=dD(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
99
- `):[],a={type:`table`,raw:fD(t[0],`
100
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(dD(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:fD(t[0],`
85
+ `,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=ZE(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=QE(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:XE(t[0],`
86
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=YE(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
87
+ `):[],a={type:`table`,raw:XE(t[0],`
88
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(YE(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:XE(t[0],`
101
89
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
102
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&yD(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=fD(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=hD(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),_D(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&yD(e,n[1],r,this.rules))return;let i=t[mD((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return _D(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:lD(t[0]),escaped:e}}}},xD=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||zT,this.options.tokenizer=this.options.tokenizer||new bD,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:WT,block:iD.normal,inline:aD.normal};this.options.pedantic?(t.block=iD.pedantic,t.inline=aD.pedantic):this.options.gfm&&(t.block=iD.gfm,t.inline=this.options.breaks?aD.breaks:aD.gfm),this.tokenizer.rules=t}static get rules(){return{block:iD,inline:aD}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(WT.carriageReturn,`
103
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(WT.tabCharGlobal,` `).replace(WT.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
90
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&rD(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=XE(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=$E(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),tD(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&rD(e,n[1],r,this.rules))return;let i=t[QE((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return tD(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:qE(t[0]),escaped:e}}}},aD=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||CT,this.options.tokenizer=this.options.tokenizer||new iD,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:OT,block:HE.normal,inline:UE.normal};this.options.pedantic?(t.block=HE.pedantic,t.inline=UE.pedantic):this.options.gfm&&(t.block=HE.gfm,t.inline=this.options.breaks?UE.breaks:UE.gfm),this.tokenizer.rules=t}static get rules(){return{block:HE,inline:UE}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(OT.carriageReturn,`
91
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(OT.tabCharGlobal,` `).replace(OT.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
104
92
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
105
93
  `)?``:`
106
94
  `)+i.raw,n.text+=`
@@ -113,9 +101,9 @@ ${d.join(`
113
101
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
114
102
  `)?``:`
115
103
  `)+i.raw,n.text+=`
116
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,mD(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,mD(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},SD=class{options;parser;constructor(e){this.options=e||zT}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(WT.notSpaceStart)?.[0],i=e?e.replace(WT.endingNewline,``)+`
117
- `:``;return r?`<pre><code class="language-`+cD(r)+`">`+(n?i:cD(i,!0))+`</code></pre>
118
- `:`<pre><code>`+(n?i:cD(i,!0))+`</code></pre>
104
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,QE(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,QE(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},oD=class{options;parser;constructor(e){this.options=e||CT}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(OT.notSpaceStart)?.[0],i=e?e.replace(OT.endingNewline,``)+`
105
+ `:``;return r?`<pre><code class="language-`+KE(r)+`">`+(n?i:KE(i,!0))+`</code></pre>
106
+ `:`<pre><code>`+(n?i:KE(i,!0))+`</code></pre>
119
107
  `}blockquote({tokens:e}){return`<blockquote>
120
108
  ${this.parser.parse(e)}</blockquote>
121
109
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -131,36 +119,39 @@ ${this.parser.parse(e)}</blockquote>
131
119
  `}tablerow({text:e}){return`<tr>
132
120
  ${e}</tr>
133
121
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
134
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${cD(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?cD(n,!0):this.parser.parseInline(r),o=uD(e);if(o===null)return a;e=cD(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+cD(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=uD(e);if(i===null)return cD(n);e=i;let a=`<img src="${cD(e)}" alt="${cD(n)}"`;return t&&(a+=` title="${cD(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:cD(e.text)}},CD=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},wD=class e{options;renderer;textRenderer;constructor(e){this.options=e||zT,this.options.renderer=this.options.renderer||new SD,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new CD}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},TD=class{options;block;constructor(e){this.options=e||zT}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?xD.lex:xD.lexInline}provideParser(e=this.block){return e?wD.parse:wD.parseInline}},ED=new class{defaults=RT();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=wD;Renderer=SD;TextRenderer=CD;Lexer=xD;Tokenizer=bD;Hooks=TD;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new SD(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new bD(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new TD;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=TD.passThroughHooks.has(n)?e=>{if(this.defaults.async&&TD.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return xD.lex(e,t??this.defaults)}parser(e,t){return wD.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?xD.lex:xD.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?wD.parse:wD.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?xD.lex:xD.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?wD.parse:wD.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
135
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+cD(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function DD(e,t){return ED.parse(e,t)}DD.options=DD.setOptions=function(e){return ED.setOptions(e),DD.defaults=ED.defaults,BT(DD.defaults),DD},DD.getDefaults=RT,DD.defaults=zT;function OD(...e){return ED.use(...e),DD.defaults=ED.defaults,BT(DD.defaults),DD}DD.use=OD,DD.walkTokens=function(e,t){return ED.walkTokens(e,t)},DD.parseInline=ED.parseInline,DD.Parser=wD,DD.parser=wD.parse,DD.Renderer=SD,DD.TextRenderer=CD,DD.Lexer=xD,DD.lexer=xD.lex,DD.Tokenizer=bD,DD.Hooks=TD,DD.parse=DD,DD.options,DD.setOptions,DD.walkTokens,DD.parseInline,wD.parse,xD.lex,DD.use({gfm:!0,breaks:!1});function kD(e){return DD.parse(e,{async:!1}).replace(/<a href=/g,`<a target="_blank" rel="noreferrer" href=`)}function AD({text:e,className:t}){let n=(0,m.useMemo)(()=>kD(e),[e]);return(0,h.jsx)(`div`,{className:X(`prose`,t),dangerouslySetInnerHTML:{__html:n}})}function jD(e,t,n=!0){let r=(0,m.useRef)(null);return(0,m.useLayoutEffect)(()=>{let i=r.current;if(!i||!n)return;let a=new ResizeObserver(()=>FT(e,t,{h:i.offsetHeight}));return a.observe(i),()=>a.disconnect()},[e,t,n]),r}function MD(e){return e<600?`smartphone`:e<1100?`tablet`:`monitor`}var ND=(0,m.memo)(function({placed:e,live:t,theme:n,store:r,events:i,capture:a}){let{item:o,x:s,y:c,w:l,h:u}=e,d=(0,m.useRef)(null),f=(0,m.useCallback)(e=>{d.current=e,LT(r,o.id,e)},[r,o.id]),p=Jg(r,e=>e.frames[o.id]),g=Jg(r,e=>e.active===o.id),_=Jg(r,e=>e.inspecting&&o.kind===`screen`),v=o.frame.height===`auto`,y=o.kind===`screen`?o.theme??n:n,b=o.kind===`screen`?o.rev:o.url,[x]=(0,m.useState)(y),S=o.kind===`screen`?gw(o.url,x,a?{capture:`1`}:void 0):o.url,C=!!p?.ready;(0,m.useEffect)(()=>{t||IT(r,o.id,{ready:!1})},[t,r,o.id]),(0,m.useEffect)(()=>{let e=d.current;if(e&&t&&o.kind===`screen`)return pw(e,t=>{switch(t.type){case`ready`:IT(r,o.id,{ready:!0}),mw(e);break;case`size`:v&&FT(r,o.id,{h:Math.max(200,t.height)});break;case`error`:{let e=r.get().frames[o.id]?.errors??[];e.includes(t.message)||IT(r,o.id,{errors:[...e,t.message]});break}case`updated`:IT(r,o.id,{errors:[]});break;case`go`:i.onGo(o.id,t.target);break;case`wheel`:i.onWheel(e,t);break;case`keydown`:t.code===`Escape`&&i.onEscape()}})},[t,o.id,o.kind,v,r,i,S,b]),(0,m.useEffect)(()=>{o.kind===`screen`&&hw(d.current,y)},[y,o.kind]);let w=o.kind===`screen`?o.snapshots?.[y]??o.snapshots?.[y===`dark`?`light`:`dark`]:void 0;return(0,h.jsxs)(`div`,{"data-item":o.id,className:`absolute overflow-hidden bg-surface`,style:{left:s,top:c,width:l,height:u,boxShadow:`var(--shadow-frame), 0 0 0 1px var(--rule)`},children:[!C&&w?(0,h.jsx)(`img`,{src:w,alt:``,draggable:!1,className:`absolute inset-0 h-full w-full object-cover object-top select-none`}):null,!C&&!w?(0,h.jsx)(PD,{item:o,loading:t&&!(o.kind===`screen`&&o.missing)}):null,t&&!(o.kind===`screen`&&o.missing)?(0,h.jsx)(`iframe`,{ref:f,src:S,title:o.title,allow:`clipboard-read; clipboard-write; fullscreen`,className:X(`absolute top-0 left-0 block border-0 transition-opacity duration-200`,C?`opacity-100`:`opacity-0`),style:{width:l,height:u,colorScheme:y},onLoad:()=>{o.kind===`url`?IT(r,o.id,{ready:!0}):(hw(d.current,y),mw(d.current))}},b):null,g||_?null:(0,h.jsx)(`div`,{"data-shield":o.id,className:`absolute inset-0`})]})});function PD({item:e,loading:t}){let n=e.kind===`screen`&&e.missing;return(0,h.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-soft text-muted`,children:[(0,h.jsx)(Z,{name:n?`alert`:e.kind===`url`?`globe`:MD(e.frame.width),size:Math.max(24,Math.min(96,e.frame.width/12)),strokeWidth:1.25,className:n?`text-danger-text`:void 0}),(0,h.jsx)(`div`,{className:`max-w-[80%] truncate text-center`,style:{fontSize:Math.max(14,e.frame.width/40)},children:n?`Missing file: ${e.kind===`screen`?e.src:``}`:t?`Loading…`:e.title})]})}var FD=(0,m.memo)(function({placed:e,store:t}){let{item:n,x:r,y:i,w:a}=e,o=jD(t,n.id),s=n.tone===`plain`;return(0,h.jsxs)(`div`,{ref:o,"data-item":n.id,className:X(`absolute`,s?``:`rounded-[10px] border border-note-line bg-note px-6 py-5 shadow-frame`),style:{left:r,top:i,width:a},children:[n.title?(0,h.jsx)(`div`,{className:`mb-2 font-semibold text-ink`,style:{fontSize:s?26:19},children:n.title}):null,(0,h.jsx)(AD,{text:n.text,className:s?`prose-plain`:`prose-note`})]})}),ID=(0,m.memo)(function({placed:e,store:t}){let{item:n,x:r,y:i,w:a,h:o}=e;return(0,h.jsx)(`div`,{"data-item":n.id,className:`absolute overflow-hidden rounded-[6px] bg-surface`,style:{left:r,top:i,width:a,height:o,boxShadow:`0 0 0 1px var(--rule)`},children:n.missing?(0,h.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:20}),` Missing image`]}):(0,h.jsx)(`img`,{src:n.url,alt:n.title,draggable:!1,className:`block h-full w-full object-contain select-none`,onLoad:e=>{let r=e.currentTarget;FT(t,n.id,{w:r.naturalWidth,h:r.naturalHeight})}})})}),LD=(0,m.memo)(function({section:e,x:t,y:n,w:r,store:i}){let a=jD(i,`section:${e.id}`);return!e.title&&!e.description?null:(0,h.jsxs)(`div`,{ref:a,className:`absolute`,style:{left:t,top:n,width:Math.min(Math.max(r,720),1400)},children:[e.title?(0,h.jsx)(`div`,{className:`text-[40px] leading-[1.15] font-semibold tracking-[-0.015em] text-ink`,children:e.title}):null,e.description?(0,h.jsx)(`div`,{className:`mt-3 max-w-[1100px]`,children:(0,h.jsx)(AD,{text:e.description,className:`prose-plain`})}):null]})}),RD={phone:{width:390,height:844,label:`Phone`},"phone-sm":{width:375,height:667,label:`Phone S`},"phone-lg":{width:430,height:932,label:`Phone L`},tablet:{width:834,height:1194,label:`Tablet`},"tablet-landscape":{width:1194,height:834,label:`Tablet landscape`},laptop:{width:1280,height:800,label:`Laptop`},desktop:{width:1440,height:900,label:`Desktop`},wide:{width:1920,height:1080,label:`Wide`}};Object.keys(RD);var zD=e=>({"--x":e.x,"--y":e.y,"--w":e.w,"--h":e.h});function BD(e){let t=e.item;if(t.kind!==`screen`&&t.kind!==`url`)return``;let n=t.frame.device?RD[t.frame.device]?.label:void 0,r=`${t.frame.width} × ${t.frame.height===`auto`?`auto`:t.frame.height}`;return n?`${n} · ${r}`:r}function VD({placed:e,store:t}){let n=e.item.id,r=Jg(t,e=>e.selected===n),i=Jg(t,e=>e.frames[n]?.errors.length??0);return(0,h.jsxs)(`div`,{"data-at":``,"data-label":n,style:zD(e),className:X(`frame-label pointer-events-auto flex cursor-default items-center gap-1.5 overflow-hidden pb-1.5 text-[12.5px] leading-none whitespace-nowrap select-none`,r?`text-ink`:`text-muted hover:text-ink2`),children:[i?(0,h.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`,title:`${i} errors`}):null,(0,h.jsx)(`span`,{className:X(`min-w-[3ch] truncate`,r?`font-semibold`:`font-medium`),children:e.item.title}),(0,h.jsx)(`span`,{className:`frame-device min-w-0 shrink-[20] truncate text-[11.5px] text-muted opacity-80`,children:BD(e)})]})}function HD({placed:e,kind:t}){return(0,h.jsx)(`div`,{"data-at":``,style:zD(e),className:X(`frame-outline rounded-[1px]`,t===`hover`?`outline outline-[1.5px] outline-action/60`:`outline-2 outline-action outline`)})}function UD({layout:e,store:t,overlayRef:n}){let r=Jg(t,e=>e.selected),i=Jg(t,e=>e.active),a=Jg(t,e=>e.hovered),o=Jg(t,e=>e.zoomTiny),s=e.items.filter(e=>ET(e.item)),c=t=>t?e.items.find(e=>e.item.id===t):void 0,l=c(r),u=a&&a!==r?c(a):void 0;return(0,h.jsxs)(`div`,{ref:n,className:`canvas-overlay`,"data-tiny":o,children:[s.map(e=>(0,h.jsx)(VD,{placed:e,store:t},e.item.id)),u?(0,h.jsx)(HD,{placed:u,kind:`hover`}):null,l?(0,h.jsx)(HD,{placed:l,kind:i===r?`active`:`selected`}):null]})}var WD=12,GD=20,KD=110;function qD({layout:e,theme:t,store:n,camera:r,events:i,capture:a,apiRef:o,onPlay:s,onSelect:c}){let l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)(null),[f,p]=(0,m.useState)(null),g=Jg(n,e=>e.panning),_=Jg(n,e=>e.selected),v=Jg(n,e=>e.active),y=(0,m.useMemo)(()=>e.items.filter(e=>ET(e.item)),[e]);(0,m.useLayoutEffect)(()=>{let e=l.current,t=u.current,i,a,o=()=>p({...r.camera,w:e.clientWidth,h:e.clientHeight}),s=r=>{t.style.transform=`translate3d(${r.x}px, ${r.y}px, 0) scale(${r.z})`,t.classList.add(`moving`),clearTimeout(i),i=setTimeout(()=>t.classList.remove(`moving`),160);let s=d.current;s&&(s.style.setProperty(`--tx`,String(r.x)),s.style.setProperty(`--ty`,String(r.y)),s.style.setProperty(`--z`,String(r.z)));let c=24*r.z;for(;c<14;)c*=4;for(;c>96;)c/=4;e.style.backgroundSize=`${c}px ${c}px`,e.style.backgroundPosition=`${r.x}px ${r.y}px`;let l=r.z<.09;n.get().zoomTiny!==l&&n.set(e=>({...e,zoomTiny:l})),a??=setTimeout(()=>{a=void 0,o()},90)};s(r.camera),o();let c=r.subscribe(s),f=e.getBoundingClientRect().left,m=new ResizeObserver(()=>{let t=e.getBoundingClientRect().left;if(t!==f){let e=r.camera;r.set({...e,x:e.x-(t-f)}),f=t}o()});return m.observe(e),()=>{c(),m.disconnect(),clearTimeout(i),clearTimeout(a)}},[r,n]),(0,m.useEffect)(()=>{let t=l.current,n=()=>({w:t.clientWidth,h:t.clientHeight});o.current={size:n,fitAll(t=!0){let{w:i,h:a}=n();if(!e.bounds.w)return;let o=yT(e.bounds,i,a,80,1);t?r.animateTo(o):r.set(o)},fitItem(t,i=!0){let a=e.items.find(e=>e.item.id===t);if(!a)return;let{w:o,h:s}=n(),c=yT(a,o,s,64,1);i?r.animateTo(c):r.set(c)},zoomBy(e){let{w:t,h:i}=n(),a=r.camera,o=a.z*e,s=(t/2-a.x)/a.z,c=(i/2-a.y)/a.z;r.animateTo({z:o,x:t/2-s*o,y:i/2-c*o},180)},zoomTo(e){let{w:t,h:i}=n(),a=r.camera,o=(t/2-a.x)/a.z,s=(i/2-a.y)/a.z;r.animateTo({z:e,x:t/2-o*e,y:i/2-s*e},220)}}},[o,r,e]);let b=(0,m.useRef)([]),x=(0,m.useMemo)(()=>{if(a)return new Set(y.map(e=>e.item.id));if(!f)return new Set;let{x:e,y:t,z:n,w:r,h:i}=f,o={x:-e/n,y:-t/n,w:r/n,h:i/n},s={x:o.x-o.w*.25,y:o.y-o.h*.25,w:o.w*1.5,h:o.h*1.5},c=e=>Math.max(0,Math.min(e.x+e.w,o.x+o.w)-Math.max(e.x,o.x))*Math.max(0,Math.min(e.y+e.h,o.y+o.h)-Math.max(e.y,o.y)),l=y.filter(e=>bT(e,s)&&e.w*n>=KD).sort((e,t)=>c(t)-c(e)).slice(0,WD).map(e=>e.item.id),u=[v,_].filter(e=>!!e),d=new Set(y.map(e=>e.item.id)),p=[...new Set([...u,...l,...b.current])].filter(e=>d.has(e)).slice(0,GD);return b.current=p,new Set(p)},[f,y,v,_,a]),S=(0,m.useRef)(null),C=(0,m.useRef)(new Map),w=(0,m.useRef)(null),T=(0,m.useRef)(!1),E=e=>{n.get().panning!==e&&n.set(t=>({...t,panning:e}))};(0,m.useEffect)(()=>{let e=e=>{e.code===`Space`&&!JD(e.target)&&(T.current=!0,l.current?.classList.add(`cursor-grab`),e.preventDefault())},t=e=>{e.code===`Space`&&(T.current=!1,l.current?.classList.remove(`cursor-grab`))};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[]);let D=e=>{let t=e;return(t?.closest(`[data-shield]`))?.dataset.shield??(t?.closest(`[data-label]`))?.dataset.label??(t?.closest(`[data-item]`))?.dataset.item??null},O=e=>{if(e.target.closest(`[data-ui]`)||e.button!==0&&e.button!==1)return;if(l.current.setPointerCapture(e.pointerId),C.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),r.interrupt(),C.current.size===2){let[e,t]=[...C.current.values()];w.current={dist:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2},S.current=null,E(!0);return}let t=e.button===1||T.current;S.current={id:t?null:D(e.target),startX:e.clientX,startY:e.clientY,lastX:e.clientX,lastY:e.clientY,moved:t},t&&E(!0)},k=e=>{if(C.current.has(e.pointerId)&&C.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),w.current&&C.current.size===2){let[e,t]=[...C.current.values()],n=Math.hypot(e.x-t.x,e.y-t.y),i=(e.x+t.x)/2,a=(e.y+t.y)/2,o=l.current.getBoundingClientRect();r.panBy(i-w.current.midX,a-w.current.midY),r.zoomAt(i-o.left,a-o.top,n/Math.max(w.current.dist,1)),w.current={dist:n,midX:i,midY:a};return}let t=S.current;if(!t){if(!n.get().panning){let t=D(e.target);n.get().hovered!==t&&n.set(e=>({...e,hovered:t}))}return}!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>3&&(t.moved=!0,E(!0)),t.moved&&r.panBy(e.clientX-t.lastX,e.clientY-t.lastY),t.lastX=e.clientX,t.lastY=e.clientY},A=e=>{C.current.delete(e.pointerId),C.current.size<2&&(w.current=null);let t=S.current;S.current=null,t&&!t.moved&&c(t.id,{x:e.clientX,y:e.clientY}),C.current.size||E(!1)};(0,m.useEffect)(()=>{let e=l.current,t=t=>{if(t.target.closest(`[data-ui]`))return;t.preventDefault();let n=e.getBoundingClientRect(),i=t.deltaMode===1?16:t.deltaMode===2?n.height:1;if(t.ctrlKey||t.metaKey){let e=t.deltaY*i,a=Math.abs(e)<40?.012:.0025;r.zoomAt(t.clientX-n.left,t.clientY-n.top,Math.exp(-e*a))}else r.panBy(-t.deltaX*i,-t.deltaY*i)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[r]);let j=e.sections;return(0,h.jsxs)(`div`,{ref:l,className:X(`canvas-dots relative h-full w-full touch-none overflow-hidden select-none`,g&&`canvas-panning cursor-grabbing`),onPointerDown:O,onPointerMove:k,onPointerUp:A,onPointerCancel:A,onPointerLeave:()=>n.get().hovered&&n.set(e=>({...e,hovered:null})),onDoubleClick:t=>{let n=D(t.target),r=n?e.items.find(e=>e.item.id===n):void 0;r&&ET(r.item)&&s(r.item.id)},children:[(0,h.jsxs)(`div`,{ref:u,className:`canvas-world`,children:[j.map(e=>(0,h.jsx)(LD,{section:e.section,x:e.x,y:e.y,w:e.w,store:n},`section:${e.section.id}`)),e.items.map(e=>{let{item:r}=e;return r.kind===`screen`||r.kind===`url`?(0,h.jsx)(ND,{placed:e,live:x.has(r.id),theme:t,store:n,events:i,capture:a},r.id):r.kind===`note`?(0,h.jsx)(FD,{placed:e,store:n},r.id):(0,h.jsx)(ID,{placed:e,store:n},r.id)})]}),(0,h.jsx)(UD,{layout:e,store:n,overlayRef:d})]})}function JD(e){let t=e;return!!t&&(t.isContentEditable||/^(input|textarea|select)$/i.test(t.tagName))}var YD=new URLSearchParams(window.location.search),XD=YD.has(`capture`),ZD=(e,t)=>`foss-design.camera.${e}.${t}`;function QD(e){try{let t=JSON.parse(sessionStorage.getItem(e)??`null`);if(t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.z))return t}catch{}return null}function $D(e){let t=r_(),n=YD.get(`theme`),[r,i]=(0,m.useState)(n===`dark`||n===`light`?n:null);return[r??e?.theme??t,i]}function eO({canvasId:e,pageId:t}){let{data:n,error:r,isLoading:i}=Bg(e);if(r)return(0,h.jsx)(hT,{title:`Canvas not found`,text:r.message});if(i||!n)return(0,h.jsx)(`div`,{className:`canvas-dots grow`});let a=t??YD.get(`page`)??void 0,o=n.pages.find(e=>e.id===a)??n.pages[0];return(0,h.jsx)(tO,{canvas:n,page:o},`${n.id}/${o?.id??``}`)}function tO({canvas:e,page:t}){let[,n]=jf(),r=(0,m.useMemo)(()=>PT(),[]),i=(0,m.useMemo)(()=>new vT,[]),a=(0,m.useRef)(null),[o,s]=$D(e),[c,l]=(0,m.useState)(()=>!XD&&window.innerWidth>900),[u,d]=(0,m.useState)(!1),f=Jg(r,e=>e.sizes),p=(0,m.useMemo)(()=>t?kT(t,f):{items:[],sections:[],bounds:{x:0,y:0,w:0,h:0}},[t,f]),g=cO(Jg(r,e=>e.frameEls),p),_=LC(g),v=u||_;(0,m.useEffect)(()=>{r.set(e=>e.inspecting===v?e:{...e,inspecting:v,active:null})},[v,r]);let y=IC(g,v,{onEscape:()=>d(!1)}),b=y.info?.el;(0,m.useEffect)(()=>{b&&d(!0)},[b]),(0,m.useEffect)(()=>{let e=y.frame;if(!e)return;let t=Object.entries(r.get().frameEls).find(([,t])=>t===e)?.[0];t&&r.get().selected!==t&&r.set(e=>({...e,selected:t}))},[y.frame,r]);let x=(0,m.useMemo)(()=>AT(p),[p]),S=ZD(e.id,t?.id??``),C=(0,m.useRef)(!1);(0,m.useEffect)(()=>{if(C.current||!p.bounds.w)return;C.current=!0;let t=Kg(e.id),n=XD?null:QD(S);t?(r.set(e=>({...e,selected:t})),requestAnimationFrame(()=>a.current?.fitItem(t,!1))):n?i.set(n):requestAnimationFrame(()=>a.current?.fitAll(!1))},[p,i,S,e.id,r]),(0,m.useEffect)(()=>{if(XD)return;let e,t=i.subscribe(t=>{clearTimeout(e),e=setTimeout(()=>sessionStorage.setItem(S,JSON.stringify(t)),250)});return()=>{t(),clearTimeout(e)}},[i,S]);let w=(0,m.useCallback)(e=>{let t=e?p.items.find(t=>t.item.id===e)?.item:void 0;r.set(e=>({...e,selected:t?t.id:null,active:t&&ET(t)?t.id:null,hovered:null}))},[p,r]),T=(0,m.useCallback)(e=>{w(e),a.current?.fitItem(e)},[w]),E=(0,m.useCallback)(r=>n(`/c/${encodeURIComponent(e.id)}/play/${encodeURIComponent(r)}${t?`?page=${encodeURIComponent(t.id)}`:``}`),[e.id,t,n]);(0,m.useEffect)(()=>{let t=t=>{let n=t.detail;n.canvas===e.id&&p.items.some(e=>e.item.id===n.item)&&(Kg(e.id),T(n.item))};return window.addEventListener(`design:focus`,t),()=>window.removeEventListener(`design:focus`,t)},[e.id,p,T]);let D=(0,m.useMemo)(()=>({onGo(r,i){let[a,o]=i.includes(`/`)?i.split(`/`):[null,i],s=a?e.pages.filter(e=>e.id===a):[t,...e.pages.filter(e=>e!==t)];for(let r of s)if(r&&r.sections.some(e=>e.items.some(e=>e.id===o))){r===t?T(o):(n(MT(e,r)),window.dispatchEvent(new CustomEvent(`design:focus`,{detail:{canvas:e.id,item:o}})));return}console.warn(`[design] go("${i}"): no such screen`)},onWheel(e,t){let n=e.closest(`.canvas-dots`);if(!n)return;let r=n.getBoundingClientRect(),a=e.getBoundingClientRect(),o=i.camera.z;if(t.zoom){let e=Math.abs(t.deltaY)<40?.012:.0025;i.zoomAt(a.left-r.left+t.x*o,a.top-r.top+t.y*o,Math.exp(-t.deltaY*e))}else i.panBy(-t.deltaX,-t.deltaY)},onEscape(){r.set(e=>({...e,active:null}))}}),[e,t,i,r,T,n]);return(0,m.useEffect)(()=>{if(!XD)return;let e=Date.now(),t=setInterval(()=>{let n=r.get().frames;(x.every(e=>n[e.item.id]?.ready||e.item.kind===`screen`&&e.item.missing)||Date.now()-e>6e4)&&(clearInterval(t),a.current?.fitAll(!1),requestAnimationFrame(()=>requestAnimationFrame(()=>window.__DESIGN_CANVAS_READY__=!0)))},250);return()=>clearInterval(t)},[x,r]),(0,m.useEffect)(()=>{let i=i=>{if(JD(i.target)||document.querySelector(`[role="dialog"]`))return;let o=a.current,s=r.get(),c=i.metaKey||i.ctrlKey;if(i.key===`Escape`)y.info?y.select(null):u?d(!1):s.active?r.set(e=>({...e,active:null})):s.selected&&r.set(e=>({...e,selected:null}));else if(i.key===`i`&&!c&&!i.altKey)d(e=>!e);else if(i.shiftKey&&i.code===`Digit1`)o?.fitAll();else if(i.shiftKey&&i.code===`Digit2`&&s.selected)o?.fitItem(s.selected);else if(i.shiftKey&&i.code===`Digit0`)o?.zoomTo(1);else if((i.key===`=`||i.key===`+`)&&!i.altKey)i.preventDefault(),o?.zoomBy(1.4);else if(i.key===`-`&&!i.altKey)i.preventDefault(),o?.zoomBy(1/1.4);else if(c&&i.key===`0`)i.preventDefault(),o?.zoomTo(1);else if(c&&i.key===`\\`)i.preventDefault(),l(e=>!e);else if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(i.key)&&x.length){i.preventDefault();let e=x.findIndex(e=>e.item.id===s.selected),t=i.key===`ArrowRight`||i.key===`ArrowDown`?1:-1,n=x[e===-1?0:(e+t+x.length)%x.length];r.set(e=>({...e,selected:n.item.id,active:null})),o?.fitItem(n.item.id)}else if(i.key===`Enter`&&s.selected){let e=p.items.find(e=>e.item.id===s.selected)?.item;e&&ET(e)&&E(e.id)}else if(i.key===`]`||i.key===`[`){let r=t?e.pages.indexOf(t):-1,a=e.pages[r+(i.key===`]`?1:-1)];a&&n(MT(e,a))}};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[r,x,p,E,e,t,n,u,y]),XD?(0,h.jsx)(`div`,{className:`flex h-dvh`,children:(0,h.jsx)(qD,{layout:p,theme:o,store:r,camera:i,events:D,capture:!0,apiRef:a,onPlay:()=>{},onSelect:()=>{}})}):(0,h.jsxs)(`div`,{className:`flex h-dvh flex-col`,children:[(0,h.jsx)(nO,{canvas:e,page:t,theme:o,onTheme:s,sidebar:c,onSidebar:l,inspect:u,onInspect:d,onPlay:()=>{let e=r.get().selected,t=e&&x.find(t=>t.item.id===e)||x[0];t&&E(t.item.id)},canPlay:x.length>0}),(0,h.jsxs)(`div`,{className:`flex min-h-0 grow`,children:[(0,h.jsx)(dw,{open:c&&!!t,side:`left`,width:264,children:t?(0,h.jsx)(NT,{canvas:e,page:t,store:r,onPick:T}):null}),(0,h.jsxs)(`div`,{className:`relative min-w-0 grow`,children:[t&&p.items.length?(0,h.jsx)(qD,{layout:p,theme:o,store:r,camera:i,events:D,capture:!1,apiRef:a,onPlay:E,onSelect:w}):(0,h.jsx)(`div`,{className:`canvas-dots flex h-full`,children:(0,h.jsx)(ww,{title:t?`This page is empty`:`This canvas has no pages`,text:(0,h.jsxs)(h.Fragment,{children:[`Add sections and screens to`,` `,(0,h.jsxs)(`code`,{className:`font-mono text-[13px]`,children:[`.design/canvas/`,e.id,`/canvas.json`]}),`.`]})})}),(0,h.jsx)(rO,{canvas:e,store:r,layoutItems:p.items.map(e=>e.item),theme:o,onPlay:E,inspect:v}),(0,h.jsx)(aO,{camera:i,apiRef:a}),e.issues.length?(0,h.jsx)(oO,{canvas:e}):null]}),(0,h.jsx)(dw,{open:u,side:`right`,width:320,children:(0,h.jsx)(qC,{info:y.info,active:!0,onSelect:e=>y.select(e),onClose:()=>{d(!1),y.select(null)}})})]})]})}function nO({canvas:e,page:t,theme:n,onTheme:r,sidebar:i,onSidebar:a,onPlay:o,canPlay:s,inspect:c,onInspect:l}){let[,u]=jf();return(0,h.jsxs)(IS,{children:[(0,h.jsx)(mT,{content:`All canvases`,children:(0,h.jsx)(Lf,{href:`/`,className:`flex items-center`,"aria-label":`All canvases`,children:(0,h.jsx)(PS,{})})}),(0,h.jsx)(y_,{icon:`panel-left`,label:i?`Hide sidebar (⌘\\)`:`Show sidebar (⌘\\)`,onClick:()=>a(!i)}),(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[14px]`,children:[(0,h.jsx)(`span`,{className:`truncate font-semibold`,children:e.title}),t&&e.pages.length>1?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Z,{name:`chevron-right`,size:14,className:`shrink-0 text-muted`}),(0,h.jsxs)(DS,{width:240,trigger:(0,h.jsxs)(`button`,{type:`button`,className:`flex h-ctrl cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-[14px] text-ink2 hover:bg-soft2`,children:[(0,h.jsx)(`span`,{className:`truncate`,children:t.title}),(0,h.jsx)(Z,{name:`chevron-down`,size:14,className:`text-muted`})]}),children:[(0,h.jsx)(jS,{children:`Pages`}),e.pages.map(n=>(0,h.jsxs)(kS,{active:n.id===t.id,onSelect:()=>u(MT(e,n)),children:[(0,h.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),n.title]},n.id))]})]}):null]}),(0,h.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,h.jsx)(vw,{label:`Screen theme`,value:n,onChange:r,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:15}),title:`Light screens`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:15}),title:`Dark screens`}]}),(0,h.jsx)(sO,{on:c,onChange:l}),(0,h.jsx)(g_,{kind:`secondary`,icon:`play`,onClick:o,disabled:!s,children:`Play`}),(0,h.jsx)(p_,{width:200,label:`Search`}),(0,h.jsx)(NS,{})]})]})}function rO({canvas:e,store:t,layoutItems:n,theme:r,onPlay:i,inspect:a}){let o=Jg(t,e=>e.selected),s=Jg(t,e=>e.active),c=Jg(t,e=>o?e.frames[o]:void 0),l=n.find(e=>e.id===o);if(!l)return null;let u=l.kind===`screen`||l.kind===`url`,d=l.kind===`screen`?_w(gw(l.url,l.theme??r)):l.kind===`url`?l.url:null,f=()=>{let e=document.querySelector(`[data-item="${CSS.escape(l.id)}"] iframe`);try{e?.contentWindow?.location.reload()}catch{e?.setAttribute(`src`,e.getAttribute(`src`)??``)}},p=c?.errors??[];return(0,h.jsx)(`div`,{"data-ui":!0,className:`pointer-events-none absolute inset-x-0 bottom-5 z-20 flex justify-center px-4`,children:(0,h.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full flex-col overflow-hidden rounded-[10px] border border-rule bg-surface shadow-pop animate-[q-pop_120ms_ease-out]`,children:[p.length?(0,h.jsxs)(`div`,{className:`flex max-h-40 items-start gap-2 overflow-y-auto border-b border-rule bg-danger-soft px-3.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),(0,h.jsx)(`span`,{className:`min-w-0`,children:p.join(`
136
- `)})]}):null,(0,h.jsxs)(`div`,{className:`flex h-[44px] items-center gap-1 pr-1.5 pl-3.5`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2`,children:[(0,h.jsx)(`span`,{className:`truncate text-[13.5px] font-medium`,children:l.title||l.id}),u&&s===l.id?(0,h.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[12px] text-muted`,children:[(0,h.jsx)(Z,{name:`pointer`,size:13}),` `,a?`Inspecting`:`Interacting`,` `,(0,h.jsx)(a_,{children:`esc`})]}):u?(0,h.jsx)(`span`,{className:`shrink-0 text-[12px] text-muted`,children:a?`Click an element to inspect it`:`Click the screen to interact`}):null]}),u?(0,h.jsx)(mT,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Play `,(0,h.jsx)(a_,{children:`↵`})]}),children:(0,h.jsx)(y_,{icon:`play`,label:`Play`,onClick:()=>i(l.id)})}):null,d?(0,h.jsx)(mT,{content:`Open in a new tab`,children:(0,h.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,"aria-label":`Open in a new tab`,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,children:(0,h.jsx)(Z,{name:`external`,size:16})})}):null,u?(0,h.jsx)(mT,{content:`Reload`,children:(0,h.jsx)(y_,{icon:`refresh`,label:`Reload`,onClick:f})}):null,l.kind===`screen`?(0,h.jsx)(mT,{content:`Copy source path`,children:(0,h.jsx)(y_,{icon:`copy`,label:`Copy source path`,onClick:()=>void hC(l.file,`Path copied`)})}):null,(0,h.jsx)(mT,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Zoom to `,(0,h.jsx)(a_,{children:`⇧2`})]}),children:(0,h.jsx)(y_,{icon:`fit`,label:`Zoom to`,onClick:()=>window.dispatchEvent(new CustomEvent(`design:focus`,{detail:{canvas:e.id,item:l.id}}))})})]})]})})}function iO({camera:e}){let[t,n]=(0,m.useState)(e.camera.z);return(0,m.useEffect)(()=>{let t=0;return e.subscribe(e=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>n(e.z))})},[e]),(0,h.jsxs)(h.Fragment,{children:[Math.round(t*100),`%`]})}function aO({camera:e,apiRef:t}){return(0,h.jsxs)(`div`,{"data-ui":!0,className:`absolute right-4 bottom-5 z-20 flex h-[46px] items-center gap-0.5 rounded-[10px] border border-rule bg-surface px-1.5 shadow-pop`,children:[(0,h.jsx)(y_,{icon:`zoom-out`,label:`Zoom out (−)`,onClick:()=>t.current?.zoomBy(1/1.4)}),(0,h.jsxs)(DS,{side:`top`,align:`end`,width:210,trigger:(0,h.jsx)(`button`,{type:`button`,className:`h-ctrl min-w-[56px] cursor-pointer rounded-[6px] border-0 bg-transparent px-1.5 text-[12.5px] font-medium text-ink2 tabular hover:bg-soft2`,children:(0,h.jsx)(iO,{camera:e})}),children:[(0,h.jsx)(kS,{onSelect:()=>t.current?.fitAll(),hint:`⇧1`,children:`Zoom to fit`}),(0,h.jsx)(kS,{onSelect:()=>t.current?.zoomTo(1),hint:`⇧0`,children:`100%`}),(0,h.jsx)(AS,{}),[.25,.5,2].map(e=>(0,h.jsxs)(kS,{onSelect:()=>t.current?.zoomTo(e),children:[e*100,`%`]},e))]}),(0,h.jsx)(y_,{icon:`zoom-in`,label:`Zoom in (+)`,onClick:()=>t.current?.zoomBy(1.4)}),(0,h.jsx)(`div`,{className:`mx-0.5 h-5 w-px bg-rule`}),(0,h.jsx)(y_,{icon:`fit`,label:`Zoom to fit (⇧1)`,onClick:()=>t.current?.fitAll()})]})}function oO({canvas:e}){let t=e.issues.filter(e=>e.severity===`error`).length;return(0,h.jsxs)(sC,{children:[(0,h.jsx)(cC,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,"data-ui":!0,className:`absolute bottom-5 left-4 z-20 flex h-[46px] cursor-pointer items-center gap-2 rounded-[10px] border border-rule bg-surface px-3.5 text-[13px] font-medium shadow-pop hover:bg-soft`,children:[(0,h.jsx)(Z,{name:`alert`,size:15,className:t?`text-danger-text`:`text-action`}),e.issues.length,` `,e.issues.length===1?`problem`:`problems`,` in canvas.json`]})}),(0,h.jsx)(lC,{children:(0,h.jsx)(uC,{side:`top`,align:`start`,sideOffset:8,collisionPadding:12,className:`z-50 max-h-[50vh] w-[460px] max-w-[calc(100vw-24px)] overflow-y-auto rounded-[10px] border border-rule bg-surface shadow-pop outline-none data-[state=open]:animate-[q-pop_120ms_ease-out]`,children:(0,h.jsx)(cw,{issues:e.issues})})})]})}function sO({on:e,onChange:t}){return(0,h.jsx)(mT,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Inspect elements `,(0,h.jsx)(a_,{children:`I`})]}),children:(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(!e),className:e?`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-action-line bg-action-soft px-ctrl text-ctrl font-medium text-action`:`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-rule-strong bg-surface px-ctrl text-ctrl font-medium text-ink hover:bg-soft`,children:[(0,h.jsx)(Z,{name:`pointer`,size:15}),`Inspect`]})})}function cO(e,t){let n=(0,m.useRef)([]);return(0,m.useMemo)(()=>{let r=new Set(t.items.filter(e=>e.item.kind===`screen`).map(e=>e.item.id)),i=Object.entries(e).filter(e=>!!e[1]&&r.has(e[0])).map(([,e])=>e);return i.length===n.current.length&&i.every((e,t)=>e===n.current[t])||(n.current=i),n.current},[e,t])}function lO(e,t){return(t?e.pages.filter(e=>e.id===t):e.pages).flatMap(t=>t.sections.flatMap(n=>n.items.filter(e=>e.kind===`screen`||e.kind===`url`).map(r=>({item:r,pageId:t.id,where:[e.pages.length>1?t.title:null,n.title].filter(Boolean).join(` · `)}))))}var uO=(e,t,n)=>`/c/${encodeURIComponent(e)}/play/${encodeURIComponent(t)}?page=${encodeURIComponent(n)}`;function dO({canvasId:e,itemId:t}){let{data:n,error:r,isLoading:i}=Bg(e);return r?(0,h.jsx)(hT,{title:`Canvas not found`,text:r.message}):i||!n?null:(0,h.jsx)(fO,{canvas:n,itemId:t})}function fO({canvas:e,itemId:t}){let[,n]=jf(),r=new URLSearchParams(window.location.search).get(`page`)??(window.location.hash.split(`?`)[1]?new URLSearchParams(window.location.hash.split(`?`)[1]).get(`page`):null),i=(0,m.useMemo)(()=>lO(e,null),[e]),a=i.find(e=>e.item.id===t),o=r??a?.pageId??null,s=(0,m.useMemo)(()=>o?lO(e,o):i,[e,o,i]),c=s.findIndex(e=>e.item.id===t),l=r_(),[u,d]=(0,m.useState)(e.theme??l),[f,p]=(0,m.useState)(`fit`),g=(0,m.useRef)(null),_=(0,m.useRef)(null),[v,y]=(0,m.useState)(null),b=(0,m.useCallback)(e=>{_.current=e,y(e)},[]),[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)({w:0,h:0}),[T,E]=(0,m.useState)([]),D=o?`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(o)}`:`/c/${encodeURIComponent(e.id)}`,O=t=>{if(!s.length)return;let r=s[(c+t+s.length)%s.length];n(uO(e.id,r.item.id,r.pageId),{replace:!0})};(0,m.useLayoutEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>w({w:e.clientWidth,h:e.clientHeight}));return t.observe(e),()=>t.disconnect()},[]),(0,m.useEffect)(()=>{let e=e=>{JD(e.target)||document.querySelector(`[role="dialog"]`)||(e.key===`ArrowRight`?O(1):e.key===`ArrowLeft`?O(-1):e.key===`i`&&!e.metaKey&&!e.ctrlKey&&!e.altKey?S(e=>!e):e.key===`Escape`&&(ie.info?ie.select(null):x?S(!1):n(D)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let k=s[c],A=k?.item,j=A?.kind===`screen`?A.theme??u:u,[ee]=(0,m.useState)(j),te=A?A.kind===`screen`?gw(A.url,ee):A.url:``,ne=(0,m.useMemo)(()=>v&&A?.kind===`screen`?[v]:[],[v,A?.kind]),re=LC(ne),ie=IC(ne,x||re,{onEscape:()=>S(!1)}),ae=ie.info?.el;if((0,m.useEffect)(()=>{ae&&S(!0)},[ae]),(0,m.useEffect)(()=>{let t=_.current;if(t&&A?.kind===`screen`)return E([]),pw(t,t=>{if(t.type===`error`)E(e=>e.includes(t.message)?e:[...e,t.message]);else if(t.type===`updated`)E([]);else if(t.type===`keydown`&&t.code===`Escape`)n(D);else if(t.type===`go`){let[r,a]=t.target.includes(`/`)?t.target.split(`/`):[null,t.target],o=i.find(e=>e.item.id===a&&(!r||e.pageId===r));o&&n(uO(e.id,o.item.id,o.pageId))}})},[A,te,i,e.id,n,D]),(0,m.useEffect)(()=>{A?.kind===`screen`&&hw(_.current,j)},[j,A]),!A)return(0,h.jsx)(hT,{title:`Screen not found`,text:`No screen "${t}" on this canvas.`});let M=A.frame.width,oe=A.frame.height===`auto`?Math.max(C.h-48,400):A.frame.height,se=f===`fit`?Math.min(1,(C.w-48)/M,(C.h-48)/oe):1,ce=M<=C.w-48&&oe<=C.h-48,le=A.kind===`screen`?_w(gw(A.url,j)):A.url;return(0,h.jsxs)(`div`,{className:`flex h-dvh flex-col`,children:[(0,h.jsxs)(IS,{children:[(0,h.jsx)(mT,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Back to canvas `,(0,h.jsx)(a_,{children:`esc`})]}),children:(0,h.jsx)(Lf,{href:D,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,"aria-label":`Back to canvas`,children:(0,h.jsx)(Z,{name:`arrow-left`,size:16})})}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:[(0,h.jsx)(`span`,{className:`truncate text-[14px] font-semibold`,children:A.title}),(0,h.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.title,k.where].filter(Boolean).join(` · `)})]}),(0,h.jsxs)(`div`,{className:`mx-auto flex items-center gap-1`,children:[(0,h.jsx)(y_,{icon:`chevron-left`,label:`Previous screen (←)`,onClick:()=>O(-1),disabled:s.length<2}),(0,h.jsxs)(`span`,{className:`min-w-[52px] text-center text-[12.5px] text-muted tabular`,children:[c+1,` / `,s.length]}),(0,h.jsx)(y_,{icon:`chevron-right`,label:`Next screen (→)`,onClick:()=>O(1),disabled:s.length<2})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce?null:(0,h.jsx)(vw,{label:`Scale`,value:f,onChange:p,items:[{value:`fit`,label:`Fit`},{value:`actual`,label:`100%`}]}),A.kind===`screen`&&!A.theme?(0,h.jsx)(vw,{label:`Screen theme`,value:u,onChange:d,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:15}),title:`Light`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:15}),title:`Dark`}]}):null,A.kind===`screen`?(0,h.jsx)(sO,{on:x,onChange:S}):null,(0,h.jsx)(y_,{icon:`refresh`,label:`Reload`,onClick:()=>{try{_.current?.contentWindow?.location.reload()}catch{}}}),(0,h.jsx)(`a`,{href:le,target:`_blank`,rel:`noreferrer`,title:`Open in a new tab`,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,children:(0,h.jsx)(Z,{name:`external`,size:16})}),(0,h.jsx)(NS,{})]})]}),(0,h.jsxs)(`div`,{className:`flex min-h-0 grow`,children:[(0,h.jsxs)(`div`,{ref:g,className:`canvas-dots relative min-w-0 grow ${f===`actual`?`overflow-auto`:`overflow-hidden`}`,children:[T.length?(0,h.jsxs)(`div`,{className:`absolute inset-x-0 top-0 z-10 flex items-start gap-2 border-b border-rule bg-danger-soft px-4 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),T.join(`
137
- `)]}):null,(0,h.jsx)(`div`,{className:`flex min-h-full min-w-full items-center justify-center p-6`,style:{width:f===`actual`?M+48:void 0},children:(0,h.jsx)(`div`,{className:`shrink-0 overflow-hidden bg-surface`,style:{width:M*se,height:oe*se,boxShadow:`var(--shadow-frame), 0 0 0 1px var(--rule)`},children:(0,h.jsx)(`iframe`,{ref:b,src:te,title:A.title,allow:`clipboard-read; clipboard-write; fullscreen`,className:`block border-0`,style:{width:M,height:oe,transform:`scale(${se})`,transformOrigin:`0 0`,colorScheme:j},onLoad:()=>A.kind===`screen`&&hw(_.current,j)},`${A.id}:${A.kind===`screen`?A.rev:A.url}`)})})]}),(0,h.jsx)(dw,{open:x,side:`right`,width:320,children:(0,h.jsx)(qC,{info:ie.info,active:!0,onSelect:e=>ie.select(e),onClose:()=>{S(!1),ie.select(null)}})})]})]})}var pO=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60]],mO=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function hO(e){if(!e)return``;let t=(e-Date.now())/1e3;for(let[e,n]of pO)if(Math.abs(t)>=n)return mO.format(Math.round(t/n),e);return`just now`}function gO(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(+(e<10240))} KB`:`${(e/1024/1024).toFixed(1)} MB`}function _O(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function vO({canvas:e}){return(0,h.jsx)(`div`,{className:`flex h-[54px] w-[86px] shrink-0 items-center justify-center overflow-hidden rounded-[6px] border border-rule bg-soft`,children:e.cover?(0,h.jsx)(`img`,{src:e.cover,alt:``,className:`h-full w-full object-cover object-top`}):(0,h.jsx)(Z,{name:`canvas`,size:18,className:`text-muted`})})}function yO({project:e}){return e.canvases.length?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Canvases`,count:e.canvases.length}),e.canvases.map(e=>(0,h.jsxs)(aw,{to:`/c/${encodeURIComponent(e.id)}`,cols:`86px minmax(0,1fr) auto auto`,align:`llrr`,pad:`10px 16px`,minH:74,children:[(0,h.jsx)(vO,{canvas:e}),(0,h.jsx)(o_,{top:e.title,bottom:(0,h.jsx)(`span`,{className:`truncate`,children:e.description??e.id})}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-[12.5px] whitespace-nowrap text-muted`,children:[e.issues?(0,h.jsx)(YC,{tone:`danger`,children:_O(e.issues,`problem`)}):null,_O(e.screens,`screen`),` · `,_O(e.pages,`page`)]}),(0,h.jsx)(`span`,{className:`w-[92px] text-[12.5px] whitespace-nowrap text-muted`,children:hO(e.updatedAt)})]},e.id))]}):(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Canvases`,count:0}),(0,h.jsx)(sw,{children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 py-6 text-center`,children:[(0,h.jsx)(`span`,{className:`text-[14px] text-ink2`,children:`No canvases yet.`}),(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Ask your agent to design something, or run `,(0,h.jsx)(Q,{children:`design new <name>`}),` in the project.`]})]})})]})}function bO({project:e}){let t=e.system;return t?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Design system`,right:(0,h.jsx)(b_,{to:`/system`,children:`Open`})}),(0,h.jsxs)(sw,{gap:6,children:[(0,h.jsx)(`span`,{className:`text-[15px] font-semibold`,children:t.name}),t.description?(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:t.description}):null]}),(0,h.jsx)(ow,{label:`Tokens`,labelWidth:120,children:(0,h.jsx)(XC,{value:t.tokens})}),(0,h.jsx)(ow,{label:`Components`,labelWidth:120,children:(0,h.jsx)(XC,{value:t.components})}),(0,h.jsx)(ow,{label:`Guidelines`,labelWidth:120,children:(0,h.jsx)(XC,{value:t.guidelines})}),t.issues?(0,h.jsx)(ow,{label:`Problems`,labelWidth:120,children:(0,h.jsx)(YC,{tone:`danger`,children:t.issues})}):null]}):(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Design system`}),(0,h.jsx)(sw,{children:(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`No design system yet. Ask your agent to build one from the codebase, or run `,(0,h.jsx)(Q,{children:`design system init`}),`.`]})})]})}function xO(){let{data:e,error:t,isLoading:n}=zg();return t?(0,h.jsx)(ww,{title:`Could not load the project`,text:t.message}):n||!e?null:(0,h.jsxs)(yw,{children:[(0,h.jsx)(bw,{title:e.name,sub:Mg?`Snapshot built with foss-design ${e.version}`:(0,h.jsxs)(Q,{size:12.5,children:[e.root,`/.design`]})}),(0,h.jsx)(lw,{issues:e.issues,title:`Problems in design.json`}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5 max-lg:grid-cols-1!`,style:{gridTemplateColumns:`minmax(0,1fr) 340px`},children:[(0,h.jsx)(yO,{project:e}),(0,h.jsx)(bO,{project:e})]})]})}function SO(e){let t=e.utility;if(t===void 0)return[];let n=t?`-${t}`:``;switch(e.kind){case`color`:return[`bg${n}`,`text${n}`,`border${n}`];case`font`:return[`font${n}`];case`text`:return[`text${n}`];case`weight`:return[`font${n}`];case`leading`:return[`leading${n}`];case`tracking`:return[`tracking${n}`];case`spacing`:return t?[`p${n}`,`gap${n}`]:[`p-1`,`gap-4`,`m-2`];case`radius`:return[`rounded${n}`];case`shadow`:return e.name.startsWith(`--inset-shadow-`)?[`inset-shadow${n}`]:e.name.startsWith(`--drop-shadow-`)?[`drop-shadow${n}`]:e.name.startsWith(`--text-shadow-`)?[`text-shadow${n}`]:[`shadow${n}`];case`blur`:return[`blur${n}`,`backdrop-blur${n}`];case`ease`:return[`ease${n}`];case`animation`:return[`animate${n}`];case`breakpoint`:return e.name.startsWith(`--container-`)?[`@${t}:`,`max-w${n}`]:[`${t}:`];default:return[]}}function CO(e,...t){return e.filter(e=>t.includes(e.kind))}function wO(e){let t=new Map;for(let n of e){let e=t.get(n.group)??[];e.push(n),t.set(n.group,e)}return[...t].map(([e,t])=>({group:e,tokens:t}))}function TO(e){let t=/^(-?[\d.]+)(px|rem|em)?$/.exec(e.trim());if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?t[2]===`rem`||t[2]===`em`?n*16:n:null}function EO(e,t){return(t===`dark`?e.dark?.value:void 0)??e.light?.value}function DO(){let e=r_(),[t,n]=(0,m.useState)(null);return[t??e,n]}function OO({value:e,onChange:t}){return(0,h.jsx)(vw,{label:`Theme`,size:`sm`,value:e,onChange:t,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:14}),title:`Light`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:14}),title:`Dark`}]})}function kO({items:e}){return e.length?(0,h.jsx)(`span`,{className:`flex min-w-0 flex-wrap gap-x-2 gap-y-0.5`,children:e.map(e=>(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e},e))}):null}function AO({title:e,children:t}){return(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:e}),(0,h.jsx)(sw,{children:(0,h.jsx)(`div`,{className:`py-4 text-[13px] text-muted`,children:t})})]})}var jO=`.design/system/tokens.css`;function MO({children:e,className:t}){return(0,h.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere] ${t??``}`,children:e})}function NO({asset:e,index:t}){if(e.kind===`image`)return(0,h.jsx)(`span`,{className:`checker flex h-[132px] items-center justify-center overflow-hidden border-b border-rule`,children:(0,h.jsx)(`img`,{src:e.url,alt:``,className:`max-h-[96px] max-w-[80%] object-contain`})});if(e.kind===`font`){let n=`design-asset-font-${t}`;return(0,h.jsxs)(`span`,{className:`flex h-[132px] items-center justify-center border-b border-rule bg-soft`,children:[(0,h.jsx)(`style`,{children:`@font-face{font-family:"${n}";src:url("${e.url.replace(/"/g,`%22`)}")}`}),(0,h.jsx)(`span`,{className:`text-[52px] leading-none text-ink`,style:{fontFamily:`"${n}", var(--font-sans)`},children:`Aa`})]})}return(0,h.jsx)(`span`,{className:`flex h-[132px] items-center justify-center border-b border-rule bg-soft text-muted`,children:(0,h.jsx)(Z,{name:`file`,size:28})})}function PO({system:e}){return e.assets.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Assets`,sub:`Click an asset to copy its import path.`}),(0,h.jsx)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(210px, 1fr))`},children:e.assets.map((e,t)=>(0,h.jsx)(`button`,{type:`button`,title:`Copy the import path`,onClick:()=>hC(`@system/${e.path}`),className:`block cursor-pointer border-0 bg-transparent p-0 text-left`,children:(0,h.jsxs)(ZC,{className:`transition-colors hover:border-rule-strong`,children:[(0,h.jsx)(NO,{asset:e,index:t}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-3.5 py-2.5`,children:[(0,h.jsx)(`span`,{className:`truncate text-[13.5px] font-medium text-ink`,children:e.name}),(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[12.5px] text-muted`,children:[(0,h.jsx)(`span`,{className:`shrink-0`,children:gO(e.size)}),(0,h.jsx)(Q,{size:12,className:`truncate`,children:e.path})]})]})]})},e.path))})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Assets`}),(0,h.jsxs)(AO,{title:`No assets`,children:[`Put logos, icons, images and font files in `,(0,h.jsx)(Q,{children:`.design/system/assets`}),`; screens import them as`,` `,(0,h.jsx)(Q,{children:`@system/assets/…`}),`.`]})]})}function FO({color:e,label:t,className:n}){return e?(0,h.jsx)(`span`,{title:`${t}: ${e}`,className:X(`checker relative h-[30px] w-[44px] shrink-0 overflow-hidden rounded-[6px]`,n),children:(0,h.jsx)(`span`,{className:`absolute inset-0 rounded-[6px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.1)] dark:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.12)]`,style:{background:e}})}):(0,h.jsx)(`span`,{className:X(`h-[30px] w-[44px] shrink-0`,n)})}function IO({tokens:e}){let t=e.some(e=>e.dark),n=t=>(0,h.jsxs)(`div`,{className:`relative flex h-9 min-w-0 grow overflow-hidden rounded-[6px]`,children:[(0,h.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 rounded-[6px] shadow-[inset_0_0_0_1px_var(--rule-strong)] opacity-60`}),e.map(e=>{let n=t===`dark`?e.dark?.value??e.light?.value:e.light?.value;return(0,h.jsx)(`button`,{type:`button`,title:`${e.name}: ${n}`,onClick:()=>hC(`var(${e.name})`),className:`h-full min-w-0 flex-1 cursor-pointer border-0 p-0 transition-[flex-grow] duration-150 hover:grow-[1.6]`,style:{background:n}},e.name)})]});return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-rule px-4 py-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t?(0,h.jsx)(`span`,{className:`w-9 shrink-0 text-[12px] text-muted`,children:`Light`}):null,n(`light`)]}),t?(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`span`,{className:`w-9 shrink-0 text-[12px] text-muted`,children:`Dark`}),n(`dark`)]}):null]})}function LO({token:e}){return(0,h.jsxs)(iw,{cols:`100px minmax(170px, 0.9fr) minmax(0, 1.4fr)`,minH:56,title:`Copy the variable`,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(FO,{color:e.light?.value,label:`Light`}),e.dark?(0,h.jsx)(FO,{color:e.dark.value,label:`Dark`}):null]}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(kO,{items:SO(e).slice(0,2)})]}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap gap-x-3`,children:[(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),e.dark?(0,h.jsxs)(Q,{size:12,className:`text-muted`,children:[`dark `,e.dark.value]}):null]}),e.description?(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.description}):null]})]})}function RO({system:e}){let t=CO(e.tokens,`color`),n=wO(t);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Colors`,sub:t.length?`${t.length} tokens · click a color to copy its variable`:void 0}),n.length?n.map(({group:e,tokens:t})=>(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:e,count:t.length}),(0,h.jsx)(IO,{tokens:t}),t.map(e=>(0,h.jsx)(LO,{token:e},e.name))]},e)):(0,h.jsxs)(AO,{title:`No color tokens`,children:[`Add them to `,(0,h.jsx)(Q,{children:jO}),`: light values in `,(0,h.jsx)(Q,{children:`:root`}),`, dark ones in`,` `,(0,h.jsx)(Q,{children:`:root[data-theme="dark"]`}),`, and map them to Tailwind with `,(0,h.jsx)(Q,{children:`--color-*`}),` in`,` `,(0,h.jsx)(Q,{children:`@theme inline`}),`.`]})]})}function zO({src:e,theme:t,title:n,minHeight:r=120,width:i,className:a}){let o=(0,m.useRef)(null),[s]=(0,m.useState)(()=>({src:e,theme:t})),c=gw(e,s.src===e?s.theme:t),[l,u]=(0,m.useState)(r),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)([]);return(0,m.useEffect)(()=>{let e=o.current;if(e)return f(!1),g([]),pw(e,e=>{e.type===`size`?u(Math.max(r,e.height)):e.type===`ready`?f(!0):e.type===`error`?g(t=>t.includes(e.message)?t:[...t,e.message]):e.type===`updated`&&g([])})},[r,c]),(0,m.useEffect)(()=>{hw(o.current,t)},[t]),(0,h.jsxs)(`div`,{className:X(`relative`,a),style:{width:i},children:[p.length?(0,h.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-rule bg-danger-soft px-4 py-2.5 text-[12.5px] text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:15,className:`mt-px`}),(0,h.jsx)(`div`,{className:`min-w-0 font-mono break-words`,children:p.join(`
138
- `)})]}):null,(0,h.jsx)(`iframe`,{ref:o,src:c,title:n,className:X(`block w-full border-0 transition-opacity duration-150`,d?`opacity-100`:`opacity-0`),style:{height:l,colorScheme:t},onLoad:()=>hw(o.current,t)},c),d?null:(0,h.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:(0,h.jsx)(Z,{name:`loader`,size:18})})]})}var BO=`identifier keyword string class property entity jsxliterals sign comment break space`.split(` `),[VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO]=BO.map((e,t)=>t);new Map(BO.map((e,t)=>[e,t]));function QO(e,t){let n=[],r=0,i=[],a=!1;function o(e){n.push({index:r++,value:e.map(([,e])=>e).join(``),tokens:e.map(([e,t])=>({type:BO[e],value:t})),annotations:[]})}for(let e=0;e<t.length;e++){let n=t[e],[r,s]=n;if(r!==XO){if(s.includes(`
122
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${KE(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?KE(n,!0):this.parser.parseInline(r),o=JE(e);if(o===null)return a;e=KE(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+KE(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=JE(e);if(i===null)return KE(n);e=i;let a=`<img src="${KE(e)}" alt="${KE(n)}"`;return t&&(a+=` title="${KE(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:KE(e.text)}},sD=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},cD=class e{options;renderer;textRenderer;constructor(e){this.options=e||CT,this.options.renderer=this.options.renderer||new oD,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new sD}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},lD=class{options;block;constructor(e){this.options=e||CT}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?aD.lex:aD.lexInline}provideParser(e=this.block){return e?cD.parse:cD.parseInline}},uD=new class{defaults=ST();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=cD;Renderer=oD;TextRenderer=sD;Lexer=aD;Tokenizer=iD;Hooks=lD;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new oD(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new iD(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new lD;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=lD.passThroughHooks.has(n)?e=>{if(this.defaults.async&&lD.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return aD.lex(e,t??this.defaults)}parser(e,t){return cD.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?aD.lex:aD.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?cD.parse:cD.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?aD.lex:aD.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?cD.parse:cD.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
123
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+KE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function dD(e,t){return uD.parse(e,t)}dD.options=dD.setOptions=function(e){return uD.setOptions(e),dD.defaults=uD.defaults,wT(dD.defaults),dD},dD.getDefaults=ST,dD.defaults=CT;function fD(...e){return uD.use(...e),dD.defaults=uD.defaults,wT(dD.defaults),dD}dD.use=fD,dD.walkTokens=function(e,t){return uD.walkTokens(e,t)},dD.parseInline=uD.parseInline,dD.Parser=cD,dD.parser=cD.parse,dD.Renderer=oD,dD.TextRenderer=sD,dD.Lexer=aD,dD.lexer=aD.lex,dD.Tokenizer=iD,dD.Hooks=lD,dD.parse=dD,dD.options,dD.setOptions,dD.walkTokens,dD.parseInline,cD.parse,aD.lex,dD.use({gfm:!0,breaks:!1});function pD(e){return dD.parse(e,{async:!1}).replace(/<a href=/g,`<a target="_blank" rel="noreferrer" href=`)}function mD({text:e,className:t}){let n=(0,m.useMemo)(()=>pD(e),[e]);return(0,h.jsx)(`div`,{className:X(`prose`,t),dangerouslySetInnerHTML:{__html:n}})}function hD(e,t,n=!0){let r=(0,m.useRef)(null);return(0,m.useLayoutEffect)(()=>{let i=r.current;if(!i||!n)return;let a=new ResizeObserver(()=>yT(e,t,{h:i.offsetHeight}));return a.observe(i),()=>a.disconnect()},[e,t,n]),r}function gD(e){return e<600?`smartphone`:e<1100?`tablet`:`monitor`}var _D=(0,m.memo)(function({placed:e,mode:t,theme:n,store:r,events:i,capture:a}){let{item:o,x:s,y:c,w:l,h:u}=e,d=(0,m.useRef)(null),f=(0,m.useCallback)(e=>{d.current=e,xT(r,o.id,e)},[r,o.id]),p=Jg(r,e=>e.frames[o.id]),g=Jg(r,e=>e.active===o.id),_=Jg(r,e=>e.inspecting&&o.kind===`screen`),v=o.frame.height===`auto`,y=o.kind===`screen`?o.theme??n:n,b=o.kind===`screen`?o.rev:o.url,[x]=(0,m.useState)(y),S=o.kind===`screen`?wC(o.url,x,a?{capture:`1`}:void 0):o.url,C=!!p?.ready,w=t===`off`,T=!w&&!(o.kind===`screen`&&o.missing);(0,m.useEffect)(()=>{w&&bT(r,o.id,{ready:!1})},[w,r,o.id]),(0,m.useEffect)(()=>{let e=d.current;if(e&&!w&&o.kind===`screen`)return vC(e,t=>{switch(t.type){case`ready`:bT(r,o.id,{ready:!0}),bC(e);break;case`size`:v&&yT(r,o.id,{h:Math.max(200,t.height)});break;case`error`:{let e=r.get().frames[o.id]?.errors??[];e.includes(t.message)||bT(r,o.id,{errors:[...e,t.message]});break}case`updated`:bT(r,o.id,{errors:[]});break;case`go`:i.onGo(o.id,t.target);break;case`wheel`:i.onWheel(e,t);break;case`keydown`:t.code===`Escape`&&i.onEscape()}})},[w,o.id,o.kind,v,r,i,S,b]),(0,m.useEffect)(()=>{o.kind===`screen`&&xC(d.current,y)},[y,o.kind]);let E=o.kind===`screen`?o.snapshots?.[y]??o.snapshots?.[y===`dark`?`light`:`dark`]:void 0,D=t===`asleep`&&C&&!!E;return(0,h.jsxs)(`div`,{"data-item":o.id,className:`absolute overflow-hidden bg-surface`,style:{left:s,top:c,width:l,height:u,boxShadow:`var(--shadow-frame), 0 0 0 1px var(--rule)`},children:[(!C||D)&&E?(0,h.jsx)(`img`,{src:E,alt:``,draggable:!1,loading:`lazy`,decoding:`async`,className:`absolute inset-0 h-full w-full object-cover object-top select-none`}):null,!C&&!E?(0,h.jsx)(vD,{item:o,loading:T}):null,T?(0,h.jsx)(`div`,{className:`absolute inset-0`,style:{contentVisibility:D?`hidden`:`visible`},children:(0,h.jsx)(`iframe`,{ref:f,src:S,title:o.title,allow:`clipboard-read; clipboard-write; fullscreen`,className:X(`absolute top-0 left-0 block border-0 transition-opacity duration-200`,C?`opacity-100`:`opacity-0`),style:{width:l,height:u,colorScheme:y},onLoad:()=>{o.kind===`url`?bT(r,o.id,{ready:!0}):(xC(d.current,y),bC(d.current))}},b)}):null,g||_?null:(0,h.jsx)(`div`,{"data-shield":o.id,className:`absolute inset-0`})]})});function vD({item:e,loading:t}){let n=e.kind===`screen`&&e.missing;return(0,h.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-soft text-muted`,children:[(0,h.jsx)(Z,{name:n?`alert`:e.kind===`url`?`globe`:gD(e.frame.width),size:Math.max(24,Math.min(96,e.frame.width/12)),strokeWidth:1.25,className:n?`text-danger-text`:void 0}),(0,h.jsx)(`div`,{className:`max-w-[80%] truncate text-center`,style:{fontSize:Math.max(14,e.frame.width/40)},children:n?`Missing file: ${e.kind===`screen`?e.src:``}`:t?`Loading…`:e.title})]})}var yD=(0,m.memo)(function({placed:e,store:t}){let{item:n,x:r,y:i,w:a}=e,o=hD(t,n.id),s=n.tone===`plain`;return(0,h.jsxs)(`div`,{ref:o,"data-item":n.id,className:X(`absolute`,s?``:`rounded-[10px] border border-note-line bg-note px-6 py-5 shadow-frame`),style:{left:r,top:i,width:a},children:[n.title?(0,h.jsx)(`div`,{className:`mb-2 font-semibold text-ink`,style:{fontSize:s?26:19},children:n.title}):null,(0,h.jsx)(mD,{text:n.text,className:s?`prose-plain`:`prose-note`})]})}),bD=(0,m.memo)(function({placed:e,store:t}){let{item:n,x:r,y:i,w:a,h:o}=e;return(0,h.jsx)(`div`,{"data-item":n.id,className:`absolute overflow-hidden rounded-[6px] bg-surface`,style:{left:r,top:i,width:a,height:o,boxShadow:`0 0 0 1px var(--rule)`},children:n.missing?(0,h.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:20}),` Missing image`]}):(0,h.jsx)(`img`,{src:n.url,alt:n.title,draggable:!1,className:`block h-full w-full object-contain select-none`,onLoad:e=>{let r=e.currentTarget;yT(t,n.id,{w:r.naturalWidth,h:r.naturalHeight})}})})}),xD=(0,m.memo)(function({section:e,x:t,y:n,w:r,store:i}){let a=hD(i,`section:${e.id}`);return!e.title&&!e.description?null:(0,h.jsxs)(`div`,{ref:a,className:`absolute`,style:{left:t,top:n,width:Math.min(Math.max(r,720),1400)},children:[e.title?(0,h.jsx)(`div`,{className:`text-[40px] leading-[1.15] font-semibold tracking-[-0.015em] text-ink`,children:e.title}):null,e.description?(0,h.jsx)(`div`,{className:`mt-3 max-w-[1100px]`,children:(0,h.jsx)(mD,{text:e.description,className:`prose-plain`})}):null]})}),SD={phone:{width:390,height:844,label:`Phone`},"phone-sm":{width:375,height:667,label:`Phone S`},"phone-lg":{width:430,height:932,label:`Phone L`},tablet:{width:834,height:1194,label:`Tablet`},"tablet-landscape":{width:1194,height:834,label:`Tablet landscape`},laptop:{width:1280,height:800,label:`Laptop`},desktop:{width:1440,height:900,label:`Desktop`},wide:{width:1920,height:1080,label:`Wide`}};Object.keys(SD);var CD=e=>({"--x":e.x,"--y":e.y,"--w":e.w,"--h":e.h});function wD(e){let t=e.item;if(t.kind!==`screen`&&t.kind!==`url`)return``;let n=t.frame.device?SD[t.frame.device]?.label:void 0,r=`${t.frame.width} × ${t.frame.height===`auto`?`auto`:t.frame.height}`;return n?`${n} · ${r}`:r}var TD=(0,m.memo)(function({placed:e,store:t}){let n=e.item.id,r=Jg(t,e=>e.selected===n),i=Jg(t,e=>e.frames[n]?.errors.length??0);return(0,h.jsxs)(`div`,{"data-at":``,"data-label":n,style:CD(e),className:X(`frame-label pointer-events-auto flex cursor-default items-center gap-1.5 overflow-hidden pb-1.5 text-[12.5px] leading-none whitespace-nowrap select-none`,r?`text-ink`:`text-muted hover:text-ink2`),children:[i?(0,h.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`,title:`${i} errors`}):null,(0,h.jsx)(`span`,{className:X(`min-w-[3ch] truncate`,r?`font-semibold`:`font-medium`),children:e.item.title}),(0,h.jsx)(`span`,{className:`frame-device min-w-0 shrink-[20] truncate text-[11.5px] text-muted opacity-80`,children:wD(e)})]})});function ED({placed:e,kind:t}){return(0,h.jsx)(`div`,{"data-at":``,style:CD(e),className:X(`frame-outline rounded-[1px]`,t===`hover`?`outline outline-[1.5px] outline-action/60`:`outline-2 outline-action outline`)})}function DD({layout:e,view:t,store:n,overlayRef:r}){let i=Jg(n,e=>e.selected),a=Jg(n,e=>e.active),o=Jg(n,e=>e.hovered),s=Jg(n,e=>e.zoomTiny),c=(0,m.useMemo)(()=>e.items.filter(e=>uT(e.item)),[e]),l=(0,m.useMemo)(()=>{if(!t||s)return[];let{x:e,y:n,z:r,w:i,h:a}=t,o={x:-e/r-i/r,y:-n/r-a/r,w:i/r*3,h:a/r*3};return c.filter(e=>iT(e,o))},[c,t,s]),u=t=>t?e.items.find(e=>e.item.id===t):void 0,d=u(i),f=o&&o!==i?u(o):void 0;return(0,h.jsxs)(`div`,{ref:r,className:`canvas-overlay`,"data-tiny":s,children:[l.map(e=>(0,h.jsx)(TD,{placed:e,store:n},e.item.id)),f?(0,h.jsx)(ED,{placed:f,kind:`hover`}):null,d?(0,h.jsx)(ED,{placed:d,kind:a===i?`active`:`selected`}):null]})}var OD=12,kD=20,AD=110,jD=3,MD=8e3,ND=14,PD=96;function FD({layout:e,theme:t,store:n,camera:r,events:i,capture:a,apiRef:o,onPlay:s,onSelect:c}){let l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)(null),f=(0,m.useRef)(null),[p,g]=(0,m.useState)(null),_=Jg(n,e=>e.panning),v=Jg(n,e=>e.selected),y=Jg(n,e=>e.active),b=(0,m.useMemo)(()=>e.items.filter(e=>uT(e.item)),[e]);(0,m.useLayoutEffect)(()=>{let e=l.current,t=u.current,i=d.current,a,o,s=!1,c=0,p=()=>g({...r.camera,w:e.clientWidth,h:e.clientHeight,moving:s}),m=e=>{t.style.transform=`translate3d(${e.x}px, ${e.y}px, 0) scale(${e.z})`,s||(s=!0,t.classList.add(`moving`)),clearTimeout(a),a=setTimeout(()=>{s=!1,t.classList.remove(`moving`),p()},160);let r=f.current;r&&(r.style.setProperty(`--tx`,String(e.x)),r.style.setProperty(`--ty`,String(e.y)),r.style.setProperty(`--z`,String(e.z)));let l=24*e.z;for(;l<ND;)l*=4;for(;l>PD;)l/=4;l!==c&&(c=l,i.style.backgroundSize=`${l}px ${l}px`);let u=e=>((e+PD)%l+l)%l-l;i.style.transform=`translate3d(${u(e.x)}px, ${u(e.y)}px, 0)`;let d=e.z<.09;n.get().zoomTiny!==d&&n.set(e=>({...e,zoomTiny:d})),o??=setTimeout(()=>{o=void 0,p()},90)};m(r.camera),p();let h=r.subscribe(m),_=e.getBoundingClientRect().left,v=new ResizeObserver(()=>{let t=e.getBoundingClientRect().left;if(t!==_){let e=r.camera;r.set({...e,x:e.x-(t-_)}),_=t}p()});return v.observe(e),()=>{h(),v.disconnect(),clearTimeout(a),clearTimeout(o)}},[r,n]),(0,m.useEffect)(()=>{let t=l.current,n=()=>{let{w:n,h:i}={w:t.clientWidth,h:t.clientHeight},a=e.bounds,o=a.w&&n?Math.min((n-160)/a.w,(i-160)/Math.max(a.h,1)):1;r.minZoom=Math.min(.25,Math.max(eT,o*.5))};n();let i=new ResizeObserver(n);return i.observe(t),()=>i.disconnect()},[r,e.bounds]),(0,m.useEffect)(()=>{let t=l.current,n=()=>({w:t.clientWidth,h:t.clientHeight});o.current={size:n,fitAll(t=!0){let{w:i,h:a}=n();if(!e.bounds.w)return;let o=rT(e.bounds,i,a,80,1);t?r.animateTo(o):r.set(o)},fitItem(t,i=!0){let a=e.items.find(e=>e.item.id===t);if(!a)return;let{w:o,h:s}=n(),c=rT(a,o,s,64,1);i?r.animateTo(c):r.set(c)},zoomBy(e){let{w:t,h:i}=n(),a=r.camera,o=a.z*e,s=(t/2-a.x)/a.z,c=(i/2-a.y)/a.z;r.animateTo({z:o,x:t/2-s*o,y:i/2-c*o},180)},zoomTo(e){let{w:t,h:i}=n(),a=r.camera,o=(t/2-a.x)/a.z,s=(i/2-a.y)/a.z;r.animateTo({z:e,x:t/2-o*e,y:i/2-s*e},220)}}},[o,r,e]);let x=(0,m.useRef)([]),S=(0,m.useRef)(new Map),[C,w]=(0,m.useState)(0),T=Jg(n,e=>ID(e.frames)),E=(0,m.useMemo)(()=>{let e=new Map;if(a){for(let t of b)e.set(t.item.id,`live`);return e}if(!p)return e;let{x:t,y:n,z:r,w:i,h:o}=p,s={x:-t/r,y:-n/r,w:i/r,h:o/r},c={x:s.x-s.w*.25,y:s.y-s.h*.25,w:s.w*1.5,h:s.h*1.5},l=s.x+s.w/2,u=s.y+s.h/2,d=e=>Math.max(0,Math.min(e.x+e.w,s.x+s.w)-Math.max(e.x,s.x))*Math.max(0,Math.min(e.y+e.h,s.y+s.h)-Math.max(e.y,s.y)),f=e=>Math.hypot(e.x+e.w/2-l,e.y+e.h/2-u),m=b.filter(e=>iT(e,c)&&e.w*r>=AD).sort((e,t)=>d(t)-d(e)||f(e)-f(t)).slice(0,OD).map(e=>e.item.id),h=[y,v].filter(e=>!!e),g=new Set(b.map(e=>e.item.id)),_=new Set(T.split(`
124
+ `)),C=new Set(x.current),w=performance.now(),E=e=>!_.has(e)&&w-(S.current.get(e)??0)<MD,D=jD-[...C].filter(E).length,O=[];for(let e of new Set([...h,...m]))g.has(e)&&(C.has(e)?O.push(e):(h.includes(e)||!p.moving&&D>0)&&(O.push(e),S.current.set(e,w),D--));let k=[...new Set([...O,...x.current])].filter(e=>g.has(e)).slice(0,kD);x.current=k;for(let e of S.current.keys())k.includes(e)||S.current.delete(e);for(let t of k)e.set(t,O.includes(t)?`live`:`asleep`);return e},[p,b,y,v,a,T,C]);(0,m.useEffect)(()=>{let e=performance.now(),t=new Set(T.split(`
125
+ `)),n=[...S.current].filter(([e])=>!t.has(e)).map(([,t])=>t+MD-e).filter(e=>e>0);if(!n.length)return;let r=setTimeout(()=>w(e=>e+1),Math.min(...n)+20);return()=>clearTimeout(r)},[E,T]);let D=(0,m.useRef)(null),O=(0,m.useRef)(new Map),k=(0,m.useRef)(null),A=(0,m.useRef)(!1),j=e=>{n.get().panning!==e&&n.set(t=>({...t,panning:e}))};(0,m.useEffect)(()=>{let e=e=>{e.code===`Space`&&!LD(e.target)&&(A.current=!0,l.current?.classList.add(`cursor-grab`),e.preventDefault())},t=e=>{e.code===`Space`&&(A.current=!1,l.current?.classList.remove(`cursor-grab`))};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[]);let ee=e=>{let t=e;return(t?.closest(`[data-shield]`))?.dataset.shield??(t?.closest(`[data-label]`))?.dataset.label??(t?.closest(`[data-item]`))?.dataset.item??null},te=e=>{if(e.target.closest(`[data-ui]`)||e.button!==0&&e.button!==1)return;if(l.current.setPointerCapture(e.pointerId),O.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),r.interrupt(),O.current.size===2){let[e,t]=[...O.current.values()];k.current={dist:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2},D.current=null,j(!0);return}let t=e.button===1||A.current;D.current={id:t?null:ee(e.target),startX:e.clientX,startY:e.clientY,lastX:e.clientX,lastY:e.clientY,moved:t},t&&j(!0)},ne=e=>{if(O.current.has(e.pointerId)&&O.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),k.current&&O.current.size===2){let[e,t]=[...O.current.values()],n=Math.hypot(e.x-t.x,e.y-t.y),i=(e.x+t.x)/2,a=(e.y+t.y)/2,o=l.current.getBoundingClientRect();r.panBy(i-k.current.midX,a-k.current.midY),r.zoomAt(i-o.left,a-o.top,n/Math.max(k.current.dist,1)),k.current={dist:n,midX:i,midY:a};return}let t=D.current;if(!t){if(!n.get().panning){let t=ee(e.target);n.get().hovered!==t&&n.set(e=>({...e,hovered:t}))}return}!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>3&&(t.moved=!0,j(!0)),t.moved&&r.panBy(e.clientX-t.lastX,e.clientY-t.lastY),t.lastX=e.clientX,t.lastY=e.clientY},re=e=>{O.current.delete(e.pointerId),O.current.size<2&&(k.current=null);let t=D.current;D.current=null,t&&!t.moved&&c(t.id,{x:e.clientX,y:e.clientY}),O.current.size||j(!1)};(0,m.useEffect)(()=>{let e=l.current,t=t=>{if(t.target.closest(`[data-ui]`))return;t.preventDefault();let n=e.getBoundingClientRect(),i=t.deltaMode===1?16:t.deltaMode===2?n.height:1;if(t.ctrlKey||t.metaKey){let e=t.deltaY*i,a=Math.abs(e)<40?.012:.0025;r.zoomAt(t.clientX-n.left,t.clientY-n.top,Math.exp(-e*a))}else r.panBy(-t.deltaX*i,-t.deltaY*i)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[r]);let ie=e.sections;return(0,h.jsxs)(`div`,{ref:l,className:X(`canvas-root relative h-full w-full touch-none overflow-hidden select-none`,_&&`canvas-panning cursor-grabbing`),onPointerDown:te,onPointerMove:ne,onPointerUp:re,onPointerCancel:re,onPointerLeave:()=>n.get().hovered&&n.set(e=>({...e,hovered:null})),onDoubleClick:t=>{let n=ee(t.target),r=n?e.items.find(e=>e.item.id===n):void 0;r&&uT(r.item)&&s(r.item.id)},children:[(0,h.jsx)(`div`,{ref:d,className:`canvas-grid`}),(0,h.jsxs)(`div`,{ref:u,className:`canvas-world`,children:[ie.map(e=>(0,h.jsx)(xD,{section:e.section,x:e.x,y:e.y,w:e.w,store:n},`section:${e.section.id}`)),e.items.map(e=>{let{item:r}=e;return r.kind===`screen`||r.kind===`url`?(0,h.jsx)(_D,{placed:e,mode:E.get(r.id)??`off`,theme:t,store:n,events:i,capture:a},r.id):r.kind===`note`?(0,h.jsx)(yD,{placed:e,store:n},r.id):(0,h.jsx)(bD,{placed:e,store:n},r.id)})]}),(0,h.jsx)(DD,{layout:e,view:p,store:n,overlayRef:f})]})}function ID(e){return Object.keys(e).filter(t=>e[t].ready).sort().join(`
126
+ `)}function LD(e){let t=e;return!!t&&(t.isContentEditable||/^(input|textarea|select)$/i.test(t.tagName))}var RD=new URLSearchParams(window.location.search),zD=RD.has(`capture`),BD=(e,t)=>`foss-design.camera.${e}.${t}`;function VD(e){try{let t=JSON.parse(sessionStorage.getItem(e)??`null`);if(t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.z))return t}catch{}return null}function HD(e){let t=r_(),n=RD.get(`theme`),[r,i]=(0,m.useState)(n===`dark`||n===`light`?n:null);return[r??e?.theme??t,i]}function UD({canvasId:e,pageId:t}){let{data:n,error:r,isLoading:i}=Bg(e);if(r)return(0,h.jsx)($w,{title:`Canvas not found`,text:r.message});if(i||!n)return(0,h.jsx)(`div`,{className:`canvas-dots grow`});let a=t??RD.get(`page`)??void 0,o=n.pages.find(e=>e.id===a)??n.pages[0];return(0,h.jsx)(WD,{canvas:n,page:o},`${n.id}/${o?.id??``}`)}function WD({canvas:e,page:t}){let[,n]=jf(),r=(0,m.useMemo)(()=>vT(),[]),i=(0,m.useMemo)(()=>new nT,[]),a=(0,m.useRef)(null),[o,s]=HD(e),[c,l]=(0,m.useState)(()=>!zD&&window.innerWidth>900),[u,d]=(0,m.useState)(!1),f=Jg(r,e=>e.sizes),p=(0,m.useMemo)(()=>t?pT(t,f):{items:[],sections:[],bounds:{x:0,y:0,w:0,h:0}},[t,f]),g=ZD(Jg(r,e=>e.frameEls),p),_=DC(g),v=u||_;(0,m.useEffect)(()=>{r.set(e=>e.inspecting===v?e:{...e,inspecting:v,active:null})},[v,r]);let y=EC(g,v,{onEscape:()=>d(!1)}),b=!!y.info;(0,m.useEffect)(()=>{b&&d(!0)},[b]),(0,m.useEffect)(()=>{let e=y.frame;if(!e)return;let t=Object.entries(r.get().frameEls).find(([,t])=>t===e)?.[0];t&&r.get().selected!==t&&r.set(e=>({...e,selected:t}))},[y.frame,r]);let x=(0,m.useMemo)(()=>mT(p),[p]),S=BD(e.id,t?.id??``),C=(0,m.useRef)(!1);(0,m.useEffect)(()=>{if(C.current||!p.bounds.w)return;C.current=!0;let t=Kg(e.id),n=zD?null:VD(S);t?(r.set(e=>({...e,selected:t})),requestAnimationFrame(()=>a.current?.fitItem(t,!1))):n?i.set(n):requestAnimationFrame(()=>a.current?.fitAll(!1))},[p,i,S,e.id,r]),(0,m.useEffect)(()=>{if(zD)return;let e,t=i.subscribe(t=>{clearTimeout(e),e=setTimeout(()=>sessionStorage.setItem(S,JSON.stringify(t)),250)});return()=>{t(),clearTimeout(e)}},[i,S]);let w=(0,m.useCallback)(e=>{let t=e?p.items.find(t=>t.item.id===e)?.item:void 0;r.set(e=>({...e,selected:t?t.id:null,active:t&&uT(t)?t.id:null,hovered:null}))},[p,r]),T=(0,m.useCallback)(e=>{w(e),a.current?.fitItem(e)},[w]),E=(0,m.useCallback)(r=>n(`/c/${encodeURIComponent(e.id)}/play/${encodeURIComponent(r)}${t?`?page=${encodeURIComponent(t.id)}`:``}`),[e.id,t,n]);(0,m.useEffect)(()=>{let t=t=>{let n=t.detail;n.canvas===e.id&&p.items.some(e=>e.item.id===n.item)&&(Kg(e.id),T(n.item))};return window.addEventListener(`design:focus`,t),()=>window.removeEventListener(`design:focus`,t)},[e.id,p,T]);let D=(0,m.useMemo)(()=>({onGo(r,i){let[a,o]=i.includes(`/`)?i.split(`/`):[null,i],s=a?e.pages.filter(e=>e.id===a):[t,...e.pages.filter(e=>e!==t)];for(let r of s)if(r&&r.sections.some(e=>e.items.some(e=>e.id===o))){r===t?T(o):(n(gT(e,r)),window.dispatchEvent(new CustomEvent(`design:focus`,{detail:{canvas:e.id,item:o}})));return}console.warn(`[design] go("${i}"): no such screen`)},onWheel(e,t){let n=e.closest(`.canvas-root`);if(!n)return;let r=n.getBoundingClientRect(),a=e.getBoundingClientRect(),o=i.camera.z;if(t.zoom){let e=Math.abs(t.deltaY)<40?.012:.0025;i.zoomAt(a.left-r.left+t.x*o,a.top-r.top+t.y*o,Math.exp(-t.deltaY*e))}else i.panBy(-t.deltaX,-t.deltaY)},onEscape(){r.set(e=>({...e,active:null}))}}),[e,t,i,r,T,n]);return(0,m.useEffect)(()=>{if(!zD)return;let e=Date.now(),t=setInterval(()=>{let n=r.get().frames;(x.every(e=>n[e.item.id]?.ready||e.item.kind===`screen`&&e.item.missing)||Date.now()-e>6e4)&&(clearInterval(t),a.current?.fitAll(!1),requestAnimationFrame(()=>requestAnimationFrame(()=>window.__DESIGN_CANVAS_READY__=!0)))},250);return()=>clearInterval(t)},[x,r]),(0,m.useEffect)(()=>{let i=i=>{if(LD(i.target)||document.querySelector(`[role="dialog"]`))return;let o=a.current,s=r.get(),c=i.metaKey||i.ctrlKey;if(i.key===`Escape`)y.info?y.select(null):u?d(!1):s.active?r.set(e=>({...e,active:null})):s.selected&&r.set(e=>({...e,selected:null}));else if(i.key===`i`&&!c&&!i.altKey)d(e=>!e);else if(i.shiftKey&&i.code===`Digit1`)o?.fitAll();else if(i.shiftKey&&i.code===`Digit2`&&s.selected)o?.fitItem(s.selected);else if(i.shiftKey&&i.code===`Digit0`)o?.zoomTo(1);else if((i.key===`=`||i.key===`+`)&&!i.altKey)i.preventDefault(),o?.zoomBy(1.4);else if(i.key===`-`&&!i.altKey)i.preventDefault(),o?.zoomBy(1/1.4);else if(c&&i.key===`0`)i.preventDefault(),o?.zoomTo(1);else if(c&&i.key===`\\`)i.preventDefault(),l(e=>!e);else if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(i.key)&&x.length){i.preventDefault();let e=x.findIndex(e=>e.item.id===s.selected),t=i.key===`ArrowRight`||i.key===`ArrowDown`?1:-1,n=x[e===-1?0:(e+t+x.length)%x.length];r.set(e=>({...e,selected:n.item.id,active:null})),o?.fitItem(n.item.id)}else if(i.key===`Enter`&&s.selected){let e=p.items.find(e=>e.item.id===s.selected)?.item;e&&uT(e)&&E(e.id)}else if(i.key===`]`||i.key===`[`){let r=t?e.pages.indexOf(t):-1,a=e.pages[r+(i.key===`]`?1:-1)];a&&n(gT(e,a))}};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[r,x,p,E,e,t,n,u,y]),zD?(0,h.jsx)(`div`,{className:`flex h-dvh`,children:(0,h.jsx)(FD,{layout:p,theme:o,store:r,camera:i,events:D,capture:!0,apiRef:a,onPlay:()=>{},onSelect:()=>{}})}):(0,h.jsxs)(`div`,{className:`flex h-dvh flex-col`,children:[(0,h.jsx)(GD,{canvas:e,page:t,theme:o,onTheme:s,sidebar:c,onSidebar:l,inspect:u,onInspect:d,onPlay:()=>{let e=r.get().selected,t=e&&x.find(t=>t.item.id===e)||x[0];t&&E(t.item.id)},canPlay:x.length>0}),(0,h.jsxs)(`div`,{className:`flex min-h-0 grow`,children:[(0,h.jsx)(tw,{open:c&&!!t,side:`left`,width:264,children:t?(0,h.jsx)(_T,{canvas:e,page:t,store:r,onPick:T}):null}),(0,h.jsxs)(`div`,{className:`relative min-w-0 grow`,children:[t&&p.items.length?(0,h.jsx)(FD,{layout:p,theme:o,store:r,camera:i,events:D,capture:!1,apiRef:a,onPlay:E,onSelect:w}):(0,h.jsx)(`div`,{className:`canvas-dots flex h-full`,children:(0,h.jsx)(cw,{title:t?`This page is empty`:`This canvas has no pages`,text:(0,h.jsxs)(h.Fragment,{children:[`Add sections and screens to`,` `,(0,h.jsxs)(`code`,{className:`font-mono text-[13px]`,children:[`.design/canvas/`,e.id,`/canvas.json`]}),`.`]})})}),(0,h.jsx)(KD,{canvas:e,store:r,layoutItems:p.items.map(e=>e.item),theme:o,onPlay:E,inspect:v}),(0,h.jsx)(JD,{camera:i,apiRef:a}),e.issues.length?(0,h.jsx)(YD,{canvas:e}):null]}),(0,h.jsx)(tw,{open:u,side:`right`,width:320,children:(0,h.jsx)(LC,{info:y.info,active:!0,onSelect:e=>y.select(e),onClose:()=>{d(!1),y.select(null)}})})]})]})}function GD({canvas:e,page:t,theme:n,onTheme:r,sidebar:i,onSidebar:a,onPlay:o,canPlay:s,inspect:c,onInspect:l}){let[,u]=jf();return(0,h.jsxs)(IS,{children:[(0,h.jsx)(Qw,{content:`All canvases`,children:(0,h.jsx)(Lf,{href:`/`,className:`flex items-center`,"aria-label":`All canvases`,children:(0,h.jsx)(PS,{})})}),(0,h.jsx)(y_,{icon:`panel-left`,label:i?`Hide sidebar (⌘\\)`:`Show sidebar (⌘\\)`,onClick:()=>a(!i)}),(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[14px]`,children:[(0,h.jsx)(`span`,{className:`truncate font-semibold`,children:e.title}),t&&e.pages.length>1?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Z,{name:`chevron-right`,size:14,className:`shrink-0 text-muted`}),(0,h.jsxs)(DS,{width:240,trigger:(0,h.jsxs)(`button`,{type:`button`,className:`flex h-ctrl cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-[14px] text-ink2 hover:bg-soft2`,children:[(0,h.jsx)(`span`,{className:`truncate`,children:t.title}),(0,h.jsx)(Z,{name:`chevron-down`,size:14,className:`text-muted`})]}),children:[(0,h.jsx)(jS,{children:`Pages`}),e.pages.map(n=>(0,h.jsxs)(kS,{active:n.id===t.id,onSelect:()=>u(gT(e,n)),children:[(0,h.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),n.title]},n.id))]})]}):null]}),(0,h.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,h.jsx)(nw,{label:`Screen theme`,value:n,onChange:r,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:15}),title:`Light screens`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:15}),title:`Dark screens`}]}),(0,h.jsx)(XD,{on:c,onChange:l}),(0,h.jsx)(g_,{kind:`secondary`,icon:`play`,onClick:o,disabled:!s,children:`Play`}),(0,h.jsx)(p_,{width:200,label:`Search`}),(0,h.jsx)(NS,{})]})]})}function KD({canvas:e,store:t,layoutItems:n,theme:r,onPlay:i,inspect:a}){let o=Jg(t,e=>e.selected),s=Jg(t,e=>e.active),c=Jg(t,e=>o?e.frames[o]:void 0),l=n.find(e=>e.id===o);if(!l)return null;let u=l.kind===`screen`||l.kind===`url`,d=l.kind===`screen`?TC(wC(l.url,l.theme??r)):l.kind===`url`?l.url:null,f=()=>SC(document.querySelector(`[data-item="${CSS.escape(l.id)}"] iframe`)),p=c?.errors??[];return(0,h.jsx)(`div`,{"data-ui":!0,className:`pointer-events-none absolute inset-x-0 bottom-5 z-20 flex justify-center px-4`,children:(0,h.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full flex-col overflow-hidden rounded-[10px] border border-rule bg-surface shadow-pop animate-[q-pop_120ms_ease-out]`,children:[p.length?(0,h.jsxs)(`div`,{className:`flex max-h-40 items-start gap-2 overflow-y-auto border-b border-rule bg-danger-soft px-3.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),(0,h.jsx)(`span`,{className:`min-w-0`,children:p.join(`
127
+ `)})]}):null,(0,h.jsxs)(`div`,{className:`flex h-[44px] items-center gap-1 pr-1.5 pl-3.5`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2`,children:[(0,h.jsx)(`span`,{className:`truncate text-[13.5px] font-medium`,children:l.title||l.id}),u&&s===l.id?(0,h.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[12px] text-muted`,children:[(0,h.jsx)(Z,{name:`pointer`,size:13}),` `,a?`Inspecting`:`Interacting`,` `,(0,h.jsx)(a_,{children:`esc`})]}):u?(0,h.jsx)(`span`,{className:`shrink-0 text-[12px] text-muted`,children:a?`Click an element to inspect it`:`Click the screen to interact`}):null]}),u?(0,h.jsx)(Qw,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Play `,(0,h.jsx)(a_,{children:`↵`})]}),children:(0,h.jsx)(y_,{icon:`play`,label:`Play`,onClick:()=>i(l.id)})}):null,d?(0,h.jsx)(Qw,{content:`Open in a new tab`,children:(0,h.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,"aria-label":`Open in a new tab`,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,children:(0,h.jsx)(Z,{name:`external`,size:16})})}):null,u?(0,h.jsx)(Qw,{content:`Reload`,children:(0,h.jsx)(y_,{icon:`refresh`,label:`Reload`,onClick:f})}):null,l.kind===`screen`?(0,h.jsx)(Qw,{content:`Copy source path`,children:(0,h.jsx)(y_,{icon:`copy`,label:`Copy source path`,onClick:()=>void gC(l.file,`Path copied`)})}):null,(0,h.jsx)(Qw,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Zoom to `,(0,h.jsx)(a_,{children:`⇧2`})]}),children:(0,h.jsx)(y_,{icon:`fit`,label:`Zoom to`,onClick:()=>window.dispatchEvent(new CustomEvent(`design:focus`,{detail:{canvas:e.id,item:l.id}}))})})]})]})})}function qD({camera:e}){let[t,n]=(0,m.useState)(e.camera.z);return(0,m.useEffect)(()=>{let t=0;return e.subscribe(e=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>n(e.z))})},[e]),(0,h.jsxs)(h.Fragment,{children:[Math.round(t*100),`%`]})}function JD({camera:e,apiRef:t}){return(0,h.jsxs)(`div`,{"data-ui":!0,className:`absolute right-4 bottom-5 z-20 flex h-[46px] items-center gap-0.5 rounded-[10px] border border-rule bg-surface px-1.5 shadow-pop`,children:[(0,h.jsx)(y_,{icon:`zoom-out`,label:`Zoom out (−)`,onClick:()=>t.current?.zoomBy(1/1.4)}),(0,h.jsxs)(DS,{side:`top`,align:`end`,width:210,trigger:(0,h.jsx)(`button`,{type:`button`,className:`h-ctrl min-w-[56px] cursor-pointer rounded-[6px] border-0 bg-transparent px-1.5 text-[12.5px] font-medium text-ink2 tabular hover:bg-soft2`,children:(0,h.jsx)(qD,{camera:e})}),children:[(0,h.jsx)(kS,{onSelect:()=>t.current?.fitAll(),hint:`⇧1`,children:`Zoom to fit`}),(0,h.jsx)(kS,{onSelect:()=>t.current?.zoomTo(1),hint:`⇧0`,children:`100%`}),(0,h.jsx)(AS,{}),[.25,.5,2].map(e=>(0,h.jsxs)(kS,{onSelect:()=>t.current?.zoomTo(e),children:[e*100,`%`]},e))]}),(0,h.jsx)(y_,{icon:`zoom-in`,label:`Zoom in (+)`,onClick:()=>t.current?.zoomBy(1.4)}),(0,h.jsx)(`div`,{className:`mx-0.5 h-5 w-px bg-rule`}),(0,h.jsx)(y_,{icon:`fit`,label:`Zoom to fit (⇧1)`,onClick:()=>t.current?.fitAll()})]})}function YD({canvas:e}){let t=e.issues.filter(e=>e.severity===`error`).length;return(0,h.jsxs)(cC,{children:[(0,h.jsx)(lC,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,"data-ui":!0,className:`absolute bottom-5 left-4 z-20 flex h-[46px] cursor-pointer items-center gap-2 rounded-[10px] border border-rule bg-surface px-3.5 text-[13px] font-medium shadow-pop hover:bg-soft`,children:[(0,h.jsx)(Z,{name:`alert`,size:15,className:t?`text-danger-text`:`text-action`}),e.issues.length,` `,e.issues.length===1?`problem`:`problems`,` in canvas.json`]})}),(0,h.jsx)(uC,{children:(0,h.jsx)(dC,{side:`top`,align:`start`,sideOffset:8,collisionPadding:12,className:`z-50 max-h-[50vh] w-[460px] max-w-[calc(100vw-24px)] overflow-y-auto rounded-[10px] border border-rule bg-surface shadow-pop outline-none data-[state=open]:animate-[q-pop_120ms_ease-out]`,children:(0,h.jsx)(QC,{issues:e.issues})})})]})}function XD({on:e,onChange:t}){return(0,h.jsx)(Qw,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Inspect elements `,(0,h.jsx)(a_,{children:`I`})]}),children:(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(!e),className:e?`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-action-line bg-action-soft px-ctrl text-ctrl font-medium text-action`:`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-rule-strong bg-surface px-ctrl text-ctrl font-medium text-ink hover:bg-soft`,children:[(0,h.jsx)(Z,{name:`pointer`,size:15}),`Inspect`]})})}function ZD(e,t){let n=(0,m.useRef)([]);return(0,m.useMemo)(()=>{let r=new Set(t.items.filter(e=>e.item.kind===`screen`).map(e=>e.item.id)),i=Object.entries(e).filter(e=>!!e[1]&&r.has(e[0])).map(([,e])=>e);return i.length===n.current.length&&i.every((e,t)=>e===n.current[t])||(n.current=i),n.current},[e,t])}function QD(e,t){return(t?e.pages.filter(e=>e.id===t):e.pages).flatMap(t=>t.sections.flatMap(n=>n.items.filter(e=>e.kind===`screen`||e.kind===`url`).map(r=>({item:r,pageId:t.id,where:[e.pages.length>1?t.title:null,n.title].filter(Boolean).join(` · `)}))))}var $D=(e,t,n)=>`/c/${encodeURIComponent(e)}/play/${encodeURIComponent(t)}?page=${encodeURIComponent(n)}`;function eO({canvasId:e,itemId:t}){let{data:n,error:r,isLoading:i}=Bg(e);return r?(0,h.jsx)($w,{title:`Canvas not found`,text:r.message}):i||!n?null:(0,h.jsx)(tO,{canvas:n,itemId:t})}function tO({canvas:e,itemId:t}){let[,n]=jf(),r=new URLSearchParams(window.location.search).get(`page`)??(window.location.hash.split(`?`)[1]?new URLSearchParams(window.location.hash.split(`?`)[1]).get(`page`):null),i=(0,m.useMemo)(()=>QD(e,null),[e]),a=i.find(e=>e.item.id===t),o=r??a?.pageId??null,s=(0,m.useMemo)(()=>o?QD(e,o):i,[e,o,i]),c=s.findIndex(e=>e.item.id===t),l=r_(),[u,d]=(0,m.useState)(e.theme??l),[f,p]=(0,m.useState)(`fit`),g=(0,m.useRef)(null),_=(0,m.useRef)(null),[v,y]=(0,m.useState)(null),b=(0,m.useCallback)(e=>{_.current=e,y(e)},[]),[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)({w:0,h:0}),[T,E]=(0,m.useState)([]),D=o?`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(o)}`:`/c/${encodeURIComponent(e.id)}`,O=t=>{if(!s.length)return;let r=s[(c+t+s.length)%s.length];n($D(e.id,r.item.id,r.pageId),{replace:!0})};(0,m.useLayoutEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>w({w:e.clientWidth,h:e.clientHeight}));return t.observe(e),()=>t.disconnect()},[]),(0,m.useEffect)(()=>{let e=e=>{LD(e.target)||document.querySelector(`[role="dialog"]`)||(e.key===`ArrowRight`?O(1):e.key===`ArrowLeft`?O(-1):e.key===`i`&&!e.metaKey&&!e.ctrlKey&&!e.altKey?S(e=>!e):e.key===`Escape`&&(ie.info?ie.select(null):x?S(!1):n(D)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let k=s[c],A=k?.item,j=A?.kind===`screen`?A.theme??u:u,[ee]=(0,m.useState)(j),te=A?A.kind===`screen`?wC(A.url,ee):A.url:``,ne=(0,m.useMemo)(()=>v&&A?.kind===`screen`?[v]:[],[v,A?.kind]),re=DC(ne),ie=EC(ne,x||re,{onEscape:()=>S(!1)}),ae=!!ie.info;if((0,m.useEffect)(()=>{ae&&S(!0)},[ae]),(0,m.useEffect)(()=>{let t=_.current;if(t&&A?.kind===`screen`)return E([]),vC(t,t=>{if(t.type===`error`)E(e=>e.includes(t.message)?e:[...e,t.message]);else if(t.type===`updated`)E([]);else if(t.type===`keydown`&&t.code===`Escape`)n(D);else if(t.type===`go`){let[r,a]=t.target.includes(`/`)?t.target.split(`/`):[null,t.target],o=i.find(e=>e.item.id===a&&(!r||e.pageId===r));o&&n($D(e.id,o.item.id,o.pageId))}})},[A,te,i,e.id,n,D]),(0,m.useEffect)(()=>{A?.kind===`screen`&&xC(_.current,j)},[j,A]),!A)return(0,h.jsx)($w,{title:`Screen not found`,text:`No screen "${t}" on this canvas.`});let M=A.frame.width,oe=A.frame.height===`auto`?Math.max(C.h-48,400):A.frame.height,se=f===`fit`?Math.min(1,(C.w-48)/M,(C.h-48)/oe):1,ce=M<=C.w-48&&oe<=C.h-48,le=A.kind===`screen`?TC(wC(A.url,j)):A.url;return(0,h.jsxs)(`div`,{className:`flex h-dvh flex-col`,children:[(0,h.jsxs)(IS,{children:[(0,h.jsx)(Qw,{content:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Back to canvas `,(0,h.jsx)(a_,{children:`esc`})]}),children:(0,h.jsx)(Lf,{href:D,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,"aria-label":`Back to canvas`,children:(0,h.jsx)(Z,{name:`arrow-left`,size:16})})}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:[(0,h.jsx)(`span`,{className:`truncate text-[14px] font-semibold`,children:A.title}),(0,h.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.title,k.where].filter(Boolean).join(` · `)})]}),(0,h.jsxs)(`div`,{className:`mx-auto flex items-center gap-1`,children:[(0,h.jsx)(y_,{icon:`chevron-left`,label:`Previous screen (←)`,onClick:()=>O(-1),disabled:s.length<2}),(0,h.jsxs)(`span`,{className:`min-w-[52px] text-center text-[12.5px] text-muted tabular`,children:[c+1,` / `,s.length]}),(0,h.jsx)(y_,{icon:`chevron-right`,label:`Next screen (→)`,onClick:()=>O(1),disabled:s.length<2})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce?null:(0,h.jsx)(nw,{label:`Scale`,value:f,onChange:p,items:[{value:`fit`,label:`Fit`},{value:`actual`,label:`100%`}]}),A.kind===`screen`&&!A.theme?(0,h.jsx)(nw,{label:`Screen theme`,value:u,onChange:d,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:15}),title:`Light`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:15}),title:`Dark`}]}):null,A.kind===`screen`?(0,h.jsx)(XD,{on:x,onChange:S}):null,(0,h.jsx)(y_,{icon:`refresh`,label:`Reload`,onClick:()=>SC(_.current)}),(0,h.jsx)(`a`,{href:le,target:`_blank`,rel:`noreferrer`,title:`Open in a new tab`,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,children:(0,h.jsx)(Z,{name:`external`,size:16})}),(0,h.jsx)(NS,{})]})]}),(0,h.jsxs)(`div`,{className:`flex min-h-0 grow`,children:[(0,h.jsxs)(`div`,{ref:g,className:`canvas-dots relative min-w-0 grow ${f===`actual`?`overflow-auto`:`overflow-hidden`}`,children:[T.length?(0,h.jsxs)(`div`,{className:`absolute inset-x-0 top-0 z-10 flex items-start gap-2 border-b border-rule bg-danger-soft px-4 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),T.join(`
128
+ `)]}):null,(0,h.jsx)(`div`,{className:`flex min-h-full min-w-full items-center justify-center p-6`,style:{width:f===`actual`?M+48:void 0},children:(0,h.jsx)(`div`,{className:`shrink-0 overflow-hidden bg-surface`,style:{width:M*se,height:oe*se,boxShadow:`var(--shadow-frame), 0 0 0 1px var(--rule)`},children:(0,h.jsx)(`iframe`,{ref:b,src:te,title:A.title,allow:`clipboard-read; clipboard-write; fullscreen`,className:`block border-0`,style:{width:M,height:oe,transform:`scale(${se})`,transformOrigin:`0 0`,colorScheme:j},onLoad:()=>A.kind===`screen`&&xC(_.current,j)},`${A.id}:${A.kind===`screen`?A.rev:A.url}`)})})]}),(0,h.jsx)(tw,{open:x,side:`right`,width:320,children:(0,h.jsx)(LC,{info:ie.info,active:!0,onSelect:e=>ie.select(e),onClose:()=>{S(!1),ie.select(null)}})})]})]})}var nO=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60]],rO=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function iO(e){if(!e)return``;let t=(e-Date.now())/1e3;for(let[e,n]of nO)if(Math.abs(t)>=n)return rO.format(Math.round(t/n),e);return`just now`}function aO(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(+(e<10240))} KB`:`${(e/1024/1024).toFixed(1)} MB`}function oO(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function sO({canvas:e}){return(0,h.jsx)(`div`,{className:`flex h-[54px] w-[86px] shrink-0 items-center justify-center overflow-hidden rounded-[6px] border border-rule bg-soft`,children:e.cover?(0,h.jsx)(`img`,{src:e.cover,alt:``,className:`h-full w-full object-cover object-top`}):(0,h.jsx)(Z,{name:`canvas`,size:18,className:`text-muted`})})}function cO({project:e}){return e.canvases.length?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Canvases`,count:e.canvases.length}),e.canvases.map(e=>(0,h.jsxs)(YC,{to:`/c/${encodeURIComponent(e.id)}`,cols:`86px minmax(0,1fr) auto auto`,align:`llrr`,pad:`10px 16px`,minH:74,children:[(0,h.jsx)(sO,{canvas:e}),(0,h.jsx)(o_,{top:e.title,bottom:(0,h.jsx)(`span`,{className:`truncate`,children:e.description??e.id})}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-[12.5px] whitespace-nowrap text-muted`,children:[e.issues?(0,h.jsx)(zC,{tone:`danger`,children:oO(e.issues,`problem`)}):null,oO(e.screens,`screen`),` · `,oO(e.pages,`page`)]}),(0,h.jsx)(`span`,{className:`w-[92px] text-[12.5px] whitespace-nowrap text-muted`,children:iO(e.updatedAt)})]},e.id))]}):(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Canvases`,count:0}),(0,h.jsx)(ZC,{children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 py-6 text-center`,children:[(0,h.jsx)(`span`,{className:`text-[14px] text-ink2`,children:`No canvases yet.`}),(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Ask your agent to design something, or run `,(0,h.jsx)(Q,{children:`design new <name>`}),` in the project.`]})]})})]})}function lO({project:e}){let t=e.system;return t?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Design system`,right:(0,h.jsx)(b_,{to:`/system`,children:`Open`})}),(0,h.jsxs)(ZC,{gap:6,children:[(0,h.jsx)(`span`,{className:`text-[15px] font-semibold`,children:t.name}),t.description?(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:t.description}):null]}),(0,h.jsx)(XC,{label:`Tokens`,labelWidth:120,children:(0,h.jsx)(BC,{value:t.tokens})}),(0,h.jsx)(XC,{label:`Components`,labelWidth:120,children:(0,h.jsx)(BC,{value:t.components})}),(0,h.jsx)(XC,{label:`Guidelines`,labelWidth:120,children:(0,h.jsx)(BC,{value:t.guidelines})}),t.issues?(0,h.jsx)(XC,{label:`Problems`,labelWidth:120,children:(0,h.jsx)(zC,{tone:`danger`,children:t.issues})}):null]}):(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Design system`}),(0,h.jsx)(ZC,{children:(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`No design system yet. Ask your agent to build one from the codebase, or run `,(0,h.jsx)(Q,{children:`design system init`}),`.`]})})]})}function uO(){let{data:e,error:t,isLoading:n}=zg();return t?(0,h.jsx)(cw,{title:`Could not load the project`,text:t.message}):n||!e?null:(0,h.jsxs)(rw,{children:[(0,h.jsx)(iw,{title:e.name,sub:Mg?`Snapshot built with foss-design ${e.version}`:(0,h.jsxs)(Q,{size:12.5,children:[e.root,`/.design`]})}),(0,h.jsx)($C,{issues:e.issues,title:`Problems in design.json`}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5 max-lg:grid-cols-1!`,style:{gridTemplateColumns:`minmax(0,1fr) 340px`},children:[(0,h.jsx)(cO,{project:e}),(0,h.jsx)(lO,{project:e})]})]})}function dO(e){let t=e.utility;if(t===void 0)return[];let n=t?`-${t}`:``;switch(e.kind){case`color`:return[`bg${n}`,`text${n}`,`border${n}`];case`font`:return[`font${n}`];case`text`:return[`text${n}`];case`weight`:return[`font${n}`];case`leading`:return[`leading${n}`];case`tracking`:return[`tracking${n}`];case`spacing`:return t?[`p${n}`,`gap${n}`]:[`p-1`,`gap-4`,`m-2`];case`radius`:return[`rounded${n}`];case`shadow`:return e.name.startsWith(`--inset-shadow-`)?[`inset-shadow${n}`]:e.name.startsWith(`--drop-shadow-`)?[`drop-shadow${n}`]:e.name.startsWith(`--text-shadow-`)?[`text-shadow${n}`]:[`shadow${n}`];case`blur`:return[`blur${n}`,`backdrop-blur${n}`];case`ease`:return[`ease${n}`];case`animation`:return[`animate${n}`];case`breakpoint`:return e.name.startsWith(`--container-`)?[`@${t}:`,`max-w${n}`]:[`${t}:`];default:return[]}}function fO(e,...t){return e.filter(e=>t.includes(e.kind))}function pO(e){let t=new Map;for(let n of e){let e=t.get(n.group)??[];e.push(n),t.set(n.group,e)}return[...t].map(([e,t])=>({group:e,tokens:t}))}function mO(e){let t=/^(-?[\d.]+)(px|rem|em)?$/.exec(e.trim());if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?t[2]===`rem`||t[2]===`em`?n*16:n:null}function hO(e,t){return(t===`dark`?e.dark?.value:void 0)??e.light?.value}function gO(){let e=r_(),[t,n]=(0,m.useState)(null);return[t??e,n]}function _O({value:e,onChange:t}){return(0,h.jsx)(nw,{label:`Theme`,size:`sm`,value:e,onChange:t,items:[{value:`light`,label:(0,h.jsx)(Z,{name:`sun`,size:14}),title:`Light`},{value:`dark`,label:(0,h.jsx)(Z,{name:`moon`,size:14}),title:`Dark`}]})}function vO({items:e}){return e.length?(0,h.jsx)(`span`,{className:`flex min-w-0 flex-wrap gap-x-2 gap-y-0.5`,children:e.map(e=>(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e},e))}):null}function yO({title:e,children:t}){return(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:e}),(0,h.jsx)(ZC,{children:(0,h.jsx)(`div`,{className:`py-4 text-[13px] text-muted`,children:t})})]})}var bO=`.design/system/tokens.css`;function xO({children:e,className:t}){return(0,h.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere] ${t??``}`,children:e})}function SO({asset:e,index:t}){if(e.kind===`image`)return(0,h.jsx)(`span`,{className:`checker flex h-[132px] items-center justify-center overflow-hidden border-b border-rule`,children:(0,h.jsx)(`img`,{src:e.url,alt:``,className:`max-h-[96px] max-w-[80%] object-contain`})});if(e.kind===`font`){let n=`design-asset-font-${t}`;return(0,h.jsxs)(`span`,{className:`flex h-[132px] items-center justify-center border-b border-rule bg-soft`,children:[(0,h.jsx)(`style`,{children:`@font-face{font-family:"${n}";src:url("${e.url.replace(/"/g,`%22`)}")}`}),(0,h.jsx)(`span`,{className:`text-[52px] leading-none text-ink`,style:{fontFamily:`"${n}", var(--font-sans)`},children:`Aa`})]})}return(0,h.jsx)(`span`,{className:`flex h-[132px] items-center justify-center border-b border-rule bg-soft text-muted`,children:(0,h.jsx)(Z,{name:`file`,size:28})})}function CO({system:e}){return e.assets.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Assets`,sub:`Click an asset to copy its import path.`}),(0,h.jsx)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(210px, 1fr))`},children:e.assets.map((e,t)=>(0,h.jsx)(`button`,{type:`button`,title:`Copy the import path`,onClick:()=>gC(`@system/${e.path}`),className:`block cursor-pointer border-0 bg-transparent p-0 text-left`,children:(0,h.jsxs)(VC,{className:`transition-colors hover:border-rule-strong`,children:[(0,h.jsx)(SO,{asset:e,index:t}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-3.5 py-2.5`,children:[(0,h.jsx)(`span`,{className:`truncate text-[13.5px] font-medium text-ink`,children:e.name}),(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[12.5px] text-muted`,children:[(0,h.jsx)(`span`,{className:`shrink-0`,children:aO(e.size)}),(0,h.jsx)(Q,{size:12,className:`truncate`,children:e.path})]})]})]})},e.path))})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Assets`}),(0,h.jsxs)(yO,{title:`No assets`,children:[`Put logos, icons, images and font files in `,(0,h.jsx)(Q,{children:`.design/system/assets`}),`; screens import them as`,` `,(0,h.jsx)(Q,{children:`@system/assets/…`}),`.`]})]})}function wO({color:e,label:t,className:n}){return e?(0,h.jsx)(`span`,{title:`${t}: ${e}`,className:X(`checker relative h-[30px] w-[44px] shrink-0 overflow-hidden rounded-[6px]`,n),children:(0,h.jsx)(`span`,{className:`absolute inset-0 rounded-[6px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.1)] dark:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.12)]`,style:{background:e}})}):(0,h.jsx)(`span`,{className:X(`h-[30px] w-[44px] shrink-0`,n)})}function TO({tokens:e}){let t=e.some(e=>e.dark),n=t=>(0,h.jsxs)(`div`,{className:`relative flex h-9 min-w-0 grow overflow-hidden rounded-[6px]`,children:[(0,h.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 rounded-[6px] shadow-[inset_0_0_0_1px_var(--rule-strong)] opacity-60`}),e.map(e=>{let n=t===`dark`?e.dark?.value??e.light?.value:e.light?.value;return(0,h.jsx)(`button`,{type:`button`,title:`${e.name}: ${n}`,onClick:()=>gC(`var(${e.name})`),className:`h-full min-w-0 flex-1 cursor-pointer border-0 p-0 transition-[flex-grow] duration-150 hover:grow-[1.6]`,style:{background:n}},e.name)})]});return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-rule px-4 py-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t?(0,h.jsx)(`span`,{className:`w-9 shrink-0 text-[12px] text-muted`,children:`Light`}):null,n(`light`)]}),t?(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`span`,{className:`w-9 shrink-0 text-[12px] text-muted`,children:`Dark`}),n(`dark`)]}):null]})}function EO({token:e}){return(0,h.jsxs)(JC,{cols:`100px minmax(170px, 0.9fr) minmax(0, 1.4fr)`,minH:56,title:`Copy the variable`,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(wO,{color:e.light?.value,label:`Light`}),e.dark?(0,h.jsx)(wO,{color:e.dark.value,label:`Dark`}):null]}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(vO,{items:dO(e).slice(0,2)})]}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap gap-x-3`,children:[(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),e.dark?(0,h.jsxs)(Q,{size:12,className:`text-muted`,children:[`dark `,e.dark.value]}):null]}),e.description?(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.description}):null]})]})}function DO({system:e}){let t=fO(e.tokens,`color`),n=pO(t);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Colors`,sub:t.length?`${t.length} tokens · click a color to copy its variable`:void 0}),n.length?n.map(({group:e,tokens:t})=>(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:e,count:t.length}),(0,h.jsx)(TO,{tokens:t}),t.map(e=>(0,h.jsx)(EO,{token:e},e.name))]},e)):(0,h.jsxs)(yO,{title:`No color tokens`,children:[`Add them to `,(0,h.jsx)(Q,{children:bO}),`: light values in `,(0,h.jsx)(Q,{children:`:root`}),`, dark ones in`,` `,(0,h.jsx)(Q,{children:`:root[data-theme="dark"]`}),`, and map them to Tailwind with `,(0,h.jsx)(Q,{children:`--color-*`}),` in`,` `,(0,h.jsx)(Q,{children:`@theme inline`}),`.`]})]})}function OO({src:e,theme:t,title:n,minHeight:r=120,width:i,className:a}){let o=(0,m.useRef)(null),[s]=(0,m.useState)(()=>({src:e,theme:t})),c=wC(e,s.src===e?s.theme:t),[l,u]=(0,m.useState)(r),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)([]);return(0,m.useEffect)(()=>{let e=o.current;if(e)return f(!1),g([]),vC(e,e=>{e.type===`size`?u(Math.max(r,e.height)):e.type===`ready`?f(!0):e.type===`error`?g(t=>t.includes(e.message)?t:[...t,e.message]):e.type===`updated`&&g([])})},[r,c]),(0,m.useEffect)(()=>{xC(o.current,t)},[t]),(0,h.jsxs)(`div`,{className:X(`relative`,a),style:{width:i},children:[p.length?(0,h.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-rule bg-danger-soft px-4 py-2.5 text-[12.5px] text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:15,className:`mt-px`}),(0,h.jsx)(`div`,{className:`min-w-0 font-mono break-words`,children:p.join(`
129
+ `)})]}):null,(0,h.jsx)(`iframe`,{ref:o,src:c,title:n,className:X(`block w-full border-0 transition-opacity duration-150`,d?`opacity-100`:`opacity-0`),style:{height:l,colorScheme:t},onLoad:()=>xC(o.current,t)},c),d?null:(0,h.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:(0,h.jsx)(Z,{name:`loader`,size:18})})]})}var kO=`identifier keyword string class property entity jsxliterals sign comment break space`.split(` `),[AO,jO,MO,NO,PO,FO,IO,LO,RO,zO,BO]=kO.map((e,t)=>t);new Map(kO.map((e,t)=>[e,t]));function VO(e,t){let n=[],r=0,i=[],a=!1;function o(e){n.push({index:r++,value:e.map(([,e])=>e).join(``),tokens:e.map(([e,t])=>({type:kO[e],value:t})),annotations:[]})}for(let e=0;e<t.length;e++){let n=t[e],[r,s]=n;if(r!==zO){if(s.includes(`
139
130
  `)){let e=s.split(`
140
- `);for(let t=0;t<e.length;t++)i.push([r,e[t]]),t<e.length-1&&(o(i),i.length=0)}else i.push(n);a=!1}else a?o([]):(o(i),i.length=0),e===t.length-1&&o([]),a=!0}return i.length&&o(i),{value:e,lines:n}}function $O(e,t){let n={index:e.index,value:e.value,tokens:e.tokens,annotations:e.annotations,className:`sh__line${e.annotations.map(e=>` sh__line--${e}`).join(``)}`,style:{},properties:{}};return t?.(n),n}function ek({type:e,value:t},n,r){let i=n?.[e],a={type:e,value:t,className:`sh__token--${e}${i?` ${i}`:``}`,style:{color:`var(--sh-${e})`},properties:{}};return r?.(a),a}function tk(e,t){let n=t?.cx,r=t?.mark,i=t?.markLine;return!n&&!r&&!i?e.lines.map(e=>{let t=`sh__line${e.annotations.map(e=>` sh__line--${e}`).join(``)}`,n=e.tokens.map(({type:e,value:t})=>`<span class="sh__token--${e}" style="color:var(--sh-${e})">${rk(t)}</span>`).join(``);return`<span class="${rk(t)}">${n}</span>`}).join(`
141
- `):e.lines.map(e=>{let t=$O(e,i),a=e.tokens.map(e=>{let t=ek(e,n,r);return`<span ${ik({...t.properties,className:t.className,style:t.style})}>${rk(t.value)}</span>`}).join(``);return`<span ${ik({...t.properties,className:t.className,style:t.style})}>${a}</span>`}).join(`
142
- `)}var nk={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#039;`},rk=e=>e.replace(/[&<>"']/g,e=>nk[e]);function ik(e){let t=Object.entries(e.style||{}).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${t}`).join(`;`),n=Object.entries(e).filter(([e,t])=>/^[\w:-]+$/.test(e)&&e!==`className`&&e!==`style`&&t!==!1&&t!=null).map(([e,t])=>t===!0?e:`${e}="${rk(String(t))}"`).join(` `);return`class="${rk(e.className||``)}"${t?` style="${rk(t)}"`:``}${n?` ${n}`:``}`}var ak=new Set(`+-*/%=!&|^~?:.,;()[]{}<>#@\\`.split(``)),ok=()=>0,sk=e=>e===`_`||e===`$`||/[\p{L}\p{N}]/u.test(e);function ck(e,t){for(;t<e.length&&/\s/.test(e[t]);)t++;return e[t]===`:`}function lk(e,t){if(typeof t?.tokenize==`function`)return t.tokenize(e,t);let n=t?.keywords||new Set,r=t?.typeKeywords||new Set,i=t?.onCommentStart||ok,a=t?.onCommentEnd||ok,o=t?.caseInsensitive?e=>e.toLowerCase():e=>e,s=[],c=``;function l(e,t){t&&(s.push([e,t]),e!==ZO&&e!==XO&&(c=t))}for(let s=0;s<e.length;){let u=e[s],d=e[s+1],f=i(u,d,s,e);if(f){let t=s++;for(;s<e.length;){if(a(e[s-1],e[s],s,e,t)==f){s++;break}s++}l(YO,e.slice(t,s));continue}let p=t?.onLiteral?.(u,s,e);if(p){l(UO,e.slice(s,s+p)),s+=p;continue}if(typeof t?.onQuote==`function`&&u===`'`){let n=t.onQuote(u,s,e);if(typeof n==`number`&&n>=1){l(VO,e.slice(s,s+n)),s+=n;continue}}if(u===`"`||u===`'`||t?.templateStrings&&u==="`"){let n=u,r=s++;for(;s<e.length;){if(e[s]===`\\`)s++;else if(e[s]===n){s++;break}s++}let i=e.slice(r,s);l(t?.quotedKeys&&ck(e,s)?GO:UO,i);continue}if(u===`
143
- `){l(XO,u),s++;continue}if(/[^\S\r\n]/.test(u)){let t=s++;for(;s<e.length&&/[^\S\r\n]/.test(e[s]);)s++;l(ZO,e.slice(t,s));continue}if(sk(u)){let t=s++;for(;s<e.length&&sk(e[s]);)s++;if(/^\d/.test(u)&&e[s]===`.`&&/\d/.test(e[s+1]||``))for(s++;s<e.length&&sk(e[s]);)s++;let i=e.slice(t,s),a=o(i);l(r.has(a)?WO:n.has(a)?HO:c===`.`?GO:/^\d/.test(i)||i===`null`||/^\p{Lu}/u.test(i)?WO:VO,i);continue}if(ak.has(u)){l(JO,u),s++;continue}l(UO,u),s++}return s}function uk(e,t){let n=QO(e,lk(e,t));if(t?.annotateLine)for(let e of n.lines)t.annotateLine(e);return n}var dk=(e,t)=>{let n=e+t;return n===`//`?1:n===`/*`?2:0},fk=(e,t)=>t===`
144
- `?1:e+t===`*/`?2:0,pk=s({keywords:()=>hk,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>mk}),mk=new Set([`void`,`char`,`short`,`int`,`long`,`float`,`double`,`signed`,`unsigned`,`_Bool`,`_Complex`,`_Imaginary`]),hk=new Set(`auto.break.case.const.continue.default.do.else.enum.extern.for.goto.if.inline.register.restrict.return.sizeof.static.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local`.split(`.`)),gk=s({keywords:()=>_k,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>vk}),_k=new Set(`alignas.alignof.and.and_eq.asm.auto.bitand.bitor.break.case.catch.class.compl.concept.const.consteval.constexpr.constinit.const_cast.continue.co_await.co_return.co_yield.decltype.default.delete.do.dynamic_cast.else.enum.explicit.export.extern.false.for.friend.goto.if.inline.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.private.protected.public.register.reinterpret_cast.requires.return.sizeof.static.static_assert.static_cast.struct.switch.template.this.thread_local.throw.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`)),vk=new Set([`bool`,`char`,`char8_t`,`char16_t`,`char32_t`,`double`,`float`,`int`,`long`,`short`,`signed`,`unsigned`,`void`,`wchar_t`]),yk=s({keywords:()=>bk,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>xk}),bk=new Set(`abstract.as.async.await.base.break.case.catch.checked.class.const.continue.default.delegate.do.else.enum.event.explicit.extern.false.finally.fixed.for.foreach.from.get.global.goto.if.implicit.in.init.interface.internal.into.is.join.let.lock.namespace.new.null.on.operator.orderby.out.override.params.partial.private.protected.public.readonly.record.ref.remove.required.return.sealed.select.set.sizeof.stackalloc.static.struct.switch.this.throw.true.try.typeof.unchecked.unsafe.using.value.virtual.volatile.when.where.while.with.yield`.split(`.`)),xk=new Set([`bool`,`byte`,`char`,`decimal`,`double`,`dynamic`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`uint`,`ulong`,`ushort`,`void`]),Sk=s({keywords:()=>Ck,onCommentEnd:()=>Tk,onCommentStart:()=>wk,onLiteral:()=>Ek,tokenize:()=>Pk}),Ck=new Set([`@media`,`@import`,`@keyframes`,`@font-face`,`@supports`,`@page`,`@counter-style`,`@font-feature-values`,`@viewport`,`@counter-style`,`@font-feature-values`,`@document`]),wk=(e,t)=>+(e+t===`/*`),Tk=(e,t)=>+(e+t===`*/`),Ek=(e,t,n)=>e===`#`&&n.slice(t).match(/^#(?:[\da-f]{8}|[\da-f]{6}|[\da-f]{4}|[\da-f]{3})(?![\w-])/i)?.[0].length||0,Dk=e=>e===ZO||e===XO||e===YO,Ok=([e,t])=>e===VO||e===WO||e===JO&&t===`-`,kk=([e])=>e===VO||e===WO||e===GO,Ak=e=>kk(e)&&!/^\d/.test(e[1]),jk=([e,t])=>e===JO&&t===`-`,Mk=e=>{for(let t=0;t<e.length;t++){let n=t,r=t;if(jk(e[r])){for(;e[r]&&jk(e[r]);)r++;if(!e[r]||!Ak(e[r]))continue;n=r++}else if(Ak(e[r]))r++;else continue;let i=n>t;for(;e[r]&&jk(e[r]);){let t=r;for(;e[r]&&jk(e[r]);)r++;if(!e[r]||!kk(e[r])){r=t;break}i=!0,r++}if(!i)continue;let a=e.slice(t,r).map(([,e])=>e).join(``);e.splice(t,r-t,[e[n][0],a])}},Nk=(e,t)=>{let n=0,r=0;for(let i=t;i<e.length;i++){let[t,a]=e[i];if(t===JO){if(a===`(`)n++;else if(a===`)`)n--;else if(a===`[`)r++;else if(a===`]`)r--;else if(!n&&!r&&a===`{`)return!0;else if(!n&&!r&&(a===`;`||a===`}`))return!1}}return!1},Pk=(e,t)=>{let n=lk(e,{...t,tokenize:void 0});Mk(n);let r=0,i=!1;for(let e=0;e<n.length;e++){let[t,a]=n[e];if(t===JO&&a===`{`){r++,i=!0;continue}if(t===JO&&a===`}`){r--,i=!1;continue}if(t===JO&&a===`;`){i=r>0;continue}if(!i||Dk(t))continue;let o=e,s=e;for(;s<n.length&&Ok(n[s]);)s++;let c=s;for(;c<n.length&&Dk(n[c][0]);)c++;if(s>o&&n[c]?.[0]===JO&&n[c][1]===`:`&&!Nk(n,c+1)){let e=n.slice(o,s).map(([,e])=>e).join(``);n.splice(o,s-o,[GO,e])}i=!1}return n},Fk=s({annotateLine:()=>Lk,keywords:()=>Ik}),Ik=new Set([]),Lk=e=>{let t=``;if(e.value.startsWith(`+`)&&!e.value.startsWith(`+++`))t=`diff-add`;else if(e.value.startsWith(`-`)&&!e.value.startsWith(`---`))t=`diff-remove`;else if(e.value.startsWith(`@@`))t=`diff-hunk`;else if(/^(diff --git|index |--- |\+\+\+ )/.test(e.value)){t=`diff-meta`;for(let t of e.tokens)t.type===`property`&&(t.type=`identifier`)}t&&e.annotations.push(t)},Rk=e=>+(e===`#`),zk=(e,t)=>+(t===`
145
- `),Bk=s({caseInsensitive:()=>!0,keywords:()=>Vk,onCommentEnd:()=>zk,onCommentStart:()=>Rk}),Vk=new Set([`add`,`arg`,`cmd`,`copy`,`entrypoint`,`env`,`expose`,`from`,`healthcheck`,`label`,`maintainer`,`onbuild`,`run`,`shell`,`stopsignal`,`user`,`volume`,`workdir`]),Hk=s({keywords:()=>Wk,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>Uk}),Uk=new Set([`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int`,`int8`,`int16`,`int32`,`int64`,`rune`,`string`,`uint`,`uint8`,`uint16`,`uint32`,`uint64`,`uintptr`]),Wk=new Set([`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`]),Gk=s({keywords:()=>Kk,onCommentEnd:()=>zk,onCommentStart:()=>Rk,typeKeywords:()=>qk}),Kk=new Set([`directive`,`enum`,`extend`,`fragment`,`implements`,`input`,`interface`,`mutation`,`on`,`query`,`repeatable`,`scalar`,`schema`,`subscription`,`type`,`union`]),qk=new Set([`Boolean`,`Float`,`ID`,`Int`,`String`]),Jk=s({keywords:()=>Yk,onCommentEnd:()=>Zk,onCommentStart:()=>Xk}),Yk=new Set([`false`,`for`,`if`,`in`,`null`,`true`]),Xk=(e,t)=>e===`#`||e+t===`//`?1:e+t===`/*`?2:0,Zk=(e,t)=>t===`
146
- `?1:e+t===`*/`?2:0,Qk=new Set([`<`,`>`,`{`,`}`,`[`,`]`]),$k=new Set(`for.do.while.if.else.return.function.var.let.const.true.false.undefined.this.new.delete.typeof.in.instanceof.void.break.continue.switch.case.default.throw.try.catch.finally.debugger.with.yield.async.await.class.extends.super.import.export.from.static`.split(`.`)),eA=new Set([...$k,`type`,`interface`,`enum`,`implements`,`readonly`,`abstract`,`declare`,`namespace`,`module`,`private`,`protected`,`public`,`override`,`keyof`,`infer`,`is`,`asserts`,`satisfies`,`as`,`unknown`,`never`,`any`,`number`,`string`,`boolean`,`bigint`,`symbol`,`object`]),tA=new Set([`+`,`-`,`*`,`/`,`%`,`=`,`!`,`&`,`|`,`^`,`~`,`!`,`?`,`:`,`.`,`,`,`;`,`'`,`"`,`.`,`(`,`)`,`[`,`]`,`#`,`@`,`\\`,...Qk]),nA={keywords:$k,onCommentStart:hA,onCommentEnd:gA,jsx:!0,regex:!0,templateStrings:!0};function rA(e){return{...nA,...e}}function iA(e){let t=0;return/\binterface\s+[A-Za-z_$][\w$]*/.test(e)&&(t+=2),/\btype\s+[A-Za-z_$][\w$]*\s*=/.test(e)&&(t+=2),/\benum\s+[A-Za-z_$][\w$]*/.test(e)&&(t+=2),/\b(?:implements|readonly|declare|namespace|satisfies|infer|keyof|asserts)\b/.test(e)&&(t+=2),/:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?(?=\s*[,)=;{])/m.test(e)&&(t+=1),/\b(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*:\s*/.test(e)&&(t+=1),/\)\s*:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?\s*(?:=>|\{)/.test(e)&&(t+=1),t>=2}function aA(e,t){if(e[t]!==`<`)return!1;let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`<`){n++;continue}if(t===`>`){if(n--,n===0){let t=i+1;for(;t<e.length&&/\s/.test(e[t]);)t++;if(!(r&&e[t]===`(`))return!1;let n=e.slice(t,t+320);return/\)\s*(?::[\s\S]{0,120}?)?=>/.test(n)}continue}if(n!==0){if(/[$A-Za-z_]/.test(t)){r=!0;continue}if(!/[\s,\.\=\?\:\|\&\[\]]/.test(t))return!1}}return!1}function oA(e){return/^[^\S\r\n]+$/g.test(e)}function sA(e){return tA.has(e)}function cA(e){return/^[\w$\u0080-\uffff]+$/.test(e||``)}function lA(e){return/^[0-9A-Z\p{Lu}]/u.test(e)||e===`null`}function uA(e){return/^[a-zA-Z]$/.test(e)}function dA(e){return/^[$_A-Za-z\u0080-\uffff]$/.test(e||``)}function fA(e){return dA(e[0])&&cA(e)}function pA(e){return e==="`"}function mA(e){return e===`"`||e===`'`}function hA(e,t){let n=e+t;return n===`/*`?2:+(n===`//`)}function gA(e,t){return e+t===`*/`?2:+(t===`
147
- `)}function _A(e){return e[0]===`/`&&!hA(e[0],e[1])}function vA(e,t){let n=t+1;for(;n<e.length&&/\s/.test(e[n]);)n++;return e[n]===`:`}function yA(e,t){let n=rA(t),r=n.keywords!==nA.keywords,i=typeof n.typescript==`boolean`?n.typescript:iA(e),a=r?n.keywords:i?eA:$k,{onCommentStart:o,onCommentEnd:s}=n,c=n.typeKeywords instanceof Set?n.typeKeywords:null,l=n.jsx!==!1,u=n.regex!==!1,d=n.templateStrings!==!1,f=n.caseInsensitive?e=>e.toLowerCase():e=>e,p=e=>d&&pA(e),m=``,h=-1,g=[-1,``],_=[-2,``],v=[],y=!1,b=0,x=0,S=0,C=0,w=()=>y&&!x&&!b,T=()=>b,E=()=>w()&&C,D=null,O=0,k=!1,A=0,j=0,ee=()=>D!==null,te=()=>k,ne=()=>j>A,re=()=>j>0&&j===A,ie=()=>ee()||ne();function ae(e){let t=e===`
148
- `;if(T()){if(ee())return UO;let[,t]=g;if(fA(e)){if(t===`<`||t===`</`)return KO;if(!S&&/^\s+$/.test(v[v.length-1]?.[1]||``))return GO}}if(E())return qO;if(ee()||ne())return UO;if(c&&c.has(f(e)))return g[1]===`.`?VO:WO;if(a.has(f(e)))return g[1]===`.`?VO:HO;if(t)return XO;if(oA(e))return ZO;if(e.split(``).every(sA))return JO;if(lA(e))return T()&&!S?VO:WO;if(fA(e)){let e=g[1]===`.`&&fA(_[1]);if(!ie()&&!e)return VO;if(e)return GO}return UO}let M=(e,t)=>{if(t&&(m=t),m){h=typeof e==`number`?e:ae(m);let t=[h,m];h!==ZO&&h!==XO&&(_=g,g=t),T()&&h===JO&&(m===`{`&&S++,m===`}`&&S--),v.push(t)}m=``};for(let t=0;t<e.length;t++){let r=e[t],i=e[t-1],c=e[t+1],d=i+r,f=r+c;if(typeof n.onQuote==`function`&&r===`'`&&!ee()&&!E()&&!ne()){let i=n.onQuote(r,t,e);if(typeof i==`number`&&i>=1&&!Number.isNaN(i)){let n=Math.min(i,e.length-t),r=t+n;M(),m=e.slice(t,r),M(VO),t=r-1;continue}}if(mA(r)&&!E()&&!ne()){M();let i=!1;if(D&&r===D?(D=null,i=!0):D||(D=r,O=v.length),M(UO,r),n.quotedKeys&&i&&vA(e,t))for(let e=O;e<v.length;e++)v[e][0]=GO;continue}if(p(r)){M(),j+=ne()?-1:1,M(UO,r);continue}if(ne()&&f==="${"){A++,M(UO),M(JO,f),t++;continue}if(re()&&r===`}`){M(),A--,M(JO,r);continue}if(w()&&r===`{`){M(),M(JO,r),x=1;continue}if(y){if(!b&&r===`<`){M(),c===`/`?(b=2,m=f,t++):(b=1,m=r),M(JO);continue}if(b){if(r===`>`&&!`/=`.includes(i)){M(),b===1?(b=0,C++):(b=0,y=!1),M(JO,r);continue}if(f===`/>`||f===`</`){m!==`<`&&m!==`/`&&M(),f===`/>`?b=0:C--,C||(y=!1),m=f,t++,M(JO);continue}if(r===`<`){M(),m=r,M(JO);continue}if(r===`-`&&m&&!ie()&&!E()){let n=t+1;for(;n<e.length&&/[$\w-]/.test(e[n]);)n++;M(GO,m+e.slice(t,n)),t=n-1;continue}if(c===`=`&&!ie()&&!oA(r)){oA(m)&&M();let e=m+r;if(fA(e)){M(GO,e);continue}}}}if(l&&!b&&(r===`<`&&dA(c)||f===`</`)){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;let i=n>=0?e[n]:``,[o,s]=g,l=!1,u=!1;if(m&&!oA(m)){let e=m;lA(e)||e===`true`||e===`false`?l=!0:a.has(e)&&fA(e)?u=!0:fA(e)&&(l=!0)}let d=r===`<`&&/[$\w\]\)]/.test(i)&&(l||!u&&(o===VO||o===WO||o===JO&&(s===`)`||s===`]`))),f=r===`<`&&aA(e,t);!d&&!f&&(b=c===`/`?2:1),r===`<`&&(c===`/`||uA(c))&&!d&&!f&&!ie()&&!E()&&!te()&&(y=!0)}let h=mA(r)||p(r),_=ne(),S=u&&!y&&_A(f),T=E();if(h||_||mA(D))m+=r,r===`\\`&&(m+=e[++t]||``);else if(S){M();let[n,i]=g;if(S&&n!==-1&&!(n===JO&&i!==`)`||n===YO)){m=r,M();continue}k=!0;let a=t++,o=!1,s=!1;for(;t<e.length&&e[t]!==`
131
+ `);for(let t=0;t<e.length;t++)i.push([r,e[t]]),t<e.length-1&&(o(i),i.length=0)}else i.push(n);a=!1}else a?o([]):(o(i),i.length=0),e===t.length-1&&o([]),a=!0}return i.length&&o(i),{value:e,lines:n}}function HO(e,t){let n={index:e.index,value:e.value,tokens:e.tokens,annotations:e.annotations,className:`sh__line${e.annotations.map(e=>` sh__line--${e}`).join(``)}`,style:{},properties:{}};return t?.(n),n}function UO({type:e,value:t},n,r){let i=n?.[e],a={type:e,value:t,className:`sh__token--${e}${i?` ${i}`:``}`,style:{color:`var(--sh-${e})`},properties:{}};return r?.(a),a}function WO(e,t){let n=t?.cx,r=t?.mark,i=t?.markLine;return!n&&!r&&!i?e.lines.map(e=>{let t=`sh__line${e.annotations.map(e=>` sh__line--${e}`).join(``)}`,n=e.tokens.map(({type:e,value:t})=>`<span class="sh__token--${e}" style="color:var(--sh-${e})">${KO(t)}</span>`).join(``);return`<span class="${KO(t)}">${n}</span>`}).join(`
132
+ `):e.lines.map(e=>{let t=HO(e,i),a=e.tokens.map(e=>{let t=UO(e,n,r);return`<span ${qO({...t.properties,className:t.className,style:t.style})}>${KO(t.value)}</span>`}).join(``);return`<span ${qO({...t.properties,className:t.className,style:t.style})}>${a}</span>`}).join(`
133
+ `)}var GO={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#039;`},KO=e=>e.replace(/[&<>"']/g,e=>GO[e]);function qO(e){let t=Object.entries(e.style||{}).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${t}`).join(`;`),n=Object.entries(e).filter(([e,t])=>/^[\w:-]+$/.test(e)&&e!==`className`&&e!==`style`&&t!==!1&&t!=null).map(([e,t])=>t===!0?e:`${e}="${KO(String(t))}"`).join(` `);return`class="${KO(e.className||``)}"${t?` style="${KO(t)}"`:``}${n?` ${n}`:``}`}var JO=new Set(`+-*/%=!&|^~?:.,;()[]{}<>#@\\`.split(``)),YO=()=>0,XO=e=>e===`_`||e===`$`||/[\p{L}\p{N}]/u.test(e);function ZO(e,t){for(;t<e.length&&/\s/.test(e[t]);)t++;return e[t]===`:`}function QO(e,t){if(typeof t?.tokenize==`function`)return t.tokenize(e,t);let n=t?.keywords||new Set,r=t?.typeKeywords||new Set,i=t?.onCommentStart||YO,a=t?.onCommentEnd||YO,o=t?.caseInsensitive?e=>e.toLowerCase():e=>e,s=[],c=``;function l(e,t){t&&(s.push([e,t]),e!==BO&&e!==zO&&(c=t))}for(let s=0;s<e.length;){let u=e[s],d=e[s+1],f=i(u,d,s,e);if(f){let t=s++;for(;s<e.length;){if(a(e[s-1],e[s],s,e,t)==f){s++;break}s++}l(RO,e.slice(t,s));continue}let p=t?.onLiteral?.(u,s,e);if(p){l(MO,e.slice(s,s+p)),s+=p;continue}if(typeof t?.onQuote==`function`&&u===`'`){let n=t.onQuote(u,s,e);if(typeof n==`number`&&n>=1){l(AO,e.slice(s,s+n)),s+=n;continue}}if(u===`"`||u===`'`||t?.templateStrings&&u==="`"){let n=u,r=s++;for(;s<e.length;){if(e[s]===`\\`)s++;else if(e[s]===n){s++;break}s++}let i=e.slice(r,s);l(t?.quotedKeys&&ZO(e,s)?PO:MO,i);continue}if(u===`
134
+ `){l(zO,u),s++;continue}if(/[^\S\r\n]/.test(u)){let t=s++;for(;s<e.length&&/[^\S\r\n]/.test(e[s]);)s++;l(BO,e.slice(t,s));continue}if(XO(u)){let t=s++;for(;s<e.length&&XO(e[s]);)s++;if(/^\d/.test(u)&&e[s]===`.`&&/\d/.test(e[s+1]||``))for(s++;s<e.length&&XO(e[s]);)s++;let i=e.slice(t,s),a=o(i);l(r.has(a)?NO:n.has(a)?jO:c===`.`?PO:/^\d/.test(i)||i===`null`||/^\p{Lu}/u.test(i)?NO:AO,i);continue}if(JO.has(u)){l(LO,u),s++;continue}l(MO,u),s++}return s}function $O(e,t){let n=VO(e,QO(e,t));if(t?.annotateLine)for(let e of n.lines)t.annotateLine(e);return n}var ek=(e,t)=>{let n=e+t;return n===`//`?1:n===`/*`?2:0},tk=(e,t)=>t===`
135
+ `?1:e+t===`*/`?2:0,nk=s({keywords:()=>ik,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>rk}),rk=new Set([`void`,`char`,`short`,`int`,`long`,`float`,`double`,`signed`,`unsigned`,`_Bool`,`_Complex`,`_Imaginary`]),ik=new Set(`auto.break.case.const.continue.default.do.else.enum.extern.for.goto.if.inline.register.restrict.return.sizeof.static.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local`.split(`.`)),ak=s({keywords:()=>ok,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>sk}),ok=new Set(`alignas.alignof.and.and_eq.asm.auto.bitand.bitor.break.case.catch.class.compl.concept.const.consteval.constexpr.constinit.const_cast.continue.co_await.co_return.co_yield.decltype.default.delete.do.dynamic_cast.else.enum.explicit.export.extern.false.for.friend.goto.if.inline.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.private.protected.public.register.reinterpret_cast.requires.return.sizeof.static.static_assert.static_cast.struct.switch.template.this.thread_local.throw.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`)),sk=new Set([`bool`,`char`,`char8_t`,`char16_t`,`char32_t`,`double`,`float`,`int`,`long`,`short`,`signed`,`unsigned`,`void`,`wchar_t`]),ck=s({keywords:()=>lk,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>uk}),lk=new Set(`abstract.as.async.await.base.break.case.catch.checked.class.const.continue.default.delegate.do.else.enum.event.explicit.extern.false.finally.fixed.for.foreach.from.get.global.goto.if.implicit.in.init.interface.internal.into.is.join.let.lock.namespace.new.null.on.operator.orderby.out.override.params.partial.private.protected.public.readonly.record.ref.remove.required.return.sealed.select.set.sizeof.stackalloc.static.struct.switch.this.throw.true.try.typeof.unchecked.unsafe.using.value.virtual.volatile.when.where.while.with.yield`.split(`.`)),uk=new Set([`bool`,`byte`,`char`,`decimal`,`double`,`dynamic`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`uint`,`ulong`,`ushort`,`void`]),dk=s({keywords:()=>fk,onCommentEnd:()=>mk,onCommentStart:()=>pk,onLiteral:()=>hk,tokenize:()=>Ck}),fk=new Set([`@media`,`@import`,`@keyframes`,`@font-face`,`@supports`,`@page`,`@counter-style`,`@font-feature-values`,`@viewport`,`@counter-style`,`@font-feature-values`,`@document`]),pk=(e,t)=>+(e+t===`/*`),mk=(e,t)=>+(e+t===`*/`),hk=(e,t,n)=>e===`#`&&n.slice(t).match(/^#(?:[\da-f]{8}|[\da-f]{6}|[\da-f]{4}|[\da-f]{3})(?![\w-])/i)?.[0].length||0,gk=e=>e===BO||e===zO||e===RO,_k=([e,t])=>e===AO||e===NO||e===LO&&t===`-`,vk=([e])=>e===AO||e===NO||e===PO,yk=e=>vk(e)&&!/^\d/.test(e[1]),bk=([e,t])=>e===LO&&t===`-`,xk=e=>{for(let t=0;t<e.length;t++){let n=t,r=t;if(bk(e[r])){for(;e[r]&&bk(e[r]);)r++;if(!e[r]||!yk(e[r]))continue;n=r++}else if(yk(e[r]))r++;else continue;let i=n>t;for(;e[r]&&bk(e[r]);){let t=r;for(;e[r]&&bk(e[r]);)r++;if(!e[r]||!vk(e[r])){r=t;break}i=!0,r++}if(!i)continue;let a=e.slice(t,r).map(([,e])=>e).join(``);e.splice(t,r-t,[e[n][0],a])}},Sk=(e,t)=>{let n=0,r=0;for(let i=t;i<e.length;i++){let[t,a]=e[i];if(t===LO){if(a===`(`)n++;else if(a===`)`)n--;else if(a===`[`)r++;else if(a===`]`)r--;else if(!n&&!r&&a===`{`)return!0;else if(!n&&!r&&(a===`;`||a===`}`))return!1}}return!1},Ck=(e,t)=>{let n=QO(e,{...t,tokenize:void 0});xk(n);let r=0,i=!1;for(let e=0;e<n.length;e++){let[t,a]=n[e];if(t===LO&&a===`{`){r++,i=!0;continue}if(t===LO&&a===`}`){r--,i=!1;continue}if(t===LO&&a===`;`){i=r>0;continue}if(!i||gk(t))continue;let o=e,s=e;for(;s<n.length&&_k(n[s]);)s++;let c=s;for(;c<n.length&&gk(n[c][0]);)c++;if(s>o&&n[c]?.[0]===LO&&n[c][1]===`:`&&!Sk(n,c+1)){let e=n.slice(o,s).map(([,e])=>e).join(``);n.splice(o,s-o,[PO,e])}i=!1}return n},wk=s({annotateLine:()=>Ek,keywords:()=>Tk}),Tk=new Set([]),Ek=e=>{let t=``;if(e.value.startsWith(`+`)&&!e.value.startsWith(`+++`))t=`diff-add`;else if(e.value.startsWith(`-`)&&!e.value.startsWith(`---`))t=`diff-remove`;else if(e.value.startsWith(`@@`))t=`diff-hunk`;else if(/^(diff --git|index |--- |\+\+\+ )/.test(e.value)){t=`diff-meta`;for(let t of e.tokens)t.type===`property`&&(t.type=`identifier`)}t&&e.annotations.push(t)},Dk=e=>+(e===`#`),Ok=(e,t)=>+(t===`
136
+ `),kk=s({caseInsensitive:()=>!0,keywords:()=>Ak,onCommentEnd:()=>Ok,onCommentStart:()=>Dk}),Ak=new Set([`add`,`arg`,`cmd`,`copy`,`entrypoint`,`env`,`expose`,`from`,`healthcheck`,`label`,`maintainer`,`onbuild`,`run`,`shell`,`stopsignal`,`user`,`volume`,`workdir`]),jk=s({keywords:()=>Nk,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>Mk}),Mk=new Set([`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int`,`int8`,`int16`,`int32`,`int64`,`rune`,`string`,`uint`,`uint8`,`uint16`,`uint32`,`uint64`,`uintptr`]),Nk=new Set([`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`]),Pk=s({keywords:()=>Fk,onCommentEnd:()=>Ok,onCommentStart:()=>Dk,typeKeywords:()=>Ik}),Fk=new Set([`directive`,`enum`,`extend`,`fragment`,`implements`,`input`,`interface`,`mutation`,`on`,`query`,`repeatable`,`scalar`,`schema`,`subscription`,`type`,`union`]),Ik=new Set([`Boolean`,`Float`,`ID`,`Int`,`String`]),Lk=s({keywords:()=>Rk,onCommentEnd:()=>Bk,onCommentStart:()=>zk}),Rk=new Set([`false`,`for`,`if`,`in`,`null`,`true`]),zk=(e,t)=>e===`#`||e+t===`//`?1:e+t===`/*`?2:0,Bk=(e,t)=>t===`
137
+ `?1:e+t===`*/`?2:0,Vk=new Set([`<`,`>`,`{`,`}`,`[`,`]`]),Hk=new Set(`for.do.while.if.else.return.function.var.let.const.true.false.undefined.this.new.delete.typeof.in.instanceof.void.break.continue.switch.case.default.throw.try.catch.finally.debugger.with.yield.async.await.class.extends.super.import.export.from.static`.split(`.`)),Uk=new Set([...Hk,`type`,`interface`,`enum`,`implements`,`readonly`,`abstract`,`declare`,`namespace`,`module`,`private`,`protected`,`public`,`override`,`keyof`,`infer`,`is`,`asserts`,`satisfies`,`as`,`unknown`,`never`,`any`,`number`,`string`,`boolean`,`bigint`,`symbol`,`object`]),Wk=new Set([`+`,`-`,`*`,`/`,`%`,`=`,`!`,`&`,`|`,`^`,`~`,`!`,`?`,`:`,`.`,`,`,`;`,`'`,`"`,`.`,`(`,`)`,`[`,`]`,`#`,`@`,`\\`,...Vk]),Gk={keywords:Hk,onCommentStart:iA,onCommentEnd:aA,jsx:!0,regex:!0,templateStrings:!0};function Kk(e){return{...Gk,...e}}function qk(e){let t=0;return/\binterface\s+[A-Za-z_$][\w$]*/.test(e)&&(t+=2),/\btype\s+[A-Za-z_$][\w$]*\s*=/.test(e)&&(t+=2),/\benum\s+[A-Za-z_$][\w$]*/.test(e)&&(t+=2),/\b(?:implements|readonly|declare|namespace|satisfies|infer|keyof|asserts)\b/.test(e)&&(t+=2),/:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?(?=\s*[,)=;{])/m.test(e)&&(t+=1),/\b(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*:\s*/.test(e)&&(t+=1),/\)\s*:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?\s*(?:=>|\{)/.test(e)&&(t+=1),t>=2}function Jk(e,t){if(e[t]!==`<`)return!1;let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`<`){n++;continue}if(t===`>`){if(n--,n===0){let t=i+1;for(;t<e.length&&/\s/.test(e[t]);)t++;if(!(r&&e[t]===`(`))return!1;let n=e.slice(t,t+320);return/\)\s*(?::[\s\S]{0,120}?)?=>/.test(n)}continue}if(n!==0){if(/[$A-Za-z_]/.test(t)){r=!0;continue}if(!/[\s,\.\=\?\:\|\&\[\]]/.test(t))return!1}}return!1}function Yk(e){return/^[^\S\r\n]+$/g.test(e)}function Xk(e){return Wk.has(e)}function Zk(e){return/^[\w$\u0080-\uffff]+$/.test(e||``)}function Qk(e){return/^[0-9A-Z\p{Lu}]/u.test(e)||e===`null`}function $k(e){return/^[a-zA-Z]$/.test(e)}function eA(e){return/^[$_A-Za-z\u0080-\uffff]$/.test(e||``)}function tA(e){return eA(e[0])&&Zk(e)}function nA(e){return e==="`"}function rA(e){return e===`"`||e===`'`}function iA(e,t){let n=e+t;return n===`/*`?2:+(n===`//`)}function aA(e,t){return e+t===`*/`?2:+(t===`
138
+ `)}function oA(e){return e[0]===`/`&&!iA(e[0],e[1])}function sA(e,t){let n=t+1;for(;n<e.length&&/\s/.test(e[n]);)n++;return e[n]===`:`}function cA(e,t){let n=Kk(t),r=n.keywords!==Gk.keywords,i=typeof n.typescript==`boolean`?n.typescript:qk(e),a=r?n.keywords:i?Uk:Hk,{onCommentStart:o,onCommentEnd:s}=n,c=n.typeKeywords instanceof Set?n.typeKeywords:null,l=n.jsx!==!1,u=n.regex!==!1,d=n.templateStrings!==!1,f=n.caseInsensitive?e=>e.toLowerCase():e=>e,p=e=>d&&nA(e),m=``,h=-1,g=[-1,``],_=[-2,``],v=[],y=!1,b=0,x=0,S=0,C=0,w=()=>y&&!x&&!b,T=()=>b,E=()=>w()&&C,D=null,O=0,k=!1,A=0,j=0,ee=()=>D!==null,te=()=>k,ne=()=>j>A,re=()=>j>0&&j===A,ie=()=>ee()||ne();function ae(e){let t=e===`
139
+ `;if(T()){if(ee())return MO;let[,t]=g;if(tA(e)){if(t===`<`||t===`</`)return FO;if(!S&&/^\s+$/.test(v[v.length-1]?.[1]||``))return PO}}if(E())return IO;if(ee()||ne())return MO;if(c&&c.has(f(e)))return g[1]===`.`?AO:NO;if(a.has(f(e)))return g[1]===`.`?AO:jO;if(t)return zO;if(Yk(e))return BO;if(e.split(``).every(Xk))return LO;if(Qk(e))return T()&&!S?AO:NO;if(tA(e)){let e=g[1]===`.`&&tA(_[1]);if(!ie()&&!e)return AO;if(e)return PO}return MO}let M=(e,t)=>{if(t&&(m=t),m){h=typeof e==`number`?e:ae(m);let t=[h,m];h!==BO&&h!==zO&&(_=g,g=t),T()&&h===LO&&(m===`{`&&S++,m===`}`&&S--),v.push(t)}m=``};for(let t=0;t<e.length;t++){let r=e[t],i=e[t-1],c=e[t+1],d=i+r,f=r+c;if(typeof n.onQuote==`function`&&r===`'`&&!ee()&&!E()&&!ne()){let i=n.onQuote(r,t,e);if(typeof i==`number`&&i>=1&&!Number.isNaN(i)){let n=Math.min(i,e.length-t),r=t+n;M(),m=e.slice(t,r),M(AO),t=r-1;continue}}if(rA(r)&&!E()&&!ne()){M();let i=!1;if(D&&r===D?(D=null,i=!0):D||(D=r,O=v.length),M(MO,r),n.quotedKeys&&i&&sA(e,t))for(let e=O;e<v.length;e++)v[e][0]=PO;continue}if(p(r)){M(),j+=ne()?-1:1,M(MO,r);continue}if(ne()&&f==="${"){A++,M(MO),M(LO,f),t++;continue}if(re()&&r===`}`){M(),A--,M(LO,r);continue}if(w()&&r===`{`){M(),M(LO,r),x=1;continue}if(y){if(!b&&r===`<`){M(),c===`/`?(b=2,m=f,t++):(b=1,m=r),M(LO);continue}if(b){if(r===`>`&&!`/=`.includes(i)){M(),b===1?(b=0,C++):(b=0,y=!1),M(LO,r);continue}if(f===`/>`||f===`</`){m!==`<`&&m!==`/`&&M(),f===`/>`?b=0:C--,C||(y=!1),m=f,t++,M(LO);continue}if(r===`<`){M(),m=r,M(LO);continue}if(r===`-`&&m&&!ie()&&!E()){let n=t+1;for(;n<e.length&&/[$\w-]/.test(e[n]);)n++;M(PO,m+e.slice(t,n)),t=n-1;continue}if(c===`=`&&!ie()&&!Yk(r)){Yk(m)&&M();let e=m+r;if(tA(e)){M(PO,e);continue}}}}if(l&&!b&&(r===`<`&&eA(c)||f===`</`)){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;let i=n>=0?e[n]:``,[o,s]=g,l=!1,u=!1;if(m&&!Yk(m)){let e=m;Qk(e)||e===`true`||e===`false`?l=!0:a.has(e)&&tA(e)?u=!0:tA(e)&&(l=!0)}let d=r===`<`&&/[$\w\]\)]/.test(i)&&(l||!u&&(o===AO||o===NO||o===LO&&(s===`)`||s===`]`))),f=r===`<`&&Jk(e,t);!d&&!f&&(b=c===`/`?2:1),r===`<`&&(c===`/`||$k(c))&&!d&&!f&&!ie()&&!E()&&!te()&&(y=!0)}let h=rA(r)||p(r),_=ne(),S=u&&!y&&oA(f),T=E();if(h||_||rA(D))m+=r,r===`\\`&&(m+=e[++t]||``);else if(S){M();let[n,i]=g;if(S&&n!==-1&&!(n===LO&&i!==`)`||n===RO)){m=r,M();continue}k=!0;let a=t++,o=!1,s=!1;for(;t<e.length&&e[t]!==`
149
140
  `;t++){let n=e[t];if(n===`\\`){if(e[t+1]===`
150
- `)break;t++;continue}if(n===`[`&&(s=!0),n===`]`&&(s=!1),n===`/`&&!s){for(o=!0;/^[a-z]$/.test(e[t+1]);)t++;break}}k=!1,a!==t&&o?(m=e.slice(a,t+1),M(UO)):(m=r,M(),t=a)}else if(o(r,c,t,e)){M();let n=t,i=o(r,c,t,e);if(i)for(;t<e.length&&s(e[t-1],e[t],t,e)!=i;t++);m=e.slice(n,t+1),M(YO)}else if(r===` `||r===`
151
- `){if(r===` `&&(oA(m)||!m||T)){let n=t+1;for(;e[n]===` `;)n++;m+=e.slice(t,n),t=n-1,e[n]===`<`&&M()}else M(),m=r,M()}else x&&r===`}`?(M(),m=r,M(),x--):T&&!Qk.has(r)||ne()||(cA(r)===cA(m[m.length-1])||w())&&!tA.has(r)?m+=r:(d===`</`&&(m=d),M(),d!==`</`&&(m=r),f===`</`||f===`/>`?(m=f,M(),t++):Qk.has(r)&&M()),x&&r===`{`&&x++}return M(),v}var bA=s({tokenize:()=>xA}),xA=yA,SA={keywords:new Set,jsx:!0,regex:!1,templateStrings:!1,onCommentStart:(e,t,n,r)=>r.startsWith(`<!--`,n)?2:0,onCommentEnd:(e,t,n,r)=>r.slice(n-2,n+1)===`-->`?2:0},CA=e=>xA(e,SA),wA=/^<\s*(script|style)\b/i,TA=e=>RegExp(`</\\s*${e}\\s*>`,`ig`);function EA(e,t){let n=``;for(let r=t;r<e.length;r++){let t=e[r];if(n)t===n&&(n=``);else if(t===`"`||t===`'`)n=t;else if(t===`>`)return r+1}return-1}function DA(e){let t=[],n=0;for(;n<e.length;){if(e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n+4);n=t===-1?e.length:t+3;continue}if(e[n]!==`<`){n++;continue}let r=EA(e,n);if(r===-1)break;let i=e.slice(n,r).match(wA);if(!i){n=r;continue}let a=i[1].toLowerCase(),o=TA(a);o.lastIndex=r;let s=o.exec(e);if(!s){n=r;continue}t.push({start:n,openEnd:r,closeStart:s.index,end:o.lastIndex,tag:a}),n=o.lastIndex}return t}function OA(e){let t=[],n=0;for(let r of DA(e)){let{start:i,openEnd:a,closeStart:o,end:s,tag:c}=r;t.push(...CA(e.slice(n,i))),t.push(...CA(e.slice(i,a))),t.push(...c===`style`?Pk(e.slice(a,o)):xA(e.slice(a,o),{jsx:!1})),t.push(...CA(e.slice(o,s))),n=s}return t.push(...CA(e.slice(n))),t}var kA=s({jsx:()=>!0,keywords:()=>AA,onCommentEnd:()=>NA,onCommentStart:()=>MA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>jA}),AA=new Set([]),jA=OA,MA=(e,t,n,r)=>r.startsWith(`<!--`,n)?2:0,NA=(e,t,n,r)=>r.slice(n-2,n+1)===`-->`?2:0,PA=s({keywords:()=>IA,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>FA}),FA=new Set([`boolean`,`byte`,`char`,`double`,`float`,`int`,`long`,`short`,`void`]),IA=new Set(`abstract.assert.break.case.catch.class.const.continue.default.do.else.enum.extends.final.finally.for.goto.if.implements.import.instanceof.interface.native.new.package.private.protected.public.return.static.strictfp.super.switch.synchronized.this.throw.throws.transient.try.volatile.while`.split(`.`)),LA=s({keywords:()=>RA,onCommentEnd:()=>fk,onCommentStart:()=>dk,quotedKeys:()=>!0}),RA=new Set([`true`,`false`,`null`]),zA=s({keywords:()=>BA,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>VA}),BA=new Set(`as.break.by.catch.class.companion.const.constructor.continue.data.do.else.enum.false.finally.for.fun.get.if.import.in.infix.init.interface.internal.is.lateinit.noinline.null.object.open.operator.out.override.package.private.protected.public.reified.return.sealed.set.suspend.tailrec.this.throw.true.try.typealias.val.var.vararg.when.where.while`.split(`.`)),VA=new Set([`Any`,`Boolean`,`Byte`,`Char`,`Double`,`Float`,`Int`,`Long`,`Nothing`,`Short`,`String`,`Unit`]),HA=s({keywords:()=>UA,onCommentEnd:()=>GA,onCommentStart:()=>WA,onLiteral:()=>KA}),UA=new Set([`and`,`break`,`do`,`else`,`elseif`,`end`,`false`,`for`,`function`,`goto`,`if`,`in`,`local`,`nil`,`not`,`or`,`repeat`,`return`,`then`,`true`,`until`,`while`]);function WA(e,t,n,r){return e===`#`&&n===0&&t===`!`?1:e+t===`--`?/^--\[=*\[/.test(r.slice(n))?2:1:0}function GA(e,t,n,r,i){if(t===`
152
- `)return 1;if(t!==`]`)return 0;let a=r.slice(i).match(/^--\[(=*)\[/);if(!a)return 0;let o=`]${a[1]}]`;return r.slice(n-o.length+1,n+1)===o?2:0}function KA(e,t,n){if(e!==`[`)return 0;let r=n.slice(t).match(/^\[(=*)\[/);if(!r)return 0;let i=`]${r[1]}]`,a=n.indexOf(i,t+r[0].length);return a===-1?n.length-t:a+i.length-t}var qA=()=>0,JA=()=>0,YA=s({annotateLine:()=>QA,keywords:()=>XA,onCommentEnd:()=>JA,onCommentStart:()=>qA,tokenize:()=>ZA}),XA=new Set([]),ZA=e=>{let t=[],n=``,r=!1,i=(e,n)=>{if(!n)return;let r=t[t.length-1];r?.[0]===e?r[1]+=n:t.push([e,n])};for(let t of e.match(/[^\n]*(?:\n|$)/g)||[]){if(!t)continue;let e=t.endsWith(`
141
+ `)break;t++;continue}if(n===`[`&&(s=!0),n===`]`&&(s=!1),n===`/`&&!s){for(o=!0;/^[a-z]$/.test(e[t+1]);)t++;break}}k=!1,a!==t&&o?(m=e.slice(a,t+1),M(MO)):(m=r,M(),t=a)}else if(o(r,c,t,e)){M();let n=t,i=o(r,c,t,e);if(i)for(;t<e.length&&s(e[t-1],e[t],t,e)!=i;t++);m=e.slice(n,t+1),M(RO)}else if(r===` `||r===`
142
+ `){if(r===` `&&(Yk(m)||!m||T)){let n=t+1;for(;e[n]===` `;)n++;m+=e.slice(t,n),t=n-1,e[n]===`<`&&M()}else M(),m=r,M()}else x&&r===`}`?(M(),m=r,M(),x--):T&&!Vk.has(r)||ne()||(Zk(r)===Zk(m[m.length-1])||w())&&!Wk.has(r)?m+=r:(d===`</`&&(m=d),M(),d!==`</`&&(m=r),f===`</`||f===`/>`?(m=f,M(),t++):Vk.has(r)&&M()),x&&r===`{`&&x++}return M(),v}var lA=s({tokenize:()=>uA}),uA=cA,dA={keywords:new Set,jsx:!0,regex:!1,templateStrings:!1,onCommentStart:(e,t,n,r)=>r.startsWith(`<!--`,n)?2:0,onCommentEnd:(e,t,n,r)=>r.slice(n-2,n+1)===`-->`?2:0},fA=e=>uA(e,dA),pA=/^<\s*(script|style)\b/i,mA=e=>RegExp(`</\\s*${e}\\s*>`,`ig`);function hA(e,t){let n=``;for(let r=t;r<e.length;r++){let t=e[r];if(n)t===n&&(n=``);else if(t===`"`||t===`'`)n=t;else if(t===`>`)return r+1}return-1}function gA(e){let t=[],n=0;for(;n<e.length;){if(e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n+4);n=t===-1?e.length:t+3;continue}if(e[n]!==`<`){n++;continue}let r=hA(e,n);if(r===-1)break;let i=e.slice(n,r).match(pA);if(!i){n=r;continue}let a=i[1].toLowerCase(),o=mA(a);o.lastIndex=r;let s=o.exec(e);if(!s){n=r;continue}t.push({start:n,openEnd:r,closeStart:s.index,end:o.lastIndex,tag:a}),n=o.lastIndex}return t}function _A(e){let t=[],n=0;for(let r of gA(e)){let{start:i,openEnd:a,closeStart:o,end:s,tag:c}=r;t.push(...fA(e.slice(n,i))),t.push(...fA(e.slice(i,a))),t.push(...c===`style`?Ck(e.slice(a,o)):uA(e.slice(a,o),{jsx:!1})),t.push(...fA(e.slice(o,s))),n=s}return t.push(...fA(e.slice(n))),t}var vA=s({jsx:()=>!0,keywords:()=>yA,onCommentEnd:()=>SA,onCommentStart:()=>xA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>bA}),yA=new Set([]),bA=_A,xA=(e,t,n,r)=>r.startsWith(`<!--`,n)?2:0,SA=(e,t,n,r)=>r.slice(n-2,n+1)===`-->`?2:0,CA=s({keywords:()=>TA,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>wA}),wA=new Set([`boolean`,`byte`,`char`,`double`,`float`,`int`,`long`,`short`,`void`]),TA=new Set(`abstract.assert.break.case.catch.class.const.continue.default.do.else.enum.extends.final.finally.for.goto.if.implements.import.instanceof.interface.native.new.package.private.protected.public.return.static.strictfp.super.switch.synchronized.this.throw.throws.transient.try.volatile.while`.split(`.`)),EA=s({keywords:()=>DA,onCommentEnd:()=>tk,onCommentStart:()=>ek,quotedKeys:()=>!0}),DA=new Set([`true`,`false`,`null`]),OA=s({keywords:()=>kA,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>AA}),kA=new Set(`as.break.by.catch.class.companion.const.constructor.continue.data.do.else.enum.false.finally.for.fun.get.if.import.in.infix.init.interface.internal.is.lateinit.noinline.null.object.open.operator.out.override.package.private.protected.public.reified.return.sealed.set.suspend.tailrec.this.throw.true.try.typealias.val.var.vararg.when.where.while`.split(`.`)),AA=new Set([`Any`,`Boolean`,`Byte`,`Char`,`Double`,`Float`,`Int`,`Long`,`Nothing`,`Short`,`String`,`Unit`]),jA=s({keywords:()=>MA,onCommentEnd:()=>PA,onCommentStart:()=>NA,onLiteral:()=>FA}),MA=new Set([`and`,`break`,`do`,`else`,`elseif`,`end`,`false`,`for`,`function`,`goto`,`if`,`in`,`local`,`nil`,`not`,`or`,`repeat`,`return`,`then`,`true`,`until`,`while`]);function NA(e,t,n,r){return e===`#`&&n===0&&t===`!`?1:e+t===`--`?/^--\[=*\[/.test(r.slice(n))?2:1:0}function PA(e,t,n,r,i){if(t===`
143
+ `)return 1;if(t!==`]`)return 0;let a=r.slice(i).match(/^--\[(=*)\[/);if(!a)return 0;let o=`]${a[1]}]`;return r.slice(n-o.length+1,n+1)===o?2:0}function FA(e,t,n){if(e!==`[`)return 0;let r=n.slice(t).match(/^\[(=*)\[/);if(!r)return 0;let i=`]${r[1]}]`,a=n.indexOf(i,t+r[0].length);return a===-1?n.length-t:a+i.length-t}var IA=()=>0,LA=()=>0,RA=s({annotateLine:()=>VA,keywords:()=>zA,onCommentEnd:()=>LA,onCommentStart:()=>IA,tokenize:()=>BA}),zA=new Set([]),BA=e=>{let t=[],n=``,r=!1,i=(e,n)=>{if(!n)return;let r=t[t.length-1];r?.[0]===e?r[1]+=n:t.push([e,n])};for(let t of e.match(/[^\n]*(?:\n|$)/g)||[]){if(!t)continue;let e=t.endsWith(`
153
144
  `)?`
154
- `:``,a=e?t.slice(0,-1):t,o=[],s=a.match(/^(?: {0,3}>[ \t]?)*/)?.[0]||``;if(!n||r)for(let e of s.matchAll(/>/g))o.push([e.index,e.index+1]);let c=s.length,l=0;for(;l<3&&a[c]===` `;)c++,l++;let u=a.slice(c).match(/^(`{3,}|~{3,})/)?.[1];if(n)u?.[0]===n[0]&&u.length>=n.length&&/^\s*$/.test(a.slice(c+u.length))&&(o.push([c,c+u.length]),n=``,r=!1);else if(u)o.push([c,c+u.length]),n=u,r=s.includes(`>`);else{let e=a.slice(c).match(/^(#{1,6}(?=\s)|(?:[-+*]|\d+[.)])(?=\s)|(?:(?:\*\s*){3,}|(?:-\s*){3,}|(?:_\s*){3,})$)/)?.[1];e&&o.push([c,c+e.length]);for(let e of a.matchAll(/(`+)(.*?)\1|(\*{1,3}|_{1,3}|~{2})(?=\S)(.*?\S)\3/g)){let t=e[1]||e[3];a[e.index-1]===`\\`||t[0]===`_`&&/\w/.test(a[e.index-1]||``)||o.push([e.index,e.index+t.length],[e.index+e[0].length-t.length,e.index+e[0].length])}}let d=0;for(let[e,t]of o.sort((e,t)=>e[0]-t[0]))e<d||(i(VO,a.slice(d,e)),i(JO,a.slice(e,t)),d=t);i(VO,a.slice(d)+e)}return t},QA=e=>{let t=``;/^#{1,6}\s/.test(e.value)?t=`markdown-heading`:/^\s*>/.test(e.value)?t=`markdown-quote`:/^\s*(?:[-*+] |\d+[.)] )/.test(e.value)?t=`markdown-list`:/^\s*```/.test(e.value)&&(t=`markdown-fence`),t&&e.annotations.push(t)},$A=s({keywords:()=>ej,onCommentEnd:()=>rj,onCommentStart:()=>nj,typeKeywords:()=>tj}),ej=new Set(`abstract.and.array.as.break.callable.case.catch.class.clone.const.continue.declare.default.do.echo.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.exit.extends.false.final.finally.fn.for.foreach.from.function.global.goto.if.implements.include.include_once.instanceof.insteadof.interface.isset.list.match.namespace.new.null.or.print.private.protected.public.readonly.require.require_once.return.static.switch.throw.trait.true.try.unset.use.var.while.xor.yield`.split(`.`)),tj=new Set([`bool`,`float`,`int`,`iterable`,`mixed`,`never`,`object`,`string`,`void`]),nj=(e,t)=>e===`#`||e+t===`//`?1:e+t===`/*`?2:0,rj=(e,t)=>t===`
155
- `?1:e+t===`*/`?2:0,ij=s({tokenize:()=>aj}),aj=e=>[[VO,e]],oj=s({caseInsensitive:()=>!0,keywords:()=>sj,onCommentEnd:()=>lj,onCommentStart:()=>cj}),sj=new Set(`begin.break.catch.class.continue.data.define.do.dynamicparam.else.elseif.end.enum.exit.filter.finally.for.foreach.from.function.if.in.param.process.return.switch.throw.trap.try.until.using.while`.split(`.`)),cj=(e,t)=>e===`#`?1:e+t===`<#`?2:0,lj=(e,t)=>t===`
156
- `?1:e+t===`#>`?2:0,uj=s({keywords:()=>dj,onCommentEnd:()=>pj,onCommentStart:()=>fj}),dj=new Set(`and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield`.split(`.`)),fj=(e,t)=>+(e===`#`),pj=(e,t)=>+(t===`
157
- `),mj=s({keywords:()=>hj,onCommentEnd:()=>vj,onCommentStart:()=>_j}),hj=new Set(`BEGIN.END.__ENCODING__.__FILE__.__LINE__.alias.and.begin.break.case.class.def.defined.do.else.elsif.end.ensure.false.for.if.in.module.next.nil.not.or.redo.rescue.retry.return.self.super.then.true.undef.unless.until.when.while.yield`.split(`.`));function gj(e,t){return e>0&&t[e-1]!==`
158
- `?!1:/^=begin(?:\s|$)/.test(t.slice(e))}function _j(e,t,n,r){return e===`#`?1:e===`=`&&gj(n,r)?2:0}function vj(e,t,n,r){if(t!==`
145
+ `:``,a=e?t.slice(0,-1):t,o=[],s=a.match(/^(?: {0,3}>[ \t]?)*/)?.[0]||``;if(!n||r)for(let e of s.matchAll(/>/g))o.push([e.index,e.index+1]);let c=s.length,l=0;for(;l<3&&a[c]===` `;)c++,l++;let u=a.slice(c).match(/^(`{3,}|~{3,})/)?.[1];if(n)u?.[0]===n[0]&&u.length>=n.length&&/^\s*$/.test(a.slice(c+u.length))&&(o.push([c,c+u.length]),n=``,r=!1);else if(u)o.push([c,c+u.length]),n=u,r=s.includes(`>`);else{let e=a.slice(c).match(/^(#{1,6}(?=\s)|(?:[-+*]|\d+[.)])(?=\s)|(?:(?:\*\s*){3,}|(?:-\s*){3,}|(?:_\s*){3,})$)/)?.[1];e&&o.push([c,c+e.length]);for(let e of a.matchAll(/(`+)(.*?)\1|(\*{1,3}|_{1,3}|~{2})(?=\S)(.*?\S)\3/g)){let t=e[1]||e[3];a[e.index-1]===`\\`||t[0]===`_`&&/\w/.test(a[e.index-1]||``)||o.push([e.index,e.index+t.length],[e.index+e[0].length-t.length,e.index+e[0].length])}}let d=0;for(let[e,t]of o.sort((e,t)=>e[0]-t[0]))e<d||(i(AO,a.slice(d,e)),i(LO,a.slice(e,t)),d=t);i(AO,a.slice(d)+e)}return t},VA=e=>{let t=``;/^#{1,6}\s/.test(e.value)?t=`markdown-heading`:/^\s*>/.test(e.value)?t=`markdown-quote`:/^\s*(?:[-*+] |\d+[.)] )/.test(e.value)?t=`markdown-list`:/^\s*```/.test(e.value)&&(t=`markdown-fence`),t&&e.annotations.push(t)},HA=s({keywords:()=>UA,onCommentEnd:()=>KA,onCommentStart:()=>GA,typeKeywords:()=>WA}),UA=new Set(`abstract.and.array.as.break.callable.case.catch.class.clone.const.continue.declare.default.do.echo.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.exit.extends.false.final.finally.fn.for.foreach.from.function.global.goto.if.implements.include.include_once.instanceof.insteadof.interface.isset.list.match.namespace.new.null.or.print.private.protected.public.readonly.require.require_once.return.static.switch.throw.trait.true.try.unset.use.var.while.xor.yield`.split(`.`)),WA=new Set([`bool`,`float`,`int`,`iterable`,`mixed`,`never`,`object`,`string`,`void`]),GA=(e,t)=>e===`#`||e+t===`//`?1:e+t===`/*`?2:0,KA=(e,t)=>t===`
146
+ `?1:e+t===`*/`?2:0,qA=s({tokenize:()=>JA}),JA=e=>[[AO,e]],YA=s({caseInsensitive:()=>!0,keywords:()=>XA,onCommentEnd:()=>QA,onCommentStart:()=>ZA}),XA=new Set(`begin.break.catch.class.continue.data.define.do.dynamicparam.else.elseif.end.enum.exit.filter.finally.for.foreach.from.function.if.in.param.process.return.switch.throw.trap.try.until.using.while`.split(`.`)),ZA=(e,t)=>e===`#`?1:e+t===`<#`?2:0,QA=(e,t)=>t===`
147
+ `?1:e+t===`#>`?2:0,$A=s({keywords:()=>ej,onCommentEnd:()=>nj,onCommentStart:()=>tj}),ej=new Set(`and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield`.split(`.`)),tj=(e,t)=>+(e===`#`),nj=(e,t)=>+(t===`
148
+ `),rj=s({keywords:()=>ij,onCommentEnd:()=>sj,onCommentStart:()=>oj}),ij=new Set(`BEGIN.END.__ENCODING__.__FILE__.__LINE__.alias.and.begin.break.case.class.def.defined.do.else.elsif.end.ensure.false.for.if.in.module.next.nil.not.or.redo.rescue.retry.return.self.super.then.true.undef.unless.until.when.while.yield`.split(`.`));function aj(e,t){return e>0&&t[e-1]!==`
149
+ `?!1:/^=begin(?:\s|$)/.test(t.slice(e))}function oj(e,t,n,r){return e===`#`?1:e===`=`&&aj(n,r)?2:0}function sj(e,t,n,r){if(t!==`
159
150
  `)return 0;let i=r.lastIndexOf(`
160
- `,n-1)+1,a=r.slice(i,n);return/^=end(?:\s|$)/.test(a)?2:1}var yj=s({keywords:()=>bj,onQuote:()=>xj}),bj=new Set(`as.break.const.continue.crate.else.enum.extern.false.fn.for.if.impl.in.let.loop.match.mod.move.mut.pub.ref.return.self.Self.static.struct.super.trait.true.type.unsafe.use.where.while.async.await.dyn.abstract.become.box.do.final.macro.override.priv.typeof.unsized.virtual.yield.try`.split(`.`));function xj(e,t,n){if(e!==`'`||t+1>=n.length)return 1;let r=n[t+1];if(r===`\\`){let e=t+2;for(;e<n.length;){if(n[e]===`\\`){e+=2;continue}if(n[e]===`'`)return e-t+1;e++}return n.length-t}if(r===`_`)return 2;if(/[a-zA-Z]/.test(r)){let e=t+2;for(;e<n.length&&/[a-zA-Z0-9_]/.test(n[e]);)e++;return e<n.length&&n[e]===`'`?e-t+1:e-t}return 1}var Sj=s({keywords:()=>Cj,onCommentEnd:()=>zk,onCommentStart:()=>Rk}),Cj=new Set([`case`,`coproc`,`do`,`done`,`elif`,`else`,`esac`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`readonly`,`return`,`select`,`then`,`time`,`until`,`while`]),wj=s({caseInsensitive:()=>!0,keywords:()=>Tj,onCommentEnd:()=>Oj,onCommentStart:()=>Dj,typeKeywords:()=>Ej}),Tj=new Set(`add.all.alter.and.as.asc.between.by.case.check.column.constraint.create.cross.database.default.delete.desc.distinct.drop.else.end.exists.foreign.from.full.group.having.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.primary.references.right.select.set.table.then.union.unique.update.values.view.when.where.with`.split(`.`)),Ej=new Set([`bigint`,`binary`,`bit`,`blob`,`boolean`,`char`,`date`,`datetime`,`decimal`,`double`,`float`,`int`,`integer`,`interval`,`json`,`numeric`,`real`,`smallint`,`text`,`time`,`timestamp`,`uuid`,`varchar`]),Dj=(e,t)=>{let n=e+t;return n===`--`?1:n===`/*`?2:0},Oj=(e,t)=>t===`
161
- `?1:e+t===`*/`?2:0,kj=s({keywords:()=>Aj,onCommentEnd:()=>fk,onCommentStart:()=>dk,typeKeywords:()=>jj}),Aj=new Set(`as.associatedtype.break.case.catch.class.continue.convenience.default.defer.deinit.didSet.do.dynamic.else.enum.extension.fallthrough.false.fileprivate.final.for.func.get.guard.if.import.in.indirect.infix.init.inout.internal.is.lazy.let.mutating.nil.nonmutating.open.operator.override.precedencegroup.private.protocol.public.repeat.required.rethrows.return.self.set.some.static.struct.subscript.super.switch.throw.throws.true.try.typealias.unowned.var.weak.where.while.willSet`.split(`.`)),jj=new Set([`Any`,`Bool`,`Character`,`Double`,`Float`,`Int`,`Never`,`String`,`UInt`,`Void`]),Mj=s({keywords:()=>Nj,onCommentEnd:()=>zk,onCommentStart:()=>Rk,quotedKeys:()=>!0}),Nj=new Set([`false`,`true`]),Pj=s({tokenize:()=>Fj}),Fj=(e,t)=>yA(e,{...t,typescript:!0}),Ij=s({jsx:()=>!0,keywords:()=>AA,onCommentEnd:()=>NA,onCommentStart:()=>MA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>OA}),Lj=s({jsx:()=>!0,keywords:()=>AA,onCommentEnd:()=>NA,onCommentStart:()=>MA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>OA}),Rj=s({keywords:()=>zj,onCommentEnd:()=>zk,onCommentStart:()=>Rk,quotedKeys:()=>!0}),zj=new Set([`false`,`False`,`FALSE`,`no`,`No`,`NO`,`null`,`Null`,`NULL`,`off`,`Off`,`OFF`,`on`,`On`,`ON`,`true`,`True`,`TRUE`,`yes`,`Yes`,`YES`]),Bj=s({keywords:()=>Vj,onCommentEnd:()=>Wj,onCommentStart:()=>Uj,onLiteral:()=>Gj,typeKeywords:()=>Hj}),Vj=new Set(`addrspace.align.allowzero.and.anyframe.anytype.asm.async.await.break.callconv.catch.comptime.const.continue.defer.else.enum.errdefer.error.export.extern.false.fn.for.if.inline.linksection.noalias.noinline.nosuspend.null.opaque.or.orelse.packed.pub.resume.return.struct.suspend.switch.test.threadlocal.true.try.undefined.union.unreachable.usingnamespace.var.volatile.while`.split(`.`)),Hj=new Set(`anyerror.anyopaque.bool.c_char.c_int.c_long.c_longdouble.c_longlong.c_short.c_uint.c_ulong.c_ulonglong.c_ushort.comptime_float.comptime_int.f16.f32.f64.f80.f128.i8.i16.i32.i64.i128.isize.noreturn.type.u8.u16.u32.u64.u128.usize.void`.split(`.`)),Uj=(e,t)=>+(e+t===`//`),Wj=(e,t)=>+(t===`
162
- `);function Gj(e,t,n){if(e!==`\\`||n[t+1]!==`\\`)return 0;let r=n.lastIndexOf(`
151
+ `,n-1)+1,a=r.slice(i,n);return/^=end(?:\s|$)/.test(a)?2:1}var cj=s({keywords:()=>lj,onQuote:()=>uj}),lj=new Set(`as.break.const.continue.crate.else.enum.extern.false.fn.for.if.impl.in.let.loop.match.mod.move.mut.pub.ref.return.self.Self.static.struct.super.trait.true.type.unsafe.use.where.while.async.await.dyn.abstract.become.box.do.final.macro.override.priv.typeof.unsized.virtual.yield.try`.split(`.`));function uj(e,t,n){if(e!==`'`||t+1>=n.length)return 1;let r=n[t+1];if(r===`\\`){let e=t+2;for(;e<n.length;){if(n[e]===`\\`){e+=2;continue}if(n[e]===`'`)return e-t+1;e++}return n.length-t}if(r===`_`)return 2;if(/[a-zA-Z]/.test(r)){let e=t+2;for(;e<n.length&&/[a-zA-Z0-9_]/.test(n[e]);)e++;return e<n.length&&n[e]===`'`?e-t+1:e-t}return 1}var dj=s({keywords:()=>fj,onCommentEnd:()=>Ok,onCommentStart:()=>Dk}),fj=new Set([`case`,`coproc`,`do`,`done`,`elif`,`else`,`esac`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`readonly`,`return`,`select`,`then`,`time`,`until`,`while`]),pj=s({caseInsensitive:()=>!0,keywords:()=>mj,onCommentEnd:()=>_j,onCommentStart:()=>gj,typeKeywords:()=>hj}),mj=new Set(`add.all.alter.and.as.asc.between.by.case.check.column.constraint.create.cross.database.default.delete.desc.distinct.drop.else.end.exists.foreign.from.full.group.having.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.primary.references.right.select.set.table.then.union.unique.update.values.view.when.where.with`.split(`.`)),hj=new Set([`bigint`,`binary`,`bit`,`blob`,`boolean`,`char`,`date`,`datetime`,`decimal`,`double`,`float`,`int`,`integer`,`interval`,`json`,`numeric`,`real`,`smallint`,`text`,`time`,`timestamp`,`uuid`,`varchar`]),gj=(e,t)=>{let n=e+t;return n===`--`?1:n===`/*`?2:0},_j=(e,t)=>t===`
152
+ `?1:e+t===`*/`?2:0,vj=s({keywords:()=>yj,onCommentEnd:()=>tk,onCommentStart:()=>ek,typeKeywords:()=>bj}),yj=new Set(`as.associatedtype.break.case.catch.class.continue.convenience.default.defer.deinit.didSet.do.dynamic.else.enum.extension.fallthrough.false.fileprivate.final.for.func.get.guard.if.import.in.indirect.infix.init.inout.internal.is.lazy.let.mutating.nil.nonmutating.open.operator.override.precedencegroup.private.protocol.public.repeat.required.rethrows.return.self.set.some.static.struct.subscript.super.switch.throw.throws.true.try.typealias.unowned.var.weak.where.while.willSet`.split(`.`)),bj=new Set([`Any`,`Bool`,`Character`,`Double`,`Float`,`Int`,`Never`,`String`,`UInt`,`Void`]),xj=s({keywords:()=>Sj,onCommentEnd:()=>Ok,onCommentStart:()=>Dk,quotedKeys:()=>!0}),Sj=new Set([`false`,`true`]),Cj=s({tokenize:()=>wj}),wj=(e,t)=>cA(e,{...t,typescript:!0}),Tj=s({jsx:()=>!0,keywords:()=>yA,onCommentEnd:()=>SA,onCommentStart:()=>xA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>_A}),Ej=s({jsx:()=>!0,keywords:()=>yA,onCommentEnd:()=>SA,onCommentStart:()=>xA,regex:()=>!1,templateStrings:()=>!1,tokenize:()=>_A}),Dj=s({keywords:()=>Oj,onCommentEnd:()=>Ok,onCommentStart:()=>Dk,quotedKeys:()=>!0}),Oj=new Set([`false`,`False`,`FALSE`,`no`,`No`,`NO`,`null`,`Null`,`NULL`,`off`,`Off`,`OFF`,`on`,`On`,`ON`,`true`,`True`,`TRUE`,`yes`,`Yes`,`YES`]),kj=s({keywords:()=>Aj,onCommentEnd:()=>Nj,onCommentStart:()=>Mj,onLiteral:()=>Pj,typeKeywords:()=>jj}),Aj=new Set(`addrspace.align.allowzero.and.anyframe.anytype.asm.async.await.break.callconv.catch.comptime.const.continue.defer.else.enum.errdefer.error.export.extern.false.fn.for.if.inline.linksection.noalias.noinline.nosuspend.null.opaque.or.orelse.packed.pub.resume.return.struct.suspend.switch.test.threadlocal.true.try.undefined.union.unreachable.usingnamespace.var.volatile.while`.split(`.`)),jj=new Set(`anyerror.anyopaque.bool.c_char.c_int.c_long.c_longdouble.c_longlong.c_short.c_uint.c_ulong.c_ulonglong.c_ushort.comptime_float.comptime_int.f16.f32.f64.f80.f128.i8.i16.i32.i64.i128.isize.noreturn.type.u8.u16.u32.u64.u128.usize.void`.split(`.`)),Mj=(e,t)=>+(e+t===`//`),Nj=(e,t)=>+(t===`
153
+ `);function Pj(e,t,n){if(e!==`\\`||n[t+1]!==`\\`)return 0;let r=n.lastIndexOf(`
163
154
  `,t-1)+1;if(n.slice(r,t).trim())return 0;let i=n.indexOf(`
164
- `,t+2);return(i===-1?n.length:i)-t}function Kj(e){return{...e,jsx:!1,regex:!1,templateStrings:!1}}function qj(){return{javascript:bA,typescript:Pj,css:Kj(Sk),python:Kj(uj),c:Kj(pk),go:Kj(Hk),java:Kj(PA),rust:Kj(yj),json:Kj(LA),diff:Kj(Fk),shell:Kj(Sj),cpp:Kj(gk),csharp:Kj(yk),sql:Kj(wj),html:kA,vue:Lj,svelte:Ij,yaml:Kj(Rj),markdown:Kj(YA),plaintext:Kj(ij),ruby:Kj(mj),kotlin:Kj(zA),swift:Kj(kj),php:Kj($A),toml:Kj(Mj),powershell:Kj(oj),dockerfile:Kj(Bk),graphql:Kj(Gk),hcl:Kj(Jk),zig:Kj(Bj),lua:Kj(HA)}}var Jj=qj();function Yj(e){return Jj[e||`javascript`]}function Xj(e,t){let{lang:n,cx:r,mark:i,markLine:a}=t||{};return tk(uk(e,Yj(n)),{cx:r,mark:i,markLine:a})}function Zj({code:e,path:t,className:n}){let r=e.replace(/\n$/,``),i=(0,m.useMemo)(()=>Xj(r),[r]),a=r.split(`
165
- `).length;return(0,h.jsxs)(`div`,{className:X(`flex min-w-0 flex-col`,n),children:[t?(0,h.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-3 border-b border-rule bg-soft pr-1.5 pl-4`,children:[(0,h.jsx)(Q,{size:12,className:`truncate text-muted`,title:t,children:t}),(0,h.jsx)(y_,{icon:`copy`,label:`Copy file`,size:15,onClick:()=>hC(e,`Copied the file`)})]}):null,(0,h.jsxs)(`div`,{className:`flex max-h-[640px] min-w-0 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,h.jsx)(`pre`,{"aria-hidden":`true`,className:`sticky left-0 m-0 shrink-0 select-none border-r border-rule bg-surface py-3 pr-3 pl-4 text-right text-muted`,children:Array.from({length:a},(e,t)=>t+1).join(`
166
- `)}),(0,h.jsx)(`pre`,{className:`m-0 min-w-0 grow py-3 pr-6 pl-4 text-ink`,children:(0,h.jsx)(`code`,{dangerouslySetInnerHTML:{__html:i}})})]})]})}var Qj={beta:`action`,experimental:`action`,draft:`action`,deprecated:`danger`,stable:`ok`},$j=`.design/system/components/`;function eM(e){return e.startsWith($j)?`@system/components/${e.slice(26).replace(/\.(tsx|jsx|ts|js)$/,``).replace(/\/index$/,``)}`:null}function tM(e){let t=new Set;for(let n of e.matchAll(/export\s+(?:async\s+)?(?:function|const|class|let)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);for(let n of e.matchAll(/export\s*\{([^}]+)\}/g))for(let e of n[1].split(`,`)){let n=e.trim().split(/\s+as\s+/).pop()?.trim();n&&n!=="default"&&t.add(n)}return[...t].filter(e=>/^[A-Z]/.test(e))}function nM({path:e}){let t=eM(e),n=Hg(t?e:null).data;if(!t)return null;let r=n?tM(n):[],i=`import { ${r.length?r.join(`, `):`…`} } from '${t}'`;return(0,h.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-rule py-1.5 pr-1.5 pl-4`,children:[(0,h.jsx)(Q,{size:12.5,className:`min-w-0 truncate text-ink2`,title:i,children:i}),(0,h.jsx)(y_,{icon:`copy`,label:`Copy the import`,size:14,className:`ml-auto`,onClick:()=>hC(i)})]})}function rM({component:e,theme:t,width:n}){return n===`fill`?(0,h.jsx)(zO,{src:e.url,theme:t,title:e.title,minHeight:160}):(0,h.jsx)(`div`,{className:`flex justify-center overflow-x-auto bg-soft p-6`,children:(0,h.jsx)(`div`,{className:`shrink-0 overflow-hidden rounded-[8px] border border-rule bg-surface shadow-frame`,children:(0,h.jsx)(zO,{src:e.url,theme:t,title:e.title,minHeight:160,width:Number(n)})})})}function iM({component:e}){let t=[...e.sources,e.specimen],[n,r]=(0,m.useState)(t[0]),i=t.includes(n)?n:t[0],{data:a,error:o,isLoading:s}=Hg(i);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[t.length>1?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-rule px-4 py-2.5`,children:(0,h.jsx)(vw,{label:`File`,size:`sm`,value:i,onChange:r,items:t.map(t=>({value:t,label:t===e.specimen?`${aM(t)} · specimen`:aM(t),title:t}))})}):null,eM(i)?(0,h.jsx)(nM,{path:i}):null,o?(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-6 text-[13px] text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:15}),o.message]}):s||a===void 0?(0,h.jsx)(`div`,{className:`flex items-center justify-center py-10 text-muted`,children:(0,h.jsx)(Z,{name:`loader`,size:18})}):(0,h.jsx)(Zj,{code:a,path:i})]})}function aM(e){return e.split(`/`).pop()??e}function oM({system:e,id:t}){let n=e.components.find(e=>e.id===t),[r,i]=(0,m.useState)(`preview`),[a,o]=DO(),[s,c]=(0,m.useState)(`fill`);if(!n)return(0,h.jsx)(hT,{title:`No such component`,text:`There is no specimen "${t}" in .design/system/specimens.`});let l=n.status?.toLowerCase();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:n.title,badge:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(YC,{children:n.group}),l?(0,h.jsx)(YC,{tone:Qj[l]??`neutral`,children:n.status}):null]}),sub:n.description}),(0,h.jsxs)(ZC,{children:[(0,h.jsx)($C,{value:r,onChange:i,items:[{value:`preview`,label:`Preview`},{value:`code`,label:`Code`,count:n.sources.length+1}],right:r===`preview`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vw,{label:`Width`,size:`sm`,value:s,onChange:c,items:[{value:`fill`,label:`Fill`},{value:`768`,label:`768`},{value:`390`,label:`390`}]}),(0,h.jsx)(OO,{value:a,onChange:o}),(0,h.jsx)(x_,{icon:`external`,href:_w(gw(n.url,a)),target:`_blank`,rel:`noreferrer`,children:`Open`})]}):null}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:r===`preview`?(0,h.jsx)(rM,{component:n,theme:a,width:s}):(0,h.jsx)(iM,{component:n})})]})]})}function sM(e,t){let n=/^\s*#\s+(.+)\r?\n/.exec(e);return n&&n[1].trim()===t?e.slice(n[0].length):e}function cM({system:e,slug:t}){let n=e.guidelines.find(e=>e.slug===t);if(!n)return(0,h.jsx)(hT,{title:`No such guideline`,text:`There is no guideline "${t}" in .design/system/guidelines.`});let r=sM(n.markdown,n.title).trim();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:n.title,sub:`Guideline`}),(0,h.jsx)(ZC,{children:(0,h.jsx)(`div`,{className:`px-6 py-5`,children:r?(0,h.jsx)(AD,{text:r,className:`max-w-[760px]`}):(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`This guideline is empty. Write it in `,(0,h.jsx)(Q,{children:`.design/system/guidelines`}),`.`]})})})]})}var lM={linear:[0,0,1,1],ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]};function uM(e){let t=e.trim();if(lM[t])return lM[t];let n=/^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/.exec(t);if(!n)return null;let r=n.slice(1).map(Number);return r.every(Number.isFinite)?r:null}function dM(e){let t=/^(-?[\d.]+)(ms|s)$/.exec(e.trim());return t?Number(t[1])*(t[2]===`s`?1e3:1):null}var fM=132,pM=22;function mM({bezier:e}){let[t,n,r,i]=e,a=Math.min(0,n,i),o=Math.max(1,n,i),s=88/(o-a),c=e=>pM+e*88,l=e=>pM+(o-e)*s;return(0,h.jsxs)(`svg`,{width:fM,height:fM,viewBox:`0 0 ${fM} ${fM}`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,h.jsx)(`rect`,{x:c(0),y:l(1),width:88,height:l(0)-l(1),className:`fill-none stroke-rule`}),(0,h.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(t),y2:l(n),className:`stroke-rule-strong`,strokeDasharray:`3 3`}),(0,h.jsx)(`line`,{x1:c(1),y1:l(1),x2:c(r),y2:l(i),className:`stroke-rule-strong`,strokeDasharray:`3 3`}),(0,h.jsx)(`path`,{d:`M ${c(0)} ${l(0)} C ${c(t)} ${l(n)}, ${c(r)} ${l(i)}, ${c(1)} ${l(1)}`,className:`fill-none stroke-ink`,strokeWidth:2,strokeLinecap:`round`}),(0,h.jsx)(`circle`,{cx:c(t),cy:l(n),r:3,className:`fill-action`}),(0,h.jsx)(`circle`,{cx:c(r),cy:l(i),r:3,className:`fill-action`})]})}function hM({token:e,duration:t}){let[n,r]=(0,m.useState)(!1),i=e.light?.value??``,a=uM(i);return(0,h.jsxs)(`button`,{type:`button`,title:`Hover to play; click to copy the variable`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onClick:()=>hC(`var(${e.name})`),className:`flex min-w-0 cursor-pointer flex-col gap-3 rounded-[8px] border border-transparent bg-transparent p-3 text-left transition-colors hover:border-rule hover:bg-soft`,children:[(0,h.jsx)(`span`,{className:`flex h-[132px] items-center justify-center rounded-[6px] bg-soft`,children:a?(0,h.jsx)(mM,{bezier:a}):(0,h.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No curve to draw`})}),(0,h.jsx)(`span`,{className:`relative mx-1 h-2 rounded-full bg-soft2`,children:(0,h.jsx)(`span`,{className:`absolute top-1/2 size-3.5 -translate-y-1/2 rounded-full bg-ink`,style:{left:n?`calc(100% - 14px)`:`0px`,transition:`left ${t}ms ${i||`ease`}`}})}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-1`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(kO,{items:SO(e)}),(0,h.jsx)(MO,{children:i}),e.description?(0,h.jsx)(`span`,{className:`text-[12.5px] text-ink2`,children:e.description}):null]})]})}function gM({system:e}){let t=CO(e.tokens,`ease`),n=CO(e.tokens,`duration`),r=CO(e.tokens,`animation`),i=`minmax(170px,1fr) 100px minmax(0,2fr)`,a=`minmax(170px,1fr) minmax(140px,0.7fr) minmax(0,2fr)`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Motion`,sub:`Hover an easing to see it move.`}),!t.length&&!n.length&&!r.length?(0,h.jsxs)(AO,{title:`No motion tokens`,children:[`Add `,(0,h.jsx)(Q,{children:`--ease-*`}),` and `,(0,h.jsx)(Q,{children:`--animate-*`}),` to the `,(0,h.jsx)(Q,{children:`@theme`}),` block, and durations as`,` `,(0,h.jsx)(Q,{children:`--duration-*`}),`, in `,(0,h.jsx)(Q,{children:jO}),`.`]}):null,t.length?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Easing`,count:t.length}),(0,h.jsx)(`div`,{className:`grid gap-2 border-t border-rule p-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(190px, 1fr))`},children:t.map(e=>(0,h.jsx)(hM,{token:e,duration:900},e.name))})]}):null,n.length?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Durations`,count:n.length}),(0,h.jsx)(nw,{cols:i,labels:[`Token`,`Value`,``]}),n.map(e=>{let t=e.light?dM(e.light.value):null;return(0,h.jsxs)(iw,{cols:i,minH:40,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),t===null?(0,h.jsx)(`span`,{}):(0,h.jsx)(`span`,{className:`h-3 rounded-[3px] bg-action/70`,style:{width:Math.max(2,Math.min(t/2,480))}})]},e.name)})]}):null,r.length?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Animations`,count:r.length,sub:`keyframes live in the system stylesheet`}),(0,h.jsx)(nw,{cols:a,labels:[`Token`,`Class`,`Value`]}),r.map(e=>(0,h.jsxs)(iw,{cols:a,minH:40,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(kO,{items:SO(e)}),(0,h.jsx)(MO,{children:e.light?.value})]},e.name))]}):null]})}function _M({system:e}){let t=new Set(e.tokens.map(e=>e.kind)),n=[{to:`/system/colors`,label:`Colors`,hint:vM(e,`color`)},{to:`/system/typography`,label:`Typography`},{to:`/system/shape`,label:`Spacing & shape`}];(t.has(`ease`)||t.has(`duration`)||t.has(`animation`))&&n.push({to:`/system/motion`,label:`Motion`}),t.has(`other`)&&n.push({to:`/system/tokens`,label:`Other tokens`,hint:vM(e,`other`)}),e.assets.length&&n.push({to:`/system/assets`,label:`Assets`,hint:e.assets.length});let r=new Map;for(let t of e.components){let e=r.get(t.group)??[];e.push({to:`/system/components/${encodeURIComponent(t.id)}`,label:t.title,hint:t.status}),r.set(t.group,e)}let i=e.guidelines.filter(e=>e.slug!==`overview`);return(0,h.jsxs)(`div`,{className:`flex flex-col max-lg:gap-1 max-lg:[&_nav]:flex-row max-lg:[&_nav]:flex-wrap`,children:[(0,h.jsx)(xw,{label:`Overview`,items:[{to:`/system`,label:`Overview`}]}),(0,h.jsx)(Sw,{children:`Foundations`}),(0,h.jsx)(xw,{label:`Foundations`,items:n}),i.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Sw,{children:`Guidelines`}),(0,h.jsx)(xw,{label:`Guidelines`,items:i.map(e=>({to:`/system/guidelines/${encodeURIComponent(e.slug)}`,label:e.title}))})]}):null,[...r].map(([e,t])=>(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(Sw,{children:e}),(0,h.jsx)(xw,{label:e,items:t})]},e))]})}function vM(e,t){return e.tokens.filter(e=>e.kind===t).length||void 0}function yM({system:e}){let t=CO(e.tokens,`other`),n=`minmax(170px,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.3fr)`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Other tokens`,sub:`Variables that are not colors, type, spacing, shape or motion.`}),t.length?wO(t).map(({group:e,tokens:t})=>(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:e,count:t.length}),(0,h.jsx)(nw,{cols:n,labels:[`Token`,`Light`,`Dark`,`Description`]}),t.map(e=>(0,h.jsxs)(iw,{cols:n,minH:40,title:`Copy the variable`,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(MO,{children:e.light?.value}),(0,h.jsx)(MO,{children:e.dark?.value??`—`}),(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.description})]},e.name))]},e)):(0,h.jsxs)(AO,{title:`No other tokens`,children:[`Variables in `,(0,h.jsx)(Q,{children:`:root`}),` of `,(0,h.jsx)(Q,{children:jO}),` that are not colors or lengths show here.`]})]})}function bM(e,...t){return e.tokens.filter(e=>t.includes(e.kind)).length}function xM(e){let t=[{to:`/system/colors`,icon:`palette`,title:`Colors`,text:_O(bM(e,`color`),`token`)},{to:`/system/typography`,icon:`type`,title:`Typography`,text:`${_O(bM(e,`font`),`family`,`families`)} · ${_O(bM(e,`text`),`size`)}`},{to:`/system/shape`,icon:`shape`,title:`Spacing & shape`,text:_O(bM(e,`spacing`,`radius`,`shadow`,`blur`,`breakpoint`),`token`)}],n=bM(e,`ease`,`duration`,`animation`);n&&t.push({to:`/system/motion`,icon:`motion`,title:`Motion`,text:_O(n,`token`)}),e.assets.length&&t.push({to:`/system/assets`,icon:`image`,title:`Assets`,text:_O(e.assets.length,`file`)});let r=e.components[0];return r&&t.push({to:`/system/components/${encodeURIComponent(r.id)}`,icon:`component`,title:`Components`,text:_O(e.components.length,`component`)}),t}function SM({system:e}){return(0,h.jsx)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:xM(e).map(e=>(0,h.jsxs)(Lf,{href:e.to,className:`flex items-center gap-3 rounded-[10px] border border-rule bg-surface px-4 py-3.5 text-inherit no-underline transition-colors hover:border-rule-strong hover:bg-soft`,children:[(0,h.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[8px] bg-soft2 text-ink2`,children:(0,h.jsx)(Z,{name:e.icon,size:17})}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,h.jsx)(`span`,{className:`text-[14px] font-medium text-ink`,children:e.title}),(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.text})]})]},e.to))})}function CM({system:e}){let[,t]=jf(),n=[{label:`Color tokens`,value:bM(e,`color`),to:`/system/colors`},{label:`Type tokens`,value:bM(e,`font`,`text`,`weight`,`leading`,`tracking`),to:`/system/typography`},{label:`Spacing & shape tokens`,value:bM(e,`spacing`,`radius`,`shadow`,`blur`,`breakpoint`),to:`/system/shape`},{label:`Motion tokens`,value:bM(e,`ease`,`duration`,`animation`),to:`/system/motion`},{label:`Other tokens`,value:bM(e,`other`),to:`/system/tokens`},{label:`Components`,value:e.components.length},{label:`Guidelines`,value:e.guidelines.length}];return(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`At a glance`}),n.filter(e=>e.value||!e.to||e.to===`/system/colors`).map(e=>(0,h.jsxs)(iw,{cols:`minmax(0,1fr) auto`,align:`lr`,minH:40,pad:`8px 16px`,onClick:e.to&&e.value?()=>t(e.to):void 0,children:[(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:e.label}),(0,h.jsx)(XC,{value:e.value})]},e.label)),e.fonts.length?(0,h.jsxs)(iw,{cols:`minmax(0,1fr) auto`,align:`lr`,minH:40,pad:`8px 16px`,children:[(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:`Web fonts`}),(0,h.jsx)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5`,children:e.fonts.map(e=>(0,h.jsx)(Q,{size:12,className:`max-w-[260px] truncate text-muted`,title:e,children:wM(e)},e))})]}):null]})}function wM(e){try{let t=new URL(e),n=t.searchParams.getAll(`family`).map(e=>e.split(`:`)[0].replace(/\+/g,` `));return n.length?n.join(`, `):t.host}catch{return e}}function TM({system:e}){let t=e.guidelines.find(e=>e.slug===`overview`);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:e.name,sub:e.description}),(0,h.jsx)(lw,{issues:e.issues,title:`Problems in the design system`}),(0,h.jsx)(SM,{system:e}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5 max-xl:grid-cols-1!`,style:{gridTemplateColumns:`minmax(0,1fr) 320px`},children:[t?(0,h.jsx)(ZC,{children:(0,h.jsx)(`div`,{className:`px-6 py-5`,children:(0,h.jsx)(AD,{text:t.markdown})})}):(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Overview`}),(0,h.jsxs)(`div`,{className:`border-t border-rule px-4 py-5 text-[13px] text-muted`,children:[`Write the principles every screen follows in `,(0,h.jsx)(Q,{children:`.design/system/guidelines/01-overview.md`}),`; it shows here.`]})]}),(0,h.jsx)(CM,{system:e})]})]})}var EM=[1,2,3,4,6,8,12,16],DM=480;function OM({px:e}){return e===null?(0,h.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`not a plain length`}):(0,h.jsxs)(`span`,{className:`flex h-3 items-center`,children:[(0,h.jsx)(`span`,{className:`h-3 rounded-[3px] bg-action/70`,style:{width:Math.max(2,Math.min(e,DM))},title:`${e}px`}),e>DM?(0,h.jsx)(`span`,{className:`ml-1.5 text-[12px] text-muted`,children:`…`}):null]})}function kM({tokens:e}){let t=e.find(e=>e.name===`--spacing`),n=e.filter(e=>e!==t),r=t?.light?TO(t.light.value):null,i=`minmax(150px,0.8fr) 110px minmax(0,2fr)`;return(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Spacing`,count:e.length,sub:t?`base ${t.light?.value}`:void 0}),(0,h.jsx)(nw,{cols:i,labels:[`Class or token`,`Value`,``]}),t&&r!==null?EM.map(e=>(0,h.jsxs)(iw,{cols:i,minH:36,pad:`6px 16px`,children:[(0,h.jsxs)(Q,{size:12.5,className:`text-ink`,children:[`p-`,e,` · gap-`,e]}),(0,h.jsxs)(Q,{size:12,className:`text-muted`,children:[r*e,`px`]}),(0,h.jsx)(OM,{px:r*e})]},e)):null,n.map(e=>(0,h.jsxs)(iw,{cols:i,minH:40,pad:`6px 16px`,title:`Copy the variable`,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),(0,h.jsx)(OM,{px:e.light?TO(e.light.value):null})]},e.name))]})}function AM({token:e,children:t}){return(0,h.jsxs)(`button`,{type:`button`,title:`Copy the variable`,onClick:()=>hC(`var(${e.name})`),className:`flex min-w-0 cursor-pointer flex-col items-stretch gap-2.5 rounded-[8px] border border-transparent bg-transparent p-2 text-left transition-colors hover:border-rule hover:bg-soft`,children:[t,(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-1`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(kO,{items:SO(e)}),(0,h.jsx)(MO,{children:e.light?.value}),e.description?(0,h.jsx)(`span`,{className:`text-[12.5px] text-ink2`,children:e.description}):null]})]})}function jM({title:e,tokens:t,min:n=170,children:r}){return(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:e,count:t.length}),(0,h.jsx)(`div`,{className:`grid gap-2 border-t border-rule p-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr))`},children:t.map(e=>(0,h.jsx)(AM,{token:e,children:r(e)},e.name))})]})}function MM({tokens:e}){let t=`minmax(170px,1fr) minmax(90px,0.6fr) 110px 90px`;return(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Breakpoints`,count:e.length}),(0,h.jsx)(nw,{cols:t,labels:[`Token`,`Variant`,`Value`,`Pixels`],align:`lllr`}),e.map(e=>{let n=e.light?TO(e.light.value):null;return(0,h.jsxs)(iw,{cols:t,align:`lllr`,minH:40,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(kO,{items:SO(e)}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:n===null?``:`${n}px`})]},e.name)})]})}function NM({system:e}){let t=r_(),n=CO(e.tokens,`spacing`),r=CO(e.tokens,`radius`),i=CO(e.tokens,`shadow`),a=CO(e.tokens,`blur`),o=CO(e.tokens,`breakpoint`),s=!n.length&&!r.length&&!i.length&&!a.length&&!o.length;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Spacing & shape`,sub:`Click a token to copy its variable.`}),s?(0,h.jsxs)(AO,{title:`No spacing or shape tokens`,children:[`Add `,(0,h.jsx)(Q,{children:`--spacing`}),` (the base step), `,(0,h.jsx)(Q,{children:`--spacing-*`}),`, `,(0,h.jsx)(Q,{children:`--radius-*`}),`,`,` `,(0,h.jsx)(Q,{children:`--shadow-*`}),` and `,(0,h.jsx)(Q,{children:`--breakpoint-*`}),` to the `,(0,h.jsx)(Q,{children:`@theme`}),` block in`,` `,(0,h.jsx)(Q,{children:jO}),`.`]}):null,n.length?(0,h.jsx)(kM,{tokens:n}):null,r.length?(0,h.jsx)(jM,{title:`Radii`,tokens:r,children:e=>(0,h.jsx)(`span`,{className:`flex h-[88px] items-center justify-center rounded-[6px] bg-soft`,children:(0,h.jsx)(`span`,{className:`size-14 border border-rule-strong bg-surface`,style:{borderRadius:e.light?.value}})})}):null,i.length?(0,h.jsx)(jM,{title:`Shadows`,tokens:i,min:200,children:e=>(0,h.jsx)(`span`,{className:`flex h-[112px] items-center justify-center rounded-[6px] bg-soft`,children:(0,h.jsx)(`span`,{className:`h-[60px] w-[108px] rounded-[8px] bg-surface`,style:{boxShadow:EO(e,t)}})})}):null,a.length?(0,h.jsx)(jM,{title:`Blur`,tokens:a,children:e=>(0,h.jsxs)(`span`,{className:`relative flex h-[88px] items-center justify-center overflow-hidden rounded-[6px] bg-soft`,children:[(0,h.jsx)(`span`,{className:`absolute left-5 top-4 size-10 rounded-full bg-action`}),(0,h.jsx)(`span`,{className:`absolute right-6 bottom-3 size-12 rounded-[6px] bg-ink2`}),(0,h.jsx)(`span`,{className:`absolute inset-x-6 inset-y-5 rounded-[6px] bg-surface/40`,style:{backdropFilter:`blur(${e.light?.value})`}})]})}):null,o.length?(0,h.jsx)(MM,{tokens:o}):null]})}var PM={font:`Family`,text:`Size`,weight:`Weight`,leading:`Line height`,tracking:`Letter spacing`};function FM(e){return e.kind===`text`?[e.light?.value,e.lineHeight].filter(Boolean).join(` / `):e.light?.value??``}function IM({system:e}){let[t,n]=DO(),r=CO(e.tokens,`font`,`text`,`weight`,`leading`,`tracking`);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bw,{title:`Typography`,sub:`Set in the design system's own stylesheet, with its fonts.`}),e.typographyUrl?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Specimen`,right:(0,h.jsx)(OO,{value:t,onChange:n})}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:(0,h.jsx)(zO,{src:e.typographyUrl,theme:t,title:`Typography specimen`,minHeight:200})})]}):null,r.length?(0,h.jsxs)(ZC,{children:[(0,h.jsx)(QC,{title:`Tokens`,count:r.length}),(0,h.jsx)(nw,{cols:`minmax(160px,1fr) 110px minmax(120px,0.8fr) minmax(0,1.4fr)`,labels:[`Token`,`Kind`,`Class`,`Value`]}),r.map(e=>(0,h.jsxs)(iw,{cols:`minmax(160px,1fr) 110px minmax(120px,0.8fr) minmax(0,1.4fr)`,minH:42,title:`Copy the variable`,onClick:()=>hC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:PM[e.kind]}),(0,h.jsx)(kO,{items:SO(e)}),(0,h.jsx)(MO,{children:FM(e)})]},e.name))]}):(0,h.jsxs)(AO,{title:`No type tokens`,children:[`Add font families (`,(0,h.jsx)(Q,{children:`--font-*`}),`), sizes (`,(0,h.jsx)(Q,{children:`--text-*`}),` with`,` `,(0,h.jsx)(Q,{children:`--text-*--line-height`}),`) and weights (`,(0,h.jsx)(Q,{children:`--font-weight-*`}),`) to the `,(0,h.jsx)(Q,{children:`@theme`}),` `,`block in `,(0,h.jsx)(Q,{children:jO}),`. Web fonts go in `,(0,h.jsx)(Q,{children:`system.json`}),` `,(0,h.jsx)(Q,{children:`fonts`}),`.`]})]})}function LM({system:e}){return(0,h.jsx)(`main`,{className:`mx-auto flex w-full max-w-[1440px] grow animate-[q-fade-in_160ms_ease-out] px-8 pt-6 pb-7 max-md:px-4 max-md:pt-4`,children:(0,h.jsxs)(`div`,{className:`grid w-full items-start gap-6 max-lg:grid-cols-1!`,style:{gridTemplateColumns:`232px minmax(0, 1fr)`},children:[(0,h.jsx)(`aside`,{className:`sticky top-[76px] flex max-h-[calc(100dvh-100px)] flex-col overflow-y-auto pb-4 max-lg:static max-lg:max-h-none max-lg:overflow-visible max-lg:pb-0`,children:(0,h.jsx)(_M,{system:e})}),(0,h.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:(0,h.jsxs)(zf,{children:[(0,h.jsx)(If,{path:`/system`,children:(0,h.jsx)(TM,{system:e})}),(0,h.jsx)(If,{path:`/system/colors`,children:(0,h.jsx)(RO,{system:e})}),(0,h.jsx)(If,{path:`/system/typography`,children:(0,h.jsx)(IM,{system:e})}),(0,h.jsx)(If,{path:`/system/shape`,children:(0,h.jsx)(NM,{system:e})}),(0,h.jsx)(If,{path:`/system/motion`,children:(0,h.jsx)(gM,{system:e})}),(0,h.jsx)(If,{path:`/system/tokens`,children:(0,h.jsx)(yM,{system:e})}),(0,h.jsx)(If,{path:`/system/assets`,children:(0,h.jsx)(PO,{system:e})}),(0,h.jsx)(If,{path:`/system/guidelines/:slug`,children:t=>(0,h.jsx)(cM,{system:e,slug:decodeURIComponent(t.slug)})}),(0,h.jsx)(If,{path:`/system/components/:id`,children:t=>(0,h.jsx)(oM,{system:e,id:decodeURIComponent(t.id)})}),(0,h.jsx)(If,{children:(0,h.jsx)(hT,{title:`No such page`,text:`This page is not part of the design system.`})})]})})]})})}function RM(){return(0,h.jsx)(ww,{title:`No design system yet`,text:(0,h.jsxs)(h.Fragment,{children:[`Ask your agent to build one from the codebase, or run `,(0,h.jsx)(Q,{children:`design system init`}),` to start from a template in `,(0,h.jsx)(Q,{children:`.design/system`}),`.`]})})}function zM(){let e=zg().data,t=e?e.system!==null:void 0,{data:n,error:r,isLoading:i}=Vg(t===!0);return t===!1||r instanceof Ng&&r.status===404?(0,h.jsx)(RM,{}):r?(0,h.jsx)(ww,{title:`Could not load the design system`,text:r.message}):i||!n?null:(0,h.jsx)(LM,{system:n})}function BM(){let e=zg().data?.name;return(0,m.useEffect)(()=>{e&&(document.title=`${e} · Design`)},[e]),null}function VM(){return(0,h.jsxs)(zf,{children:[(0,h.jsx)(If,{path:`/c/:canvas/play/:item`,children:e=>(0,h.jsx)(dO,{canvasId:e.canvas,itemId:e.item})}),(0,h.jsx)(If,{path:`/c/:canvas/p/:page`,children:e=>(0,h.jsx)(eO,{canvasId:e.canvas,pageId:e.page})}),(0,h.jsx)(If,{path:`/c/:canvas`,children:e=>(0,h.jsx)(eO,{canvasId:e.canvas})}),(0,h.jsxs)(If,{path:`/system/*?`,children:[(0,h.jsx)(RS,{}),(0,h.jsx)(zM,{})]}),(0,h.jsxs)(If,{path:`/`,children:[(0,h.jsx)(RS,{}),(0,h.jsx)(xO,{})]}),(0,h.jsxs)(If,{children:[(0,h.jsx)(RS,{}),(0,h.jsx)(hT,{})]})]})}function HM(){return(0,h.jsx)(hu,{reducedMotion:`user`,children:(0,h.jsxs)(fT,{children:[(0,h.jsx)(BM,{}),Mg?(0,h.jsxs)(Nf,{hook:Kf,hrefs:e=>`#${e}`,children:[(0,h.jsx)(VM,{}),(0,h.jsx)(u_,{})]}):(0,h.jsxs)(Nf,{children:[(0,h.jsx)(VM,{}),(0,h.jsx)(u_,{})]}),(0,h.jsx)(mC,{})]})})}Ug(),(0,Qd.createRoot)(document.getElementById(`root`)).render((0,h.jsx)(m.StrictMode,{children:(0,h.jsx)(v,{client:Lg,children:(0,h.jsx)(HM,{})})}));
155
+ `,t+2);return(i===-1?n.length:i)-t}function Fj(e){return{...e,jsx:!1,regex:!1,templateStrings:!1}}function Ij(){return{javascript:lA,typescript:Cj,css:Fj(dk),python:Fj($A),c:Fj(nk),go:Fj(jk),java:Fj(CA),rust:Fj(cj),json:Fj(EA),diff:Fj(wk),shell:Fj(dj),cpp:Fj(ak),csharp:Fj(ck),sql:Fj(pj),html:vA,vue:Ej,svelte:Tj,yaml:Fj(Dj),markdown:Fj(RA),plaintext:Fj(qA),ruby:Fj(rj),kotlin:Fj(OA),swift:Fj(vj),php:Fj(HA),toml:Fj(xj),powershell:Fj(YA),dockerfile:Fj(kk),graphql:Fj(Pk),hcl:Fj(Lk),zig:Fj(kj),lua:Fj(jA)}}var Lj=Ij();function Rj(e){return Lj[e||`javascript`]}function zj(e,t){let{lang:n,cx:r,mark:i,markLine:a}=t||{};return WO($O(e,Rj(n)),{cx:r,mark:i,markLine:a})}function Bj({code:e,path:t,className:n}){let r=e.replace(/\n$/,``),i=(0,m.useMemo)(()=>zj(r),[r]),a=r.split(`
156
+ `).length;return(0,h.jsxs)(`div`,{className:X(`flex min-w-0 flex-col`,n),children:[t?(0,h.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-3 border-b border-rule bg-soft pr-1.5 pl-4`,children:[(0,h.jsx)(Q,{size:12,className:`truncate text-muted`,title:t,children:t}),(0,h.jsx)(y_,{icon:`copy`,label:`Copy file`,size:15,onClick:()=>gC(e,`Copied the file`)})]}):null,(0,h.jsxs)(`div`,{className:`flex max-h-[640px] min-w-0 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,h.jsx)(`pre`,{"aria-hidden":`true`,className:`sticky left-0 m-0 shrink-0 select-none border-r border-rule bg-surface py-3 pr-3 pl-4 text-right text-muted`,children:Array.from({length:a},(e,t)=>t+1).join(`
157
+ `)}),(0,h.jsx)(`pre`,{className:`m-0 min-w-0 grow py-3 pr-6 pl-4 text-ink`,children:(0,h.jsx)(`code`,{dangerouslySetInnerHTML:{__html:i}})})]})]})}var Vj={beta:`action`,experimental:`action`,draft:`action`,deprecated:`danger`,stable:`ok`},Hj=`.design/system/components/`;function Uj(e){return e.startsWith(Hj)?`@system/components/${e.slice(26).replace(/\.(tsx|jsx|ts|js)$/,``).replace(/\/index$/,``)}`:null}function Wj(e){let t=new Set;for(let n of e.matchAll(/export\s+(?:async\s+)?(?:function|const|class|let)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);for(let n of e.matchAll(/export\s*\{([^}]+)\}/g))for(let e of n[1].split(`,`)){let n=e.trim().split(/\s+as\s+/).pop()?.trim();n&&n!=="default"&&t.add(n)}return[...t].filter(e=>/^[A-Z]/.test(e))}function Gj({path:e}){let t=Uj(e),n=Hg(t?e:null).data;if(!t)return null;let r=n?Wj(n):[],i=`import { ${r.length?r.join(`, `):`…`} } from '${t}'`;return(0,h.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-rule py-1.5 pr-1.5 pl-4`,children:[(0,h.jsx)(Q,{size:12.5,className:`min-w-0 truncate text-ink2`,title:i,children:i}),(0,h.jsx)(y_,{icon:`copy`,label:`Copy the import`,size:14,className:`ml-auto`,onClick:()=>gC(i)})]})}function Kj({component:e,theme:t,width:n}){return n===`fill`?(0,h.jsx)(OO,{src:e.url,theme:t,title:e.title,minHeight:160}):(0,h.jsx)(`div`,{className:`flex justify-center overflow-x-auto bg-soft p-6`,children:(0,h.jsx)(`div`,{className:`shrink-0 overflow-hidden rounded-[8px] border border-rule bg-surface shadow-frame`,children:(0,h.jsx)(OO,{src:e.url,theme:t,title:e.title,minHeight:160,width:Number(n)})})})}function qj({component:e}){let t=[...e.sources,e.specimen],[n,r]=(0,m.useState)(t[0]),i=t.includes(n)?n:t[0],{data:a,error:o,isLoading:s}=Hg(i);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[t.length>1?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-rule px-4 py-2.5`,children:(0,h.jsx)(nw,{label:`File`,size:`sm`,value:i,onChange:r,items:t.map(t=>({value:t,label:t===e.specimen?`${Jj(t)} · specimen`:Jj(t),title:t}))})}):null,Uj(i)?(0,h.jsx)(Gj,{path:i}):null,o?(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-6 text-[13px] text-danger-text`,children:[(0,h.jsx)(Z,{name:`alert`,size:15}),o.message]}):s||a===void 0?(0,h.jsx)(`div`,{className:`flex items-center justify-center py-10 text-muted`,children:(0,h.jsx)(Z,{name:`loader`,size:18})}):(0,h.jsx)(Bj,{code:a,path:i})]})}function Jj(e){return e.split(`/`).pop()??e}function Yj({system:e,id:t}){let n=e.components.find(e=>e.id===t),[r,i]=(0,m.useState)(`preview`),[a,o]=gO(),[s,c]=(0,m.useState)(`fill`);if(!n)return(0,h.jsx)($w,{title:`No such component`,text:`There is no specimen "${t}" in .design/system/specimens.`});let l=n.status?.toLowerCase();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:n.title,badge:(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(zC,{children:n.group}),l?(0,h.jsx)(zC,{tone:Vj[l]??`neutral`,children:n.status}):null]}),sub:n.description}),(0,h.jsxs)(VC,{children:[(0,h.jsx)(UC,{value:r,onChange:i,items:[{value:`preview`,label:`Preview`},{value:`code`,label:`Code`,count:n.sources.length+1}],right:r===`preview`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(nw,{label:`Width`,size:`sm`,value:s,onChange:c,items:[{value:`fill`,label:`Fill`},{value:`768`,label:`768`},{value:`390`,label:`390`}]}),(0,h.jsx)(_O,{value:a,onChange:o}),(0,h.jsx)(x_,{icon:`external`,href:TC(wC(n.url,a)),target:`_blank`,rel:`noreferrer`,children:`Open`})]}):null}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:r===`preview`?(0,h.jsx)(Kj,{component:n,theme:a,width:s}):(0,h.jsx)(qj,{component:n})})]})]})}function Xj(e,t){let n=/^\s*#\s+(.+)\r?\n/.exec(e);return n&&n[1].trim()===t?e.slice(n[0].length):e}function Zj({system:e,slug:t}){let n=e.guidelines.find(e=>e.slug===t);if(!n)return(0,h.jsx)($w,{title:`No such guideline`,text:`There is no guideline "${t}" in .design/system/guidelines.`});let r=Xj(n.markdown,n.title).trim();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:n.title,sub:`Guideline`}),(0,h.jsx)(VC,{children:(0,h.jsx)(`div`,{className:`px-6 py-5`,children:r?(0,h.jsx)(mD,{text:r,className:`max-w-[760px]`}):(0,h.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`This guideline is empty. Write it in `,(0,h.jsx)(Q,{children:`.design/system/guidelines`}),`.`]})})})]})}var Qj={linear:[0,0,1,1],ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]};function $j(e){let t=e.trim();if(Qj[t])return Qj[t];let n=/^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/.exec(t);if(!n)return null;let r=n.slice(1).map(Number);return r.every(Number.isFinite)?r:null}function eM(e){let t=/^(-?[\d.]+)(ms|s)$/.exec(e.trim());return t?Number(t[1])*(t[2]===`s`?1e3:1):null}var tM=132,nM=22;function rM({bezier:e}){let[t,n,r,i]=e,a=Math.min(0,n,i),o=Math.max(1,n,i),s=88/(o-a),c=e=>nM+e*88,l=e=>nM+(o-e)*s;return(0,h.jsxs)(`svg`,{width:tM,height:tM,viewBox:`0 0 ${tM} ${tM}`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,h.jsx)(`rect`,{x:c(0),y:l(1),width:88,height:l(0)-l(1),className:`fill-none stroke-rule`}),(0,h.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(t),y2:l(n),className:`stroke-rule-strong`,strokeDasharray:`3 3`}),(0,h.jsx)(`line`,{x1:c(1),y1:l(1),x2:c(r),y2:l(i),className:`stroke-rule-strong`,strokeDasharray:`3 3`}),(0,h.jsx)(`path`,{d:`M ${c(0)} ${l(0)} C ${c(t)} ${l(n)}, ${c(r)} ${l(i)}, ${c(1)} ${l(1)}`,className:`fill-none stroke-ink`,strokeWidth:2,strokeLinecap:`round`}),(0,h.jsx)(`circle`,{cx:c(t),cy:l(n),r:3,className:`fill-action`}),(0,h.jsx)(`circle`,{cx:c(r),cy:l(i),r:3,className:`fill-action`})]})}function iM({token:e,duration:t}){let[n,r]=(0,m.useState)(!1),i=e.light?.value??``,a=$j(i);return(0,h.jsxs)(`button`,{type:`button`,title:`Hover to play; click to copy the variable`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onClick:()=>gC(`var(${e.name})`),className:`flex min-w-0 cursor-pointer flex-col gap-3 rounded-[8px] border border-transparent bg-transparent p-3 text-left transition-colors hover:border-rule hover:bg-soft`,children:[(0,h.jsx)(`span`,{className:`flex h-[132px] items-center justify-center rounded-[6px] bg-soft`,children:a?(0,h.jsx)(rM,{bezier:a}):(0,h.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No curve to draw`})}),(0,h.jsx)(`span`,{className:`relative mx-1 h-2 rounded-full bg-soft2`,children:(0,h.jsx)(`span`,{className:`absolute top-1/2 size-3.5 -translate-y-1/2 rounded-full bg-ink`,style:{left:n?`calc(100% - 14px)`:`0px`,transition:`left ${t}ms ${i||`ease`}`}})}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-1`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(vO,{items:dO(e)}),(0,h.jsx)(xO,{children:i}),e.description?(0,h.jsx)(`span`,{className:`text-[12.5px] text-ink2`,children:e.description}):null]})]})}function aM({system:e}){let t=fO(e.tokens,`ease`),n=fO(e.tokens,`duration`),r=fO(e.tokens,`animation`),i=`minmax(170px,1fr) 100px minmax(0,2fr)`,a=`minmax(170px,1fr) minmax(140px,0.7fr) minmax(0,2fr)`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Motion`,sub:`Hover an easing to see it move.`}),!t.length&&!n.length&&!r.length?(0,h.jsxs)(yO,{title:`No motion tokens`,children:[`Add `,(0,h.jsx)(Q,{children:`--ease-*`}),` and `,(0,h.jsx)(Q,{children:`--animate-*`}),` to the `,(0,h.jsx)(Q,{children:`@theme`}),` block, and durations as`,` `,(0,h.jsx)(Q,{children:`--duration-*`}),`, in `,(0,h.jsx)(Q,{children:bO}),`.`]}):null,t.length?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Easing`,count:t.length}),(0,h.jsx)(`div`,{className:`grid gap-2 border-t border-rule p-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(190px, 1fr))`},children:t.map(e=>(0,h.jsx)(iM,{token:e,duration:900},e.name))})]}):null,n.length?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Durations`,count:n.length}),(0,h.jsx)(KC,{cols:i,labels:[`Token`,`Value`,``]}),n.map(e=>{let t=e.light?eM(e.light.value):null;return(0,h.jsxs)(JC,{cols:i,minH:40,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),t===null?(0,h.jsx)(`span`,{}):(0,h.jsx)(`span`,{className:`h-3 rounded-[3px] bg-action/70`,style:{width:Math.max(2,Math.min(t/2,480))}})]},e.name)})]}):null,r.length?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Animations`,count:r.length,sub:`keyframes live in the system stylesheet`}),(0,h.jsx)(KC,{cols:a,labels:[`Token`,`Class`,`Value`]}),r.map(e=>(0,h.jsxs)(JC,{cols:a,minH:40,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(vO,{items:dO(e)}),(0,h.jsx)(xO,{children:e.light?.value})]},e.name))]}):null]})}function oM({system:e}){let t=new Set(e.tokens.map(e=>e.kind)),n=[{to:`/system/colors`,label:`Colors`,hint:sM(e,`color`)},{to:`/system/typography`,label:`Typography`},{to:`/system/shape`,label:`Spacing & shape`}];(t.has(`ease`)||t.has(`duration`)||t.has(`animation`))&&n.push({to:`/system/motion`,label:`Motion`}),t.has(`other`)&&n.push({to:`/system/tokens`,label:`Other tokens`,hint:sM(e,`other`)}),e.assets.length&&n.push({to:`/system/assets`,label:`Assets`,hint:e.assets.length});let r=new Map;for(let t of e.components){let e=r.get(t.group)??[];e.push({to:`/system/components/${encodeURIComponent(t.id)}`,label:t.title,hint:t.status}),r.set(t.group,e)}let i=e.guidelines.filter(e=>e.slug!==`overview`);return(0,h.jsxs)(`div`,{className:`flex flex-col max-lg:gap-1 max-lg:[&_nav]:flex-row max-lg:[&_nav]:flex-wrap`,children:[(0,h.jsx)(aw,{label:`Overview`,items:[{to:`/system`,label:`Overview`}]}),(0,h.jsx)(ow,{children:`Foundations`}),(0,h.jsx)(aw,{label:`Foundations`,items:n}),i.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ow,{children:`Guidelines`}),(0,h.jsx)(aw,{label:`Guidelines`,items:i.map(e=>({to:`/system/guidelines/${encodeURIComponent(e.slug)}`,label:e.title}))})]}):null,[...r].map(([e,t])=>(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(ow,{children:e}),(0,h.jsx)(aw,{label:e,items:t})]},e))]})}function sM(e,t){return e.tokens.filter(e=>e.kind===t).length||void 0}function cM({system:e}){let t=fO(e.tokens,`other`),n=`minmax(170px,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.3fr)`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Other tokens`,sub:`Variables that are not colors, type, spacing, shape or motion.`}),t.length?pO(t).map(({group:e,tokens:t})=>(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:e,count:t.length}),(0,h.jsx)(KC,{cols:n,labels:[`Token`,`Light`,`Dark`,`Description`]}),t.map(e=>(0,h.jsxs)(JC,{cols:n,minH:40,title:`Copy the variable`,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(xO,{children:e.light?.value}),(0,h.jsx)(xO,{children:e.dark?.value??`—`}),(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.description})]},e.name))]},e)):(0,h.jsxs)(yO,{title:`No other tokens`,children:[`Variables in `,(0,h.jsx)(Q,{children:`:root`}),` of `,(0,h.jsx)(Q,{children:bO}),` that are not colors or lengths show here.`]})]})}function lM(e,...t){return e.tokens.filter(e=>t.includes(e.kind)).length}function uM(e){let t=[{to:`/system/colors`,icon:`palette`,title:`Colors`,text:oO(lM(e,`color`),`token`)},{to:`/system/typography`,icon:`type`,title:`Typography`,text:`${oO(lM(e,`font`),`family`,`families`)} · ${oO(lM(e,`text`),`size`)}`},{to:`/system/shape`,icon:`shape`,title:`Spacing & shape`,text:oO(lM(e,`spacing`,`radius`,`shadow`,`blur`,`breakpoint`),`token`)}],n=lM(e,`ease`,`duration`,`animation`);n&&t.push({to:`/system/motion`,icon:`motion`,title:`Motion`,text:oO(n,`token`)}),e.assets.length&&t.push({to:`/system/assets`,icon:`image`,title:`Assets`,text:oO(e.assets.length,`file`)});let r=e.components[0];return r&&t.push({to:`/system/components/${encodeURIComponent(r.id)}`,icon:`component`,title:`Components`,text:oO(e.components.length,`component`)}),t}function dM({system:e}){return(0,h.jsx)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:uM(e).map(e=>(0,h.jsxs)(Lf,{href:e.to,className:`flex items-center gap-3 rounded-[10px] border border-rule bg-surface px-4 py-3.5 text-inherit no-underline transition-colors hover:border-rule-strong hover:bg-soft`,children:[(0,h.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[8px] bg-soft2 text-ink2`,children:(0,h.jsx)(Z,{name:e.icon,size:17})}),(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,h.jsx)(`span`,{className:`text-[14px] font-medium text-ink`,children:e.title}),(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.text})]})]},e.to))})}function fM({system:e}){let[,t]=jf(),n=[{label:`Color tokens`,value:lM(e,`color`),to:`/system/colors`},{label:`Type tokens`,value:lM(e,`font`,`text`,`weight`,`leading`,`tracking`),to:`/system/typography`},{label:`Spacing & shape tokens`,value:lM(e,`spacing`,`radius`,`shadow`,`blur`,`breakpoint`),to:`/system/shape`},{label:`Motion tokens`,value:lM(e,`ease`,`duration`,`animation`),to:`/system/motion`},{label:`Other tokens`,value:lM(e,`other`),to:`/system/tokens`},{label:`Components`,value:e.components.length},{label:`Guidelines`,value:e.guidelines.length}];return(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`At a glance`}),n.filter(e=>e.value||!e.to||e.to===`/system/colors`).map(e=>(0,h.jsxs)(JC,{cols:`minmax(0,1fr) auto`,align:`lr`,minH:40,pad:`8px 16px`,onClick:e.to&&e.value?()=>t(e.to):void 0,children:[(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:e.label}),(0,h.jsx)(BC,{value:e.value})]},e.label)),e.fonts.length?(0,h.jsxs)(JC,{cols:`minmax(0,1fr) auto`,align:`lr`,minH:40,pad:`8px 16px`,children:[(0,h.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:`Web fonts`}),(0,h.jsx)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5`,children:e.fonts.map(e=>(0,h.jsx)(Q,{size:12,className:`max-w-[260px] truncate text-muted`,title:e,children:pM(e)},e))})]}):null]})}function pM(e){try{let t=new URL(e),n=t.searchParams.getAll(`family`).map(e=>e.split(`:`)[0].replace(/\+/g,` `));return n.length?n.join(`, `):t.host}catch{return e}}function mM({system:e}){let t=e.guidelines.find(e=>e.slug===`overview`);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:e.name,sub:e.description}),(0,h.jsx)($C,{issues:e.issues,title:`Problems in the design system`}),(0,h.jsx)(dM,{system:e}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5 max-xl:grid-cols-1!`,style:{gridTemplateColumns:`minmax(0,1fr) 320px`},children:[t?(0,h.jsx)(VC,{children:(0,h.jsx)(`div`,{className:`px-6 py-5`,children:(0,h.jsx)(mD,{text:t.markdown})})}):(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Overview`}),(0,h.jsxs)(`div`,{className:`border-t border-rule px-4 py-5 text-[13px] text-muted`,children:[`Write the principles every screen follows in `,(0,h.jsx)(Q,{children:`.design/system/guidelines/01-overview.md`}),`; it shows here.`]})]}),(0,h.jsx)(fM,{system:e})]})]})}var hM=[1,2,3,4,6,8,12,16],gM=480;function _M({px:e}){return e===null?(0,h.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`not a plain length`}):(0,h.jsxs)(`span`,{className:`flex h-3 items-center`,children:[(0,h.jsx)(`span`,{className:`h-3 rounded-[3px] bg-action/70`,style:{width:Math.max(2,Math.min(e,gM))},title:`${e}px`}),e>gM?(0,h.jsx)(`span`,{className:`ml-1.5 text-[12px] text-muted`,children:`…`}):null]})}function vM({tokens:e}){let t=e.find(e=>e.name===`--spacing`),n=e.filter(e=>e!==t),r=t?.light?mO(t.light.value):null,i=`minmax(150px,0.8fr) 110px minmax(0,2fr)`;return(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Spacing`,count:e.length,sub:t?`base ${t.light?.value}`:void 0}),(0,h.jsx)(KC,{cols:i,labels:[`Class or token`,`Value`,``]}),t&&r!==null?hM.map(e=>(0,h.jsxs)(JC,{cols:i,minH:36,pad:`6px 16px`,children:[(0,h.jsxs)(Q,{size:12.5,className:`text-ink`,children:[`p-`,e,` · gap-`,e]}),(0,h.jsxs)(Q,{size:12,className:`text-muted`,children:[r*e,`px`]}),(0,h.jsx)(_M,{px:r*e})]},e)):null,n.map(e=>(0,h.jsxs)(JC,{cols:i,minH:40,pad:`6px 16px`,title:`Copy the variable`,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),(0,h.jsx)(_M,{px:e.light?mO(e.light.value):null})]},e.name))]})}function yM({token:e,children:t}){return(0,h.jsxs)(`button`,{type:`button`,title:`Copy the variable`,onClick:()=>gC(`var(${e.name})`),className:`flex min-w-0 cursor-pointer flex-col items-stretch gap-2.5 rounded-[8px] border border-transparent bg-transparent p-2 text-left transition-colors hover:border-rule hover:bg-soft`,children:[t,(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 px-1`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(vO,{items:dO(e)}),(0,h.jsx)(xO,{children:e.light?.value}),e.description?(0,h.jsx)(`span`,{className:`text-[12.5px] text-ink2`,children:e.description}):null]})]})}function bM({title:e,tokens:t,min:n=170,children:r}){return(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:e,count:t.length}),(0,h.jsx)(`div`,{className:`grid gap-2 border-t border-rule p-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr))`},children:t.map(e=>(0,h.jsx)(yM,{token:e,children:r(e)},e.name))})]})}function xM({tokens:e}){let t=`minmax(170px,1fr) minmax(90px,0.6fr) 110px 90px`;return(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Breakpoints`,count:e.length}),(0,h.jsx)(KC,{cols:t,labels:[`Token`,`Variant`,`Value`,`Pixels`],align:`lllr`}),e.map(e=>{let n=e.light?mO(e.light.value):null;return(0,h.jsxs)(JC,{cols:t,align:`lllr`,minH:40,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),(0,h.jsx)(vO,{items:dO(e)}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:e.light?.value}),(0,h.jsx)(Q,{size:12,className:`text-muted`,children:n===null?``:`${n}px`})]},e.name)})]})}function SM({system:e}){let t=r_(),n=fO(e.tokens,`spacing`),r=fO(e.tokens,`radius`),i=fO(e.tokens,`shadow`),a=fO(e.tokens,`blur`),o=fO(e.tokens,`breakpoint`),s=!n.length&&!r.length&&!i.length&&!a.length&&!o.length;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Spacing & shape`,sub:`Click a token to copy its variable.`}),s?(0,h.jsxs)(yO,{title:`No spacing or shape tokens`,children:[`Add `,(0,h.jsx)(Q,{children:`--spacing`}),` (the base step), `,(0,h.jsx)(Q,{children:`--spacing-*`}),`, `,(0,h.jsx)(Q,{children:`--radius-*`}),`,`,` `,(0,h.jsx)(Q,{children:`--shadow-*`}),` and `,(0,h.jsx)(Q,{children:`--breakpoint-*`}),` to the `,(0,h.jsx)(Q,{children:`@theme`}),` block in`,` `,(0,h.jsx)(Q,{children:bO}),`.`]}):null,n.length?(0,h.jsx)(vM,{tokens:n}):null,r.length?(0,h.jsx)(bM,{title:`Radii`,tokens:r,children:e=>(0,h.jsx)(`span`,{className:`flex h-[88px] items-center justify-center rounded-[6px] bg-soft`,children:(0,h.jsx)(`span`,{className:`size-14 border border-rule-strong bg-surface`,style:{borderRadius:e.light?.value}})})}):null,i.length?(0,h.jsx)(bM,{title:`Shadows`,tokens:i,min:200,children:e=>(0,h.jsx)(`span`,{className:`flex h-[112px] items-center justify-center rounded-[6px] bg-soft`,children:(0,h.jsx)(`span`,{className:`h-[60px] w-[108px] rounded-[8px] bg-surface`,style:{boxShadow:hO(e,t)}})})}):null,a.length?(0,h.jsx)(bM,{title:`Blur`,tokens:a,children:e=>(0,h.jsxs)(`span`,{className:`relative flex h-[88px] items-center justify-center overflow-hidden rounded-[6px] bg-soft`,children:[(0,h.jsx)(`span`,{className:`absolute left-5 top-4 size-10 rounded-full bg-action`}),(0,h.jsx)(`span`,{className:`absolute right-6 bottom-3 size-12 rounded-[6px] bg-ink2`}),(0,h.jsx)(`span`,{className:`absolute inset-x-6 inset-y-5 rounded-[6px] bg-surface/40`,style:{backdropFilter:`blur(${e.light?.value})`}})]})}):null,o.length?(0,h.jsx)(xM,{tokens:o}):null]})}var CM={font:`Family`,text:`Size`,weight:`Weight`,leading:`Line height`,tracking:`Letter spacing`};function wM(e){return e.kind===`text`?[e.light?.value,e.lineHeight].filter(Boolean).join(` / `):e.light?.value??``}function TM({system:e}){let[t,n]=gO(),r=fO(e.tokens,`font`,`text`,`weight`,`leading`,`tracking`);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(iw,{title:`Typography`,sub:`Set in the design system's own stylesheet, with its fonts.`}),e.typographyUrl?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Specimen`,right:(0,h.jsx)(_O,{value:t,onChange:n})}),(0,h.jsx)(`div`,{className:`border-t border-rule`,children:(0,h.jsx)(OO,{src:e.typographyUrl,theme:t,title:`Typography specimen`,minHeight:200})})]}):null,r.length?(0,h.jsxs)(VC,{children:[(0,h.jsx)(HC,{title:`Tokens`,count:r.length}),(0,h.jsx)(KC,{cols:`minmax(160px,1fr) 110px minmax(120px,0.8fr) minmax(0,1.4fr)`,labels:[`Token`,`Kind`,`Class`,`Value`]}),r.map(e=>(0,h.jsxs)(JC,{cols:`minmax(160px,1fr) 110px minmax(120px,0.8fr) minmax(0,1.4fr)`,minH:42,title:`Copy the variable`,onClick:()=>gC(`var(${e.name})`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,h.jsx)(Q,{size:12.5,className:`truncate text-ink`,children:e.name}),e.description?(0,h.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.description}):null]}),(0,h.jsx)(`span`,{className:`text-[13px] text-ink2`,children:CM[e.kind]}),(0,h.jsx)(vO,{items:dO(e)}),(0,h.jsx)(xO,{children:wM(e)})]},e.name))]}):(0,h.jsxs)(yO,{title:`No type tokens`,children:[`Add font families (`,(0,h.jsx)(Q,{children:`--font-*`}),`), sizes (`,(0,h.jsx)(Q,{children:`--text-*`}),` with`,` `,(0,h.jsx)(Q,{children:`--text-*--line-height`}),`) and weights (`,(0,h.jsx)(Q,{children:`--font-weight-*`}),`) to the `,(0,h.jsx)(Q,{children:`@theme`}),` `,`block in `,(0,h.jsx)(Q,{children:bO}),`. Web fonts go in `,(0,h.jsx)(Q,{children:`system.json`}),` `,(0,h.jsx)(Q,{children:`fonts`}),`.`]})]})}function EM({system:e}){return(0,h.jsx)(`main`,{className:`mx-auto flex w-full max-w-[1440px] grow animate-[q-fade-in_160ms_ease-out] px-8 max-md:px-4`,children:(0,h.jsxs)(`div`,{className:`grid w-full items-start gap-6 max-lg:grid-cols-1! max-lg:gap-0`,style:{gridTemplateColumns:`232px minmax(0, 1fr)`},children:[(0,h.jsx)(`aside`,{className:`sticky top-[52px] flex max-h-[calc(100dvh-52px)] flex-col overflow-y-auto pt-6 pb-4 max-lg:static max-lg:max-h-none max-lg:overflow-visible max-lg:pb-0 max-md:pt-4`,children:(0,h.jsx)(oM,{system:e})}),(0,h.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pt-6 pb-7`,children:(0,h.jsxs)(zf,{children:[(0,h.jsx)(If,{path:`/system`,children:(0,h.jsx)(mM,{system:e})}),(0,h.jsx)(If,{path:`/system/colors`,children:(0,h.jsx)(DO,{system:e})}),(0,h.jsx)(If,{path:`/system/typography`,children:(0,h.jsx)(TM,{system:e})}),(0,h.jsx)(If,{path:`/system/shape`,children:(0,h.jsx)(SM,{system:e})}),(0,h.jsx)(If,{path:`/system/motion`,children:(0,h.jsx)(aM,{system:e})}),(0,h.jsx)(If,{path:`/system/tokens`,children:(0,h.jsx)(cM,{system:e})}),(0,h.jsx)(If,{path:`/system/assets`,children:(0,h.jsx)(CO,{system:e})}),(0,h.jsx)(If,{path:`/system/guidelines/:slug`,children:t=>(0,h.jsx)(Zj,{system:e,slug:decodeURIComponent(t.slug)})}),(0,h.jsx)(If,{path:`/system/components/:id`,children:t=>(0,h.jsx)(Yj,{system:e,id:decodeURIComponent(t.id)})}),(0,h.jsx)(If,{children:(0,h.jsx)($w,{title:`No such page`,text:`This page is not part of the design system.`})})]})})]})})}function DM(){return(0,h.jsx)(cw,{title:`No design system yet`,text:(0,h.jsxs)(h.Fragment,{children:[`Ask your agent to build one from the codebase, or run `,(0,h.jsx)(Q,{children:`design system init`}),` to start from a template in `,(0,h.jsx)(Q,{children:`.design/system`}),`.`]})})}function OM(){let e=zg().data,t=e?e.system!==null:void 0,{data:n,error:r,isLoading:i}=Vg(t===!0);return t===!1||r instanceof Ng&&r.status===404?(0,h.jsx)(DM,{}):r?(0,h.jsx)(cw,{title:`Could not load the design system`,text:r.message}):i||!n?null:(0,h.jsx)(EM,{system:n})}function kM(){let e=zg().data?.name;return(0,m.useEffect)(()=>{e&&(document.title=`${e} · Design`)},[e]),null}function AM(){return(0,h.jsxs)(zf,{children:[(0,h.jsx)(If,{path:`/c/:canvas/play/:item`,children:e=>(0,h.jsx)(eO,{canvasId:e.canvas,itemId:e.item})}),(0,h.jsx)(If,{path:`/c/:canvas/p/:page`,children:e=>(0,h.jsx)(UD,{canvasId:e.canvas,pageId:e.page})}),(0,h.jsx)(If,{path:`/c/:canvas`,children:e=>(0,h.jsx)(UD,{canvasId:e.canvas})}),(0,h.jsxs)(If,{path:`/system/*?`,children:[(0,h.jsx)(zS,{}),(0,h.jsx)(OM,{})]}),(0,h.jsxs)(If,{path:`/`,children:[(0,h.jsx)(zS,{}),(0,h.jsx)(uO,{})]}),(0,h.jsxs)(If,{children:[(0,h.jsx)(zS,{}),(0,h.jsx)($w,{})]})]})}function jM(){return(0,h.jsx)(hu,{reducedMotion:`user`,children:(0,h.jsxs)(Xw,{children:[(0,h.jsx)(kM,{}),Mg?(0,h.jsxs)(Nf,{hook:Kf,hrefs:e=>`#${e}`,children:[(0,h.jsx)(AM,{}),(0,h.jsx)(u_,{})]}):(0,h.jsxs)(Nf,{children:[(0,h.jsx)(AM,{}),(0,h.jsx)(u_,{})]}),(0,h.jsx)(hC,{})]})})}Ug(),(0,Qd.createRoot)(document.getElementById(`root`)).render((0,h.jsx)(m.StrictMode,{children:(0,h.jsx)(v,{client:Lg,children:(0,h.jsx)(jM,{})})}));