@inkeep/open-knowledge 0.0.0-dev-20260423193655 → 0.0.0-dev-20260423222123

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 (54) hide show
  1. package/dist/cli.mjs +4 -4
  2. package/dist/constants-By8TCEux.mjs +2 -0
  3. package/dist/index.d.mts +171 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-GFp7KZdK.mjs → init-BEYJxssT.mjs} +2 -2
  6. package/dist/init-Ca3oXZ2r.mjs +5 -0
  7. package/dist/init-Z_14KXK6.mjs +1 -0
  8. package/dist/init-t1KAo7Xn.mjs +1 -0
  9. package/dist/{loader-BVcvdP-0.mjs → loader-AGQcuG-5.mjs} +2 -2
  10. package/dist/loader-C_Bm1Mam.mjs +1 -0
  11. package/dist/{paths-BUMVS9lz.mjs → paths-BHyG1wt5.mjs} +2 -2
  12. package/dist/paths-OkgDVC2Q.mjs +1 -0
  13. package/dist/{preview-Brnmcivg.mjs → preview-BNr7OMR-.mjs} +2 -2
  14. package/dist/preview-BRaI8Ld9.mjs +1 -0
  15. package/dist/public/assets/{GraphPanel-D2JBM6nD.js → GraphPanel-nbYklZ9C.js} +2 -2
  16. package/dist/public/assets/McpConsentDialogBody-BTLTOjWM.js +1 -0
  17. package/dist/public/assets/SourceEditor-CEqBKP5f.js +3 -0
  18. package/dist/public/assets/button-BuHZQnlF.js +1 -0
  19. package/dist/public/assets/clipboard-ZQ-AEssh.js +36 -0
  20. package/dist/public/assets/dialog-C2kd-BJI.js +45 -0
  21. package/dist/public/assets/{dist-B2YW_ZWG.js → dist-1RA1Ivz5.js} +1 -1
  22. package/dist/public/assets/{dist-k7VFO_3K.js → dist-B90Tbt-G.js} +1 -1
  23. package/dist/public/assets/{dist-CQbn9Fxc.js → dist-BJa-wTjR.js} +1 -1
  24. package/dist/public/assets/{dist-X189qk_S.js → dist-CsuK1sJe.js} +1 -1
  25. package/dist/public/assets/{dist-Dm75HY2n.js → dist-D96Jocj9.js} +1 -1
  26. package/dist/public/assets/{dist-Bx72hMUu.js → dist-DQmXHI9Z.js} +1 -1
  27. package/dist/public/assets/{dist-DVEMi7bH.js → dist-yRCb9u34.js} +1 -1
  28. package/dist/public/assets/index-CGTgnYOo.css +1 -0
  29. package/dist/public/assets/index-DUIfxmm6.js +21 -0
  30. package/dist/public/assets/panel-CnHxXki4.js +240 -0
  31. package/dist/public/assets/toggle-group-BNTPJpXY.js +1 -0
  32. package/dist/public/index.html +11 -9
  33. package/dist/src-Cgf9w34f.mjs +1 -0
  34. package/dist/{start-BqNEuImZ.mjs → start-BJ0_AeSA.mjs} +2 -2
  35. package/dist/start-iuBWR-Az.mjs +1 -0
  36. package/package.json +1 -1
  37. package/dist/constants-4r2VtN6C.mjs +0 -2
  38. package/dist/init-B8_WS6Qm.mjs +0 -5
  39. package/dist/init-BeWtwX5r.mjs +0 -1
  40. package/dist/init-DcMUf7qi.mjs +0 -1
  41. package/dist/loader-DB5wT8Sb.mjs +0 -1
  42. package/dist/paths-CR8Zi3NJ.mjs +0 -1
  43. package/dist/preview-BJ9g28y6.mjs +0 -1
  44. package/dist/public/assets/SourceEditor-BKyWQ7mW.js +0 -3
  45. package/dist/public/assets/clipboard-CdKkyvy1.js +0 -80
  46. package/dist/public/assets/index-Bfb7OhfE.js +0 -21
  47. package/dist/public/assets/index-DHlHPMwL.css +0 -1
  48. package/dist/public/assets/panel-DTlG8EiB.js +0 -240
  49. package/dist/public/assets/toggle-group-BFNw1DkB.js +0 -1
  50. package/dist/src-CJ-J3AJB.mjs +0 -1
  51. package/dist/start-CGXYbLrK.mjs +0 -1
  52. /package/dist/public/assets/{go-IODVg4Ok.js → go-C_J4XPHz.js} +0 -0
  53. /package/dist/public/assets/{shell-COsTRxlr.js → shell-Cp2AENBi.js} +0 -0
  54. /package/dist/public/assets/{w3c-keyname-DLDSJn4E.js → w3c-keyname-DGDXsZN5.js} +0 -0
