@inkeep/open-knowledge 0.88.9-beta.2 → 0.88.9-beta.3

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 (85) hide show
  1. package/dist/{cli-78ggxS9d.mjs → cli-heKKE0h6.mjs} +6 -6
  2. package/dist/cli.mjs +1 -1
  3. package/dist/constants-DD0dQrNW.mjs +1 -0
  4. package/dist/{dist-B9j8kAKZ.mjs → dist-4Xy44rzG.mjs} +1 -1
  5. package/dist/{dist-CjMvnZHW.mjs → dist-B0DBnzRw.mjs} +502 -502
  6. package/dist/index.mjs +1 -1
  7. package/dist/{init-tZZEMY57.mjs → init-BiiaRaJc.mjs} +2 -2
  8. package/dist/init-BlvN269t.mjs +1 -0
  9. package/dist/{launch-json-removal-CkdStqp0.mjs → launch-json-removal-CPMxuob7.mjs} +1 -1
  10. package/dist/loader-B2I9sa8s.mjs +1 -0
  11. package/dist/{loader-CLzWCnTU.mjs → loader-CF7WIVMA.mjs} +1 -1
  12. package/dist/{open-browser-XevLmN33.mjs → open-browser-CKOAlkdm.mjs} +1 -1
  13. package/dist/preview-BaIBGVsN.mjs +1 -0
  14. package/dist/{preview-d9Xj2oz-.mjs → preview-Ch8NwweL.mjs} +1 -1
  15. package/dist/public/assets/{AccountSection-bHRNk_V5.js → AccountSection-qENJ037Z.js} +1 -1
  16. package/dist/public/assets/{ActivityModeContent-CIBAyqCQ.js → ActivityModeContent-uTfzywnv.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-DS9uZkTx.js → AddPropertiesButton-CWvueDgR.js} +1 -1
  18. package/dist/public/assets/{AgentDiffPane-C5u3b_w4.js → AgentDiffPane-BhFOm-c8.js} +1 -1
  19. package/dist/public/assets/{AttachmentsSection-Cwylv9cJ.js → AttachmentsSection-BglRmlI2.js} +1 -1
  20. package/dist/public/assets/{CodeMirrorPropInput-D7GY-vsi.js → CodeMirrorPropInput-DpGpVASC.js} +1 -1
  21. package/dist/public/assets/{ContentRulesSection-B-WyS9la.js → ContentRulesSection-Bqg5cHzL.js} +1 -1
  22. package/dist/public/assets/{DocumentContext-DXqn96Dj.js → DocumentContext-C7f-2j3S.js} +1 -1
  23. package/dist/public/assets/{EditorModeToggle-DBLccwaz.js → EditorModeToggle-D_CPJnkr.js} +1 -1
  24. package/dist/public/assets/{ExcalidrawDocEditor-B5uqWx0E.js → ExcalidrawDocEditor-DaiaNhCg.js} +1 -1
  25. package/dist/public/assets/FeedbackForm-CckRtMRS.js +1 -0
  26. package/dist/public/assets/{ImportSkillDialog-zw_ii5QI.js → ImportSkillDialog-DBwK66d6.js} +1 -1
  27. package/dist/public/assets/{LinkPreviewsSection-CVctoQ7Q.js → LinkPreviewsSection-Dz-FXsxK.js} +1 -1
  28. package/dist/public/assets/{LintConfigEditor-CCyO7123.js → LintConfigEditor-D80LBug6.js} +1 -1
  29. package/dist/public/assets/{LintingSection-CkSQo-gu.js → LintingSection-iTdBTXpn.js} +1 -1
  30. package/dist/public/assets/ManagedArtifactProperties-CgwjRrjW.js +1 -0
  31. package/dist/public/assets/{ManagedArtifactProperties-C9jhSWMF.js → ManagedArtifactProperties-DD5MRuAW.js} +1 -1
  32. package/dist/public/assets/{MermaidDocEditor-5jiPIdAL.js → MermaidDocEditor-BZg78G3J.js} +1 -1
  33. package/dist/public/assets/{NetworkAccessSection-B9sx911F.js → NetworkAccessSection-DFTxrwZl.js} +1 -1
  34. package/dist/public/assets/{PropertyDisplayRow-2eko2YVG.js → PropertyDisplayRow-CbF44Jsc.js} +1 -1
  35. package/dist/public/assets/{PublishToGitHubDialog-MRhU3m1O.js → PublishToGitHubDialog-Bi4yg3gA.js} +1 -1
  36. package/dist/public/assets/{SchemaConfigEditor-DFLRZpKw.js → SchemaConfigEditor-BheAGWoK.js} +1 -1
  37. package/dist/public/assets/{SearchSection-B5ODJxFu.js → SearchSection-Cs4KQUa1.js} +1 -1
  38. package/dist/public/assets/{SessionsHost-tfaJ-irn.js → SessionsHost-B4VnJSVy.js} +2 -2
  39. package/dist/public/assets/{SettingsDialogBody-XoqrDmag.js → SettingsDialogBody-BfNVNXOX.js} +2 -2
  40. package/dist/public/assets/{ShareReceiveMissDialog-Dkl4VORm.js → ShareReceiveMissDialog-CiW8SA14.js} +1 -1
  41. package/dist/public/assets/{SkillToolbarControls-CMbrDecI.js → SkillToolbarControls-BwvWExD-.js} +1 -1
  42. package/dist/public/assets/{SourceEditor-h5yPfEoM.js → SourceEditor-BCDbD-lX.js} +1 -1
  43. package/dist/public/assets/{SyncSection-IgN0JEiL.js → SyncSection-zY-Hk6_u.js} +1 -1
  44. package/dist/public/assets/{SyncStatusBadge-BNYfSyo3.js → SyncStatusBadge-BeCo1R8Y.js} +1 -1
  45. package/dist/public/assets/{TerminalSection-Bq9pWdqB.js → TerminalSection-DP3QvSyD.js} +1 -1
  46. package/dist/public/assets/{TerminalWindowApp-C9qqlU_B.js → TerminalWindowApp-B5WuXD5M.js} +1 -1
  47. package/dist/public/assets/{TextDocEditor-DnOJUyur.js → TextDocEditor-CMiHX9T4.js} +1 -1
  48. package/dist/public/assets/{ThreadView-CyuW42aX.js → ThreadView-CFhT-yDc.js} +1 -1
  49. package/dist/public/assets/{TimelineDiffPane-Yt6mGPXb.js → TimelineDiffPane-BDvNV1AG.js} +1 -1
  50. package/dist/public/assets/{client-version-DJxwS4jI.js → client-version-QyucWXca.js} +1 -1
  51. package/dist/public/assets/{comment-chips-BDz0jvV-.js → comment-chips-Ct3n-Ocd.js} +1 -1
  52. package/dist/public/assets/{config-provider-BdqYLWTk.js → config-provider-B084_P-F.js} +1 -1
  53. package/dist/public/assets/{doc-undo-manager-BS8LDmSB.js → doc-undo-manager-DusTYvFB.js} +1 -1
  54. package/dist/public/assets/{index-DDdInvcw.js → index-EG4CXoqu.js} +7 -7
  55. package/dist/public/assets/{lint-plugins-Df0iB6ZL.js → lint-plugins-WKwhKAIC.js} +1 -1
  56. package/dist/public/assets/{pending-receive-nav-store-PoNyEtCJ.js → pending-receive-nav-store-DpVXFUf1.js} +1 -1
  57. package/dist/public/assets/{preferred-session-events-DRwedC4l.js → preferred-session-events-DJCdCQuc.js} +1 -1
  58. package/dist/public/assets/{progress-CIBZtkMN.js → progress-G97DGgRz.js} +1 -1
  59. package/dist/public/assets/{selection-context-BKZrCaCI.js → selection-context-QdjbPI3E.js} +1 -1
  60. package/dist/public/assets/{src-jt9_T0XO.js → src-B_RRa5ZI.js} +1 -1
  61. package/dist/public/assets/{telemetry-impl-DvVUQZKW.js → telemetry-impl-DLO_0UAa.js} +1 -1
  62. package/dist/public/assets/{telemetry-startup-CnaVjI19.js → telemetry-startup-BMWOHbB6.js} +1 -1
  63. package/dist/public/assets/{typing-burst-detector-CQd0s--X.js → typing-burst-detector-CSLkAaYr.js} +1 -1
  64. package/dist/public/assets/{use-activity-panel-B2645ugD.js → use-activity-panel-CObfBAb1.js} +1 -1
  65. package/dist/public/assets/{use-open-skill-BuK_lWsT.js → use-open-skill-CzOAeSq6.js} +1 -1
  66. package/dist/public/assets/{use-terminal-enabled-BXPeoDBJ.js → use-terminal-enabled-D4EqjdQP.js} +1 -1
  67. package/dist/public/assets/{use-timeline-entry-diff-PstJ8awU.js → use-timeline-entry-diff-B2h1ZYkY.js} +1 -1
  68. package/dist/public/index.html +19 -19
  69. package/dist/{registry-probes-Bh1Qy3qZ.mjs → registry-probes-BO8LQnnq.mjs} +1 -1
  70. package/dist/{removal-file-path-cvkiBibT.mjs → removal-file-path-BU5oybZW.mjs} +1 -1
  71. package/dist/{repair-launch-json-DyuTwfkz.mjs → repair-launch-json-3kR-vJqB.mjs} +1 -1
  72. package/dist/{repair-mcp-configs-DbiwUJCR.mjs → repair-mcp-configs-Bjdl4e04.mjs} +1 -1
  73. package/dist/src-4tLs8QTq.mjs +1 -0
  74. package/dist/{src-DA0Ksa-7.mjs → src-DAphXmts.mjs} +1 -1
  75. package/dist/{start-DEwAokRH.mjs → start-BAvitkf3.mjs} +3 -3
  76. package/dist/start-Bd3DQKN3.mjs +1 -0
  77. package/package.json +4 -4
  78. package/dist/constants-CLQ8X-E2.mjs +0 -1
  79. package/dist/init-Djx6uVIJ.mjs +0 -1
  80. package/dist/loader-CPoDR3tl.mjs +0 -1
  81. package/dist/preview-Cbc7dZii.mjs +0 -1
  82. package/dist/public/assets/FeedbackForm-BFfpAR60.js +0 -1
  83. package/dist/public/assets/ManagedArtifactProperties-DffV_RLk.js +0 -1
  84. package/dist/src-Cii4d3mM.mjs +0 -1
  85. package/dist/start-CkI_wBlE.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{A as r,D as i,F as a,Gt as o,I as s,Jt as c,L as l,M as u,N as d,O as f,P as p,Ut as m,Yt as h,_ as g,g as _,i as v,j as y,k as ee}from"./DocumentContext-DXqn96Dj.js";import{t as b}from"./react-f2sANaYj.js";import{n as x,r as S}from"./dist-Nvb76hAm.js";import{t as C}from"./react-dom-DPxgxlDT.js";import{t as w}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./react-error-boundary-6ac6QM6R.js";import{T,X as E,Y as D,_t as O,at as ne,dt as re,it as ie,lt as ae,mt as k,n as oe,pt as A}from"./dist-Dc8tD1th.js";import{Yt as se,bt as j,it as ce}from"./schemas-api-WgoIuF0H.js";import{c as le}from"./Mermaid-DH1HLMlB.js";import{h as M,i as ue,l as de,n as fe,t as pe}from"./PropertyDisplayRow-2eko2YVG.js";import{Ct as me,at as he,ct as ge,nt as _e,ot as ve,rt as ye,tt as be,ut as xe,wt as Se}from"./CodeMirrorPropInput-D7GY-vsi.js";import{t as Ce}from"./minus-DdRxss3A.js";import{n as we,t as Te}from"./plus-CXQ-oViZ.js";import{t as Ee}from"./libesm-DKFmHwvW.js";var N=w(),P=n(),F=200;function De(e){let t=(0,N.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,P.jsx)(Me,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,s,c,l,u,d,f,p;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=fe,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,P.jsx)(x,{id:`l_UFPv`}),t[14]=s):s=t[14],c=n.changes.length,l=`property-diff-block`,u=`border-b border-border py-3`,d=r,f=i,p=e.map(Oe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p}else a=t[5],o=t[6],s=t[7],c=t[8],l=t[9],u=t[10],d=t[11],f=t[12],p=t[13];let m;t[15]===o?m=t[16]:(m=o>0&&(0,P.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,P.jsx)(x,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=m);let h;return t[17]!==a||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,P.jsxs)(a,{title:s,count:c,testId:l,className:u,open:d,onOpenChange:f,children:[p,m]}),t[17]=a,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}function Oe(e){return(0,P.jsx)(ke,{change:e},`${e.kind}-${e.key}`)}function ke(e){let t=(0,N.c)(22),{change:n}=e,{_:r}=S(),i=de[se(n.kind===`removed`?n.before:n.after)],a;t[0]!==r||t[1]!==n.kind?(a=n.kind===`added`?{KindIcon:Te,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:Ce,kindLabel:r({id:`eps54V`})}:{KindIcon:we,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=a):a=t[2];let{KindIcon:o,kindLabel:s}=a,c;t[3]===o?c=t[4]:(c=(0,P.jsx)(o,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=o,t[4]=c);let l;t[5]===s?l=t[6]:(l=(0,P.jsx)(`span`,{className:`sr-only`,children:s}),t[5]=s,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,P.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]===i?d=t[11]:(d=(0,P.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=d);let f;t[12]===n?f=t[13]:(f=(0,P.jsx)(Ae,{change:n}),t[12]=n,t[13]=f);let p;t[14]!==n.key||t[15]!==d||t[16]!==f?(p=(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(pe,{icon:d,label:n.key,dataKey:n.key,children:f})}),t[14]=n.key,t[15]=d,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==n.key||t[19]!==u||t[20]!==p?(m=(0,P.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[u,p]}),t[18]=n.key,t[19]=u,t[20]=p,t[21]=m):m=t[21],m}function Ae(e){let t=(0,N.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,P.jsx)(I,{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,P.jsx)(I,{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=M(n.before)||M(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,P.jsx)(I,{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,P.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,P.jsx)(I,{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,P.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 I(e){let t=(0,N.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(M(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,P.jsx)(ue,{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,P.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(je).join(`, `):String(n),r=e.length>F;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,F)}…`: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,P.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 je(e){return typeof e==`string`}function Me(e){let t=(0,N.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,P.jsx)(x,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(x,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,P.jsx)(L,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(x,{id:`NawEr2`}),t[4]=o):o=t[4];let s;t[5]===n.after?s=t[6]:(s=(0,P.jsx)(L,{label:o,text:n.after}),t[5]=n.after,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,P.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,P.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,s]})]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function L(e){let t=(0,N.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,P.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,P.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,P.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var Ne=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}()})),Pe=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}})),R=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=Pe();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}]}})),Fe=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=Ne(),r=Pe(),i=R(),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)}})),Ie=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=Ne();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=Fe(),r=R();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)}})),z=e(b(),1),Le=e(C(),1),B=Ie();function V(){}V.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(Re(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 Re(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 ze=new V;function Be(e,t,n){return ze.diff(e,t,n)}var H=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Ve=/\S/,U=new V;U.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Ve.test(e)&&!Ve.test(t)},U.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]&&H.test(t[n])&&H.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function He(e,t,n){return U.diff(e,t,n)}var Ue=new V;Ue.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{A as r,D as i,F as a,Gt as o,I as s,Jt as c,L as l,M as u,N as d,O as f,P as p,Ut as m,Yt as h,_ as g,g as _,i as v,j as y,k as ee}from"./DocumentContext-C7f-2j3S.js";import{t as b}from"./react-f2sANaYj.js";import{n as x,r as S}from"./dist-Nvb76hAm.js";import{t as C}from"./react-dom-DPxgxlDT.js";import{t as w}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./react-error-boundary-6ac6QM6R.js";import{T,X as E,Y as D,_t as O,at as ne,dt as re,it as ie,lt as ae,mt as k,n as oe,pt as A}from"./dist-Dc8tD1th.js";import{Yt as se,bt as j,it as ce}from"./schemas-api-WgoIuF0H.js";import{c as le}from"./Mermaid-DH1HLMlB.js";import{h as M,i as ue,l as de,n as fe,t as pe}from"./PropertyDisplayRow-CbF44Jsc.js";import{Ct as me,at as he,ct as ge,nt as _e,ot as ve,rt as ye,tt as be,ut as xe,wt as Se}from"./CodeMirrorPropInput-DpGpVASC.js";import{t as Ce}from"./minus-DdRxss3A.js";import{n as we,t as Te}from"./plus-CXQ-oViZ.js";import{t as Ee}from"./libesm-DKFmHwvW.js";var N=w(),P=n(),F=200;function De(e){let t=(0,N.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,P.jsx)(Me,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,s,c,l,u,d,f,p;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=fe,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,P.jsx)(x,{id:`l_UFPv`}),t[14]=s):s=t[14],c=n.changes.length,l=`property-diff-block`,u=`border-b border-border py-3`,d=r,f=i,p=e.map(Oe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p}else a=t[5],o=t[6],s=t[7],c=t[8],l=t[9],u=t[10],d=t[11],f=t[12],p=t[13];let m;t[15]===o?m=t[16]:(m=o>0&&(0,P.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,P.jsx)(x,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=m);let h;return t[17]!==a||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,P.jsxs)(a,{title:s,count:c,testId:l,className:u,open:d,onOpenChange:f,children:[p,m]}),t[17]=a,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}function Oe(e){return(0,P.jsx)(ke,{change:e},`${e.kind}-${e.key}`)}function ke(e){let t=(0,N.c)(22),{change:n}=e,{_:r}=S(),i=de[se(n.kind===`removed`?n.before:n.after)],a;t[0]!==r||t[1]!==n.kind?(a=n.kind===`added`?{KindIcon:Te,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:Ce,kindLabel:r({id:`eps54V`})}:{KindIcon:we,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=a):a=t[2];let{KindIcon:o,kindLabel:s}=a,c;t[3]===o?c=t[4]:(c=(0,P.jsx)(o,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=o,t[4]=c);let l;t[5]===s?l=t[6]:(l=(0,P.jsx)(`span`,{className:`sr-only`,children:s}),t[5]=s,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,P.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]===i?d=t[11]:(d=(0,P.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=d);let f;t[12]===n?f=t[13]:(f=(0,P.jsx)(Ae,{change:n}),t[12]=n,t[13]=f);let p;t[14]!==n.key||t[15]!==d||t[16]!==f?(p=(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(pe,{icon:d,label:n.key,dataKey:n.key,children:f})}),t[14]=n.key,t[15]=d,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==n.key||t[19]!==u||t[20]!==p?(m=(0,P.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[u,p]}),t[18]=n.key,t[19]=u,t[20]=p,t[21]=m):m=t[21],m}function Ae(e){let t=(0,N.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,P.jsx)(I,{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,P.jsx)(I,{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=M(n.before)||M(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,P.jsx)(I,{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,P.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,P.jsx)(I,{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,P.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 I(e){let t=(0,N.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(M(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,P.jsx)(ue,{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,P.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(je).join(`, `):String(n),r=e.length>F;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,F)}…`: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,P.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 je(e){return typeof e==`string`}function Me(e){let t=(0,N.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,P.jsx)(x,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(x,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,P.jsx)(L,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(x,{id:`NawEr2`}),t[4]=o):o=t[4];let s;t[5]===n.after?s=t[6]:(s=(0,P.jsx)(L,{label:o,text:n.after}),t[5]=n.after,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,P.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,P.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,s]})]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function L(e){let t=(0,N.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,P.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,P.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,P.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var Ne=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}()})),Pe=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}})),R=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=Pe();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}]}})),Fe=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=Ne(),r=Pe(),i=R(),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)}})),Ie=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=Ne();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=Fe(),r=R();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)}})),z=e(b(),1),Le=e(C(),1),B=Ie();function V(){}V.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(Re(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 Re(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 ze=new V;function Be(e,t,n){return ze.diff(e,t,n)}var H=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Ve=/\S/,U=new V;U.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Ve.test(e)&&!Ve.test(t)},U.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]&&H.test(t[n])&&H.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function He(e,t,n){return U.diff(e,t,n)}var Ue=new V;Ue.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 V;We.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Ge=new V;Ge.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function W(e){"@babel/helpers - typeof";return W=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},W(e)}var Ke=Object.prototype.toString,G=new V;G.useLongestToken=!0,G.tokenize=Ue.tokenize,G.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(K(e,null,null,i),i,` `)},G.equals=function(e,t){return V.prototype.equals.call(G,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function K(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(Ke.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=K(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),W(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]=K(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var q=new V;q.tokenize=function(e){return e.slice()},q.join=q.removeEmpty=function(e){return e};function J(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 A(n,i,t.slice(n,r))}function qe(e){if(!e.steps.length)return;let t=new k(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 A&&r instanceof A?J(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function Y(e){let t=new k(e);return t.removeMark(0,e.nodeSize-2),t.doc}function Je(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 X(e){return JSON.parse(JSON.stringify(e))}var Ye=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 k(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=Y(this.fromDoc).toJSON(),this.finalJSON=Y(this.toDoc).toJSON(),this.ops=(0,B.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,B.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=qe(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=X(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,B.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=Y(this.tr.doc).toJSON(),this.ops=(0,B.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=J(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=X(this.currentJSON),a=X(this.currentJSON);(0,B.applyPatch)(i,[n]),(0,B.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=Je(this.currentJSON,e.path),u=this.wordDiffs?He(l,c):Be(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 Xe(e,t,n={}){return new Ye(e,t,n).init()}var Ze=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function Qe(e){let t=[];return e.forEach((e,n)=>{if(Ze.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 $e(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 et(e,t){let n=$e(Qe(e),Qe(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 tt=400;function nt(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function rt(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof ae?`add`:t instanceof re?`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 it(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=nt(r,n,e),a=nt(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=Xe(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=et(i,o),l=s?rt(s,c):[];return c.length+l.length>tt?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var at=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ot(e){return e.changes.length+2*e.markChanges.length}function st(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ct(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 lt(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&&ct(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}var Z=new WeakMap;function ut(e,t,n){let r=O.fromSchema(e);return new O({...r.nodes,jsxComponent:e=>{let r=t(e);return n.push(r.destroy),{dom:r.dom,contentDOM:r.contentDOM}}},r.marks)}function dt(e,t,n,r){let i=st(t);return D.widget(e,()=>{let e=[],a=lt(ut(n,r,e),t,i);return Z.set(a,e),a},{side:-1,ignoreSelection:!0,marks:[],destroy:e=>{for(let t of Z.get(e)??[])t();Z.delete(e)}})}function ft(e,t,n,r,i,a){let o=[];for(let e of r){let n=t.slice(e.fromA,e.toA);o.push(dt(e.fromB,n.content,i,a)),o.push(D.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(D.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA);o.push(dt(e.fromB,n.content,i,a))}return E.create(e,o)}function pt(e){return e.attrs.props??{}}function mt(e,t){return e.name===`Mirror`?!0:e.name===`Excalidraw`&&c(t.src)}function ht(e){let t=o(e.src),n=o(e.name);return n?`${t}#${n}`:t}function gt(e,t){let n=new Set(e.props.map(e=>e.name));return{...t,...n.has(`defaultOpen`)?{defaultOpen:!0}:{},...n.has(`autoplay`)?{autoplay:!1}:{},...n.has(`loop`)?{loop:!1}:{},...n.has(`controls`)?{controls:!0}:{}}}function _t(e){return{className:f,...y(m(e.attrs.componentName),pt(e))}}function vt(e){let t=a(e).split(`
3
3
  `),n=t.findIndex(e=>e.trimEnd().endsWith(`>`));return t.slice(0,n+1).join(`
4
4
  `)}function yt(e){let t=(0,N.c)(8),{node:n,heading:r,children:i}=e,o;t[0]===r?o=t[1]:(o=(0,P.jsx)(`div`,{className:`flex gap-2 text-xs font-mono text-foreground px-2 py-1`,children:r}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n?(s=n.childCount>0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`code`,{className:`block whitespace-pre-wrap px-2 text-xs text-foreground`,children:vt(n)}),i]}):(0,P.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-3 py-2 text-sm`,children:(0,P.jsx)(`code`,{children:a(n)})}),t[2]=i,t[3]=n,t[4]=s):s=t[4];let c;return t[5]!==o||t[6]!==s?(c=(0,P.jsxs)(`div`,{"data-diff-jsx-source":``,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function bt(e){let t=(0,N.c)(42),{node:n,docName:r,children:i}=e,{_:a}=S(),o=String(n.attrs.componentName??``),c,f,p,g,_,v,y,b,x,C;if(t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==n||t[4]!==o){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=m(o),S=e.displayName??e.name;if(e.name===`*`){let e;t[15]!==a||t[16]!==o?(e=a({id:`sJWhgo`,values:{unregisteredComponentName:o}}),t[15]=a,t[16]=o,t[17]=e):e=t[17];let r;t[18]!==i||t[19]!==n||t[20]!==e?(r=(0,P.jsx)(yt,{node:n,heading:e,children:i}),t[18]=i,t[19]=n,t[20]=e,t[21]=r):r=t[21],C=r;break bb0}let w=d(e,ee(n.attrs,e),r);if(l(e,pt(n))||mt(e,w)){let{Icon:r}=s(e),a=ht(w),o=(0,P.jsxs)(`div`,{"data-diff-jsx-reference":``,className:`flex items-center gap-2 rounded-md border border-dashed border-border px-3 py-2 text-sm text-foreground`,children:[(0,P.jsx)(r,{size:16,"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:S}),a?(0,P.jsx)(`code`,{className:`truncate`,children:a}):null]}),c=n.childCount>0?i:null,l;t[22]!==o||t[23]!==c?(l=(0,P.jsxs)(P.Fragment,{children:[o,c]}),t[22]=o,t[23]=c,t[24]=l):l=t[24],C=l;break bb0}let T=e.Component;g=te,b=(t,n)=>{u(e.name,o,t,n)},x=()=>(0,P.jsx)(yt,{node:n,heading:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{children:S}),(0,P.jsx)(`span`,{children:a({id:`V_DjMe`})})]}),children:i}),p=h,y=!1,f=le,v=null,c=T,_=gt(e,w)}t[0]=a,t[1]=i,t[2]=r,t[3]=n,t[4]=o,t[5]=c,t[6]=f,t[7]=p,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=C}else c=t[5],f=t[6],p=t[7],g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],C=t[14];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let w;t[25]!==c||t[26]!==i||t[27]!==_?(w=(0,P.jsx)(c,{..._,children:i}),t[25]=c,t[26]=i,t[27]=_,t[28]=w):w=t[28];let T;t[29]!==f||t[30]!==v||t[31]!==w?(T=(0,P.jsx)(f,{value:v,children:w}),t[29]=f,t[30]=v,t[31]=w,t[32]=T):T=t[32];let E;t[33]!==p||t[34]!==y||t[35]!==T?(E=(0,P.jsx)(p,{value:y,children:T}),t[33]=p,t[34]=y,t[35]=T,t[36]=E):E=t[36];let D;return t[37]!==g||t[38]!==b||t[39]!==x||t[40]!==E?(D=(0,P.jsx)(g,{onError:b,fallbackRender:x,children:E}),t[37]=g,t[38]=b,t[39]=x,t[40]=E,t[41]=D):D=t[41],D}function xt(e){let t=(0,N.c)(27),{node:n,editor:i,extension:a}=e,o,s,c,l,u,d,f;if(t[0]!==i||t[1]!==a.options||t[2]!==n){let e=m(n.attrs.componentName);c=ye,t[10]===n?f=t[11]:(f=_t(n),t[10]=n,t[11]=f),s=bt,u=n,t[12]!==i||t[13]!==a.options?(d=p(a.options,i),t[12]=i,t[13]=a.options,t[14]=d):d=t[14],o=_e,l=r(e,n),t[0]=i,t[1]=a.options,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9];let h;t[15]!==o||t[16]!==l?(h=(0,P.jsx)(o,{className:l}),t[15]=o,t[16]=l,t[17]=h):h=t[17];let g;t[18]!==s||t[19]!==u||t[20]!==d||t[21]!==h?(g=(0,P.jsx)(s,{node:u,docName:d,children:h}),t[18]=s,t[19]=u,t[20]=d,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==c||t[24]!==f||t[25]!==g?(_=(0,P.jsx)(c,{...f,children:g}),t[23]=c,t[24]=f,t[25]=g,t[26]=_):_=t[26],_}var St=i.extend({addNodeView(){return he(xt)}});function Ct(e){let t=(0,N.c)(16),{node:n,docName:i,contentDOM:a}=e,o;t[0]===n?o=t[1]:(o=_t(n),t[0]=n,t[1]=o);let s;t[2]===n?s=t[3]:(s=r(m(n.attrs.componentName),n),t[2]=n,t[3]=s);let c;t[4]===a?c=t[5]:(c=e=>{e&&a.parentNode!==e&&e.appendChild(a)},t[4]=a,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,P.jsx)(`div`,{className:s,ref:c}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==i||t[10]!==n||t[11]!==l?(u=(0,P.jsx)(bt,{node:n,docName:i,children:l}),t[9]=i,t[10]=n,t[11]=l,t[12]=u):u=t[12];let d;return t[13]!==o||t[14]!==u?(d=(0,P.jsx)(`div`,{...o,children:u}),t[13]=o,t[14]=u,t[15]=d):d=t[15],d}function wt(e,t){let n=document.createElement(`div`);n.setAttribute(`data-node-view-content-react`,``);let r=new ve(Ct,{editor:e,props:{node:t,docName:me(e),contentDOM:n}});return{dom:r.element,contentDOM:n,destroy:()=>r.destroy()}}var Tt=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`trailingAffordance`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),Et=g.filter(e=>!Tt.has(e.name)).map(e=>e.name===`jsxComponent`?St:e),Q=T(Et);function Dt(e,t){return it(e,t,Q,xe())}var Ot=oe.create({name:`renderedDiffDecorations`,addOptions(){return{diff:null}},addProseMirrorPlugins(){let{diff:e}=this.options,t=this.editor,n=e?ft(e.afterDoc,e.beforeDoc,e.changes,e.markChanges,Q,e=>wt(t,e)):E.empty;return[new ie({key:new ne(`renderedDiffDecorations`),props:{decorations:()=>n}})]}});function kt(e){let t=(0,N.c)(28),{diff:n,docName:r}=e,i;if(t[0]!==n||t[1]!==r){let e=_(Et,r),a;t[3]===n?a=t[4]:(a=Ot.configure({diff:n}),t[3]=n,t[4]=a),i=[...e,a],t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;t[5]===n.afterDoc?a=t[6]:(a=n.afterDoc.toJSON(),t[5]=n.afterDoc,t[6]=a);let o;t[7]===r?o=t[8]:(o=e=>{let{editor:t}=e;return Se(t,r)},t[7]=r,t[8]=o);let s;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(s={attributes:{class:`pt-4`}},t[9]=s):s=t[9];let c;t[10]!==i||t[11]!==a||t[12]!==o?(c={editable:!1,extensions:i,content:a,onBeforeCreate:o,editorProps:s},t[10]=i,t[11]=a,t[12]=o,t[13]=c):c=t[13];let l;t[14]!==n||t[15]!==r?(l=[n,r],t[14]=n,t[15]=r,t[16]=l):l=t[16];let u=ge(c,l),[d]=(0,z.useState)(At),f=(0,z.useRef)(null),p,m;t[17]===d?(p=t[18],m=t[19]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[17]=d,t[18]=p,t[19]=m),(0,z.useLayoutEffect)(p,m);let h;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,P.jsx)(`div`,{className:`tiptap-editor`,children:(0,P.jsx)(`div`,{ref:f,style:{display:`contents`}})}),t[20]=h):h=t[20];let g;t[21]===u?g=t[22]:(g=(0,P.jsx)(be,{editor:u,className:`tiptap-editor-portal-content`}),t[21]=u,t[22]=g);let v;t[23]!==d||t[24]!==g?(v=(0,Le.createPortal)(g,d),t[23]=d,t[24]=g,t[25]=v):v=t[25];let y;return t[26]===v?y=t[27]:(y=(0,P.jsxs)(`div`,{className:`ok-rendered-diff editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[h,v]}),t[26]=v,t[27]=y),y}function At(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var jt=`[data-property-change]`,Mt=`[data-content] > [data-line-type="change-addition"], [data-content] > [data-line-type="change-deletion"]`;function Nt(e){let t=[];for(let n of e.querySelectorAll(`diffs-container`)){let e=n.shadowRoot;e&&t.push(...e.querySelectorAll(Mt))}return t}function Pt(e,t){let n=new Map;return{sync(){for(let r of e.querySelectorAll(`diffs-container`)){let e=r.shadowRoot;if(e===null||n.has(e))continue;let i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0}),n.set(e,i)}},disconnect(){for(let e of n.values())e.disconnect();n.clear()}}}function Ft(e){let t=Nt(e),n=[],r=null;for(let e of t)(r===null||e.previousElementSibling!==r)&&n.push(e),r=e;return n}function It(e){let t=0,n=0;for(let r of e.split(`
@@ -86,7 +86,7 @@
86
86
  -->
87
87
  <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>
88
88
  <style>html { background-color: #fafafa } html.dark { background-color: #0b0b0b }</style>
89
- <script type="module" crossorigin src="./assets/index-DDdInvcw.js"></script>
89
+ <script type="module" crossorigin src="./assets/index-EG4CXoqu.js"></script>
90
90
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
91
91
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
92
92
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
@@ -127,14 +127,14 @@
127
127
  <link rel="modulepreload" crossorigin href="./assets/dist-BGzUo_18.js">
128
128
  <link rel="modulepreload" crossorigin href="./assets/messages-gyTavuOO.js">
129
129
  <link rel="modulepreload" crossorigin href="./assets/use-apply-config-language-N3OMaFbH.js">
130
- <link rel="modulepreload" crossorigin href="./assets/client-version-DJxwS4jI.js">
130
+ <link rel="modulepreload" crossorigin href="./assets/client-version-QyucWXca.js">
131
131
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
132
132
  <link rel="modulepreload" crossorigin href="./assets/use-apply-config-theme-CYFG76sS.js">
133
133
  <link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-CTtLraO9.js">
134
134
  <link rel="modulepreload" crossorigin href="./assets/css-color-to-hex-pv-EKOQu.js">
135
135
  <link rel="modulepreload" crossorigin href="./assets/constants-upload-DZP-sCdl.js">
136
136
  <link rel="modulepreload" crossorigin href="./assets/saved-themes-client-BV81hPag.js">
137
- <link rel="modulepreload" crossorigin href="./assets/config-provider-BdqYLWTk.js">
137
+ <link rel="modulepreload" crossorigin href="./assets/config-provider-B084_P-F.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/dist-Dc8tD1th.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/ccount-s_UaBrax.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/lib-CZXZ01YL.js">
@@ -157,7 +157,7 @@
157
157
  <link rel="modulepreload" crossorigin href="./assets/documents-fetch-ZX1mUge_.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/note-window-mode-CI3Yju9B.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/structural-freshness-C6rR7cV3-VXiZX15w.js">
160
- <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-D7GY-vsi.js">
160
+ <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-DpGpVASC.js">
161
161
  <link rel="modulepreload" crossorigin href="./assets/dist-CSCUSbQc.js">
162
162
  <link rel="modulepreload" crossorigin href="./assets/dist-DTFuvKje.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/dist-CRjqnzU7.js">
@@ -240,19 +240,19 @@
240
240
  <link rel="modulepreload" crossorigin href="./assets/storage-scope-sNHb4BCO.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/use-workspace-5RavNejH.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/utils-random-uuid-CE1X6bNM.js">
243
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-DXqn96Dj.js">
243
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-C7f-2j3S.js">
244
244
  <link rel="modulepreload" crossorigin href="./assets/dist-BKgU0kag.js">
245
245
  <link rel="modulepreload" crossorigin href="./assets/dist-d2WYntJB.js">
246
246
  <link rel="modulepreload" crossorigin href="./assets/dist-C0nuYMFu.js">
247
247
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-5XqyQTVx.js">
248
- <link rel="modulepreload" crossorigin href="./assets/comment-chips-BDz0jvV-.js">
248
+ <link rel="modulepreload" crossorigin href="./assets/comment-chips-Ct3n-Ocd.js">
249
249
  <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-BD1Le0QE.js">
250
250
  <link rel="modulepreload" crossorigin href="./assets/tool-list-format-ahklHT7Z.js">
251
251
  <link rel="modulepreload" crossorigin href="./assets/acp-thread-protocol-EC8X7m2Z.js">
252
252
  <link rel="modulepreload" crossorigin href="./assets/image-attachment-Chp6ejuJ.js">
253
253
  <link rel="modulepreload" crossorigin href="./assets/workspace-paths-BjilyZF6.js">
254
254
  <link rel="modulepreload" crossorigin href="./assets/acp-tool-call-input-B6Z0o0iM.js">
255
- <link rel="modulepreload" crossorigin href="./assets/progress-CIBZtkMN.js">
255
+ <link rel="modulepreload" crossorigin href="./assets/progress-G97DGgRz.js">
256
256
  <link rel="modulepreload" crossorigin href="./assets/radio-group-G1GR05Rb.js">
257
257
  <link rel="modulepreload" crossorigin href="./assets/separator-D7s_9ZwH.js">
258
258
  <link rel="modulepreload" crossorigin href="./assets/toggle-group-B7p69Qfd.js">
@@ -261,15 +261,15 @@
261
261
  <link rel="modulepreload" crossorigin href="./assets/markdown-lint-DyGTskus.js">
262
262
  <link rel="modulepreload" crossorigin href="./assets/format-DUHlUJ5L.js">
263
263
  <link rel="modulepreload" crossorigin href="./assets/braces--g9Mwtim.js">
264
- <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-2eko2YVG.js">
264
+ <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-CbF44Jsc.js">
265
265
  <link rel="modulepreload" crossorigin href="./assets/grip-vertical-DNbkgWZL.js">
266
266
  <link rel="modulepreload" crossorigin href="./assets/SkillCostValue-BcfssFYU.js">
267
267
  <link rel="modulepreload" crossorigin href="./assets/textarea-DkcNoPBJ.js">
268
- <link rel="modulepreload" crossorigin href="./assets/selection-context-BKZrCaCI.js">
268
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-QdjbPI3E.js">
269
269
  <link rel="modulepreload" crossorigin href="./assets/lint-config-client-Bpn28Gqc.js">
270
270
  <link rel="modulepreload" crossorigin href="./assets/use-skills-B6ndwLoW.js">
271
271
  <link rel="modulepreload" crossorigin href="./assets/folder-config-api-C6LhS3Cf.js">
272
- <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-C9jhSWMF.js">
272
+ <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-DD5MRuAW.js">
273
273
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-nJaICi16.js">
274
274
  <link rel="modulepreload" crossorigin href="./assets/git-merge-VDBzSZBV.js">
275
275
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-BVQchE6b.js">
@@ -281,7 +281,7 @@
281
281
  <link rel="modulepreload" crossorigin href="./assets/use-git-sync-status-DB3RSBj5.js">
282
282
  <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-D5fo2XHL.js">
283
283
  <link rel="modulepreload" crossorigin href="./assets/use-settings-route-BGtkup9E.js">
284
- <link rel="modulepreload" crossorigin href="./assets/SyncStatusBadge-BNYfSyo3.js">
284
+ <link rel="modulepreload" crossorigin href="./assets/SyncStatusBadge-BeCo1R8Y.js">
285
285
  <link rel="modulepreload" crossorigin href="./assets/cursor-pH0WlPzE.js">
286
286
  <link rel="modulepreload" crossorigin href="./assets/agent-registry-Z4n6bROi.js">
287
287
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-3YdE9YD2.js">
@@ -305,18 +305,18 @@
305
305
  <link rel="modulepreload" crossorigin href="./assets/agent-launcher-labels-CKD6Vuny.js">
306
306
  <link rel="modulepreload" crossorigin href="./assets/terminal-cli-display-CHuCou07.js">
307
307
  <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-BcMHQbeA.js">
308
- <link rel="modulepreload" crossorigin href="./assets/use-open-skill-BuK_lWsT.js">
308
+ <link rel="modulepreload" crossorigin href="./assets/use-open-skill-CzOAeSq6.js">
309
309
  <link rel="modulepreload" crossorigin href="./assets/platform-labels-DDy1ouuX.js">
310
310
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-FO6gFDPG.js">
311
- <link rel="modulepreload" crossorigin href="./assets/AddPropertiesButton-DS9uZkTx.js">
311
+ <link rel="modulepreload" crossorigin href="./assets/AddPropertiesButton-CWvueDgR.js">
312
312
  <link rel="modulepreload" crossorigin href="./assets/case-sensitive-DIxypOE0.js">
313
313
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-C5T97PNU.js">
314
314
  <link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-CtDE2R0v.js">
315
315
  <link rel="modulepreload" crossorigin href="./assets/wrench-DmtZXcHB.js">
316
316
  <link rel="modulepreload" crossorigin href="./assets/panel-eNhYruJz.js">
317
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CQd0s--X.js">
317
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CSLkAaYr.js">
318
318
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-CsiJb9Ou.js">
319
- <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-PoNyEtCJ.js">
319
+ <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-DpVXFUf1.js">
320
320
  <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-D_irC8wr.js">
321
321
  <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-aL5veMO9.js">
322
322
  <link rel="modulepreload" crossorigin href="./assets/contact-email-store-B_5aVbhf.js">
@@ -325,7 +325,7 @@
325
325
  <link rel="modulepreload" crossorigin href="./assets/package-PkCmIx3S.js">
326
326
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-D4M8nGPT.js">
327
327
  <link rel="modulepreload" crossorigin href="./assets/overlay-layers-CKMAjef3.js">
328
- <link rel="modulepreload" crossorigin href="./assets/preferred-session-events-DRwedC4l.js">
328
+ <link rel="modulepreload" crossorigin href="./assets/preferred-session-events-DJCdCQuc.js">
329
329
  <link rel="modulepreload" crossorigin href="./assets/panel-right-close-Bsh1pCmh.js">
330
330
  <link rel="modulepreload" crossorigin href="./assets/rotate-ccw-DeMl2ou7.js">
331
331
  <link rel="modulepreload" crossorigin href="./assets/square-pen-DU3t-IcD.js">
@@ -335,13 +335,13 @@
335
335
  <link rel="modulepreload" crossorigin href="./assets/dist-DMhg0Xyd.js">
336
336
  <link rel="modulepreload" crossorigin href="./assets/dist-ucvNbATJ.js">
337
337
  <link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-CDBOzWaI.js">
338
- <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-DBLccwaz.js">
338
+ <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-D_CPJnkr.js">
339
339
  <link rel="modulepreload" crossorigin href="./assets/ImageAttachments-BGB1Xeig.js">
340
340
  <link rel="modulepreload" crossorigin href="./assets/TemplateRow-CHung0e5.js">
341
341
  <link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-CJywmyrk.js">
342
342
  <link rel="modulepreload" crossorigin href="./assets/RowDisclosure-BpaiWVwL.js">
343
343
  <link rel="modulepreload" crossorigin href="./assets/project-paths-Cq56bh9f.js">
344
- <link rel="modulepreload" crossorigin href="./assets/PublishToGitHubDialog-MRhU3m1O.js">
344
+ <link rel="modulepreload" crossorigin href="./assets/PublishToGitHubDialog-Bi4yg3gA.js">
345
345
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-APSgNRF8.js">
346
346
  <link rel="modulepreload" crossorigin href="./assets/ReportBugMenuTrigger-YhgSFu20.js">
347
347
  <link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-BLTTRSBJ.js">
@@ -359,7 +359,7 @@
359
359
  <link rel="modulepreload" crossorigin href="./assets/alert-BEwM2iOp.js">
360
360
  <link rel="modulepreload" crossorigin href="./assets/input-group-CBuVp6zh.js">
361
361
  <link rel="modulepreload" crossorigin href="./assets/use-skill-origin-CFF_c9ld.js">
362
- <link rel="modulepreload" crossorigin href="./assets/use-terminal-enabled-BXPeoDBJ.js">
362
+ <link rel="modulepreload" crossorigin href="./assets/use-terminal-enabled-D4EqjdQP.js">
363
363
  <link rel="modulepreload" crossorigin href="./assets/catalog-CLnUnyxw.js">
364
364
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-DU3TT-KP.js">
365
365
  <link rel="modulepreload" crossorigin href="./assets/auth-prompt-store-Br5SQeuk.js">
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{C as r,E as i,L as a,M as o,N as s,P as c,w as l,x as u}from"./constants-ok-dir-DZ25OS9-.mjs";import{Ya as d,af as f,bd as p,cf as m,of as h,rf as g}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{Ms as _,Ns as v,Oa as y,Vo as ee,m as b,ns as te,tr as x}from"./dist-CjMvnZHW.mjs";import{s as S,y as ne}from"./fs-find-project-root-BYV07wjn.mjs";import{A as re,B as ie,E as C,F as ae,M as w,N as T,S as oe,T as se,Y as ce,Z as E,at as le,b as ue,et as de,f as fe,ft as pe,it as me,j as he,k as D,lt as ge,nt as _e,ot as ve,p as ye,rt as be,s as xe,ut as Se,y as Ce}from"./init-tZZEMY57.mjs";import{o as we}from"./token-store-Bmb3_0hU.mjs";import{t as Te}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./removal-file-path-cvkiBibT.mjs";import{basename as O,dirname as k,join as A,resolve as j,win32 as De}from"node:path";import{accessSync as Oe,constants as M,existsSync as N,lstatSync as P,mkdirSync as ke,readFileSync as F,readdirSync as I,realpathSync as L,rmSync as Ae,rmdirSync as je,statSync as R,unlinkSync as Me}from"node:fs";import{homedir as z}from"node:os";import{createHash as Ne}from"node:crypto";import{spawn as Pe}from"node:child_process";import{isDeepStrictEqual as Fe}from"node:util";import{setTimeout as Ie}from"node:timers/promises";function Le(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function Re(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function ze(e){return ee({detached:!0,stdio:`ignore`,shell:!1,env:Le(e)})}function Be(e,t,n={}){let r=(n.spawn??Pe)(e,[...t],ze(n.env??process.env));return r.unref(),r}function Ve(e,t,n={}){let r=n.spawn??Pe,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],ze(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(Re(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(Re(e))}})}const He=r.stable.appId,B=i,Ue=[`stable`,`beta`];function We(e,t,n=e=>console.error(e)){try{return a(e,t)}catch(r){let i=a({...e,[l]:void 0},t);return n(`Treating this CLI as ${o(i)} for this command: ${r instanceof Error?r.message:String(r)}`),i}}function V(e){return Ue.includes(e)||!B.includes(e)?Ue:[e,...Ue]}function Ge(e){return e.bundlePath===void 0?null:{bundlePath:e.bundlePath,protocolScheme:r[e.product].protocolScheme}}function Ke(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return R(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function qe(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let n=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(n?.[1]){let e=n[1];return{path:e,product:B.find(t=>e.endsWith(`/${r[t].productName}.app`))??t}}}let n=e.homeDir??z();for(let i of V(t)){let{productName:t}=r[i];for(let r of[A(n,`Applications`),`/Applications`]){let n=A(r,`${t}.app`);if(Je(e,A(n,`Contents`,`MacOS`,t)))return{path:n,product:i}}}return null}function Je(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}function Ye(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=B.find(t=>e.execPath.toLowerCase().endsWith(`\\${s(r[t]).toLowerCase()}`));if(t)return{path:e.execPath,product:t}}let n=e.env.LOCALAPPDATA;if(n)for(let i of V(t))for(let t of c(r[i])){let a=De.join(n,`Programs`,t,s(r[i]));if(Je(e,a))return{path:a,product:i}}return null}function Xe(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=B.find(t=>e.execPath.endsWith(`/${r[t].linuxExecutableName}`));if(t)return{path:e.execPath,product:t}}for(let n of V(t)){let{productName:t,linuxExecutableName:i}=r[n],a=`/opt/${t}/${i}`;if(Je(e,a))return{path:a,product:n}}return null}function Ze(e){let t=We(e.env,e.execPath,e.warn);if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`,cliProduct:t};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`,cliProduct:t};let n;try{n=e.platform===`darwin`?qe(e,t):e.platform===`win32`?Ye(e,t):Xe(e,t)}catch{return{available:!1,reason:`stat-error`,cliProduct:t}}if(!n)return{available:!1,reason:`no-bundle`,cliProduct:t};let r={bundlePath:n.path,product:n.product,cliProduct:t};return e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,...r}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,...r}:{available:!0,reason:`available`,...r}}function Qe(e,t){let n=e.log??(e=>console.error(e)),i=e.platform??process.platform;if(t.bundlePath===void 0){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}let{productName:a}=r[t.product],[o]=r[t.cliProduct].cliCommandNames;n(`Launching ${a} desktop (use \`${o} start\` for the browser server, or \`OK_FORCE_BROWSER=1\` to always skip)`);let s=t.bundlePath;if(i===`darwin`){Be(`open`,[`-a`,s],{spawn:e.spawn});return}Be(s,[],{spawn:e.spawn})}function $e(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}var et=u();function H(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function tt(e){return Ne(`sha256`).update(e).digest(`hex`)}function U(e){return A(ne(j(e)),`pi-trust`)}function nt(e,t){return A(U(e),tt(j(t)))}function rt(e,t,n){return A(nt(e,t),`${tt(n)}.json`)}var W=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${H(e)} ${H(t)}; ${H(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function G(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new W(e,`could not ${t}: ${i}`,a,n)}function K(e){let t;try{t=P(e)}catch(t){if(t.code===`ENOENT`)return!1;throw G(e,`be inspected`,t)}if(!t.isDirectory())throw new W(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function it(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function at(e,t){if(!Te(e)||!it(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==j(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==j(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==j(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!Te(e.previous))throw new W(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&it(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&it(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new W(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function ot(e,t,n){let r;try{r=P(n)}catch(e){throw G(n,`be inspected`,e)}if(!r.isFile())throw new W(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=F(n,`utf8`)}catch(e){throw G(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new W(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=at(a,n);if(o.cwd!==j(t)||n!==rt(e,t,o.canonicalTrustPath))throw new W(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function st(e,t){let{record:n,path:r}=t;for(let t of[U(e),nt(e,n.cwd)])if(!K(t))throw new W(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=ot(e,n.cwd,r);if(!Fe(i.record,n))throw new W(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function ct(e,t,n,r,i){let a={version:1,cwd:j(t),configuredTrustPath:j(n),canonicalTrustPath:j(r),state:`pending`,previous:i},o=rt(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Fe(at(JSON.parse(s),o),a))throw new W(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);K(U(e)),K(k(o));try{ke(k(o),{recursive:!0,mode:448})}catch(e){throw G(k(o),`be created`,e)}let c;try{c=P(o,{throwIfNoEntry:!1})}catch(e){throw G(o,`be inspected`,e)}if(c)throw new W(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{S(o,s,{mode:384})}catch(e){throw G(o,`be written`,e)}return{path:o,record:a}}function lt(e,t){let n=st(e,t);if(n.record.state!==`pending`)throw new W(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{S(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw G(n.path,`be committed`,e)}return{path:n.path,record:r}}function q(e,t){if(!K(U(e)))return[];let n=nt(e,t);if(!K(n))return[];let r;try{r=I(n).sort()}catch(e){throw G(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>ot(e,t,A(n,r)))}function J(e,t){let n=st(e,t);try{Me(n.path)}catch(e){throw G(n.path,`be removed after reconciling its grant`,e)}for(let t of[k(n.path),U(e)])try{je(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw G(t,`be removed after reconciling its grant`,e)}}var ut=n(((t,n)=>{var r=e(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),dt=n(((t,n)=>{var r=e(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),ft=n(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),pt=n(((t,n)=>{var r=e(`fs`),i=ut(),a=dt(),o=ft(),s=e(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{C as r,E as i,L as a,M as o,N as s,P as c,w as l,x as u}from"./constants-ok-dir-DZ25OS9-.mjs";import{Ya as d,af as f,bd as p,cf as m,of as h,rf as g}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{Ms as _,Ns as v,Oa as y,Vo as ee,m as b,ns as te,tr as x}from"./dist-B0DBnzRw.mjs";import{s as S,y as ne}from"./fs-find-project-root-BYV07wjn.mjs";import{A as re,B as ie,E as C,F as ae,M as w,N as T,S as oe,T as se,Y as ce,Z as E,at as le,b as ue,et as de,f as fe,ft as pe,it as me,j as he,k as D,lt as ge,nt as _e,ot as ve,p as ye,rt as be,s as xe,ut as Se,y as Ce}from"./init-BiiaRaJc.mjs";import{o as we}from"./token-store-Bmb3_0hU.mjs";import{t as Te}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./removal-file-path-BU5oybZW.mjs";import{basename as O,dirname as k,join as A,resolve as j,win32 as De}from"node:path";import{accessSync as Oe,constants as M,existsSync as N,lstatSync as P,mkdirSync as ke,readFileSync as F,readdirSync as I,realpathSync as L,rmSync as Ae,rmdirSync as je,statSync as R,unlinkSync as Me}from"node:fs";import{homedir as z}from"node:os";import{createHash as Ne}from"node:crypto";import{spawn as Pe}from"node:child_process";import{isDeepStrictEqual as Fe}from"node:util";import{setTimeout as Ie}from"node:timers/promises";function Le(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function Re(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function ze(e){return ee({detached:!0,stdio:`ignore`,shell:!1,env:Le(e)})}function Be(e,t,n={}){let r=(n.spawn??Pe)(e,[...t],ze(n.env??process.env));return r.unref(),r}function Ve(e,t,n={}){let r=n.spawn??Pe,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],ze(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(Re(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(Re(e))}})}const He=r.stable.appId,B=i,Ue=[`stable`,`beta`];function We(e,t,n=e=>console.error(e)){try{return a(e,t)}catch(r){let i=a({...e,[l]:void 0},t);return n(`Treating this CLI as ${o(i)} for this command: ${r instanceof Error?r.message:String(r)}`),i}}function V(e){return Ue.includes(e)||!B.includes(e)?Ue:[e,...Ue]}function Ge(e){return e.bundlePath===void 0?null:{bundlePath:e.bundlePath,protocolScheme:r[e.product].protocolScheme}}function Ke(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return R(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function qe(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let n=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(n?.[1]){let e=n[1];return{path:e,product:B.find(t=>e.endsWith(`/${r[t].productName}.app`))??t}}}let n=e.homeDir??z();for(let i of V(t)){let{productName:t}=r[i];for(let r of[A(n,`Applications`),`/Applications`]){let n=A(r,`${t}.app`);if(Je(e,A(n,`Contents`,`MacOS`,t)))return{path:n,product:i}}}return null}function Je(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}function Ye(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=B.find(t=>e.execPath.toLowerCase().endsWith(`\\${s(r[t]).toLowerCase()}`));if(t)return{path:e.execPath,product:t}}let n=e.env.LOCALAPPDATA;if(n)for(let i of V(t))for(let t of c(r[i])){let a=De.join(n,`Programs`,t,s(r[i]));if(Je(e,a))return{path:a,product:i}}return null}function Xe(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=B.find(t=>e.execPath.endsWith(`/${r[t].linuxExecutableName}`));if(t)return{path:e.execPath,product:t}}for(let n of V(t)){let{productName:t,linuxExecutableName:i}=r[n],a=`/opt/${t}/${i}`;if(Je(e,a))return{path:a,product:n}}return null}function Ze(e){let t=We(e.env,e.execPath,e.warn);if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`,cliProduct:t};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`,cliProduct:t};let n;try{n=e.platform===`darwin`?qe(e,t):e.platform===`win32`?Ye(e,t):Xe(e,t)}catch{return{available:!1,reason:`stat-error`,cliProduct:t}}if(!n)return{available:!1,reason:`no-bundle`,cliProduct:t};let r={bundlePath:n.path,product:n.product,cliProduct:t};return e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,...r}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,...r}:{available:!0,reason:`available`,...r}}function Qe(e,t){let n=e.log??(e=>console.error(e)),i=e.platform??process.platform;if(t.bundlePath===void 0){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}let{productName:a}=r[t.product],[o]=r[t.cliProduct].cliCommandNames;n(`Launching ${a} desktop (use \`${o} start\` for the browser server, or \`OK_FORCE_BROWSER=1\` to always skip)`);let s=t.bundlePath;if(i===`darwin`){Be(`open`,[`-a`,s],{spawn:e.spawn});return}Be(s,[],{spawn:e.spawn})}function $e(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}var et=u();function H(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function tt(e){return Ne(`sha256`).update(e).digest(`hex`)}function U(e){return A(ne(j(e)),`pi-trust`)}function nt(e,t){return A(U(e),tt(j(t)))}function rt(e,t,n){return A(nt(e,t),`${tt(n)}.json`)}var W=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${H(e)} ${H(t)}; ${H(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function G(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new W(e,`could not ${t}: ${i}`,a,n)}function K(e){let t;try{t=P(e)}catch(t){if(t.code===`ENOENT`)return!1;throw G(e,`be inspected`,t)}if(!t.isDirectory())throw new W(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function it(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function at(e,t){if(!Te(e)||!it(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==j(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==j(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==j(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!Te(e.previous))throw new W(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&it(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&it(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new W(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function ot(e,t,n){let r;try{r=P(n)}catch(e){throw G(n,`be inspected`,e)}if(!r.isFile())throw new W(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=F(n,`utf8`)}catch(e){throw G(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new W(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=at(a,n);if(o.cwd!==j(t)||n!==rt(e,t,o.canonicalTrustPath))throw new W(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function st(e,t){let{record:n,path:r}=t;for(let t of[U(e),nt(e,n.cwd)])if(!K(t))throw new W(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=ot(e,n.cwd,r);if(!Fe(i.record,n))throw new W(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function ct(e,t,n,r,i){let a={version:1,cwd:j(t),configuredTrustPath:j(n),canonicalTrustPath:j(r),state:`pending`,previous:i},o=rt(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Fe(at(JSON.parse(s),o),a))throw new W(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);K(U(e)),K(k(o));try{ke(k(o),{recursive:!0,mode:448})}catch(e){throw G(k(o),`be created`,e)}let c;try{c=P(o,{throwIfNoEntry:!1})}catch(e){throw G(o,`be inspected`,e)}if(c)throw new W(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{S(o,s,{mode:384})}catch(e){throw G(o,`be written`,e)}return{path:o,record:a}}function lt(e,t){let n=st(e,t);if(n.record.state!==`pending`)throw new W(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{S(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw G(n.path,`be committed`,e)}return{path:n.path,record:r}}function q(e,t){if(!K(U(e)))return[];let n=nt(e,t);if(!K(n))return[];let r;try{r=I(n).sort()}catch(e){throw G(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>ot(e,t,A(n,r)))}function J(e,t){let n=st(e,t);try{Me(n.path)}catch(e){throw G(n.path,`be removed after reconciling its grant`,e)}for(let t of[k(n.path),U(e)])try{je(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw G(t,`be removed after reconciling its grant`,e)}}var ut=n(((t,n)=>{var r=e(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),dt=n(((t,n)=>{var r=e(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),ft=n(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),pt=n(((t,n)=>{var r=e(`fs`),i=ut(),a=dt(),o=ft(),s=e(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
2
2
  GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){function t(t,n){return e.call(r,t,function(e){e||g(),typeof n==`function`&&n.apply(this,arguments)})}return Object.defineProperty(t,l,{value:e}),t})(r.close),r.closeSync=(function(e){function t(t){e.apply(r,arguments),g()}return Object.defineProperty(t,l,{value:e}),t})(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){f(r[c]),e(`assert`).equal(r[c].length,0)})),global[c]||d(global,r[c]),n.exports=p(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(n.exports=p(r),r.__patched=!0);function p(e){i(e),e.gracefulify=p,e.createReadStream=ne,e.createWriteStream=re;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?m([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=o;function o(e,t,n,i){return typeof n==`function`&&(i=n,n=null),a(e,t,n,i);function a(e,t,n,i,o){return r(e,t,n,function(r){r&&(r.code===`EMFILE`||r.code===`ENFILE`)?m([a,[e,t,n,i],r,o||Date.now(),Date.now()]):typeof i==`function`&&i.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var f=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=f.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?m([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=a(e);b=g.ReadStream,x=g.WriteStream}var _=e.ReadStream;_&&(b.prototype=Object.create(_.prototype),b.prototype.open=te);var v=e.WriteStream;v&&(x.prototype=Object.create(v.prototype),x.prototype.open=S),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var y=b;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var ee=x;Object.defineProperty(e,"FileWriteStream",{get:function(){return ee},set:function(e){ee=e},enumerable:!0,configurable:!0});function b(e,t){return this instanceof b?(_.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function te(){var e=this;C(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function x(e,t){return this instanceof x?(v.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;C(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function ne(t,n){return new e.ReadStream(t,n)}function re(t,n){return new e.WriteStream(t,n)}var ie=e.open;e.open=C;function C(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return ie(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function m(e){f(`ENQUEUE`,e[0].name,e[1]),r[c].push(e),_()}var h;function g(){for(var e=Date.now(),t=0;t<r[c].length;++t)r[c][t].length>2&&(r[c][t][3]=e,r[c][t][4]=e);_()}function _(){if(clearTimeout(h),h=void 0,r[c].length!==0){var e=r[c].shift(),t=e[0],n=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)f(`RETRY`,t.name,n),t.apply(null,n);else if(Date.now()-a>=6e4){f(`TIMEOUT`,t.name,n);var s=n.pop();typeof s==`function`&&s.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(f(`RETRY`,t.name,n),t.apply(null,n.concat([a]))):r[c].push(e)}h===void 0&&(h=setTimeout(_,0))}}})),mt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1}var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),ht=n((e=>{var t=mt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),gt=n(((e,t)=>{t.exports=ht()})),_t=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),vt=n(((t,n)=>{var r=global.process;let i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=_t(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}return _.apply(this,arguments)}}})),yt=n(((e,t)=>{let n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),bt=n(((t,n)=>{let r=e(`path`),i=pt(),a=gt(),o=vt(),s=yt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function d(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?d(e,{...t,stale:0},n):n(r);if(!f(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));p(e,t,r=>{if(r)return n(r);d(e,{...t,stale:0},n)})})})}function f(e,t){return e.mtime.getTime()<Date.now()-t.stale}function p(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function m(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return h(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,m(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function h(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function g(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{d(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};m(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));_(r,{...t,realpath:!1},e)})})})})}function _(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],p(r,t,n)})}function v(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!f(r,t)))})}function y(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=g,n.exports.unlock=_,n.exports.check=v,n.exports.getLocks=y})),xt=n(((e,t)=>{let n=pt();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),St=t(n(((e,t)=>{let n=bt(),{toPromise:r,toSync:i,toSyncOptions:a}=xt();async function o(e,t){let i=await r(n.lock)(e,t);return r(i)}function s(e,t){let r=i(n.lock)(e,a(t));return i(r)}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}))(),1);const Ct=5e3;function wt(e,t,n){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ELOCKED`)throw e;let r=t-performance.now();if(r<=0)throw Object.assign(Error(`Could not acquire Pi trust lock at ${n}.lock within ${Ct}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Tt(e,t){we()?.warn(t,e)}function Et(e,t){if(e.length===0)return;if(e.length===1)throw e[0];let[n,r]=e,i=n instanceof Error?n.message:String(n),a=r instanceof Error?r.message:String(r);throw AggregateError(e,`Pi trust update failed: ${i}\nReleasing Pi trust lock ${t}.lock also failed: ${a}`)}async function Dt(e,t,n){await _(`${t}.ok.lock`,async()=>{let t=performance.now()+Ct,r;for(;;)try{r=await St.default.lock(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Ie(wt(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Et(i,e)},{onWarn:Tt})}function Ot(e,t,n){v(`${t}.ok.lock`,()=>{let t=performance.now()+Ct,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=St.default.lockSync(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,wt(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Et(a,e)},{onWarn:Tt})}const kt=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var At=class extends Error{name=`PiResourceInspectionError`};function Y(e){let t;try{t=P(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=R(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new At(w(`missing-symlink-target`),{cause:e}):e}return Oe(e,M.R_OK|(n.isDirectory()?M.X_OK:0)),!0}function jt(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function Mt(e,t,n){let r=e;try{let i=L(e),a;r=t;try{a=L(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=j(t)}let o=A(a,`.agents`,`skills`),s=[];for(let e of kt)r=A(i,`.pi`,e),Y(r)&&s.push(r);if(r=A(i,`.pi`,`extensions`),Y(r))for(let t of I(r).sort()){let i=A(r,t);j(n)!==A(j(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[A(i,`.pi`,`skills`),A(i,`.agents`,`skills`)])if(e!==o&&(r=e,Y(e)))for(let t of I(e).sort())jt(t)||s.push(A(e,t));let c=k(i);for(;c!==i;){r=A(c,`.agents`,`skills`),r!==o&&Y(r)&&s.push(r);let e=k(c);if(e===c)break;c=e}return s.length===0?{kind:`none`}:{kind:`shared`,paths:s.sort()}}catch(e){return{kind:`unreadable`,error:`Could not inspect Pi project resources at ${H(r)}: ${e instanceof At?e.message:w(T(e))}`}}}function Nt(e,t,n){let r=j(e),i=ge({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:E.pi.projectConfigPath(r),trustPath:A(i,`trust.json`)}}function X(e){try{let t=L(e);return R(t).isDirectory()?(Oe(t,M.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${H(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${H(e)} could not be resolved or accessed: ${H(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function Pt(e){let t=X(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${H(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function Ft(e,t,n){let r=xe(E.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return me(i)?{state:`own-current`,text:a}:C(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function It(e,t){let n;try{n=F(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:T(t)}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,reason:`invalid-json`}}return Te(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
3
3
  `)}:{state:`unreadable`,reason:`invalid-json`}}function Lt(e){switch(e){case`invalid-json`:return`the file is not a valid JSON object; repair its JSON, then retry`;case`path-changed`:return`the path changed while waiting for its lock; retry to check its current state`;case`unavailable-root`:return`the filesystem root is unavailable; reconnect the drive or network share, then retry`;default:return w(e)}}function Z(e,t){return{kind:`refused`,error:`trust store ${H(e)}: ${Lt(t)}`}}function Q(e){let t=Ee(e);try{switch(t.kind){case`declined`:return Z(e,t.reason);case`ready`:return{kind:`ready`,path:L(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=k(e),r=[O(e)],i=P(n,{throwIfNoEntry:!1});for(;!i;){let t=k(n);if(t===n)return Z(e,`unavailable-root`);r.unshift(O(n)),n=t,i=P(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:A(L(n),...r)}}catch(t){return Z(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:T(t))}}catch(t){return Z(e,T(t))}}function Rt(e,t){let n=Q(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?Z(e,`path-changed`):n}function zt(e,t,n){let r=Nt(e,t,n),i=X(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=Ft(r.cwd,r.bridgePath,t).state,o=Q(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:It(o,i.project.canonical).state;return{...r,project:`ready`,canonicalCwd:i.project.canonical,bridge:a,trust:s,bridgeLoadable:(a===`own-current`||a===`own-stale`)&&s===`trusted`,otherExtensions:Bt(r.bridgePath).displayNames}}function Bt(e){let t=k(e),n=O(e);try{return{displayNames:I(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>H(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function Vt(e,t={mode:`published`},n,r,i){let a=Nt(e,n,r),o=X(a.cwd);if(o.kind===`refused`)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:o.error};if(i!==void 0&&o.project.canonical!==i)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:`The approved Pi project directory ${H(i)} no longer matches the current directory ${H(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=Ft(a.cwd,a.bridgePath,n);if(s.state===`foreign`)return{...a,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(s.state===`unreadable`)return{...a,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let c;if(s.state===`absent`)c=`written`;else{let e;try{e=se(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=ue(E.pi,a.cwd,t,n,a.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...a,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error===void 0?`bridge write ${e.action}`:H(e.error)}}let l=await Ht(a.trustPath,o.project,n??z());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function Ht(e,t,n){let r=t.canonical,i=Q(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{ke(k(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:H(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await Dt(e,i.path,()=>{let o=Pt(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=Rt(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=It(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=Z(e,c.reason).error;return}let l=$(n,()=>{let t=q(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&J(n,t),ct(n,r,e,s.path,Object.hasOwn(c.entries,r)?{present:!0,value:c.entries[r]}:{present:!1})}),u={...c.entries,[r]:!0},d=JSON.stringify(u,null,2)+(c.trailingNewline?`
4
4
  `:``),f=D(s.path);S(s.path,d,f===void 0?void 0:{mode:f}),$(n,()=>lt(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:H(e instanceof Error?e.message:String(e))}}return a}function Ut(e){let t=[],n=e;try{for(;;){if(P(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=L(n);return R(e).isDirectory()?(Oe(e,M.X_OK),A(e,...t)):void 0}let e=k(n);if(e===n)return;t.unshift(O(n)),n=e}}catch{return}}function Wt(e){let t={"not-present":0,removed:1,"kept-unowned":2,"kept-shared":3,"kept-unverified":4,"refused-unreadable":5,failed:6},n=e.reduce((e,n)=>t[n.action]>t[e.action]?n:e,{action:`not-present`}),r=e.flatMap(e=>e.error??[]),i=e.flatMap(e=>e.detail??[]);return r.length>0?{action:n.error===void 0?`failed`:n.action,error:[...r,...i].join(`
@@ -1 +1 @@
1
- import{C as e,N as t}from"./init-tZZEMY57.mjs";import{lstatSync as n,statSync as r}from"node:fs";function i(i){let a;try{a=n(i).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:t(e)}}let o=e(i);if(o.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!r(o.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:a&&e.code===`ENOENT`?`missing-symlink-target`:t(e)}}return{kind:`ready`,path:o.writePath,symlink:a}}export{i as t};
1
+ import{C as e,N as t}from"./init-BiiaRaJc.mjs";import{lstatSync as n,statSync as r}from"node:fs";function i(i){let a;try{a=n(i).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:t(e)}}let o=e(i);if(o.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!r(o.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:a&&e.code===`ENOENT`?`missing-symlink-target`:t(e)}}return{kind:`ready`,path:o.writePath,symlink:a}}export{i as t};
@@ -1 +1 @@
1
- import{t as e}from"./launch-json-removal-CkdStqp0.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`,severity:`info`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=(n.removeOwnLaunchEntryFn??e)(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,severity:`warn`,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`,severity:`info`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
1
+ import{t as e}from"./launch-json-removal-CPMxuob7.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`,severity:`info`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=(n.removeOwnLaunchEntryFn??e)(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,severity:`warn`,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`,severity:`info`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
@@ -1 +1 @@
1
- import{E as e}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{Y as t,Z as n,b as r,et as i,it as a,p as o,tt as s}from"./init-tZZEMY57.mjs";import{homedir as c}from"node:os";function l(e){let{priorCommand:t,priorArgs:n}=u(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function u(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function d(e){let r=e.logger??h,i=e.home??c(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,severity:`info`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=n[o],s=f(()=>t.configPath(``,i));if(s!==null&&a.push(p({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let n=t.projectConfigPath,i=f(()=>n(e.projectDir));i!==null&&a.push(p({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function f(e){try{return e()}catch{return null}}function p(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},c=o(t.target,t.cwd,t.home,t.configPathOverride);if(c===null)return{...n,outcome:`no-entry`};if(t.target.format===`file`){if(a(c))return{...n,outcome:`canonical`}}else{let a=e(c);if(a.kind===`recognized`&&a.disposition===`keep`){let e=s(c,i(t.target,t.cwd));if(e.length===0)return{...n,outcome:`canonical`};let a=m(t,n,r(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0,pruneOnly:!0},t.home,t.configPathOverride));return(a.outcome===`repaired`||a.outcome===`canonical`)&&t.logger({event:a.outcome===`repaired`?`mcp-config-repair-pruned`:`mcp-config-repair-prune-unchanged`,severity:a.outcome===`repaired`?`info`:`warn`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,keys:e}),a.outcome===`canonical`?{...n,outcome:`prune-unchanged`}:a}if(a.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-skipped-foreign`,severity:`info`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:a.reason}),{...n,outcome:`foreign`,reason:a.reason}}return t.logger({...l({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:c}),severity:`info`}),m(t,n,r(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride))}function m(e,t,n){if(n.action===`failed`){let r=n.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:r}),{...t,outcome:`write-failed`,error:r}}return n.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:n.declineReason}),{...t,outcome:`declined`,reason:n.declineReason}):n.action===`skipped-flag`?{...t,outcome:`canonical`}:{...t,outcome:`repaired`}}function h(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{u as n,d as repairMcpConfigs,l as t};
1
+ import{E as e}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{Y as t,Z as n,b as r,et as i,it as a,p as o,tt as s}from"./init-BiiaRaJc.mjs";import{homedir as c}from"node:os";function l(e){let{priorCommand:t,priorArgs:n}=u(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function u(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function d(e){let r=e.logger??h,i=e.home??c(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,severity:`info`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=n[o],s=f(()=>t.configPath(``,i));if(s!==null&&a.push(p({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let n=t.projectConfigPath,i=f(()=>n(e.projectDir));i!==null&&a.push(p({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function f(e){try{return e()}catch{return null}}function p(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},c=o(t.target,t.cwd,t.home,t.configPathOverride);if(c===null)return{...n,outcome:`no-entry`};if(t.target.format===`file`){if(a(c))return{...n,outcome:`canonical`}}else{let a=e(c);if(a.kind===`recognized`&&a.disposition===`keep`){let e=s(c,i(t.target,t.cwd));if(e.length===0)return{...n,outcome:`canonical`};let a=m(t,n,r(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0,pruneOnly:!0},t.home,t.configPathOverride));return(a.outcome===`repaired`||a.outcome===`canonical`)&&t.logger({event:a.outcome===`repaired`?`mcp-config-repair-pruned`:`mcp-config-repair-prune-unchanged`,severity:a.outcome===`repaired`?`info`:`warn`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,keys:e}),a.outcome===`canonical`?{...n,outcome:`prune-unchanged`}:a}if(a.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-skipped-foreign`,severity:`info`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:a.reason}),{...n,outcome:`foreign`,reason:a.reason}}return t.logger({...l({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:c}),severity:`info`}),m(t,n,r(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride))}function m(e,t,n){if(n.action===`failed`){let r=n.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:r}),{...t,outcome:`write-failed`,error:r}}return n.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:n.declineReason}),{...t,outcome:`declined`,reason:n.declineReason}):n.action===`skipped-flag`?{...t,outcome:`canonical`}:{...t,outcome:`repaired`}}function h(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{u as n,d as repairMcpConfigs,l as t};
@@ -0,0 +1 @@
1
+ import"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import"./src-DAphXmts.mjs";import"./init-BiiaRaJc.mjs";import"./token-store-Bmb3_0hU.mjs";import"./start-BAvitkf3.mjs";import"./registry-probes-BO8LQnnq.mjs";import{n as e}from"./loader-CF7WIVMA.mjs";import"./preview-Ch8NwweL.mjs";import"./repair-mcp-configs-Bjdl4e04.mjs";export{e as loadConfig};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{C as t,E as n,L as r,M as i,N as a,O as o,S as s,d as c,k as l,x as u}from"./constants-ok-dir-DZ25OS9-.mjs";import{Da as d,G as f,Gl as p,Kl as m,Oa as h,Qc as g,U as _,W as v,Yc as y,el as b,l as x,mf as S,nl as ee,tl as te,u as ne}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{$r as C,As as w,Cs as T,Es as re,Hi as ie,Ia as E,Is as D,Nt as O,Os as ae,Qt as oe,Si as k,Ss as se,Vo as A,Wi as j,_a as M,bi as N,ci as P,fr as ce,js as F,ks as le,m as ue,ma as de,mi as fe,nr as I,ta as pe,wi as me,ws as he,xi as ge,xo as _e,xs as ve}from"./dist-CjMvnZHW.mjs";import{t as ye}from"./yazl-BBz29IQN.mjs";import{t as be,y as xe}from"./fs-find-project-root-BYV07wjn.mjs";import{ct as Se,gt as Ce,ht as we,mt as Te,pt as Ee,st as De,wt as Oe}from"./init-tZZEMY57.mjs";import{o as ke}from"./token-store-Bmb3_0hU.mjs";import{c as Ae}from"./colors-r_owlCuY.mjs";import{t as je}from"./is-object-BGze3w87.mjs";import{l as Me,u as Ne}from"./registry-probes-Bh1Qy3qZ.mjs";import{n as Pe}from"./constants-CLQ8X-E2.mjs";import"./loader-CLzWCnTU.mjs";import"./preview-d9Xj2oz-.mjs";import{basename as L,dirname as R,isAbsolute as Fe,join as z,relative as Ie,resolve as B,sep as V,win32 as Le}from"node:path";import{closeSync as Re,cpSync as ze,createWriteStream as Be,existsSync as H,lstatSync as Ve,mkdirSync as U,mkdtempSync as He,openSync as Ue,readFileSync as W,readSync as We,readdirSync as G,readlinkSync as Ge,realpathSync as Ke,rmSync as qe,rmdirSync as Je,statSync as Ye,writeFileSync as K}from"node:fs";import{arch as Xe,freemem as Ze,homedir as q,hostname as Qe,platform as $e,release as et,tmpdir as tt,totalmem as nt,type as rt,uptime as it}from"node:os";import{readFile as at,readdir as ot,stat as st}from"node:fs/promises";import{createHash as ct}from"node:crypto";import{execFile as lt,execSync as ut,spawnSync as dt}from"node:child_process";function ft(e,t){let n=t.map(e=>[D(e),e]);for(let t of e){let e=D(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function pt(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=ft([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=ft(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function mt(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const ht=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function gt(e,t,n=be){if(e!==void 0&&!ht.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let _t=null;function vt(e){_t=e}function yt(){return _t??process.cwd()}const bt=`Open Knowledge`;function xt(e={}){let t=e.platformName??process.platform,n=e.productName??l().productName;return De(t).join(Se({...e,platformName:t}),n)}function St(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=De(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`${l().packageName.replaceAll(`/`,``)}-updater`)}function Ct(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function wt(e){let t=z(e,`state.json`);if(!H(t))return[];let n;try{n=JSON.parse(W(t,`utf-8`))}catch{return[]}return Ct(n)??[]}function Tt(e){let t=z(e,`state.json`);if(!H(t))return!1;try{return Ct(JSON.parse(W(t,`utf-8`)))!==null}catch{return!1}}const Et=8192;function Dt(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Ot(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const kt=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function At(e){return e.replace(kt,`$1"[REDACTED-DEVICE-ID]"`)}function jt(e){return At(Ot(e))}const Mt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Nt(e){if(typeof e!=`string`)return null;let t=Mt.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Pt(e){let t=Ue(e,`r`);try{let e=Buffer.alloc(Et),n=0,r=!1;for(;n<Et;){let i=We(t,e,n,Et-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{Re(t)}}function Ft(e){try{let t=Pt(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Nt(a)}}catch{return{kind:`unreadable`}}}function It(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function Lt(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=G(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=z(e,t.name),r;try{r=Ye(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ft(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!It(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}const Rt=`state/os-termination-evidence.json`,zt=6048e5,Bt=/openknowledge/i,Vt=n.map(e=>a(t[e]));function Ht(e={}){return(t,n)=>new Promise(r=>{try{lt(t,n,{encoding:`utf8`,timeout:e.timeoutMs??15e3,maxBuffer:e.maxBuffer??16777216,windowsHide:!0},(e,t,n)=>{r({...Ut(e),stdout:t,stderr:n})})}catch(e){let t=e.code;r({status:null,stdout:``,stderr:``,errorCode:typeof t==`string`?t:`spawn-failed`})}})}function Ut(e){return e===null?{status:0}:typeof e.code==`string`?{status:null,errorCode:e.code}:typeof e.code==`number`?{status:e.code}:e.killed===!0?{status:null,errorCode:`ETIMEDOUT`}:e.signal?{status:null,signal:e.signal}:{status:null}}function Wt(e){if(e.errorCode!==void 0)return e.errorCode;if(e.signal!==void 0)return`signal ${e.signal}`;let t=(e.stderr.trim().split(`
1
+ import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{C as t,E as n,L as r,M as i,N as a,O as o,S as s,d as c,k as l,x as u}from"./constants-ok-dir-DZ25OS9-.mjs";import{Da as d,G as f,Gl as p,Kl as m,Oa as h,Qc as g,U as _,W as v,Yc as y,el as b,l as x,mf as S,nl as ee,tl as te,u as ne}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{$r as C,As as w,Cs as T,Es as re,Hi as ie,Ia as E,Is as D,Nt as O,Os as ae,Qt as oe,Si as k,Ss as se,Vo as A,Wi as j,_a as M,bi as N,ci as P,fr as ce,js as F,ks as le,m as ue,ma as de,mi as fe,nr as I,ta as pe,wi as me,ws as he,xi as ge,xo as _e,xs as ve}from"./dist-B0DBnzRw.mjs";import{t as ye}from"./yazl-BBz29IQN.mjs";import{t as be,y as xe}from"./fs-find-project-root-BYV07wjn.mjs";import{ct as Se,gt as Ce,ht as we,mt as Te,pt as Ee,st as De,wt as Oe}from"./init-BiiaRaJc.mjs";import{o as ke}from"./token-store-Bmb3_0hU.mjs";import{c as Ae}from"./colors-r_owlCuY.mjs";import{t as je}from"./is-object-BGze3w87.mjs";import{l as Me,u as Ne}from"./registry-probes-BO8LQnnq.mjs";import{n as Pe}from"./constants-DD0dQrNW.mjs";import"./loader-CF7WIVMA.mjs";import"./preview-Ch8NwweL.mjs";import{basename as L,dirname as R,isAbsolute as Fe,join as z,relative as Ie,resolve as B,sep as V,win32 as Le}from"node:path";import{closeSync as Re,cpSync as ze,createWriteStream as Be,existsSync as H,lstatSync as Ve,mkdirSync as U,mkdtempSync as He,openSync as Ue,readFileSync as W,readSync as We,readdirSync as G,readlinkSync as Ge,realpathSync as Ke,rmSync as qe,rmdirSync as Je,statSync as Ye,writeFileSync as K}from"node:fs";import{arch as Xe,freemem as Ze,homedir as q,hostname as Qe,platform as $e,release as et,tmpdir as tt,totalmem as nt,type as rt,uptime as it}from"node:os";import{readFile as at,readdir as ot,stat as st}from"node:fs/promises";import{createHash as ct}from"node:crypto";import{execFile as lt,execSync as ut,spawnSync as dt}from"node:child_process";function ft(e,t){let n=t.map(e=>[D(e),e]);for(let t of e){let e=D(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function pt(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=ft([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=ft(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function mt(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const ht=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function gt(e,t,n=be){if(e!==void 0&&!ht.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let _t=null;function vt(e){_t=e}function yt(){return _t??process.cwd()}const bt=`Open Knowledge`;function xt(e={}){let t=e.platformName??process.platform,n=e.productName??l().productName;return De(t).join(Se({...e,platformName:t}),n)}function St(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=De(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`${l().packageName.replaceAll(`/`,``)}-updater`)}function Ct(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function wt(e){let t=z(e,`state.json`);if(!H(t))return[];let n;try{n=JSON.parse(W(t,`utf-8`))}catch{return[]}return Ct(n)??[]}function Tt(e){let t=z(e,`state.json`);if(!H(t))return!1;try{return Ct(JSON.parse(W(t,`utf-8`)))!==null}catch{return!1}}const Et=8192;function Dt(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Ot(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const kt=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function At(e){return e.replace(kt,`$1"[REDACTED-DEVICE-ID]"`)}function jt(e){return At(Ot(e))}const Mt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Nt(e){if(typeof e!=`string`)return null;let t=Mt.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Pt(e){let t=Ue(e,`r`);try{let e=Buffer.alloc(Et),n=0,r=!1;for(;n<Et;){let i=We(t,e,n,Et-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{Re(t)}}function Ft(e){try{let t=Pt(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Nt(a)}}catch{return{kind:`unreadable`}}}function It(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function Lt(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=G(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=z(e,t.name),r;try{r=Ye(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ft(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!It(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}const Rt=`state/os-termination-evidence.json`,zt=6048e5,Bt=/openknowledge/i,Vt=n.map(e=>a(t[e]));function Ht(e={}){return(t,n)=>new Promise(r=>{try{lt(t,n,{encoding:`utf8`,timeout:e.timeoutMs??15e3,maxBuffer:e.maxBuffer??16777216,windowsHide:!0},(e,t,n)=>{r({...Ut(e),stdout:t,stderr:n})})}catch(e){let t=e.code;r({status:null,stdout:``,stderr:``,errorCode:typeof t==`string`?t:`spawn-failed`})}})}function Ut(e){return e===null?{status:0}:typeof e.code==`string`?{status:null,errorCode:e.code}:typeof e.code==`number`?{status:e.code}:e.killed===!0?{status:null,errorCode:`ETIMEDOUT`}:e.signal?{status:null,signal:e.signal}:{status:null}}function Wt(e){if(e.errorCode!==void 0)return e.errorCode;if(e.signal!==void 0)return`signal ${e.signal}`;let t=(e.stderr.trim().split(`
2
2
  `)[0]??``).replace(/\S*\/journal\/\S*/g,`<journal path>`).replace(/\b[0-9a-f]{32}\b/gi,`<id>`);return`exit ${e.status}${t===``?``:`: ${t}`}`}function J(e,t,n){return{schemaVersion:1,platform:e,source:t,outcome:`none-in-window`,readFrom:n,windowDays:7,foreignIgnored:0,unparseable:0,droppedOverCap:0,events:[]}}function Gt(e,t){return{...e,outcome:`unavailable`,unavailableReason:t}}function Kt(e){return{...e,outcome:e.events.length>0?`collected`:`none-in-window`}}function qt(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Jt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Yt(e,t){let n=t.indexOf(`
3
3
  `);if(n===-1)return null;let r,i;try{r=Jt(JSON.parse(t.slice(0,n))),i=Jt(JSON.parse(t.slice(n+1)))}catch{return null}if(r===null||i===null||!Array.isArray(i.processes))return null;let a=[];for(let e of i.processes){let t=Jt(e);t===null||typeof t.name!=`string`||!It(t.name)||a.push({name:t.name,pid:qt(t.pid),killReason:typeof t.reason==`string`?t.reason:null,residentPages:qt(t.rpages),lifetimeMaxPages:qt(t.lifetimeMax)})}let o=Nt(r.timestamp);return{kind:`jetsam`,at:o===null?null:new Date(o).toISOString(),file:e,pageSize:qt(Jt(i.memoryStatus)?.pageSize),largestProcessOwned:typeof i.largestProcess==`string`?It(i.largestProcess):null,ownedProcesses:a}}const Xt=/^JetsamEvent-.*\.ips$/;function Zt(e,t,n,r){let i=e.flatMap(({file:e,mtimeMs:n})=>n!==null&&n>=t?[{file:e,mtimeMs:n}]:[]);return i.sort((e,t)=>r===`newest-first`?t.mtimeMs-e.mtimeMs:e.mtimeMs-t.mtimeMs),{files:i.slice(0,n).map(({file:e})=>e),statFailed:e.filter(({mtimeMs:e})=>e===null).length,droppedOverCap:Math.max(0,i.length-n)}}async function Qt(e,t){let n=J(`darwin`,`macos-jetsam`,[z(e,`JetsamEvent-*.ips`)]),r;try{r=await ot(e)}catch(e){return Gt(n,e.code??`unknown`)}let i=Zt(await Promise.all(r.filter(e=>Xt.test(e)).map(async t=>{try{return{file:t,mtimeMs:(await st(z(e,t))).mtimeMs}}catch{return{file:t,mtimeMs:null}}})),t.getTime()-zt,50,`newest-first`);n.unparseable+=i.statFailed,n.droppedOverCap=i.droppedOverCap;for(let t of i.files){let r=null;try{r=Yt(t,await at(z(e,t),`utf8`))}catch{}r===null?n.unparseable+=1:r.ownedProcesses.length===0?n.foreignIgnored+=1:n.events.push(r)}return Kt(n)}const $t=[`--no-pager`,`--output=short-iso-precise`,`--since=-7d`,`--grep=Out of memory|oom-kill|Killed process|Killed /|memory pressure`,`_TRANSPORT=kernel`,`+`,`_SYSTEMD_UNIT=systemd-oomd.service`],en=[`--user`,`--no-pager`,`--output=short-iso-precise`,`--since=-7d`,`--grep=Fatal Wayland communication error|Wayland protocol error|X IO error|Missing X server`],tn=/^(\S+) \S+ ([^:\s[]+)(?:\[\d+\])?: (.*)$/,nn=/\[(\d+)(?::\d+)?:\d{4}\/\d{6}\.\d+:[A-Z0-9]+:[^\]]*\]\s*(.*)$/,rn=/^desktop\.\d{4}-\d{2}-\d{2}\.log$/;async function an(e,t){let n=new Set,r;try{r=await ot(e)}catch{return{pids:n,unreadable:!0}}let i=!1;for(let a of r){if(!rn.test(a))continue;let r=z(e,a);try{if(t.getTime()-(await st(r)).mtimeMs>zt)continue;for(let e of(await at(r,`utf8`)).split(`
4
4
  `)){if(!e.includes(`"event":"desktop.boot"`))continue;let t=/"pid":(\d+)/.exec(e)?.[1];t!==void 0&&n.add(Number(t))}}catch{i=!0}}return{pids:n,unreadable:i}}function on(e,t){if(e===`systemd-oomd`){let e=/^Killed (\S+)/.exec(t);if(e===null)return null;let n=e[1]?.split(`/`).pop()??``;return{origin:`systemd-oomd`,action:`oomd-kill`,pid:null,processName:null,unit:Bt.test(n)?n:null,trigger:/swap used/.test(t)?`swap`:/memory pressure/.test(t)?`memory-pressure`:null}}if(e!==`kernel`)return null;let n=/Killed process (\d+) \(([^)]+)\)/.exec(t);if(n!==null)return{origin:`kernel`,action:`oom-kill`,pid:Number(n[1]),processName:n[2]??null,unit:null,trigger:null};let r=/task=([^,]+),pid=(\d+)/.exec(t);if(r!==null)return{origin:`kernel`,action:`oom-kill`,pid:Number(r[2]),processName:r[1]??null,unit:null,trigger:null};let i=/^(\S+) invoked oom-killer/.exec(t);return i===null?null:{origin:`kernel`,action:`oom-invoked`,pid:null,processName:i[1]??null,unit:null,trigger:null}}function sn(e){let t=[],n=0,r=0;for(let i of e.split(`