@inkeep/open-knowledge 0.59.0-beta.39 → 0.59.0-beta.40

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 (60) hide show
  1. package/dist/{acp-harness-probe-D59aD_3r.mjs → acp-harness-probe-BXaEG9XN.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-DzwYLdlF.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-CG7engaW.mjs → init-DJQw_oSo.mjs} +3 -3
  6. package/dist/init-DiyB7t8-.mjs +1 -0
  7. package/dist/{launch-json-removal-DUSkPnTb.mjs → launch-json-removal-D9jr3Cym.mjs} +2 -2
  8. package/dist/loader-DN5VV8rd.mjs +1 -0
  9. package/dist/{loader-DsdBuJPZ.mjs → loader-lM2dlAdG.mjs} +2 -2
  10. package/dist/preview-DfNrt9nH.mjs +1 -0
  11. package/dist/{preview-DrsokgLX.mjs → preview-P4lIN2Xz.mjs} +2 -2
  12. package/dist/public/assets/{ActivityModeContent-96IBIdRC.js → ActivityModeContent-B6cXYk7E.js} +1 -1
  13. package/dist/public/assets/{AgentDiffPane-CU7Jd7Re.js → AgentDiffPane-Bh5zJLhI.js} +1 -1
  14. package/dist/public/assets/{DocumentContext-BLI58wnU.js → DocumentContext-CoYCdUTn.js} +2 -2
  15. package/dist/public/assets/{ExcalidrawDocEditor-CCpdsWAK.js → ExcalidrawDocEditor-DESqJPaH.js} +1 -1
  16. package/dist/public/assets/FeedbackForm-Be8PVK4s.js +1 -0
  17. package/dist/public/assets/{ImportSkillDialog-D23hWjz6.js → ImportSkillDialog-CUfIX2Eq.js} +1 -1
  18. package/dist/public/assets/ManagedArtifactProperties-C-2tXobc.js +1 -0
  19. package/dist/public/assets/{ManagedArtifactProperties-DPG7IerN.js → ManagedArtifactProperties-C0w77LVG.js} +1 -1
  20. package/dist/public/assets/Mermaid-CaELc5Zf.js +2 -0
  21. package/dist/public/assets/{MermaidDocEditor-CvfQvpde.js → MermaidDocEditor-DxmG30L8.js} +1 -1
  22. package/dist/public/assets/{PropertyDisplayRow-zG_LjEst.js → PropertyDisplayRow-B6rCTA9W.js} +1 -1
  23. package/dist/public/assets/{SessionsHost-B-xkCGBA.js → SessionsHost-DfN_SR22.js} +2 -2
  24. package/dist/public/assets/{SettingsDialogBody-B5mFyUqf.js → SettingsDialogBody-zm5oYc1W.js} +1 -1
  25. package/dist/public/assets/{SkillInstallMenu-DJCBHOGq.js → SkillInstallMenu-ChmuKg2U.js} +1 -1
  26. package/dist/public/assets/{SkillToolbarControls-3QVKeJw1.js → SkillToolbarControls-CfDZO8oD.js} +1 -1
  27. package/dist/public/assets/{SourceEditor-Dwb1Q9s3.js → SourceEditor-CmjhgcpS.js} +1 -1
  28. package/dist/public/assets/{TerminalWindowApp-FZtG9s0t.js → TerminalWindowApp-D243fYSc.js} +1 -1
  29. package/dist/public/assets/ThreadView-D9vhfjoU.js +14 -0
  30. package/dist/public/assets/{TimelineDiffPane-CMyr13re.js → TimelineDiffPane-DpxUnCr7.js} +1 -1
  31. package/dist/public/assets/{agent-diff-store-D4xji3u-.js → agent-diff-store-S2i2o6of.js} +1 -1
  32. package/dist/public/assets/{auth-state-cache-BnzO4Iie.js → auth-state-cache-CyUM6zjr.js} +1 -1
  33. package/dist/public/assets/{comment-chips-DBkvmOTk.js → comment-chips-CoL6Cjh4.js} +1 -1
  34. package/dist/public/assets/{index-BuQhICuW.js → index-BEbGyHpc.js} +15 -15
  35. package/dist/public/assets/{progress-DDYMamfx.js → progress-BI1WoFwX.js} +2 -2
  36. package/dist/public/assets/{selection-context-BA_Aj-pX.js → selection-context-BIBH9g3O.js} +1 -1
  37. package/dist/public/assets/{skill-actions-C552b7L2.js → skill-actions-D5hCSoeU.js} +1 -1
  38. package/dist/public/assets/{typing-burst-detector-WE1xusfq.js → typing-burst-detector-BNdl6EaU.js} +1 -1
  39. package/dist/public/assets/{use-activity-panel-BNl2lYxr.js → use-activity-panel-BUNW6oNK.js} +1 -1
  40. package/dist/public/assets/{use-open-skill-BCb_9q15.js → use-open-skill-Bjriumns.js} +1 -1
  41. package/dist/public/assets/{use-popular-skills-BmFzLBrW.js → use-popular-skills-HmcJCaX6.js} +1 -1
  42. package/dist/public/assets/{use-timeline-entry-diff-xKE8VsRE.js → use-timeline-entry-diff-DijUR0V_.js} +1 -1
  43. package/dist/public/index.html +15 -15
  44. package/dist/{repair-launch-json-D6I6Lrxq.mjs → repair-launch-json-CdSGcXNS.mjs} +2 -2
  45. package/dist/{repair-mcp-configs-8cYVOomh.mjs → repair-mcp-configs-6T3iELeJ.mjs} +2 -2
  46. package/dist/{src-3kDLkvlY.mjs → src-B8QX7oNJ.mjs} +2 -2
  47. package/dist/src-BoSNO_uo.mjs +1 -0
  48. package/dist/start-CoLYZ46p.mjs +1 -0
  49. package/dist/{start-DIHe19JI.mjs → start-DzgWu5RH.mjs} +2 -2
  50. package/package.json +4 -4
  51. package/dist/constants-7Yv6cluF.mjs +0 -2
  52. package/dist/init-t3l5wfTC.mjs +0 -1
  53. package/dist/loader-BKsQl7ds.mjs +0 -1
  54. package/dist/preview-BWDZYPz4.mjs +0 -1
  55. package/dist/public/assets/FeedbackForm-B1G5woOI.js +0 -1
  56. package/dist/public/assets/ManagedArtifactProperties-PfK1FiEA.js +0 -1
  57. package/dist/public/assets/Mermaid-D6W1JO-s.js +0 -2
  58. package/dist/public/assets/ThreadView-Cgw8IAzE.js +0 -14
  59. package/dist/src-BUmN_cvz.mjs +0 -1
  60. package/dist/start-C7Y6T9s7.mjs +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./DocumentContext-BLI58wnU.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{Lo as n}from"./dist-D-pIxpOA2.js";import{n as r}from"./dist-DTX2HxC82.js";import{t as i}from"./dist-BgXDUIPy.js";import{t as a}from"./createLucideIcon-CAkY8Blx.js";import{S as o,f as s,x as c}from"./doc-paths-je9IlWgC.js";import{J as l}from"./navigation-targets-F5rmiq0j.js";import{F as u,_ as d}from"./skills-api-BWpKRKq_.js";var f=a(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),p=t(),m=null,h=new Set;function g(){return m}function _(e){return h.add(e),()=>{h.delete(e)}}function v(){for(let e of h)e()}function y(e){m!==null&&m.scope===e.scope&&m.name===e.name||(m=e,v())}function b(){m!==null&&(m=null,v())}function x(){let t=(0,p.c)(5),{openTarget:a,setSkillsSidebar:f}=e(),m=u(),h;return t[0]!==a||t[1]!==f||t[2]!==m.data||t[3]!==m.status?(h=(e,t,u)=>{let p=e=>{a({kind:`doc`,target:e,docName:e},u?.replaceActive?{tabBehavior:`replace-active`}:void 0),f(!0);let t=s(e);u?.replaceHistory?o(t):c(t)},h=m.status===`ready`?m.data.find(n=>n.scope===e&&n.name===t):void 0;if(h?.ignored===!0&&h.managed!==!0){y({scope:h.scope,name:h.name});return}if(h)return p(l(h));if(e===`project`&&u?.path)return p(u.path.replace(/\.mdx?$/i,``));if(e===`global`)return p(n(e,t));(async()=>{try{let n=await d(`project`);if(!n.ok){r.error(i._({id:`IO8REi`,values:{0:n.error,name:t}}));return}let a=n.skills.find(n=>n.scope===e&&n.name===t);if(!a){r.error(i._({id:`9uRLEH`,values:{name:t}}));return}p(l(a))}catch(e){let n=e;r.error(i._({id:`IO8REi`,values:{0:n instanceof Error?n.message:String(n),name:t}}))}})()},t[0]=a,t[1]=f,t[2]=m.data,t[3]=m.status,t[4]=h):h=t[4],h}export{_ as a,y as i,b as n,f as o,g as r,x as t};