@@ -0,0 +1 @@
1
+ import{C as e,O as t,S as n,T as r,_ as i,a,b as o,c as s,f as c,g as l,i as u,l as d,n as f,o as p,p as m,r as h,s as g,u as _,w as v,x as y,y as b}from"./button-BuHZQnlF.js";import{$ as x,Bt as S,Gt as C,Ht as w,Kt as T,Lt as E,Vt as D,Wt as O,qt as k,zt as A}from"./panel-CnHxXki4.js";var j=y(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),M=y(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),N=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),P=y(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ee=t(e(),1),F=t(r(),1),I=v(),te=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ne=`VisuallyHidden`,L=F.forwardRef((e,t)=>(0,I.jsx)(m.span,{...e,ref:t,style:{...te,...e.style}}));L.displayName=ne;var R=L;function z(e){let t=e+`CollectionProvider`,[n,r]=c(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=F.useRef(null),a=F.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,u=l(s),d=F.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,I.jsx)(u,{ref:b(t,a(s,n).collectionRef),children:r})});d.displayName=s;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=l(f),h=F.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=F.useRef(null),s=b(t,o),c=a(f,n);return F.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(m,{[p]:``,ref:s,children:r})});h.displayName=f;function g(t){let n=a(e+`CollectionConsumer`,t);return F.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:d,ItemSlot:h},g,r]}var re=F.createContext(void 0);function B(e){let t=F.useContext(re);return e||t||`ltr`}function ie(e){let[t,n]=F.useState(void 0);return d(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var V=typeof document<`u`?F.useLayoutEffect:function(){};function H(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!H(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!H(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ae(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oe(e,t){let n=ae(e);return Math.round(t*n)/n}function U(e){let t=F.useRef(e);return V(()=>{t.current=e}),t}function se(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=F.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=F.useState(r);H(f,r)||p(r);let[m,h]=F.useState(null),[g,_]=F.useState(null),v=F.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=F.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,x=o||g,C=F.useRef(null),w=F.useRef(null),T=F.useRef(u),E=c!=null,D=U(c),O=U(i),k=U(l),A=F.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),S(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!H(T.current,t)&&(T.current=t,ee.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);V(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=F.useRef(!1);V(()=>(j.current=!0,()=>{j.current=!1}),[]),V(()=>{if(b&&(C.current=b),x&&(w.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,E]);let M=F.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=F.useMemo(()=>({reference:b,floating:x}),[b,x]),P=F.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=oe(N.floating,u.x),r=oe(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ae(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return F.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var ce=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:E({element:r.current,padding:i}).fn(n):r?E({element:r,padding:i}).fn(n):{}}}},le=(e,t)=>{let n=C(e);return{name:n.name,fn:n.fn,options:[e,t]}},ue=(e,t)=>{let n=T(e);return{name:n.name,fn:n.fn,options:[e,t]}},de=(e,t)=>({fn:O(e).fn,options:[e,t]}),fe=(e,t)=>{let n=D(e);return{name:n.name,fn:n.fn,options:[e,t]}},pe=(e,t)=>{let n=k(e);return{name:n.name,fn:n.fn,options:[e,t]}},me=(e,t)=>{let n=w(e);return{name:n.name,fn:n.fn,options:[e,t]}},he=(e,t)=>{let n=ce(e);return{name:n.name,fn:n.fn,options:[e,t]}},ge=`Arrow`,_e=F.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,I.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,I.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});_e.displayName=ge;var ve=_e,ye=`Popper`,[be,xe]=c(ye),[Se,Ce]=be(ye),we=e=>{let{__scopePopper:t,children:n}=e,[r,i]=F.useState(null);return(0,I.jsx)(Se,{scope:t,anchor:r,onAnchorChange:i,children:n})};we.displayName=ye;var Te=`PopperAnchor`,Ee=F.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ce(Te,n),o=F.useRef(null),s=b(t,o),c=F.useRef(null);return F.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,I.jsx)(m.div,{...i,ref:s})});Ee.displayName=Te;var W=`PopperContent`,[De,Oe]=be(W),ke=F.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...v}=e,y=Ce(W,n),[x,S]=F.useState(null),C=b(t,e=>S(e)),[w,T]=F.useState(null),E=ie(w),D=E?.width??0,O=E?.height??0,k=r+(o===`center`?``:`-`+o),j=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},M=Array.isArray(u)?u:[u],N=M.length>0,P={padding:j,boundary:M.filter(Ne),altBoundary:N},{refs:ee,floatingStyles:te,placement:ne,isPositioned:L,middlewareData:R}=se({strategy:`fixed`,placement:k,whileElementsMounted:(...e)=>A(...e,{animationFrame:g===`always`}),elements:{reference:y.anchor},middleware:[le({mainAxis:i+O,alignmentAxis:s}),l&&ue({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?de():void 0,...P}),l&&fe({...P}),pe({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&he({element:w,padding:c}),Pe({arrowWidth:D,arrowHeight:O}),h&&me({strategy:`referenceHidden`,...P})]}),[z,re]=Fe(ne),B=a(_);d(()=>{L&&B?.()},[L,B]);let V=R.arrow?.x,H=R.arrow?.y,ae=R.arrow?.centerOffset!==0,[oe,U]=F.useState();return d(()=>{x&&U(window.getComputedStyle(x).zIndex)},[x]),(0,I.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:L?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,I.jsx)(De,{scope:n,placedSide:z,onArrowChange:T,arrowX:V,arrowY:H,shouldHideArrow:ae,children:(0,I.jsx)(m.div,{"data-side":z,"data-align":re,...v,ref:C,style:{...v.style,animation:L?void 0:`none`}})})})});ke.displayName=W;var Ae=`PopperArrow`,je={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Me=F.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Oe(Ae,n),a=je[i.placedSide];return(0,I.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,I.jsx)(ve,{...r,ref:t,style:{...r.style,display:`block`}})})});Me.displayName=Ae;function Ne(e){return e!==null}var Pe=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Fe(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Fe(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Ie=we,Le=Ee,Re=ke,ze=Me,Be=`rovingFocusGroup.onEntryFocus`,Ve={bubbles:!1,cancelable:!0},G=`RovingFocusGroup`,[He,Ue,We]=z(G),[Ge,Ke]=c(G,[We]),[qe,Je]=Ge(G),Ye=F.forwardRef((e,t)=>(0,I.jsx)(He.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(He.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Xe,{...e,ref:t})})}));Ye.displayName=G;var Xe=F.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,h=F.useRef(null),g=b(t,h),v=B(o),[y,x]=s({prop:c,defaultProp:l??null,onChange:u,caller:G}),[S,C]=F.useState(!1),w=a(d),T=Ue(n),E=F.useRef(!1),[D,O]=F.useState(0);return F.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(Be,w),()=>e.removeEventListener(Be,w)},[w]),(0,I.jsx)(qe,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:y,onItemFocus:F.useCallback(e=>x(e),[x]),onItemShiftTab:F.useCallback(()=>C(!0),[]),onFocusableItemAdd:F.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:F.useCallback(()=>O(e=>e-1),[]),children:(0,I.jsx)(m.div,{tabIndex:S||D===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:`none`,...e.style},onMouseDown:_(e.onMouseDown,()=>{E.current=!0}),onFocus:_(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(Be,Ve);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);nt([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),f)}}E.current=!1}),onBlur:_(e.onBlur,()=>C(!1))})})}),Ze=`RovingFocusGroupItem`,Qe=F.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=p(),l=a||c,u=Je(Ze,n),d=u.currentTabStopId===l,f=Ue(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=u;return F.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),(0,I.jsx)(He.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,I.jsx)(m.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:_(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:_(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:_(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=tt(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?rt(n,r+1):n.slice(r+1)}setTimeout(()=>nt(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:v!=null}):o})})});Qe.displayName=Ze;var $e={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function et(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function tt(e,t,n){let r=et(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return $e[r]}function nt(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var it=Ye,at=Qe,ot=`Toggle`,st=F.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,c]=s({prop:n,onChange:i,defaultProp:r??!1,caller:ot});return(0,I.jsx)(m.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:_(e.onClick,()=>{e.disabled||c(!o)})})});st.displayName=ot;var K=`ToggleGroup`,[ct,lt]=c(K,[Ke]),ut=Ke(),dt=F.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,I.jsx)(mt,{...r,ref:t});if(n===`multiple`)return(0,I.jsx)(ht,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${K}\``)});dt.displayName=K;var[ft,pt]=ct(K),mt=F.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,c]=s({prop:n,defaultProp:r??``,onChange:i,caller:K});return(0,I.jsx)(ft,{scope:e.__scopeToggleGroup,type:`single`,value:F.useMemo(()=>o?[o]:[],[o]),onItemActivate:c,onItemDeactivate:F.useCallback(()=>c(``),[c]),children:(0,I.jsx)(vt,{...a,ref:t})})}),ht=F.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,c]=s({prop:n,defaultProp:r??[],onChange:i,caller:K}),l=F.useCallback(e=>c((t=[])=>[...t,e]),[c]),u=F.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,I.jsx)(ft,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:l,onItemDeactivate:u,children:(0,I.jsx)(vt,{...a,ref:t})})});dt.displayName=K;var[gt,_t]=ct(K),vt=F.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=ut(n),u=B(o),d={role:`group`,dir:u,...c};return(0,I.jsx)(gt,{scope:n,rovingFocus:i,disabled:r,children:i?(0,I.jsx)(it,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,I.jsx)(m.div,{...d,ref:t})}):(0,I.jsx)(m.div,{...d,ref:t})})}),q=`ToggleGroupItem`,yt=F.forwardRef((e,t)=>{let n=pt(q,e.__scopeToggleGroup),r=_t(q,e.__scopeToggleGroup),i=ut(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=F.useRef(null);return r.rovingFocus?(0,I.jsx)(at,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,I.jsx)(bt,{...s,ref:t})}):(0,I.jsx)(bt,{...s,ref:t})});yt.displayName=q;var bt=F.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=pt(q,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,I.jsx)(st,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),xt=dt,St=yt,[J,Ct]=c(`Tooltip`,[xe]),Y=xe(),wt=`TooltipProvider`,Tt=700,Et=`tooltip.open`,[Dt,Ot]=J(wt),kt=e=>{let{__scopeTooltip:t,delayDuration:n=Tt,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=F.useRef(!0),s=F.useRef(!1),c=F.useRef(0);return F.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,I.jsx)(Dt,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:F.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:F.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:F.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};kt.displayName=wt;var X=`Tooltip`,[At,Z]=J(X),jt=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=Ot(X,e.__scopeTooltip),u=Y(t),[d,f]=F.useState(null),m=p(),h=F.useRef(0),g=o??l.disableHoverableContent,_=c??l.delayDuration,v=F.useRef(!1),[y,b]=s({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Et))):l.onClose(),a?.(e)},caller:X}),x=F.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=F.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=F.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=F.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return F.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,I.jsx)(Ie,{...u,children:(0,I.jsx)(At,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:F.useCallback(()=>{l.isOpenDelayedRef.current?w():S()},[l.isOpenDelayedRef,w,S]),onTriggerLeave:F.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};jt.displayName=X;var Mt=`TooltipTrigger`,Nt=F.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Z(Mt,n),a=Ot(Mt,n),o=Y(n),s=b(t,F.useRef(null),i.onTriggerChange),c=F.useRef(!1),l=F.useRef(!1),u=F.useCallback(()=>c.current=!1,[]);return F.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,I.jsx)(Le,{asChild:!0,...o,children:(0,I.jsx)(m.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:_(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:_(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:_(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:_(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:_(e.onBlur,i.onClose),onClick:_(e.onClick,i.onClose)})})});Nt.displayName=Mt;var Pt=`TooltipPortal`,[Ft,It]=J(Pt,{forceMount:void 0}),Lt=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Z(Pt,t);return(0,I.jsx)(Ft,{scope:t,forceMount:n,children:(0,I.jsx)(g,{present:n||a.open,children:(0,I.jsx)(h,{asChild:!0,container:i,children:r})})})};Lt.displayName=Pt;var Q=`TooltipContent`,Rt=F.forwardRef((e,t)=>{let n=It(Q,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Z(Q,e.__scopeTooltip);return(0,I.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,I.jsx)(Ut,{side:i,...a,ref:t}):(0,I.jsx)(zt,{side:i,...a,ref:t})})}),zt=F.forwardRef((e,t)=>{let n=Z(Q,e.__scopeTooltip),r=Ot(Q,e.__scopeTooltip),i=F.useRef(null),a=b(t,i),[o,s]=F.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=F.useCallback(()=>{s(null),d(!1)},[d]),p=F.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=qt(r,Kt(r,n.getBoundingClientRect())),a=Jt(t.getBoundingClientRect());s(Xt([...i,...a])),d(!0)},[d]);return F.useEffect(()=>()=>f(),[f]),F.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]),F.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=!Yt(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,I.jsx)(Ut,{...e,ref:a})}),[Bt,Vt]=J(X,{isInside:!1}),Ht=i(`TooltipContent`),Ut=F.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Z(Q,n),l=Y(n),{onClose:d}=c;return F.useEffect(()=>(document.addEventListener(Et,d),()=>document.removeEventListener(Et,d)),[d]),F.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,d]),(0,I.jsx)(u,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,I.jsxs)(Re,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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,I.jsx)(Ht,{children:r}),(0,I.jsx)(Bt,{scope:n,isInside:!0,children:(0,I.jsx)(R,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Rt.displayName=Q;var Wt=`TooltipArrow`,Gt=F.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Y(n);return Vt(Wt,n).isInside?null:(0,I.jsx)(ze,{...i,...r,ref:t})});Gt.displayName=Wt;function Kt(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 qt(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 Jt(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 Yt(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 Xt(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)),Zt(t)}function Zt(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 Qt=kt,$t=jt,en=Nt,tn=Lt,nn=Rt,rn=Gt,$=n();function an(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,I.jsx)(Qt,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function on(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,I.jsx)($t,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function sn(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,I.jsx)(en,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function cn(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=f(`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,I.jsx)(rn,{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,I.jsx)(tn,{children:(0,I.jsxs)(nn,{"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}function ln(e){switch(e.kind){case`doc`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:return`missing`}}function un(e,t){let n=x(e,t);return{resolvedTarget:n,hashDocName:n.target,displayState:ln(n)}}var dn=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`}}),fn=F.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function pn(e){let t=(0,$.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,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let p=d,m;t[10]===r?m=t[11]:(m=f(`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 g;t[17]!==n||t[18]!==h?(g=(0,I.jsx)(fn.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==c?(_=(0,I.jsx)(xt,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:p,className:m,...i,children:g}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=p,t[25]=m,t[26]=g,t[27]=c,t[28]=_):_=t[28],_}function mn(e){let t=(0,$.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=F.use(fn),u=l.variant||s,d=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=f(`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`,dn({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 h;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==m?(h=(0,I.jsx)(St,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}export{j as S,B as _,cn as a,N as b,at as c,Le as d,ze as f,ie as g,xe as h,on as i,it as l,Ie as m,mn as n,an as o,Re as p,un as r,sn as s,pn as t,Ke as u,z as v,M as x,P as y};
@@ -20,15 +20,17 @@
20
20
  nothing for the formatter to reindent.
21
21
  -->
22
22
  <script>(() => { let mode = 'wysiwyg'; try { const raw = localStorage.getItem('ok-editor-mode-v1'); if (raw === 'wysiwyg' || raw === 'source') mode = raw; } catch {} window.__OK_EDITOR_MODE__ = mode; })();</script>
23
- <script type="module" crossorigin src="/assets/index-Bfb7OhfE.js"></script>
24
- <link rel="modulepreload" crossorigin href="/assets/w3c-keyname-DLDSJn4E.js">
25
- <link rel="modulepreload" crossorigin href="/assets/panel-DTlG8EiB.js">
26
- <link rel="modulepreload" crossorigin href="/assets/dist-B2YW_ZWG.js">
27
- <link rel="modulepreload" crossorigin href="/assets/dist-k7VFO_3K.js">
28
- <link rel="modulepreload" crossorigin href="/assets/dist-CQbn9Fxc.js">
29
- <link rel="modulepreload" crossorigin href="/assets/clipboard-CdKkyvy1.js">
30
- <link rel="modulepreload" crossorigin href="/assets/toggle-group-BFNw1DkB.js">
31
- <link rel="stylesheet" crossorigin href="/assets/index-DHlHPMwL.css">
23
+ <script type="module" crossorigin src="/assets/index-DUIfxmm6.js"></script>
24
+ <link rel="modulepreload" crossorigin href="/assets/button-BuHZQnlF.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/w3c-keyname-DGDXsZN5.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/dist-1RA1Ivz5.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/dist-B90Tbt-G.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/panel-CnHxXki4.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/dist-BJa-wTjR.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/dialog-C2kd-BJI.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/clipboard-ZQ-AEssh.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/toggle-group-BNTPJpXY.js">
33
+ <link rel="stylesheet" crossorigin href="/assets/index-CGTgnYOo.css">
32
34
  </head>
33
35
 
34
36
  <body class="antialiased">
@@ -0,0 +1 @@
1
+ import"./init-Ca3oXZ2r.mjs";import"./loader-AGQcuG-5.mjs";export{};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-4r2VtN6C.mjs";import{O as t}from"./src-CQw-HNNM.mjs";import{Command as n}from"commander";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o}from"node:fs";import{join as s}from"node:path";import{spawn as c}from"node:child_process";function l(){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 u(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 d(e){i(e.lockDir)||a(e.lockDir,{recursive:!0});let t=o(s(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??c,{PORT:u,...d}=process.env,f=l();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{r(t)}catch{}}}async function f(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 p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>new Promise(t=>setTimeout(t,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 m(e){let{config:n,cwd: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:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./src-DB3pnkMU.mjs`),{resolveContentDir:y}=await import(`./paths-CR8Zi3NJ.mjs`),b=e.log??g(`start`),x=y(n,r);s(x)||(c(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!s(l(r,t)),C=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-DcMUf7qi.mjs`),t=e(r);return S||t.created.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,t),E=n.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-CfwaLBtR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:r,contentRoot:n.content.dir,port:n.server.port,host:n.server.host,quiet:!1,debounce:n.persistence.debounceMs,maxDebounce:n.persistence.maxDebounceMs,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:C,ensureProjectGitFn:i?void 0:()=>h(r),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!a)try{d({lockDir:t,cwd:r,spawn:e.spawn}),b.info({reason:D.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 D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>new Promise(t=>setTimeout(t,e)),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(r){return new n(`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(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async n=>{let{renderBanner:i}=await import(`./banner-C51OKbnz.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-xJqYhQcY.mjs`),l=r(),u=process.cwd();n.port!==void 0&&(l.server.port=Number(n.port)),n.host!==void 0&&(l.server.host=n.host);let d;try{d=await m({config:l,cwd:u,skipAutoInit:n.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./src-DB3pnkMU.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let f=!1,p=async e=>{if(!f){f=!0,console.log(a(`\nShutting down (${e})...`));try{await d.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{p(`SIGINT`)}),process.once(`SIGTERM`,()=>{p(`SIGTERM`)});let h=`http://${l.server.host}:${d.port}`,g=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${d.port}`:void 0,_=d.resolvedUiPort,v=_!==null&&_>0?`http://${l.server.host}:${_}`:h;console.log(i({name:`open-knowledge`,version:e,localUrl:v,apiUrl:v===h?void 0:h,networkUrl:g})),d.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let y={"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`};d.ready.then(async()=>{if(d.degraded.length>0){console.log();for(let e of d.degraded){let t=y[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(d.didAutoInit||d.didGitInit)if(d.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),d.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-BJ9g28y6.mjs`),n=e({projectDir:u,contentDir:d.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(n.open){let{openBrowser:e}=await import(`./open-browser-CfwaLBtR.mjs`);e(v)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
2
- //# sourceMappingURL=start-BqNEuImZ.mjs.map
1
+ import{a as e}from"./constants-By8TCEux.mjs";import{O as t}from"./src-CQw-HNNM.mjs";import{Command as n}from"commander";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o}from"node:fs";import{join as s}from"node:path";import{spawn as c}from"node:child_process";function l(){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 u(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 d(e){i(e.lockDir)||a(e.lockDir,{recursive:!0});let t=o(s(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??c,{PORT:u,...d}=process.env,f=l();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{r(t)}catch{}}}async function f(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 p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>new Promise(t=>setTimeout(t,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 m(e){let{config:n,cwd: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:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./src-DB3pnkMU.mjs`),{resolveContentDir:y}=await import(`./paths-OkgDVC2Q.mjs`),b=e.log??g(`start`),x=y(n,r);s(x)||(c(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!s(l(r,t)),C=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-t1KAo7Xn.mjs`),t=e(r);return S||t.created.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,t),E=n.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-CfwaLBtR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:r,contentRoot:n.content.dir,port:n.server.port,host:n.server.host,quiet:!1,debounce:n.persistence.debounceMs,maxDebounce:n.persistence.maxDebounceMs,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:C,ensureProjectGitFn:i?void 0:()=>h(r),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!a)try{d({lockDir:t,cwd:r,spawn:e.spawn}),b.info({reason:D.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 D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>new Promise(t=>setTimeout(t,e)),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(r){return new n(`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(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async n=>{let{renderBanner:i}=await import(`./banner-C51OKbnz.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-xJqYhQcY.mjs`),l=r(),u=process.cwd();n.port!==void 0&&(l.server.port=Number(n.port)),n.host!==void 0&&(l.server.host=n.host);let d;try{d=await m({config:l,cwd:u,skipAutoInit:n.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./src-DB3pnkMU.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let f=!1,p=async e=>{if(!f){f=!0,console.log(a(`\nShutting down (${e})...`));try{await d.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{p(`SIGINT`)}),process.once(`SIGTERM`,()=>{p(`SIGTERM`)});let h=`http://${l.server.host}:${d.port}`,g=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${d.port}`:void 0,_=d.resolvedUiPort,v=_!==null&&_>0?`http://${l.server.host}:${_}`:h;console.log(i({name:`open-knowledge`,version:e,localUrl:v,apiUrl:v===h?void 0:h,networkUrl:g})),d.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let y={"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`};d.ready.then(async()=>{if(d.degraded.length>0){console.log();for(let e of d.degraded){let t=y[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(d.didAutoInit||d.didGitInit)if(d.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),d.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-BRaI8Ld9.mjs`),n=e({projectDir:u,contentDir:d.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(n.open){let{openBrowser:e}=await import(`./open-browser-CfwaLBtR.mjs`);e(v)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
2
+ //# sourceMappingURL=start-BJ0_AeSA.mjs.map
@@ -0,0 +1 @@
1
+ import{o as e}from"./start-BJ0_AeSA.mjs";export{e as startCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.0.0-dev-20260423193655",
3
+ "version": "0.0.0-dev-20260423222123",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- import"./src-CQw-HNNM.mjs";var e=`0.0.0-dev-20260423193655`;const t=`AGENTS.md`,n=`config.yml`,r=`cache`,i=e,a=`open-knowledge`;export{i as a,a as i,r as n,n as r,t};
2
- //# sourceMappingURL=constants-4r2VtN6C.mjs.map
@@ -1,5 +0,0 @@
1
- import{i as e}from"./constants-4r2VtN6C.mjs";import{O as t}from"./src-CQw-HNNM.mjs";import{n,t as r}from"./src-skP-DoiW.mjs";import{o as i,s as a}from"./init-GFp7KZdK.mjs";import{t as o}from"./preview-Brnmcivg.mjs";import{t as s}from"./is-object-DaHwJLOe.mjs";import{Command as c}from"commander";import{existsSync as l,mkdirSync as u,readFileSync as d,writeFileSync as f}from"node:fs";import{homedir as p}from"node:os";import{basename as m,dirname as h,isAbsolute as g,join as _,posix as v,relative as y,resolve as b,sep as x,win32 as S}from"node:path";import{parse as C,stringify as w}from"smol-toml";const T=[`claude`,`claude-desktop`,`cursor`,`vscode`,`windsurf`,`codex`],E=[`@inkeep/open-knowledge`,`mcp`],ee={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function D(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=b(e);if(m(t)===`cli.mjs`&&m(h(t))===`dist`)return t;let n=t.split(x),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return _(i.length===0?x:i.join(x),`packages`,`cli`,`dist`,`cli.mjs`)}function O(e={}){return e.mode===`dev`?{command:`node`,args:[D(e.cliEntryPath),`mcp`],env:{...ee}}:{command:`npx`,args:[...E]}}function k(e){return e===`win32`?S:v}function A(e={}){let t=e.platformName??process.platform,n=e.home??p(),r=e.env??process.env,i=k(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function j(e={}){let t=e.platformName??process.platform,n=e.home??p();return k(t).join(n,`.claude.json`)}function M(e={}){let t=e.platformName??process.platform,n=e.home??p(),r=e.env??process.env;if(t===`darwin`)return v.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??S.join(n,`AppData`,`Roaming`);return S.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function N(e={}){let t=e.platformName??process.platform,n=e.home??p();return k(t).join(n,`.cursor`,`mcp.json`)}function P(e={}){return k(e.platformName??process.platform).join(A(e),`Code`,`User`,`mcp.json`)}function F(e={}){let t=e.platformName??process.platform,n=e.home??p();return k(t).join(n,`.codeium`,`windsurf`,`mcp_config.json`)}function I(e={}){let t=e.platformName??process.platform,n=e.home??p();return(e.env??process.env).CODEX_HOME??k(t).join(n,`.codex`)}function L(e={}){return k(e.platformName??process.platform).join(I(e),`config.toml`)}function R(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>R(e,t[n]));if(s(e)&&s(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((e,t)=>e===r[t])&&n.every(n=>R(e[n],t[n]))}return!1}function z(e,t){return Object.entries(t).every(([t,n])=>R(e[t],n))}function B(e,t){return{...e,...t}}function V(e){return{...e,isCompatible(t,n,r){return z(t,e.buildEntry(n,r))},mergeManagedFields(t,n,r){return B(t,e.buildEntry(n,r))}}}const H={claude:V({id:`claude`,label:`Claude Code`,configPath:(e,t)=>j({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>e,buildEntry:(e,t)=>O(t),scope:`global`,detectPath:(e,t)=>_(t??p(),`.claude`),legacyProjectConfigPath:e=>_(e,`.mcp.json`),instructionsPath:e=>_(e,`CLAUDE.md`)}),"claude-desktop":V({id:`claude-desktop`,label:`Claude Desktop`,configPath:(e,t)=>M({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>e,buildEntry:(e,t)=>O(t),scope:`global`,detectPath:(e,t)=>h(M({home:t}))}),cursor:V({id:`cursor`,label:`Cursor`,configPath:(e,t)=>N({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>e,buildEntry:(e,t)=>O(t),scope:`global`,detectPath:(e,t)=>h(N({home:t})),legacyProjectConfigPath:e=>_(e,`.cursor`,`mcp.json`)}),vscode:V({id:`vscode`,label:`VS Code`,configPath:(e,t)=>P({home:t}),format:`json`,topLevelKey:`servers`,serverName:()=>e,buildEntry:(e,t)=>({type:`stdio`,...O(t)}),scope:`global`,detectPath:(e,t)=>h(P({home:t})),legacyProjectConfigPath:e=>_(e,`.vscode`,`mcp.json`)}),windsurf:V({id:`windsurf`,label:`Windsurf`,configPath:(e,t)=>F({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>e,buildEntry:(e,t)=>O(t),scope:`global`,detectPath:(e,t)=>h(F({home:t}))}),codex:V({id:`codex`,label:`Codex`,configPath:(e,t)=>L({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>e,buildEntry:(e,t)=>O(t),scope:`global`,detectPath:(e,t)=>h(L({home:t})),legacyProjectConfigPath:e=>_(e,`.codex`,`config.toml`)})};function U(e){let t=e.filter(e=>!(e in H));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${T.join(`, `)}`);return e.map(e=>H[e])}function W(e){if(!l(e))return{};let t=d(e,`utf-8`).trim();if(t===``)return{};try{let n=JSON.parse(t);if(s(n))return n;throw Error(`${e} root must be a JSON object`)}catch(t){throw t instanceof SyntaxError?Error(`${e} contains invalid JSON: ${t.message}`):t}}function G(e){if(!l(e))return{};let t=d(e,`utf-8`).trim();if(t===``)return{};try{let n=C(t);if(s(n))return n;throw Error(`${e} root must be a TOML table`)}catch(t){throw Error(`${e} contains invalid TOML: ${t instanceof Error?t.message:String(t)}`)}}function K(e,t){u(h(e),{recursive:!0}),f(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function q(e,t){u(h(e),{recursive:!0});let n=w(t);f(e,n.endsWith(`
2
- `)?n:`${n}\n`,`utf-8`)}const J=`0.0.1`,Y=`open-knowledge-ui`;function te(e,t={}){let n=_(e,`.claude`,`launch.json`),r=t.mode===`dev`?{name:Y,runtimeExecutable:`node`,runtimeArgs:[D(t.cliEntryPath),`ui`],port:3e3}:{name:Y,runtimeExecutable:`npx`,runtimeArgs:[`@inkeep/open-knowledge`,`ui`],port:3e3};try{if(!l(n))return u(h(n),{recursive:!0}),f(n,`${JSON.stringify({version:J,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let e=d(n,`utf-8`).trim(),t=e?JSON.parse(e):{};if(!s(t))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let i=Array.isArray(t.configurations)?t.configurations:[],a=i.findIndex(e=>s(e)&&e.name===Y);a>=0?i[a]=r:i.push(r);let o={...t,version:t.version??J,configurations:i};return f(n,`${JSON.stringify(o,null,2)}\n`,`utf-8`),{action:a>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function X(e,t,n){try{return l(e.detectPath?.(t,n)??h(e.configPath(t,n)))}catch{return!1}}function ne(e,t,n,r){let i=e.serverName(t),a;try{a=e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:i,error:t instanceof Error?t.message:String(t)}}if(!X(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:a,serverName:i};let o;try{o=e.format===`toml`?G(a):W(a)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:a,serverName:i,error:t instanceof Error?t.message:String(t)}}let s=o[e.topLevelKey]??{},c=s[i],l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:a,serverName:i,error:t instanceof Error?t.message:String(t)}}let u={...o,[e.topLevelKey]:{...s,[i]:l}};try{e.format===`toml`?q(a,u):K(a,u)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:a,serverName:i,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:c===void 0?`written`:`overwritten`,configPath:a,serverName:i}}function re(e,t){let n=e.legacyProjectConfigPath?.(t);if(!(!n||!l(n)))return{editorId:e.id,label:e.label,path:n}}async function Z(e={}){let t=b(e.cwd??process.cwd()),r={mode:e.devMcp?`dev`:`published`,cliEntryPath:e.cliEntryPath},o=await n(t),s;try{s=i(t)}catch(n){let r=H.claude.configPath(t,e.home);return{contentCreated:[],contentSkipped:[],editors:[],legacyProjectConfigs:[],rootInstructions:[],didGitInit:o.didInit,mcpAction:`failed`,mcpPath:r,mcpError:`Content scaffolding failed: ${n instanceof Error?n.message:String(n)}`}}let c=U(e.editors??$(t,e.home)),l=c.filter(n=>X(n,t,e.home)),u=[];for(let n of c){if(e.mcp===!1){let r=``;try{r=n.configPath(t,e.home)}catch{}u.push({editorId:n.id,label:n.label,action:`skipped-flag`,configPath:r,serverName:n.serverName(t)});continue}u.push(ne(n,t,r,e.home))}let d=e.mcp===!1?[]:l.map(e=>re(e,t)).filter(e=>e!==void 0),f=l.some(e=>e.id===`claude`)&&e.mcp!==!1?te(t,r):void 0,p=l.map(e=>e.instructionsPath?.(t)).filter(e=>e!==void 0).map(e=>g(e)?y(t,e):e),m=e.rootInstructions===!1?[]:a(t,!0,p),h=e.mcp===!1?`skipped-flag`:`skipped-missing`,_=u.find(e=>e.editorId===`claude`)??u[0]??{action:h,configPath:H.claude.configPath(t,e.home)};return{contentCreated:s.created,contentSkipped:s.skipped,editors:u,legacyProjectConfigs:d,rootInstructions:m,launchJson:f,didGitInit:o.didInit,mcpAction:_.action,mcpPath:_.configPath,mcpError:`error`in _?_.error:void 0}}function Q(e,n){let r=[],i=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),a=e.editors.some(e=>e.action===`failed`),s=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),c=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`),l=e=>{let t=e.configPath.startsWith(n)?y(n,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${t} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${t} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${t} FAILED: ${e.error}`}};e.didGitInit&&r.push(`Initialized git repo at ${n}/.git/ (default branch: main)`);let u=_(n,t);if(e.contentCreated.length>0?(r.push(`Content scaffolded at ${u}/`),r.push(` Created: ${e.contentCreated.join(`, `)}`)):r.push(`Content already present at ${u}/`),e.contentSkipped.length>0&&r.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),r.push(``),e.mcpError&&e.editors.length===0)r.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)r.push(`MCP server configuration:`),r.push(e.mcpAction===`skipped-flag`?` MCP config not written — use without --no-mcp to configure editors`:` No supported editor config directories detected; skipped MCP registration`);else if(s)r.push(`MCP config not written — use without --no-mcp to configure editors`);else if(c)r.push(`MCP server configuration:`),r.push(` No supported editor config directories detected; skipped MCP registration`);else{r.push(`MCP server configuration:`);for(let t of e.editors){let i=t.configPath.startsWith(n)?y(n,t.configPath):t.configPath.replace(/^\/Users\/[^/]+/,`~`),a=t.serverName===`open-knowledge`?``:` (${t.serverName})`,o=` `.repeat(Math.max(1,14-t.label.length)),s=t.editorId===`claude-desktop`&&(t.action===`written`||t.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(t.action){case`written`:r.push(` ${t.label}${o}${i} registered${a}${s}`);break;case`overwritten`:r.push(` ${t.label}${o}${i} updated${a}${s}`);break;case`skipped-missing`:r.push(` ${t.label}${o}${i} config root missing; skipped`);break;case`failed`:r.push(` ${t.label}${o}${i} FAILED: ${t.error}`);break;case`skipped-flag`:break}t.editorId===`claude`&&e.launchJson&&r.push(l(e.launchJson))}}if(a&&(r.push(``),r.push(`For failed editors, add the MCP server entry manually. See:`),r.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){r.push(``),r.push(`Legacy project MCP configs detected:`);for(let t of e.legacyProjectConfigs)r.push(` ${t.label} ${y(n,t.path)}`);r.push(` These project-local files may override the new global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.rootInstructions.length>0){let t=e.rootInstructions.filter(e=>e.action!==`skipped-symlink`);if(t.length>0){r.push(``),r.push(`Root instructions:`);for(let e of t){let t=e.path.startsWith(n)?y(n,e.path):e.path,i=` `.repeat(Math.max(1,14-e.file.length));switch(e.action){case`created`:r.push(` ${e.file}${i}${t} created`);break;case`appended`:r.push(` ${e.file}${i}${t} appended Open Knowledge section`);break;case`replaced`:r.push(` ${e.file}${i}${t} replaced Open Knowledge section`);break;case`skipped-existing`:r.push(` ${e.file}${i}${t} already has Open Knowledge section`);break}}}}if(e.preview?(r.push(``),r.push(o(e.preview,n))):e.previewWarning&&(r.push(``),r.push(`Content preview unavailable: ${e.previewWarning}`)),i){let t=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.label);r.push(``),r.push(`Next steps:`),r.push(` 1. Open your editor (${t.join(` / `)})`),r.push(` 2. Approve the MCP server when prompted`),r.push(` 3. The knowledge base is ready — use the three workflow tools:`),r.push(` - mcp__open-knowledge__init-content — bootstrap articles from the codebase`),r.push(` - mcp__open-knowledge__ingest — capture an external source`),r.push(` - mcp__open-knowledge__research — gather sources and write findings`)}return r.join(`
3
- `)}function $(e,t){let n=[];for(let r of T)X(H[r],e,t)&&n.push(r);return n}function ie(){return new c(`init`).description(`Scaffold ${t}/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the ${t}/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).action(async e=>{let t=process.cwd(),n;try{n=await Z({cwd:t,mcp:e.mcp,devMcp:e.devMcp})}catch(e){if(e instanceof r){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
4
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-BJ9g28y6.mjs`),{loadConfig:r}=await import(`./loader-DB5wT8Sb.mjs`),{resolveContentDir:i}=await import(`./paths-CR8Zi3NJ.mjs`),{config:a}=r(t),o=i(a,t);n.preview=e({projectDir:t,contentDir:o,include:a.content.include,exclude:a.content.exclude})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${Q(n,t)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Z as i,Q as n,ie as r,$ as t};
5
- //# sourceMappingURL=init-B8_WS6Qm.mjs.map
@@ -1 +0,0 @@
1
- import{i as e,n as t,r as n,t as r}from"./init-B8_WS6Qm.mjs";export{r as detectInstalledEditors,t as formatInitResult,n as initCommand,e as runInit};
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./init-GFp7KZdK.mjs";export{o as CLAUDE_MD_SECTION,n as OK_MARKER_BEGIN,i as OK_MARKER_END,t as PREVIEW_GUIDANCE,e as ensureOkGitignoredAtRoot,r as initContent,a as upsertRootInstructions};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-BVcvdP-0.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./paths-BUMVS9lz.mjs";export{t as resolveContentDir,e as resolveLockDir};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-Brnmcivg.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DVEMi7bH.js","assets/dist-B2YW_ZWG.js","assets/panel-DTlG8EiB.js","assets/w3c-keyname-DLDSJn4E.js","assets/dist-CQbn9Fxc.js","assets/dist-X189qk_S.js","assets/dist-Dm75HY2n.js","assets/dist-k7VFO_3K.js","assets/dist-Bx72hMUu.js"])))=>i.map(i=>d[i]);
2
- import{Cn as e,Kn as t,Sn as n,T as r,X as i,Y as a,Z as o,hn as s,v as c,vn as l}from"./panel-DTlG8EiB.js";import{A as u,Ct as d,F as f,G as p,I as m,J as h,K as g,L as _,P as v,Q as ee,St as y,Tt as b,_ as te,_t as x,a as S,bt as C,c as ne,d as re,et as ie,f as ae,g as oe,gt as w,h as T,ht as E,kt as D,l as se,m as ce,p as le,pt as ue,q as de,s as fe,t as pe,u as me,v as he,vt as O,wt as ge,xt as k,yt as A}from"./clipboard-CdKkyvy1.js";import{At as _e,Dt as j,Et as ve,N as M,Nt as N,Pt as P,Q as ye,Tt as F,Y as I,Z as L,a as R,bt as z,ft as B,jt as V,lt as be,q as H,wt as xe}from"./dist-B2YW_ZWG.js";var U=t(e(),1),Se=s(),Ce=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:C(this.yanchor),yhead:C(this.yhead)}}static fromJSON(t){return new e(O(t.yanchor),O(t.yhead))}},we=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new E(e)}toYPos(e,t=0){return A(this.ytext,e,t)}fromYPos(e){let t=x(O(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new Ce(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?F.cursor(n.pos,n.assoc):F.range(t.pos,n.pos)}},W=j.define({combine(e){return e[e.length-1]}}),G=z.define(),Te=class{constructor(e){this.view=e,this.conf=e.state.facet(W),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[G.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(G)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
3
- `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},Ee=L.fromClass(Te),De=I.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),Oe=z.define(),ke=class extends ye{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return k(`span`,[d(`class`,`cm-ySelectionCaret`),d(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[y(`⁠`),k(`div`,[d(`class`,`cm-ySelectionCaretDot`)]),y(`⁠`),k(`div`,[d(`class`,`cm-ySelectionInfo`)],[y(this.name)]),y(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},Ae=class{constructor(e){this.conf=e.state.facet(W),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[Oe.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=_e.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:O(a.cursor.anchor),s=a.cursor==null?null:O(a.cursor.head);if(i!=null){let e=A(t,i.anchor),n=A(t,i.head);(a.cursor==null||!w(o,e)||!w(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=x(s.anchor,n),l=x(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,p=b(c.index,l.index),m=ge(c.index,l.index),h=e.view.state.doc.lineAt(p),g=e.view.state.doc.lineAt(m);if(h.number===g.number)i.push({from:p,to:m,value:H.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:p,to:h.from+h.length,value:H.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:g.from,to:m,value:H.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=h.number+1;t<g.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:H.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:H.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new ke(u,d)})})}),this.decorations=H.set(i,!0)}},je=L.fromClass(Ae,{decorations:e=>e.decorations}),Me=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},K=j.define({combine(e){return e[e.length-1]}});z.define();var Ne=class{constructor(e){this.view=e,this.conf=e.state.facet(K),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(W),this._beforeChangeSelection=null,this._mux=ue(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[I.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(G)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Pe=L.fromClass(Ne),Fe=({state:e,dispatch:t})=>e.facet(K).undo()||!0,Ie=({state:e,dispatch:t})=>e.facet(K).redo()||!0,Le=(e,t,{undoManager:n=new E(e)}={})=>{let r=new we(e,t),i=[W.of(r),Ee];return t&&i.push(De,je),n!==!1&&i.push(K.of(new Me(n)),Pe,I.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Fe(t):e.inputType===`historyRedo`?Ie(t):!1}})),i},Re=[R.of({name:`javascript`,alias:[`js`,`jsx`],extensions:[`js`,`mjs`,`cjs`,`jsx`],load:async()=>ce({jsx:!0})}),R.of({name:`typescript`,alias:[`ts`,`tsx`],extensions:[`ts`,`mts`,`cts`,`tsx`],load:async()=>ce({typescript:!0,jsx:!0})}),R.of({name:`json`,alias:[`jsonc`],extensions:[`json`,`jsonc`],load:()=>D(()=>import(`./dist-DVEMi7bH.js`).then(e=>e.json()),__vite__mapDeps([0,1,2,3,4]))}),R.of({name:`yaml`,alias:[`yml`],extensions:[`yaml`,`yml`],load:()=>D(()=>import(`./dist-X189qk_S.js`).then(e=>e.yaml()),__vite__mapDeps([5,1,2,3,4]))}),R.of({name:`css`,alias:[`scss`,`less`],extensions:[`css`,`scss`,`less`],load:async()=>T()}),R.of({name:`html`,alias:[`htm`],extensions:[`html`,`htm`],load:async()=>le()}),R.of({name:`python`,alias:[`py`],extensions:[`py`,`pyw`],load:()=>D(()=>import(`./dist-Dm75HY2n.js`).then(e=>e.python()),__vite__mapDeps([6,7,1,2,3,4]))}),R.of({name:`rust`,alias:[`rs`],extensions:[`rs`],load:()=>D(()=>import(`./dist-Bx72hMUu.js`).then(e=>e.rust()),__vite__mapDeps([8,1,2,3,4]))}),R.of({name:`markdown`,alias:[`md`,`mdx`],extensions:[`md`,`mdx`,`markdown`],load:async()=>re()}),R.of({name:`bash`,alias:[`sh`,`shell`,`zsh`],extensions:[`sh`,`bash`,`zsh`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:t},{shell:n}]=await Promise.all([D(()=>import(`./dist-B2YW_ZWG.js`).then(e=>e.m),__vite__mapDeps([1,2,3])),D(()=>import(`./shell-COsTRxlr.js`),[])]);return new t(e.define(n))}}),R.of({name:`go`,alias:[`golang`],extensions:[`go`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:t},{go:n}]=await Promise.all([D(()=>import(`./dist-B2YW_ZWG.js`).then(e=>e.m),__vite__mapDeps([1,2,3])),D(()=>import(`./go-IODVg4Ok.js`),[])]);return new t(e.define(n))}})],ze=N.define(),Be=N.define(),Ve=H.line({class:`agent-flash`}),He=P.define({create(){return H.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(ze)){let{from:r,to:i}=n.value,a=[];for(let e=r;e<=i;){let n=t.state.doc.lineAt(e);a.push(Ve.range(n.from)),e=n.to+1}e=e.update({add:a,sort:!0})}else n.is(Be)&&(e=H.none);return e},provide:e=>I.decorations.from(e)});function Ue(e){let t=e.getMap(`agent-flash`);return[He,L.define(e=>{let n=0,r=Date.now(),s=null,c=null,l=!1;function u(){let t=e.state.doc.length;t!==0&&(l||(e.dispatch({effects:ze.of({from:0,to:t})}),c&&clearTimeout(c),c=setTimeout(()=>{c=null,!l&&e.dispatch({effects:Be.of(null)})},a)))}let d=e=>{if(i(t),!o(t,r))return;r=Date.now();let a=Date.now();if(a-n<500){if(!s){let e=500-(a-n);s=setTimeout(()=>{s=null,n=Date.now(),u()},e)}return}n=a,u()};t.observe(d);let f=()=>{document.visibilityState===`visible`?o(t,r)&&(r=Date.now(),n=Date.now(),u()):r=Date.now()};return document.addEventListener(`visibilitychange`,f),{update(e){},destroy(){l=!0,t.unobserve(d),document.removeEventListener(`visibilitychange`,f),s&&=(clearTimeout(s),null),c&&=(clearTimeout(c),null)}}})]}var q=/\[([^\]\n]*)\]\((<[^>\n]+>|[^)\s\n]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?\)/g,We=H.mark({class:`cm-md-internal-link`});function Ge(e,t){return t>0&&e[t-1]===`!`}function Ke(e){let t=e[2]??``;return t.startsWith(`<`)&&t.endsWith(`>`)?t.slice(1,-1):t}function qe(e){let t=new V;for(let{from:n,to:r}of e.visibleRanges){let i=e.state.doc.sliceString(n,r);q.lastIndex=0;let a=q.exec(i);for(;a!==null;){let e=Ge(i,a.index)?null:p(Ke(a));e&&e.kind!==`external`&&t.add(n+a.index,n+a.index+a[0].length,We),a=q.exec(i)}}return t.finish()}var Je=L.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=I.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);q.lastIndex=0;let i=q.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=Ge(r.text,i.index)?null:p(Ke(i));if(t&&t.kind!==`external`)return e.preventDefault(),t.kind===`doc`&&h(e)?(de(t),!0):(g(t),!0)}i=q.exec(r.text)}return!1}}),Xe=I.theme({".cm-md-internal-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-md-internal-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function Ze(){return[Je,Ye,Xe]}var Qe=5e3,J=null,$e=0,et=null,Y=new Map;async function tt(){let e=Date.now();return J&&e-$e<Qe?J:(J=await f(),$e=e,et=ot(J),J)}async function nt(e){let t=Date.now(),n=Y.get(e);if(n!==void 0&&t-n.time<Qe)return n.headings;try{let n=await v(e);return Y.set(e,{headings:n,time:t}),n}catch(n){return console.warn(`[wiki-link-source] /api/page-headings fetch failed:`,n),Y.set(e,{headings:[],time:t}),[]}}var X=/\[\[[^\]]*?\]\]/g,rt=H.mark({class:`cm-wiki-link`}),it=H.mark({class:`cm-wiki-link cm-wiki-link-broken`});function at(e){let t=new Set;for(let n of e)t.add(n.docName.toLowerCase()),n.title&&t.add(n.title.toLowerCase());return t}function ot(e){let t=at(e);for(let n of e){let e=n.docName.split(`/`);e.pop();let r=``;for(let n of e)r=r?`${r}/${n}`:n,t.add(r.toLowerCase())}return t}function st(e){return e.split(/[#|]/)[0].trim().toLowerCase()}function ct(e){let t=new V,n=J?et:null;for(let{from:r,to:i}of e.visibleRanges){let a=e.state.doc.sliceString(r,i);X.lastIndex=0;let o=X.exec(a);for(;o!==null;){let e=rt;if(n){let t=st(o[0].slice(2,-2));t&&!n.has(t)&&(e=it)}t.add(r+o.index,r+o.index+o[0].length,e),o=X.exec(a)}}return t.finish()}var lt=L.fromClass(class{decorations;cacheWarmAtBuild;constructor(e){this.cacheWarmAtBuild=J!==null,this.decorations=ct(e),this.cacheWarmAtBuild||this.warmCache(e)}update(e){let t=J!==null;(e.docChanged||e.viewportChanged||!this.cacheWarmAtBuild&&t)&&(this.cacheWarmAtBuild=t,this.decorations=ct(e.view))}warmCache(e){tt().then(()=>{try{e.dispatch({})}catch{}}).catch(e=>{console.warn(`[wiki-link-source] warmCache fetch failed:`,e)})}},{decorations:e=>e.decorations}),Z=/\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/g,ut=I.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);Z.lastIndex=0;let i=Z.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=i[1]?.trim(),n=i[2]?.trim()||null;if(t){let r=c(t,n);if(!r)return!1;e.preventDefault(),r.kind===`external`?window.open(r.url,`_blank`,`noopener,noreferrer`):h(e)?de(r):window.location.hash=r.anchor?`#/${r.docName}?anchor=${encodeURIComponent(r.anchor)}`:`#/${r.docName}`}return!0}i=Z.exec(r.text)}return!1}});async function dt(e){let t=e.state.doc.sliceString(0,e.pos).match(/\[\[([^\]]*)$/);if(!t)return null;let n=t[1],r=e.pos-n.length,i=n.indexOf(`#`);if(i>0){let e=n.slice(0,i),t=n.slice(i+1),a=r+i+1,o=await nt(e);if(!o.length)return null;let s=m(o,t);return s.length?{from:a,filter:!1,options:s.map(e=>({label:e.text,detail:`H${e.level}`,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.slug+a},selection:{anchor:r+e.slug.length+a.length}})}}))}:null}return{from:r,filter:!1,options:_(await tt().catch(e=>(console.warn(`[wiki-link-source] Failed to fetch pages:`,e),[])),n).map(e=>({label:e.title,detail:e.title===e.docName?void 0:e.docName,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.docName+a},selection:{anchor:r+e.docName.length+a.length}})}}))}}var ft=I.theme({".cm-wiki-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-wiki-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function pt(){return[lt,ut,ft,ae.data.of({autocomplete:dt})]}var mt=H.mark({class:`cm-link-ref-broken`}),ht=/^\s{0,3}\[([^\]]+)\]:\s/,gt=/\[([^\]]*)\]\[([^\]]*)\]/g,_t=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Q(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function vt(e){let t=[];return M(e).iterate({enter(e){if(_t.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function $(e){let t=new Set,n=[],r=e.doc,i=vt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Q(n.from,i))continue;let a=ht.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Q(t.from,i)&&!ht.test(t.text))for(gt.lastIndex=0;;){let e=gt.exec(t.text);if(!e)break;let r=t.from+e.index;if(Q(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(mt.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),H.set(a)}var yt=P.define({create(e){return $(e)},update(e,t){return t.docChanged?$(t.state):e},provide:e=>I.decorations.from(e)}),bt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,xt=H.mark({class:`cm-del`}),St=H.line({class:`cm-table-header`}),Ct=H.line({class:`cm-table-row`});function wt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Tt(e,t){let n=[],r=M(e);for(let{from:i,to:a}of t)r.iterate({from:i,to:a,enter(t){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(xt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=bt.exec(r.text),a=i?i[1].length:2,o=H.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=wt(r.text),a=H.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Ct.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Ct.range(r.from)),!1}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),H.set(n)}var Et=class{decorations;constructor(e){this.decorations=Tt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||M(e.startState)!==M(e.state))&&(this.decorations=Tt(e.view.state,e.view.visibleRanges))}},Dt=L.fromClass(Et,{decorations:e=>e.decorations});function Ot(){return[Dt,yt]}var kt=n(),At=me({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),jt=se({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),Mt=new xe,Nt=new xe;function Pt(e,t){let n=e.state.doc,i=1;if(n.lines>=1&&n.line(1).text===`---`){for(let e=2;e<=n.lines;e++)if(n.line(e).text===`---`){i=e+1;break}}let a=r(),o=0;for(let r=i;r<=n.lines;r++){let i=n.line(r);if(!a(i.text)&&/^#{1,6}\s/.test(i.text)){if(o===t.index){e.dispatch({selection:F.cursor(i.from),effects:I.scrollIntoView(i.from,{y:`start`})}),e.focus();return}o++}}}function Ft(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:F.cursor(r),effects:I.scrollIntoView(r,{y:`center`})}),e.focus()})}function It(e){let t=(0,Se.c)(29),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,U.useRef)(null),c=(0,U.useRef)(null),[u,d]=(0,U.useState)(null);if(u)throw u;let{resolvedTheme:f}=l(),p;t[0]!==o||t[1]!==i.awareness?(p=()=>{let e=i.awareness;if(e)return e.setLocalStateField(`mode`,o?`source`:`wysiwyg`),()=>{e.setLocalStateField(`mode`,`wysiwyg`)}},t[0]=o,t[1]=i.awareness,t[2]=p):p=t[2];let m;t[3]!==o||t[4]!==i?(m=[i,o],t[3]=o,t[4]=i,t[5]=m):m=t[5],(0,U.useEffect)(p,m);let h=(0,U.useRef)(null),g;t[6]!==a||t[7]!==i||t[8]!==f||t[9]!==r?(g=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,n,o=Lt;try{n=ee({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=pe({ydoc:i.document,ytext:r}),n=new I({state:ve.create({doc:r.toString(),extensions:[fe,be.of([ne]),re({base:ae,extensions:[oe],codeLanguages:Re}),Le(r,i.awareness),Ue(i.document),pt(),Ze(),Ot(),t,Mt.of(f===`dark`?At:jt),Nt.of(B(a??``)),I.lineWrapping,I.theme({"&":{height:`100%`}})]}),parent:e}),s=n.contentDOM;return s.addEventListener(`keydown`,o),s.addEventListener(`paste`,o),s.addEventListener(`drop`,o),s.addEventListener(`cut`,o),{view:n,ydoc:i.document,ytext:r,provider:i}}}),h.current=n,c.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),h.current=null,c.current=null,d(t instanceof Error?t:Error(String(t)))}return()=>{let e=h.current;e&&ie(e),h.current=null,c.current=null}},t[6]=a,t[7]=i,t[8]=f,t[9]=r,t[10]=g):g=t[10];let _;t[11]!==i||t[12]!==r?(_=[r,i],t[11]=i,t[12]=r,t[13]=_):_=t[13],(0,U.useEffect)(g,_);let v,y;t[14]===f?(v=t[15],y=t[16]):(v=()=>{c.current&&c.current.dispatch({effects:Mt.reconfigure(f===`dark`?At:jt)})},y=[f],t[14]=f,t[15]=v,t[16]=y),(0,U.useEffect)(v,y);let b,x;t[17]===a?(b=t[18],x=t[19]):(b=()=>{c.current&&c.current.dispatch({effects:Nt.reconfigure(B(a??``))})},x=[a],t[17]=a,t[18]=b,t[19]=x),(0,U.useEffect)(b,x);let C,w;t[20]!==n||t[21]!==o?(w=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!o)return;let r=c.current;r&&(Pt(r,t),te(n))};return window.addEventListener(S,e),()=>window.removeEventListener(S,e)},C=[n,o],t[20]=n,t[21]=o,t[22]=C,t[23]=w):(C=t[22],w=t[23]),(0,U.useEffect)(w,C);let T,E;t[24]!==n||t[25]!==o?(T=()=>{if(!o)return;let e=c.current;if(!e)return;let t=he(n);if(t){if(t.kind===`outline`){Pt(e,t.detail);return}Ft(e,t.detail)}},E=[n,o],t[24]=n,t[25]=o,t[26]=T,t[27]=E):(T=t[26],E=t[27]),(0,U.useEffect)(T,E);let D;return t[28]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,kt.jsx)(`div`,{ref:s,className:`source-editor h-full py-3`}),t[28]=D):D=t[28],D}function Lt(){return u()}export{It as SourceEditor};