@inkeep/open-knowledge 0.4.0-beta.25 → 0.4.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
  2. package/dist/cli.mjs +37 -37
  3. package/dist/constants-CSmwRAFo.mjs +2 -0
  4. package/dist/{dist-DVNDjpnz.mjs → dist-BaIGvDgD.mjs} +1 -1
  5. package/dist/{dist-JNaknvi7.mjs → dist-C4qQGc8i.mjs} +8 -8
  6. package/dist/{dist-Cl_t5NRm.mjs → dist-DoBoUPet.mjs} +17 -16
  7. package/dist/index.mjs +1 -1
  8. package/dist/init-Cys0YykC.mjs +1 -0
  9. package/dist/{init-uWmRmgCA.mjs → init-Djz7BdtL.mjs} +5 -5
  10. package/dist/{loader-hjhxvSRP.mjs → loader-B64r69-j.mjs} +3 -3
  11. package/dist/loader-DfRJHcOw.mjs +1 -0
  12. package/dist/preview-Chj-AjEC.mjs +1 -0
  13. package/dist/{preview-vq_EvsiP.mjs → preview-nt7uUE2i.mjs} +2 -2
  14. package/dist/public/assets/{ActivityModeContent-C-OqZ3Ro.js → ActivityModeContent-EGGl80pX.js} +1 -1
  15. package/dist/public/assets/{DocumentContext-Ccj8qLzP.js → DocumentContext-Bic6EUm_.js} +1 -1
  16. package/dist/public/assets/{GraphPanel-BKsp7Crh.js → GraphPanel-B42N4CIV.js} +1 -1
  17. package/dist/public/assets/{OutlinePanel-DP5j1Wq1.js → OutlinePanel-CJ2DJN7r.js} +1 -1
  18. package/dist/public/assets/{SettingsDialog-C9FPnh00.js → SettingsDialog-D53RhrjD.js} +2 -2
  19. package/dist/public/assets/{SourceEditor-mNodigv_.js → SourceEditor-CMwexck1.js} +1 -1
  20. package/dist/public/assets/config-validation-events-Bosr96x4.js +10 -0
  21. package/dist/public/assets/{doc-hash-C9Z2AnUu.js → doc-hash-Bg2WkAY_.js} +128 -127
  22. package/dist/public/assets/{index-BDj01myg.js → index-10HZouza.js} +76 -76
  23. package/dist/public/assets/index-EvzmrHLW.css +1 -0
  24. package/dist/public/assets/{target-navigation-intent-FPPCIJIk.js → target-navigation-intent-zW_9xoDt.js} +1 -1
  25. package/dist/public/assets/{toggle-group-CP96D5oH.js → toggle-group-BMp2XgSC.js} +1 -1
  26. package/dist/public/assets/{tooltip-qQkwljHf.js → tooltip-CYfWgpPY.js} +1 -1
  27. package/dist/public/index.html +23 -16
  28. package/dist/{src-jO7GzWRA.mjs → src-DVGh66ju.mjs} +2 -2
  29. package/dist/start-CjvYIfQD.mjs +1 -0
  30. package/dist/{start-BnicFP1K.mjs → start-D6Gr8R62.mjs} +2 -2
  31. package/package.json +1 -1
  32. package/dist/constants-Dlyng5m6.mjs +0 -2
  33. package/dist/init-BKrp4NZQ.mjs +0 -1
  34. package/dist/loader-DqxqwNEe.mjs +0 -1
  35. package/dist/preview-CpmoA4SU.mjs +0 -1
  36. package/dist/public/assets/config-validation-events-BJEehccy.js +0 -10
  37. package/dist/public/assets/index-BzPHdvNz.css +0 -1
  38. package/dist/start-CNyWXmFb.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{I as i,L as a}from"./doc-hash-C9Z2AnUu.js";import{S as o,c as s,f as c,h as l,m as u,r as d,s as f,u as p,x as m}from"./button-C1nwPVFQ.js";var h=e(t(),1),g=n(),_=`rovingFocusGroup.onEntryFocus`,v={bubbles:!1,cancelable:!0},y=`RovingFocusGroup`,[b,x,S]=a(y),[C,w]=u(y,[S]),[T,E]=C(y),D=h.forwardRef((e,t)=>(0,g.jsx)(b.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,g.jsx)(b.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,g.jsx)(O,{...e,ref:t})})}));D.displayName=y;var O=h.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:b,preventScrollOnEntryFocus:S=!1,...C}=e,w=h.useRef(null),E=m(t,w),D=i(o),[O,k]=p({prop:s,defaultProp:u??null,onChange:d,caller:y}),[A,j]=h.useState(!1),M=f(b),N=x(n),F=h.useRef(!1),[I,L]=h.useState(0);return h.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(_,M),()=>e.removeEventListener(_,M)},[M]),(0,g.jsx)(T,{scope:n,orientation:r,dir:D,loop:a,currentTabStopId:O,onItemFocus:h.useCallback(e=>k(e),[k]),onItemShiftTab:h.useCallback(()=>j(!0),[]),onFocusableItemAdd:h.useCallback(()=>L(e=>e+1),[]),onFocusableItemRemove:h.useCallback(()=>L(e=>e-1),[]),children:(0,g.jsx)(l.div,{tabIndex:A||I===0?-1:0,"data-orientation":r,...C,ref:E,style:{outline:`none`,...e.style},onMouseDown:c(e.onMouseDown,()=>{F.current=!0}),onFocus:c(e.onFocus,e=>{let t=!F.current;if(e.target===e.currentTarget&&t&&!A){let t=new CustomEvent(_,v);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=N().filter(e=>e.focusable);P([e.find(e=>e.active),e.find(e=>e.id===O),...e].filter(Boolean).map(e=>e.ref.current),S)}}F.current=!1}),onBlur:c(e.onBlur,()=>j(!1))})})}),k=`RovingFocusGroupItem`,A=h.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...u}=e,d=s(),f=a||d,p=E(k,n),m=p.currentTabStopId===f,_=x(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:S}=p;return h.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),(0,g.jsx)(b.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:(0,g.jsx)(l.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...u,ref:t,onMouseDown:c(e.onMouseDown,e=>{r?p.onItemFocus(f):e.preventDefault()}),onFocus:c(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:c(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=N(e,p.orientation,p.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().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=p.loop?F(n,r+1):n.slice(r+1)}setTimeout(()=>P(n))}}),children:typeof o==`function`?o({isCurrentTabStop:m,hasTabStop:S!=null}):o})})});A.displayName=k;var j={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function M(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function N(e,t,n){let r=M(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return j[r]}function P(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function F(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var I=D,L=A,R=`Toggle`,z=h.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=p({prop:n,onChange:i,defaultProp:r??!1,caller:R});return(0,g.jsx)(l.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:c(e.onClick,()=>{e.disabled||s(!o)})})});z.displayName=R;var B=`ToggleGroup`,[V,ee]=u(B,[w]),H=w(),U=h.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,g.jsx)(K,{...r,ref:t});if(n===`multiple`)return(0,g.jsx)(q,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${B}\``)});U.displayName=B;var[W,G]=V(B),K=h.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=p({prop:n,defaultProp:r??``,onChange:i,caller:B});return(0,g.jsx)(W,{scope:e.__scopeToggleGroup,type:`single`,value:h.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:h.useCallback(()=>s(``),[s]),children:(0,g.jsx)(J,{...a,ref:t})})}),q=h.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=p({prop:n,defaultProp:r??[],onChange:i,caller:B}),c=h.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=h.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,g.jsx)(W,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,g.jsx)(J,{...a,ref:t})})});U.displayName=B;var[te,ne]=V(B),J=h.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...u}=e,d=H(n),f=i(s),p={role:`group`,dir:f,...u};return(0,g.jsx)(te,{scope:n,rovingFocus:a,disabled:r,children:a?(0,g.jsx)(I,{asChild:!0,...d,orientation:o,dir:f,loop:c,children:(0,g.jsx)(l.div,{...p,ref:t})}):(0,g.jsx)(l.div,{...p,ref:t})})}),Y=`ToggleGroupItem`,X=h.forwardRef((e,t)=>{let n=G(Y,e.__scopeToggleGroup),r=ne(Y,e.__scopeToggleGroup),i=H(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=h.useRef(null);return r.rovingFocus?(0,g.jsx)(L,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,g.jsx)(Z,{...s,ref:t})}):(0,g.jsx)(Z,{...s,ref:t})});X.displayName=Y;var Z=h.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=G(Y,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,g.jsx)(z,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),re=U,ie=X,Q=r(),ae=o(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),$=h.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function oe(e){let t=(0,Q.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,f;t[8]===l?f=t[9]:(f={"--gap":l},t[8]=l,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=d(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(h={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=h):h=t[16];let _;t[17]!==n||t[18]!==h?(_=(0,g.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==p||t[25]!==m||t[26]!==_||t[27]!==c?(v=(0,g.jsx)(re,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:p,className:m,...i,children:_}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=p,t[25]=m,t[26]=_,t[27]=c,t[28]=v):v=t[28],v}function se(e){let t=(0,Q.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=h.use($),u=l.variant||s,f=l.size||c,p=l.spacing,m;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(m=d(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,ae({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=m):m=t[11];let _;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==f||t[17]!==m?(_=(0,g.jsx)(ie,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=f,t[17]=m,t[18]=_):_=t[18],_}export{w as a,I as i,se as n,L as r,oe as t};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{I as i,L as a}from"./doc-hash-Bg2WkAY_.js";import{S as o,c as s,f as c,h as l,m as u,r as d,s as f,u as p,x as m}from"./button-C1nwPVFQ.js";var h=e(t(),1),g=n(),_=`rovingFocusGroup.onEntryFocus`,v={bubbles:!1,cancelable:!0},y=`RovingFocusGroup`,[b,x,S]=a(y),[C,w]=u(y,[S]),[T,E]=C(y),D=h.forwardRef((e,t)=>(0,g.jsx)(b.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,g.jsx)(b.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,g.jsx)(O,{...e,ref:t})})}));D.displayName=y;var O=h.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:b,preventScrollOnEntryFocus:S=!1,...C}=e,w=h.useRef(null),E=m(t,w),D=i(o),[O,k]=p({prop:s,defaultProp:u??null,onChange:d,caller:y}),[A,j]=h.useState(!1),M=f(b),N=x(n),F=h.useRef(!1),[I,L]=h.useState(0);return h.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(_,M),()=>e.removeEventListener(_,M)},[M]),(0,g.jsx)(T,{scope:n,orientation:r,dir:D,loop:a,currentTabStopId:O,onItemFocus:h.useCallback(e=>k(e),[k]),onItemShiftTab:h.useCallback(()=>j(!0),[]),onFocusableItemAdd:h.useCallback(()=>L(e=>e+1),[]),onFocusableItemRemove:h.useCallback(()=>L(e=>e-1),[]),children:(0,g.jsx)(l.div,{tabIndex:A||I===0?-1:0,"data-orientation":r,...C,ref:E,style:{outline:`none`,...e.style},onMouseDown:c(e.onMouseDown,()=>{F.current=!0}),onFocus:c(e.onFocus,e=>{let t=!F.current;if(e.target===e.currentTarget&&t&&!A){let t=new CustomEvent(_,v);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=N().filter(e=>e.focusable);P([e.find(e=>e.active),e.find(e=>e.id===O),...e].filter(Boolean).map(e=>e.ref.current),S)}}F.current=!1}),onBlur:c(e.onBlur,()=>j(!1))})})}),k=`RovingFocusGroupItem`,A=h.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...u}=e,d=s(),f=a||d,p=E(k,n),m=p.currentTabStopId===f,_=x(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:S}=p;return h.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),(0,g.jsx)(b.ItemSlot,{scope:n,id:f,focusable:r,active:i,children:(0,g.jsx)(l.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...u,ref:t,onMouseDown:c(e.onMouseDown,e=>{r?p.onItemFocus(f):e.preventDefault()}),onFocus:c(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:c(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=N(e,p.orientation,p.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().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=p.loop?F(n,r+1):n.slice(r+1)}setTimeout(()=>P(n))}}),children:typeof o==`function`?o({isCurrentTabStop:m,hasTabStop:S!=null}):o})})});A.displayName=k;var j={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function M(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function N(e,t,n){let r=M(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return j[r]}function P(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function F(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var I=D,L=A,R=`Toggle`,z=h.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=p({prop:n,onChange:i,defaultProp:r??!1,caller:R});return(0,g.jsx)(l.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:c(e.onClick,()=>{e.disabled||s(!o)})})});z.displayName=R;var B=`ToggleGroup`,[V,ee]=u(B,[w]),H=w(),U=h.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,g.jsx)(K,{...r,ref:t});if(n===`multiple`)return(0,g.jsx)(q,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${B}\``)});U.displayName=B;var[W,G]=V(B),K=h.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=p({prop:n,defaultProp:r??``,onChange:i,caller:B});return(0,g.jsx)(W,{scope:e.__scopeToggleGroup,type:`single`,value:h.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:h.useCallback(()=>s(``),[s]),children:(0,g.jsx)(J,{...a,ref:t})})}),q=h.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=p({prop:n,defaultProp:r??[],onChange:i,caller:B}),c=h.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=h.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,g.jsx)(W,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,g.jsx)(J,{...a,ref:t})})});U.displayName=B;var[te,ne]=V(B),J=h.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...u}=e,d=H(n),f=i(s),p={role:`group`,dir:f,...u};return(0,g.jsx)(te,{scope:n,rovingFocus:a,disabled:r,children:a?(0,g.jsx)(I,{asChild:!0,...d,orientation:o,dir:f,loop:c,children:(0,g.jsx)(l.div,{...p,ref:t})}):(0,g.jsx)(l.div,{...p,ref:t})})}),Y=`ToggleGroupItem`,X=h.forwardRef((e,t)=>{let n=G(Y,e.__scopeToggleGroup),r=ne(Y,e.__scopeToggleGroup),i=H(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=h.useRef(null);return r.rovingFocus?(0,g.jsx)(L,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,g.jsx)(Z,{...s,ref:t})}):(0,g.jsx)(Z,{...s,ref:t})});X.displayName=Y;var Z=h.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=G(Y,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,g.jsx)(z,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),re=U,ie=X,Q=r(),ae=o(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),$=h.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function oe(e){let t=(0,Q.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,f;t[8]===l?f=t[9]:(f={"--gap":l},t[8]=l,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=d(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(h={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=h):h=t[16];let _;t[17]!==n||t[18]!==h?(_=(0,g.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==p||t[25]!==m||t[26]!==_||t[27]!==c?(v=(0,g.jsx)(re,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:p,className:m,...i,children:_}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=p,t[25]=m,t[26]=_,t[27]=c,t[28]=v):v=t[28],v}function se(e){let t=(0,Q.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=h.use($),u=l.variant||s,f=l.size||c,p=l.spacing,m;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(m=d(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,ae({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=m):m=t[11];let _;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==f||t[17]!==m?(_=(0,g.jsx)(ie,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=f,t[17]=m,t[18]=_):_=t[18],_}export{w as a,I as i,se as n,L as r,oe as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{C as i,R as a,S as o,T as s,w as c,x as l}from"./doc-hash-C9Z2AnUu.js";import{a as u,c as d,f,h as p,l as m,m as h,o as g,r as _,u as ee,x as v,y}from"./button-C1nwPVFQ.js";var b=e(t(),1),x=n(),[S,te]=h(`Tooltip`,[s]),C=s(),w=`TooltipProvider`,T=700,E=`tooltip.open`,[D,O]=S(w),k=e=>{let{__scopeTooltip:t,delayDuration:n=T,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,x.jsx)(D,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};k.displayName=w;var A=`Tooltip`,[j,M]=S(A),N=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=O(A,e.__scopeTooltip),u=C(t),[f,p]=b.useState(null),m=d(),h=b.useRef(0),g=o??l.disableHoverableContent,_=s??l.delayDuration,v=b.useRef(!1),[y,S]=ee({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(E))):l.onClose(),a?.(e)},caller:A}),te=b.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),w=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),D=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return b.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,x.jsx)(c,{...u,children:(0,x.jsx)(j,{scope:t,contentId:m,open:y,stateAttribute:te,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?D():w()},[l.isOpenDelayedRef,D,w]),onTriggerLeave:b.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};N.displayName=A;var P=`TooltipTrigger`,F=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=M(P,n),a=O(P,n),o=C(n),s=v(t,b.useRef(null),i.onTriggerChange),c=b.useRef(!1),u=b.useRef(!1),d=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,x.jsx)(l,{asChild:!0,...o,children:(0,x.jsx)(p.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:f(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:f(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:f(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:f(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:f(e.onBlur,i.onClose),onClick:f(e.onClick,i.onClose)})})});F.displayName=P;var I=`TooltipPortal`,[L,R]=S(I,{forceMount:void 0}),z=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(I,t);return(0,x.jsx)(L,{scope:t,forceMount:n,children:(0,x.jsx)(m,{present:n||a.open,children:(0,x.jsx)(u,{asChild:!0,container:i,children:r})})})};z.displayName=I;var B=`TooltipContent`,V=b.forwardRef((e,t)=>{let n=R(B,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(B,e.__scopeTooltip);return(0,x.jsx)(m,{present:r||o.open,children:o.disableHoverableContent?(0,x.jsx)(K,{side:i,...a,ref:t}):(0,x.jsx)(H,{side:i,...a,ref:t})})}),H=b.forwardRef((e,t)=>{let n=M(B,e.__scopeTooltip),r=O(B,e.__scopeTooltip),i=b.useRef(null),a=v(t,i),[o,s]=b.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{s(null),d(!1)},[d]),p=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=X(r,Y(r,n.getBoundingClientRect())),a=Z(t.getBoundingClientRect());s(re([...i,...a])),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ne(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,x.jsx)(K,{...e,ref:a})}),[U,W]=S(A,{isInside:!1}),G=y(`TooltipContent`),K=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=e,u=M(B,n),d=C(n),{onClose:f}=u;return b.useEffect(()=>(document.addEventListener(E,f),()=>document.removeEventListener(E,f)),[f]),b.useEffect(()=>{if(u.trigger){let e=e=>{e.target?.contains(u.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]),(0,x.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,x.jsxs)(i,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.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,x.jsx)(G,{children:r}),(0,x.jsx)(U,{scope:n,isInside:!0,children:(0,x.jsx)(a,{id:u.contentId,role:`tooltip`,children:o||r})})]})})});V.displayName=B;var q=`TooltipArrow`,J=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=C(n);return W(q,n).isInside?null:(0,x.jsx)(o,{...i,...r,ref:t})});J.displayName=q;function Y(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`)}}function X(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});break}return r}function Z(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}]}function ne(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}function re(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)),ie(t)}function ie(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)}var Q=k,ae=N,oe=F,se=z,ce=V,le=J,$=r();function ue(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,x.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function de(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,x.jsx)(ae,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function fe(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,x.jsx)(oe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function pe(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=_(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,x.jsx)(le,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,x.jsx)(se,{children:(0,x.jsxs)(ce,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{fe as i,pe as n,ue as r,de as t};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{C as i,R as a,S as o,T as s,w as c,x as l}from"./doc-hash-Bg2WkAY_.js";import{a as u,c as d,f,h as p,l as m,m as h,o as g,r as _,u as ee,x as v,y}from"./button-C1nwPVFQ.js";var b=e(t(),1),x=n(),[S,te]=h(`Tooltip`,[s]),C=s(),w=`TooltipProvider`,T=700,E=`tooltip.open`,[D,O]=S(w),k=e=>{let{__scopeTooltip:t,delayDuration:n=T,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,x.jsx)(D,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};k.displayName=w;var A=`Tooltip`,[j,M]=S(A),N=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=O(A,e.__scopeTooltip),u=C(t),[f,p]=b.useState(null),m=d(),h=b.useRef(0),g=o??l.disableHoverableContent,_=s??l.delayDuration,v=b.useRef(!1),[y,S]=ee({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(E))):l.onClose(),a?.(e)},caller:A}),te=b.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),w=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),D=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return b.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,x.jsx)(c,{...u,children:(0,x.jsx)(j,{scope:t,contentId:m,open:y,stateAttribute:te,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?D():w()},[l.isOpenDelayedRef,D,w]),onTriggerLeave:b.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};N.displayName=A;var P=`TooltipTrigger`,F=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=M(P,n),a=O(P,n),o=C(n),s=v(t,b.useRef(null),i.onTriggerChange),c=b.useRef(!1),u=b.useRef(!1),d=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,x.jsx)(l,{asChild:!0,...o,children:(0,x.jsx)(p.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:f(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:f(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:f(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:f(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:f(e.onBlur,i.onClose),onClick:f(e.onClick,i.onClose)})})});F.displayName=P;var I=`TooltipPortal`,[L,R]=S(I,{forceMount:void 0}),z=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(I,t);return(0,x.jsx)(L,{scope:t,forceMount:n,children:(0,x.jsx)(m,{present:n||a.open,children:(0,x.jsx)(u,{asChild:!0,container:i,children:r})})})};z.displayName=I;var B=`TooltipContent`,V=b.forwardRef((e,t)=>{let n=R(B,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(B,e.__scopeTooltip);return(0,x.jsx)(m,{present:r||o.open,children:o.disableHoverableContent?(0,x.jsx)(K,{side:i,...a,ref:t}):(0,x.jsx)(H,{side:i,...a,ref:t})})}),H=b.forwardRef((e,t)=>{let n=M(B,e.__scopeTooltip),r=O(B,e.__scopeTooltip),i=b.useRef(null),a=v(t,i),[o,s]=b.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{s(null),d(!1)},[d]),p=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=X(r,Y(r,n.getBoundingClientRect())),a=Z(t.getBoundingClientRect());s(re([...i,...a])),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ne(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,x.jsx)(K,{...e,ref:a})}),[U,W]=S(A,{isInside:!1}),G=y(`TooltipContent`),K=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=e,u=M(B,n),d=C(n),{onClose:f}=u;return b.useEffect(()=>(document.addEventListener(E,f),()=>document.removeEventListener(E,f)),[f]),b.useEffect(()=>{if(u.trigger){let e=e=>{e.target?.contains(u.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]),(0,x.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,x.jsxs)(i,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.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,x.jsx)(G,{children:r}),(0,x.jsx)(U,{scope:n,isInside:!0,children:(0,x.jsx)(a,{id:u.contentId,role:`tooltip`,children:o||r})})]})})});V.displayName=B;var q=`TooltipArrow`,J=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=C(n);return W(q,n).isInside?null:(0,x.jsx)(o,{...i,...r,ref:t})});J.displayName=q;function Y(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`)}}function X(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});break}return r}function Z(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}]}function ne(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}function re(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)),ie(t)}function ie(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)}var Q=k,ae=N,oe=F,se=z,ce=V,le=J,$=r();function ue(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,x.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function de(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,x.jsx)(ae,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function fe(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,x.jsx)(oe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function pe(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=_(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,x.jsx)(le,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,x.jsx)(se,{children:(0,x.jsxs)(ce,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{fe as i,pe as n,ue as r,de as t};
@@ -29,19 +29,26 @@
29
29
  in sync. next-themes stores the value as a plain string, not JSON.
30
30
 
31
31
  The inline <style> below paints the html background to match the
32
- body's resolved background (body uses `bg-sidebar` per globals.css
33
- `oklch(0.985 0 0) ≈ #fafafa` light, `oklch(0.205 0 0) ≈ #171717`
34
- dark). The `html.dark` literal must match the BrowserWindow
35
- `backgroundColor` constructor in packages/desktop/src/main/index.ts
36
- drift produces a sub-frame composite mismatch when the OS-level
37
- window first shows.
32
+ body's resolved background (body uses `bg-sidebar` per globals.css).
33
+ The placeholders #fafafa / #171717 are
34
+ substituted at build time by chromeTokensVitePlugin (resolves the
35
+ Tailwind v4 `--sidebar` OKLCH values to sRGB hex via culori). Single
36
+ source of truth for chrome bg no hand-maintained drift between
37
+ this file and packages/core/src/constants/chrome.ts.
38
+
39
+ The `electron-mode` class is added when `window.okDesktop` is
40
+ present (preload bridge runs before any inline page script). Paired
41
+ consumer: globals.css `html.electron-mode` rules — render the outer
42
+ canvas (html / body / sidebar wrapper / sidebar inner) alpha-aware
43
+ so the BrowserWindow's vibrancy material shows through. Web mode
44
+ (no `window.okDesktop`) skips the class so chrome stays solid.
38
45
 
39
46
  Single-line script body — same biome HTML-formatter constraint as
40
47
  the editor-mode FOUC above.
41
48
  -->
42
- <script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); })();</script>
49
+ <script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
43
50
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
44
- <script type="module" crossorigin src="./assets/index-BDj01myg.js"></script>
51
+ <script type="module" crossorigin src="./assets/index-10HZouza.js"></script>
45
52
  <link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
46
53
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
47
54
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-B5t0fahT.js">
@@ -51,26 +58,26 @@
51
58
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-CVnuRdak.js">
52
59
  <link rel="modulepreload" crossorigin href="./assets/button-C1nwPVFQ.js">
53
60
  <link rel="modulepreload" crossorigin href="./assets/dist-Cg-Qaqw_.js">
54
- <link rel="modulepreload" crossorigin href="./assets/doc-hash-C9Z2AnUu.js">
61
+ <link rel="modulepreload" crossorigin href="./assets/doc-hash-Bg2WkAY_.js">
55
62
  <link rel="modulepreload" crossorigin href="./assets/dist-WhY-UbDY.js">
56
63
  <link rel="modulepreload" crossorigin href="./assets/propagation-api-3kmMXRwS.js">
57
64
  <link rel="modulepreload" crossorigin href="./assets/dist-OTL8-1C2.js">
58
65
  <link rel="modulepreload" crossorigin href="./assets/dist-Bej94Urx.js">
59
66
  <link rel="modulepreload" crossorigin href="./assets/input-BOmkuBId.js">
60
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-Ccj8qLzP.js">
67
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-Bic6EUm_.js">
61
68
  <link rel="modulepreload" crossorigin href="./assets/panel-8fydlQgn.js">
62
- <link rel="modulepreload" crossorigin href="./assets/OutlinePanel-DP5j1Wq1.js">
69
+ <link rel="modulepreload" crossorigin href="./assets/OutlinePanel-CJ2DJN7r.js">
63
70
  <link rel="modulepreload" crossorigin href="./assets/label-Dv_9VZWz.js">
64
- <link rel="modulepreload" crossorigin href="./assets/toggle-group-CP96D5oH.js">
71
+ <link rel="modulepreload" crossorigin href="./assets/toggle-group-BMp2XgSC.js">
65
72
  <link rel="modulepreload" crossorigin href="./assets/dialog-BFN-ujuF.js">
66
73
  <link rel="modulepreload" crossorigin href="./assets/textarea-57j4gLcZ.js">
67
- <link rel="modulepreload" crossorigin href="./assets/config-validation-events-BJEehccy.js">
74
+ <link rel="modulepreload" crossorigin href="./assets/config-validation-events-Bosr96x4.js">
68
75
  <link rel="modulepreload" crossorigin href="./assets/checkbox-DBLbPikY.js">
69
- <link rel="modulepreload" crossorigin href="./assets/tooltip-qQkwljHf.js">
76
+ <link rel="modulepreload" crossorigin href="./assets/tooltip-CYfWgpPY.js">
70
77
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-BrTlNKmt.js">
71
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-FPPCIJIk.js">
78
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-zW_9xoDt.js">
72
79
  <link rel="modulepreload" crossorigin href="./assets/consent-store-lB0p7dI5.js">
73
- <link rel="stylesheet" crossorigin href="./assets/index-BzPHdvNz.css">
80
+ <link rel="stylesheet" crossorigin href="./assets/index-EvzmrHLW.css">
74
81
  </head>
75
82
 
76
83
  <body class="antialiased">
@@ -1,2 +1,2 @@
1
- import{c as e,d as t,s as n}from"./init-uWmRmgCA.mjs";import"./loader-hjhxvSRP.mjs";import"./preview-vq_EvsiP.mjs";function r(r,i,a={}){let o=[];for(let n of i){let i=t[n],s=i.projectConfigPath?.(r);if(!s){o.push({editorId:n,outcome:`skipped-no-project-surface`});continue}let c;try{c=e(i,r,a,void 0,s)}catch(e){o.push({editorId:n,outcome:`failed`,error:e instanceof Error?e.message:String(e)});continue}if(c.action===`written`||c.action===`overwritten`){o.push({editorId:n,outcome:c.action});continue}if(c.action===`failed`){o.push({editorId:n,outcome:`failed`,error:c.error});continue}o.push({editorId:n,outcome:`failed`,error:`unexpected project-scope action: ${c.action}`})}return{editorOutcomes:o,claudeLaunchJson:i.includes(`claude`)?n(r,a):void 0}}export{r as t};
2
- //# sourceMappingURL=src-jO7GzWRA.mjs.map
1
+ import{c as e,d as t,s as n}from"./init-Djz7BdtL.mjs";import"./loader-B64r69-j.mjs";import"./preview-nt7uUE2i.mjs";function r(r,i,a={}){let o=[];for(let n of i){let i=t[n],s=i.projectConfigPath?.(r);if(!s){o.push({editorId:n,outcome:`skipped-no-project-surface`});continue}let c;try{c=e(i,r,a,void 0,s)}catch(e){o.push({editorId:n,outcome:`failed`,error:e instanceof Error?e.message:String(e)});continue}if(c.action===`written`||c.action===`overwritten`){o.push({editorId:n,outcome:c.action});continue}if(c.action===`failed`){o.push({editorId:n,outcome:`failed`,error:c.error});continue}o.push({editorId:n,outcome:`failed`,error:`unexpected project-scope action: ${c.action}`})}return{editorOutcomes:o,claudeLaunchJson:i.includes(`claude`)?n(r,a):void 0}}export{r as t};
2
+ //# sourceMappingURL=src-DVGh66ju.mjs.map
@@ -0,0 +1 @@
1
+ import{l as e}from"./start-D6Gr8R62.mjs";export{e as startCommand};
@@ -1,3 +1,3 @@
1
- import{n as e,t}from"./esm-CEs3LWY3.mjs";import"./dist-Cl_t5NRm.mjs";import{n}from"./constants-Dlyng5m6.mjs";import{spawn as r}from"node:child_process";import{join as i}from"node:path";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,statSync as l}from"node:fs";import{homedir as u}from"node:os";import{setTimeout as d}from"node:timers/promises";const f=`Open Knowledge.app`,p=`/Applications/${f}`;function m(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return l(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function h(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(g(e,p))return p;let t=i(e.homeDir??u(),`Applications`,f);return g(e,t)?t:null}function g(e,t){try{let n=i(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function _(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=h(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function v(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop… (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`}).unref()}function y(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${p}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${p} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${p} but launch dispatch did not fire (caller bug).`}}function b(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function x(e,t){return e.host??t.HOST??`localhost`}var S=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function C(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function w(e){o(e.lockDir)||s(e.lockDir,{recursive:!0});let t=c(i(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??r,{PORT:l,...u}=process.env,d=b();try{let r=n(d.command,[...d.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:u});return r.unref(),r}finally{try{a(t)}catch{}}}async function T(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function E(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>d(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function D(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:u,getLogger:f,isProcessAlive:p,readUiLock:m,resolveContentDir:h}=await import(`./dist-DVNDjpnz.mjs`),g=e.log??f(`start`),_=l(n,`.ok`);if(!i&&!s(_))throw new S(n);let v=h(t,n);s(v)||(c(v,{recursive:!0}),g.info({contentDir:v},`Created content directory`));let y=null,b=await u({config:t,contentDir:v,projectDir:n,contentRoot:t.content.dir,port:e.port,host:r,quiet:!1,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:!0,spawnUiSiblingFn:async({lockDir:t})=>{if(y=C({uiLock:m(t),isAlive:p}),y.action===`spawn`&&!a)try{w({lockDir:t,cwd:n,spawn:e.spawn}),g.info({reason:y.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else y.action===`skip`&&g.info({port:y.port,pid:y.pid},`UI already running at port ${y.port}`)},idleShutdownHandler:e=>E({readUiLock:()=>m(b.lockDir),isAlive:p,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:g}),log:g});y||={action:`skip`,reason:`alive`,pid:0,port:0};let x=y,D=null;if(x.action===`skip`)D=x.port>0?x.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;D=await T({readUiLock:()=>m(b.lockDir),now:Date.now,sleep:e=>d(e),timeoutMs:t,pollIntervalMs:50}),D===null&&g.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:b.httpServer,destroy:b.destroy,lockDir:b.lockDir,contentDir:v,port:b.port,ready:b.ready,degraded:b.degraded,uiSpawnDecision:y,resolvedUiPort:D}}function O(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function k(e,t){let{renderBanner:r}=await import(`./banner-DdbR6AZr.mjs`),{dim:i,error:a,warning:o}=await import(`./colors-T3xmlXQT.mjs`),s=process.cwd(),c=e,l=x(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await D({config:c,cwd:s,host:l,port:f})}catch(e){e instanceof S&&(console.error(a(e.message)),process.exit(1));let t=A(e,s,await import(`./dist-DVNDjpnz.mjs`));t!==null&&(console.error(a(t)),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(r({name:`open-knowledge`,version:n,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${o(`⚠`)} ${o(e)}: ${i(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-BOeCxs2W.mjs`);e(y)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function A(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=i(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function j(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,O).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
1
+ import{n as e,t}from"./esm-CEs3LWY3.mjs";import"./dist-DoBoUPet.mjs";import{n}from"./constants-CSmwRAFo.mjs";import{spawn as r}from"node:child_process";import{join as i}from"node:path";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,statSync as l}from"node:fs";import{homedir as u}from"node:os";import{setTimeout as d}from"node:timers/promises";const f=`Open Knowledge.app`,p=`/Applications/${f}`;function m(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return l(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function h(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(g(e,p))return p;let t=i(e.homeDir??u(),`Applications`,f);return g(e,t)?t:null}function g(e,t){try{let n=i(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function _(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=h(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function v(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop… (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`}).unref()}function y(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${p}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${p} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${p} but launch dispatch did not fire (caller bug).`}}function b(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function x(e,t){return e.host??t.HOST??`localhost`}var S=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function C(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function w(e){o(e.lockDir)||s(e.lockDir,{recursive:!0});let t=c(i(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??r,{PORT:l,...u}=process.env,d=b();try{let r=n(d.command,[...d.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:u});return r.unref(),r}finally{try{a(t)}catch{}}}async function T(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function E(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>d(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function D(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:u,getLogger:f,isProcessAlive:p,readUiLock:m,resolveContentDir:h}=await import(`./dist-BaIGvDgD.mjs`),g=e.log??f(`start`),_=l(n,`.ok`);if(!i&&!s(_))throw new S(n);let v=h(t,n);s(v)||(c(v,{recursive:!0}),g.info({contentDir:v},`Created content directory`));let y=null,b=await u({config:t,contentDir:v,projectDir:n,contentRoot:t.content.dir,port:e.port,host:r,quiet:!1,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:!0,spawnUiSiblingFn:async({lockDir:t})=>{if(y=C({uiLock:m(t),isAlive:p}),y.action===`spawn`&&!a)try{w({lockDir:t,cwd:n,spawn:e.spawn}),g.info({reason:y.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else y.action===`skip`&&g.info({port:y.port,pid:y.pid},`UI already running at port ${y.port}`)},idleShutdownHandler:e=>E({readUiLock:()=>m(b.lockDir),isAlive:p,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:g}),log:g});y||={action:`skip`,reason:`alive`,pid:0,port:0};let x=y,D=null;if(x.action===`skip`)D=x.port>0?x.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;D=await T({readUiLock:()=>m(b.lockDir),now:Date.now,sleep:e=>d(e),timeoutMs:t,pollIntervalMs:50}),D===null&&g.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:b.httpServer,destroy:b.destroy,lockDir:b.lockDir,contentDir:v,port:b.port,ready:b.ready,degraded:b.degraded,uiSpawnDecision:y,resolvedUiPort:D}}function O(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function k(e,t){let{renderBanner:r}=await import(`./banner-DdbR6AZr.mjs`),{dim:i,error:a,warning:o}=await import(`./colors-T3xmlXQT.mjs`),s=process.cwd(),c=e,l=x(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await D({config:c,cwd:s,host:l,port:f})}catch(e){e instanceof S&&(console.error(a(e.message)),process.exit(1));let t=A(e,s,await import(`./dist-BaIGvDgD.mjs`));t!==null&&(console.error(a(t)),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(r({name:`open-knowledge`,version:n,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${o(`⚠`)} ${o(e)}: ${i(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-BOeCxs2W.mjs`);e(y)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function A(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=i(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function j(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,O).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
2
2
  `),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=_(m());if(n.available){v({spawn:r});return}console.error(y(n.reason)),process.exit(1)}await k(n,t)})}export{C as a,w as c,b as d,m as f,E as i,j as l,v as m,T as n,x as o,_ as p,D as r,k as s,S as t,A as u};
3
- //# sourceMappingURL=start-BnicFP1K.mjs.map
3
+ //# sourceMappingURL=start-D6Gr8R62.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.4.0-beta.25",
3
+ "version": "0.4.0-beta.26",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import"./dist-Cl_t5NRm.mjs";var e=`0.4.0-beta.25`;const t=`config.yml`,n=e;export{n,t};
2
- //# sourceMappingURL=constants-Dlyng5m6.mjs.map
@@ -1 +0,0 @@
1
- import{o as e}from"./init-uWmRmgCA.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-hjhxvSRP.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-vq_EvsiP.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,10 +0,0 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{Tt as i,Ut as a,Zt as o,et as s,fn as c,n as l}from"./DocumentContext-Ccj8qLzP.js";import{$ as u,C as d,I as f,Ir as p,Kt as m,L as h,Q as g,Rn as _,Rr as v,S as y,T as b,Wt as x,b as S,bn as C,et as w,p as T,tt as E,w as D,x as O}from"./doc-hash-C9Z2AnUu.js";import{C as k,S as A,a as j,b as M,c as N,f as P,g as F,h as I,l as L,m as R,o as ee,r as z,s as te,t as B,u as ne,v as V,w as re,x as H}from"./button-C1nwPVFQ.js";import{n as ie,t as ae}from"./dist-Bej94Urx.js";import{c as oe,d as se,l as ce,m as le,p as ue,u as de}from"./dist-OTL8-1C2.js";import{t as fe}from"./dist-Cg-Qaqw_.js";import{a as pe,i as me,r as he}from"./toggle-group-CP96D5oH.js";import{t as ge}from"./label-Dv_9VZWz.js";import{a as _e,c as U,i as ve,n as ye,o as be,r as xe,s as Se,t as Ce}from"./dialog-BFN-ujuF.js";import{t as we}from"./input-BOmkuBId.js";import{t as Te}from"./textarea-57j4gLcZ.js";var Ee=k(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),De=k(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Oe=k(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ke=k(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ae=k(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),je=k(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Me=k(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),W=r(),G=e(t(),1);function Ne(){let e=(0,W.c)(4),[t,n]=(0,G.useState)(null),r=(0,G.useRef)(!1),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=typeof window<`u`?window.okDesktop:void 0;if(!e)return;let t=e.onChannelChanged(e=>{let{channel:t}=e;r.current=!0,n(t)});return e.state.query().then(e=>{r.current||n(e.channel)}).catch(Fe),t},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,G.useEffect)(i,a);let o;return e[2]===t?o=e[3]:(o={channel:t,setChannel:Pe},e[2]=t,e[3]=o),o}async function Pe(e){let t=typeof window<`u`?window.okDesktop:void 0;if(!t)throw Error(`useUpdateChannel.setChannel called without desktop bridge`);await t.update.setChannel(e)}function Fe(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}var K=n(),Ie=e(re());function Le(e,t){let n=window.okDesktop?.shell?.openExternal;n&&(e.preventDefault(),n(t))}var Re=[`Enter`,` `],ze=[`ArrowDown`,`PageUp`,`Home`],Be=[`ArrowUp`,`PageDown`,`End`],Ve=[...ze,...Be],He={ltr:[...Re,`ArrowRight`],rtl:[...Re,`ArrowLeft`]},Ue={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},We=`Menu`,[Ge,Ke,qe]=h(We),[Je,Ye]=R(We,[qe,b,pe]),Xe=b(),Ze=pe(),[Qe,$e]=Je(We),[et,tt]=Je(We),nt=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xe(t),[c,l]=G.useState(null),u=G.useRef(!1),d=te(a),p=f(i);return G.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;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})}},[]),(0,K.jsx)(D,{...s,children:(0,K.jsx)(Qe,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,K.jsx)(et,{scope:t,onClose:G.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:o,children:r})})})};nt.displayName=We;var rt=`MenuAnchor`,it=G.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xe(n);return(0,K.jsx)(O,{...i,...r,ref:t})});it.displayName=rt;var at=`MenuPortal`,[ot,st]=Je(at,{forceMount:void 0}),ct=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$e(at,t);return(0,K.jsx)(ot,{scope:t,forceMount:n,children:(0,K.jsx)(L,{present:n||a.open,children:(0,K.jsx)(j,{asChild:!0,container:i,children:r})})})};ct.displayName=at;var q=`MenuContent`,[lt,ut]=Je(q),dt=G.forwardRef((e,t)=>{let n=st(q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$e(q,e.__scopeMenu),o=tt(q,e.__scopeMenu);return(0,K.jsx)(Ge.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(L,{present:r||a.open,children:(0,K.jsx)(Ge.Slot,{scope:e.__scopeMenu,children:o.modal?(0,K.jsx)(ft,{...i,ref:t}):(0,K.jsx)(pt,{...i,ref:t})})})})}),ft=G.forwardRef((e,t)=>{let n=$e(q,e.__scopeMenu),r=G.useRef(null),i=H(t,r);return G.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,K.jsx)(ht,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),pt=G.forwardRef((e,t)=>{let n=$e(q,e.__scopeMenu);return(0,K.jsx)(ht,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),mt=V(`MenuContent.ScrollLock`),ht=G.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=$e(q,n),v=tt(q,n),y=Xe(n),b=Ze(n),x=Ke(n),[S,C]=G.useState(null),w=G.useRef(null),T=H(t,w,_.onContentChange),E=G.useRef(0),D=G.useRef(``),O=G.useRef(0),k=G.useRef(null),A=G.useRef(`right`),j=G.useRef(0),M=h?ce:G.Fragment,N=h?{as:mt,allowPinchZoom:!0}:void 0,F=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=$t(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};G.useEffect(()=>()=>window.clearTimeout(E.current),[]),de();let I=G.useCallback(e=>A.current===k.current?.side&&tn(e,k.current?.area),[]);return(0,K.jsx)(lt,{scope:n,searchRef:D,onItemEnter:G.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:G.useCallback(e=>{I(e)||(w.current?.focus(),C(null))},[I]),onTriggerLeave:G.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:O,onPointerGraceIntentChange:G.useCallback(e=>{k.current=e},[]),children:(0,K.jsx)(M,{...N,children:(0,K.jsx)(se,{asChild:!0,trapped:i,onMountAutoFocus:P(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,K.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,K.jsx)(me,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:P(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,K.jsx)(d,{role:`menu`,"aria-orientation":`vertical`,"data-state":Jt(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:P(g.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&&F(e.key));let i=w.current;if(e.target!==i||!Ve.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Be.includes(e.key)&&a.reverse(),Zt(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:P(e.onPointerMove,nn(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});dt.displayName=q;var gt=`MenuGroup`,_t=G.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,K.jsx)(I.div,{role:`group`,...r,ref:t})});_t.displayName=gt;var vt=`MenuLabel`,yt=G.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,K.jsx)(I.div,{...r,ref:t})});yt.displayName=vt;var bt=`MenuItem`,xt=`menu.itemSelect`,St=G.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=G.useRef(null),o=tt(bt,e.__scopeMenu),s=ut(bt,e.__scopeMenu),c=H(t,a),l=G.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(xt,{bubbles:!0,cancelable:!0});e.addEventListener(xt,e=>r?.(e),{once:!0}),F(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,K.jsx)(Ct,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Re.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});St.displayName=bt;var Ct=G.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ut(bt,n),s=Ze(n),c=G.useRef(null),l=H(t,c),[u,d]=G.useState(!1),[f,p]=G.useState(``);return G.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,K.jsx)(Ge.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,K.jsx)(he,{asChild:!0,...s,focusable:!r,children:(0,K.jsx)(I.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,nn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,nn(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})}),wt=`MenuCheckboxItem`,Tt=G.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,K.jsx)(Nt,{scope:e.__scopeMenu,checked:n,children:(0,K.jsx)(St,{role:`menuitemcheckbox`,"aria-checked":Yt(n)?`mixed`:n,...i,ref:t,"data-state":Xt(n),onSelect:P(i.onSelect,()=>r?.(Yt(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Tt.displayName=wt;var Et=`MenuRadioGroup`,[Dt,Ot]=Je(Et,{value:void 0,onValueChange:()=>{}}),kt=G.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=te(r);return(0,K.jsx)(Dt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,K.jsx)(_t,{...i,ref:t})})});kt.displayName=Et;var At=`MenuRadioItem`,jt=G.forwardRef((e,t)=>{let{value:n,...r}=e,i=Ot(At,e.__scopeMenu),a=n===i.value;return(0,K.jsx)(Nt,{scope:e.__scopeMenu,checked:a,children:(0,K.jsx)(St,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Xt(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});jt.displayName=At;var Mt=`MenuItemIndicator`,[Nt,Pt]=Je(Mt,{checked:!1}),Ft=G.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Pt(Mt,n);return(0,K.jsx)(L,{present:r||Yt(a.checked)||a.checked===!0,children:(0,K.jsx)(I.span,{...i,ref:t,"data-state":Xt(a.checked)})})});Ft.displayName=Mt;var It=`MenuSeparator`,Lt=G.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,K.jsx)(I.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Lt.displayName=It;var Rt=`MenuArrow`,zt=G.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xe(n);return(0,K.jsx)(y,{...i,...r,ref:t})});zt.displayName=Rt;var Bt=`MenuSub`,[Vt,Ht]=Je(Bt),Ut=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=$e(Bt,t),o=Xe(t),[s,c]=G.useState(null),[l,u]=G.useState(null),d=te(i);return G.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,K.jsx)(D,{...o,children:(0,K.jsx)(Qe,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,K.jsx)(Vt,{scope:t,contentId:N(),triggerId:N(),trigger:s,onTriggerChange:c,children:n})})})};Ut.displayName=Bt;var Wt=`MenuSubTrigger`,Gt=G.forwardRef((e,t)=>{let n=$e(Wt,e.__scopeMenu),r=tt(Wt,e.__scopeMenu),i=Ht(Wt,e.__scopeMenu),a=ut(Wt,e.__scopeMenu),o=G.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=G.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return G.useEffect(()=>u,[u]),G.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,K.jsx)(it,{asChild:!0,...l,children:(0,K.jsx)(Ct,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Jt(n.open),...e,ref:M(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(e.onPointerMove,nn(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:P(e.onPointerLeave,nn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:P(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||He[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Gt.displayName=Wt;var Kt=`MenuSubContent`,qt=G.forwardRef((e,t)=>{let n=st(q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$e(q,e.__scopeMenu),o=tt(q,e.__scopeMenu),s=Ht(Kt,e.__scopeMenu),c=G.useRef(null),l=H(t,c);return(0,K.jsx)(Ge.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(L,{present:r||a.open,children:(0,K.jsx)(Ge.Slot,{scope:e.__scopeMenu,children:(0,K.jsx)(ht,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:P(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:P(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ue[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});qt.displayName=Kt;function Jt(e){return e?`open`:`closed`}function Yt(e){return e===`indeterminate`}function Xt(e){return Yt(e)?`indeterminate`:e?`checked`:`unchecked`}function Zt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Qt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function $t(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=Qt(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}function en(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}function tn(e,t){return t?en({x:e.clientX,y:e.clientY},t):!1}function nn(e){return t=>t.pointerType===`mouse`?e(t):void 0}var rn=nt,an=it,on=ct,sn=dt,cn=_t,ln=yt,un=St,dn=Tt,fn=kt,pn=jt,mn=Ft,hn=Lt,gn=zt,_n=Ut,vn=Gt,yn=qt,bn=`DropdownMenu`,[xn,Sn]=R(bn,[Ye]),J=Ye(),[Cn,wn]=xn(bn),Tn=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=J(t),l=G.useRef(null),[u,d]=ne({prop:i,defaultProp:a??!1,onChange:o,caller:bn});return(0,K.jsx)(Cn,{scope:t,triggerId:N(),triggerRef:l,contentId:N(),open:u,onOpenChange:d,onOpenToggle:G.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,K.jsx)(rn,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Tn.displayName=bn;var En=`DropdownMenuTrigger`,Dn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=wn(En,n),o=J(n);return(0,K.jsx)(an,{asChild:!0,...o,children:(0,K.jsx)(I.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:M(t,a.triggerRef),onPointerDown:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Dn.displayName=En;var On=`DropdownMenuPortal`,kn=e=>{let{__scopeDropdownMenu:t,...n}=e,r=J(t);return(0,K.jsx)(on,{...r,...n})};kn.displayName=On;var An=`DropdownMenuContent`,jn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=wn(An,n),a=J(n),o=G.useRef(!1);return(0,K.jsx)(sn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(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)`}})});jn.displayName=An;var Mn=`DropdownMenuGroup`,Nn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(cn,{...i,...r,ref:t})});Nn.displayName=Mn;var Pn=`DropdownMenuLabel`,Fn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(ln,{...i,...r,ref:t})});Fn.displayName=Pn;var In=`DropdownMenuItem`,Ln=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(un,{...i,...r,ref:t})});Ln.displayName=In;var Rn=`DropdownMenuCheckboxItem`,zn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(dn,{...i,...r,ref:t})});zn.displayName=Rn;var Bn=`DropdownMenuRadioGroup`,Vn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(fn,{...i,...r,ref:t})});Vn.displayName=Bn;var Hn=`DropdownMenuRadioItem`,Un=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(pn,{...i,...r,ref:t})});Un.displayName=Hn;var Wn=`DropdownMenuItemIndicator`,Gn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(mn,{...i,...r,ref:t})});Gn.displayName=Wn;var Kn=`DropdownMenuSeparator`,qn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(hn,{...i,...r,ref:t})});qn.displayName=Kn;var Jn=`DropdownMenuArrow`,Yn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(gn,{...i,...r,ref:t})});Yn.displayName=Jn;var Xn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=J(t),[s,c]=ne({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,K.jsx)(_n,{...o,open:s,onOpenChange:c,children:n})},Zn=`DropdownMenuSubTrigger`,Qn=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(vn,{...i,...r,ref:t})});Qn.displayName=Zn;var $n=`DropdownMenuSubContent`,er=G.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,K.jsx)(yn,{...i,...r,ref:t,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)`}})});er.displayName=$n;var tr=Tn,nr=Dn,rr=kn,ir=jn,ar=Fn,or=Ln,sr=Vn,cr=Un,lr=Gn,ur=qn,dr=Xn,fr=Qn,pr=er,mr=`Radio`,[hr,gr]=R(mr),[_r,vr]=hr(mr),yr=G.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=G.useState(null),p=H(t,e=>f(e)),m=G.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,K.jsxs)(_r,{scope:n,checked:i,disabled:o,children:[(0,K.jsx)(I.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":wr(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:P(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,K.jsx)(Cr,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});yr.displayName=mr;var br=`RadioIndicator`,xr=G.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=vr(br,n);return(0,K.jsx)(L,{present:r||a.checked,children:(0,K.jsx)(I.span,{"data-state":wr(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});xr.displayName=br;var Sr=`RadioBubbleInput`,Cr=G.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=G.useRef(null),s=H(o,a),c=ae(n),l=fe(t);return G.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,K.jsx)(I.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Cr.displayName=Sr;function wr(e){return e?`checked`:`unchecked`}var Tr=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Er=`RadioGroup`,[Dr,Or]=R(Er,[pe,gr]),kr=pe(),Ar=gr(),[jr,Mr]=Dr(Er),Nr=G.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...p}=e,m=kr(n),h=f(l),[g,_]=ne({prop:a,defaultProp:i??null,onChange:d,caller:Er});return(0,K.jsx)(jr,{scope:n,name:r,required:o,disabled:s,value:g,onValueChange:_,children:(0,K.jsx)(me,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:(0,K.jsx)(I.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:h,...p,ref:t})})})});Nr.displayName=Er;var Pr=`RadioGroupItem`,Fr=G.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Mr(Pr,n),o=a.disabled||r,s=kr(n),c=Ar(n),l=G.useRef(null),u=H(t,l),d=a.value===i.value,f=G.useRef(!1);return G.useEffect(()=>{let e=e=>{Tr.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,K.jsx)(he,{asChild:!0,...s,focusable:!o,active:d,children:(0,K.jsx)(yr,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:P(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:P(i.onFocus,()=>{f.current&&l.current?.click()})})})});Fr.displayName=Pr;var Ir=`RadioGroupIndicator`,Lr=G.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,K.jsx)(xr,{...Ar(n),...r,ref:t})});Lr.displayName=Ir;var Rr=Nr,zr=Fr,Br=Lr,Vr=`Separator`,Hr=`horizontal`,Ur=[`horizontal`,`vertical`],Wr=G.forwardRef((e,t)=>{let{decorative:n,orientation:r=Hr,...i}=e,a=Gr(r)?r:Hr,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,K.jsx)(I.div,{"data-orientation":a,...o,...i,ref:t})});Wr.displayName=Vr;function Gr(e){return Ur.includes(e)}var Kr=Wr;function qr(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jr(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(Rr,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yr(e){let t=(0,W.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Br,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,K.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,K.jsx)(zr,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Xr(e){let t=(0,W.c)(9),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,G.useState)(n),[a,o]=(0,G.useState)(0),s;t[1]===e?s=t[2]:(s=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Qr).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,frontmatterSources:e.frontmatter_sources??{}}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[1]=e,t[2]=s);let c;t[3]!==e||t[4]!==a?(c=[e,a],t[3]=e,t[4]=a,t[5]=c):c=t[5],(0,G.useEffect)(s,c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(Zr),t[6]=l):l=t[6];let u;return t[7]===r?u=t[8]:(u={state:r,refresh:l},t[7]=r,t[8]=u),u}function Zr(e){return e+1}async function Qr(e){if(!e.ok){let t=await e.json().catch($r);throw Error(S(t)??`HTTP ${e.status}`)}return e.json()}function $r(){return null}function ei(e,t,n){let r=(0,W.c)(6),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={status:`idle`},r[0]=i):i=r[0];let[a,o]=(0,G.useState)(i),s,c;return r[1]!==e||r[2]!==t||r[3]!==n?(s=()=>{if(!t){o({status:`idle`});return}if(n!==`user`&&e===null){o({status:`idle`});return}let r=!1;o({status:`loading`});let i=`?folder=${encodeURIComponent(n===`user`?``:e??``)}&name=${encodeURIComponent(t)}`;return n!==void 0&&(i+=`&target=${encodeURIComponent(n)}`),fetch(`/api/template${i}`).then(ti).then(e=>{if(!r){if(!e||typeof e!=`object`||!e.template){o({status:`error`,message:`Server returned an incomplete template response.`});return}o({status:`ready`,data:e.template})}}).catch(e=>{r||o({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{r=!0}},c=[e,t,n],r[1]=e,r[2]=t,r[3]=n,r[4]=s,r[5]=c):(s=r[4],c=r[5]),(0,G.useEffect)(s,c),a}async function ti(e){if(!e.ok){let t=await e.json().catch(ni);throw Error(S(t)??`HTTP ${e.status}`)}return e.json()}function ni(){return null}async function ri(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function ii(){return ai().status}function ai(){let e=(0,W.c)(8),[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ri().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,G.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>T(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,G.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var oi=(0,G.createContext)(null);function si(e,t,n){let r=new i,a=new s({url:e,name:t,document:r}),o=x(a,n);return{binding:o,config:o.current(),cleanup:()=>{o.dispose(),a.destroy(),r.destroy()}}}function ci(e){let t=new i,n=new s({url:e,name:g,document:t}),r=m(n);return{binding:r,provider:n,cleanup:()=>{r.dispose(),n.destroy(),t.destroy()}}}function li(e){let t=(0,W.c)(25),{children:n}=e,{collabUrl:r}=l(),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null),[c,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{if(r===null)return;let e=si(r,E,`user`),t=si(r,u,`project`),n=si(r,w,`project-local`),i=ci(r);a({binding:e.binding,config:e.config}),s({binding:t.binding,config:t.config}),d({binding:n.binding,config:n.config,synced:n.binding.hasSynced()}),p({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),c=t.binding.subscribe(e=>{s(n=>n?.binding===t.binding?{...n,config:e}:n)}),l=n.binding.subscribe(e=>{d(t=>t?.binding===n.binding?{...t,config:e}:t)}),f=n.binding.subscribeSynced(()=>{d(e=>e?.binding===n.binding?{...e,synced:!0}:e)}),m=()=>{p(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,m),()=>{o(),c(),l(),f(),i.provider.off(`synced`,m),e.cleanup(),t.cleanup(),n.cleanup(),i.cleanup(),a(t=>t?.binding===e.binding?null:t),s(e=>e?.binding===t.binding?null:e),d(e=>e?.binding===n.binding?null:e),p(e=>e?.binding===i.binding?null:e)}},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,G.useEffect)(m,h);let g;t[3]!==c?.config||t[4]!==o||t[5]!==i?(g=i&&o?_(i.config,o.config,c?.config):null,t[3]=c?.config,t[4]=o,t[5]=i,t[6]=g):g=t[6];let y=g,{setTheme:b}=v(),x=y?.appearance?.theme,S,C;t[7]!==b||t[8]!==x?(S=()=>{(x===`light`||x===`dark`||x===`system`)&&b(x)},C=[x,b],t[7]=b,t[8]=x,t[9]=S,t[10]=C):(S=t[9],C=t[10]),(0,G.useEffect)(S,C);let T=i?.binding??null,D=o?.binding??null,O=c?.binding??null,k=f?.binding??null,A=f?.synced??!1,j=i?.config??null,M=o?.config??null,N=c?.config??null,P=c?.synced??!1,F;t[11]!==y||t[12]!==A||t[13]!==j||t[14]!==M||t[15]!==N||t[16]!==P||t[17]!==T||t[18]!==D||t[19]!==O||t[20]!==k?(F={userBinding:T,projectBinding:D,projectLocalBinding:O,okignoreBinding:k,okignoreSynced:A,userConfig:j,projectConfig:M,projectLocalConfig:N,projectLocalSynced:P,merged:y},t[11]=y,t[12]=A,t[13]=j,t[14]=M,t[15]=N,t[16]=P,t[17]=T,t[18]=D,t[19]=O,t[20]=k,t[21]=F):F=t[21];let I=F,L;return t[22]!==n||t[23]!==I?(L=(0,K.jsx)(oi,{value:I,children:n}),t[22]=n,t[23]=I,t[24]=L):L=t[24],L}function ui(){let e=(0,G.use)(oi);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function di(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(U,{children:`Enable git auto-sync?`}),(0,K.jsx)(_e,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),e[0]=t):t=e[0],t}function fi(){let e=(0,W.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Before you enable it:`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsxs)(K.Fragment,{children:[t,(0,K.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5 text-sm text-muted-foreground`,children:[(0,K.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,K.jsx)(`li`,{children:`If you do not want automatic commits in your git history, you should not enable auto-sync.`})]})]}),e[1]=n):n=e[1],n}function pi(){let e=(0,W.c)(2),{projectLocalBinding:t}=ui();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{enabled:e}});return n.ok?{ok:!0}:{ok:!1,error:C(n.error)}},e[0]=t,e[1]=n),n}function mi(e){let t=(0,W.c)(10),[n,r]=(0,G.useState)(!1),i;t[0]===e?i=t[1]:(i=function(t){if(e===null)return ue.error(`Sync settings not yet loaded — try again in a moment`),!1;let n=e(t);return n.ok?!0:(console.error(`[sync] toggle failed:`,n.error),ue.error(`Failed to ${t?`enable`:`disable`} sync — ${n.error}`),!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=function(e){if(e){r(!0);return}a(!1)},t[2]=a,t[3]=o);let s=o,c;t[4]===a?c=t[5]:(c=function(){a(!0)&&r(!1)},t[4]=a,t[5]=c);let l=c,u;return t[6]!==n||t[7]!==l||t[8]!==s?(u={confirmOpen:n,setConfirmOpen:r,onToggleRequest:s,onConfirm:l},t[6]=n,t[7]=l,t[8]=s,t[9]=u):u=t[9],u}function hi(e){let t=(0,W.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=z(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,K.jsx)(Kr,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function gi(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _i=A(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function vi(e){let t=(0,W.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=z(_i({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,K.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function yi(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bi(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(ge,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xi(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Si(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ci(e){let t=(0,W.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ti)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,K.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(wi)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=z(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,K.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function wi(e){return e?.message&&(0,K.jsx)(`li`,{children:e.message},e.message)}function Ti(e){return[e?.message,e]}function Ei(){var e=[...arguments];return(0,G.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Di=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Oi(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function ki(e){return`nodeType`in e}function Y(e){return e?Oi(e)?e:ki(e)?e.ownerDocument?.defaultView??window:window:window}function Ai(e){let{Document:t}=Y(e);return e instanceof t}function ji(e){return Oi(e)?!1:e instanceof Y(e).HTMLElement}function Mi(e){return e instanceof Y(e).SVGElement}function Ni(e){return e?Oi(e)?e.document:ki(e)?Ai(e)?e:ji(e)||Mi(e)?e.ownerDocument:document:document:document}var Pi=Di?G.useLayoutEffect:G.useEffect;function Fi(e){let t=(0,G.useRef)(e);return Pi(()=>{t.current=e}),(0,G.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ii(){let e=(0,G.useRef)(null);return[(0,G.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,G.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Li(e,t){t===void 0&&(t=[e]);let n=(0,G.useRef)(e);return Pi(()=>{n.current!==e&&(n.current=e)},t),n}function Ri(e,t){let n=(0,G.useRef)();return(0,G.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function zi(e){let t=Fi(e),n=(0,G.useRef)(null);return[n,(0,G.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Bi(e){let t=(0,G.useRef)();return(0,G.useEffect)(()=>{t.current=e},[e]),t.current}var Vi={};function Hi(e,t){return(0,G.useMemo)(()=>{if(t)return t;let n=Vi[e]==null?0:Vi[e]+1;return Vi[e]=n,e+`-`+n},[e,t])}function Ui(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Wi=Ui(1),Gi=Ui(-1);function Ki(e){return`clientX`in e&&`clientY`in e}function qi(e){if(!e)return!1;let{KeyboardEvent:t}=Y(e.target);return t&&e instanceof t}function Ji(e){if(!e)return!1;let{TouchEvent:t}=Y(e.target);return t&&e instanceof t}function Yi(e){if(Ji(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ki(e)?{x:e.clientX,y:e.clientY}:null}var Xi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Xi.Translate.toString(e),Xi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Zi=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Qi(e){return e.matches(Zi)?e:e.querySelector(Zi)}var $i={display:`none`};function ea(e){let{id:t,value:n}=e;return G.createElement(`div`,{id:t,style:$i},n)}function ta(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return G.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function na(){let[e,t]=(0,G.useState)(``);return{announce:(0,G.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ra=(0,G.createContext)(null);function ia(e){let t=(0,G.useContext)(ra);(0,G.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function aa(){let[e]=(0,G.useState)(()=>new Set),t=(0,G.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,G.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var oa={draggable:`
2
- To pick up a draggable item, press the space bar.
3
- While dragging, use the arrow keys to move the item.
4
- Press space again to drop the item in its new position, or press escape to cancel.
5
- `},sa={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function ca(e){let{announcements:t=sa,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=oa}=e,{announce:a,announcement:o}=na(),s=Hi(`DndLiveRegion`),[c,l]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{l(!0)},[]),ia((0,G.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=G.createElement(G.Fragment,null,G.createElement(ea,{id:r,value:i.draggable}),G.createElement(ta,{id:s,announcement:o}));return n?(0,Ie.createPortal)(u,n):u}var X;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(X||={});function la(){}function ua(e,t){return(0,G.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function da(){var e=[...arguments];return(0,G.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Z=Object.freeze({x:0,y:0});function fa(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function pa(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ma(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ha(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function ga(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function _a(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var va=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=_a(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=fa(_a(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(pa)},ya=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ha(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ha(r),o=i.reduce((e,t,r)=>e+fa(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(pa)};function ba(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var xa=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=ba(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ma)};function Sa(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ca(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Z}function wa(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ta=wa(1);function Ea(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Da(e,t,n){let r=Ea(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Oa={ignoreTransform:!1};function ka(e,t){t===void 0&&(t=Oa);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Y(e).getComputedStyle(e);t&&(n=Da(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Aa(e){return ka(e,{ignoreTransform:!0})}function ja(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ma(e,t){return t===void 0&&(t=Y(e).getComputedStyle(e)),t.position===`fixed`}function Na(e,t){t===void 0&&(t=Y(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Pa(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Ai(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ji(i)||Mi(i)||n.includes(i))return n;let a=Y(e).getComputedStyle(i);return i!==e&&Na(i,a)&&n.push(i),Ma(i,a)?n:r(i.parentNode)}return e?r(e):n}function Fa(e){let[t]=Pa(e,1);return t??null}function Ia(e){return!Di||!e?null:Oi(e)?e:ki(e)?Ai(e)||e===Ni(e).scrollingElement?window:ji(e)?e:null:null}function La(e){return Oi(e)?e.scrollX:e.scrollLeft}function Ra(e){return Oi(e)?e.scrollY:e.scrollTop}function za(e){return{x:La(e),y:Ra(e)}}var Q;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Q||={});function Ba(e){return!Di||!e?!1:e===document.scrollingElement}function Va(e){let t={x:0,y:0},n=Ba(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Ha={x:.2,y:.2};function Ua(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Ha);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Va(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Q.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Q.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Q.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Q.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Wa(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ga(e){return e.reduce((e,t)=>Wi(e,za(t)),Z)}function Ka(e){return e.reduce((e,t)=>e+La(t),0)}function qa(e){return e.reduce((e,t)=>e+Ra(t),0)}function Ja(e,t){if(t===void 0&&(t=ka),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Fa(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ya=[[`x`,[`left`,`right`],Ka],[`y`,[`top`,`bottom`],qa]],Xa=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Pa(t),r=Ga(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ya)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Za=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Qa(e){let{EventTarget:t}=Y(e);return e instanceof t?e:Ni(e)}function $a(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var eo;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(eo||={});function to(e){e.preventDefault()}function no(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var ro={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},io=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},ao=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Za(Ni(t)),this.windowListeners=new Za(Y(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(eo.Resize,this.handleCancel),this.windowListeners.add(eo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(eo.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ja(n),t(Z)}handleKeyDown(e){if(qi(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=ro,coordinateGetter:a=io,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Z;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Gi(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Va(n),p=Wa(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Wi(Gi(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};ao.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=ro,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function oo(e){return!!(e&&`distance`in e)}function so(e){return!!(e&&`delay`in e)}var co=class{constructor(e,t,n){n===void 0&&(n=Qa(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Ni(i),this.documentListeners=new Za(this.document),this.listeners=new Za(n),this.windowListeners=new Za(Y(i)),this.initialCoordinates=Yi(r)??Z,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(eo.Resize,this.handleCancel),this.windowListeners.add(eo.DragStart,to),this.windowListeners.add(eo.VisibilityChange,this.handleCancel),this.windowListeners.add(eo.ContextMenu,to),this.documentListeners.add(eo.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(so(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(oo(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(eo.Click,no,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(eo.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Yi(e)??Z,s=Gi(n,o);if(!t&&a){if(oo(a)){if(a.tolerance!=null&&$a(s,a.tolerance))return this.handleCancel();if($a(s,a.distance))return this.handleStart()}if(so(a)&&$a(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},lo={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},uo=class extends co{constructor(e){let{event:t}=e,n=Ni(t.target);super(e,lo,n)}};uo.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var fo={move:{name:`mousemove`},end:{name:`mouseup`}},po;(function(e){e[e.RightClick=2]=`RightClick`})(po||={});var mo=class extends co{constructor(e){super(e,fo,Ni(e.event.target))}};mo.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===po.RightClick?!1:(r?.({event:n}),!0)}}];var ho={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},go=class extends co{constructor(e){super(e,ho)}static setup(){return window.addEventListener(ho.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ho.move.name,e)};function e(){}}};go.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var _o;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(_o||={});var vo;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(vo||={});function yo(e){let{acceleration:t,activator:n=_o.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=vo.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=xo({delta:d,disabled:!a}),[m,h]=Ii(),g=(0,G.useRef)({x:0,y:0}),_=(0,G.useRef)({x:0,y:0}),v=(0,G.useMemo)(()=>{switch(n){case _o.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case _o.DraggableRect:return i}},[n,i,c]),y=(0,G.useRef)(null),b=(0,G.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,G.useMemo)(()=>s===vo.TreeOrder?[...l].reverse():l,[s,l]);(0,G.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Ua(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var bo={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function xo(e){let{delta:t,disabled:n}=e,r=Bi(t);return Ri(e=>{if(n||!r||!e)return bo;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:e.x[Q.Backward]||i.x===-1,[Q.Forward]:e.x[Q.Forward]||i.x===1},y:{[Q.Backward]:e.y[Q.Backward]||i.y===-1,[Q.Forward]:e.y[Q.Forward]||i.y===1}}},[n,t,r])}function So(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Ri(e=>t==null?null:r??e??null,[r,t])}function Co(e,t){return(0,G.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var wo;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(wo||={});var To;(function(e){e.Optimized=`optimized`})(To||={});var Eo=new Map;function Do(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,G.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,G.useRef)(e),d=g(),f=Li(d),p=(0,G.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,G.useRef)(null),h=Ri(t=>{if(d&&!n)return Eo;if(!t||t===Eo||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Xa(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,G.useEffect)(()=>{u.current=e},[e]),(0,G.useEffect)(()=>{d||p()},[n,d]),(0,G.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,G.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case wo.Always:return!1;case wo.BeforeDragging:return n;default:return!n}}}function Oo(e,t){return Ri(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function ko(e,t){return Oo(e,t)}function Ao(e){let{callback:t,disabled:n}=e,r=Fi(t),i=(0,G.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,G.useEffect)(()=>()=>i?.disconnect(),[i]),i}function jo(e){let{callback:t,disabled:n}=e,r=Fi(t),i=(0,G.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,G.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Mo(e){return new Xa(ka(e),e)}function No(e,t,n){t===void 0&&(t=Mo);let[r,i]=(0,G.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Ao({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=jo({callback:a});return Pi(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Po(e){return Ca(e,Oo(e))}var Fo=[];function Io(e){let t=(0,G.useRef)(e),n=Ri(n=>e?n&&n!==Fo&&e&&t.current&&e.parentNode===t.current.parentNode?n:Pa(e):Fo,[e]);return(0,G.useEffect)(()=>{t.current=e},[e]),n}function Lo(e){let[t,n]=(0,G.useState)(null),r=(0,G.useRef)(e),i=(0,G.useCallback)(e=>{let t=Ia(e.target);t&&n(e=>e?(e.set(t,za(t)),new Map(e)):null)},[]);return(0,G.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Ia(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,za(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Ia(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,G.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Wi(e,t),Z):Ga(e):Z,[e,t])}function Ro(e,t){t===void 0&&(t=[]);let n=(0,G.useRef)(null);return(0,G.useEffect)(()=>{n.current=null},t),(0,G.useEffect)(()=>{let t=e!==Z;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Gi(e,n.current):Z}function zo(e){(0,G.useEffect)(()=>{if(!Di)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Bo(e,t){return(0,G.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Vo(e){return(0,G.useMemo)(()=>e?ja(e):null,[e])}var Ho=[];function Uo(e,t){t===void 0&&(t=ka);let[n]=e,r=Vo(n?Y(n):null),[i,a]=(0,G.useState)(Ho);function o(){a(()=>e.length?e.map(e=>Ba(e)?r:new Xa(t(e),e)):Ho)}let s=jo({callback:o});return Pi(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Wo(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ji(t)?t:e}function Go(e){let{measure:t}=e,[n,r]=(0,G.useState)(null),i=jo({callback:(0,G.useCallback)(e=>{for(let{target:n}of e)if(ji(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=zi((0,G.useCallback)(e=>{let n=Wo(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,G.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ko=[{sensor:uo,options:{}},{sensor:ao,options:{}}],qo={current:{}},Jo={draggable:{measure:Aa},droppable:{measure:Aa,strategy:wo.WhileDragging,frequency:To.Optimized},dragOverlay:{measure:ka}},Yo=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Xo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:la},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Jo,measureDroppableContainers:la,windowRect:null,measuringScheduled:!1},Zo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:la,draggableNodes:new Map,over:null,measureDroppableContainers:la},Qo=(0,G.createContext)(Zo),$o=(0,G.createContext)(Xo);function es(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yo}}}function ts(e,t){switch(t.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Yo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case X.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Yo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case X.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Yo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ns(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,G.useContext)(Qo),a=Bi(r),o=Bi(n?.id);return(0,G.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!qi(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Qi(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function rs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function is(e){return(0,G.useMemo)(()=>({draggable:{...Jo.draggable,...e?.draggable},droppable:{...Jo.droppable,...e?.droppable},dragOverlay:{...Jo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function as(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,G.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Pi(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Ca(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Fa(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var os=(0,G.createContext)({...Z,scaleX:1,scaleY:1}),ss;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(ss||={});var cs=(0,G.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ko,collisionDetection:o=xa,measuring:s,modifiers:c,...l}=e,[u,d]=(0,G.useReducer)(ts,void 0,es),[f,p]=aa(),[m,h]=(0,G.useState)(ss.Uninitialized),g=m===ss.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,G.useRef)({initial:null,translated:null}),C=(0,G.useMemo)(()=>_==null?null:{id:_,data:x?.data??qo,rect:S},[_,x]),w=(0,G.useRef)(null),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(null),k=Li(l,Object.values(l)),A=Hi(`DndDescribedBy`,t),j=(0,G.useMemo)(()=>b.getEnabled(),[b]),M=is(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Do(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=So(v,_),L=(0,G.useMemo)(()=>D?Yi(D):null,[D]),R=Te(),ee=ko(I,M.draggable.measure);as({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:ee,measure:M.draggable.measure});let z=No(I,M.draggable.measure,ee),te=No(I?I.parentElement:null),B=(0,G.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(B.current.over?.id),V=Go({measure:M.dragOverlay.measure}),re=V.nodeRef.current??I,H=g?V.rect??z:null,ie=!!(V.nodeRef.current&&V.rect),ae=Po(ie?null:z),oe=Vo(re?Y(re):null),se=Io(g?ne??I:null),ce=Uo(se),le=rs(c,{transform:{x:y.x-ae.x,y:y.y-ae.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:H,over:B.current.over,overlayNodeRect:V.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=L?Wi(L,y):null,de=Lo(se),fe=Ro(de),pe=Ro(de,[z]),me=Wi(le,fe),he=H?Ta(H,le):null,ge=C&&he?o({active:C,collisionRect:he,droppableRects:N,droppableContainers:j,pointerCoordinates:ue}):null,_e=ga(ge,`id`),[U,ve]=(0,G.useState)(null),ye=Sa(ie?le:Wi(le,pe),U?.rect??null,z),be=(0,G.useRef)(null),xe=(0,G.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:w.current,activeNode:i,event:a,options:r,context:B,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Ie.unstable_batchedUpdates)(()=>{r?.(i),h(ss.Initializing),d({type:X.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(be.current),O(a)})},onMove(e){d({type:X.DragMove,coordinates:e})},onEnd:o(X.DragEnd),onCancel:o(X.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=B.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===X.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=X.DragCancel)}w.current=null,(0,Ie.unstable_batchedUpdates)(()=>{d({type:e}),h(ss.Uninitialized),ve(null),E(null),O(null),be.current=null;let t=e===X.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=Co(a,(0,G.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,xe(n,t))},[v,xe]));zo(a),Pi(()=>{z&&m===ss.Initializing&&h(ss.Initialized)},[z,m]),(0,G.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=B.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,Ie.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,G.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=B.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Ie.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),Pi(()=>{B.current={activatorEvent:D,active:C,activeNode:I,collisionRect:he,collisions:ge,droppableRects:N,draggableNodes:v,draggingNode:re,draggingNodeRect:H,droppableContainers:b,over:U,scrollableAncestors:se,scrollAdjustedTranslate:me},S.current={initial:H,translated:he}},[C,I,ge,he,v,re,H,N,b,U,se,me]),yo({...R,delta:y,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let Ce=(0,G.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:z,activatorEvent:D,collisions:ge,containerNodeRect:te,dragOverlay:V,draggableNodes:v,droppableContainers:b,droppableRects:N,over:U,measureDroppableContainers:P,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:M,measuringScheduled:F,windowRect:oe}),[C,I,z,D,ge,te,V,v,b,N,U,P,se,ce,M,F,oe]),we=(0,G.useMemo)(()=>({activatorEvent:D,activators:Se,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:U,measureDroppableContainers:P}),[D,Se,C,z,d,A,v,U,P]);return G.createElement(ra.Provider,{value:p},G.createElement(Qo.Provider,{value:we},G.createElement($o.Provider,{value:Ce},G.createElement(os.Provider,{value:ye},i)),G.createElement(ns,{disabled:n?.restoreFocus===!1})),G.createElement(ca,{...n,hiddenTextDescribedById:A}));function Te(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),ls=(0,G.createContext)(null),us=`button`,ds=`Draggable`;function fs(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Hi(ds),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,G.useContext)(Qo),{role:p=us,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,G.useContext)(g?os:ls),[v,y]=zi(),[b,x]=zi(),S=Bo(o,t),C=Li(n);return Pi(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,G.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===us?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function ps(){return(0,G.useContext)($o)}var ms=`Droppable`,hs={timeout:25};function gs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Hi(ms),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,G.useContext)(Qo),u=(0,G.useRef)({disabled:n}),d=(0,G.useRef)(!1),f=(0,G.useRef)(null),p=(0,G.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...hs,...i},_=Li(h??r),v=jo({callback:(0,G.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=zi((0,G.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Li(t);return(0,G.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,G.useEffect)(()=>(s({type:X.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:X.UnregisterDroppable,key:a,id:r})),[r]),(0,G.useEffect)(()=>{n!==u.current.disabled&&(s({type:X.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function _s(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function vs(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ys(e){return e!==null&&e>=0}function bs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xs(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Ss=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=_s(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Cs={scaleX:1,scaleY:1},ws=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Cs}:null}let s=Ts(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Cs}:r<t&&r>=a?{x:0,y:o.height+s,...Cs}:{x:0,y:0,...Cs}};function Ts(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Es=`Sortable`,Ds=G.createContext({activeIndex:-1,containerId:Es,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ss,disabled:{draggable:!1,droppable:!1}});function Os(e){let{children:t,id:n,items:r,strategy:i=Ss,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=ps(),d=Hi(Es,n),f=s.rect!==null,p=(0,G.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,G.useRef)(p),v=!bs(p,_.current),y=g!==-1&&h===-1||v,b=xs(a);Pi(()=>{v&&m&&u(p)},[v,p,m,u]),(0,G.useEffect)(()=>{_.current=p},[p]);let x=(0,G.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:vs(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return G.createElement(Ds.Provider,{value:x},t)}var ks=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return _s(n,r,i).indexOf(t)},As=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},js={duration:200,easing:`ease`},Ms=`transform`,Ns=Xi.Transition.toString({property:Ms,duration:0,easing:`linear`}),Ps={roleDescription:`sortable`};function Fs(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,G.useState)(null),s=(0,G.useRef)(n);return Pi(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ka(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,G.useEffect)(()=>{a&&o(null)},[a]),a}function Is(e){let{animateLayoutChanges:t=As,attributes:n,disabled:r,data:i,getNewIndex:a=ks,id:o,strategy:s,resizeObserverConfig:c,transition:l=js}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,G.useContext)(Ds),y=Ls(r,p),b=u.indexOf(o),x=(0,G.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,G.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=gs({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=fs({id:o,data:x,attributes:{...Ps,...n},disabled:y.draggable}),L=Ei(E,j),R=!!D,ee=R&&!m&&ys(f)&&ys(g),z=!_&&N,te=ee?(z&&ee?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,B=ys(f)&&ys(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=D?.id,V=(0,G.useRef)({activeId:ne,items:u,newIndex:B,containerId:d}),re=u!==V.current.items,H=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),ie=Fs({disabled:!H,index:b,node:w,rect:C});return(0,G.useEffect)(()=>{R&&V.current.newIndex!==B&&(V.current.newIndex=B),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[R,B,d,u]),(0,G.useEffect)(()=>{if(ne===V.current.activeId)return;if(ne!=null&&V.current.activeId==null){V.current.activeId=ne;return}let e=setTimeout(()=>{V.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:B,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ie??te,transition:ae()};function ae(){if(ie||re&&V.current.newIndex===b)return Ns;if(!(z&&!qi(O)||!l)&&(R||H))return Xi.Transition.toString({...l,property:Ms})}}function Ls(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Rs(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var zs=[$.Down,$.Right,$.Up,$.Left],Bs=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(zs.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=ya({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=ga(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Pa(c).some((e,t)=>s[t]!==e),i=Vs(e,t),a=Hs(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Gi(u,l)}}}};function Vs(e,t){return!Rs(e)||!Rs(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Hs(e,t){return!Rs(e)||!Rs(t)||!Vs(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Us(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(tr,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Ws(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(nr,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Gs(e){let t=(0,W.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=z(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,K.jsx)(rr,{children:(0,K.jsx)(ir,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Ks(e){let t=(0,W.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=z(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,K.jsx)(or,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function qs(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(sr,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Js(e){let t=(0,W.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=z(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,K.jsx)(lr,{children:(0,K.jsx)(ie,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,K.jsxs)(cr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ys(e){let t=(0,W.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=z(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,K.jsx)(ar,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Xs(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(ur,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zs(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(dr,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Qs(e){let t=(0,W.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=z(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(c,{className:`ml-auto`}),t[7]=s):s=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(l=(0,K.jsxs)(fr,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=l):l=t[12],l}function $s(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(pr,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function ec(e){return S(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function tc(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await ec(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function nc(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await ec(t)};let n=await t.json().catch(()=>null);return{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function rc(e,t,n){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`;n!==void 0&&(r+=`&target=${encodeURIComponent(n)}`);let i=await fetch(`/api/template${r}`,{method:`DELETE`});return i.ok?{ok:!0,existed:(await i.json().catch(()=>null))?.existed??!1}:{ok:!1,error:await ec(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function ic(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ac(e,t){return e===``?`.ok/templates/${t}.md`:`${e}/.ok/templates/${t}.md`}function oc(e){let t=(0,W.c)(22),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:s,children:c}=e,l=n===void 0?`this item`:n,u=a??`Delete ${l}`,d;t[0]===u?d=t[1]:(d=(0,K.jsx)(U,{children:u}),t[0]=u,t[1]=d);let f=s??`Are you sure you want to delete ${l}? This action cannot be undone.`,p;t[2]===f?p=t[3]:(p=(0,K.jsx)(_e,{className:`whitespace-pre-wrap`,children:f}),t[2]=f,t[3]=p);let m;t[4]===c?m=t[5]:(m=c?(0,K.jsx)(ye,{children:c}):null,t[4]=c,t[5]=m);let h;t[6]===r?h=t[7]:(h=(0,K.jsx)(xe,{asChild:!0,children:(0,K.jsx)(B,{variant:`outline`,disabled:r,children:`Cancel`})}),t[6]=r,t[7]=h);let g;t[8]===r?g=t[9]:(g=r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(o,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[8]=r,t[9]=g);let _;t[10]!==r||t[11]!==i||t[12]!==g?(_=(0,K.jsx)(B,{variant:`destructive`,onClick:i,disabled:r,children:g}),t[10]=r,t[11]=i,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==h||t[15]!==_?(v=(0,K.jsxs)(be,{children:[h,_]}),t[14]=h,t[15]=_,t[16]=v):v=t[16];let y;return t[17]!==v||t[18]!==d||t[19]!==p||t[20]!==m?(y=(0,K.jsxs)(ve,{children:[d,p,m,v]}),t[17]=v,t[18]=d,t[19]=p,t[20]=m,t[21]=y):y=t[21],y}function sc(e){let t=(0,W.c)(40),{value:n,onChange:r,onBlur:i,placeholder:o,id:s,disabled:c,"aria-describedby":l,"aria-invalid":u,ref:d}=e,f=o===void 0?`Add tag…`:o,[p,m]=(0,G.useState)(``),h;t[0]!==r||t[1]!==n?(h=e=>{let t=e.trim();if(t){if(n.includes(t)){m(``);return}r([...n,t]),m(``)}},t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==r||t[4]!==n?(_=e=>{r(n.filter((t,n)=>n!==e))},t[3]=r,t[4]=n,t[5]=_):_=t[5];let v=_,y=c&&`pointer-events-none opacity-60`,b;t[6]===y?b=t[7]:(b=z(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,y),t[6]=y,t[7]=b);let x;if(t[8]!==c||t[9]!==v||t[10]!==n){let e;t[12]!==c||t[13]!==v?(e=(e,t)=>(0,K.jsxs)(a,{variant:`secondary`,className:`gap-1 pl-2 pr-1`,children:[(0,K.jsx)(`span`,{className:`font-mono`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>v(t),"aria-label":`Remove ${e}`,className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:c,children:(0,K.jsx)(le,{className:`size-3`,"aria-hidden":`true`})})]},e),t[12]=c,t[13]=v,t[14]=e):e=t[14],x=n.map(e),t[8]=c,t[9]=v,t[10]=n,t[11]=x}else x=t[11];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>m(e.target.value),t[15]=S):S=t[15];let C;t[16]!==g||t[17]!==p||t[18]!==v||t[19]!==n.length?(C=e=>{e.key===`Enter`?p.trim()&&(e.preventDefault(),g(p)):e.key===`,`?(e.preventDefault(),p.trim()&&g(p)):e.key===`Tab`?p.trim()&&(e.preventDefault(),g(p)):e.key===`Backspace`&&p===``&&n.length>0&&(e.preventDefault(),v(n.length-1))},t[16]=g,t[17]=p,t[18]=v,t[19]=n.length,t[20]=C):C=t[20];let w;t[21]!==g||t[22]!==p||t[23]!==i?(w=()=>{p.trim()&&g(p),i?.()},t[21]=g,t[22]=p,t[23]=i,t[24]=w):w=t[24];let T=n.length===0?f:``,E;t[25]!==l||t[26]!==u||t[27]!==c||t[28]!==p||t[29]!==s||t[30]!==d||t[31]!==T||t[32]!==C||t[33]!==w?(E=(0,K.jsx)(`input`,{id:s,ref:d,type:`text`,value:p,onChange:S,onKeyDown:C,onBlur:w,placeholder:T,"aria-describedby":l,"aria-invalid":u,disabled:c,className:`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`}),t[25]=l,t[26]=u,t[27]=c,t[28]=p,t[29]=s,t[30]=d,t[31]=T,t[32]=C,t[33]=w,t[34]=E):E=t[34];let D;return t[35]!==u||t[36]!==E||t[37]!==b||t[38]!==x?(D=(0,K.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":u,className:b,children:[x,E]}),t[35]=u,t[36]=E,t[37]=b,t[38]=x,t[39]=D):D=t[39],D}function cc(e){let t=(0,W.c)(49),{title:n,description:r,tags:i,onTitleChange:a,onDescriptionChange:o,onTagsChange:s,requireTitle:c,disabled:l}=e,u=c===void 0?!1:c,d=l===void 0?!1:l,f=(0,G.useId)(),p=(0,G.useId)(),m=(0,G.useId)(),[h,g]=(0,G.useState)(!1),_;t[0]!==u||t[1]!==n?(_=u&&n.trim()===``,t[0]=u,t[1]=n,t[2]=_):_=t[2];let v=_&&h,y;t[3]===u?y=t[4]:(y=u?(0,K.jsx)(`span`,{className:`text-destructive`,children:`*`}):null,t[3]=u,t[4]=y);let b;t[5]!==y||t[6]!==f?(b=(0,K.jsxs)(bi,{htmlFor:f,children:[`Title`,y]}),t[5]=y,t[6]=f,t[7]=b):b=t[7];let x;t[8]===a?x=t[9]:(x=e=>a(e.target.value),t[8]=a,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>g(!0),t[10]=S):S=t[10];let C;t[11]!==d||t[12]!==v||t[13]!==x||t[14]!==n||t[15]!==f?(C=(0,K.jsx)(we,{id:f,value:n,onChange:x,onBlur:S,disabled:d,"aria-invalid":v}),t[11]=d,t[12]=v,t[13]=x,t[14]=n,t[15]=f,t[16]=C):C=t[16];let w;t[17]===v?w=t[18]:(w=v?(0,K.jsx)(Ci,{children:`Required — title is the agent menu surface.`}):null,t[17]=v,t[18]=w);let T;t[19]!==b||t[20]!==C||t[21]!==w?(T=(0,K.jsxs)(vi,{children:[b,C,w]}),t[19]=b,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===p?E=t[24]:(E=(0,K.jsx)(bi,{htmlFor:p,children:`Description`}),t[23]=p,t[24]=E);let D;t[25]===o?D=t[26]:(D=e=>o(e.target.value),t[25]=o,t[26]=D);let O;t[27]!==r||t[28]!==p||t[29]!==d||t[30]!==D?(O=(0,K.jsx)(Te,{id:p,value:r,onChange:D,disabled:d,rows:2}),t[27]=r,t[28]=p,t[29]=d,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==E||t[33]!==O?(k=(0,K.jsxs)(vi,{children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;t[35]===m?A=t[36]:(A=(0,K.jsx)(bi,{htmlFor:m,children:`Tags`}),t[35]=m,t[36]=A);let j;t[37]!==d||t[38]!==s||t[39]!==i||t[40]!==m?(j=(0,K.jsx)(sc,{id:m,value:i,onChange:s,disabled:d}),t[37]=d,t[38]=s,t[39]=i,t[40]=m,t[41]=j):j=t[41];let M;t[42]!==A||t[43]!==j?(M=(0,K.jsxs)(vi,{children:[A,j]}),t[42]=A,t[43]=j,t[44]=M):M=t[44];let N;return t[45]!==T||t[46]!==k||t[47]!==M?(N=(0,K.jsxs)(K.Fragment,{children:[T,k,M]}),t[45]=T,t[46]=k,t[47]=M,t[48]=N):N=t[48],N}function lc(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();r&&(t.description=r);let i=e.tags.map(e=>e.trim()).filter(e=>e.length>0);return i.length>0&&(t.tags=i),t}function uc(e){let t=(0,W.c)(17),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,G.useId)(),u;t[0]===l?u=t[1]:(u=(0,K.jsx)(bi,{htmlFor:l,children:`Body`}),t[0]=l,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[`Allowed substitutions: `,`{{date}}`,`, `,`{{user}}`]}),t[2]=d):d=t[2];let f;t[3]===u?f=t[4]:(f=(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[u,d]}),t[3]=u,t[4]=f);let p;t[5]===r?p=t[6]:(p=e=>r(e.target.value),t[5]=r,t[6]=p);let m;t[7]!==s||t[8]!==l||t[9]!==a||t[10]!==c||t[11]!==p||t[12]!==n?(m=(0,K.jsx)(Te,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[7]=s,t[8]=l,t[9]=a,t[10]=c,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==f||t[15]!==m?(h=(0,K.jsxs)(vi,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var dc=/^[A-Za-z0-9_-]+$/;function fc(e){let t=(0,W.c)(36),{mode:n,folderPath:r,initial:i,existingNames:a,onCommitted:o,target:s}=e,[c,l]=(0,G.useState)(i.name),[u,d]=(0,G.useState)(i.title),[f,p]=(0,G.useState)(i.description),[m,h]=(0,G.useState)(i.tags),[g,_]=(0,G.useState)(i.body),[v,y]=(0,G.useState)(!1),b,x,S,C;if(t[0]!==a||t[1]!==n||t[2]!==c||t[3]!==u){S=c.trim();let e;t[8]===u?e=t[9]:(e=u.trim(),t[8]=u,t[9]=e),C=e,b=n===`create`&&(S===``||!dc.test(S)),x=n===`create`&&!b&&(a?.has(S)??!1),t[0]=a,t[1]=n,t[2]=c,t[3]=u,t[4]=b,t[5]=x,t[6]=S,t[7]=C}else b=t[4],x=t[5],S=t[6],C=t[7];let w=x,T=!v&&!b&&C!==``,E;t[10]!==g||t[11]!==T||t[12]!==f||t[13]!==r||t[14]!==i.name||t[15]!==n||t[16]!==o||t[17]!==m||t[18]!==s||t[19]!==u||t[20]!==S?(E=async function(){if(!T)return;y(!0);let e=lc({title:u,description:f,tags:m}),t={folder:r,name:n===`create`?S:i.name,frontmatter:e,body:g};s!==void 0&&(t.target=s);let a=await nc(t);if(y(!1),!a.ok){ue.error(`${n===`create`?`Create`:`Save`} failed: ${a.error}`);return}a.warnings.length>0?ue.warning(a.warnings.join(` `)):n===`create`?ue.success(`Template "${S}" created`):ue.success(`Template saved`),o()},t[10]=g,t[11]=T,t[12]=f,t[13]=r,t[14]=i.name,t[15]=n,t[16]=o,t[17]=m,t[18]=s,t[19]=u,t[20]=S,t[21]=E):E=t[21];let D=E,O=s??`project`,k;return t[22]!==g||t[23]!==T||t[24]!==f||t[25]!==n||t[26]!==c||t[27]!==b||t[28]!==w||t[29]!==v||t[30]!==D||t[31]!==O||t[32]!==m||t[33]!==u||t[34]!==S?(k={mode:n,name:c,title:u,description:f,tags:m,body:g,setName:l,setTitle:d,setDescription:p,setTags:h,setBody:_,isSaving:v,canSubmit:T,nameInvalid:b,nameShadows:w,trimmedName:S,target:O,submit:D},t[22]=g,t[23]=T,t[24]=f,t[25]=n,t[26]=c,t[27]=b,t[28]=w,t[29]=v,t[30]=D,t[31]=O,t[32]=m,t[33]=u,t[34]=S,t[35]=k):k=t[35],k}function pc(e){let t=(0,W.c)(21),{form:n,bodyPlaceholder:r}=e,i=(0,G.useId)(),a=n.mode===`create`&&n.trimmedName!==``&&n.nameInvalid,o;t[0]!==n||t[1]!==i||t[2]!==a?(o=n.mode===`create`?(0,K.jsxs)(vi,{children:[(0,K.jsxs)(bi,{htmlFor:i,children:[`Name`,(0,K.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,K.jsx)(we,{id:i,value:n.name,onChange:e=>n.setName(e.target.value),placeholder:`article`,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":a}),a?(0,K.jsxs)(Ci,{children:[`Letters, digits, `,(0,K.jsx)(`code`,{className:`font-mono`,children:`_`}),`,`,` `,(0,K.jsx)(`code`,{className:`font-mono`,children:`-`}),` only — no slashes, dots, spaces, or`,` `,(0,K.jsx)(`code`,{className:`font-mono`,children:`.md`}),`.`]}):n.nameShadows?(0,K.jsx)(Si,{className:`text-yellow-600 dark:text-yellow-500`,children:n.target===`user`?(0,K.jsxs)(K.Fragment,{children:[`A template named `,(0,K.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already exists in your user scope. Saving overwrites it. Project or folder templates with the same name will continue to shadow this one in their respective scopes.`]}):(0,K.jsxs)(K.Fragment,{children:[`A template named `,(0,K.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already resolves here (likely inherited). Saving creates a`,` `,(0,K.jsx)(`code`,{className:`font-mono`,children:`local`}),` shadow that supersedes it for this folder.`]})}):null]}):null,t[0]=n,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s;t[4]!==n.description||t[5]!==n.isSaving||t[6]!==n.setDescription||t[7]!==n.setTags||t[8]!==n.setTitle||t[9]!==n.tags||t[10]!==n.title?(s=(0,K.jsx)(cc,{title:n.title,description:n.description,tags:n.tags,onTitleChange:n.setTitle,onDescriptionChange:n.setDescription,onTagsChange:n.setTags,requireTitle:!0,disabled:n.isSaving}),t[4]=n.description,t[5]=n.isSaving,t[6]=n.setDescription,t[7]=n.setTags,t[8]=n.setTitle,t[9]=n.tags,t[10]=n.title,t[11]=s):s=t[11];let c;t[12]!==r||t[13]!==n.body||t[14]!==n.isSaving||t[15]!==n.setBody?(c=(0,K.jsx)(uc,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[12]=r,t[13]=n.body,t[14]=n.isSaving,t[15]=n.setBody,t[16]=c):c=t[16];let l;return t[17]!==o||t[18]!==s||t[19]!==c?(l=(0,K.jsxs)(gi,{children:[o,s,c]}),t[17]=o,t[18]=s,t[19]=c,t[20]=l):l=t[20],l}var mc={name:``,title:``,description:``,tags:[],body:``},hc=`## Summary
6
-
7
- (One-paragraph summary. Edit later via edit_document.)
8
- `;function gc(e){let t=(0,W.c)(13),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o,target:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i||t[5]!==s?(c=i?(0,K.jsx)(_c,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o,target:s}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;t[7]===c?l=t[8]:(l=(0,K.jsx)(ve,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:c}),t[7]=c,t[8]=l);let u;return t[9]!==a||t[10]!==i||t[11]!==l?(u=(0,K.jsx)(Ce,{open:i,onOpenChange:a,children:l}),t[9]=a,t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function _c(e){let t=(0,W.c)(43),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a,target:o}=e,s=o===`user`,c;t[0]!==n||t[1]!==s?(c=s?`~/.ok/templates/<name>.md`:ac(n,`<name>`),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==i?(u=()=>{a(),i(!1)},t[3]=a,t[4]=i,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o===void 0?{}:{target:o},t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==n||t[10]!==u||t[11]!==d?(f={mode:`create`,folderPath:n,initial:mc,existingNames:r,onCommitted:u,...d},t[8]=r,t[9]=n,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=fc(f),m=s?`New user template`:`New template`,h;t[13]===m?h=t[14]:(h=(0,K.jsx)(U,{children:m}),t[13]=m,t[14]=h);let g;t[15]===l?g=t[16]:(g=(0,K.jsx)(`code`,{className:`font-mono`,children:l}),t[15]=l,t[16]=g);let _=s?`Available across every OK project you open with this user account.`:`Agents resolve it via leaf → root walk-up — closest-wins on filename collision.`,v;t[17]!==g||t[18]!==_?(v=(0,K.jsxs)(_e,{children:[`Lands at `,g,`.`,` `,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==h||t[21]!==v?(y=(0,K.jsxs)(Se,{children:[h,v]}),t[20]=h,t[21]=v,t[22]=y):y=t[22];let b;t[23]===p?b=t[24]:(b=(0,K.jsx)(ye,{children:(0,K.jsx)(pc,{form:p,bodyPlaceholder:hc})}),t[23]=p,t[24]=b);let x;t[25]===i?x=t[26]:(x=()=>i(!1),t[25]=i,t[26]=x);let S;t[27]!==p.isSaving||t[28]!==x?(S=(0,K.jsx)(B,{variant:`outline`,className:`font-mono uppercase`,onClick:x,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=x,t[29]=S):S=t[29];let C;t[30]===p?C=t[31]:(C=()=>void p.submit(),t[30]=p,t[31]=C);let w=!p.canSubmit,T=p.isSaving?`Creating…`:`Create template`,E;t[32]!==C||t[33]!==w||t[34]!==T?(E=(0,K.jsx)(B,{onClick:C,disabled:w,children:T}),t[32]=C,t[33]=w,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==S||t[37]!==E?(D=(0,K.jsxs)(be,{children:[S,E]}),t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;return t[39]!==y||t[40]!==b||t[41]!==D?(O=(0,K.jsxs)(K.Fragment,{children:[y,b,D]}),t[39]=y,t[40]=b,t[41]=D,t[42]=O):O=t[42],O}function vc(e){let t=(0,W.c)(33),{folderPath:n,template:r,onOpenChange:i,onSaved:o,target:s}=e,c=r!==null,l;t[0]===i?l=t[1]:(l=function(){i(!1)},t[0]=i,t[1]=l);let u=l,d;t[2]!==u||t[3]!==o?(d=function(){o(),u()},t[2]=u,t[3]=o,t[4]=d):d=t[4];let f=d,p;t[5]===u?p=t[6]:(p=e=>e?null:u(),t[5]=u,t[6]=p);let m=r?.title??r?.name??`Template`,h;t[7]===r?.scope?h=t[8]:(h=r?.scope===`inherited`?(0,K.jsx)(a,{variant:`gray`,className:`text-2xs`,children:`inherited`}):null,t[7]=r?.scope,t[8]=h);let g;t[9]===r?.scope?g=t[10]:(g=r?.scope===`user`?(0,K.jsx)(a,{variant:`primary`,className:`text-2xs`,children:`user`}):null,t[9]=r?.scope,t[10]=g);let _;t[11]!==m||t[12]!==h||t[13]!==g?(_=(0,K.jsxs)(U,{className:`flex items-center gap-2`,children:[`Edit `,m,h,g]}),t[11]=m,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v=r?.description??`Edit template`,y;t[15]===v?y=t[16]:(y=(0,K.jsx)(_e,{className:`sr-only`,children:v}),t[15]=v,t[16]=y);let b;t[17]!==_||t[18]!==y?(b=(0,K.jsxs)(Se,{children:[_,y]}),t[17]=_,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==n||t[21]!==u||t[22]!==f||t[23]!==s||t[24]!==r?(x=r?(0,K.jsx)(yc,{folderPath:n,template:r,onCancel:u,onSaved:f,target:s},`${r.source_folder}::${r.name}`):null,t[20]=n,t[21]=u,t[22]=f,t[23]=s,t[24]=r,t[25]=x):x=t[25];let S;t[26]!==b||t[27]!==x?(S=(0,K.jsxs)(ve,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:[b,x]}),t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;return t[29]!==c||t[30]!==S||t[31]!==p?(C=(0,K.jsx)(Ce,{open:c,onOpenChange:p,children:S}),t[29]=c,t[30]=S,t[31]=p,t[32]=C):C=t[32],C}function yc(e){let t=(0,W.c)(8),{folderPath:n,template:r,onCancel:i,onSaved:a,target:o}=e,s=ei(n,r.name,o);if(s.status===`loading`||s.status===`idle`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(qr,{className:`h-32 w-full`}),(0,K.jsx)(qr,{className:`h-48 w-full`})]})}),t[0]=e):e=t[0],e}if(s.status===`error`){let e;return t[1]===s.message?e=t[2]:(e=(0,K.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load template: `,s.message]})}),t[1]=s.message,t[2]=e),e}let c;return t[3]!==i||t[4]!==a||t[5]!==s.data||t[6]!==o?(c=(0,K.jsx)(bc,{detail:s.data,onCancel:i,onSaved:a,target:o}),t[3]=i,t[4]=a,t[5]=s.data,t[6]=o,t[7]=c):c=t[7],c}function bc(e){let t=(0,W.c)(42),{detail:n,onCancel:r,onSaved:i,target:a}=e,o=n.frontmatter,s=typeof o.title==`string`?o.title:``,c=typeof o.description==`string`?o.description:``,l;t[0]===o.tags?l=t[1]:(l=Array.isArray(o.tags)?o.tags.filter(xc):[],t[0]=o.tags,t[1]=l);let u;t[2]!==n.body||t[3]!==n.name||t[4]!==s||t[5]!==c||t[6]!==l?(u={name:n.name,title:s,description:c,tags:l,body:n.body},t[2]=n.body,t[3]=n.name,t[4]=s,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===a?d=t[9]:(d=a===void 0?{}:{target:a},t[8]=a,t[9]=d);let f;t[10]!==n.folder||t[11]!==i||t[12]!==u||t[13]!==d?(f={mode:`edit`,folderPath:n.folder,initial:u,onCommitted:i,...d},t[10]=n.folder,t[11]=i,t[12]=u,t[13]=d,t[14]=f):f=t[14];let p=fc(f),m;t[15]===n.name?m=t[16]:(m=(0,K.jsxs)(`code`,{className:`font-mono`,children:[`write_document({ template: "`,n.name,`" })`]}),t[15]=n.name,t[16]=m);let h;t[17]===n.path?h=t[18]:(h=(0,K.jsx)(`code`,{className:`font-mono`,children:n.path}),t[17]=n.path,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Instantiate as`,` `,m,`. This template is located at `,h,`.`]}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]===p?_=t[23]:(_=(0,K.jsx)(pc,{form:p}),t[22]=p,t[23]=_);let v;t[24]!==_||t[25]!==g?(v=(0,K.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[g,_]})}),t[24]=_,t[25]=g,t[26]=v):v=t[26];let y;t[27]!==p.isSaving||t[28]!==r?(y=(0,K.jsx)(B,{variant:`outline`,className:`font-mono uppercase`,onClick:r,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=r,t[29]=y):y=t[29];let b;t[30]===p?b=t[31]:(b=()=>void p.submit(),t[30]=p,t[31]=b);let x=!p.canSubmit,S=p.isSaving?`Saving…`:`Save`,C;t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,K.jsx)(B,{onClick:b,disabled:x,children:S}),t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35];let w;t[36]!==y||t[37]!==C?(w=(0,K.jsxs)(be,{children:[y,C]}),t[36]=y,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==v||t[40]!==w?(T=(0,K.jsxs)(K.Fragment,{children:[v,w]}),t[39]=v,t[40]=w,t[41]=T):T=t[41],T}function xc(e){return typeof e==`string`}var Sc=`npx @inkeep/open-knowledge install-skill`,Cc=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function wc(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Tc(e){let t=(0,W.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function Ec(e){let t=(0,W.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Dc(e){let t=(0,W.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function Oc(){let e=(0,W.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(Ec,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(Dc,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,K.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,K.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,K.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(Dc,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,K.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,K.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,K.jsx)(Dc,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(Tc,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,K.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,K.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,K.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,K.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,K.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function kc(e){let t=(0,W.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,s]=(0,G.useState)(i),[c,l]=(0,G.useState)(!1),u,d;t[1]===n?(u=t[2],d=t[3]):(u=()=>{n||(s({kind:`idle`}),l(!1))},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,G.useEffect)(u,d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=async function(){s({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){s({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)s({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;ue.error(`Install handoff failed: ${e}`),s({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=f):f=t[4];let m=f,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=async function(){try{await navigator.clipboard.writeText(Sc),l(!0),setTimeout(()=>l(!1),2e3)}catch(e){let t=e;ue.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=h):h=t[5];let g=h,_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=wc(),t[6]=_):_=t[6];let v=_,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,K.jsxs)(U,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsxs)(Se,{children:[y,(0,K.jsxs)(_e,{children:[`Adds the Open Knowledge skill to the`,` `,(0,K.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=b):b=t[8];let x;t[9]===a.kind?x=t[10]:(x=a.kind===`idle`&&v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(Ec,{className:`text-muted-foreground`,children:`Automatic`}),(0,K.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,K.jsx)(Tc,{children:`openknowledge.skill`}),`, save it to`,` `,(0,K.jsx)(Tc,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,K.jsx)(Oc,{})]}),t[9]=a.kind,t[10]=x);let S;t[11]!==c||t[12]!==a.kind?(S=a.kind===`idle`&&!v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(Ec,{children:`Run this in your terminal`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,K.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Sc}),(0,K.jsx)(B,{variant:`ghost`,size:`sm`,onClick:g,"aria-label":`Copy command`,className:`h-7 gap-1`,children:c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(p,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(De,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,K.jsx)(Tc,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,K.jsx)(Oc,{})]}),t[11]=c,t[12]=a.kind,t[13]=S):S=t[13];let C;t[14]===a.kind?C=t[15]:(C=a.kind===`downloading`&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,K.jsx)(Tc,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=C);let w;t[16]!==a.kind||t[17]!==a.path?(w=a.kind===`handed-off`&&v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,K.jsx)(p,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,K.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,K.jsx)(Oc,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=w):w=t[18];let T;t[19]===a.kind?T=t[20]:(T=a.kind===`handed-off`&&!v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,K.jsx)(p,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,K.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,K.jsx)(Tc,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,K.jsx)(Oc,{})]}),t[19]=a.kind,t[20]=T);let E;t[21]!==a.kind||t[22]!==a.message?(E=a.kind===`error`&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,K.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,K.jsx)(`a`,{href:Cc,target:`_blank`,rel:`noopener noreferrer`,onClick:Nc,onAuxClick:Mc,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=E):E=t[23];let D;t[24]!==S||t[25]!==C||t[26]!==w||t[27]!==T||t[28]!==E||t[29]!==x?(D=(0,K.jsx)(ye,{children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[x,S,C,w,T,E]})}),t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=x,t[30]=D):D=t[30];let O;t[31]===a.kind?O=t[32]:(O=a.kind!==`error`&&(0,K.jsxs)(`a`,{href:Cc,target:`_blank`,rel:`noopener noreferrer`,onClick:jc,onAuxClick:Ac,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,K.jsx)(je,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=O);let k;t[33]!==r||t[34]!==a.kind?(k=a.kind===`idle`&&v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,K.jsxs)(B,{onClick:m,children:[(0,K.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=k):k=t[35];let A;t[36]!==r||t[37]!==a.kind?(A=a.kind===`idle`&&!v&&(0,K.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=A):A=t[38];let j;t[39]!==r||t[40]!==a.kind?(j=a.kind===`error`&&v&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,K.jsxs)(B,{onClick:m,children:[(0,K.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=j):j=t[41];let M;t[42]===a.kind?M=t[43]:(M=a.kind===`downloading`&&(0,K.jsxs)(B,{disabled:!0,children:[(0,K.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=M);let N;t[44]!==r||t[45]!==a.kind?(N=a.kind===`handed-off`&&(0,K.jsx)(B,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=N):N=t[46];let P;t[47]!==O||t[48]!==k||t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N?(P=(0,K.jsxs)(be,{children:[O,k,A,j,M,N]}),t[47]=O,t[48]=k,t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P):P=t[53];let F;t[54]!==D||t[55]!==P?(F=(0,K.jsxs)(ve,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[b,D,P]}),t[54]=D,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==r||t[58]!==n||t[59]!==F?(I=(0,K.jsx)(Ce,{open:n,onOpenChange:r,children:F}),t[57]=r,t[58]=n,t[59]=F,t[60]=I):I=t[60],I}function Ac(e){return Le(e,Cc)}function jc(e){return Le(e,Cc)}function Mc(e){return Le(e,Cc)}function Nc(e){return Le(e,Cc)}function Pc(e){let t=(0,W.c)(9),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Se,{children:(0,K.jsx)(di,{})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(ye,{children:(0,K.jsx)(fi,{})}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(xe,{asChild:!0,children:(0,K.jsx)(B,{variant:`outline`,children:`Cancel`})}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsxs)(ve,{children:[a,o,(0,K.jsxs)(be,{children:[s,(0,K.jsx)(B,{onClick:i,children:`Enable auto-sync`})]})]}),t[3]=i,t[4]=c);let l;return t[5]!==r||t[6]!==n||t[7]!==c?(l=(0,K.jsx)(Ce,{open:n,onOpenChange:r,children:c}),t[5]=r,t[6]=n,t[7]=c,t[8]=l):l=t[8],l}function Fc(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Ic(e){return{lines:e.split(`
9
- `).map(Fc)}}function Lc(e){return e.lines.map(e=>e.raw).join(`
10
- `)}function Rc(e){return e.lines.filter(e=>e.kind===`pattern`)}function zc(e,t){let n=t.trim();if(n.length===0)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function Bc(e,t,n){let r=n.trim();if(r.length===0)return Vc(e,t);let i=Uc(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Vc(e,t){let n=Uc(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Hc(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function Uc(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}var Wc=new Set;function Gc(e){for(let t of Wc)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function Kc(e){return Wc.add(e),()=>{Wc.delete(e)}}var qc=new Set;function Jc(e){for(let t of qc)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function Yc(e){return qc.add(e),()=>{qc.delete(e)}}export{ui as $,Ws as A,da as B,Ys as C,Zs as D,Xs as E,cs as F,bi as G,vi as H,ao as I,mi as J,xi as K,uo as L,Bs as M,Is as N,$s as O,ws as P,li as Q,va as R,Ks as S,Js as T,yi as U,Xi as V,Si as W,di as X,pi as Y,fi as Z,ic as _,zc as a,qr as at,Us as b,Ic as c,Me as ct,Lc as d,Oe as dt,ii as et,Pc as f,De as ft,oc as g,gc as h,Kc as i,Yr as it,Os as j,Qs as k,Vc as l,Ae as lt,vc as m,Yc as n,Xr as nt,Bc as o,Le as ot,kc as p,Ee as pt,hi as q,Gc as r,Jr as rt,Rc as s,Ne as st,Jc as t,ai as tt,Hc as u,ke as ut,rc as v,qs as w,Gs as x,tc as y,ua as z};