1
+ import{a as e}from"./DocumentContext-CoYCdUTn.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{Lo as n}from"./dist-D-pIxpOA2.js";import{n as r}from"./dist-DTX2HxC82.js";import{t as i}from"./dist-BgXDUIPy.js";import{t as a}from"./createLucideIcon-CAkY8Blx.js";import{S as o,f as s,x as c}from"./doc-paths-je9IlWgC.js";import{J as l}from"./navigation-targets-F5rmiq0j.js";import{F as u,_ as d}from"./skills-api-BWpKRKq_.js";var f=a(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),p=t(),m=null,h=new Set;function g(){return m}function _(e){return h.add(e),()=>{h.delete(e)}}function v(){for(let e of h)e()}function y(e){m!==null&&m.scope===e.scope&&m.name===e.name||(m=e,v())}function b(){m!==null&&(m=null,v())}function x(){let t=(0,p.c)(5),{openTarget:a,setSkillsSidebar:f}=e(),m=u(),h;return t[0]!==a||t[1]!==f||t[2]!==m.data||t[3]!==m.status?(h=(e,t,u)=>{let p=e=>{a({kind:`doc`,target:e,docName:e},u?.replaceActive?{tabBehavior:`replace-active`}:void 0),f(!0);let t=s(e);u?.replaceHistory?o(t):c(t)},h=m.status===`ready`?m.data.find(n=>n.scope===e&&n.name===t):void 0;if(h?.ignored===!0&&h.managed!==!0){y({scope:h.scope,name:h.name});return}if(h)return p(l(h));if(e===`project`&&u?.path)return p(u.path.replace(/\.mdx?$/i,``));if(e===`global`)return p(n(e,t));(async()=>{try{let n=await d(`project`);if(!n.ok){r.error(i._({id:`IO8REi`,values:{0:n.error,name:t}}));return}let a=n.skills.find(n=>n.scope===e&&n.name===t);if(!a){r.error(i._({id:`9uRLEH`,values:{name:t}}));return}p(l(a))}catch(e){let n=e;r.error(i._({id:`IO8REi`,values:{0:n instanceof Error?n.message:String(n),name:t}}))}})()},t[0]=a,t[1]=f,t[2]=m.data,t[3]=m.status,t[4]=h):h=t[4],h}export{_ as a,y as i,b as n,f as o,g as r,x as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-CA0dewJJ.js";import{sr as c}from"./dist-D-pIxpOA2.js";import{t as l}from"./createLucideIcon-CAkY8Blx.js";import{t as u}from"./check-Bzwwm-o4.js";import{t as d}from"./use-open-skill-BCb_9q15.js";import{t as f}from"./badge-8D3yWFye.js";import{F as p,s as m,u as h}from"./skills-api-BWpKRKq_.js";import{t as g}from"./skeleton-BR4i6Fy5.js";import{n as _}from"./open-managed-artifact-tab-CHDncIVf.js";import{n as v}from"./SkillCostValue-DhbH1CJo.js";var y=[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]],b=l(`package`,y),x=e(n(),1),S=o(),C=t();function w(e){let t=(0,S.c)(28),{name:n,description:r,onOpen:a,onHover:o,action:c,meta:l,leading:u}=e,{_:d}=i(),f;t[0]===n?f=t[1]:(f=(0,C.jsx)(`div`,{className:`truncate font-medium text-sm`,children:n}),t[0]=n,t[1]=f);let p=f,m;t[2]!==d||t[3]!==n?(m=d({id:`9_euHO`,values:{name:n}}),t[2]=d,t[3]=n,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==m?(h=(0,C.jsx)(s,{variant:`ghost`,"aria-label":m,onClick:a,className:`absolute inset-0 h-auto w-full rounded-xl p-0 opacity-0`}),t[5]=a,t[6]=m,t[7]=h):h=t[7];let g;t[8]===u?g=t[9]:(g=u?(0,C.jsx)(`div`,{className:`shrink-0`,children:u}):null,t[8]=u,t[9]=g);let _;t[10]!==l||t[11]!==p?(_=(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[p,l]}),t[10]=l,t[11]=p,t[12]=_):_=t[12];let v;t[13]===c?v=t[14]:(v=(0,C.jsx)(`div`,{className:`relative z-10 shrink-0`,children:c}),t[13]=c,t[14]=v);let y;t[15]!==g||t[16]!==_||t[17]!==v?(y=(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,_,v]}),t[15]=g,t[16]=_,t[17]=v,t[18]=y):y=t[18];let b;t[19]===r?b=t[20]:(b=r?(0,C.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground text-xs leading-relaxed`,children:r}):null,t[19]=r,t[20]=b);let x;t[21]!==y||t[22]!==b?(x=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23];let w;return t[24]!==o||t[25]!==h||t[26]!==x?(w=(0,C.jsxs)(`li`,{className:`relative rounded-xl border border-border bg-card p-4 transition-colors hover:border-border/60 hover:bg-accent/40 focus-within:ring-2 focus-within:ring-ring`,onMouseEnter:o,onFocus:o,children:[h,x]}),t[24]=o,t[25]=h,t[26]=x,t[27]=w):w=t[27],w}function T(e,t){return new Intl.NumberFormat(t||void 0,{notation:`compact`,compactDisplay:`short`}).format(e)}var E=new Map,D=new Map;function O(e,t){return`${e}::${t}`}function k(e,t){return E.get(O(e,t))}async function A(e,t){let n=O(e,t),r=E.get(n);if(r!==void 0)return r;let i=D.get(n);if(i)return i;let a=(async()=>{try{let n=await h({source:e,name:t});return n.ok?c({name:n.name,description:n.description??``,skillMd:n.skillMd,files:n.files}):null}catch{return null}})();D.set(n,a);try{let e=await a;return E.set(n,e),e}finally{D.delete(n)}}function j(e){let t=(0,S.c)(4),{login:n}=e,[r,i]=(0,x.useState)(!0);if(n&&r){let e=`https://github.com/${encodeURIComponent(n)}.png?size=96`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>i(!1),t[0]=r):r=t[0];let a;return t[1]===e?a=t[2]:(a=(0,C.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`size-10 rounded border border-border bg-background object-cover`,onError:r}),t[1]=e,t[2]=a),a}let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded border border-border bg-muted text-muted-foreground`,children:(0,C.jsx)(b,{className:`size-5`,"aria-hidden":!0})}),t[3]=a):a=t[3],a}function M(e){let t=(0,S.c)(34),{result:n,imported:a,onOpen:o}=e,{i18n:s}=i(),c;t[0]!==n.name||t[1]!==n.source?(c=()=>k(n.source,n.name)??null,t[0]=n.name,t[1]=n.source,t[2]=c):c=t[2];let[l,d]=(0,x.useState)(c),p=(0,x.useRef)(!0),m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>(p.current=!0,()=>{p.current=!1}),h=[],t[3]=m,t[4]=h):(m=t[3],h=t[4]),(0,x.useEffect)(m,h);let g;t[5]!==n.name||t[6]!==n.source?(g=()=>{k(n.source,n.name)===void 0&&A(n.source,n.name).then(e=>{p.current&&d(e)})},t[5]=n.name,t[6]=n.source,t[7]=g):g=t[7];let _=g,y;t[8]===n.publisher?y=t[9]:(y=(0,C.jsx)(j,{login:n.publisher}),t[8]=n.publisher,t[9]=y);let b;t[10]===a?b=t[11]:(b=a?(0,C.jsxs)(f,{variant:`primary`,className:`gap-1`,children:[(0,C.jsx)(u,{"aria-hidden":!0}),(0,C.jsx)(r,{id:`hp8OtS`})]}):null,t[10]=a,t[11]=b);let E=n.publisher??n.source,D;t[12]===E?D=t[13]:(D=(0,C.jsx)(`span`,{className:`truncate`,children:E}),t[12]=E,t[13]=D);let O;t[14]===n.publisher?O=t[15]:(O=n.publisher===`openknowledge`||n.publisher===`inkeep`?(0,C.jsx)(f,{variant:`secondary`,className:`h-4 px-1 text-[10px] uppercase tracking-wide`,children:(0,C.jsx)(r,{id:`o0bHtA`})}):null,t[14]=n.publisher,t[15]=O);let M;t[16]!==s||t[17]!==n.installs?(M=n.installs==null?null:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,C.jsxs)(`span`,{className:`shrink-0`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`↓ `}),(0,C.jsxs)(`span`,{className:`sr-only`,children:[(0,C.jsx)(r,{id:`7m3Ade`}),` `]}),T(n.installs,s.locale)]})]}),t[16]=s,t[17]=n.installs,t[18]=M):M=t[18];let N;t[19]===l?N=t[20]:(N=l?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,C.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap`,"data-testid":`skill-card-always-on`,children:[v(l.alwaysOn),` `,(0,C.jsx)(r,{id:`MiMTvb`})]})]}):null,t[19]=l,t[20]=N);let P;t[21]!==M||t[22]!==N||t[23]!==D||t[24]!==O?(P=(0,C.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[D,O,M,N]}),t[21]=M,t[22]=N,t[23]=D,t[24]=O,t[25]=P):P=t[25];let F;return t[26]!==_||t[27]!==o||t[28]!==n.description||t[29]!==n.name||t[30]!==P||t[31]!==y||t[32]!==b?(F=(0,C.jsx)(w,{name:n.name,description:n.description,onOpen:o,onHover:_,leading:y,action:b,meta:P}),t[26]=_,t[27]=o,t[28]=n.description,t[29]=n.name,t[30]=P,t[31]=y,t[32]=b,t[33]=F):F=t[33],F}function N(e,t){return e.find(e=>e.origin?.source===t.source&&(e.name===t.name||e.name===`${t.name}-imported`||e.name.startsWith(`${t.name}-imported-`)))??null}function P(e){let t=(0,S.c)(15),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{scope:r,onNavigate:i}=n,a=d(),o=p(),s;t[2]!==o.data||t[3]!==o.status?(s=o.status===`ready`?o.data.filter(F):[],t[2]=o.data,t[3]=o.status,t[4]=s):s=t[4];let c=s,l;t[5]===c?l=t[6]:(l=e=>N(c,e),t[5]=c,t[6]=l);let u=l,f;t[7]!==u||t[8]!==i||t[9]!==a||t[10]!==r?(f=function(e){i?.();let t=u(e);if(t){a(t.scope,t.name);return}_({flavor:`explore`,source:e.source,name:e.name,subtitle:e.source,level:r})},t[7]=u,t[8]=i,t[9]=a,t[10]=r,t[11]=f):f=t[11];let m=f,h;return t[12]!==u||t[13]!==m?(h={importedEntry:u,openResult:m},t[12]=u,t[13]=m,t[14]=h):h=t[14],h}function F(e){return e.origin}var I=[`s1`,`s2`,`s3`,`s4`,`s5`,`s6`,`s7`,`s8`];function L(e){let t=(0,S.c)(17),{results:n,pending:r,skeletonCount:i,label:a,action:o,loadingLabel:s,scope:c,onNavigate:l,testId:u}=e,d=r===void 0?!1:r,f=i===void 0?8:i,p;t[0]!==l||t[1]!==c?(p={scope:c,onNavigate:l},t[0]=l,t[1]=c,t[2]=p):p=t[2];let{importedEntry:m,openResult:h}=P(p),g;t[3]!==o||t[4]!==a?(g=a===void 0?null:(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h3`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:a}),o]}),t[3]=o,t[4]=a,t[5]=g):g=t[5];let _;t[6]!==m||t[7]!==s||t[8]!==h||t[9]!==d||t[10]!==n||t[11]!==f?(_=d?(0,C.jsxs)(`div`,{"aria-busy":`true`,children:[(0,C.jsx)(`span`,{className:`sr-only`,children:s}),(0,C.jsx)(`ul`,{className:`grid grid-cols-1 gap-2.5 sm:grid-cols-2`,"aria-hidden":!0,children:I.slice(0,f).map(R)})]}):(0,C.jsx)(`ul`,{className:`grid grid-cols-1 gap-2.5 sm:grid-cols-2`,children:n.map(e=>(0,C.jsx)(M,{result:e,imported:m(e),onOpen:()=>h(e)},e.id))}),t[6]=m,t[7]=s,t[8]=h,t[9]=d,t[10]=n,t[11]=f,t[12]=_):_=t[12];let v;return t[13]!==g||t[14]!==_||t[15]!==u?(v=(0,C.jsxs)(`section`,{className:`flex flex-col gap-3`,"data-testid":u,children:[g,_]}),t[13]=g,t[14]=_,t[15]=u,t[16]=v):v=t[16],v}function R(e){return(0,C.jsx)(g,{className:`h-18 rounded-xl`},e)}function z(){let e=(0,S.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`skills`,`popular`],queryFn:B,staleTime:3e5},e[0]=t):t=e[0];let{data:n,isPending:r,isError:i}=a(t),o;e[1]===n?o=e[2]:(o=n??[],e[1]=n,e[2]=o);let s;return e[3]!==i||e[4]!==r||e[5]!==o?(s={skills:o,isPending:r,failed:i},e[3]=i,e[4]=r,e[5]=o,e[6]=s):s=e[6],s}async function B(){let e=await m();if(!e.ok)throw Error(e.error);return e.results}export{y as i,L as n,b as r,z as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-CA0dewJJ.js";import{sr as c}from"./dist-D-pIxpOA2.js";import{t as l}from"./createLucideIcon-CAkY8Blx.js";import{t as u}from"./check-Bzwwm-o4.js";import{t as d}from"./use-open-skill-Bjriumns.js";import{t as f}from"./badge-8D3yWFye.js";import{F as p,s as m,u as h}from"./skills-api-BWpKRKq_.js";import{t as g}from"./skeleton-BR4i6Fy5.js";import{n as _}from"./open-managed-artifact-tab-CHDncIVf.js";import{n as v}from"./SkillCostValue-DhbH1CJo.js";var y=[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]],b=l(`package`,y),x=e(n(),1),S=o(),C=t();function w(e){let t=(0,S.c)(28),{name:n,description:r,onOpen:a,onHover:o,action:c,meta:l,leading:u}=e,{_:d}=i(),f;t[0]===n?f=t[1]:(f=(0,C.jsx)(`div`,{className:`truncate font-medium text-sm`,children:n}),t[0]=n,t[1]=f);let p=f,m;t[2]!==d||t[3]!==n?(m=d({id:`9_euHO`,values:{name:n}}),t[2]=d,t[3]=n,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==m?(h=(0,C.jsx)(s,{variant:`ghost`,"aria-label":m,onClick:a,className:`absolute inset-0 h-auto w-full rounded-xl p-0 opacity-0`}),t[5]=a,t[6]=m,t[7]=h):h=t[7];let g;t[8]===u?g=t[9]:(g=u?(0,C.jsx)(`div`,{className:`shrink-0`,children:u}):null,t[8]=u,t[9]=g);let _;t[10]!==l||t[11]!==p?(_=(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[p,l]}),t[10]=l,t[11]=p,t[12]=_):_=t[12];let v;t[13]===c?v=t[14]:(v=(0,C.jsx)(`div`,{className:`relative z-10 shrink-0`,children:c}),t[13]=c,t[14]=v);let y;t[15]!==g||t[16]!==_||t[17]!==v?(y=(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,_,v]}),t[15]=g,t[16]=_,t[17]=v,t[18]=y):y=t[18];let b;t[19]===r?b=t[20]:(b=r?(0,C.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground text-xs leading-relaxed`,children:r}):null,t[19]=r,t[20]=b);let x;t[21]!==y||t[22]!==b?(x=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23];let w;return t[24]!==o||t[25]!==h||t[26]!==x?(w=(0,C.jsxs)(`li`,{className:`relative rounded-xl border border-border bg-card p-4 transition-colors hover:border-border/60 hover:bg-accent/40 focus-within:ring-2 focus-within:ring-ring`,onMouseEnter:o,onFocus:o,children:[h,x]}),t[24]=o,t[25]=h,t[26]=x,t[27]=w):w=t[27],w}function T(e,t){return new Intl.NumberFormat(t||void 0,{notation:`compact`,compactDisplay:`short`}).format(e)}var E=new Map,D=new Map;function O(e,t){return`${e}::${t}`}function k(e,t){return E.get(O(e,t))}async function A(e,t){let n=O(e,t),r=E.get(n);if(r!==void 0)return r;let i=D.get(n);if(i)return i;let a=(async()=>{try{let n=await h({source:e,name:t});return n.ok?c({name:n.name,description:n.description??``,skillMd:n.skillMd,files:n.files}):null}catch{return null}})();D.set(n,a);try{let e=await a;return E.set(n,e),e}finally{D.delete(n)}}function j(e){let t=(0,S.c)(4),{login:n}=e,[r,i]=(0,x.useState)(!0);if(n&&r){let e=`https://github.com/${encodeURIComponent(n)}.png?size=96`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>i(!1),t[0]=r):r=t[0];let a;return t[1]===e?a=t[2]:(a=(0,C.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`size-10 rounded border border-border bg-background object-cover`,onError:r}),t[1]=e,t[2]=a),a}let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded border border-border bg-muted text-muted-foreground`,children:(0,C.jsx)(b,{className:`size-5`,"aria-hidden":!0})}),t[3]=a):a=t[3],a}function M(e){let t=(0,S.c)(34),{result:n,imported:a,onOpen:o}=e,{i18n:s}=i(),c;t[0]!==n.name||t[1]!==n.source?(c=()=>k(n.source,n.name)??null,t[0]=n.name,t[1]=n.source,t[2]=c):c=t[2];let[l,d]=(0,x.useState)(c),p=(0,x.useRef)(!0),m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>(p.current=!0,()=>{p.current=!1}),h=[],t[3]=m,t[4]=h):(m=t[3],h=t[4]),(0,x.useEffect)(m,h);let g;t[5]!==n.name||t[6]!==n.source?(g=()=>{k(n.source,n.name)===void 0&&A(n.source,n.name).then(e=>{p.current&&d(e)})},t[5]=n.name,t[6]=n.source,t[7]=g):g=t[7];let _=g,y;t[8]===n.publisher?y=t[9]:(y=(0,C.jsx)(j,{login:n.publisher}),t[8]=n.publisher,t[9]=y);let b;t[10]===a?b=t[11]:(b=a?(0,C.jsxs)(f,{variant:`primary`,className:`gap-1`,children:[(0,C.jsx)(u,{"aria-hidden":!0}),(0,C.jsx)(r,{id:`hp8OtS`})]}):null,t[10]=a,t[11]=b);let E=n.publisher??n.source,D;t[12]===E?D=t[13]:(D=(0,C.jsx)(`span`,{className:`truncate`,children:E}),t[12]=E,t[13]=D);let O;t[14]===n.publisher?O=t[15]:(O=n.publisher===`openknowledge`||n.publisher===`inkeep`?(0,C.jsx)(f,{variant:`secondary`,className:`h-4 px-1 text-[10px] uppercase tracking-wide`,children:(0,C.jsx)(r,{id:`o0bHtA`})}):null,t[14]=n.publisher,t[15]=O);let M;t[16]!==s||t[17]!==n.installs?(M=n.installs==null?null:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,C.jsxs)(`span`,{className:`shrink-0`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`↓ `}),(0,C.jsxs)(`span`,{className:`sr-only`,children:[(0,C.jsx)(r,{id:`7m3Ade`}),` `]}),T(n.installs,s.locale)]})]}),t[16]=s,t[17]=n.installs,t[18]=M):M=t[18];let N;t[19]===l?N=t[20]:(N=l?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,C.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap`,"data-testid":`skill-card-always-on`,children:[v(l.alwaysOn),` `,(0,C.jsx)(r,{id:`MiMTvb`})]})]}):null,t[19]=l,t[20]=N);let P;t[21]!==M||t[22]!==N||t[23]!==D||t[24]!==O?(P=(0,C.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[D,O,M,N]}),t[21]=M,t[22]=N,t[23]=D,t[24]=O,t[25]=P):P=t[25];let F;return t[26]!==_||t[27]!==o||t[28]!==n.description||t[29]!==n.name||t[30]!==P||t[31]!==y||t[32]!==b?(F=(0,C.jsx)(w,{name:n.name,description:n.description,onOpen:o,onHover:_,leading:y,action:b,meta:P}),t[26]=_,t[27]=o,t[28]=n.description,t[29]=n.name,t[30]=P,t[31]=y,t[32]=b,t[33]=F):F=t[33],F}function N(e,t){return e.find(e=>e.origin?.source===t.source&&(e.name===t.name||e.name===`${t.name}-imported`||e.name.startsWith(`${t.name}-imported-`)))??null}function P(e){let t=(0,S.c)(15),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{scope:r,onNavigate:i}=n,a=d(),o=p(),s;t[2]!==o.data||t[3]!==o.status?(s=o.status===`ready`?o.data.filter(F):[],t[2]=o.data,t[3]=o.status,t[4]=s):s=t[4];let c=s,l;t[5]===c?l=t[6]:(l=e=>N(c,e),t[5]=c,t[6]=l);let u=l,f;t[7]!==u||t[8]!==i||t[9]!==a||t[10]!==r?(f=function(e){i?.();let t=u(e);if(t){a(t.scope,t.name);return}_({flavor:`explore`,source:e.source,name:e.name,subtitle:e.source,level:r})},t[7]=u,t[8]=i,t[9]=a,t[10]=r,t[11]=f):f=t[11];let m=f,h;return t[12]!==u||t[13]!==m?(h={importedEntry:u,openResult:m},t[12]=u,t[13]=m,t[14]=h):h=t[14],h}function F(e){return e.origin}var I=[`s1`,`s2`,`s3`,`s4`,`s5`,`s6`,`s7`,`s8`];function L(e){let t=(0,S.c)(17),{results:n,pending:r,skeletonCount:i,label:a,action:o,loadingLabel:s,scope:c,onNavigate:l,testId:u}=e,d=r===void 0?!1:r,f=i===void 0?8:i,p;t[0]!==l||t[1]!==c?(p={scope:c,onNavigate:l},t[0]=l,t[1]=c,t[2]=p):p=t[2];let{importedEntry:m,openResult:h}=P(p),g;t[3]!==o||t[4]!==a?(g=a===void 0?null:(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h3`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:a}),o]}),t[3]=o,t[4]=a,t[5]=g):g=t[5];let _;t[6]!==m||t[7]!==s||t[8]!==h||t[9]!==d||t[10]!==n||t[11]!==f?(_=d?(0,C.jsxs)(`div`,{"aria-busy":`true`,children:[(0,C.jsx)(`span`,{className:`sr-only`,children:s}),(0,C.jsx)(`ul`,{className:`grid grid-cols-1 gap-2.5 sm:grid-cols-2`,"aria-hidden":!0,children:I.slice(0,f).map(R)})]}):(0,C.jsx)(`ul`,{className:`grid grid-cols-1 gap-2.5 sm:grid-cols-2`,children:n.map(e=>(0,C.jsx)(M,{result:e,imported:m(e),onOpen:()=>h(e)},e.id))}),t[6]=m,t[7]=s,t[8]=h,t[9]=d,t[10]=n,t[11]=f,t[12]=_):_=t[12];let v;return t[13]!==g||t[14]!==_||t[15]!==u?(v=(0,C.jsxs)(`section`,{className:`flex flex-col gap-3`,"data-testid":u,children:[g,_]}),t[13]=g,t[14]=_,t[15]=u,t[16]=v):v=t[16],v}function R(e){return(0,C.jsx)(g,{className:`h-18 rounded-xl`},e)}function z(){let e=(0,S.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`skills`,`popular`],queryFn:B,staleTime:3e5},e[0]=t):t=e[0];let{data:n,isPending:r,isError:i}=a(t),o;e[1]===n?o=e[2]:(o=n??[],e[1]=n,e[2]=o);let s;return e[3]!==i||e[4]!==r||e[5]!==o?(s={skills:o,isPending:r,failed:i},e[3]=i,e[4]=r,e[5]=o,e[6]=s):s=e[6],s}async function B(){let e=await m();if(!e.ok)throw Error(e.error);return e.results}export{y as i,L as n,b as r,z as t};
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{_ as r,a as i,zn as a}from"./DocumentContext-BLI58wnU.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{i as d}from"./local-menu-action-bus-aAi23OVU.js";import{T as f,et as p,q as m}from"./CodeMirrorPropInput-ONJdKGBm.js";import{Ba as h,Co as g,Fa as _,Ja as v,K as y,Ka as b,Pa as x,Sa as S,Wa as ee,Xa as te,Ya as C,ar as ne,la as re,za as ie,zo as w}from"./dist-D-pIxpOA2.js";import{i as ae,l as oe,m as T,n as se,t as ce}from"./PropertyDisplayRow-zG_LjEst.js";import{t as le}from"./minus-HJRULrSt.js";import{t as ue}from"./libesm-CmFxXX9W.js";var E=u(),D=n(),O=200;function de(e){let t=(0,E.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,D.jsx)(ge,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=se,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(fe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,D.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,D.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function fe(e){return(0,D.jsx)(pe,{change:e},`${e.kind}-${e.key}`)}function pe(e){let t=(0,E.c)(22),{change:n}=e,{_:r}=c(),i=oe[g(n.kind===`removed`?n.before:n.after)],o;t[0]!==r||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:d,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:le,kindLabel:r({id:`eps54V`})}:{KindIcon:a,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,D.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let f;t[5]===l?f=t[6]:(f=(0,D.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=f);let p;t[7]!==u||t[8]!==f?(p=(0,D.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,f]}),t[7]=u,t[8]=f,t[9]=p):p=t[9];let m;t[10]===i?m=t[11]:(m=(0,D.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,D.jsx)(me,{change:n}),t[12]=n,t[13]=h);let _;t[14]!==n.key||t[15]!==m||t[16]!==h?(_=(0,D.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,D.jsx)(ce,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=_):_=t[17];let v;return t[18]!==n.key||t[19]!==p||t[20]!==_?(v=(0,D.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[p,_]}),t[18]=n.key,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function me(e){let t=(0,E.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=T(n.before)||T(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,D.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function k(e){let t=(0,E.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(T(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,D.jsx)(ae,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,D.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(he).join(`, `):String(n),r=e.length>O;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,O)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,D.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function he(e){return typeof e==`string`}function ge(e){let t=(0,E.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,D.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,D.jsx)(A,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,D.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,D.jsx)(A,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,D.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,D.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function A(e){let t=(0,E.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,D.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,D.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,D.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),M=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=M();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),_e=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=j(),r=M(),i=N(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ve=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=j();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=_e(),r=N();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),P=e(o(),1),ye=e(l(),1),F=ve();function I(){}I.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(be(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function be(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var xe=new I;function Se(e,t,n){return xe.diff(e,t,n)}var L=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,R=/\S/,z=new I;z.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!R.test(e)&&!R.test(t)},z.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&L.test(t[n])&&L.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Ce(e,t,n){return z.diff(e,t,n)}var B=new I;B.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1
+ import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{_ as r,a as i,zn as a}from"./DocumentContext-CoYCdUTn.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{i as d}from"./local-menu-action-bus-aAi23OVU.js";import{T as f,et as p,q as m}from"./CodeMirrorPropInput-ONJdKGBm.js";import{Ba as h,Co as g,Fa as _,Ja as v,K as y,Ka as b,Pa as x,Sa as S,Wa as ee,Xa as te,Ya as C,ar as ne,la as re,za as ie,zo as w}from"./dist-D-pIxpOA2.js";import{i as ae,l as oe,m as T,n as se,t as ce}from"./PropertyDisplayRow-B6rCTA9W.js";import{t as le}from"./minus-HJRULrSt.js";import{t as ue}from"./libesm-CmFxXX9W.js";var E=u(),D=n(),O=200;function de(e){let t=(0,E.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,D.jsx)(ge,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=se,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(fe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,D.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,D.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function fe(e){return(0,D.jsx)(pe,{change:e},`${e.kind}-${e.key}`)}function pe(e){let t=(0,E.c)(22),{change:n}=e,{_:r}=c(),i=oe[g(n.kind===`removed`?n.before:n.after)],o;t[0]!==r||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:d,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:le,kindLabel:r({id:`eps54V`})}:{KindIcon:a,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,D.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let f;t[5]===l?f=t[6]:(f=(0,D.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=f);let p;t[7]!==u||t[8]!==f?(p=(0,D.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,f]}),t[7]=u,t[8]=f,t[9]=p):p=t[9];let m;t[10]===i?m=t[11]:(m=(0,D.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,D.jsx)(me,{change:n}),t[12]=n,t[13]=h);let _;t[14]!==n.key||t[15]!==m||t[16]!==h?(_=(0,D.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,D.jsx)(ce,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=_):_=t[17];let v;return t[18]!==n.key||t[19]!==p||t[20]!==_?(v=(0,D.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[p,_]}),t[18]=n.key,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function me(e){let t=(0,E.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=T(n.before)||T(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,D.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function k(e){let t=(0,E.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(T(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,D.jsx)(ae,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,D.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(he).join(`, `):String(n),r=e.length>O;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,O)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,D.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function he(e){return typeof e==`string`}function ge(e){let t=(0,E.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,D.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,D.jsx)(A,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,D.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,D.jsx)(A,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,D.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,D.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function A(e){let t=(0,E.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,D.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,D.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,D.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),M=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=M();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),_e=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=j(),r=M(),i=N(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ve=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=j();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=_e(),r=N();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),P=e(o(),1),ye=e(l(),1),F=ve();function I(){}I.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(be(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function be(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var xe=new I;function Se(e,t,n){return xe.diff(e,t,n)}var L=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,R=/\S/,z=new I;z.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!R.test(e)&&!R.test(t)},z.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&L.test(t[n])&&L.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Ce(e,t,n){return z.diff(e,t,n)}var B=new I;B.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
2
2
  `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var we=new I;we.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Te=new I;Te.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function V(e){"@babel/helpers - typeof";return V=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V(e)}var Ee=Object.prototype.toString,H=new I;H.useLongestToken=!0,H.tokenize=B.tokenize,H.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(U(e,null,null,i),i,` `)},H.equals=function(e,t){return I.prototype.equals.call(H,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function U(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Ee.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=U(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),V(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=U(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var W=new I;W.tokenize=function(e){return e.slice()},W.join=W.removeEmpty=function(e){return e};function G(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new v(n,i,t.slice(n,r))}function De(e){if(!e.steps.length)return;let t=new C(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof v&&r instanceof v?G(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function K(e){let t=new C(e);return t.removeMark(0,e.nodeSize-2),t.doc}function Oe(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function q(e){return JSON.parse(JSON.stringify(e))}var ke=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new C(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=K(this.fromDoc).toJSON(),this.finalJSON=K(this.toDoc).toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=De(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=q(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,F.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=K(this.tr.doc).toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=G(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=q(this.currentJSON),a=q(this.currentJSON);(0,F.applyPatch)(i,[n]),(0,F.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=Oe(this.currentJSON,e.path),u=this.wordDiffs?Ce(l,c):Se(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function Ae(e,t,n={}){return new ke(e,t,n).init()}var je=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function J(e){let t=[];return e.forEach((e,n)=>{if(je.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function Me(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function Ne(e,t){let n=Me(J(e),J(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var Pe=400;function Y(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function Fe(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof ee?`add`:t instanceof b?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function Ie(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=Y(r,n,e),a=Y(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=Ae(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=Ne(i,o),l=s?Fe(s,c):[];return c.length+l.length>Pe?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var Le=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function Re(e){return e.changes.length+2*e.markChanges.length}function X(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ze(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function Z(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&ze(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function Be(e,t,n,r,i){let a=te.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=X(n.content);o.push(x.widget(e.fromB,()=>Z(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(x.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(x.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=X(n.content);o.push(x.widget(e.fromB,()=>Z(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return _.create(e,o)}var Ve=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),Q=r.filter(e=>!Ve.has(e.name)).map(e=>e.name===`jsxComponent`?y:e),He=S(Q);function Ue(e,t){return Ie(e,t,He,f())}var We=re.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:_.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new ie({key:new h(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function Ge(e){let t=(0,E.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=Be(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,He);o=p,a=!1,r=Q,i=We.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l={attributes:{class:`pt-4`}},t[13]=l):l=t[13];let u;t[14]!==a||t[15]!==s||t[16]!==c?(u={editable:a,extensions:s,content:c,editorProps:l},t[14]=a,t[15]=s,t[16]=c,t[17]=u):u=t[17];let d;t[18]===n?d=t[19]:(d=[n],t[18]=n,t[19]=d);let f=o(u,d),[h]=(0,P.useState)(Ke),g=(0,P.useRef)(null),_,v;t[20]===h?(_=t[21],v=t[22]):(_=()=>{let e=g.current;if(e)return e.appendChild(h),()=>{h.parentNode===e&&e.removeChild(h)}},v=[h],t[20]=h,t[21]=_,t[22]=v),(0,P.useLayoutEffect)(_,v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,D.jsx)(`div`,{className:`tiptap-editor`,children:(0,D.jsx)(`div`,{ref:g,style:{display:`contents`}})}),t[23]=y):y=t[23];let b;t[24]===f?b=t[25]:(b=(0,D.jsx)(m,{editor:f,className:`tiptap-editor-portal-content`}),t[24]=f,t[25]=b);let x;t[26]!==h||t[27]!==b?(x=(0,ye.createPortal)(b,h),t[26]=h,t[27]=b,t[28]=x):x=t[28];let S;return t[29]===x?S=t[30]:(S=(0,D.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[y,x]}),t[29]=x,t[30]=S),S}function Ke(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var qe=`[data-property-change]`;function Je(e){let t=0,n=!1;for(let r of e.split(`
3
3
  `)){let e=r.startsWith(`+`)&&!r.startsWith(`+++`)||r.startsWith(`-`)&&!r.startsWith(`---`);e&&!n&&(t+=1),n=e}return t}function Ye(e){let t=Array.from(e.querySelectorAll(`.diff-code-insert, .diff-code-delete`)),n=[],r=null;for(let e of t){let t=e.closest(`tr`);t&&((r===null||t.previousElementSibling!==r)&&n.push(e),r=t)}return n}function $(e){let t=0,n=0;for(let r of e.split(`
4
4
  `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Xe(e,t){return`${e}\u0000${t}`}function Ze(e,t,n){let r=w(e).body,i=w(t).body;return r===i?``:ue(n,r,i,``,``,{context:Math.max(r.split(`
@@ -94,7 +94,7 @@
94
94
  -->
95
95
  <script>(() => { try { const raw = localStorage.getItem('ok-language-v1'); if (!raw) return; const o = JSON.parse(raw); if (typeof o?.locale !== 'string' || !/^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{2,8})*$/.test(o.locale)) return; document.documentElement.lang = o.locale; document.documentElement.dir = o.dir === 'rtl' ? 'rtl' : 'ltr'; } catch {} })();</script>
96
96
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
97
- <script type="module" crossorigin src="./assets/index-BuQhICuW.js"></script>
97
+ <script type="module" crossorigin src="./assets/index-BEbGyHpc.js"></script>
98
98
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
99
99
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
100
100
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
@@ -182,7 +182,7 @@
182
182
  <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-ONJdKGBm.js">
183
183
  <link rel="modulepreload" crossorigin href="./assets/git-branch-BEl3Boky.js">
184
184
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-CJVfCxE0.js">
185
- <link rel="modulepreload" crossorigin href="./assets/Mermaid-D6W1JO-s.js">
185
+ <link rel="modulepreload" crossorigin href="./assets/Mermaid-CaELc5Zf.js">
186
186
  <link rel="modulepreload" crossorigin href="./assets/circle-alert-CKGYtHdt.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/documents-events-Dv0-c6Gq.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/parse-api-error-DcnXKbfT.js">
@@ -203,33 +203,33 @@
203
203
  <link rel="modulepreload" crossorigin href="./assets/popover-MKPgXNPk.js">
204
204
  <link rel="modulepreload" crossorigin href="./assets/skills-api-BWpKRKq_.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/use-collab-url-3E8FBfyE.js">
206
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-BLI58wnU.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-CoYCdUTn.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/workspace-paths-CD0W1etA.js">
208
- <link rel="modulepreload" crossorigin href="./assets/progress-DDYMamfx.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/progress-BI1WoFwX.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/radio-group-BsZGGl8l.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/toggle-group-BlEg4yJE.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/useQuery-ZeEDLtxh.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/format-BxicnlGz.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/braces-okUwnkYm.js">
214
- <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-zG_LjEst.js">
214
+ <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-B6rCTA9W.js">
215
215
  <link rel="modulepreload" crossorigin href="./assets/folder-config-api-CWvrN8lP.js">
216
- <link rel="modulepreload" crossorigin href="./assets/comment-chips-DBkvmOTk.js">
216
+ <link rel="modulepreload" crossorigin href="./assets/comment-chips-CoL6Cjh4.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/SkillCostValue-DhbH1CJo.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/textarea-WVtoklh9.js">
219
- <link rel="modulepreload" crossorigin href="./assets/selection-context-BA_Aj-pX.js">
219
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-BIBH9g3O.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/lint-config-client-C3CAQ-EN.js">
221
- <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-DPG7IerN.js">
221
+ <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-C0w77LVG.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-CAa7STLG.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-CXMA4cr5.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-aLfYhnMx.js">
225
- <link rel="modulepreload" crossorigin href="./assets/use-open-skill-BCb_9q15.js">
225
+ <link rel="modulepreload" crossorigin href="./assets/use-open-skill-Bjriumns.js">
226
226
  <link rel="modulepreload" crossorigin href="./assets/mascot-outline-CtS592mc.js">
227
- <link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-DJCBHOGq.js">
227
+ <link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-ChmuKg2U.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/list-plus-1_iMFVqs.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/use-settings-route-B0SXlDtB.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/platform-labels-CLcjUBK6.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/use-workspace-CTA6IT0U.js">
232
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-C552b7L2.js">
232
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-D5hCSoeU.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/case-sensitive-B9mhUnHr.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-B1wYSm9K.js">
235
235
  <link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-C15NfeTq.js">
@@ -237,17 +237,17 @@
237
237
  <link rel="modulepreload" crossorigin href="./assets/wrench-JX3g_hHJ.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/panel-CZuoQmmu.js">
239
239
  <link rel="modulepreload" crossorigin href="./assets/skeleton-BR4i6Fy5.js">
240
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-WE1xusfq.js">
240
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-BNdl6EaU.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/download-Bdmlj4Jo.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/field-BnGNvs-N.js">
243
- <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-BnzO4Iie.js">
243
+ <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-CyUM6zjr.js">
244
244
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-CdkrAlK3.js">
245
245
  <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-BmPJ0hig.js">
246
246
  <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-Bec1VoOw.js">
247
247
  <link rel="modulepreload" crossorigin href="./assets/history-BteF85_l.js">
248
248
  <link rel="modulepreload" crossorigin href="./assets/bug-report-send-manager-BSek0xNK.js">
249
249
  <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CHDncIVf.js">
250
- <link rel="modulepreload" crossorigin href="./assets/use-popular-skills-BmFzLBrW.js">
250
+ <link rel="modulepreload" crossorigin href="./assets/use-popular-skills-HmcJCaX6.js">
251
251
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-BXE3r3dB.js">
252
252
  <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-DZoRkSx-.js">
253
253
  <link rel="modulepreload" crossorigin href="./assets/square-pen-BlKNuUz7.js">
@@ -262,7 +262,7 @@
262
262
  <link rel="modulepreload" crossorigin href="./assets/app-menubar-gate-BTnubpt0.js">
263
263
  <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-3AkzYElW.js">
264
264
  <link rel="modulepreload" crossorigin href="./assets/terminal-command-events-CpkInJtp.js">
265
- <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-D4xji3u-.js">
265
+ <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-S2i2o6of.js">
266
266
  <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-DuH9FKgs.js">
267
267
  <link rel="modulepreload" crossorigin href="./assets/input-group-C2iHh4MW.js">
268
268
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-CpbeDgpN.js">
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-DUSkPnTb.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-D6I6Lrxq.mjs.map
1
+ import{t as e}from"./launch-json-removal-D9jr3Cym.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-CdSGcXNS.mjs.map
@@ -1,2 +1,2 @@
1
- import{bs as e}from"./src-BD1wHyiU.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-CHFE5Tp7.mjs";import{d as i,v as a}from"./init-CG7engaW.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-8cYVOomh.mjs.map
1
+ import{bs as e}from"./src-BD1wHyiU.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-CHFE5Tp7.mjs";import{d as i,v as a}from"./init-DJQw_oSo.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-6T3iELeJ.mjs.map
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-DhRrtbfG.mjs";import{Dc as i,Ec as a,bo as o,ct as s,jc as c,lt as l}from"./src-BD1wHyiU.mjs";import{Ci as u,Pn as ee,at as d,ei as f,it as p,ot as m,rt as h}from"./src-CKvbaaFV.mjs";import{D as g,F as _,I as v,k as y}from"./fs-traced-2B_-YK-g.mjs";import{C as b,S as x,_ as S,f as C,r as w}from"./server-lock-RKPNHNqb.mjs";import{t as T}from"./yazl-DZr4PyKA.mjs";import{b as E,h as D,m as te}from"./resolve-project-root-CHFE5Tp7.mjs";import{c as ne}from"./colors-DSyAT9Cz.mjs";import{n as O}from"./acp-harness-probe-D59aD_3r.mjs";import{E as k,T as re,_ as ie,b as A,o as ae,w as j,x as oe}from"./init-CG7engaW.mjs";import{n as se}from"./constants-7Yv6cluF.mjs";import{t as ce}from"./is-object-Bw0-z8qH.mjs";import"./loader-DsdBuJPZ.mjs";import"./skill-teardown-DcAF7q_b.mjs";import"./preview-DrsokgLX.mjs";import{execSync as le,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,join as F,relative as ue,resolve as I,sep as de}from"node:path";import{cpSync as fe,createWriteStream as pe,existsSync as L,lstatSync as me,mkdirSync as R,mkdtempSync as he,readFileSync as z,readdirSync as B,readlinkSync as ge,rmSync as _e,statSync as ve,writeFileSync as V}from"node:fs";import{arch as ye,freemem as be,homedir as H,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import"node:fs/promises";import{createHash as Oe}from"node:crypto";var ke=n();const Ae=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function je(e,t,n=ee){if(e!==void 0&&!Ae.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Me=null;function Ne(e){Me=e}function Pe(){return Me??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Ie(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:be(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=le(`sw_vers -productVersion 2>/dev/null`,f({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Re=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function ze(e){let t=N(e);return Re.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Be(e,t){return We(e,t).files}const Ve=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function He(e,t=O){let n=F(e,`${t}.ShipIt`);return L(n)?Ve.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ue(e){if(!L(e))return[];try{return B(e).filter(e=>e.endsWith(`.yaml`)).sort().slice(-25).map(t=>F(e,t))}catch{return[]}}function We(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(ze),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!ze(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Ge(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,s].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ke(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function qe(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=i(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{qe({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Je(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??F(H(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,i):null;R(P(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let l=Le();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:ee}=We(s,o),{files:d}=t.projectDir?Ge(t.projectDir):{files:[]},{files:f}=t.projectDir?Ke(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:ee,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:g}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),_=new g;W({zipfile:_,files:[...u,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:c,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&qe({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let v=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=m.reduce((e,t)=>e+t.lineCount,0),x=new Set(p.map(e=>`logs/${N(e)}`)),S=h.filter(e=>x.has(e)),C=new Set((t.bugReportLedgerFiles??[]).map(e=>`${c}/${N(e)}`)),w=h.filter(e=>C.has(e)),T=s?h.filter(e=>e.startsWith(`logs/`)&&!ze(e)&&!x.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...w.length>0?[`Send history: one small record per bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-DhRrtbfG.mjs";import{Dc as i,Ec as a,bo as o,ct as s,jc as c,lt as l}from"./src-BD1wHyiU.mjs";import{Ci as u,Pn as ee,at as d,ei as f,it as p,ot as m,rt as h}from"./src-CKvbaaFV.mjs";import{D as g,F as _,I as v,k as y}from"./fs-traced-2B_-YK-g.mjs";import{C as b,S as x,_ as S,f as C,r as w}from"./server-lock-RKPNHNqb.mjs";import{t as T}from"./yazl-DZr4PyKA.mjs";import{b as E,h as D,m as te}from"./resolve-project-root-CHFE5Tp7.mjs";import{c as ne}from"./colors-DSyAT9Cz.mjs";import{n as O}from"./acp-harness-probe-BXaEG9XN.mjs";import{E as k,T as re,_ as ie,b as A,o as ae,w as j,x as oe}from"./init-DJQw_oSo.mjs";import{n as se}from"./constants-DzwYLdlF.mjs";import{t as ce}from"./is-object-Bw0-z8qH.mjs";import"./loader-lM2dlAdG.mjs";import"./skill-teardown-DcAF7q_b.mjs";import"./preview-P4lIN2Xz.mjs";import{execSync as le,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,join as F,relative as ue,resolve as I,sep as de}from"node:path";import{cpSync as fe,createWriteStream as pe,existsSync as L,lstatSync as me,mkdirSync as R,mkdtempSync as he,readFileSync as z,readdirSync as B,readlinkSync as ge,rmSync as _e,statSync as ve,writeFileSync as V}from"node:fs";import{arch as ye,freemem as be,homedir as H,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import"node:fs/promises";import{createHash as Oe}from"node:crypto";var ke=n();const Ae=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function je(e,t,n=ee){if(e!==void 0&&!Ae.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Me=null;function Ne(e){Me=e}function Pe(){return Me??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Ie(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:be(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=le(`sw_vers -productVersion 2>/dev/null`,f({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Re=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function ze(e){let t=N(e);return Re.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Be(e,t){return We(e,t).files}const Ve=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function He(e,t=O){let n=F(e,`${t}.ShipIt`);return L(n)?Ve.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ue(e){if(!L(e))return[];try{return B(e).filter(e=>e.endsWith(`.yaml`)).sort().slice(-25).map(t=>F(e,t))}catch{return[]}}function We(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(ze),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!ze(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Ge(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,s].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ke(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function qe(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=i(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{qe({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Je(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??F(H(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,i):null;R(P(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let l=Le();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:ee}=We(s,o),{files:d}=t.projectDir?Ge(t.projectDir):{files:[]},{files:f}=t.projectDir?Ke(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:ee,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:g}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),_=new g;W({zipfile:_,files:[...u,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:c,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&qe({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let v=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=m.reduce((e,t)=>e+t.lineCount,0),x=new Set(p.map(e=>`logs/${N(e)}`)),S=h.filter(e=>x.has(e)),C=new Set((t.bugReportLedgerFiles??[]).map(e=>`${c}/${N(e)}`)),w=h.filter(e=>C.has(e)),T=s?h.filter(e=>e.startsWith(`logs/`)&&!ze(e)&&!x.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...w.length>0?[`Send history: one small record per bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
2
2
  `);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=pe(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ye=e(T(),1),G=e(ne(),1);function Xe(e){return v({absPath:y(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function Ze({home:e=H(),env:n=process.env}={}){let i=Xe(e),{override:a,preferenceList:s}=g(n),{locale:c,source:l}=o({override:a,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function Qe(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function $e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return Qe(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!$e(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function et(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
3
  `),i=n.split(`
4
4
  `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sle
17
17
  `).replace(/\n/g,`\r
18
18
  `));let u=`${i?``:``}${l}`;return u!==r&&_(e,u,{mode:j(e)}),{kind:`removed`}}function mn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function hn(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function gn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&w(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:p(n),command:n,isDesktop:mn(n)}}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const _n=new Set([`running`,`desktop`,`foreign`]);function vn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`stale`:return G.default.yellow(e)}}function yn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function bn(e){return`${yn(e.server.usage)} | ${yn(e.ui?.usage??null)}`}function xn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Sn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,xn(e),bn(e),Q(e),String(e.server.pid),hn(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=vn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
19
19
  `)}async function Cn(e={}){let t=e.discover??h,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??d,a=e.resolveUsage??m,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=gn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(Sn(e.all?s:s.filter(e=>_n.has(Q(e)))))}function wn(){return new E(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Cn({all:t.all===!0||e===`all`,json:t.json===!0})})}function Tn(e,t,n={}){let r=n.isAlive??x,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function En(e){let t=e.inspect??(t=>t===`ui`?Z(e.lockDir):X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Tn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Dn(e,t=x){let n=await h(),r=null;for(let i of n){let n=X(i,`server`),a=Z(i);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function On(e){let t=En({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function kn(e){return new E(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=En({lockDir:u(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await Cn({});return}if(n===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=Z(n);!$(e,x)&&!$(r,x)||(On(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Dn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}On(t);return}On(u(I(Pe(),n)))})}export{U as _,tn as a,je as b,an as c,Z as d,X as f,Fe as g,Jt as h,un as i,on as l,qt as m,kn as n,sn as o,Zt as p,wn as r,nn as s,En as t,en as u,Pe as v,Ne as y};
20
- //# sourceMappingURL=src-3kDLkvlY.mjs.map
20
+ //# sourceMappingURL=src-B8QX7oNJ.mjs.map
@@ -0,0 +1 @@
1
+ import"./src-BD1wHyiU.mjs";import"./resolve-project-root-CHFE5Tp7.mjs";import"./src-B8QX7oNJ.mjs";import"./acp-harness-probe-BXaEG9XN.mjs";import"./init-DJQw_oSo.mjs";import{n as e}from"./loader-lM2dlAdG.mjs";import"./skill-teardown-DcAF7q_b.mjs";import"./preview-P4lIN2Xz.mjs";import"./mcp-migrate-event-9DFnNzHa.mjs";export{e as loadConfig};
@@ -0,0 +1 @@
1
+ import{d as e,f as t,n,y as r}from"./start-DzgWu5RH.mjs";export{n as bootStartServer,e as resolveBundledReactShellDir,t as resolveHost,r as startCommand};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./sleep-DhRrtbfG.mjs";import{bc as t,fc as n,hc as r,xc as i,yc as a}from"./src-BD1wHyiU.mjs";import{Fn as o,a as s,ui as c}from"./src-CKvbaaFV.mjs";import{r as l}from"./server-lock-RKPNHNqb.mjs";import{b as u,x as d}from"./resolve-project-root-CHFE5Tp7.mjs";import{a as f,f as p,i as m,l as h,o as g,r as _,t as v}from"./acp-harness-probe-D59aD_3r.mjs";import{y}from"./init-CG7engaW.mjs";import{n as b}from"./constants-7Yv6cluF.mjs";import{spawn as x}from"node:child_process";import{basename as S,resolve as C}from"node:path";import{existsSync as w}from"node:fs";import{rm as T}from"node:fs/promises";import{setTimeout as E}from"node:timers/promises";function D(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function O(e){if(e===`server`)return e;throw new d(`--only must be 'server'`)}function k(e=w){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[C(t,`public`),C(t,`../../app/dist`),C(t,`../../../app/dist`)].find(t=>e(t))}function A(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function j(t){if(t===`off`)return`off`;if(!e.test(t))throw new d(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function M(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function N(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function P(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||M(e.host))&&e.isTTY}function F(e,t){let n;try{n=new URL(t)}catch{throw new d(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new d(`${e} must be an http(s) origin (got: ${t})`);return t}function I(e){return F(`--external-url`,e)}function L(e){let t=S(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var R=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 z(e,t,n=e=>T(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function B(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function V(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:l,mkdirSync:u}=await import(`node:fs`),{basename:d,dirname:f}=await import(`node:path`),{bootServer:m,getLogger:g,resolveContentDir:_,resolveLockDir:b,waitForServerLockDrain:x}=await import(`./src-nk8WfDCB.mjs`),S=e.log??g(`start`),C=e.singleFile!==void 0,w=e.projectDir??n,T=C?s(e.singleFile).canonicalFilePath:void 0,E=T?f(T):void 0,D=T?d(T):void 0;if(!C){if(!i&&!o(n))throw new R(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-8cYVOomh.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-D6I6Lrxq.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-CS2_jKX3.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let O=E??_(t,n);!C&&!l(O)&&(u(O,{recursive:!0}),S.info({contentDir:O},`Created content directory`));let k=p(),A=c();{let e=b(C?w:n),t=Date.now(),r=await x(e);r!==`no-drain`&&S.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let j=await m({config:t,contentDir:O,projectDir:C?w:n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:h,tokenStore:k,embeddingsKeyStore:A,mcpTomlEditor:y(),...C?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>v(e,t),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return B(C?z(n,w):n,{log:S,exit:e.idleExit})},log:S,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});return{httpServer:j.httpServer,destroy:j.destroy,lockDir:j.lockDir,contentDir:O,port:j.port,ready:j.ready,degraded:j.degraded}}function H(e){if(e===`browser`||e===`app`)return e;throw new d(`--mode must be 'browser' or 'app'`)}function U(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function W(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function G(e,o){let s=U(process.env);s!==null&&(process.env.OK_CONSOLE_LEVEL=s);let{renderBanner:c}=await import(`./banner-B14xalho.mjs`),{accent:l,dim:u,error:d,warning:f}=await import(`./colors-CpP5E4wV.mjs`),p=process.cwd();process.title=L(p);let m;try{m=i(process.env)}catch(e){throw e instanceof a&&(console.error(d(e.message)),process.exit(78)),e}for(let e of m.diagnostics)console.warn(f(`[config] ${e.message}`));let h=t(e,m.layer),g=m.overrides.some(e=>e.envVar===`OK_BIND`),_=o.bind!==void 0&&o.bind.length>0?o.bind:void 0,v=process.env.HOST,y=v!==void 0&&v.trim()!==``?v:void 0,x=r(h),S=_??(g||y===void 0?[...x.bind]:[y]);N({flagBindSet:_!==void 0,okBindSet:g,hostEnvSet:y!==void 0,fileBindCount:x.bind.length})&&console.warn(f(`[config] HOST=${y} overrides server.bind — dropping the file-configured addresses (${x.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let C=S[0]??`127.0.0.1`,w=S,T=o.externalUrl,D=r(t(h,{server:{bind:w,...T===void 0?{}:{externalUrl:T}}}));if(D.allowExternal&&(!D.loopbackOnly||D.externalUrl)){let e=D.externalUrl??D.bind.join(`, `);console.warn(f([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
1
+ import{j as e}from"./sleep-DhRrtbfG.mjs";import{bc as t,fc as n,hc as r,xc as i,yc as a}from"./src-BD1wHyiU.mjs";import{Fn as o,a as s,ui as c}from"./src-CKvbaaFV.mjs";import{r as l}from"./server-lock-RKPNHNqb.mjs";import{b as u,x as d}from"./resolve-project-root-CHFE5Tp7.mjs";import{a as f,f as p,i as m,l as h,o as g,r as _,t as v}from"./acp-harness-probe-BXaEG9XN.mjs";import{y}from"./init-DJQw_oSo.mjs";import{n as b}from"./constants-DzwYLdlF.mjs";import{spawn as x}from"node:child_process";import{basename as S,resolve as C}from"node:path";import{existsSync as w}from"node:fs";import{rm as T}from"node:fs/promises";import{setTimeout as E}from"node:timers/promises";function D(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function O(e){if(e===`server`)return e;throw new d(`--only must be 'server'`)}function k(e=w){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[C(t,`public`),C(t,`../../app/dist`),C(t,`../../../app/dist`)].find(t=>e(t))}function A(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function j(t){if(t===`off`)return`off`;if(!e.test(t))throw new d(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function M(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function N(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function P(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||M(e.host))&&e.isTTY}function F(e,t){let n;try{n=new URL(t)}catch{throw new d(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new d(`${e} must be an http(s) origin (got: ${t})`);return t}function I(e){return F(`--external-url`,e)}function L(e){let t=S(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var R=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 z(e,t,n=e=>T(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function B(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function V(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:l,mkdirSync:u}=await import(`node:fs`),{basename:d,dirname:f}=await import(`node:path`),{bootServer:m,getLogger:g,resolveContentDir:_,resolveLockDir:b,waitForServerLockDrain:x}=await import(`./src-nk8WfDCB.mjs`),S=e.log??g(`start`),C=e.singleFile!==void 0,w=e.projectDir??n,T=C?s(e.singleFile).canonicalFilePath:void 0,E=T?f(T):void 0,D=T?d(T):void 0;if(!C){if(!i&&!o(n))throw new R(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-6T3iELeJ.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CdSGcXNS.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-CS2_jKX3.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let O=E??_(t,n);!C&&!l(O)&&(u(O,{recursive:!0}),S.info({contentDir:O},`Created content directory`));let k=p(),A=c();{let e=b(C?w:n),t=Date.now(),r=await x(e);r!==`no-drain`&&S.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let j=await m({config:t,contentDir:O,projectDir:C?w:n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:h,tokenStore:k,embeddingsKeyStore:A,mcpTomlEditor:y(),...C?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>v(e,t),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return B(C?z(n,w):n,{log:S,exit:e.idleExit})},log:S,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});return{httpServer:j.httpServer,destroy:j.destroy,lockDir:j.lockDir,contentDir:O,port:j.port,ready:j.ready,degraded:j.degraded}}function H(e){if(e===`browser`||e===`app`)return e;throw new d(`--mode must be 'browser' or 'app'`)}function U(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function W(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function G(e,o){let s=U(process.env);s!==null&&(process.env.OK_CONSOLE_LEVEL=s);let{renderBanner:c}=await import(`./banner-B14xalho.mjs`),{accent:l,dim:u,error:d,warning:f}=await import(`./colors-CpP5E4wV.mjs`),p=process.cwd();process.title=L(p);let m;try{m=i(process.env)}catch(e){throw e instanceof a&&(console.error(d(e.message)),process.exit(78)),e}for(let e of m.diagnostics)console.warn(f(`[config] ${e.message}`));let h=t(e,m.layer),g=m.overrides.some(e=>e.envVar===`OK_BIND`),_=o.bind!==void 0&&o.bind.length>0?o.bind:void 0,v=process.env.HOST,y=v!==void 0&&v.trim()!==``?v:void 0,x=r(h),S=_??(g||y===void 0?[...x.bind]:[y]);N({flagBindSet:_!==void 0,okBindSet:g,hostEnvSet:y!==void 0,fileBindCount:x.bind.length})&&console.warn(f(`[config] HOST=${y} overrides server.bind — dropping the file-configured addresses (${x.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let C=S[0]??`127.0.0.1`,w=S,T=o.externalUrl,D=r(t(h,{server:{bind:w,...T===void 0?{}:{externalUrl:T}}}));if(D.allowExternal&&(!D.loopbackOnly||D.externalUrl)){let e=D.externalUrl??D.bind.join(`, `);console.warn(f([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
2
2
  `)))}let O=o.port===void 0?void 0:Number(o.port),j=m.overrides.find(e=>e.envVar===`PORT`)?.value,M=O??j??e.server?.port,F=A({explicitDir:o.reactShellDistDir,only:o.only,findBundledDir:k}),I=F.dir;F.missingBundle&&console.warn(`bundled web UI not found — serving /api and /mcp only. Reinstall @inkeep/open-knowledge, or build packages/app in a source checkout.`);let z;try{z=await V({config:e,cwd:p,host:C,port:M,bind:w,...o.serveContentAssets===void 0?{}:{serveContentAssets:o.serveContentAssets},...I?{reactShellDistDir:I}:{},idleThresholdMs:n(o.idleShutdown??D.idleShutdown),serverRuntime:D,...o.singleFile?{singleFile:o.singleFile}:{},...o.projectDir?{projectDir:o.projectDir}:{}})}catch(e){e instanceof R&&(console.error(d(e.message)),process.exit(1));let t=await import(`./src-nk8WfDCB.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.ExposureConsentError&&(console.error(d(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(d(e.message)),process.exit(1)),J(e,t)){let e=t.resolveLockDir(p),n=null;try{n=await K({readServerLock:()=>t.readServerLock(e),now:Date.now,sleep:e=>E(e),timeoutMs:3e3,pollIntervalMs:50})}catch(e){process.stderr.write(`[start] spawn-or-reuse: lock poll failed (${e instanceof Error?e.message:String(e)}) — falling back to the collision message\n`)}if(n!==null){let[e,...t]=q(n);console.log(l(e));for(let e of t)console.log(u(e));process.exit(0)}}let n=Y(e,p,t);n!==null&&(console.error(d(n)),process.exit(1)),console.error(`${d(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let B=!1,H=async e=>{if(B)return;B=!0;let[t,...n]=W(e);console.log(l(`\n${t}`));for(let e of n)console.log(u(` ${e}`));try{await z.destroy()}catch(e){console.error(`${d(`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://${C.includes(`:`)&&!C.startsWith(`[`)?`[${C}]`:C}:${z.port}`,X=C===`0.0.0.0`||C===`::`?`http://0.0.0.0:${z.port}`:void 0,Z=G;console.log(c({name:`open-knowledge`,version:b,localUrl:Z,networkUrl:X,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let Q={"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`};z.ready.then(async()=>{if(z.degraded.length>0){console.log();for(let e of z.degraded){let t=Q[e]??`${e} (check server logs for details)`;console.warn(` ${f(`⚠`)} ${f(e)}: ${u(t)}`)}console.log()}if(P({openBrowser:o.openBrowser!==!1&&D.openBrowser,explicitOn:o.openBrowser!==!1&&h.server?.openBrowser===!0,host:C,isTTY:process.stdout.isTTY===!0,ephemeral:o.singleFile!==void 0,only:o.only,servesUi:I!==void 0})){let{openBrowser:e}=await import(`./open-browser-CldvWM5B.mjs`);e(Z)}}).catch(e=>{console.error(` ${d(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}async function K(e){let t=e.now()+e.timeoutMs,n=e.readServerLock();for(;n!==null&&n.draining!==!0&&n.port<=0&&e.now()<t;)await e.sleep(e.pollIntervalMs),n=e.readServerLock();return n===null||n.draining===!0||n.port<=0?null:l(n)&&n.url!==void 0?{url:n.url,kind:n.kind,pid:n.pid,servesUi:!0}:{url:n.url??`http://127.0.0.1:${n.port}`,kind:n.kind,pid:n.pid,servesUi:!1}}function q(e){return[`${e.kind===`mcp-spawned`?`An MCP-spawned OpenKnowledge server is already running on this project`:`OpenKnowledge is already running on this project`} (pid ${e.pid}).`,` ${e.url}`,"Leaving it running — run `ok stop` first if you want a fresh server."]}function J(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function Y(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=n.readServerLock(n.resolveLockDir(t));return e&&e.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function X(e){return new u(`start`).description(`Start the OpenKnowledge server (UI + API + MCP + collab on one port)`).option(`-p, --port <port>`,`Server port`,void 0).option(`--bind <address>`,`Bind address (repeatable; default 127.0.0.1 — loopback only)`,(e,t)=>[...t??[],e]).option(`--no-open-browser`,`Do not open the browser after start (interactive loopback starts open it by default)`).option(`--only <module>`,`Serve one module: 'server' (API + MCP only, no shell or browser)`,O).option(`--idle-shutdown <duration>`,`Shut the server down after this long with no connected clients ('off', or a duration like 90s, 30m, 2h; default 30m)`,j).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,H).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path>`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).option(`--external-url <url>`,`Canonical external origin clients dial (sets server.externalUrl for this run) — its host joins the Host/Origin allowlists (CORS + external-Host admission). External exposure additionally requires consent (OK_ALLOW_EXTERNAL=1 or server.allowExternal).`,I).action(async t=>{let n=e();if(t.only===`server`&&t.reactShellDistDir!==void 0&&(process.stderr.write(`error: option '--only server' cannot be combined with '--react-shell-dist-dir'
3
3
  `),process.exit(2)),t.mode===`app`){let e=[];if(t.port!==void 0&&e.push(`--port`),t.bind!==void 0&&e.push(`--bind`),t.only!==void 0&&e.push(`--only`),t.idleShutdown!==void 0&&e.push(`--idle-shutdown`),t.openBrowser===!1&&e.push(`--no-open-browser`),t.externalUrl!==void 0&&e.push(`--external-url`),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){f({spawn:x},n);return}console.error(g(n.reason)),process.exit(1)}await G(n,t)})}export{B as S,P as _,W as a,Y as b,I as c,k as d,D as f,G as g,A as h,q as i,j as l,U as m,V as n,M as o,K as p,L as r,J as s,R as t,O as u,N as v,z as x,X as y};
4
- //# sourceMappingURL=start-DIHe19JI.mjs.map
4
+ //# sourceMappingURL=start-DzgWu5RH.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.59.0-beta.39",
3
+ "version": "0.59.0-beta.40",
4
4
  "description": "Local-first, agent-friendly Markdown knowledge base with a cross-platform CLI and web editor",
5
5
  "keywords": [
6
6
  "knowledge-base",
@@ -71,10 +71,10 @@
71
71
  "ajv-formats": "^3.0.1",
72
72
  "tsdown": "^0.21.7",
73
73
  "typescript": "^5.9.3",
74
- "@inkeep/open-knowledge-app": "0.59.0-beta.39",
75
- "@inkeep/open-knowledge-core": "0.59.0-beta.39",
74
+ "@inkeep/open-knowledge-app": "0.59.0-beta.40",
75
+ "@inkeep/open-knowledge-core": "0.59.0-beta.40",
76
76
  "@inkeep/open-knowledge-native-config": "0.0.0",
77
- "@inkeep/open-knowledge-server": "0.59.0-beta.39"
77
+ "@inkeep/open-knowledge-server": "0.59.0-beta.40"
78
78
  },
79
79
  "scripts": {
80
80
  "build:cli": "rm -rf dist && tsdown",
@@ -1,2 +0,0 @@
1
- import"./src-BD1wHyiU.mjs";var e=`0.59.0-beta.39`;const t=`config.yml`,n=e;export{n,t};
2
- //# sourceMappingURL=constants-7Yv6cluF.mjs.map
@@ -1 +0,0 @@
1
- import"./src-CKvbaaFV.mjs";import{g as e}from"./init-CG7engaW.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-DsdBuJPZ.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-DrsokgLX.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +0,0 @@
1
- import{t as e}from"./index-BuQhICuW.js";export{e as FeedbackForm};
@@ -1 +0,0 @@
1
- import{t as e}from"./ManagedArtifactProperties-DPG7IerN.js";export{e as ManagedArtifactProperties};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-DcqlxvbR.js","./mermaid.core-DUFfAOa8.js","./preload-helper-Chd9yIcd.js","./chunk-4I5QYGJK-CdakfThp.js","./src-BhPrWnP5.js","./chunk-CYidjpOJ.js","./src-BJDBXEob.js","./chunk-Y2CYZVJY-4leQOjDx.js","./chunk-I66GZJ75-DQJBUxOU.js","./chunk-NSK5VX7P-CfSajvN6.js","./dist-CK2lSTAX.js","./chunk-WRU74C26-DUud6FI6.js","./chunk-3NCLNEKW-cC1YisGp.js","./chunk-7BUUIJ7U-DYSWVK_v.js","./chunk-7Z6QIM7H-nioyImE2.js","./line-C1wSlJLG.js","./path-0K1vu23z.js","./array-Cl6WHFH4.js","./chunk-QR6OTTB3-CbdsusFj.js","./chunk-UBXNYLIW-CNbSj4ld.js","./chunk-W5SLKNZC-CdyCCS5E.js","./rough.esm-CJXrCZNp.js","./chunk-J7OUQ5F2-DR-Oo-uo.js","./chunk-ZIRB5QZD-C1OYAa2H.js","./dist-B8ci-tfH.js","./dist-CdPpcftY.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./utils-CPqDy6Hr.js";import{t as c}from"./button-CA0dewJJ.js";import{t as l}from"./createLucideIcon-CAkY8Blx.js";import{t as u}from"./triangle-alert-CJVfCxE0.js";var d=l(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),f=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),p=l(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),m=l(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ee=l(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),h=l(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),g=l(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),te=o(),_=e(r(),1),v=n(),y=(0,_.createContext)(null);function b(e){let t=(0,te.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,v.jsx)(y.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function x(){return(0,_.use)(y)}var S=.5,ne=4,C=.25,w=48,T={type:`button`,size:`icon-sm`,variant:`secondary`,className:`border-border`},E=null;function D(){return E||=t(()=>import(`./mermaid.core-DcqlxvbR.js`).then(e=>e.default),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).catch(e=>{throw E=null,e}),E}var O=null;function k(){return O||=Promise.all([t(()=>import(`./dist-CdPpcftY.js`),[],import.meta.url),t(()=>import(`./dist-B8ci-tfH.js`),__vite__mapDeps([24,25]),import.meta.url)]).catch(e=>{throw O=null,e}),O}function A(){if(typeof document<`u`){let e=document.documentElement.classList;if(e.contains(`dark`))return`dark`;if(e.contains(`light`))return`light`}return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}var j={fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,background:`#0b0b0d`,primaryColor:`#1c1c1f`,primaryTextColor:`#f5f5f7`,primaryBorderColor:`#2a2a2e`,secondaryColor:`#242427`,secondaryTextColor:`#f5f5f7`,secondaryBorderColor:`#2a2a2e`,tertiaryColor:`#2c2c30`,tertiaryTextColor:`#f5f5f7`,tertiaryBorderColor:`#2a2a2e`,mainBkg:`#1c1c1f`,lineColor:`#5a5a63`,textColor:`#f5f5f7`,actorBkg:`#1c1c1f`,actorBorder:`#2a2a2e`,actorTextColor:`#f5f5f7`,actorLineColor:`#4a4a52`,signalColor:`#8b8b93`,signalTextColor:`#a1a1a9`,labelBoxBkgColor:`#1c1c1f`,labelBoxBorderColor:`#4a4a52`,labelTextColor:`#a1a1a9`,loopTextColor:`#a1a1a9`,nodeBorder:`#1c1c1f`,clusterBkg:`#141416`,clusterBorder:`#2a2a2e`,defaultLinkColor:`#5a5a63`,edgeLabelBackground:`#0b0b0d`,titleColor:`#a1a1a9`,noteBkgColor:`#c88a1e`,noteTextColor:`#ffffff`,noteBorderColor:`#c88a1e`,activationBkgColor:`#2c2c30`,activationBorderColor:`#3a3a40`};function M(e){return{startOnLoad:!1,securityLevel:`strict`,theme:e===`dark`?`dark`:`default`,themeVariables:e===`dark`?j:void 0,suppressErrorRendering:!0}}var N=null;function P(){return N||=t(()=>import(`./panzoom.es-JC-R1D77.js`).then(e=>e.default),[],import.meta.url).catch(e=>{throw N=null,e}),N}var F=[`mousedown`,`mouseup`,`click`,`dblclick`,`pointerdown`,`pointerup`,`keydown`,`keyup`,`keypress`];function I(e){let t=(0,te.c)(64),{chart:n,className:r,editBinding:a}=e,o=n===void 0?``:n,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={status:`rendering`,error:``},t[0]=c):c=t[0];let[l,d]=(0,_.useState)(c),[f,p]=(0,_.useState)(0),[m,ee]=(0,_.useState)(z),h,g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{if(typeof document>`u`)return;let e=document.documentElement,t=()=>{let e=A();ee(t=>t===e?t:e)};t();let n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>n.disconnect()},g=[],t[1]=h,t[2]=g):(h=t[1],g=t[2]),(0,_.useEffect)(h,g);let y=x(),b=a?a.canEdit:y?.editor.isEditable??!1,w=(0,_.useRef)(null),T=(0,_.useRef)(y),E,O;t[3]===y?(E=t[4],O=t[5]):(E=()=>{T.current=y},O=[y],t[3]=y,t[4]=E,t[5]=O),(0,_.useLayoutEffect)(E,O);let j=(0,_.useRef)(a),N,I;t[6]===a?(N=t[7],I=t[8]):(N=()=>{j.current=a},I=[a],t[6]=a,t[7]=N,t[8]=I),(0,_.useLayoutEffect)(N,I);let B=(0,_.useRef)(o),V,H;t[9]===o?(V=t[10],H=t[11]):(H=()=>{B.current=o},V=[o],t[9]=o,t[10]=V,t[11]=H),(0,_.useLayoutEffect)(H,V);let U=(0,_.useRef)(b),W,G;t[12]===b?(W=t[13],G=t[14]):(W=()=>{U.current=b},G=[b],t[12]=b,t[13]=W,t[14]=G),(0,_.useLayoutEffect)(W,G);let K=(0,_.useRef)(m),oe,se;t[15]===m?(oe=t[16],se=t[17]):(oe=()=>{K.current=m},se=[m],t[15]=m,t[16]=oe,t[17]=se),(0,_.useLayoutEffect)(oe,se);let ce=(0,_.useRef)(null),le=(0,_.useRef)(null),q=(0,_.useRef)(null),ue=(0,_.useRef)(!1),de;t[18]===o?de=t[19]:(de=o.trim(),t[18]=o,t[19]=de);let J=!!de,fe;t[20]===J?fe=t[21]:(fe=()=>{if(!J)return;let e=!1,t=null,n=[],r=!1;d({status:`rendering`,error:``}),P().catch(ie);let i=function(e){let t=j.current;if(t){t.commitChart(e);return}let n=T.current;if(!n)return;let r=n.getPos();if(typeof r!=`number`)return;let i=n.editor.state.doc.nodeAt(r);if(!i||i.type.name!==`jsxComponent`)return;let a=i.attrs.props??{};try{n.editor.view.dispatch(n.editor.state.tr.setNodeMarkup(r,null,{...i.attrs,props:{...a,chart:e},sourceDirty:!0}))}catch(e){let t=e;if(!(t instanceof RangeError))throw t}},a=function(){let t=w.current?.querySelector(`svg`),n=q.current;if(q.current=null,n?.destroy(),t?.namespaceURI!==`http://www.w3.org/2000/svg`)return;let r=t.viewBox?.baseVal;r&&r.width>0&&(t.style.maxWidth=`${r.width}px`),P().then(n=>{e||w.current?.querySelector(`svg`)===t&&(q.current?.destroy(),q.current=n(t,{canvas:!0,cursor:`default`,maxScale:ne,minScale:S,noBind:!0,step:C,touchAction:`auto`}))}).catch(R)};return Promise.all([D(),k()]).then(o=>{let[s,c]=o,[l,u]=c,f=w.current;if(e||!f)return;let p=new l.MermaidWysiwygEditor({code:B.current});t=new u.MermaidCanvasView({editor:p,container:f,mermaid:s,mermaidConfig:M(K.current),readOnly:!U.current,accentColor:`var(--ring)`}),ce.current=p,le.current=t,n.push(p.on(`change`,e=>{let{code:t,origin:n}=e;n!==`external`&&i(t)}),t.on(`render`,t=>{let{ok:n,error:i}=t;e||(n?(r=!0,d({status:`ready`,error:``}),a()):r||d({status:`error`,error:i??``}))}))}).catch(t=>{e||(ue.current=!0,d({status:`error`,error:t instanceof Error?t.message:String(t)}))}),()=>{e=!0;for(let e of n)e();q.current?.destroy(),q.current=null,t?.destroy(),ce.current=null,le.current=null}},t[20]=J,t[21]=fe);let pe;t[22]!==J||t[23]!==f?(pe=[J,f],t[22]=J,t[23]=f,t[24]=pe):pe=t[24],(0,_.useEffect)(fe,pe);let me,he;t[25]===o?(me=t[26],he=t[27]):(me=()=>{let e=ce.current;e&&o!==e.code?e.setCode(o,`external`):!ce.current&&ue.current&&o.trim()&&(ue.current=!1,p(L))},he=[o],t[25]=o,t[26]=me,t[27]=he),(0,_.useEffect)(me,he);let ge,_e;t[28]===b?(ge=t[29],_e=t[30]):(ge=()=>{le.current?.setReadOnly(!b)},_e=[b],t[28]=b,t[29]=ge,t[30]=_e),(0,_.useEffect)(ge,_e);let ve,ye;t[31]===m?(ve=t[32],ye=t[33]):(ve=()=>{le.current?.setMermaidConfig(M(m))},ye=[m],t[31]=m,t[32]=ve,t[33]=ye),(0,_.useEffect)(ve,ye);let be,xe;if(t[34]!==b||t[35]!==J?(be=()=>{let e=w.current;if(!e||!b||!J)return;let t=re;for(let n of F)e.addEventListener(n,t);return()=>{for(let n of F)e.removeEventListener(n,t)}},xe=[b,J],t[34]=b,t[35]=J,t[36]=be,t[37]=xe):(be=t[36],xe=t[37]),(0,_.useEffect)(be,xe),!J){let e;t[38]===r?e=t[39]:(e=s(`mermaid mermaid-placeholder flex min-h-16 w-full items-center justify-center rounded-md border border-dashed border-border/60 bg-muted/10 px-3 py-6 text-sm text-muted-foreground`,r),t[38]=r,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,v.jsx)(`span`,{className:`mermaid-empty`,children:(0,v.jsx)(i,{id:`8nWu1k`})}),t[40]=n):n=t[40];let a;return t[41]===e?a=t[42]:(a=(0,v.jsx)(`div`,{className:e,"data-component-type":`mermaid`,children:n}),t[41]=e,t[42]=a),a}let Y=l.status===`ready`,X;t[43]!==r||t[44]!==Y||t[45]!==l.status?(X=s(`mermaid`,Y&&s(`mermaid-ready flex h-full min-h-64 w-full overflow-hidden rounded-md border border-border/60 bg-background`,r),l.status===`error`&&`mermaid-error`,l.status===`rendering`&&`mermaid-rendering`),t[43]=r,t[44]=Y,t[45]=l.status,t[46]=X):X=t[46];let Se=l.status===`error`?l.error:void 0,Z;t[47]!==o||t[48]!==l.error||t[49]!==l.status?(Z=l.status===`error`&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{role:`alert`,className:`mermaid-error-message mb-2 flex items-start gap-2 rounded border border-destructive/30 bg-destructive/5 px-3 py-2 text-[12px] text-destructive`,children:[(0,v.jsx)(u,{className:`size-3.5 shrink-0 mt-0.5`,"aria-hidden":!0}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`font-medium`,children:(0,v.jsx)(i,{id:`OLBz-_`})}),(0,v.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words font-mono text-[11px] opacity-90`,children:l.error})]})]}),(0,v.jsx)(`pre`,{className:`mermaid-error-source`,children:o})]}),t[47]=o,t[48]=l.error,t[49]=l.status,t[50]=Z):Z=t[50];let Ce=Y?`flex`:`hidden`,Q;t[51]===Ce?Q=t[52]:(Q=s(`relative min-h-0 flex-1 overflow-hidden bg-muted/20`,Ce),t[51]=Ce,t[52]=Q);let we;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,v.jsx)(`div`,{ref:w,className:`ok-mermaid-svg flex min-h-0 flex-1`}),t[53]=we):we=t[53];let $;t[54]===Y?$=t[55]:($=Y&&(0,v.jsx)(ae,{panzoomRef:q}),t[54]=Y,t[55]=$);let Te;t[56]!==Q||t[57]!==$?(Te=(0,v.jsxs)(`div`,{contentEditable:!1,className:Q,children:[we,$]}),t[56]=Q,t[57]=$,t[58]=Te):Te=t[58];let Ee;return t[59]!==X||t[60]!==Se||t[61]!==Z||t[62]!==Te?(Ee=(0,v.jsxs)(`div`,{className:X,"data-component-type":`mermaid`,title:Se,children:[Z,Te]}),t[59]=X,t[60]=Se,t[61]=Z,t[62]=Te,t[63]=Ee):Ee=t[63],Ee}function re(e){return e.stopPropagation()}function L(e){return e+1}function R(e){console.warn(`[Mermaid] panzoom setup failed:`,e)}function ie(){}function z(){return A()}function ae(e){let t=(0,te.c)(80),{panzoomRef:n}=e,{_:r}=a(),i;t[0]===r?i=t[1]:(i=r({id:`AWOSPo`}),t[0]=r,t[1]=i);let o;t[2]===r?o=t[3]:(o=r({id:`FjkaiT`}),t[2]=r,t[3]=o);let s;t[4]===r?s=t[5]:(s=r({id:`0BfhAj`}),t[4]=r,t[5]=s);let l;t[6]===r?l=t[7]:(l=r({id:`PrhzDE`}),t[6]=r,t[7]=l);let u;t[8]===r?u=t[9]:(u=r({id:`NcurBF`}),t[8]=r,t[9]=u);let _;t[10]===r?_=t[11]:(_=r({id:`UhpfxY`}),t[10]=r,t[11]=_);let y;t[12]===r?y=t[13]:(y=r({id:`glzsS_`}),t[12]=r,t[13]=y);let b;t[14]===r?b=t[15]:(b=r({id:`toyw51`}),t[14]=r,t[15]=b);let x;t[16]!==i||t[17]!==o||t[18]!==s||t[19]!==l||t[20]!==u||t[21]!==_||t[22]!==y||t[23]!==b?(x={zoomIn:i,zoomOut:o,reset:s,panUp:l,panDown:u,panLeft:_,panRight:y,toolbar:b},t[16]=i,t[17]=o,t[18]=s,t[19]=l,t[20]=u,t[21]=_,t[22]=y,t[23]=b,t[24]=x):x=t[24];let S=x,ne;t[25]===n?ne=t[26]:(ne=(e,t)=>{n.current?.pan(e,t,{relative:!0})},t[25]=n,t[26]=ne);let C=ne,E;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,v.jsx)(`span`,{"aria-hidden":`true`}),t[27]=E):E=t[27];let D;t[28]===C?D=t[29]:(D=()=>C(0,-w),t[28]=C,t[29]=D);let O;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,v.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),t[30]=O):O=t[30];let k;t[31]!==S.panUp||t[32]!==D?(k=(0,v.jsx)(c,{...T,title:S.panUp,"aria-label":S.panUp,onClick:D,children:O}),t[31]=S.panUp,t[32]=D,t[33]=k):k=t[33];let A;t[34]===n?A=t[35]:(A=()=>n.current?.zoomIn(),t[34]=n,t[35]=A);let j;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,v.jsx)(h,{className:`size-4`,"aria-hidden":`true`}),t[36]=j):j=t[36];let M;t[37]!==S.zoomIn||t[38]!==A?(M=(0,v.jsx)(c,{...T,title:S.zoomIn,"aria-label":S.zoomIn,onClick:A,children:j}),t[37]=S.zoomIn,t[38]=A,t[39]=M):M=t[39];let N;t[40]===C?N=t[41]:(N=()=>C(-w,0),t[40]=C,t[41]=N);let P;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,v.jsx)(f,{className:`size-4`,"aria-hidden":`true`}),t[42]=P):P=t[42];let F;t[43]!==S.panLeft||t[44]!==N?(F=(0,v.jsx)(c,{...T,title:S.panLeft,"aria-label":S.panLeft,onClick:N,children:P}),t[43]=S.panLeft,t[44]=N,t[45]=F):F=t[45];let I;t[46]===n?I=t[47]:(I=()=>n.current?.reset(),t[46]=n,t[47]=I);let re;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,v.jsx)(ee,{className:`size-4`,"aria-hidden":`true`}),t[48]=re):re=t[48];let L;t[49]!==S.reset||t[50]!==I?(L=(0,v.jsx)(c,{...T,title:S.reset,"aria-label":S.reset,onClick:I,children:re}),t[49]=S.reset,t[50]=I,t[51]=L):L=t[51];let R;t[52]===C?R=t[53]:(R=()=>C(w,0),t[52]=C,t[53]=R);let ie;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,v.jsx)(p,{className:`size-4`,"aria-hidden":`true`}),t[54]=ie):ie=t[54];let z;t[55]!==S.panRight||t[56]!==R?(z=(0,v.jsx)(c,{...T,title:S.panRight,"aria-label":S.panRight,onClick:R,children:ie}),t[55]=S.panRight,t[56]=R,t[57]=z):z=t[57];let ae;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,v.jsx)(`span`,{"aria-hidden":`true`}),t[58]=ae):ae=t[58];let B;t[59]===C?B=t[60]:(B=()=>C(0,w),t[59]=C,t[60]=B);let V;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,v.jsx)(d,{className:`size-4`,"aria-hidden":`true`}),t[61]=V):V=t[61];let H;t[62]!==S.panDown||t[63]!==B?(H=(0,v.jsx)(c,{...T,title:S.panDown,"aria-label":S.panDown,onClick:B,children:V}),t[62]=S.panDown,t[63]=B,t[64]=H):H=t[64];let U;t[65]===n?U=t[66]:(U=()=>n.current?.zoomOut(),t[65]=n,t[66]=U);let W;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,v.jsx)(g,{className:`size-4`,"aria-hidden":`true`}),t[67]=W):W=t[67];let G;t[68]!==S.zoomOut||t[69]!==U?(G=(0,v.jsx)(c,{...T,title:S.zoomOut,"aria-label":S.zoomOut,onClick:U,children:W}),t[68]=S.zoomOut,t[69]=U,t[70]=G):G=t[70];let K;return t[71]!==S.toolbar||t[72]!==k||t[73]!==M||t[74]!==F||t[75]!==L||t[76]!==z||t[77]!==H||t[78]!==G?(K=(0,v.jsxs)(`div`,{className:`absolute right-3 bottom-3 grid grid-cols-3 gap-1`,"data-testid":`mermaid-actions`,role:`toolbar`,"aria-label":S.toolbar,children:[E,k,M,F,L,z,ae,H,G]}),t[71]=S.toolbar,t[72]=k,t[73]=M,t[74]=F,t[75]=L,t[76]=z,t[77]=H,t[78]=G,t[79]=K):K=t[79],K}export{h as a,f as c,g as i,d as l,b as n,m as o,x as r,p as s,I as t};