@inkeep/open-knowledge 0.86.19-beta.3 → 0.86.19

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 (103) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-BSsoisIb.mjs +1 -0
  4. package/dist/{dist-CP1cIPST.mjs → dist-CbA9Te53.mjs} +468 -468
  5. package/dist/{dist-CJb4z7Cx.mjs → dist-dkuaYp-W.mjs} +1 -1
  6. package/dist/index.mjs +81 -81
  7. package/dist/{init-XYCfFXC2.mjs → init-D1_2kwSe.mjs} +2 -2
  8. package/dist/init-FqdPU1R4.mjs +1 -0
  9. package/dist/{launch-json-removal-BeUprPXt.mjs → launch-json-removal-grbQuHRl.mjs} +1 -1
  10. package/dist/{loader-C3aJ7pno.mjs → loader-CqCKhp-3.mjs} +1 -1
  11. package/dist/loader-DmXf4bJ0.mjs +1 -0
  12. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  13. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  14. package/dist/{open-browser-D2QoIpKk.mjs → open-browser-foWNoVBg.mjs} +1 -1
  15. package/dist/preview-CpjZq6qS.mjs +1 -0
  16. package/dist/{preview-rfRPPmZw.mjs → preview-Dw5ht4g5.mjs} +1 -1
  17. package/dist/public/assets/{AccountSection-DojYWsvF.js → AccountSection-DVxaHkM4.js} +1 -1
  18. package/dist/public/assets/{ActivityModeContent-5eDMFCds.js → ActivityModeContent-BIgcJK6a.js} +1 -1
  19. package/dist/public/assets/{AddPropertiesButton-2uz1_eQ0.js → AddPropertiesButton-D968tXQy.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-CyTVCF2i.js → AgentDiffPane-RE601rTO.js} +1 -1
  21. package/dist/public/assets/{AppMenubar-vPHVy2jk.js → AppMenubar-ClplcAeM.js} +1 -1
  22. package/dist/public/assets/{AttachmentsSection-kXSdmpS8.js → AttachmentsSection-DL9nvFCk.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-D_sfUFdL.js → CodeMirrorPropInput-D-MXrjSu.js} +1 -1
  24. package/dist/public/assets/{ContentRulesSection-DOJqWd7Z.js → ContentRulesSection-DOLvfOER.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-C7mE6mu6.js → DocumentContext-DoYFEoIV.js} +12 -12
  26. package/dist/public/assets/{EditorModeToggle-4mNDd2Qr.js → EditorModeToggle-BrrBR82z.js} +1 -1
  27. package/dist/public/assets/{ExcalidrawDocEditor-Bpb19a7u.js → ExcalidrawDocEditor-C9_cuBBc.js} +1 -1
  28. package/dist/public/assets/FeedbackForm-DL3ThcXe.js +1 -0
  29. package/dist/public/assets/{ImportSkillDialog-DDmDFsFX.js → ImportSkillDialog-BbfUjEEz.js} +1 -1
  30. package/dist/public/assets/{LinkPreviewsSection-DC-XUEKY.js → LinkPreviewsSection-fEX_XthT.js} +1 -1
  31. package/dist/public/assets/{LintConfigEditor-D0EaXTzh.js → LintConfigEditor-3qempgFs.js} +1 -1
  32. package/dist/public/assets/{LintingSection-8rk1N2xf.js → LintingSection-C0-lVwWU.js} +1 -1
  33. package/dist/public/assets/{ManagedArtifactProperties-BIuX58nK.js → ManagedArtifactProperties-BHAjmSMa.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-CaWEt6SH.js +1 -0
  35. package/dist/public/assets/{Mermaid-DqNhHNi1.js → Mermaid-BUWNFmOJ.js} +2 -2
  36. package/dist/public/assets/{MermaidDocEditor-Mzy0bDbh.js → MermaidDocEditor-DbH59fgw.js} +1 -1
  37. package/dist/public/assets/{NetworkAccessSection-CbNihszz.js → NetworkAccessSection-Bbbze3FD.js} +1 -1
  38. package/dist/public/assets/{PropertyDisplayRow-CIGM7uEu.js → PropertyDisplayRow-DAkX7-35.js} +1 -1
  39. package/dist/public/assets/{PublishToGitHubDialog-Cyyc-7WZ.js → PublishToGitHubDialog-C3q1CDqm.js} +1 -1
  40. package/dist/public/assets/ReportBugMenuTrigger-CAUKQKXn.js +1 -0
  41. package/dist/public/assets/{SchemaConfigEditor-DIMVYCnO.js → SchemaConfigEditor-MCN2u6si.js} +1 -1
  42. package/dist/public/assets/{SearchSection-OsK3-bM9.js → SearchSection-DCs9WFjN.js} +1 -1
  43. package/dist/public/assets/{SessionsHost-ddZzbbYD.js → SessionsHost-CIsRLSaE.js} +2 -2
  44. package/dist/public/assets/{SettingsDialogBody-DahMDMVc.js → SettingsDialogBody-BGgrDG7O.js} +2 -2
  45. package/dist/public/assets/{ShareReceiveMissDialog-BVXdjnFS.js → ShareReceiveMissDialog-Bw61hL4X.js} +1 -1
  46. package/dist/public/assets/{SkillToolbarControls-CWy86npn.js → SkillToolbarControls-BO0PKTq1.js} +1 -1
  47. package/dist/public/assets/{SourceEditor-bEulpItb.js → SourceEditor-BBLTRJ7D.js} +1 -1
  48. package/dist/public/assets/{SyncSection-DW6x2wXm.js → SyncSection-CRJzeX9p.js} +1 -1
  49. package/dist/public/assets/{SyncStatusBadge-CodPHi7k.js → SyncStatusBadge-D1OtRzRB.js} +1 -1
  50. package/dist/public/assets/{TerminalSection-W882kbVI.js → TerminalSection-CC2YwJpV.js} +1 -1
  51. package/dist/public/assets/{TerminalWindowApp-DQ04VIwE.js → TerminalWindowApp-DoI0jqQ1.js} +1 -1
  52. package/dist/public/assets/{TextDocEditor-CzNAofgq.js → TextDocEditor-BxVTOe7e.js} +1 -1
  53. package/dist/public/assets/ThreadView-BHYoyM_O.js +28 -0
  54. package/dist/public/assets/{TimelineDiffPane-QwIzI-70.js → TimelineDiffPane-DO9irXKb.js} +1 -1
  55. package/dist/public/assets/{client-version-DaqPNZrZ.js → client-version-BVxzNu0e.js} +1 -1
  56. package/dist/public/assets/{comment-chips-CJoaS3Cr.js → comment-chips-50INyshh.js} +1 -1
  57. package/dist/public/assets/{config-provider-BZrRPx0L.js → config-provider-Bf-6EUb_.js} +1 -1
  58. package/dist/public/assets/{dist-BUMFJcXg.js → dist-CxQmGY4K.js} +12 -13
  59. package/dist/public/assets/dist-JrdDgCNs.js +124 -0
  60. package/dist/public/assets/{doc-undo-manager-CYWGW9IX.js → doc-undo-manager-CavX05dP.js} +1 -1
  61. package/dist/public/assets/{globals-Cn_PZ-hh.css → globals-Cr0S8PDH.css} +1 -1
  62. package/dist/public/assets/index-C10zpKkC.js +2209 -0
  63. package/dist/public/assets/{lint-plugins-YpFY23BP.js → lint-plugins-C4Px2YBE.js} +1 -1
  64. package/dist/public/assets/{pending-receive-nav-store-BAkqfwcI.js → pending-receive-nav-store-BHYqINaL.js} +1 -1
  65. package/dist/public/assets/{preferred-session-events-Ixz9XkPb.js → preferred-session-events-DWIfqtIB.js} +1 -1
  66. package/dist/public/assets/{progress-DZa81aer.js → progress-CgvUuzyt.js} +1 -1
  67. package/dist/public/assets/{selection-context-Dl0HvyD2.js → selection-context-C1ugIbCJ.js} +1 -1
  68. package/dist/public/assets/{src-DVnJ3yRP.js → src-BjX-JGKc.js} +1 -1
  69. package/dist/public/assets/{telemetry-impl-8tI6j9Yf.js → telemetry-impl-DsQovEi7.js} +1 -1
  70. package/dist/public/assets/{telemetry-startup-DYXC3ZEO.js → telemetry-startup-Dgw1BcUL.js} +1 -1
  71. package/dist/public/assets/{typing-burst-detector-NANAUeWK.js → typing-burst-detector-iy4OEiLk.js} +2 -2
  72. package/dist/public/assets/{uninstall-DBWFuFGF.js → uninstall-DFTOzPT_.js} +1 -1
  73. package/dist/public/assets/{use-activity-panel-D7UDHbaB.js → use-activity-panel-BJDvDdvC.js} +1 -1
  74. package/dist/public/assets/use-installed-clis-BopBqnEZ.js +2 -0
  75. package/dist/public/assets/{use-open-skill-CHcEq4yM.js → use-open-skill-CFJ6fXda.js} +1 -1
  76. package/dist/public/assets/{use-terminal-enabled-CJC0W91S.js → use-terminal-enabled-jAihkkWu.js} +1 -1
  77. package/dist/public/assets/{use-timeline-entry-diff-39zbjqC8.js → use-timeline-entry-diff-dOfytDk7.js} +1 -1
  78. package/dist/public/index.html +24 -24
  79. package/dist/public/uninstall.html +3 -3
  80. package/dist/{registry-probes-BePFTC2o.mjs → registry-probes-CPlsORK6.mjs} +1 -1
  81. package/dist/{removal-file-path-adczU7M3.mjs → removal-file-path-DXtxSsXI.mjs} +1 -1
  82. package/dist/{repair-launch-json-BKBgRjgC.mjs → repair-launch-json-HSjuiz_b.mjs} +1 -1
  83. package/dist/{repair-mcp-configs-DLgaoj3b.mjs → repair-mcp-configs-B3D0qm57.mjs} +1 -1
  84. package/dist/{src-CaqFOBSF.mjs → src-C9gZ883x.mjs} +1 -1
  85. package/dist/src-CSHgb4Fd.mjs +1 -0
  86. package/dist/{start-smef5zYS.mjs → start-CRtnwn3L.mjs} +3 -3
  87. package/dist/start-mTFQvqCW.mjs +1 -0
  88. package/package.json +4 -4
  89. package/dist/constants-D__Dkzs1.mjs +0 -1
  90. package/dist/init-BJEVSZ5Z.mjs +0 -1
  91. package/dist/loader-Bxzbqy9N.mjs +0 -1
  92. package/dist/preview-DOE3RMB2.mjs +0 -1
  93. package/dist/public/assets/FeedbackForm-CrGH6Sjh.js +0 -1
  94. package/dist/public/assets/ManagedArtifactProperties-BCSB1r7p.js +0 -1
  95. package/dist/public/assets/ReportBugMenuTrigger-CvL5wd-7.js +0 -1
  96. package/dist/public/assets/ThreadView-ZvtUjW7G.js +0 -28
  97. package/dist/public/assets/dist-DjMGDcCv.js +0 -161
  98. package/dist/public/assets/index-BSW8Oe5H.js +0 -2209
  99. package/dist/public/assets/preview-frame.html +0 -9
  100. package/dist/public/assets/use-installed-clis-DVpPDztg.js +0 -2
  101. package/dist/src-BICtdUdy.mjs +0 -1
  102. package/dist/start-DrVKuTk8.mjs +0 -1
  103. /package/dist/public/assets/{globals-nzGvH8Va.js → globals-DHDe92Ga.js} +0 -0
package/dist/index.mjs CHANGED
@@ -426,8 +426,8 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
426
426
  `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=bq(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l={...i,attributes:(i.attributes??[]).map(v_e),children:(i.children??[]).map(g_e)};return m_e(l,t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=Dq(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},underline(e,t,n,r){let i=e.data?.sourceForm===`ins`?`<ins>`:`<u>`,a=e.data?.sourceForm===`ins`?`</ins>`:`</u>`,o=n.createTracker(r),s=n.enter(`underline`),c=o.move(i);return c+=n.containerPhrasing(e,{before:c,after:a,...o.current()}),c+=o.move(a),s(),c},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=bq(e.attributes??[]),i=(e.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return i?r?`<${n} ${r}>${i}</${n}>`:`<${n}>${i}</${n}>`:r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!h_e.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function bq(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${xq(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function xq(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function v_e(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:xq(e.value)}}:e}function Sq(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function Cq(e,t,n,r=!1){let i=String(n.url??``),a=i.startsWith(`<`)&&i.endsWith(`>`);if(n.data?.sourceUrlForm===`angle-bracketed`&&!a||r){let n=e.enter(`destinationLiteral`),r=t.move(y_e(i,e.stack.includes(`tableCell`)));return n(),r}let o=e.enter(`destinationRaw`),s=t.move(b_e(i));return o(),s}function y_e(e,t=!1){let n=`<`;for(let r=0;r<e.length;r++){let i=e[r];wH(i)||t&&i===`|`?n+=`\\${i}`:n+=i===`
427
427
  `?`&#xA;`:i===`\r`?`&#xD;`:i===`\\`?TH(e[r+1])?`\\\\`:`\\`:i}return`${n}>`}function b_e(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function x_e(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>S_e(t)?e:`\\${e}`)}function S_e(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}const C_e=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function w_e(e){return e.replace(C_e,e=>rc(e)?``+e.slice(1):e)}function T_e(e){return/[\r\n][\t ]*$/.test(e)}function wq(e,t,n,r=!1){let{matched:i}=MU(t,{escapeAware:!1});if(i.length===0)return Tq(e,t,n,r);let a=``,o=0,s=i=>{i>o&&(a+=Tq(e,t.slice(o,i),{...n,before:n.before+a,after:t.slice(i,i+1)||n.after},r)),o=i};for(let e of i)s(e.start),!T_e(n.before+a)&&(a+=t.slice(e.start,e.end),o=e.end);return s(t.length),a}function Tq(e,t,n,r=!1){let i=e.unsafe;e.unsafe=i.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||r&&e.character===`:`&&e.before===`[ps]`&&e.after===`\\/`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
428
428
  ]|$)`};return delete t._compiled,t});let a;try{a=e.safe(w_e(t),n)}finally{e.unsafe=i}return a=a.replaceAll(``,`\\&`),x_e(O_e(a,n))}function Eq(e){if(Number.isNaN(e))return`ws`;let t=Vf(e);return t===1?`ws`:t===2?`punct`:`other`}function E_e(e,t,n){let r=Eq(t),i=Eq(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function D_e(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
429
- `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function O_e(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&D_e(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=E_e(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function Dq(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);Oq(i.charCodeAt(i.length-1),s,r)&&(o=kq(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return Oq(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+kq(c)),o}function Oq(e,t,n){return!(Vf(t)!==1||n===`_`&&Vf(e)===void 0)}function kq(e){return`&#x${e.toString(16).toUpperCase()};`}function k_e(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!j_e(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function A_e(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=Dq(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function j_e(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const Aq=[{mode:`protecting`,protect:LH,reservations:FH},{mode:`protecting`,protect:FU,reservations:HH},{mode:`protecting`,protect:jH,reservations:DH},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(Aq.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function M_e(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function jq(e){return Aq.reduce(M_e,e)}function Mq(e){return e.data?.sourceRaw}function N_e(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&Mq(e)===``}function Nq(e){return e.type===`paragraph`&&(e.children??[]).every(N_e)}function Pq(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function P_e(e){switch(e.type){case`table`:return Pq(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return Mq(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return Mq(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function F_e(e){let t=[];for(let n of e.children){if(n.type===`table`&&Pq(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}P_e(n)||(n.type===`paragraph`&&n.children.length>0&&Nq(n)&&(n.children=[]),t.push(n))}e.children=t}function I_e(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const L_e=(e,t)=>{if(Nq(e)||I_e(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},Fq=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function R_e(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;Wf(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=mP(e);Fq.lastIndex=0;let o=[],s;for(;(s=Fq.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(vP(a,e,1)||vP(a,t-1,1)){Fq.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(_P(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=xP(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(_P(n,e,l,i.length)),r.children.splice(t,1,...c),[yf,t+c.length]})}}const z_e=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function B_e(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function V_e(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function Iq(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const Lq=/[ \t]+$/,Rq=/^[ \t]*$/;function H_e(e){return e.some(e=>!(Iq(e)&&Rq.test(e.value)))}function zq(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(B_e(n)){V_e(n);break}if(n&&z_e.has(n.type)&&`children`in n){let t=n.children;if(zq(t,!0),t.length===0){e.pop();continue}}if(!t&&Iq(n)&&Lq.test(n.value)){let t=n.value.replace(Lq,``);if(t.length>0){n.value=t;continue}if(H_e(e.slice(0,-1))){e.pop();continue}if(e.every(e=>Iq(e)&&Rq.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const U_e=new Set([`paragraph`,`heading`,`tableCell`]);function W_e(e){let t=e=>{if(U_e.has(e.type)&&`children`in e&&zq(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const Bq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[A-Za-z]|[^\\x00-\\x7F]`}]};function G_e(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===Bq)||e.toMarkdownExtensions.push(Bq)}const K_e=new Set([`u`,`ins`]);function q_e(){return e=>{Wf(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!K_e.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}function J_e(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const Y_e=[{name:`remark-parse`,plugin:w_},{name:`escape-provenance`,plugin:AK},{name:`remark-mdx-agnostic`,plugin:UU},{name:`remark-gfm`,plugin:Uh},{name:`remark-math`,plugin:qW,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:fW},{name:`remark-github-alerts`,plugin:UW,options:xG},{name:`callout-transformer`,plugin:bG},{name:`restore-from-mdx`,plugin:LU},{name:`void-br-promoter`,plugin:qU},{name:`restore-entity-refs`,plugin:PH},{name:`restore-backslash-escapes`,plugin:RH},{name:`details-accordion-promoter`,plugin:aK},{name:`div-align-promoter`,plugin:mK},{name:`image-promoter`,plugin:RK},{name:`indented-code-promoter`,plugin:WK},{name:`math-promoter`,plugin:eq},{name:`single-dollar-math-promoter`,plugin:R_e},{name:`highlight-promoter`,plugin:LK},{name:`underline-promoter`,plugin:q_e},{name:`mermaid-promoter`,plugin:n_e},{name:`comment-promoter`,plugin:wG},{name:`merged-post-parse-walker`,plugin:e_e},{name:`empty-task-item-unmint`,plugin:xK},{name:`link-reference-destination`,plugin:QK},{name:`non-rendering-context-demote`,plugin:d_e},{name:`ensure-non-empty-doc`,plugin:()=>J_e}];function X_e(e){let t=ug();for(let e of Y_e)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(FW,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function Z_e(e){let t=ug().use(zg,[`yaml`]).use(Uh,{tablePipeAlign:!1}).use(qW,{singleDollarTextMath:!1}).use(UU).use(fW).use(G_e).use(aB,{bullet:`-`,fences:!0,rule:`-`,join:[L_e],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function Vq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const Hq=/^\n+$/,Uq=/^\n{2,}$/;function Wq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Hq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);Uq.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Q_e(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Hq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&Uq.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function $_e(e,t){let{source:n,hadBom:r}=Vq(e),i=JG(n),a=new ng(jq(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);JK(s,i);let c=Wq(s,i,r),l=c?ws(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function eve(e,t){return Gq(e,t,!1)}function tve(e,t){return Gq(e,t,!0)}function Gq(e,t,n){let{source:r,hadBom:i}=Vq(e),a=JG(r),o=new ng(jq(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&JK(c,a);let l=Wq(c,a,i);return n&&l&&ws(c,l),c}function nve(e,t,n){let r=LW(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});Kq(r),yK(r),W_e(r),F_e(r);let i=Q_e(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function Kq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)Kq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=lP(i)?i.escapedChars:null,s=lP(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}var rve=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=yO(e.extensions),this.handlers=cve(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Qs({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=lve(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=X_e({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Z_e({toMarkdownHandlers:__e})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return $_e(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?eve(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?tve(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?XW(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return nve(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const qq=eV();function Jq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function ive(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function ave(e,t){return e.attrs.sourceDirty||ive(e)?!0:t?t.isDiverged(e.toJSON()):!1}function ove(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function Yq(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function Xq(e,t){if(e.length===0)return Yq({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return Yq({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[Xq(n.children,t)]}}return Yq({type:`inlineCode`,value:Zq(e)},t)}function Zq(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=Zq(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const sve=Oc;function cve(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=MW(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=MW(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=yW(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r,sourceUrlForm:e.data?.sourceUrlForm??null})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&oc(t.raw)!==null&&rc(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=oc(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=NW(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NW(r.highlight)),r.underline&&(i.underline=NW(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=NW(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MW(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NW(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NW(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MW(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=MW(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=MW(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker,s=!!o.spec.attrs?.sourceUrlForm;i.definition=i=>{let c={title:i.title??null};return n&&(c.identifier=i.identifier??``),c.label=i.label??i.identifier??``,e?c.url=i.url??``:t&&(c.href=i.url??``),r&&(c.sourceLayout=i.data?.sourceLayout??null),a&&(c.sourceTitleMarker=i.data?.sourceTitleMarker??null),s&&(c.sourceUrlForm=i.data?.sourceUrlForm??null),o.createAndFill(c)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=qq.getOrWildcard(o),c=Jq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=yW(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?qq.get(i):void 0;if(o&&n.jsxInline){let e=Jq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=sk(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&sve.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&kc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&jc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Mc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:bW(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=MW(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function lve(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RW(`paragraph`)),i.blockquote&&(n.blockquote=RW(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=RW(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=RW(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&ove(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=RW(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:HP(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>{let t={type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title};return e.attrs.sourceUrlForm===`angle-bracketed`&&(t.data={sourceUrlForm:`angle-bracketed`}),t}),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!ave(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:qq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:qq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return CB(t,e,qq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=zW(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zW(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return Xq(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=zW(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zW(`mark`)),a.underline&&(r.underline=zW(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=zW(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RW(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=RW(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return tk(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const uve=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(QB.flatMap(e=>e.surface===`compat`&&uve.has(e.rendersAs)?[[e.name,e]]:[])),Np(`<>`);var Qq={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100};Qq.SINGLE_TILDE,Qq.COMPARISON_OPERATORS,Qq.HTML_TAGS,Qq.SETEXT_HEADINGS,Qq.LINKS,Qq.BOLD_ITALIC,Qq.BOLD,Qq.ITALIC_DOUBLE_UNDERSCORE,Qq.ITALIC_SINGLE_ASTERISK,Qq.ITALIC_SINGLE_UNDERSCORE,Qq.INLINE_CODE,Qq.STRIKETHROUGH,Qq.KATEX,Qq.INLINE_KATEX,ug().use(w_).use(Uh);const $q=U(bt),dve=U(iee),fve=V({alwaysOn:L().int().nonnegative(),onTrigger:L().int().nonnegative(),onDemand:L().int().nonnegative()}).strict();V({intents:B(V({satisfierId:I().min(1),desired:U([`present`,`absent`])}).loose()),...Ud,summary:Wd}).loose();const pve=V({satisfierId:I(),agentId:I(),piece:I(),scope:I(),kind:I(),pathId:I().optional(),desired:U([`present`,`absent`]),action:U(va),errorId:I().optional()}).loose(),mve=V({kind:I(),satisfierIds:B(I()),agentIds:B(I()),pathId:I().optional(),blockedReason:I().optional()}).loose(),hve=V({state:I(),strictness:B(U(ga)).optional()}).loose(),gve=V({probes:V({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(I(),hve)}).loose(),detection:V({detected:B(I()),probed:R()}).loose()}).loose();V({actions:B(pve),conflicts:B(mve),withheld:B(I()),snapshot:gve}).loose(),V({entries:B(V({level:U([`info`,`warn`,`error`]),message:I().max(8192),event:I().optional(),fields:H(I(),z()).optional(),ts:L().optional(),sourceId:I().optional(),lineNumber:L().optional()}).loose()).max(100),droppedSinceLastFlush:L().int().min(0).optional()}).loose(),V({accepted:L().int().min(0)}).loose();const _ve=V({exact:I().min(1),prefix:I(),suffix:I(),start:L().int().nonnegative(),end:L().int().nonnegative()}),vve=B($i([I(),L().int().nonnegative()])),yve=ea(`kind`,[V({kind:W(`body`)}),V({kind:W(`property`),key:I().min(1),path:vve.default([])})]).default({kind:`body`}),bve=U([`anchored`,`orphaned`,`resolved`]),eJ=V({threadId:I().min(1),docName:I().min(1),target:yve,anchor:_ve.nullable(),state:bve,queued:R(),latestComment:I(),createdBy:I().min(1),createdAt:L(),updatedAt:L().optional()}),tJ=V({docName:I(),instruction:I(),property:I().nullable(),passage:V({exact:I(),prefix:I(),suffix:I()}).nullable(),anchorLost:R(),passageRepeats:R()}).loose(),nJ=V({threadId:I(),ok:W(!0)}),rJ=V({threadId:I(),ok:W(!1),error:W(`not-found`)});V({threads:B(eJ)}).loose(),V({meta:eJ,orphaned:R()}).loose(),V({threadId:I()}).loose(),V({meta:eJ,payload:tJ}).loose(),V({results:B($i([nJ.extend({meta:eJ,payload:tJ}),rJ]))}).loose(),V({results:B($i([nJ.extend({meta:eJ}),rJ]))}).loose();const xve=V({status:I().min(1),reason:I()}).loose();V({docName:I().min(1),content:I(),lifecycle:xve.nullable()}).loose(),V({documents:B(V({kind:U([`document`,`asset`,`folder`,`file`]).default(`document`),docName:I().min(1).optional(),docExt:I().min(1).default(`.md`),size:L().int().nonnegative(),modified:I().min(1),isSymlink:R().default(!1),canonicalDocName:I().nullable().default(null),targetPath:I().nullable().default(null),path:I().min(1).optional(),assetExt:I().min(1).optional(),mediaKind:U([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:B(I().min(1)).optional(),hasChildren:R().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:R().optional()}).loose();const Sve=V({source:I().min(1),anchor:I().nullable(),title:I(),snippet:I().nullable()}).loose();V({docName:I().min(1),backlinks:B(Sve)}).loose(),V({counts:H(I().min(1),L().int().nonnegative())}).loose(),V({counts:H(I().min(1),L().int().nonnegative())}).loose();const Cve=ea(`kind`,[V({kind:W(`doc`),docName:I().min(1),anchor:I().nullable(),title:I(),snippet:I().nullable()}).loose(),V({kind:W(`external`),url:I().min(1),title:I(),snippet:I().nullable()}).loose()]),wve=V({role:I().min(1),sourceForm:I().min(1),targetKind:I().min(1),href:I(),resolvedTarget:I().nullable(),status:I().min(1),reason:I().nullable(),resolutionMethod:I().min(1),fallbackTarget:I().nullable().default(null),range:V({start:L().int().nonnegative(),end:L().int().nonnegative()}),line:L().int().nonnegative(),column:L().int().nonnegative(),definition:V({label:I(),line:L().int().nonnegative()}).nullable().default(null)}).loose();V({docName:I().min(1),forwardLinks:B(Cve),localTargets:B(wve).optional()}).loose();const Tve=ea(`kind`,[V({id:I().min(1),kind:W(`doc`),docName:I().min(1),anchor:I().nullable(),label:I(),cluster:I().nullable(),category:I().nullable(),tags:B(I()).nullable(),managed:R().optional()}).loose(),V({id:I().min(1),kind:W(`external`),url:I().min(1),label:I()}).loose()]),Eve=V({source:I().min(1),target:I().min(1)}).loose();V({nodes:B(Tve),links:B(Eve)}).loose();const Dve=V({ts:L().int().min(0),url:I(),method:I(),ua:I().optional(),origin:I().optional(),referer:I().optional(),host:I().optional(),remote:I().optional(),secChUa:I().optional(),secChUaMobile:I().optional(),secChUaPlatform:I().optional(),secFetchSite:I().optional(),secFetchDest:I().optional(),secFetchMode:I().optional(),secFetchUser:I().optional()}).loose(),Ove=V({app:$i([W(`cursor`),W(`codex`),W(`claude`),qi()]),signals_fired:B(I())}).loose();V({entries:B(Dve),count:L().int().min(0),detection:Ove}).loose();const iJ=V({path:I().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:I().min(1).optional(),syncScoped:R(),open:ea(`kind`,[V({kind:W(`doc`),docName:I().min(1)}),V({kind:W(`asset`),path:I().min(1)})]).optional()}).loose();V({branch:I().nullable(),detached:R(),upstream:I().nullable(),staged:B(iJ),notStaged:B(iJ),untracked:B(iJ),incoming:B(iJ),truncated:R(),readable:R().default(!0)}).loose();const kve=U([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),Ave=U([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),jve=U([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),Mve=U([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),Nve=V({mergeQueue:V({position:L().int().nonnegative(),state:kve.nullable().catch(null)}).nullable().catch(null),autoMerge:R(),mergeState:Ave.nullable().catch(null),reviewDecision:jve.nullable().catch(null),checks:Mve.nullable().catch(null)}).loose(),Pve=V({kind:U([`pull`,`issue`]),repo:I().min(1),number:L().int().positive(),title:I(),author:I().nullable(),createdAt:I(),lifecycle:U([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:L().int().nonnegative().optional(),deletions:L().int().nonnegative().optional(),status:Nve.optional()}).loose();V({url:I()}).loose(),ea(`ok`,[V({ok:W(!0),preview:Pve}).loose(),V({ok:W(!1),reason:I()}).loose()]),V({writers:B(V({id:I().min(1),name:I().optional(),email:I().optional()}).loose()).optional(),summary:Wd,...Ud}).loose(),V({checkpointRef:I().min(1)}).loose();const Fve=V({v:L().int().optional(),id:I().min(1),name:I().min(1),colorSeed:I().optional(),docs:B(I()),summaries:B(I()).optional()}).loose();V({entries:B(V({sha:I().min(1),timestamp:I().min(1),author:I(),authorEmail:I(),type:U([`checkpoint`,`wip`,`upstream`,`park`]),message:I(),contributors:B(Fve),checkpoint:z().nullable(),parentSha:I().nullable().optional()}).loose()),total:L().int().nonnegative().optional(),truncated:R().optional(),hasMore:R().optional()}).loose(),V({sha:I().regex(/^[0-9a-f]{40}$/i),content:I(),timestamp:I(),author:I()}).loose(),V({contentDir:I().min(1),pathSeparator:U([`/`,`\\`]),symlinkResolved:R()}).loose(),B(ea(`source`,[V({docName:I().min(1),timestamp:I().min(1),size:L().int().nonnegative(),source:W(`flat`)}).loose(),V({docName:I().min(1),timestamp:I().min(1),source:W(`timeline`),sha:I().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const Ive=V({domain:I().min(1),title:I().optional(),description:I().optional(),siteName:I().optional(),faviconDataUri:I().optional()}).loose();V({url:I()}).loose(),ea(`ok`,[V({ok:W(!0),metadata:Ive}).loose(),V({ok:W(!1),reason:I()}).loose()]),V({orphans:B(V({docName:I().min(1),title:I()}).loose())}).loose(),V({hubs:B(V({docName:I().min(1),title:I(),count:L().int().nonnegative()}).loose())}).loose();const Lve=V({source:I().min(1),title:I(),snippet:I().nullable()}).loose();V({deadLinks:B(V({target:I().min(1),sources:B(Lve)}).loose())}).loose(),V({target:V({docName:I().min(1),title:I(),aliases:B(I())}).loose(),mentions:B(V({source:I().min(1),excerpt:I(),offset:L().int().nonnegative()}).loose()),truncated:R()}).loose(),V({projectPath:I().min(1)}).loose();const Rve=U([`not-a-git-worktree`,`init-failed`]);ea(`ok`,[V({ok:W(!0),projectPath:I().min(1)}).loose(),V({ok:W(!1),reason:Rve,message:I().min(1)}).loose()]),V({host:I().min(1).optional()}).loose(),V({host:I().min(1).optional(),token:I().min(1)}).loose(),V({host:I(),login:I()}).loose(),V({host:I().refine(hc,{message:`Host must be a hostname with an optional :port, with no scheme or path`}),username:I().min(1),token:I().min(1)}).loose(),V({host:I(),login:I()}).loose(),V({key:I().min(1)}).loose(),V({keyPresent:R()}).loose();const zve=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ea(`ok`,[V({ok:W(!0),endpoint:I().min(1),model:I().min(1),dimensions:L().int().positive()}).loose(),V({ok:W(!1),endpoint:I().min(1),model:I().min(1),reason:zve,status:L().int().optional()}).loose()]),V({name:I().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:I().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),V({authenticated:R()}).loose(),V({channel:U([`login`,`gh-login`]).default(`login`)}).loose(),V({}).loose();const Bve=V({stackIndex:L().int().min(0),ts:L().int().min(0),additions:L().int().min(0),deletions:L().int().min(0)}).loose(),Vve=V({docName:I().min(1),additionsTotal:L().int().min(0),deletionsTotal:L().int().min(0),lastTs:L().int().min(0),bursts:B(Bve)}).loose(),Hve=V({displayName:I().min(1),color:I().min(1),icon:I().optional(),connectionId:I().min(1)}).loose();V({sessionAlive:R(),agent:Hve.nullable(),files:B(Vve)}).loose(),V({diff:I(),before:I(),after:I(),properties:kP,generatedAt:L().int().min(0)}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose();const Uve=V({displayName:I().min(1),icon:I(),color:I().min(1),currentDoc:I().nullable(),mode:U([`idle`,`writing`]),ts:L().int().min(0)}).loose();V({presence:H(I().min(1),Uve)}).loose();const Wve=V({sessionId:I().min(1),agentType:I().min(1),ts:L().int().min(0),insertedChars:L().int().min(0),deletedChars:L().int().min(0)}).loose();V({effects:B(V({"doc.name":I().min(1),entries:B(Wve)}).loose())}).loose(),V({decisions:B(V({ts:L().int().min(0),decision:I().min(1),kind:I().min(1),"doc.name":I().min(1),pathRole:I().min(1)}).loose())}).loose(),H(I().min(1),R()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),V({path:I().min(1,`path must be non-empty`)}).loose(),V({}).loose();const Gve=V({fromDocName:I().min(1),toDocName:I().min(1)}).loose(),Kve=V({fromPath:I().min(1),toPath:I().min(1)}).loose();V({}).loose(),V({path:I().min(1),...Ud,summary:Wd}).loose(),V({docName:I().min(1)}).loose(),V({path:I().min(1),...Ud,summary:Wd}).loose(),V({path:I().min(1)}).loose(),V({kind:U([`file`,`folder`]),path:I().min(1),...Ud,summary:Wd}).loose(),V({kind:U([`file`,`folder`]),path:I().min(1),duplicatedDocNames:B(I().min(1))}).loose(),V({pages:B(V({docName:I().min(1),title:I(),docExt:I().min(1),size:L().int().nonnegative(),modified:I().min(1),icon:I().min(1).max(2048).optional()}).loose())}).loose();const qve=V({level:L().int().min(1).max(6),text:I(),slug:I()}).loose();V({docName:I().min(1),headings:B(qve)}).loose();const Jve=V({docName:I().min(1),rewrites:L().int().nonnegative()}).loose();V({kind:U([`file`,`folder`,`asset`]),fromPath:I().min(1),toPath:I().min(1),...Ud,summary:Wd}).loose(),V({renamed:B(Gve),renamedAssets:B(Kve),rewrittenDocs:B(Jve).optional(),summary:Kd.optional()}).loose(),V({kind:U([`file`,`folder`,`asset`]),path:I().min(1),...Ud}).loose(),V({deletedDocNames:B(I().min(1))}).loose(),V({kind:U([`file`,`folder`,`asset`]),path:I().min(1),...Ud,summary:Wd}).loose(),V({deletedDocNames:B(I().min(1))}).loose(),V({docName:I().min(1),commitSha:I().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Wd,...Ud}).loose(),V({restoredFrom:I().min(1),timestamp:I().min(1),summary:Kd.optional(),warnings:Zd.optional()}).loose();const Yve=/^#[0-9a-fA-F]{6}$/,Xve=V(Object.fromEntries(el.map(e=>[e,I().regex(Yve,`must be a #rrggbb hex color`)]))),aJ=I().min(1).refine(al,{message:`must contain a non-whitespace character`}),oJ=V({name:aJ,author:aJ.optional(),variant:U([`dark`,`light`]),palette:Xve}).loose();V({name:I().min(1),scheme:oJ,stem:I().min(1).optional(),extension:U([`.yaml`,`.yml`]).optional()}).loose(),V({id:I().min(1),filename:I().min(1)}).loose(),V({id:I().min(1),scheme:oJ}).loose(),V({id:I().min(1),filename:I().min(1)}).loose(),ea(`existed`,[V({existed:W(!1)}).loose(),V({existed:W(!0),filename:I().min(1),scheme:oJ}).loose()]),V({themes:B(ea(`ok`,[V({ok:W(!0),id:I().min(1),filename:I().min(1),scheme:oJ}),V({ok:W(!1),filename:I().min(1),id:I().min(1).optional(),code:I().min(1),conflictingFilenames:B(I().min(1)).min(2).optional()})])),truncated:R()}).loose();function Zve(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==``&&e!==`.`)}function Qve(e){let t=Zve(e).at(-1);return t!==void 0&&Dd.some(e=>t.toLowerCase().endsWith(e))}V({tags:B(V({name:I().min(1),count:L().int().nonnegative(),isLeaf:R()}).loose())}).loose();const $ve=V({docName:I().min(1),title:I(),matchingTags:B(I().min(1)),snippet:I().nullable()}).loose();V({name:I().min(1),docs:B($ve)}).loose(),V({folder:z(),frontmatter_local:H(I(),z()).nullable(),warnings:B(I()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:B(U([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),V({path:I(),frontmatter:H(I(),z()).optional()}).loose(),V({applied:z()}).loose();const sJ=H(I(),z()).meta({description:`Free-form frontmatter map embedded in template payloads.`});V({template:V({name:I().min(1),folder:I(),scope:U([`local`,`inherited`]),path:I().min(1),frontmatter:sJ,body:I()}).strict()}).strict(),V({templates:B(V({name:I().min(1),title:I().optional(),description:I().optional(),path:I().min(1),source_folder:I()}).strict()),truncated:R()}).strict(),V({folder:I(),name:I(),body:Bd.optional(),frontmatter:sJ.optional(),...Ud,summary:Wd}).strict(),V({path:I().min(1),created:R(),warnings:B(I())}).strict(),V({sourcePath:I().min(1),targetFolder:I(),name:I().optional(),title:I().optional(),deleteSource:R().optional(),...Ud,summary:Wd}).strict(),V({path:I().min(1),created:R(),warnings:B(I())}).strict(),V({existed:R(),path:I().min(1)}).strict(),V({fromFolder:I(),fromName:I(),toFolder:I(),toName:I(),body:Bd.optional(),frontmatter:sJ.optional(),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),committed:R()}).strict();const cJ=U(Ed),eye=/^[a-z0-9-]+$/,lJ=V({name:I(),description:I(),metadata:V({pack:I()}).strict().optional()}).strict();V({skill:V({name:I().min(1),scope:cJ,path:I().min(1),frontmatter:lJ,body:I(),files:B(V({path:I().min(1),text:I().nullable()})).optional(),managed:R().optional()}).strict()}).strict();const tye=V({source:I().min(1),publisher:I().optional(),skill:I().optional(),marketplaceUrl:I().optional(),importedAt:I().min(1),autoUpdate:R().optional()}).strict(),nye=V({name:I().min(1),description:I().optional(),scope:cJ,path:I().min(1),canonicalPath:I().min(1).optional(),filePaths:B(I()).optional(),absolutePath:I().min(1).optional(),installed:R(),hosts:B(I()),hostQualifier:I().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:B(I()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:H(I(),I()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:B(I()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:B(I()).optional(),installableEditors:B(I()).optional(),hubOffered:R().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:R().optional(),customPlacements:B(V({path:I(),mode:U([`copy`,`link`])}).strict()).optional(),plugin:V({name:I().min(1),marketplace:I().min(1),provider:I().min(1),url:I().optional()}).strict().optional(),managed:R().optional(),origin:tye.optional(),pack:I().optional(),modified:R().optional(),revertable:R().optional(),ignored:R().optional(),size:fve.optional()}).strict();V({name:I().min(1),scope:cJ,apply:R().optional()}).strict(),V({line:I().min(1),gitignorePath:I().min(1),applied:R(),alreadyTracked:R().optional()}).strict(),V({skills:B(nye),truncated:R()}).strict(),V({scope:cJ.default(`project`),name:I().meta({description:`Managed skill name to create or update.`}),body:Bd.optional(),frontmatter:lJ,...Ud,summary:Wd}).strict();const uJ=[`skill-name-vendor-word`,`skill-body-too-long`],dJ=B(U(uJ)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});V({path:I().min(1),created:R(),warnings:B(I()),warningCodes:dJ}).strict(),V({scope:cJ.default(`project`),name:I(),dryRun:R().optional(),setAutoUpdate:R().optional(),...Ud,summary:Wd}).strict(),V({name:I().min(1),updated:R(),source:I().min(1),localBody:I().optional(),upstreamBody:I().optional(),gitTracked:R().optional(),warnings:B(I()),warningCodes:dJ}).strict(),V({scope:cJ.default(`project`),name:I(),...Ud,summary:Wd}).strict(),V({name:I().min(1),baselineRef:I().min(1),restoredFiles:B(I()),warnings:B(I())}).strict();const fJ=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;V({existed:R(),path:I().min(1),warnings:B(I()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${fJ}`})}).strict(),V({scope:cJ.default(`project`),fromName:I(),toName:I(),body:Bd.optional(),frontmatter:lJ.optional(),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),committed:R(),warnings:B(I()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${fJ}`})}).strict(),V({name:I(),toName:I().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:cJ,toScope:cJ,...Ud,summary:Wd}).strict(),V({scope:cJ,path:I().optional(),droppedLocations:B(I()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:B(I()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${fJ}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),V({scope:cJ,name:I(),toName:I(),...Ud,summary:Wd}).strict(),V({name:I().min(1)}).strict(),V({name:I(),home:I().min(1)}).strict(),V({docName:I().min(1)}).strict();const pJ=U([`reference`,`script`,`file`]);V({scope:cJ.default(`project`),name:I(),path:I().min(1),content:I(),...Ud,summary:Wd}).strict().superRefine((e,t)=>{Qve(e.path)&&zd(e.content,t,[`content`])}),V({path:I().min(1),created:R(),kind:pJ,content:R()}).strict(),V({scope:cJ.default(`project`),name:I(),from:I().min(1),to:I().min(1),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),fromDocName:I().optional(),toDocName:I().optional()}).strict(),V({path:I().min(1),kind:pJ,text:I()}).strict(),V({path:I().min(1),existed:R(),kind:pJ}).strict();const mJ=$i([dve,W(`agents`)]),hJ=I().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),gJ=$i([mJ,hJ]);V({scope:cJ.default(`project`),name:I(),targets:B(mJ).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:B(gJ).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:B(gJ).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:U([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:gJ.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:R().optional(),setSource:I().min(1).optional(),place:V({dir:I().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:U([`copy`,`link`])}).strict().optional(),convert:V({target:gJ.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:U([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:V({path:I().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...Ud,summary:Wd,fork:V({editor:I().min(1),action:U([`align`,`make-source`,`rename`]),toName:I().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const _J=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`,`links-not-permitted`];V({name:I().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:B(I()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:R().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:B(I()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:B(U(_J)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:I().optional(),sourceMovedTo:I().optional()}).strict(),V({scope:cJ.default(`project`),name:I().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),V({name:I().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:R().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),V({targets:B($q),configured:R(),folders:B(V({scope:cJ,host:I(),root:I(),state:U([`own`,`linked`,`linked-parent`,`absent`]),target:I().optional(),drift:W(!0).optional(),expected:I().optional()}).strict()).optional()}).strict();const vJ=V({action:W(`link`),scope:cJ,root:I().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:I().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),yJ=V({action:W(`unlink`),scope:cJ,root:I().min(1).meta({description:`The linked folder to materialize back.`}),exclude:B(I().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),bJ=V({action:W(`add-root`),scope:cJ,root:hJ.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),rye=ea(`action`,[vJ.extend({preview:R().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),yJ,bJ]);ea(`action`,[vJ.strict(),yJ,bJ]),V({folderAction:rye}).strict();const iye=V({moves:B(I()),drops:B(I()),removes:B(I()),replaces:B(I()),conflicts:B(I()),strays:B(I())}).strict();V({targets:B($q),reprojected:B(V({name:I(),hosts:B(I())}).strict()),bundleHosts:B(I()),removedFrom:B(I()),folder:V({moved:B(I()),dropped:B(I()),linked:B(I())}).strict().optional(),preview:iye.optional()}).strict(),V({scope:cJ.default(`project`),name:I(),version:I().regex(/^[0-9a-f]{40}$/i),...Ud,summary:Wd}).strict(),V({name:I().min(1),version:I(),restoredFiles:B(I()),warnings:B(I())}).strict(),V({query:I().optional(),intent:U([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:U([`navigation`,`relevance`]).optional(),scopes:B(U([`page`,`folder`,`content`,`file`])).optional(),scope:I().optional(),limit:L().int().nonnegative().optional(),semantic:R().optional(),source:U([`omnibar`,`mcp`,`http`]).optional()}).loose();const aye=V({kind:U([`page`,`folder`,`content`,`file`]),path:I().min(1),title:I(),score:L(),signals:H(I(),z()),snippet:I().optional()}).loose(),oye=U([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),xJ=U([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),SJ=V({capable:R(),applied:R(),outcome:oye,providerErrorReason:xJ.nullable().optional().catch(null),coverage:V({embedded:L().int().nonnegative(),total:L().int().nonnegative()})}).loose();V({enabled:R(),keyPresent:R(),keyNotRequired:R(),keySource:U([`project`,`file`,`env`]).nullable(),keyHint:I().nullable(),ready:R(),capable:R(),providerError:R().optional(),providerErrorReason:xJ.nullable().optional().catch(null),embedded:L().int().nonnegative(),total:L().int().nonnegative()}).loose(),V({query:I(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:B(aye),elapsedMs:L().nonnegative(),semantic:SJ.optional(),truncated:R().optional(),ready:R().optional()}).loose();const sye=V({version:I().min(1),recordedAt:I().min(1)}).loose();V({currentVersion:I().min(1),targets:H(I(),sye.nullable())}).loose(),V({scope:cJ.default(`project`),source:I().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:I().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:R().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:R().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...Ud,summary:Wd}).strict(),V({scope:cJ.default(`project`),source:I().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:B(I().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:R().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:R().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...Ud,summary:Wd}).strict(),V({results:B(V({requested:I(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:I().optional(),collisionRenamedFrom:I().optional(),warnings:B(I()),warningCodes:dJ,error:I().optional()}).loose()),imported:L(),alreadyImported:L(),failed:L()}).loose(),V({scope:cJ.default(`project`),names:B(I().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...Ud,summary:Wd}).strict(),V({results:B(V({requested:I(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:I().optional(),warnings:B(I()),warningCodes:dJ,error:I().optional()}).loose()),updated:L(),upToDate:L(),failed:L()}).loose();const cye=V({source:I(),ref:I().optional(),contentHash:I(),publisher:I().optional()}).loose();V({name:I().min(1).meta({description:`Managed skill name created or matched.`}),path:I().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:R().meta({description:`True when this request created new source files.`}),alreadyImported:R().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:I().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:cye,warnings:B(I()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:dJ}).loose();const lye=U([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);V({v:W(1),ch:W(`server-info`),seq:L(),serverInstanceId:I().min(1),currentBranch:I().min(1).optional()}).loose(),V({v:W(1),ch:W(`branch-switched`),seq:L(),branch:I().min(1)}).loose(),V({v:W(1),ch:lye,seq:L()}).loose(),V({v:W(1),ch:W(`disk-ack`),seq:L(),docName:I().min(1),sv:I().min(1)}).loose(),V({v:W(1),ch:W(`config-validation-rejected`),seq:L(),docName:I().min(1),error:Qie}).loose(),V({v:W(1),ch:W(`config-ignore-nested-error`),seq:L(),path:I().min(1),error:I().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const uye=Zi({name:I(),description:I(),files:Zi({skillMd:I(),scripts:B(I()),references:B(I())})}),dye=Zi({pluginProvider:I().optional(),plugin:I().optional(),marketplace:I().optional(),repositoryUrl:I().optional(),version:I().optional(),gitCommitSha:I().optional(),scope:I().optional(),projectPath:I().optional()}),fye=Zi({commands:R(),hooks:R(),mcp:R()}),pye=Zi({...uye.shape,sourceHarness:I(),sourceHarnesses:B(I()),home:I(),provenance:dye,inert:fye,outsideProject:R().optional()}),mye=Zi({schema:W(1),name:I(),version:I(),description:I().optional(),author:Zi({name:I()}).optional(),skills:B(I()),hostCompatibility:B(I()).optional(),capabilities:Zi({scripts:I(),network:I(),inert:B(I())}).optional(),provenance:Zi({source:I(),ref:I(),contentHash:I()}).optional()});V({skills:B(pye),packs:B(mye)}).loose(),V({results:B(V({id:I().min(1),name:I().min(1),source:I().min(1),description:I(),installs:L().int().nonnegative().nullable(),publisher:I().nullable()}).loose()),backend:U([`skills.sh`,`github-fallback`]),degraded:R()}).loose(),V({title:I(),description:I(),image:I().nullable(),skillsUrl:I().nullable(),sourceKind:U([`github`,`site`]),sourceUrl:I()}).loose(),V({skills:B(V({name:I(),description:I().nullable()}).loose())}).loose(),V({kind:U([`local`,`import`,`none`]),scope:U(Ed).optional(),name:I().optional(),dir:I().optional(),source:I().optional(),ref:I().optional(),via:U([`source`,`publisher`]).optional()}).loose();const hye=V({relPath:I(),content:I().nullable()}).loose(),gye=V({provider:I(),plugin:I(),version:I().optional(),marketplace:I().optional(),repositoryUrl:I().optional()}).loose(),_ye=V({provider:I(),plugin:I(),version:I().optional(),description:I().optional(),repositoryUrl:I().optional(),bundledSkills:B(I()),capabilities:V({commands:R(),hooks:R(),mcp:R(),agents:R()}),setupSupported:R()}).loose();V({name:I(),description:I().nullable(),skillMd:I(),files:B(hye),plugin:gye.optional(),pluginBundle:_ye.optional()}).loose();const vye=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`,`unsafe-incoming-symlinks`],CJ=e=>e*8+4;CJ(92),CJ(40),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null})(),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const wJ={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},TJ=`state/bug-reports`,yye=Zi({at:I(),transport:I(),outcome:I(),reference:I().optional(),error:I().optional(),errorCode:I().optional()}),bye=Zi({reason:I(),at:I(),errorCode:I().optional()});Zi({version:L().int().catch(1),id:I(),createdAt:I(),bundleLevel:I(),zipBytes:L().int().nonnegative().catch(0),zipDeleted:R().optional(),state:I(),systemWide:R().optional(),projectSlug:I().nullable().optional(),reference:I().optional(),lastError:bye.optional(),attempts:B(yye).optional(),note:I().optional()}),Zi({version:L().int().catch(1),id:I().optional(),sentAt:I().optional(),reference:I().optional()});const xye=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function Sye(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Cye(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(Sye).join(`_`)}`}function wye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tye(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=Wl(Ul,t);if(e!==void 0){if(e.scope===`project-local`){let e=Cye(t),o;i!=null&&r!=null&&n!=null&&(o=Zu({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...xye.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(wye(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const EJ=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${EJ}\\.${EJ}\\.${EJ}$`);function DJ(e,t){return e===`unix-chain`?`# ok-mcp${t}-v`:`# ok-mcp${t}-win-v`}function OJ(e){return e.replace(/\/+/g,`/`).replace(/\/+$/,``)}function Eye(e){return rt[e].userHomeDirName}function Dye(e,t){return e===`stable`?`${OJ(t)}/Library/Application Support/OpenKnowledge/path-install.json`:`${OJ(t)}/${Eye(e)}/path-install.json`}const Oye=[`.ok`,cd,`installed-skills.json`],kye=U(Ed),Aye=Zi({hosts:B(I()),scope:kye,scripts:R(),installedAt:ki(),projection:U([`symlink`,`copy`]).optional(),contentHash:I().optional()}),jye=Zi({schema:W(1),skills:H(I(),Aye).default({})});function Mye(e){let t;try{t=JSON.parse(e)}catch{return null}let n=jye.safeParse(t);return n.success?n.data:null}function kJ(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function Nye(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>kJ(e))]}const AJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of AJ){let t=QB.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}gH(),PV(),FV();function Pye(){return QB.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function Fye(){return Pye().filter(e=>{let t=Iye(e);return t!==`fence`&&t!==`html`})}function Iye(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}const jJ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),MJ=globalThis;MJ[jJ]===void 0&&(MJ[jJ]=sr());const NJ=MJ[jJ],PJ=Zi({version:I().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(NJ,{description:`Recorded skill version for this target.`}),recordedAt:ki().register(NJ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:U([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(NJ,{description:`Install-source surface that recorded this entry.`}).optional()}),Lye=Zi({enabled:R().register(NJ,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:ki().register(NJ,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});Zi({schema:W(1).register(NJ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zi({"claude-cowork":PJ.optional(),"cli-hosts":PJ.optional()}).register(NJ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(I(),Lye).register(NJ,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:B(I()).register(NJ,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const Rye=/<script(?![^>]*\ssrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi;function zye(e){return[[`script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'`,...[...e.matchAll(Rye)].map(e=>`'sha256-${Te(`sha256`).update(e[1]??``).digest(`base64`)}'`)].join(` `),`worker-src 'self' blob:`,`object-src 'none'`,`base-uri 'self'`].join(`; `)}zye(``);function Bye(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Zu({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function FJ(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return D(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function IJ(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function Vye(e){let t=[],n=[[`maxBatchSize`,1,Ll],[`maxBatchChars`,1,Rl],[`docTimeoutMs`,1,zl]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=IJ(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function Hye(e){let t=IJ(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=gie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function Uye(e){let t=IJ(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=_ie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function LJ(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Ul.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,xs.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?FJ(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=nd({value:c,file:t,source:o,doc:s}),u=l.length>0?id(c):c,d=[...Hye({rawConfig:u,doc:s,source:o,absPath:t}),...Uye({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=Ul.safeParse(u);if(!f.success){let e=Bye(f,s,o,t),c=Ul.shape.git.safeParse(IJ(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?FJ(t,r,i):void 0,h=[...l,...d,...Cd(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...Vye({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}function RJ(e=_e()){return j(e,ft().userHomeDirName)}const zJ=`.tmp.`,BJ=[8,4,4,4,12];function Wye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Gye=BJ.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),Kye=BJ.map(e=>`[0-9a-f]{${e}}`).join(`-`),qye=`*${zJ}${Gye}`;RegExp(`${Wye(zJ)}${Kye}$`);function Jye(e){return`${e}${zJ}${Ee()}`}function Yye(e){try{let t=k(e),n=`${ae(e)}${zJ}`,r=Date.now()-3e4;for(let e of w(t)){if(!e.startsWith(n))continue;let i=j(t,e);try{te(i).mtimeMs<r&&ne(i)}catch{}}}catch{}}function VJ(e,t,n={}){Yye(e);let r=Jye(e);try{re(r,t,{encoding:`utf-8`,mode:n.mode??420}),D(r,e)}catch(e){try{ne(r)}catch{}throw e}}var HJ=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function Xye(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new HJ(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new HJ(e,r);await Gie(i);continue}try{return await t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}function Zye(e){let t=Date.now()+e;for(;Date.now()<t;);}function UJ(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new HJ(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new HJ(e,r);Zye(i);continue}try{return t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}const WJ=`config.yml`;function GJ(e,t,n){if(e===`user`)return N(RJ(n??_e()),`global.yml`);let r=A(t)?t:N(t);return e===`project-local`?N(r,`.ok`,cd,WJ):N(r,`.ok`,WJ)}const Qye=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function KJ(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:jP(t.replaceAll(`_`,`-`))}function $ye(e){for(let t of Qye){let n=e[t]?.trim();if(n!==void 0&&n!==``)return KJ(n)}return null}function ebe(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return jP(t)??void 0}function tbe(e=process.env){let t=ebe(e),n=$ye(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=KJ(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function qJ(){return pd(ud)}function JJ(){return ft().keyringService}function YJ(e){try{e()}catch{}}var nbe=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(JJ(),e).getPassword()}catch(t){return YJ(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return YJ(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return YJ(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(JJ(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(JJ(),e).deletePassword()}catch{}}},XJ=class{backend=`file`;authFile;constructor(e){this.authFile=e??j(RJ(),`auth.yml`)}read(){if(!g(this.authFile))return{};try{let e=S(this.authFile,`utf-8`);return(0,xs.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=k(this.authFile);g(t)||v(t,{recursive:!0,mode:448}),VJ(this.authFile,(0,xs.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},rbe=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${qJ()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function ZJ(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(JJ(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
430
- `),YJ(()=>t?.onBackendSelected?.({backend:`keyring`})),new rbe(new nbe(t?.onKeychainRead),new XJ(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (${qJ()}) — OS keychain unavailable: ${r}\n`),YJ(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new XJ(e)}}function ibe(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (${qJ()})\n`),r(new XJ(e))},n)});try{return await Promise.race([ZJ(e),r])}catch{return new XJ(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function abe(e){let t=ibe(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}
429
+ `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function O_e(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&D_e(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=E_e(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function Dq(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);Oq(i.charCodeAt(i.length-1),s,r)&&(o=kq(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return Oq(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+kq(c)),o}function Oq(e,t,n){return!(Vf(t)!==1||n===`_`&&Vf(e)===void 0)}function kq(e){return`&#x${e.toString(16).toUpperCase()};`}function k_e(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!j_e(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function A_e(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=Dq(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function j_e(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const Aq=[{mode:`protecting`,protect:LH,reservations:FH},{mode:`protecting`,protect:FU,reservations:HH},{mode:`protecting`,protect:jH,reservations:DH},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(Aq.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function M_e(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function jq(e){return Aq.reduce(M_e,e)}function Mq(e){return e.data?.sourceRaw}function N_e(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&Mq(e)===``}function Nq(e){return e.type===`paragraph`&&(e.children??[]).every(N_e)}function Pq(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function P_e(e){switch(e.type){case`table`:return Pq(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return Mq(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return Mq(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function F_e(e){let t=[];for(let n of e.children){if(n.type===`table`&&Pq(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}P_e(n)||(n.type===`paragraph`&&n.children.length>0&&Nq(n)&&(n.children=[]),t.push(n))}e.children=t}function I_e(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const L_e=(e,t)=>{if(Nq(e)||I_e(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},Fq=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function R_e(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;Wf(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=mP(e);Fq.lastIndex=0;let o=[],s;for(;(s=Fq.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(vP(a,e,1)||vP(a,t-1,1)){Fq.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(_P(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=xP(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(_P(n,e,l,i.length)),r.children.splice(t,1,...c),[yf,t+c.length]})}}const z_e=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function B_e(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function V_e(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function Iq(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const Lq=/[ \t]+$/,Rq=/^[ \t]*$/;function H_e(e){return e.some(e=>!(Iq(e)&&Rq.test(e.value)))}function zq(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(B_e(n)){V_e(n);break}if(n&&z_e.has(n.type)&&`children`in n){let t=n.children;if(zq(t,!0),t.length===0){e.pop();continue}}if(!t&&Iq(n)&&Lq.test(n.value)){let t=n.value.replace(Lq,``);if(t.length>0){n.value=t;continue}if(H_e(e.slice(0,-1))){e.pop();continue}if(e.every(e=>Iq(e)&&Rq.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const U_e=new Set([`paragraph`,`heading`,`tableCell`]);function W_e(e){let t=e=>{if(U_e.has(e.type)&&`children`in e&&zq(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const Bq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[A-Za-z]|[^\\x00-\\x7F]`}]};function G_e(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===Bq)||e.toMarkdownExtensions.push(Bq)}const K_e=new Set([`u`,`ins`]);function q_e(){return e=>{Wf(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!K_e.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}function J_e(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const Y_e=[{name:`remark-parse`,plugin:w_},{name:`escape-provenance`,plugin:AK},{name:`remark-mdx-agnostic`,plugin:UU},{name:`remark-gfm`,plugin:Uh},{name:`remark-math`,plugin:qW,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:fW},{name:`remark-github-alerts`,plugin:UW,options:xG},{name:`callout-transformer`,plugin:bG},{name:`restore-from-mdx`,plugin:LU},{name:`void-br-promoter`,plugin:qU},{name:`restore-entity-refs`,plugin:PH},{name:`restore-backslash-escapes`,plugin:RH},{name:`details-accordion-promoter`,plugin:aK},{name:`div-align-promoter`,plugin:mK},{name:`image-promoter`,plugin:RK},{name:`indented-code-promoter`,plugin:WK},{name:`math-promoter`,plugin:eq},{name:`single-dollar-math-promoter`,plugin:R_e},{name:`highlight-promoter`,plugin:LK},{name:`underline-promoter`,plugin:q_e},{name:`mermaid-promoter`,plugin:n_e},{name:`comment-promoter`,plugin:wG},{name:`merged-post-parse-walker`,plugin:e_e},{name:`empty-task-item-unmint`,plugin:xK},{name:`link-reference-destination`,plugin:QK},{name:`non-rendering-context-demote`,plugin:d_e},{name:`ensure-non-empty-doc`,plugin:()=>J_e}];function X_e(e){let t=ug();for(let e of Y_e)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(FW,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function Z_e(e){let t=ug().use(zg,[`yaml`]).use(Uh,{tablePipeAlign:!1}).use(qW,{singleDollarTextMath:!1}).use(UU).use(fW).use(G_e).use(aB,{bullet:`-`,fences:!0,rule:`-`,join:[L_e],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function Vq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const Hq=/^\n+$/,Uq=/^\n{2,}$/;function Wq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Hq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);Uq.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Q_e(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Hq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&Uq.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function $_e(e,t){let{source:n,hadBom:r}=Vq(e),i=JG(n),a=new ng(jq(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);JK(s,i);let c=Wq(s,i,r),l=c?ws(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function eve(e,t){return Gq(e,t,!1)}function tve(e,t){return Gq(e,t,!0)}function Gq(e,t,n){let{source:r,hadBom:i}=Vq(e),a=JG(r),o=new ng(jq(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&JK(c,a);let l=Wq(c,a,i);return n&&l&&ws(c,l),c}function nve(e,t,n){let r=LW(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});Kq(r),yK(r),W_e(r),F_e(r);let i=Q_e(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function Kq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)Kq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=lP(i)?i.escapedChars:null,s=lP(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}var rve=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=yO(e.extensions),this.handlers=cve(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Qs({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=lve(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=X_e({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Z_e({toMarkdownHandlers:__e})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return $_e(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?eve(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?tve(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?XW(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return nve(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const qq=eV();function Jq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function ive(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function ave(e,t){return e.attrs.sourceDirty||ive(e)?!0:t?t.isDiverged(e.toJSON()):!1}function ove(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function Yq(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function Xq(e,t){if(e.length===0)return Yq({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return Yq({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[Xq(n.children,t)]}}return Yq({type:`inlineCode`,value:Zq(e)},t)}function Zq(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=Zq(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const sve=Oc;function cve(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=MW(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=MW(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=yW(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r,sourceUrlForm:e.data?.sourceUrlForm??null})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&oc(t.raw)!==null&&rc(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=oc(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=NW(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NW(r.highlight)),r.underline&&(i.underline=NW(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=NW(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MW(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NW(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NW(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MW(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=MW(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=MW(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker,s=!!o.spec.attrs?.sourceUrlForm;i.definition=i=>{let c={title:i.title??null};return n&&(c.identifier=i.identifier??``),c.label=i.label??i.identifier??``,e?c.url=i.url??``:t&&(c.href=i.url??``),r&&(c.sourceLayout=i.data?.sourceLayout??null),a&&(c.sourceTitleMarker=i.data?.sourceTitleMarker??null),s&&(c.sourceUrlForm=i.data?.sourceUrlForm??null),o.createAndFill(c)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=qq.getOrWildcard(o),c=Jq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=yW(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?qq.get(i):void 0;if(o&&n.jsxInline){let e=Jq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=sk(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&sve.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&kc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&jc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Mc.has(f)&&n.jsxComponent&&qq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:bW(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=MW(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function lve(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RW(`paragraph`)),i.blockquote&&(n.blockquote=RW(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=RW(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=RW(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&ove(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=RW(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:HP(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>{let t={type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title};return e.attrs.sourceUrlForm===`angle-bracketed`&&(t.data={sourceUrlForm:`angle-bracketed`}),t}),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!ave(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:qq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:qq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return CB(t,e,qq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=zW(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zW(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return Xq(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=zW(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zW(`mark`)),a.underline&&(r.underline=zW(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=zW(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RW(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=RW(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return tk(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const uve=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(QB.flatMap(e=>e.surface===`compat`&&uve.has(e.rendersAs)?[[e.name,e]]:[])),Np(`<>`);var Qq={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100};Qq.SINGLE_TILDE,Qq.COMPARISON_OPERATORS,Qq.HTML_TAGS,Qq.SETEXT_HEADINGS,Qq.LINKS,Qq.BOLD_ITALIC,Qq.BOLD,Qq.ITALIC_DOUBLE_UNDERSCORE,Qq.ITALIC_SINGLE_ASTERISK,Qq.ITALIC_SINGLE_UNDERSCORE,Qq.INLINE_CODE,Qq.STRIKETHROUGH,Qq.KATEX,Qq.INLINE_KATEX,ug().use(w_).use(Uh);const $q=U(bt),dve=U(iee),fve=V({alwaysOn:L().int().nonnegative(),onTrigger:L().int().nonnegative(),onDemand:L().int().nonnegative()}).strict();V({intents:B(V({satisfierId:I().min(1),desired:U([`present`,`absent`])}).loose()),...Ud,summary:Wd}).loose();const pve=V({satisfierId:I(),agentId:I(),piece:I(),scope:I(),kind:I(),pathId:I().optional(),desired:U([`present`,`absent`]),action:U(va),errorId:I().optional()}).loose(),mve=V({kind:I(),satisfierIds:B(I()),agentIds:B(I()),pathId:I().optional(),blockedReason:I().optional()}).loose(),hve=V({state:I(),strictness:B(U(ga)).optional()}).loose(),gve=V({probes:V({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(I(),hve)}).loose(),detection:V({detected:B(I()),probed:R()}).loose()}).loose();V({actions:B(pve),conflicts:B(mve),withheld:B(I()),snapshot:gve}).loose(),V({entries:B(V({level:U([`info`,`warn`,`error`]),message:I().max(8192),event:I().optional(),fields:H(I(),z()).optional(),ts:L().optional(),sourceId:I().optional(),lineNumber:L().optional()}).loose()).max(100),droppedSinceLastFlush:L().int().min(0).optional()}).loose(),V({accepted:L().int().min(0)}).loose();const _ve=V({exact:I().min(1),prefix:I(),suffix:I(),start:L().int().nonnegative(),end:L().int().nonnegative()}),vve=B($i([I(),L().int().nonnegative()])),yve=ea(`kind`,[V({kind:W(`body`)}),V({kind:W(`property`),key:I().min(1),path:vve.default([])})]).default({kind:`body`}),bve=U([`anchored`,`orphaned`,`resolved`]),eJ=V({threadId:I().min(1),docName:I().min(1),target:yve,anchor:_ve.nullable(),state:bve,queued:R(),latestComment:I(),createdBy:I().min(1),createdAt:L(),updatedAt:L().optional()}),tJ=V({docName:I(),instruction:I(),property:I().nullable(),passage:V({exact:I(),prefix:I(),suffix:I()}).nullable(),anchorLost:R(),passageRepeats:R()}).loose(),nJ=V({threadId:I(),ok:W(!0)}),rJ=V({threadId:I(),ok:W(!1),error:W(`not-found`)});V({threads:B(eJ)}).loose(),V({meta:eJ,orphaned:R()}).loose(),V({threadId:I()}).loose(),V({meta:eJ,payload:tJ}).loose(),V({results:B($i([nJ.extend({meta:eJ,payload:tJ}),rJ]))}).loose(),V({results:B($i([nJ.extend({meta:eJ}),rJ]))}).loose();const xve=V({status:I().min(1),reason:I()}).loose();V({docName:I().min(1),content:I(),lifecycle:xve.nullable()}).loose(),V({documents:B(V({kind:U([`document`,`asset`,`folder`,`file`]).default(`document`),docName:I().min(1).optional(),docExt:I().min(1).default(`.md`),size:L().int().nonnegative(),modified:I().min(1),isSymlink:R().default(!1),canonicalDocName:I().nullable().default(null),targetPath:I().nullable().default(null),path:I().min(1).optional(),assetExt:I().min(1).optional(),mediaKind:U([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:B(I().min(1)).optional(),hasChildren:R().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:R().optional()}).loose();const Sve=V({source:I().min(1),anchor:I().nullable(),title:I(),snippet:I().nullable()}).loose();V({docName:I().min(1),backlinks:B(Sve)}).loose(),V({counts:H(I().min(1),L().int().nonnegative())}).loose(),V({counts:H(I().min(1),L().int().nonnegative())}).loose();const Cve=ea(`kind`,[V({kind:W(`doc`),docName:I().min(1),anchor:I().nullable(),title:I(),snippet:I().nullable()}).loose(),V({kind:W(`external`),url:I().min(1),title:I(),snippet:I().nullable()}).loose()]),wve=V({role:I().min(1),sourceForm:I().min(1),targetKind:I().min(1),href:I(),resolvedTarget:I().nullable(),status:I().min(1),reason:I().nullable(),resolutionMethod:I().min(1),fallbackTarget:I().nullable().default(null),range:V({start:L().int().nonnegative(),end:L().int().nonnegative()}),line:L().int().nonnegative(),column:L().int().nonnegative(),definition:V({label:I(),line:L().int().nonnegative()}).nullable().default(null)}).loose();V({docName:I().min(1),forwardLinks:B(Cve),localTargets:B(wve).optional()}).loose();const Tve=ea(`kind`,[V({id:I().min(1),kind:W(`doc`),docName:I().min(1),anchor:I().nullable(),label:I(),cluster:I().nullable(),category:I().nullable(),tags:B(I()).nullable(),managed:R().optional()}).loose(),V({id:I().min(1),kind:W(`external`),url:I().min(1),label:I()}).loose()]),Eve=V({source:I().min(1),target:I().min(1)}).loose();V({nodes:B(Tve),links:B(Eve)}).loose();const Dve=V({ts:L().int().min(0),url:I(),method:I(),ua:I().optional(),origin:I().optional(),referer:I().optional(),host:I().optional(),remote:I().optional(),secChUa:I().optional(),secChUaMobile:I().optional(),secChUaPlatform:I().optional(),secFetchSite:I().optional(),secFetchDest:I().optional(),secFetchMode:I().optional(),secFetchUser:I().optional()}).loose(),Ove=V({app:$i([W(`cursor`),W(`codex`),W(`claude`),qi()]),signals_fired:B(I())}).loose();V({entries:B(Dve),count:L().int().min(0),detection:Ove}).loose();const iJ=V({path:I().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:I().min(1).optional(),syncScoped:R(),open:ea(`kind`,[V({kind:W(`doc`),docName:I().min(1)}),V({kind:W(`asset`),path:I().min(1)})]).optional()}).loose();V({branch:I().nullable(),detached:R(),upstream:I().nullable(),staged:B(iJ),notStaged:B(iJ),untracked:B(iJ),incoming:B(iJ),truncated:R(),readable:R().default(!0)}).loose();const kve=U([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),Ave=U([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),jve=U([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),Mve=U([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),Nve=V({mergeQueue:V({position:L().int().nonnegative(),state:kve.nullable().catch(null)}).nullable().catch(null),autoMerge:R(),mergeState:Ave.nullable().catch(null),reviewDecision:jve.nullable().catch(null),checks:Mve.nullable().catch(null)}).loose(),Pve=V({kind:U([`pull`,`issue`]),repo:I().min(1),number:L().int().positive(),title:I(),author:I().nullable(),createdAt:I(),lifecycle:U([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:L().int().nonnegative().optional(),deletions:L().int().nonnegative().optional(),status:Nve.optional()}).loose();V({url:I()}).loose(),ea(`ok`,[V({ok:W(!0),preview:Pve}).loose(),V({ok:W(!1),reason:I()}).loose()]),V({writers:B(V({id:I().min(1),name:I().optional(),email:I().optional()}).loose()).optional(),summary:Wd,...Ud}).loose(),V({checkpointRef:I().min(1)}).loose();const Fve=V({v:L().int().optional(),id:I().min(1),name:I().min(1),colorSeed:I().optional(),docs:B(I()),summaries:B(I()).optional()}).loose();V({entries:B(V({sha:I().min(1),timestamp:I().min(1),author:I(),authorEmail:I(),type:U([`checkpoint`,`wip`,`upstream`,`park`]),message:I(),contributors:B(Fve),checkpoint:z().nullable(),parentSha:I().nullable().optional()}).loose()),total:L().int().nonnegative().optional(),truncated:R().optional(),hasMore:R().optional()}).loose(),V({sha:I().regex(/^[0-9a-f]{40}$/i),content:I(),timestamp:I(),author:I()}).loose(),V({contentDir:I().min(1),pathSeparator:U([`/`,`\\`]),symlinkResolved:R()}).loose(),B(ea(`source`,[V({docName:I().min(1),timestamp:I().min(1),size:L().int().nonnegative(),source:W(`flat`)}).loose(),V({docName:I().min(1),timestamp:I().min(1),source:W(`timeline`),sha:I().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const Ive=V({domain:I().min(1),title:I().optional(),description:I().optional(),siteName:I().optional(),faviconDataUri:I().optional()}).loose();V({url:I()}).loose(),ea(`ok`,[V({ok:W(!0),metadata:Ive}).loose(),V({ok:W(!1),reason:I()}).loose()]),V({orphans:B(V({docName:I().min(1),title:I()}).loose())}).loose(),V({hubs:B(V({docName:I().min(1),title:I(),count:L().int().nonnegative()}).loose())}).loose();const Lve=V({source:I().min(1),title:I(),snippet:I().nullable()}).loose();V({deadLinks:B(V({target:I().min(1),sources:B(Lve)}).loose())}).loose(),V({target:V({docName:I().min(1),title:I(),aliases:B(I())}).loose(),mentions:B(V({source:I().min(1),excerpt:I(),offset:L().int().nonnegative()}).loose()),truncated:R()}).loose(),V({projectPath:I().min(1)}).loose();const Rve=U([`not-a-git-worktree`,`init-failed`]);ea(`ok`,[V({ok:W(!0),projectPath:I().min(1)}).loose(),V({ok:W(!1),reason:Rve,message:I().min(1)}).loose()]),V({host:I().min(1).optional()}).loose(),V({host:I().min(1).optional(),token:I().min(1)}).loose(),V({host:I(),login:I()}).loose(),V({host:I().refine(hc,{message:`Host must be a hostname with an optional :port, with no scheme or path`}),username:I().min(1),token:I().min(1)}).loose(),V({host:I(),login:I()}).loose(),V({key:I().min(1)}).loose(),V({keyPresent:R()}).loose();const zve=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ea(`ok`,[V({ok:W(!0),endpoint:I().min(1),model:I().min(1),dimensions:L().int().positive()}).loose(),V({ok:W(!1),endpoint:I().min(1),model:I().min(1),reason:zve,status:L().int().optional()}).loose()]),V({name:I().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:I().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),V({authenticated:R()}).loose(),V({channel:U([`login`,`gh-login`]).default(`login`)}).loose(),V({}).loose();const Bve=V({stackIndex:L().int().min(0),ts:L().int().min(0),additions:L().int().min(0),deletions:L().int().min(0)}).loose(),Vve=V({docName:I().min(1),additionsTotal:L().int().min(0),deletionsTotal:L().int().min(0),lastTs:L().int().min(0),bursts:B(Bve)}).loose(),Hve=V({displayName:I().min(1),color:I().min(1),icon:I().optional(),connectionId:I().min(1)}).loose();V({sessionAlive:R(),agent:Hve.nullable(),files:B(Vve)}).loose(),V({diff:I(),before:I(),after:I(),properties:kP,generatedAt:L().int().min(0)}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose(),V({}).loose();const Uve=V({displayName:I().min(1),icon:I(),color:I().min(1),currentDoc:I().nullable(),mode:U([`idle`,`writing`]),ts:L().int().min(0)}).loose();V({presence:H(I().min(1),Uve)}).loose();const Wve=V({sessionId:I().min(1),agentType:I().min(1),ts:L().int().min(0),insertedChars:L().int().min(0),deletedChars:L().int().min(0)}).loose();V({effects:B(V({"doc.name":I().min(1),entries:B(Wve)}).loose())}).loose(),V({decisions:B(V({ts:L().int().min(0),decision:I().min(1),kind:I().min(1),"doc.name":I().min(1),pathRole:I().min(1)}).loose())}).loose(),H(I().min(1),R()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),V({path:I().min(1,`path must be non-empty`)}).loose(),V({}).loose();const Gve=V({fromDocName:I().min(1),toDocName:I().min(1)}).loose(),Kve=V({fromPath:I().min(1),toPath:I().min(1)}).loose();V({}).loose(),V({path:I().min(1),...Ud,summary:Wd}).loose(),V({docName:I().min(1)}).loose(),V({path:I().min(1),...Ud,summary:Wd}).loose(),V({path:I().min(1)}).loose(),V({kind:U([`file`,`folder`]),path:I().min(1),...Ud,summary:Wd}).loose(),V({kind:U([`file`,`folder`]),path:I().min(1),duplicatedDocNames:B(I().min(1))}).loose(),V({pages:B(V({docName:I().min(1),title:I(),docExt:I().min(1),size:L().int().nonnegative(),modified:I().min(1),icon:I().min(1).max(2048).optional()}).loose())}).loose();const qve=V({level:L().int().min(1).max(6),text:I(),slug:I()}).loose();V({docName:I().min(1),headings:B(qve)}).loose();const Jve=V({docName:I().min(1),rewrites:L().int().nonnegative()}).loose();V({kind:U([`file`,`folder`,`asset`]),fromPath:I().min(1),toPath:I().min(1),...Ud,summary:Wd}).loose(),V({renamed:B(Gve),renamedAssets:B(Kve),rewrittenDocs:B(Jve).optional(),summary:Kd.optional()}).loose(),V({kind:U([`file`,`folder`,`asset`]),path:I().min(1),...Ud}).loose(),V({deletedDocNames:B(I().min(1))}).loose(),V({kind:U([`file`,`folder`,`asset`]),path:I().min(1),...Ud,summary:Wd}).loose(),V({deletedDocNames:B(I().min(1))}).loose(),V({docName:I().min(1),commitSha:I().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Wd,...Ud}).loose(),V({restoredFrom:I().min(1),timestamp:I().min(1),summary:Kd.optional(),warnings:Zd.optional()}).loose();const Yve=/^#[0-9a-fA-F]{6}$/,Xve=V(Object.fromEntries(el.map(e=>[e,I().regex(Yve,`must be a #rrggbb hex color`)]))),aJ=I().min(1).refine(al,{message:`must contain a non-whitespace character`}),oJ=V({name:aJ,author:aJ.optional(),variant:U([`dark`,`light`]),palette:Xve}).loose();V({name:I().min(1),scheme:oJ,stem:I().min(1).optional(),extension:U([`.yaml`,`.yml`]).optional()}).loose(),V({id:I().min(1),filename:I().min(1)}).loose(),V({id:I().min(1),scheme:oJ}).loose(),V({id:I().min(1),filename:I().min(1)}).loose(),ea(`existed`,[V({existed:W(!1)}).loose(),V({existed:W(!0),filename:I().min(1),scheme:oJ}).loose()]),V({themes:B(ea(`ok`,[V({ok:W(!0),id:I().min(1),filename:I().min(1),scheme:oJ}),V({ok:W(!1),filename:I().min(1),id:I().min(1).optional(),code:I().min(1),conflictingFilenames:B(I().min(1)).min(2).optional()})])),truncated:R()}).loose();function Zve(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==``&&e!==`.`)}function Qve(e){let t=Zve(e).at(-1);return t!==void 0&&Dd.some(e=>t.toLowerCase().endsWith(e))}V({tags:B(V({name:I().min(1),count:L().int().nonnegative(),isLeaf:R()}).loose())}).loose();const $ve=V({docName:I().min(1),title:I(),matchingTags:B(I().min(1)),snippet:I().nullable()}).loose();V({name:I().min(1),docs:B($ve)}).loose(),V({folder:z(),frontmatter_local:H(I(),z()).nullable(),warnings:B(I()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:B(U([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),V({path:I(),frontmatter:H(I(),z()).optional()}).loose(),V({applied:z()}).loose();const sJ=H(I(),z()).meta({description:`Free-form frontmatter map embedded in template payloads.`});V({template:V({name:I().min(1),folder:I(),scope:U([`local`,`inherited`]),path:I().min(1),frontmatter:sJ,body:I()}).strict()}).strict(),V({templates:B(V({name:I().min(1),title:I().optional(),description:I().optional(),path:I().min(1),source_folder:I()}).strict()),truncated:R()}).strict(),V({folder:I(),name:I(),body:Bd.optional(),frontmatter:sJ.optional(),...Ud,summary:Wd}).strict(),V({path:I().min(1),created:R(),warnings:B(I())}).strict(),V({sourcePath:I().min(1),targetFolder:I(),name:I().optional(),title:I().optional(),deleteSource:R().optional(),...Ud,summary:Wd}).strict(),V({path:I().min(1),created:R(),warnings:B(I())}).strict(),V({existed:R(),path:I().min(1)}).strict(),V({fromFolder:I(),fromName:I(),toFolder:I(),toName:I(),body:Bd.optional(),frontmatter:sJ.optional(),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),committed:R()}).strict();const cJ=U(Ed),eye=/^[a-z0-9-]+$/,lJ=V({name:I(),description:I(),metadata:V({pack:I()}).strict().optional()}).strict();V({skill:V({name:I().min(1),scope:cJ,path:I().min(1),frontmatter:lJ,body:I(),files:B(V({path:I().min(1),text:I().nullable()})).optional(),managed:R().optional()}).strict()}).strict();const tye=V({source:I().min(1),publisher:I().optional(),skill:I().optional(),marketplaceUrl:I().optional(),importedAt:I().min(1),autoUpdate:R().optional()}).strict(),nye=V({name:I().min(1),description:I().optional(),scope:cJ,path:I().min(1),canonicalPath:I().min(1).optional(),filePaths:B(I()).optional(),absolutePath:I().min(1).optional(),installed:R(),hosts:B(I()),hostQualifier:I().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:B(I()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:H(I(),I()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:B(I()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:B(I()).optional(),installableEditors:B(I()).optional(),hubOffered:R().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:R().optional(),customPlacements:B(V({path:I(),mode:U([`copy`,`link`])}).strict()).optional(),plugin:V({name:I().min(1),marketplace:I().min(1),provider:I().min(1),url:I().optional()}).strict().optional(),managed:R().optional(),origin:tye.optional(),pack:I().optional(),modified:R().optional(),revertable:R().optional(),ignored:R().optional(),size:fve.optional()}).strict();V({name:I().min(1),scope:cJ,apply:R().optional()}).strict(),V({line:I().min(1),gitignorePath:I().min(1),applied:R(),alreadyTracked:R().optional()}).strict(),V({skills:B(nye),truncated:R()}).strict(),V({scope:cJ.default(`project`),name:I().meta({description:`Managed skill name to create or update.`}),body:Bd.optional(),frontmatter:lJ,...Ud,summary:Wd}).strict();const uJ=[`skill-name-vendor-word`,`skill-body-too-long`],dJ=B(U(uJ)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});V({path:I().min(1),created:R(),warnings:B(I()),warningCodes:dJ}).strict(),V({scope:cJ.default(`project`),name:I(),dryRun:R().optional(),setAutoUpdate:R().optional(),...Ud,summary:Wd}).strict(),V({name:I().min(1),updated:R(),source:I().min(1),localBody:I().optional(),upstreamBody:I().optional(),gitTracked:R().optional(),warnings:B(I()),warningCodes:dJ}).strict(),V({scope:cJ.default(`project`),name:I(),...Ud,summary:Wd}).strict(),V({name:I().min(1),baselineRef:I().min(1),restoredFiles:B(I()),warnings:B(I())}).strict();const fJ=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;V({existed:R(),path:I().min(1),warnings:B(I()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${fJ}`})}).strict(),V({scope:cJ.default(`project`),fromName:I(),toName:I(),body:Bd.optional(),frontmatter:lJ.optional(),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),committed:R(),warnings:B(I()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${fJ}`})}).strict(),V({name:I(),toName:I().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:cJ,toScope:cJ,...Ud,summary:Wd}).strict(),V({scope:cJ,path:I().optional(),droppedLocations:B(I()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:B(I()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${fJ}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),V({scope:cJ,name:I(),toName:I(),...Ud,summary:Wd}).strict(),V({name:I().min(1)}).strict(),V({name:I(),home:I().min(1)}).strict(),V({docName:I().min(1)}).strict();const pJ=U([`reference`,`script`,`file`]);V({scope:cJ.default(`project`),name:I(),path:I().min(1),content:I(),...Ud,summary:Wd}).strict().superRefine((e,t)=>{Qve(e.path)&&zd(e.content,t,[`content`])}),V({path:I().min(1),created:R(),kind:pJ,content:R()}).strict(),V({scope:cJ.default(`project`),name:I(),from:I().min(1),to:I().min(1),...Ud,summary:Wd}).strict(),V({from:I().min(1),to:I().min(1),fromDocName:I().optional(),toDocName:I().optional()}).strict(),V({path:I().min(1),kind:pJ,text:I()}).strict(),V({path:I().min(1),existed:R(),kind:pJ}).strict();const mJ=$i([dve,W(`agents`)]),hJ=I().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),gJ=$i([mJ,hJ]);V({scope:cJ.default(`project`),name:I(),targets:B(mJ).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:B(gJ).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:B(gJ).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:U([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:gJ.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:R().optional(),setSource:I().min(1).optional(),place:V({dir:I().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:U([`copy`,`link`])}).strict().optional(),convert:V({target:gJ.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:U([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:V({path:I().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...Ud,summary:Wd,fork:V({editor:I().min(1),action:U([`align`,`make-source`,`rename`]),toName:I().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const _J=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`,`links-not-permitted`];V({name:I().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:B(I()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:R().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:B(I()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:B(U(_J)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:I().optional(),sourceMovedTo:I().optional()}).strict(),V({scope:cJ.default(`project`),name:I().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),V({name:I().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:R().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),V({targets:B($q),configured:R(),folders:B(V({scope:cJ,host:I(),root:I(),state:U([`own`,`linked`,`linked-parent`,`absent`]),target:I().optional(),drift:W(!0).optional(),expected:I().optional()}).strict()).optional()}).strict();const vJ=V({action:W(`link`),scope:cJ,root:I().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:I().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),yJ=V({action:W(`unlink`),scope:cJ,root:I().min(1).meta({description:`The linked folder to materialize back.`}),exclude:B(I().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),bJ=V({action:W(`add-root`),scope:cJ,root:hJ.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),rye=ea(`action`,[vJ.extend({preview:R().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),yJ,bJ]);ea(`action`,[vJ.strict(),yJ,bJ]),V({folderAction:rye}).strict();const iye=V({moves:B(I()),drops:B(I()),removes:B(I()),replaces:B(I()),conflicts:B(I()),strays:B(I())}).strict();V({targets:B($q),reprojected:B(V({name:I(),hosts:B(I())}).strict()),bundleHosts:B(I()),removedFrom:B(I()),folder:V({moved:B(I()),dropped:B(I()),linked:B(I())}).strict().optional(),preview:iye.optional()}).strict(),V({scope:cJ.default(`project`),name:I(),version:I().regex(/^[0-9a-f]{40}$/i),...Ud,summary:Wd}).strict(),V({name:I().min(1),version:I(),restoredFiles:B(I()),warnings:B(I())}).strict(),V({query:I().optional(),intent:U([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:U([`navigation`,`relevance`]).optional(),scopes:B(U([`page`,`folder`,`content`,`file`])).optional(),scope:I().optional(),limit:L().int().nonnegative().optional(),semantic:R().optional(),source:U([`omnibar`,`mcp`,`http`]).optional()}).loose();const aye=V({kind:U([`page`,`folder`,`content`,`file`]),path:I().min(1),title:I(),score:L(),signals:H(I(),z()),snippet:I().optional()}).loose(),oye=U([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),xJ=U([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),SJ=V({capable:R(),applied:R(),outcome:oye,providerErrorReason:xJ.nullable().optional().catch(null),coverage:V({embedded:L().int().nonnegative(),total:L().int().nonnegative()})}).loose();V({enabled:R(),keyPresent:R(),keyNotRequired:R(),keySource:U([`project`,`file`,`env`]).nullable(),keyHint:I().nullable(),ready:R(),capable:R(),providerError:R().optional(),providerErrorReason:xJ.nullable().optional().catch(null),embedded:L().int().nonnegative(),total:L().int().nonnegative()}).loose(),V({query:I(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:B(aye),elapsedMs:L().nonnegative(),semantic:SJ.optional(),truncated:R().optional(),ready:R().optional()}).loose();const sye=V({version:I().min(1),recordedAt:I().min(1)}).loose();V({currentVersion:I().min(1),targets:H(I(),sye.nullable())}).loose(),V({scope:cJ.default(`project`),source:I().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:I().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:R().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:R().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...Ud,summary:Wd}).strict(),V({scope:cJ.default(`project`),source:I().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:B(I().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:R().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:R().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...Ud,summary:Wd}).strict(),V({results:B(V({requested:I(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:I().optional(),collisionRenamedFrom:I().optional(),warnings:B(I()),warningCodes:dJ,error:I().optional()}).loose()),imported:L(),alreadyImported:L(),failed:L()}).loose(),V({scope:cJ.default(`project`),names:B(I().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...Ud,summary:Wd}).strict(),V({results:B(V({requested:I(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:I().optional(),warnings:B(I()),warningCodes:dJ,error:I().optional()}).loose()),updated:L(),upToDate:L(),failed:L()}).loose();const cye=V({source:I(),ref:I().optional(),contentHash:I(),publisher:I().optional()}).loose();V({name:I().min(1).meta({description:`Managed skill name created or matched.`}),path:I().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:R().meta({description:`True when this request created new source files.`}),alreadyImported:R().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:I().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:cye,warnings:B(I()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:dJ}).loose();const lye=U([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);V({v:W(1),ch:W(`server-info`),seq:L(),serverInstanceId:I().min(1),currentBranch:I().min(1).optional()}).loose(),V({v:W(1),ch:W(`branch-switched`),seq:L(),branch:I().min(1)}).loose(),V({v:W(1),ch:lye,seq:L()}).loose(),V({v:W(1),ch:W(`disk-ack`),seq:L(),docName:I().min(1),sv:I().min(1)}).loose(),V({v:W(1),ch:W(`config-validation-rejected`),seq:L(),docName:I().min(1),error:Qie}).loose(),V({v:W(1),ch:W(`config-ignore-nested-error`),seq:L(),path:I().min(1),error:I().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const uye=Zi({name:I(),description:I(),files:Zi({skillMd:I(),scripts:B(I()),references:B(I())})}),dye=Zi({pluginProvider:I().optional(),plugin:I().optional(),marketplace:I().optional(),repositoryUrl:I().optional(),version:I().optional(),gitCommitSha:I().optional(),scope:I().optional(),projectPath:I().optional()}),fye=Zi({commands:R(),hooks:R(),mcp:R()}),pye=Zi({...uye.shape,sourceHarness:I(),sourceHarnesses:B(I()),home:I(),provenance:dye,inert:fye,outsideProject:R().optional()}),mye=Zi({schema:W(1),name:I(),version:I(),description:I().optional(),author:Zi({name:I()}).optional(),skills:B(I()),hostCompatibility:B(I()).optional(),capabilities:Zi({scripts:I(),network:I(),inert:B(I())}).optional(),provenance:Zi({source:I(),ref:I(),contentHash:I()}).optional()});V({skills:B(pye),packs:B(mye)}).loose(),V({results:B(V({id:I().min(1),name:I().min(1),source:I().min(1),description:I(),installs:L().int().nonnegative().nullable(),publisher:I().nullable()}).loose()),backend:U([`skills.sh`,`github-fallback`]),degraded:R()}).loose(),V({title:I(),description:I(),image:I().nullable(),skillsUrl:I().nullable(),sourceKind:U([`github`,`site`]),sourceUrl:I()}).loose(),V({skills:B(V({name:I(),description:I().nullable()}).loose())}).loose(),V({kind:U([`local`,`import`,`none`]),scope:U(Ed).optional(),name:I().optional(),dir:I().optional(),source:I().optional(),ref:I().optional(),via:U([`source`,`publisher`]).optional()}).loose();const hye=V({relPath:I(),content:I().nullable()}).loose(),gye=V({provider:I(),plugin:I(),version:I().optional(),marketplace:I().optional(),repositoryUrl:I().optional()}).loose(),_ye=V({provider:I(),plugin:I(),version:I().optional(),description:I().optional(),repositoryUrl:I().optional(),bundledSkills:B(I()),capabilities:V({commands:R(),hooks:R(),mcp:R(),agents:R()}),setupSupported:R()}).loose();V({name:I(),description:I().nullable(),skillMd:I(),files:B(hye),plugin:gye.optional(),pluginBundle:_ye.optional()}).loose();const vye=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`,`unsafe-incoming-symlinks`],CJ=e=>e*8+4;CJ(92),CJ(40),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null})(),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const wJ={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},TJ=`state/bug-reports`,yye=Zi({at:I(),transport:I(),outcome:I(),reference:I().optional(),error:I().optional(),errorCode:I().optional()}),bye=Zi({reason:I(),at:I(),errorCode:I().optional()});Zi({version:L().int().catch(1),id:I(),createdAt:I(),bundleLevel:I(),zipBytes:L().int().nonnegative().catch(0),zipDeleted:R().optional(),state:I(),systemWide:R().optional(),projectSlug:I().nullable().optional(),reference:I().optional(),lastError:bye.optional(),attempts:B(yye).optional(),note:I().optional()}),Zi({version:L().int().catch(1),id:I().optional(),sentAt:I().optional(),reference:I().optional()});const xye=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function Sye(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Cye(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(Sye).join(`_`)}`}function wye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tye(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=Wl(Ul,t);if(e!==void 0){if(e.scope===`project-local`){let e=Cye(t),o;i!=null&&r!=null&&n!=null&&(o=Zu({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...xye.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(wye(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const EJ=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${EJ}\\.${EJ}\\.${EJ}$`);function DJ(e,t){return e===`unix-chain`?`# ok-mcp${t}-v`:`# ok-mcp${t}-win-v`}function OJ(e){return e.replace(/\/+/g,`/`).replace(/\/+$/,``)}function Eye(e){return rt[e].userHomeDirName}function Dye(e,t){return e===`stable`?`${OJ(t)}/Library/Application Support/OpenKnowledge/path-install.json`:`${OJ(t)}/${Eye(e)}/path-install.json`}const Oye=[`.ok`,cd,`installed-skills.json`],kye=U(Ed),Aye=Zi({hosts:B(I()),scope:kye,scripts:R(),installedAt:ki(),projection:U([`symlink`,`copy`]).optional(),contentHash:I().optional()}),jye=Zi({schema:W(1),skills:H(I(),Aye).default({})});function Mye(e){let t;try{t=JSON.parse(e)}catch{return null}let n=jye.safeParse(t);return n.success?n.data:null}function kJ(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function Nye(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>kJ(e))]}const AJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of AJ){let t=QB.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}gH(),PV(),FV();function Pye(){return QB.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function Fye(){return Pye().filter(e=>{let t=Iye(e);return t!==`fence`&&t!==`html`})}function Iye(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}const jJ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),MJ=globalThis;MJ[jJ]===void 0&&(MJ[jJ]=sr());const NJ=MJ[jJ],PJ=Zi({version:I().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(NJ,{description:`Recorded skill version for this target.`}),recordedAt:ki().register(NJ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:U([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(NJ,{description:`Install-source surface that recorded this entry.`}).optional()}),Lye=Zi({enabled:R().register(NJ,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:ki().register(NJ,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});Zi({schema:W(1).register(NJ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zi({"claude-cowork":PJ.optional(),"cli-hosts":PJ.optional()}).register(NJ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(I(),Lye).register(NJ,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:B(I()).register(NJ,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});function Rye(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Zu({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function FJ(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return D(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function IJ(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function zye(e){let t=[],n=[[`maxBatchSize`,1,Ll],[`maxBatchChars`,1,Rl],[`docTimeoutMs`,1,zl]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=IJ(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function Bye(e){let t=IJ(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=gie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function Vye(e){let t=IJ(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=_ie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Zu({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function LJ(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Ul.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,xs.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?FJ(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=nd({value:c,file:t,source:o,doc:s}),u=l.length>0?id(c):c,d=[...Bye({rawConfig:u,doc:s,source:o,absPath:t}),...Vye({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=Ul.safeParse(u);if(!f.success){let e=Rye(f,s,o,t),c=Ul.shape.git.safeParse(IJ(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?FJ(t,r,i):void 0,h=[...l,...d,...Cd(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...zye({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}function RJ(e=_e()){return j(e,ft().userHomeDirName)}const zJ=`.tmp.`,BJ=[8,4,4,4,12];function Hye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Uye=BJ.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),Wye=BJ.map(e=>`[0-9a-f]{${e}}`).join(`-`),Gye=`*${zJ}${Uye}`;RegExp(`${Hye(zJ)}${Wye}$`);function Kye(e){return`${e}${zJ}${Ee()}`}function qye(e){try{let t=k(e),n=`${ae(e)}${zJ}`,r=Date.now()-3e4;for(let e of w(t)){if(!e.startsWith(n))continue;let i=j(t,e);try{te(i).mtimeMs<r&&ne(i)}catch{}}}catch{}}function VJ(e,t,n={}){qye(e);let r=Kye(e);try{re(r,t,{encoding:`utf-8`,mode:n.mode??420}),D(r,e)}catch(e){try{ne(r)}catch{}throw e}}var HJ=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function Jye(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new HJ(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new HJ(e,r);await Gie(i);continue}try{return await t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}function Yye(e){let t=Date.now()+e;for(;Date.now()<t;);}function UJ(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new HJ(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new HJ(e,r);Yye(i);continue}try{return t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}const WJ=`config.yml`;function GJ(e,t,n){if(e===`user`)return N(RJ(n??_e()),`global.yml`);let r=A(t)?t:N(t);return e===`project-local`?N(r,`.ok`,cd,WJ):N(r,`.ok`,WJ)}const Xye=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function KJ(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:jP(t.replaceAll(`_`,`-`))}function Zye(e){for(let t of Xye){let n=e[t]?.trim();if(n!==void 0&&n!==``)return KJ(n)}return null}function Qye(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return jP(t)??void 0}function $ye(e=process.env){let t=Qye(e),n=Zye(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=KJ(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function qJ(){return pd(ud)}function JJ(){return ft().keyringService}function YJ(e){try{e()}catch{}}var ebe=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(JJ(),e).getPassword()}catch(t){return YJ(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return YJ(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return YJ(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(JJ(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(JJ(),e).deletePassword()}catch{}}},XJ=class{backend=`file`;authFile;constructor(e){this.authFile=e??j(RJ(),`auth.yml`)}read(){if(!g(this.authFile))return{};try{let e=S(this.authFile,`utf-8`);return(0,xs.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=k(this.authFile);g(t)||v(t,{recursive:!0,mode:448}),VJ(this.authFile,(0,xs.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},tbe=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${qJ()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function ZJ(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(JJ(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
430
+ `),YJ(()=>t?.onBackendSelected?.({backend:`keyring`})),new tbe(new ebe(t?.onKeychainRead),new XJ(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (${qJ()}) — OS keychain unavailable: ${r}\n`),YJ(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new XJ(e)}}function nbe(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (${qJ()})\n`),r(new XJ(e))},n)});try{return await Promise.race([ZJ(e),r])}catch{return new XJ(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function rbe(e){let t=nbe(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}
431
431
  /*!
432
432
  * Copyright (c) Squirrel Chat et al., All rights reserved.
433
433
  * SPDX-License-Identifier: BSD-3-Clause
@@ -455,7 +455,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
455
455
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
456
456
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
457
457
  */
458
- let obe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var sbe=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(obe);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
458
+ let ibe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var abe=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(ibe);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
459
459
  /*!
460
460
  * Copyright (c) Squirrel Chat et al., All rights reserved.
461
461
  * SPDX-License-Identifier: BSD-3-Clause
@@ -483,9 +483,9 @@ let obe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+
483
483
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
484
484
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
485
485
  */
486
- function cbe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function lbe(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
486
+ function obe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function sbe(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
487
487
  `,e===t&&(i+=` `.repeat(a+n+2),i+=`^
488
- `))}return i}var QJ=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=cbe(t.toml,t.ptr),i=lbe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
488
+ `))}return i}var QJ=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=obe(t.toml,t.ptr),i=sbe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
489
489
  /*!
490
490
  * Copyright (c) Squirrel Chat et al., All rights reserved.
491
491
  * SPDX-License-Identifier: BSD-3-Clause
@@ -513,12 +513,12 @@ function cbe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop(
513
513
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
514
514
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
515
515
  */
516
- let ube=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,dbe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,fbe=/^[+-]?0[0-9_]/;function $J(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
516
+ let cbe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,lbe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,ube=/^[+-]?0[0-9_]/;function $J(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
517
517
  `?t++:e[t]===`\r`&&e[t+1]===`
518
518
  `&&(t+=2));let o=``,s=t,c=0;for(let l=t;l<e.length;l++)if(n=e[l],a&&(n===`
519
519
  `||n===`\r`&&e[l+1]===`
520
520
  `))c&&=3;else if(n<` `&&n!==` `||n===``)throw new QJ(`control characters are not allowed in strings`,{toml:e,ptr:l});else if((!c||c===3)&&n===r&&(!a||e[l+1]===r&&e[l+2]===r))return a&&(e[l+3]===r&&l++,e[l+3]===r&&l++),[c?o:o+e.slice(s,l),l+(a?3:1)];else if(!c)!i&&n===`\\`&&(o+=e.slice(s,s=l),c=1);else if(c===1){if(n===`x`||n===`u`||n===`U`){let t=0,r=n===`x`?2:n===`u`?4:8;for(let n=0;n<r;n++,l++){let n=e.charCodeAt(l+1),r=n>=48&&n<=57?n-48:n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:-1;if(r<0)throw new QJ(`invalid non-hex character in unicode escape`,{toml:e,ptr:l+1});t=t<<4|r}if(t<0||t>1114111||t>=55296&&t<=57343)throw new QJ(`invalid unicode escape`,{toml:e,ptr:l});o+=String.fromCodePoint(t),s=l+1,c=0}else if(n===` `||n===` `)c=2;else{if(n===`b`)o+=`\b`;else if(n===`t`)o+=` `;else if(n===`n`)o+=`
521
- `;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new QJ(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new QJ(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new QJ(`unfinished string`,{toml:e,ptr:t})}function pbe(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=ube.test(e);if(i||dbe.test(e)){if(fbe.test(e))throw new QJ(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new QJ(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new QJ(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new sbe(e);if(!a.isValid())throw new QJ(`invalid value`,{toml:t,ptr:n});return a}
521
+ `;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new QJ(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new QJ(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new QJ(`unfinished string`,{toml:e,ptr:t})}function dbe(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=cbe.test(e);if(i||lbe.test(e)){if(ube.test(e))throw new QJ(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new QJ(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new QJ(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new abe(e);if(!a.isValid())throw new QJ(`invalid value`,{toml:t,ptr:n});return a}
522
522
  /*!
523
523
  * Copyright (c) Squirrel Chat et al., All rights reserved.
524
524
  * SPDX-License-Identifier: BSD-3-Clause
@@ -551,7 +551,7 @@ function eY(e,t=0,n=e.length){let r=e.indexOf(`
551
551
  `)return n;if(r===`\r`&&e[n+1]===`
552
552
  `)return n+1;if(r<` `&&r!==` `||r===``)throw new QJ(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}function nY(e,t,n,r){let i;for(;;){for(;(i=e[t])===` `||i===` `||!n&&(i===`
553
553
  `||i===`\r`&&e[t+1]===`
554
- `);)t++;if(r||i!==`#`)break;t=tY(e,t)}return t}function mbe(e,t,n,r,i=!1){if(!r)return t=eY(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=eY(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
554
+ `);)t++;if(r||i!==`#`)break;t=tY(e,t)}return t}function fbe(e,t,n,r,i=!1){if(!r)return t=eY(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=eY(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
555
555
  `||t===`\r`&&e[a+1]===`
556
556
  `))return a}throw new QJ(`cannot find end of structure`,{toml:e,ptr:t})}
557
557
  /*!
@@ -581,8 +581,8 @@ function eY(e,t=0,n=e.length){let r=e.indexOf(`
581
581
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
582
582
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
583
583
  */
584
- function hbe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(tY(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function rY(e,t,n,r,i){if(r===0)throw new QJ(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?vbe(e,t,r,i):_be(e,t,r,i);if(n){if(s=nY(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new QJ(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=$J(e,t);if(n){if(i=nY(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
585
- `&&e[i]!==`\r`)throw new QJ(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=mbe(e,t,`,`,n),s=hbe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new QJ(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=nY(e,t+s[1]),e[o]===`,`&&o++),[pbe(s[0],e,t,i),o]}
584
+ function pbe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(tY(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function rY(e,t,n,r,i){if(r===0)throw new QJ(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?gbe(e,t,r,i):hbe(e,t,r,i);if(n){if(s=nY(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new QJ(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=$J(e,t);if(n){if(i=nY(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
585
+ `&&e[i]!==`\r`)throw new QJ(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=fbe(e,t,`,`,n),s=pbe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new QJ(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=nY(e,t+s[1]),e[o]===`,`&&o++),[dbe(s[0],e,t,i),o]}
586
586
  /*!
587
587
  * Copyright (c) Squirrel Chat et al., All rights reserved.
588
588
  * SPDX-License-Identifier: BSD-3-Clause
@@ -610,8 +610,8 @@ function hbe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(tY(e,i),r=
610
610
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
611
611
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
612
612
  */
613
- let gbe=/^[a-zA-Z0-9-_]+[ \t]*$/;function iY(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new QJ(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `){if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new QJ(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=$J(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=eY(l);if(u>-1)throw new QJ(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new QJ(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new QJ(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(s)}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!gbe.test(n))throw new QJ(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}}while(r+1&&r<a);return[i,nY(e,a+1,!0,!0)]}function _be(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new QJ(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=tY(e,t);else if(o!==` `&&o!==` `&&o!==`
614
- `&&o!==`\r`){let o,s=i,c=!1,[l,u]=iY(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new QJ(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new QJ(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=rY(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new QJ(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function vbe(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new QJ(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=tY(e,t);else if(a!==` `&&a!==` `&&a!==`
613
+ let mbe=/^[a-zA-Z0-9-_]+[ \t]*$/;function iY(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new QJ(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `){if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new QJ(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=$J(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=eY(l);if(u>-1)throw new QJ(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new QJ(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new QJ(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(s)}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!mbe.test(n))throw new QJ(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}}while(r+1&&r<a);return[i,nY(e,a+1,!0,!0)]}function hbe(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new QJ(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=tY(e,t);else if(o!==` `&&o!==` `&&o!==`
614
+ `&&o!==`\r`){let o,s=i,c=!1,[l,u]=iY(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new QJ(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new QJ(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=rY(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new QJ(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function gbe(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new QJ(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=tY(e,t);else if(a!==` `&&a!==` `&&a!==`
615
615
  `&&a!==`\r`){let a=rY(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new QJ(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}
616
616
  /*!
617
617
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -640,7 +640,7 @@ let gbe=/^[a-zA-Z0-9-_]+[ \t]*$/;function iY(e,t,n=`=`){let r=t-1,i=[],a=e.index
640
640
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
641
641
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
642
642
  */
643
- function aY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function ybe(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=nY(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=iY(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new QJ(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=aY(n[0],r,i,t?2:1);if(!c)throw new QJ(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=iY(e,s),i=aY(r[0],a,o,0);if(!i)throw new QJ(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=rY(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=nY(e,s,!0),e[s]&&e[s]!==`
643
+ function aY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function _be(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=nY(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=iY(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new QJ(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=aY(n[0],r,i,t?2:1);if(!c)throw new QJ(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=iY(e,s),i=aY(r[0],a,o,0);if(!i)throw new QJ(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=rY(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=nY(e,s,!0),e[s]&&e[s]!==`
644
644
  `&&e[s]!==`\r`)throw new QJ(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=nY(e,s)}return r}
645
645
  /*!
646
646
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -669,13 +669,13 @@ function aY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i
669
669
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
670
670
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
671
671
  */
672
- let oY=/^[a-z0-9-_]+$/i;function sY(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function bbe(e){for(let t=0;t<e.length;t++)if(sY(e[t])!==`object`)return!1;return e.length!=0}function cY(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function lY(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:Number.isInteger(e)&&(r||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return cY(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return xbe(e,n,r);if(t===`array`)return Sbe(e,n,r)}function xbe(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=oY.test(o)?o:cY(o),i+=` = `,i+=lY(e[o],sY(e[o]),t-1,n)}return i+` }`}function Sbe(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=lY(e[i],sY(e[i]),t-1,n)}return r+` ]`}function Cbe(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
673
- `}[[${t}]]\n`,i+=uY(0,e[a],t,n,r);return i}function uY(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=sY(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=oY.test(c)?c:cY(c);if(e===`array`&&bbe(t[c]))o+=(o&&`
674
- `)+Cbe(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
672
+ let oY=/^[a-z0-9-_]+$/i;function sY(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function vbe(e){for(let t=0;t<e.length;t++)if(sY(e[t])!==`object`)return!1;return e.length!=0}function cY(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function lY(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:Number.isInteger(e)&&(r||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return cY(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return ybe(e,n,r);if(t===`array`)return bbe(e,n,r)}function ybe(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=oY.test(o)?o:cY(o),i+=` = `,i+=lY(e[o],sY(e[o]),t-1,n)}return i+` }`}function bbe(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=lY(e[i],sY(e[i]),t-1,n)}return r+` ]`}function xbe(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
673
+ `}[[${t}]]\n`,i+=uY(0,e[a],t,n,r);return i}function uY(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=sY(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=oY.test(c)?c:cY(c);if(e===`array`&&vbe(t[c]))o+=(o&&`
674
+ `)+xbe(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
675
675
  `)+uY(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=lY(t[c],e,r,i),a+=`
676
- `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function wbe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(sY(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=uY(0,e,``,t,n);return r[r.length-1]===`
676
+ `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function Sbe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(sY(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=uY(0,e,``,t,n);return r[r.length-1]===`
677
677
  `?r:r+`
678
- `}function dY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fY(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function Tbe(e){return!e||typeof e!=`object`?String(e):`${typeof e} keys=[${Object.keys(e).join(`,`)}]`}function Ebe(e,t){let n=[],r=new WeakSet,i=t;for(;i instanceof Error&&!r.has(i);)r.add(i),n.push(i.message),i=i.cause;return n.length===0?`${e}: ${Tbe(t)}`:`${e}: ${n.reverse().slice(0,5).join(` -> `)}`}function pY(e,t){process.env.OK_DEBUG_NATIVE&&process.stderr.write(`[ok] native-config ${Ebe(e,t)}\n`)}const Dbe=[`native`,`index.js`];function mY(e={},t=pY){let n=e.moduleUrl??import.meta.url,r=e.requireModule??a(n);try{let e=k(fe(n));return r(j(e,...Dbe))}catch(e){fY(e)||t(`bundled loader failed to load`,e)}try{return r(`@inkeep/open-knowledge-native-config`)}catch(e){return fY(e)||t(`workspace addon failed to load`,e),null}}function Obe(){let e=mY();return e&&typeof e.parseTomlToJson==`function`?e:null}function kbe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return pY(`addon loaded but probe failed`,e),!1}}function hY(e){if(!dY(e))throw Error(`TOML root is not a table`);return e}function Abe(e){return{backend:`native`,parseToObject(t){return hY(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}},removeEntryKey(t,n,r){let i=e.removeMcpServerKey(t,n,r);return{text:i.text,existed:i.existed}}}}function jbe(){return{backend:`fallback`,parseToObject(e){return hY(ybe(e))}}}function Mbe(e=Obe){let t=e();return t&&kbe(t)?Abe(t):jbe()}let gY=null;function _Y(){return gY===null&&(gY=Mbe()),gY}function Nbe(){let e=_Y();return e.backend===`native`?e:void 0}const vY=gt,yY=ree,Pbe=aee,bY=`node`,xY={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function SY(){let e=dt();return e===`stable`?{...xY}:{...xY,[st]:e}}const CY=`@inkeep/open-knowledge`;function wY(e){return`${DJ(`unix-chain`,e.mcpChainTag)}2`}function TY(e){return`${DJ(`windows-chain`,e.mcpChainTag)}1`}function EY(e){let t=rt[e],n=`${CY}@${t.npmDistTag}`,r=e===`stable`?``:`\nexport ${st}=${e}`;return`${wY(t)}${r}
678
+ `}function dY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fY(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function Cbe(e){return!e||typeof e!=`object`?String(e):`${typeof e} keys=[${Object.keys(e).join(`,`)}]`}function wbe(e,t){let n=[],r=new WeakSet,i=t;for(;i instanceof Error&&!r.has(i);)r.add(i),n.push(i.message),i=i.cause;return n.length===0?`${e}: ${Cbe(t)}`:`${e}: ${n.reverse().slice(0,5).join(` -> `)}`}function pY(e,t){process.env.OK_DEBUG_NATIVE&&process.stderr.write(`[ok] native-config ${wbe(e,t)}\n`)}const Tbe=[`native`,`index.js`];function mY(e={},t=pY){let n=e.moduleUrl??import.meta.url,r=e.requireModule??a(n);try{let e=k(fe(n));return r(j(e,...Tbe))}catch(e){fY(e)||t(`bundled loader failed to load`,e)}try{return r(`@inkeep/open-knowledge-native-config`)}catch(e){return fY(e)||t(`workspace addon failed to load`,e),null}}function Ebe(){let e=mY();return e&&typeof e.parseTomlToJson==`function`?e:null}function Dbe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return pY(`addon loaded but probe failed`,e),!1}}function hY(e){if(!dY(e))throw Error(`TOML root is not a table`);return e}function Obe(e){return{backend:`native`,parseToObject(t){return hY(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}},removeEntryKey(t,n,r){let i=e.removeMcpServerKey(t,n,r);return{text:i.text,existed:i.existed}}}}function kbe(){return{backend:`fallback`,parseToObject(e){return hY(_be(e))}}}function Abe(e=Ebe){let t=e();return t&&Dbe(t)?Obe(t):kbe()}let gY=null;function _Y(){return gY===null&&(gY=Abe()),gY}function jbe(){let e=_Y();return e.backend===`native`?e:void 0}const vY=gt,yY=ree,Mbe=aee,bY=`node`,xY={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function SY(){let e=dt();return e===`stable`?{...xY}:{...xY,[st]:e}}const CY=`@inkeep/open-knowledge`;function wY(e){return`${DJ(`unix-chain`,e.mcpChainTag)}2`}function TY(e){return`${DJ(`windows-chain`,e.mcpChainTag)}1`}function EY(e){let t=rt[e],n=`${CY}@${t.npmDistTag}`,r=e===`stable`?``:`\nexport ${st}=${e}`;return`${wY(t)}${r}
679
679
  USER_BUNDLE="$HOME/Applications/${t.productName}.app/Contents/Resources/cli/bin/ok.sh"
680
680
  [ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
681
681
  BUNDLE="/Applications/${t.productName}.app/Contents/Resources/cli/bin/ok.sh"
@@ -711,41 +711,41 @@ foreach ($d in $dirs) {
711
711
  if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '${n}' mcp; exit $LASTEXITCODE }
712
712
  }
713
713
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g ${i}), then restart your editor')
714
- exit 127`}const Fbe=`A dev build writes no MCP launcher for an installed OpenKnowledge channel, because that launcher runs a released CLI. Register this checkout by running \`${ht} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`;function OY(){let e=dt();if(e===`dev`)throw Error(Fbe);return e}wY(rt.stable),EY(`stable`),TY(rt.stable),DY(`stable`);function kY(e){return`// ok-pi-bridge${e.mcpChainTag}`}function AY(e){return`${kY(e)}-v1`}function jY(e){return`${kY(e)}-dev`}kY(rt.stable),AY(rt.stable);function MY(e){if(typeof e!=`object`||!e)return!1;let t=ft(),n=e;if(n.command===`/bin/sh`){if(!Array.isArray(n.args)||n.args[0]!==`-l`||n.args[1]!==`-c`)return!1;let e=n.args[2];return zY(e,wY(t))}if(n.command===`powershell`){if(!Array.isArray(n.args)||n.args[0]!==`-NoProfile`||n.args[1]!==`-NonInteractive`||n.args[2]!==`-Command`)return!1;let e=n.args[3];return zY(e,TY(t))}if(n.type===`local`&&Array.isArray(n.command)){if(n.command[0]===`/bin/sh`){if(n.command[1]!==`-l`||n.command[2]!==`-c`)return!1;let e=n.command[3];return zY(e,wY(t))}if(n.command[0]===`powershell`){if(n.command[1]!==`-NoProfile`||n.command[2]!==`-NonInteractive`||n.command[3]!==`-Command`)return!1;let e=n.command[4];return zY(e,TY(t))}return!1}if(n.command===`ok-pi-managed-extension`){if(!Array.isArray(n.args))return!1;let e=n.args[0];return typeof e==`string`&&e.startsWith(AY(t))}return!1}function NY(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=N(e);if(ae(t)===`cli.mjs`&&ae(k(t))===`dist`)return t;let n=t.split(le),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?le:i.join(le);return j(a,`packages`,`cli`,`dist`,`cli.mjs`)}function PY(e={}){return e.mode===`dev`?{command:bY,args:[NY(),`mcp`],env:SY()}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,DY(OY())]}:{command:`/bin/sh`,args:[`-l`,`-c`,EY(OY())]}}function Ibe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[bY,NY(),`mcp`],environment:SY()}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,DY(OY())]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,EY(OY())]}}function FY(e){if(typeof e!=`object`||!e||ut())return!1;let t=e;return IY(t,PY({mode:`published`,platformName:`darwin`}))||IY(t,PY({mode:`published`,platformName:`win32`}))}function IY(e,t){return Object.keys(e).length===Object.keys(t).length&&Lbe(e,t)}function Lbe(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function LY(e,t){let n=e=>BY(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function Rbe(e){return e.format===`toml`?_Y().backend===`native`:e.format===`json`||e.format===`yaml`}function RY(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function zY(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function BY(e){return zY(e,`# ok-mcp`)}function zbe(e){return typeof e==`string`&&(e===CY||e.startsWith(`${CY}@`))}function VY(e){if(typeof e!=`object`||!e)return!1;let t=RY(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&BY(t[n+1])?!0:t.some(zbe)}function Bbe(e){if(typeof e!=`object`||!e)return!1;let t=RY(e);if(t[0]!==bY||t[2]!==`mcp`)return!1;try{return t[1]===NY()}catch{return!1}}const Vbe=[`command`,`args`,`env`],Hbe=[`type`,`command`,`environment`];function HY(e){return e.type===`local`&&Array.isArray(e.command)?Hbe:Vbe}function UY(e,t){if(t===null||typeof e!=`object`||!e)return[];let n=e;return HY(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function WY(e,t){return e.format===`file`||ut()?null:e.buildEntry(t,{})}function Ube(e,t){return UY(e,t).length>0}function Wbe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:LY(t.args,t.command)}function Gbe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&LY(r,n)}function GY(e){return e===`win32`?ue:ce}function Kbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.claude.json`)}function KY(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=e.env??process.env;if(t===`darwin`)return ce.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??ue.join(n,`AppData`,`Roaming`);return ue.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function qY(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.cursor`,`mcp.json`)}function qbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return(e.env??process.env).CODEX_HOME??GY(t).join(n,`.codex`)}function JY(e={}){return GY(e.platformName??process.platform).join(qbe(e),`config.toml`)}function YY(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=(e.env??process.env).COPILOT_HOME??GY(t).join(n,`.copilot`);return GY(t).join(r,`mcp-config.json`)}function Jbe(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=e.env??process.env,i=GY(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function XY(e={}){return GY(e.platformName??process.platform).join(Jbe(e),`opencode.json`)}function Ybe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.openclaw`,`openclaw.json`)}function Xbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.hermes`,`config.yaml`)}function ZY(e={}){let t=e.platformName??process.platform,n=e.home??_e();return(e.env??process.env).PI_CODING_AGENT_DIR??GY(t).join(n,`.pi`,`agent`)}function Zbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Qbe(e,t){let n=GY(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function $be(e){try{return w(e).length>0}catch{return!1}}function QY(e={}){let t=e.platformName??process.platform,[n,r]=Qbe(e.home??_e(),t),i=[n,r].find(e=>g(e.file));return i?i.file:$be(r.dir)?r.file:n.file}function exe(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function txe(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const $Y={claude:{id:`claude`,label:yY.claude,configPath:(e,t)=>Kbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:yY[`claude-desktop`],configPath:(e,t)=>KY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(KY({home:t}))},cursor:{id:`cursor`,label:yY.cursor,configPath:(e,t)=>qY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(qY({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:yY.codex,configPath:(e,t)=>JY({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(JY({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:yY.copilot,configPath:(e,t)=>YY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(YY({home:t})),projectSkillPath:e=>j(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:yY.opencode,configPath:(e,t)=>XY({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>pt(),buildEntry:(e,t)=>Ibe(t),scope:`global`,detectPath:(e,t)=>k(XY({home:t})),projectConfigPath:e=>j(e,`opencode.json`),projectSkillPath:e=>j(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:yY.openclaw,configPath:(e,t)=>Ybe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:yY.pi,configPath:()=>{throw Error(`Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at ${wt(ft())} (run \`${mt()} init\` in the project).`)},format:`file`,topLevelKey:`mcpServers`,serverName:()=>pt(),scope:`project`,detectPath:(e,t)=>ZY({home:t}),projectConfigPath:e=>j(e,wt(ft())),projectSkillPath:e=>j(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:yY.antigravity,configPath:(e,t)=>Zbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:yY[`lm-studio`],configPath:(e,t)=>QY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(QY({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:yY.hermes,configPath:(e,t)=>Xbe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.hermes`),offerOnlyWhenDetected:!0}};function nxe(e){let t=e.filter(e=>!Object.hasOwn($Y,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${vY.join(`, `)}`);return e.map(e=>$Y[e])}Yu();var rxe=Object.create,eX=Object.defineProperty,ixe=Object.getOwnPropertyDescriptor,axe=Object.getOwnPropertyNames,oxe=Object.getPrototypeOf,tX=Object.prototype.hasOwnProperty,nX=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),sxe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=axe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!tX.call(e,s)&&s!==n&&eX(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ixe(t,s))||r.enumerable});return e},rX=(e,t,n)=>(n=e==null?{}:rxe(oxe(e)),sxe(t||!e||!e.__esModule||!tX.call(e,`default`)?eX(n,`default`,{value:e,enumerable:!0}):n,e)),iX=a(import.meta.url),aX=nX(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
714
+ exit 127`}const Nbe=`A dev build writes no MCP launcher for an installed OpenKnowledge channel, because that launcher runs a released CLI. Register this checkout by running \`${ht} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`;function OY(){let e=dt();if(e===`dev`)throw Error(Nbe);return e}wY(rt.stable),EY(`stable`),TY(rt.stable),DY(`stable`);function kY(e){return`// ok-pi-bridge${e.mcpChainTag}`}function AY(e){return`${kY(e)}-v1`}function jY(e){return`${kY(e)}-dev`}kY(rt.stable),AY(rt.stable);function MY(e){if(typeof e!=`object`||!e)return!1;let t=ft(),n=e;if(n.command===`/bin/sh`){if(!Array.isArray(n.args)||n.args[0]!==`-l`||n.args[1]!==`-c`)return!1;let e=n.args[2];return zY(e,wY(t))}if(n.command===`powershell`){if(!Array.isArray(n.args)||n.args[0]!==`-NoProfile`||n.args[1]!==`-NonInteractive`||n.args[2]!==`-Command`)return!1;let e=n.args[3];return zY(e,TY(t))}if(n.type===`local`&&Array.isArray(n.command)){if(n.command[0]===`/bin/sh`){if(n.command[1]!==`-l`||n.command[2]!==`-c`)return!1;let e=n.command[3];return zY(e,wY(t))}if(n.command[0]===`powershell`){if(n.command[1]!==`-NoProfile`||n.command[2]!==`-NonInteractive`||n.command[3]!==`-Command`)return!1;let e=n.command[4];return zY(e,TY(t))}return!1}if(n.command===`ok-pi-managed-extension`){if(!Array.isArray(n.args))return!1;let e=n.args[0];return typeof e==`string`&&e.startsWith(AY(t))}return!1}function NY(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=N(e);if(ae(t)===`cli.mjs`&&ae(k(t))===`dist`)return t;let n=t.split(le),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?le:i.join(le);return j(a,`packages`,`cli`,`dist`,`cli.mjs`)}function PY(e={}){return e.mode===`dev`?{command:bY,args:[NY(),`mcp`],env:SY()}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,DY(OY())]}:{command:`/bin/sh`,args:[`-l`,`-c`,EY(OY())]}}function Pbe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[bY,NY(),`mcp`],environment:SY()}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,DY(OY())]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,EY(OY())]}}function FY(e){if(typeof e!=`object`||!e||ut())return!1;let t=e;return IY(t,PY({mode:`published`,platformName:`darwin`}))||IY(t,PY({mode:`published`,platformName:`win32`}))}function IY(e,t){return Object.keys(e).length===Object.keys(t).length&&Fbe(e,t)}function Fbe(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function LY(e,t){let n=e=>BY(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function Ibe(e){return e.format===`toml`?_Y().backend===`native`:e.format===`json`||e.format===`yaml`}function RY(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function zY(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function BY(e){return zY(e,`# ok-mcp`)}function Lbe(e){return typeof e==`string`&&(e===CY||e.startsWith(`${CY}@`))}function VY(e){if(typeof e!=`object`||!e)return!1;let t=RY(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&BY(t[n+1])?!0:t.some(Lbe)}function Rbe(e){if(typeof e!=`object`||!e)return!1;let t=RY(e);if(t[0]!==bY||t[2]!==`mcp`)return!1;try{return t[1]===NY()}catch{return!1}}const zbe=[`command`,`args`,`env`],Bbe=[`type`,`command`,`environment`];function HY(e){return e.type===`local`&&Array.isArray(e.command)?Bbe:zbe}function UY(e,t){if(t===null||typeof e!=`object`||!e)return[];let n=e;return HY(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function WY(e,t){return e.format===`file`||ut()?null:e.buildEntry(t,{})}function Vbe(e,t){return UY(e,t).length>0}function Hbe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:LY(t.args,t.command)}function Ube(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&LY(r,n)}function GY(e){return e===`win32`?ue:ce}function Wbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.claude.json`)}function KY(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=e.env??process.env;if(t===`darwin`)return ce.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??ue.join(n,`AppData`,`Roaming`);return ue.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function qY(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.cursor`,`mcp.json`)}function Gbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return(e.env??process.env).CODEX_HOME??GY(t).join(n,`.codex`)}function JY(e={}){return GY(e.platformName??process.platform).join(Gbe(e),`config.toml`)}function YY(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=(e.env??process.env).COPILOT_HOME??GY(t).join(n,`.copilot`);return GY(t).join(r,`mcp-config.json`)}function Kbe(e={}){let t=e.platformName??process.platform,n=e.home??_e(),r=e.env??process.env,i=GY(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function XY(e={}){return GY(e.platformName??process.platform).join(Kbe(e),`opencode.json`)}function qbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.openclaw`,`openclaw.json`)}function Jbe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.hermes`,`config.yaml`)}function ZY(e={}){let t=e.platformName??process.platform,n=e.home??_e();return(e.env??process.env).PI_CODING_AGENT_DIR??GY(t).join(n,`.pi`,`agent`)}function Ybe(e={}){let t=e.platformName??process.platform,n=e.home??_e();return GY(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Xbe(e,t){let n=GY(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function Zbe(e){try{return w(e).length>0}catch{return!1}}function QY(e={}){let t=e.platformName??process.platform,[n,r]=Xbe(e.home??_e(),t),i=[n,r].find(e=>g(e.file));return i?i.file:Zbe(r.dir)?r.file:n.file}function Qbe(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function $be(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const $Y={claude:{id:`claude`,label:yY.claude,configPath:(e,t)=>Wbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:yY[`claude-desktop`],configPath:(e,t)=>KY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(KY({home:t}))},cursor:{id:`cursor`,label:yY.cursor,configPath:(e,t)=>qY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(qY({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:yY.codex,configPath:(e,t)=>JY({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(JY({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:yY.copilot,configPath:(e,t)=>YY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(YY({home:t})),projectSkillPath:e=>j(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:yY.opencode,configPath:(e,t)=>XY({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>pt(),buildEntry:(e,t)=>Pbe(t),scope:`global`,detectPath:(e,t)=>k(XY({home:t})),projectConfigPath:e=>j(e,`opencode.json`),projectSkillPath:e=>j(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:yY.openclaw,configPath:(e,t)=>qbe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:yY.pi,configPath:()=>{throw Error(`Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at ${wt(ft())} (run \`${mt()} init\` in the project).`)},format:`file`,topLevelKey:`mcpServers`,serverName:()=>pt(),scope:`project`,detectPath:(e,t)=>ZY({home:t}),projectConfigPath:e=>j(e,wt(ft())),projectSkillPath:e=>j(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:yY.antigravity,configPath:(e,t)=>Ybe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:yY[`lm-studio`],configPath:(e,t)=>QY({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>k(QY({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:yY.hermes,configPath:(e,t)=>Jbe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>pt(),buildEntry:(e,t)=>PY(t),scope:`global`,detectPath:(e,t)=>j(t??_e(),`.hermes`),offerOnlyWhenDetected:!0}};function exe(e){let t=e.filter(e=>!Object.hasOwn($Y,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${vY.join(`, `)}`);return e.map(e=>$Y[e])}Yu();var txe=Object.create,eX=Object.defineProperty,nxe=Object.getOwnPropertyDescriptor,rxe=Object.getOwnPropertyNames,ixe=Object.getPrototypeOf,tX=Object.prototype.hasOwnProperty,nX=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),axe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=rxe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!tX.call(e,s)&&s!==n&&eX(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=nxe(t,s))||r.enumerable});return e},rX=(e,t,n)=>(n=e==null?{}:txe(ixe(e)),axe(t||!e||!e.__esModule||!tX.call(e,`default`)?eX(n,`default`,{value:e,enumerable:!0}):n,e)),iX=a(import.meta.url),aX=nX(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
715
715
  causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
716
- caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),oX=nX(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),cxe=nX(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=aX(),{pinoErrProto:a,pinoErrorSymbols:o}=oX(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),lxe=nX(((e,t)=>{t.exports=s;let{isErrorLike:n}=aX(),{pinoErrProto:r,pinoErrorSymbols:i}=oX(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),uxe=nX(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),dxe=nX(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),sX=nX(((e,t)=>{let n=cxe(),r=lxe(),i=uxe(),a=dxe();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),cX=nX(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),fxe=nX(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a)){if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else if(typeof a==`object`&&a){if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else if(d.includes(`*`))u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s);else if(s)a(e,d);else{let r=typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n;i(e,d,r)}}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.has(r)||t.has(`*`)?n(e[r],t.get(r)||t.get(`*`)):e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),lX=nX(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),ee=Symbol.for(`pino.serializers`),te=Symbol.for(`pino.formatters`),ne=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:ee,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:te,hooksSym:ne,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),uX=nX(((e,t)=>{let n=fxe(),{redactFmtSym:r,wildcardFirstSym:i}=lX(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),pxe=nX(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=process.hrtime.bigint()-c,t=s+e,n=t/o,r=t%o,i=Number(n*1000n+r/1000000n),a=new Date(i);return`,"time":"${a.getUTCFullYear()}-${(a.getUTCMonth()+1).toString().padStart(2,`0`)}-${a.getUTCDate().toString().padStart(2,`0`)}T${a.getUTCHours().toString().padStart(2,`0`)}:${a.getUTCMinutes().toString().padStart(2,`0`)}:${a.getUTCSeconds().toString().padStart(2,`0`)}.${r.toString().padStart(9,`0`)}Z"`}}})),mxe=nX(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),dX=nX(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),fX=nX(((e,t)=>{let n=iX(`fs`),r=iX(`events`),i=iX(`util`).inherits,a=iX(`path`),o=dX(),s=iX(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:ee,contentMode:te,mode:ne}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=ee||!1,this.append=p||!1,this.mode=ne,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let re,ie;if(te===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,re=()=>n.writeSync(this.fd,this._writingBuf),ie=()=>n.write(this.fd,this._writingBuf,this.release);else if(te===void 0||te===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,re=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),ie=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${te}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length)){if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ie,100)}else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){ie();return}try{do{let e=re(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),pX=nX(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),hxe=nX(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),gxe=nX(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),_xe=nX(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),vxe=nX(((e,t)=>{let{version:n}=hxe(),{EventEmitter:r}=iX(`events`),{Worker:i}=iX(`worker_threads`),{join:a}=iX(`path`),{pathToFileURL:o}=iX(`url`),{wait:s}=gxe(),{WRITE_INDEX:c,READ_INDEX:l,SEQ_INDEX:u}=_xe(),d=iX(`buffer`),f=iX(`assert`),p=Symbol(`kImpl`),m=d.constants.MAX_STRING_LENGTH;function h(){}function g(e,t){Atomics.add(e[p].state,u,1),t(),Atomics.add(e[p].state,u,1),Atomics.notify(e[p].state,u)}function _(e){g(e,()=>{Atomics.store(e[p].state,l,0),Atomics.store(e[p].state,c,0)})}var v=class{constructor(e){this._value=e}deref(){return this._value}},y=class{register(){}unregister(){}};let b=process.env.NODE_V8_COVERAGE?y:global.FinalizationRegistry||y,x=process.env.NODE_V8_COVERAGE?v:global.WeakRef||v,S=new b(e=>{e.exited||e.terminate()});function C(e,t){let{filename:r,workerData:s}=t,c=(`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),l=new i(c,{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[p].dataBuf,stateBuf:e[p].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return l.stream=new v(e),l.on(`message`,E),l.on(`exit`,D),S.register(e,l),l}function w(e){f(!e[p].sync),e[p].needDrain&&(e[p].needDrain=!1,e.emit(`drain`))}function T(e){for(;;){let t=Atomics.load(e[p].state,c),n=e[p].data.length-t;if(n>0){if(e[p].bufLen===0){e[p].flushing=!1,e[p].ending?oe(e):e[p].needDrain&&process.nextTick(w,e);return}k(e,n,h);continue}if(n===0){if(t===0&&e[p].bufLen===0)return;te(e,()=>{e.destroyed||(_(e),T(e))});return}ae(e,Error(`overwritten`));return}}function E(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new x(t),te(t,()=>{t[p].ready=!0,t.emit(`ready`)});break;case`ERROR`:ae(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){ae(t,Error(`this should not happen: `+e.code));break}let n=t[p].flushCallbacks.get(e.id);n&&(t[p].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:ae(t,Error(`this should not happen: `+e.code))}}function D(e){let t=this.stream.deref();t!==void 0&&(S.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,D),ae(t,e===0?null:Error(`the worker thread exited`)))}var O=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[p]={},this[p].stateBuf=new SharedArrayBuffer(128),this[p].state=new Int32Array(this[p].stateBuf),this[p].dataBuf=new SharedArrayBuffer(e.bufferSize||4194304),this[p].data=Buffer.from(this[p].dataBuf),this[p].sync=e.sync||!1,this[p].ending=!1,this[p].ended=!1,this[p].needDrain=!1,this[p].destroyed=!1,this[p].flushing=!1,this[p].ready=!1,this[p].finished=!1,this[p].errored=null,this[p].closed=!1,this[p].buf=[],this[p].bufHead=0,this[p].bufLen=0,this[p].flushCallbacks=new Map,this[p].nextFlushId=0,this.worker=C(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[p].destroyed)return ie(this,Error(`the worker has exited`)),!1;if(this[p].ending)return ie(this,Error(`the worker is ending`)),!1;if(this[p].flushing&&this[p].bufLen+t.length>=m)try{A(this),this[p].flushing=!0}catch(e){return ae(this,e),!1}if(this[p].buf.push(t),this[p].bufLen+=t.length,this[p].sync)try{return A(this),!0}catch(e){return ae(this,e),!1}return this[p].flushing||(this[p].flushing=!0,setImmediate(T,this)),this[p].needDrain=this[p].data.length-this[p].bufLen-Atomics.load(this[p].state,c)<=0,!this[p].needDrain}end(){this[p].destroyed||(this[p].ending=!0,oe(this))}flush(e){e=typeof e==`function`?e:h,ee(this,t=>{if(t){process.nextTick(e,t);return}ne(this,e)})}flushSync(){this[p].destroyed||(A(this),j(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[p].ready}get destroyed(){return this[p].destroyed}get closed(){return this[p].closed}get writable(){return!this[p].destroyed&&!this[p].ending}get writableEnded(){return this[p].ending}get writableFinished(){return this[p].finished}get writableNeedDrain(){return this[p].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[p].errored}};function ee(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].sync&&(e[p].flushing||e[p].bufLen>0)){setImmediate(ee,e,t);return}te(e,t)}function te(e,t){let n=Atomics.load(e[p].state,c);s(e[p].state,l,n,1/0,(n,r)=>{if(n){ae(e,n),t(n);return}if(r!==`ok`){te(e,t);return}t()})}function ne(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].ready){let n=()=>{i(),ne(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[p].nextFlushId;e[p].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[p].flushCallbacks.delete(n),ae(e,r),process.nextTick(t,r)}}function re(e,t){let n=e[p].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function ie(e,t){setImmediate(()=>{e.emit(`error`,t)})}function ae(e,t){e[p].destroyed||(e[p].destroyed=!0,re(e,t),t&&(e[p].errored=t,ie(e,t)),e.worker.exited?setImmediate(()=>{e[p].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[p].closed=!0,e.emit(`close`)}))}function k(e,t,n){let r=Atomics.load(e[p].state,c),i=t;for(;i>0&&e[p].bufLen!==0;){let t=e[p].bufHead,n=e[p].buf[t];if(n.length<=i){n.copy(e[p].data,r),r+=n.length,i-=n.length,e[p].bufLen-=n.length,e[p].bufHead=t+1,e[p].bufHead===e[p].buf.length?(e[p].buf.length=0,e[p].bufHead=0):e[p].bufHead>=1024&&e[p].bufHead*2>=e[p].buf.length&&(e[p].buf.splice(0,e[p].bufHead),e[p].bufHead=0);continue}n.copy(e[p].data,r,0,i),e[p].buf[t]=n.subarray(i),e[p].bufLen-=i,r+=i,i=0}return g(e,()=>{Atomics.store(e[p].state,c,r)}),n(),!0}function oe(e){if(!(e[p].ended||!e[p].ending||e[p].flushing)){e[p].ended=!0;try{e.flushSync();let t=Atomics.load(e[p].state,l);g(e,()=>{Atomics.store(e[p].state,c,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[p].state,l,t,1e3),t=Atomics.load(e[p].state,l),t===-2){ae(e,Error(`end() failed`));return}if(++n===10){ae(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[p].finished=!0,e.emit(`finish`)})}catch(t){ae(e,t)}}}function A(e){let t=()=>{e[p].ending?oe(e):e[p].needDrain&&process.nextTick(w,e)};for(e[p].flushing=!1;e[p].bufLen!==0;){let n=Atomics.load(e[p].state,c),r=e[p].data.length-n;if(r===0){j(e),_(e);continue}if(r<0)throw Error(`overwritten`);k(e,r,t)}}function j(e){if(e[p].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[p].state,c),n=0;for(;;){let r=Atomics.load(e[p].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[p].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=O})),mX=nX(((e,t)=>{let{createRequire:n}=iX(`module`),{existsSync:r}=iX(`node:fs`),i=cX(),{join:a,isAbsolute:o,sep:s}=iX(`node:path`),{fileURLToPath:c}=iX(`node:url`),l=dX(),u=pX(),d=vxe();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&iX.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{let i=r===`node:repl`?process.cwd()+s:r;t=n(i).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),hX=nX(((e,t)=>{let n=iX(`node:diagnostics_channel`),r=mxe(),{mapHttpRequest:i,mapHttpResponse:a}=sX(),o=fX(),s=pX(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=lX(),{isMainThread:w}=iX(`worker_threads`),T=mX(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):ne;function ee(){}function te(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function ne(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function re(e,t,n,r){if(D.hasSubscribers===!1)return ie.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(ie,i,this,e,t,n,r)}function ie(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let ee=o[_],te=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);te+=`,`+n+`:`+D}let ne=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),ne=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),ne=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),ne=`,"`+w+`":`+D}}return this[v]&&te?E+this[S]+te.slice(1)+`}`+ne+s:E+te+ne+s}function ae(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function k(e){return e.write!==e.constructor.prototype.write}function oe(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,A),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function A(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function j(e){return function(t,n,r={},i){if(typeof r==`string`)i=oe({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=oe({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=ee),i||=k(process.stdout)?process.stdout:oe({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function se(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function ce(e,t,n){return{level:e,bindings:t,log:n}}function M(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:ee,buildSafeSonicBoom:oe,asChindings:ae,asJson:re,genLog:te,createArgsNormalizer:j,stringify:se,buildFormatters:ce,normalizeDestFileDescriptor:M}})),gX=nX(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),_X=nX(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=lX(),{noop:l,genLog:u}=hX(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=gX(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),vX=nX(((e,t)=>{t.exports={version:`10.3.1`}})),yxe=nX(((e,t)=>{let{EventEmitter:n}=iX(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=lX(),{getLevel:D,setLevel:O,isLevelEnabled:ee,mappings:te,initialLsCache:ne,genLsCache:re,assertNoLevelCollisions:ie}=_X(),{asChindings:ae,asJson:k,buildFormatters:oe,stringify:A,noop:j}=hX(),{version:se}=vX(),ce=uX(),M={constructor:class{},child:le,bindings:ue,setBindings:de,flush:pe,isLevelEnabled:ee,version:se,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:ne,[u]:P,[l]:k,[o]:D,[a]:O};Object.setPrototypeOf(M,n.prototype),t.exports=function(){return Object.create(M)};let N=e=>e;function le(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==N&&(i[g]=oe(r.level,N,r.log)),i[s]=ae(i,e),this.onChild!==j&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=oe(e||r.level,n||N,a||r.log)}else i[g]=oe(r.level,N,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(ie(this.levels,t.customLevels),i.levels=te(t.customLevels,i[y]),re(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=ce(i.redact,A),n={stringify:e[x]};i[S]=A,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=ae(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function ue(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function de(e){let t=ae(this,e);this[s]=t}function fe(e,t){return Object.assign(t,e)}function P(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||fe,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function pe(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||j):e&&e()}})),bxe=nX(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0||t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0||r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),xxe=nX(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=gX(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),yX=nX(((e,t)=>{let n=iX(`node:os`),r=sX(),i=cX(),a=uX(),o=pxe(),s=yxe(),c=lX(),{configure:l}=bxe(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=_X(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=gX(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=hX(),{version:w}=vX(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:ee,streamSym:te,stringifySym:ne,stringifySafeSym:re,stringifiersSym:ie,setLevelSym:ae,endSym:k,formatOptsSym:oe,messageKeySym:A,errorKeySym:j,nestedKeySym:se,mixinSym:ce,levelCompSym:M,useOnlyCustomLevelsSym:N,formattersSym:le,hooksSym:ue,nestedKeyStrSym:de,mixinMergeStrategySym:fe,msgPrefixSym:P}=c,{epochTime:pe,nullTime:me}=o,{pid:he}=process,ge=n.hostname(),_e=r.err,ve=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:he,hostname:ge},serializers:Object.assign(Object.create(null),{err:_e}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:pe,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),ye=Object.assign(Object.create(null),r);function be(...e){let t={},{opts:n,stream:r}=ve(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:he,name:ge,level:_e,customLevels:ye,levelComparison:be,mixin:xe,mixinMergeStrategy:Se,useOnlyCustomLevels:Ce,formatters:we,hooks:Te,depthLimit:Ee,edgeLimit:De,onChild:Oe,msgPrefix:ke}=n,Ae=l({maximumDepth:Ee,maximumBreadth:De}),je=b(we.level,we.bindings,we.log),Me=x.bind({[re]:Ae}),Ne=o?a(o,Me):{},Pe=o?{stringify:Ne[E]}:{stringify:Me},Fe=`}`+(c?`\r
716
+ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),oX=nX(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),oxe=nX(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=aX(),{pinoErrProto:a,pinoErrorSymbols:o}=oX(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),sxe=nX(((e,t)=>{t.exports=s;let{isErrorLike:n}=aX(),{pinoErrProto:r,pinoErrorSymbols:i}=oX(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),cxe=nX(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),lxe=nX(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),sX=nX(((e,t)=>{let n=oxe(),r=sxe(),i=cxe(),a=lxe();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),cX=nX(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),uxe=nX(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a)){if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else if(typeof a==`object`&&a){if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else if(d.includes(`*`))u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s);else if(s)a(e,d);else{let r=typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n;i(e,d,r)}}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.has(r)||t.has(`*`)?n(e[r],t.get(r)||t.get(`*`)):e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),lX=nX(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),ee=Symbol.for(`pino.serializers`),te=Symbol.for(`pino.formatters`),ne=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:ee,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:te,hooksSym:ne,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),uX=nX(((e,t)=>{let n=uxe(),{redactFmtSym:r,wildcardFirstSym:i}=lX(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),dxe=nX(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=process.hrtime.bigint()-c,t=s+e,n=t/o,r=t%o,i=Number(n*1000n+r/1000000n),a=new Date(i);return`,"time":"${a.getUTCFullYear()}-${(a.getUTCMonth()+1).toString().padStart(2,`0`)}-${a.getUTCDate().toString().padStart(2,`0`)}T${a.getUTCHours().toString().padStart(2,`0`)}:${a.getUTCMinutes().toString().padStart(2,`0`)}:${a.getUTCSeconds().toString().padStart(2,`0`)}.${r.toString().padStart(9,`0`)}Z"`}}})),fxe=nX(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),dX=nX(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),fX=nX(((e,t)=>{let n=iX(`fs`),r=iX(`events`),i=iX(`util`).inherits,a=iX(`path`),o=dX(),s=iX(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:ee,contentMode:te,mode:ne}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=ee||!1,this.append=p||!1,this.mode=ne,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let re,ie;if(te===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,re=()=>n.writeSync(this.fd,this._writingBuf),ie=()=>n.write(this.fd,this._writingBuf,this.release);else if(te===void 0||te===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,re=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),ie=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${te}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length)){if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ie,100)}else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){ie();return}try{do{let e=re(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),pX=nX(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),pxe=nX(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),mxe=nX(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),hxe=nX(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),gxe=nX(((e,t)=>{let{version:n}=pxe(),{EventEmitter:r}=iX(`events`),{Worker:i}=iX(`worker_threads`),{join:a}=iX(`path`),{pathToFileURL:o}=iX(`url`),{wait:s}=mxe(),{WRITE_INDEX:c,READ_INDEX:l,SEQ_INDEX:u}=hxe(),d=iX(`buffer`),f=iX(`assert`),p=Symbol(`kImpl`),m=d.constants.MAX_STRING_LENGTH;function h(){}function g(e,t){Atomics.add(e[p].state,u,1),t(),Atomics.add(e[p].state,u,1),Atomics.notify(e[p].state,u)}function _(e){g(e,()=>{Atomics.store(e[p].state,l,0),Atomics.store(e[p].state,c,0)})}var v=class{constructor(e){this._value=e}deref(){return this._value}},y=class{register(){}unregister(){}};let b=process.env.NODE_V8_COVERAGE?y:global.FinalizationRegistry||y,x=process.env.NODE_V8_COVERAGE?v:global.WeakRef||v,S=new b(e=>{e.exited||e.terminate()});function C(e,t){let{filename:r,workerData:s}=t,c=(`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),l=new i(c,{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[p].dataBuf,stateBuf:e[p].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return l.stream=new v(e),l.on(`message`,E),l.on(`exit`,D),S.register(e,l),l}function w(e){f(!e[p].sync),e[p].needDrain&&(e[p].needDrain=!1,e.emit(`drain`))}function T(e){for(;;){let t=Atomics.load(e[p].state,c),n=e[p].data.length-t;if(n>0){if(e[p].bufLen===0){e[p].flushing=!1,e[p].ending?oe(e):e[p].needDrain&&process.nextTick(w,e);return}k(e,n,h);continue}if(n===0){if(t===0&&e[p].bufLen===0)return;te(e,()=>{e.destroyed||(_(e),T(e))});return}ae(e,Error(`overwritten`));return}}function E(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new x(t),te(t,()=>{t[p].ready=!0,t.emit(`ready`)});break;case`ERROR`:ae(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){ae(t,Error(`this should not happen: `+e.code));break}let n=t[p].flushCallbacks.get(e.id);n&&(t[p].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:ae(t,Error(`this should not happen: `+e.code))}}function D(e){let t=this.stream.deref();t!==void 0&&(S.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,D),ae(t,e===0?null:Error(`the worker thread exited`)))}var O=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[p]={},this[p].stateBuf=new SharedArrayBuffer(128),this[p].state=new Int32Array(this[p].stateBuf),this[p].dataBuf=new SharedArrayBuffer(e.bufferSize||4194304),this[p].data=Buffer.from(this[p].dataBuf),this[p].sync=e.sync||!1,this[p].ending=!1,this[p].ended=!1,this[p].needDrain=!1,this[p].destroyed=!1,this[p].flushing=!1,this[p].ready=!1,this[p].finished=!1,this[p].errored=null,this[p].closed=!1,this[p].buf=[],this[p].bufHead=0,this[p].bufLen=0,this[p].flushCallbacks=new Map,this[p].nextFlushId=0,this.worker=C(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[p].destroyed)return ie(this,Error(`the worker has exited`)),!1;if(this[p].ending)return ie(this,Error(`the worker is ending`)),!1;if(this[p].flushing&&this[p].bufLen+t.length>=m)try{A(this),this[p].flushing=!0}catch(e){return ae(this,e),!1}if(this[p].buf.push(t),this[p].bufLen+=t.length,this[p].sync)try{return A(this),!0}catch(e){return ae(this,e),!1}return this[p].flushing||(this[p].flushing=!0,setImmediate(T,this)),this[p].needDrain=this[p].data.length-this[p].bufLen-Atomics.load(this[p].state,c)<=0,!this[p].needDrain}end(){this[p].destroyed||(this[p].ending=!0,oe(this))}flush(e){e=typeof e==`function`?e:h,ee(this,t=>{if(t){process.nextTick(e,t);return}ne(this,e)})}flushSync(){this[p].destroyed||(A(this),j(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[p].ready}get destroyed(){return this[p].destroyed}get closed(){return this[p].closed}get writable(){return!this[p].destroyed&&!this[p].ending}get writableEnded(){return this[p].ending}get writableFinished(){return this[p].finished}get writableNeedDrain(){return this[p].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[p].errored}};function ee(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].sync&&(e[p].flushing||e[p].bufLen>0)){setImmediate(ee,e,t);return}te(e,t)}function te(e,t){let n=Atomics.load(e[p].state,c);s(e[p].state,l,n,1/0,(n,r)=>{if(n){ae(e,n),t(n);return}if(r!==`ok`){te(e,t);return}t()})}function ne(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].ready){let n=()=>{i(),ne(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[p].nextFlushId;e[p].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[p].flushCallbacks.delete(n),ae(e,r),process.nextTick(t,r)}}function re(e,t){let n=e[p].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function ie(e,t){setImmediate(()=>{e.emit(`error`,t)})}function ae(e,t){e[p].destroyed||(e[p].destroyed=!0,re(e,t),t&&(e[p].errored=t,ie(e,t)),e.worker.exited?setImmediate(()=>{e[p].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[p].closed=!0,e.emit(`close`)}))}function k(e,t,n){let r=Atomics.load(e[p].state,c),i=t;for(;i>0&&e[p].bufLen!==0;){let t=e[p].bufHead,n=e[p].buf[t];if(n.length<=i){n.copy(e[p].data,r),r+=n.length,i-=n.length,e[p].bufLen-=n.length,e[p].bufHead=t+1,e[p].bufHead===e[p].buf.length?(e[p].buf.length=0,e[p].bufHead=0):e[p].bufHead>=1024&&e[p].bufHead*2>=e[p].buf.length&&(e[p].buf.splice(0,e[p].bufHead),e[p].bufHead=0);continue}n.copy(e[p].data,r,0,i),e[p].buf[t]=n.subarray(i),e[p].bufLen-=i,r+=i,i=0}return g(e,()=>{Atomics.store(e[p].state,c,r)}),n(),!0}function oe(e){if(!(e[p].ended||!e[p].ending||e[p].flushing)){e[p].ended=!0;try{e.flushSync();let t=Atomics.load(e[p].state,l);g(e,()=>{Atomics.store(e[p].state,c,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[p].state,l,t,1e3),t=Atomics.load(e[p].state,l),t===-2){ae(e,Error(`end() failed`));return}if(++n===10){ae(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[p].finished=!0,e.emit(`finish`)})}catch(t){ae(e,t)}}}function A(e){let t=()=>{e[p].ending?oe(e):e[p].needDrain&&process.nextTick(w,e)};for(e[p].flushing=!1;e[p].bufLen!==0;){let n=Atomics.load(e[p].state,c),r=e[p].data.length-n;if(r===0){j(e),_(e);continue}if(r<0)throw Error(`overwritten`);k(e,r,t)}}function j(e){if(e[p].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[p].state,c),n=0;for(;;){let r=Atomics.load(e[p].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[p].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=O})),mX=nX(((e,t)=>{let{createRequire:n}=iX(`module`),{existsSync:r}=iX(`node:fs`),i=cX(),{join:a,isAbsolute:o,sep:s}=iX(`node:path`),{fileURLToPath:c}=iX(`node:url`),l=dX(),u=pX(),d=gxe();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&iX.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{let i=r===`node:repl`?process.cwd()+s:r;t=n(i).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),hX=nX(((e,t)=>{let n=iX(`node:diagnostics_channel`),r=fxe(),{mapHttpRequest:i,mapHttpResponse:a}=sX(),o=fX(),s=pX(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=lX(),{isMainThread:w}=iX(`worker_threads`),T=mX(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):ne;function ee(){}function te(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function ne(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function re(e,t,n,r){if(D.hasSubscribers===!1)return ie.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(ie,i,this,e,t,n,r)}function ie(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let ee=o[_],te=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);te+=`,`+n+`:`+D}let ne=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),ne=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),ne=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),ne=`,"`+w+`":`+D}}return this[v]&&te?E+this[S]+te.slice(1)+`}`+ne+s:E+te+ne+s}function ae(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function k(e){return e.write!==e.constructor.prototype.write}function oe(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,A),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function A(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function j(e){return function(t,n,r={},i){if(typeof r==`string`)i=oe({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=oe({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=ee),i||=k(process.stdout)?process.stdout:oe({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function se(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function ce(e,t,n){return{level:e,bindings:t,log:n}}function M(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:ee,buildSafeSonicBoom:oe,asChindings:ae,asJson:re,genLog:te,createArgsNormalizer:j,stringify:se,buildFormatters:ce,normalizeDestFileDescriptor:M}})),gX=nX(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),_X=nX(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=lX(),{noop:l,genLog:u}=hX(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=gX(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),vX=nX(((e,t)=>{t.exports={version:`10.3.1`}})),_xe=nX(((e,t)=>{let{EventEmitter:n}=iX(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=lX(),{getLevel:D,setLevel:O,isLevelEnabled:ee,mappings:te,initialLsCache:ne,genLsCache:re,assertNoLevelCollisions:ie}=_X(),{asChindings:ae,asJson:k,buildFormatters:oe,stringify:A,noop:j}=hX(),{version:se}=vX(),ce=uX(),M={constructor:class{},child:le,bindings:ue,setBindings:de,flush:pe,isLevelEnabled:ee,version:se,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:ne,[u]:P,[l]:k,[o]:D,[a]:O};Object.setPrototypeOf(M,n.prototype),t.exports=function(){return Object.create(M)};let N=e=>e;function le(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==N&&(i[g]=oe(r.level,N,r.log)),i[s]=ae(i,e),this.onChild!==j&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=oe(e||r.level,n||N,a||r.log)}else i[g]=oe(r.level,N,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(ie(this.levels,t.customLevels),i.levels=te(t.customLevels,i[y]),re(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=ce(i.redact,A),n={stringify:e[x]};i[S]=A,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=ae(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function ue(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function de(e){let t=ae(this,e);this[s]=t}function fe(e,t){return Object.assign(t,e)}function P(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||fe,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function pe(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||j):e&&e()}})),vxe=nX(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0||t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0||r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),yxe=nX(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=gX(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),yX=nX(((e,t)=>{let n=iX(`node:os`),r=sX(),i=cX(),a=uX(),o=dxe(),s=_xe(),c=lX(),{configure:l}=vxe(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=_X(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=gX(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=hX(),{version:w}=vX(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:ee,streamSym:te,stringifySym:ne,stringifySafeSym:re,stringifiersSym:ie,setLevelSym:ae,endSym:k,formatOptsSym:oe,messageKeySym:A,errorKeySym:j,nestedKeySym:se,mixinSym:ce,levelCompSym:M,useOnlyCustomLevelsSym:N,formattersSym:le,hooksSym:ue,nestedKeyStrSym:de,mixinMergeStrategySym:fe,msgPrefixSym:P}=c,{epochTime:pe,nullTime:me}=o,{pid:he}=process,ge=n.hostname(),_e=r.err,ve=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:he,hostname:ge},serializers:Object.assign(Object.create(null),{err:_e}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:pe,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),ye=Object.assign(Object.create(null),r);function be(...e){let t={},{opts:n,stream:r}=ve(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:he,name:ge,level:_e,customLevels:ye,levelComparison:be,mixin:xe,mixinMergeStrategy:Se,useOnlyCustomLevels:Ce,formatters:we,hooks:Te,depthLimit:Ee,edgeLimit:De,onChild:Oe,msgPrefix:ke}=n,Ae=l({maximumDepth:Ee,maximumBreadth:De}),je=b(we.level,we.bindings,we.log),Me=x.bind({[re]:Ae}),Ne=o?a(o,Me):{},Pe=o?{stringify:Ne[E]}:{stringify:Me},Fe=`}`+(c?`\r
717
717
  `:`
718
- `),Ie=v.bind(null,{[T]:``,[D]:g,[ie]:Ne,[ne]:x,[re]:Ae,[le]:je}),Le=``;he!==null&&(Le=Ie(ge===void 0?he:Object.assign({},he,{name:ge})));let Re=_ instanceof Function?_:_?pe:me,ze=Re().indexOf(`:`)+1;if(Ce&&!ye)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(xe&&typeof xe!=`function`)throw Error(`Unknown mixin type "${typeof xe}" - expected "function"`);if(ke&&typeof ke!=`string`)throw Error(`Unknown msgPrefix type "${typeof ke}" - expected "string"`);u(_e,ye,Ce);let Be=d(ye,Ce);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Be,messageKey:y,errorKey:S}}),m(be);let Ve=p(be);return Object.assign(t,{levels:Be,[M]:Ve,[N]:Ce,[te]:r,[O]:Re,[ee]:ze,[ne]:x,[re]:Ae,[ie]:Ne,[k]:Fe,[oe]:Pe,[A]:y,[j]:S,[se]:w,[de]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[ce]:xe,[fe]:Se,[T]:Le,[le]:je,[ue]:Te,silent:C,onChild:Oe,[P]:ke}),Object.setPrototypeOf(t,s()),f(t),t[ae](_e),t}t.exports=be,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=mX(),t.exports.multistream=xxe(),t.exports.levels=d(),t.exports.stdSerializers=ye,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=be,t.exports.pino=be})),bX=nX((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=iX(`tty`);function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t);let{env:i={},argv:a=[],platform:o=``}=typeof process>`u`?{}:process,s=`NO_COLOR`in i||a.includes(`--no-color`),c=`FORCE_COLOR`in i||a.includes(`--color`),l=o===`win32`,u=i.TERM===`dumb`,d=r&&r.isatty&&r.isatty(1)&&i.TERM&&!u,f=`CI`in i&&(`GITHUB_ACTIONS`in i||`GITLAB_CI`in i||`CIRCLECI`in i),p=!s&&(c||l&&!u||d||f),m=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:m(o,a,n,r)),h=(e,t,n,r,i)=>e<0?n+t+r:n+m(e,t,r,i)+r,g=(e,t,n=e,r=e.length+1)=>i=>i||i!==``&&i!==void 0?h((``+i).indexOf(t,r),i,e,t,n):``,_=(e,t,n)=>g(`\x1b[${e}m`,`\x1b[${t}m`,n),v={reset:_(0,0),bold:_(1,22,`\x1B[22m\x1B[1m`),dim:_(2,22,`\x1B[22m\x1B[2m`),italic:_(3,23),underline:_(4,24),inverse:_(7,27),hidden:_(8,28),strikethrough:_(9,29),black:_(30,39),red:_(31,39),green:_(32,39),yellow:_(33,39),blue:_(34,39),magenta:_(35,39),cyan:_(36,39),white:_(37,39),gray:_(90,39),bgBlack:_(40,49),bgRed:_(41,49),bgGreen:_(42,49),bgYellow:_(43,49),bgBlue:_(44,49),bgMagenta:_(45,49),bgCyan:_(46,49),bgWhite:_(47,49),blackBright:_(90,39),redBright:_(91,39),greenBright:_(92,39),yellowBright:_(93,39),blueBright:_(94,39),magentaBright:_(95,39),cyanBright:_(96,39),whiteBright:_(97,39),bgBlackBright:_(100,49),bgRedBright:_(101,49),bgGreenBright:_(102,49),bgYellowBright:_(103,49),bgBlueBright:_(104,49),bgMagentaBright:_(105,49),bgCyanBright:_(106,49),bgWhiteBright:_(107,49)},y=({useColor:e=p}={})=>e?v:Object.keys(v).reduce((e,t)=>({...e,[t]:String}),{}),{reset:b,bold:x,dim:S,italic:C,underline:w,inverse:T,hidden:E,strikethrough:D,black:O,red:ee,green:te,yellow:ne,blue:re,magenta:ie,cyan:ae,white:k,gray:oe,bgBlack:A,bgRed:j,bgGreen:se,bgYellow:ce,bgBlue:M,bgMagenta:N,bgCyan:le,bgWhite:ue,blackBright:de,redBright:fe,greenBright:P,yellowBright:pe,blueBright:me,magentaBright:he,cyanBright:ge,whiteBright:_e,bgBlackBright:ve,bgRedBright:ye,bgGreenBright:be,bgYellowBright:xe,bgBlueBright:Se,bgMagentaBright:Ce,bgCyanBright:we,bgWhiteBright:Te}=y();e.bgBlack=A,e.bgBlackBright=ve,e.bgBlue=M,e.bgBlueBright=Se,e.bgCyan=le,e.bgCyanBright=we,e.bgGreen=se,e.bgGreenBright=be,e.bgMagenta=N,e.bgMagentaBright=Ce,e.bgRed=j,e.bgRedBright=ye,e.bgWhite=ue,e.bgWhiteBright=Te,e.bgYellow=ce,e.bgYellowBright=xe,e.black=O,e.blackBright=de,e.blue=re,e.blueBright=me,e.bold=x,e.createColors=y,e.cyan=ae,e.cyanBright=ge,e.dim=S,e.gray=oe,e.green=te,e.greenBright=P,e.hidden=E,e.inverse=T,e.isColorSupported=p,e.italic=C,e.magenta=ie,e.magentaBright=he,e.red=ee,e.redBright=fe,e.reset=b,e.strikethrough=D,e.underline=w,e.white=k,e.whiteBright=_e,e.yellow=ne,e.yellowBright=pe})),Sxe=nX(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),xX=nX(((e,t)=>{var n=Sxe();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),Cxe=nX(((e,t)=>{var n=xX(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),wxe=nX(((e,t)=>{var n=xX(),r=Cxe(),i;try{i=iX(`fs`)}catch{}var a=function(){},o=typeof process>`u`?!1:/^v?\.0/.test(process.version),s=function(e){return typeof e==`function`},c=function(e){return!o||!i?!1:(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&s(e.close)},l=function(e){return e.setHeader&&s(e.abort)},u=function(e,t,i,o){o=n(o);var u=!1;e.on(`close`,function(){u=!0}),r(e,{readable:t,writable:i},function(e){if(e)return o(e);u=!0,o()});var d=!1;return function(t){if(!u&&!d){if(d=!0,c(e))return e.close(a);if(l(e))return e.abort();if(s(e.destroy))return e.destroy();o(t||Error(`stream was destroyed`))}}},d=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=s(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return u(i,o,a>0,function(e){n||=e,e&&r.forEach(d),!o&&(r.forEach(d),t(n))})});return e.reduce(f)}})),Txe=nX(((e,t)=>{let{Transform:n}=iX(`stream`),{StringDecoder:r}=iX(`string_decoder`),i=Symbol(`last`),a=Symbol(`decoder`);function o(e,t,n){let r;if(this.overflow){if(r=this[a].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[i]+=this[a].write(e),r=this[i].split(this.matcher);this[i]=r.pop();for(let e=0;e<r.length;e++)try{c(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[i].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function s(e){if(this[i]+=this[a].end(),this[i])try{c(this,this.mapper(this[i]))}catch(t){return e(t)}e()}function c(e,t){t!==void 0&&e.push(t)}function l(e){return e}function u(e,t,c){switch(e||=/\r?\n/,t||=l,c||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(c=e,e=/\r?\n/);break;case 2:typeof e==`function`?(c=t,t=e,e=/\r?\n/):typeof t==`object`&&(c=t,t=l)}c=Object.assign({},c),c.autoDestroy=!0,c.transform=o,c.flush=s,c.readableObjectMode=!0;let u=new n(c);return u[i]=``,u[a]=new r(`utf8`),u.matcher=e,u.mapper=t,u.maxLength=c.maxLength,u.skipOverflow=c.skipOverflow||!1,u.overflow=!1,u._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},u}t.exports=u})),Exe=nX(((e,t)=>{let n=Symbol.for(`pino.metadata`),r=Txe(),{Duplex:i}=iX(`stream`),{parentPort:a,workerData:o}=iX(`worker_threads`);function s(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}t.exports=function(e,t={}){let l=t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||c,p=r(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[n]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[n]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),l){let e={},t=s();return a.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),a.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return i.from({writable:p,readable:n});return p}};function c(e,t){process.nextTick(t,e)}})),SX=nX(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),CX=nX(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=SX();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),wX=nX(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=bX(),a=CX(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),TX=nX(((e,t)=>{t.exports=function(){}})),Dxe=nX(((e,t)=>{t.exports=a;let{isMainThread:n}=iX(`node:worker_threads`),r=fX(),i=TX();function a(e){let t=new r(e);return t.on(`error`,a),!e.sync&&n&&o(t),t;function a(e){if(e.code===`EPIPE`){t.write=i,t.end=i,t.flushSync=i,t.destroy=i;return}t.removeListener(`error`,a)}}function o(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=pX();t.register(e,s),e.on(`close`,function(){t.unregister(e)})}}function s(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),EX=nX(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),DX=nX(((e,t)=>{t.exports=r;let n=EX();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),OX=nX(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),kX=nX(((e,t)=>{t.exports=r;let n=OX();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),AX=nX(((e,t)=>{t.exports=i;let n=kX(),r=OX();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),Oxe=nX((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),jX=nX(((e,t)=>{t.exports=a;let{createCopier:n}=Oxe(),r=n({}),i=AX();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),kxe=nX(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=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},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o!==void 0&&o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/6048e5;return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),MX=nX(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=SX(),i=kxe(),a=DX(),o=EX();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),NX=nX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),PX=nX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),FX=nX(((e,t)=>{t.exports=r;let n=kX();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),IX=nX(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),LX=nX(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
719
- `}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),Axe=nX(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=SX(),r=wX(),i=PX(),a=NX(),o=CX();function s(e){let t=e.crlf?`\r
718
+ `),Ie=v.bind(null,{[T]:``,[D]:g,[ie]:Ne,[ne]:x,[re]:Ae,[le]:je}),Le=``;he!==null&&(Le=Ie(ge===void 0?he:Object.assign({},he,{name:ge})));let Re=_ instanceof Function?_:_?pe:me,ze=Re().indexOf(`:`)+1;if(Ce&&!ye)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(xe&&typeof xe!=`function`)throw Error(`Unknown mixin type "${typeof xe}" - expected "function"`);if(ke&&typeof ke!=`string`)throw Error(`Unknown msgPrefix type "${typeof ke}" - expected "string"`);u(_e,ye,Ce);let Be=d(ye,Ce);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Be,messageKey:y,errorKey:S}}),m(be);let Ve=p(be);return Object.assign(t,{levels:Be,[M]:Ve,[N]:Ce,[te]:r,[O]:Re,[ee]:ze,[ne]:x,[re]:Ae,[ie]:Ne,[k]:Fe,[oe]:Pe,[A]:y,[j]:S,[se]:w,[de]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[ce]:xe,[fe]:Se,[T]:Le,[le]:je,[ue]:Te,silent:C,onChild:Oe,[P]:ke}),Object.setPrototypeOf(t,s()),f(t),t[ae](_e),t}t.exports=be,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=mX(),t.exports.multistream=yxe(),t.exports.levels=d(),t.exports.stdSerializers=ye,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=be,t.exports.pino=be})),bX=nX((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=iX(`tty`);function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t);let{env:i={},argv:a=[],platform:o=``}=typeof process>`u`?{}:process,s=`NO_COLOR`in i||a.includes(`--no-color`),c=`FORCE_COLOR`in i||a.includes(`--color`),l=o===`win32`,u=i.TERM===`dumb`,d=r&&r.isatty&&r.isatty(1)&&i.TERM&&!u,f=`CI`in i&&(`GITHUB_ACTIONS`in i||`GITLAB_CI`in i||`CIRCLECI`in i),p=!s&&(c||l&&!u||d||f),m=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:m(o,a,n,r)),h=(e,t,n,r,i)=>e<0?n+t+r:n+m(e,t,r,i)+r,g=(e,t,n=e,r=e.length+1)=>i=>i||i!==``&&i!==void 0?h((``+i).indexOf(t,r),i,e,t,n):``,_=(e,t,n)=>g(`\x1b[${e}m`,`\x1b[${t}m`,n),v={reset:_(0,0),bold:_(1,22,`\x1B[22m\x1B[1m`),dim:_(2,22,`\x1B[22m\x1B[2m`),italic:_(3,23),underline:_(4,24),inverse:_(7,27),hidden:_(8,28),strikethrough:_(9,29),black:_(30,39),red:_(31,39),green:_(32,39),yellow:_(33,39),blue:_(34,39),magenta:_(35,39),cyan:_(36,39),white:_(37,39),gray:_(90,39),bgBlack:_(40,49),bgRed:_(41,49),bgGreen:_(42,49),bgYellow:_(43,49),bgBlue:_(44,49),bgMagenta:_(45,49),bgCyan:_(46,49),bgWhite:_(47,49),blackBright:_(90,39),redBright:_(91,39),greenBright:_(92,39),yellowBright:_(93,39),blueBright:_(94,39),magentaBright:_(95,39),cyanBright:_(96,39),whiteBright:_(97,39),bgBlackBright:_(100,49),bgRedBright:_(101,49),bgGreenBright:_(102,49),bgYellowBright:_(103,49),bgBlueBright:_(104,49),bgMagentaBright:_(105,49),bgCyanBright:_(106,49),bgWhiteBright:_(107,49)},y=({useColor:e=p}={})=>e?v:Object.keys(v).reduce((e,t)=>({...e,[t]:String}),{}),{reset:b,bold:x,dim:S,italic:C,underline:w,inverse:T,hidden:E,strikethrough:D,black:O,red:ee,green:te,yellow:ne,blue:re,magenta:ie,cyan:ae,white:k,gray:oe,bgBlack:A,bgRed:j,bgGreen:se,bgYellow:ce,bgBlue:M,bgMagenta:N,bgCyan:le,bgWhite:ue,blackBright:de,redBright:fe,greenBright:P,yellowBright:pe,blueBright:me,magentaBright:he,cyanBright:ge,whiteBright:_e,bgBlackBright:ve,bgRedBright:ye,bgGreenBright:be,bgYellowBright:xe,bgBlueBright:Se,bgMagentaBright:Ce,bgCyanBright:we,bgWhiteBright:Te}=y();e.bgBlack=A,e.bgBlackBright=ve,e.bgBlue=M,e.bgBlueBright=Se,e.bgCyan=le,e.bgCyanBright=we,e.bgGreen=se,e.bgGreenBright=be,e.bgMagenta=N,e.bgMagentaBright=Ce,e.bgRed=j,e.bgRedBright=ye,e.bgWhite=ue,e.bgWhiteBright=Te,e.bgYellow=ce,e.bgYellowBright=xe,e.black=O,e.blackBright=de,e.blue=re,e.blueBright=me,e.bold=x,e.createColors=y,e.cyan=ae,e.cyanBright=ge,e.dim=S,e.gray=oe,e.green=te,e.greenBright=P,e.hidden=E,e.inverse=T,e.isColorSupported=p,e.italic=C,e.magenta=ie,e.magentaBright=he,e.red=ee,e.redBright=fe,e.reset=b,e.strikethrough=D,e.underline=w,e.white=k,e.whiteBright=_e,e.yellow=ne,e.yellowBright=pe})),bxe=nX(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),xX=nX(((e,t)=>{var n=bxe();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),xxe=nX(((e,t)=>{var n=xX(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),Sxe=nX(((e,t)=>{var n=xX(),r=xxe(),i;try{i=iX(`fs`)}catch{}var a=function(){},o=typeof process>`u`?!1:/^v?\.0/.test(process.version),s=function(e){return typeof e==`function`},c=function(e){return!o||!i?!1:(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&s(e.close)},l=function(e){return e.setHeader&&s(e.abort)},u=function(e,t,i,o){o=n(o);var u=!1;e.on(`close`,function(){u=!0}),r(e,{readable:t,writable:i},function(e){if(e)return o(e);u=!0,o()});var d=!1;return function(t){if(!u&&!d){if(d=!0,c(e))return e.close(a);if(l(e))return e.abort();if(s(e.destroy))return e.destroy();o(t||Error(`stream was destroyed`))}}},d=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=s(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return u(i,o,a>0,function(e){n||=e,e&&r.forEach(d),!o&&(r.forEach(d),t(n))})});return e.reduce(f)}})),Cxe=nX(((e,t)=>{let{Transform:n}=iX(`stream`),{StringDecoder:r}=iX(`string_decoder`),i=Symbol(`last`),a=Symbol(`decoder`);function o(e,t,n){let r;if(this.overflow){if(r=this[a].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[i]+=this[a].write(e),r=this[i].split(this.matcher);this[i]=r.pop();for(let e=0;e<r.length;e++)try{c(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[i].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function s(e){if(this[i]+=this[a].end(),this[i])try{c(this,this.mapper(this[i]))}catch(t){return e(t)}e()}function c(e,t){t!==void 0&&e.push(t)}function l(e){return e}function u(e,t,c){switch(e||=/\r?\n/,t||=l,c||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(c=e,e=/\r?\n/);break;case 2:typeof e==`function`?(c=t,t=e,e=/\r?\n/):typeof t==`object`&&(c=t,t=l)}c=Object.assign({},c),c.autoDestroy=!0,c.transform=o,c.flush=s,c.readableObjectMode=!0;let u=new n(c);return u[i]=``,u[a]=new r(`utf8`),u.matcher=e,u.mapper=t,u.maxLength=c.maxLength,u.skipOverflow=c.skipOverflow||!1,u.overflow=!1,u._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},u}t.exports=u})),wxe=nX(((e,t)=>{let n=Symbol.for(`pino.metadata`),r=Cxe(),{Duplex:i}=iX(`stream`),{parentPort:a,workerData:o}=iX(`worker_threads`);function s(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}t.exports=function(e,t={}){let l=t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||c,p=r(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[n]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[n]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),l){let e={},t=s();return a.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),a.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return i.from({writable:p,readable:n});return p}};function c(e,t){process.nextTick(t,e)}})),SX=nX(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),CX=nX(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=SX();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),wX=nX(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=bX(),a=CX(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),TX=nX(((e,t)=>{t.exports=function(){}})),Txe=nX(((e,t)=>{t.exports=a;let{isMainThread:n}=iX(`node:worker_threads`),r=fX(),i=TX();function a(e){let t=new r(e);return t.on(`error`,a),!e.sync&&n&&o(t),t;function a(e){if(e.code===`EPIPE`){t.write=i,t.end=i,t.flushSync=i,t.destroy=i;return}t.removeListener(`error`,a)}}function o(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=pX();t.register(e,s),e.on(`close`,function(){t.unregister(e)})}}function s(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),EX=nX(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),DX=nX(((e,t)=>{t.exports=r;let n=EX();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),OX=nX(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),kX=nX(((e,t)=>{t.exports=r;let n=OX();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),AX=nX(((e,t)=>{t.exports=i;let n=kX(),r=OX();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),Exe=nX((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),jX=nX(((e,t)=>{t.exports=a;let{createCopier:n}=Exe(),r=n({}),i=AX();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),Dxe=nX(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=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},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o!==void 0&&o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/6048e5;return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),MX=nX(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=SX(),i=Dxe(),a=DX(),o=EX();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),NX=nX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),PX=nX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),FX=nX(((e,t)=>{t.exports=r;let n=kX();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),IX=nX(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),LX=nX(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
719
+ `}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),Oxe=nX(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=SX(),r=wX(),i=PX(),a=NX(),o=CX();function s(e){let t=e.crlf?`\r
720
720
  `:`
721
- `,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors){if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`)}let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,O=r(e.colorize,w,b),ee=e.colorizeObjects?O:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:O,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:ee,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),jxe=nX(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),RX=nX(((e,t)=>{t.exports=r;let n=LX();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),zX=nX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=SX(),r=jxe(),i=LX(),a=RX();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),BX=nX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=SX(),r=IX(),i=LX(),a=zX();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),VX=nX(((e,t)=>{t.exports=r;let n=kX();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),HX=nX(((e,t)=>{t.exports=a;let{LEVELS:n}=SX(),r=kX(),i=FX();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&(typeof e[u]==`string`||typeof e[u]==`number`||typeof e[u]==`boolean`))return a.message(e[u])}})),UX=nX(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),WX=nX(((e,t)=>{t.exports=r;let n=MX();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),Mxe=nX(((e,t)=>{t.exports={buildSafeSonicBoom:Dxe(),createDate:DX(),deleteLogProperty:AX(),filterLog:jX(),formatTime:MX(),getPropertyValue:kX(),handleCustomLevelsNamesOpts:NX(),handleCustomLevelsOpts:PX(),interpretConditionals:FX(),isObject:IX(),isValidDate:EX(),joinLinesWithIndentation:LX(),noop:TX(),parseFactoryOptions:Axe(),prettifyErrorLog:BX(),prettifyError:RX(),prettifyLevel:VX(),prettifyMessage:HX(),prettifyMetadata:UX(),prettifyObject:zX(),prettifyTime:WX(),splitPropertyKey:OX(),getLevelLabelData:CX()}})),Nxe=nX(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),Pxe=nX(((e,t)=>{t.exports=h;let n=Nxe(),r=IX(),i=BX(),a=VX(),o=HX(),s=UX(),c=zX(),l=WX(),u=jX(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=SX(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),Fxe=nX(((e,t)=>{let{isColorSupported:n}=bX(),r=wxe(),{Transform:i}=iX(`node:stream`),a=Exe(),o=wX(),{ERROR_LIKE_KEYS:s,LEVEL_KEY:c,LEVEL_LABEL:l,MESSAGE_KEY:u,TIMESTAMP_KEY:d}=SX(),{buildSafeSonicBoom:f,parseFactoryOptions:p}=Mxe(),m=Pxe(),h={colorize:n,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:s,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:c,levelLabel:l,messageFormat:null,messageKey:u,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:d,translateTime:!0,useOnlyCustomProps:!0};function g(e){let t=p(Object.assign({},h,e));return m.bind({...t,context:t})}function _(e={}){let t=g(e),n;return a(function(a){a.on(`message`,function n(r){!r||r.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:r.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||s,r.config.errorKey])),customLevels:r.config.levels.values}),t=g(e),a.off(`message`,n))});let o=new i({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:f({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),a.on(`unknown`,function(e){n.write(e+`
722
- `)}),r(a,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}t.exports=_,t.exports.build=_,t.exports.PinoPretty=_,t.exports.prettyFactory=g,t.exports.colorizerFactory=o,t.exports.isColorSupported=n,t.exports.default=_})),GX=rX(yX(),1),Ixe=rX(Fxe(),1);const KX=new Map;function Lxe(e){let t=KX.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},KX.set(e,t)),t}var Rxe=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=Lxe(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await De(k(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Ne(this.#e,e,{flag:`a`});let t;try{t=te(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await je(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const qX=[`.ok`,`local`,`logs`];function zxe(e){return j(e,...qX,`server-current.jsonl`)}function Bxe(e){return j(e,...qX,`server-prev.jsonl`)}var JX=class extends Le{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new Rxe({currentPath:zxe(e.projectDir),previousPath:Bxe(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function Vxe(){let e=Ju.getSpan(Gu.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function Hxe(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const YX=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function XX(e){return e===`silent`?1/0:GX.default.levels.values[e]??GX.default.levels.values.info}function ZX(e,t){return XX(e)<=XX(t)?e:t}var Uxe=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:GX.default.stdSerializers.err,error:GX.default.stdSerializers.err},mixin:Vxe,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&YX.has(t)?t:e===`silent`?`silent`:ZX(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&YX.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:ZX(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,GX.default)(this.options,GX.default.transport({targets:this.transportConfigs}));let r;try{r=(0,Ixe.default)({colorize:Hxe(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new JX(this.fileSinkOpts);return this.activeFileSink=t,(0,GX.default)({...this.options,level:n},GX.default.multistream([{stream:t,level:e}]))}return(0,GX.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new JX(this.fileSinkOpts);return this.activeFileSink=i,(0,GX.default)({...this.options,level:n},GX.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,GX.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const Wxe=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new Uxe(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function QX(e){return Wxe.getLogger(e)}new rve({extensions:sP,deriveStructuralFreshness:!0}),yO(sP);var $X=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(j(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=A(t)?t:N(this.gitDir,t))}catch(e){if(!tZ(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(j(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return tZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:rZ(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(j(t.path,`config`),`utf-8`)}catch(e){return tZ(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=qxe(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!nZ(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=N(t.path,e),r=M(t.path,n);if(r.startsWith(`..`)||A(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=Xxe(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!tZ(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(j(t.path,`packed-refs`),`utf-8`)}catch(e){return tZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return rZ(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function Gxe(e){return eZ(N(e),``)}function Kxe(e){let t=N(e),n=N(_e());if(t===n)return{kind:`absent`};let r=eZ(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=k(i);if(e===i||e===n)return{kind:`absent`};let r=eZ(e,M(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function eZ(e,t){let n=j(e,`.git`),r;try{r=te(n)}catch(e){return tZ(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new $X(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=A(o)?o:N(e,o);try{if(!te(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new $X(`linked`,e,t,n,s)}}function qxe(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=Jxe(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=Yxe(i[1]);if(a.length>0)return a}return null}function Jxe(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function Yxe(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function tZ(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function nZ(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function Xxe(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?nZ(t[1])?{kind:`symbolic`,target:t[1]}:null:rZ(e)?{kind:`oid`,oid:e}:null}function rZ(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}process.platform===`darwin`||process.platform,new Set(sae);const Zxe=Object.values(rt).map(e=>e.mcpServerName.slice(oae.length)).filter(e=>e!==``);RegExp(`^open[-_ ]?knowledge(?:${Zxe.join(`|`)})?$`),new Set(Object.values(rt).map(Tt));const iZ={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},aZ={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},Qxe={cancel_request:`$/cancel_request`},oZ=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function sZ(e,t){let n=e.catch(t);return z().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),Dt):n.parse(e))}function cZ(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function lZ(e,t,n){return e.superRefine((e,r)=>{let i=cZ(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function uZ(e,t,n){return z().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return Dt}let o=a.data,s=cZ(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function dZ(e){return B(e.catch(oZ)).transform(e=>e.filter(e=>e!==oZ))}const fZ=$i([L(),I()]).nullable(),pZ=I(),mZ=V({sessionId:pZ,path:I(),content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),hZ=V({sessionId:pZ,path:I(),line:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gZ=I(),_Z=$i([W(`read`),W(`edit`),W(`delete`),W(`move`),W(`search`),W(`execute`),W(`think`),W(`fetch`),W(`switch_mode`),W(`other`)]),vZ=$i([W(`pending`),W(`in_progress`),W(`completed`),W(`failed`)]),yZ=V({audience:$(dZ($i([W(`assistant`),W(`user`)])).nullish(),()=>void 0),lastModified:$(I().nullish(),()=>void 0),priority:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),$xe=V({annotations:$(yZ.nullish(),()=>void 0),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),eSe=V({annotations:$(yZ.nullish(),()=>void 0),data:I(),mimeType:I(),uri:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),tSe=V({annotations:$(yZ.nullish(),()=>void 0),data:I(),mimeType:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),nSe=V({annotations:$(yZ.nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),mimeType:$(I().nullish(),()=>void 0),name:I(),size:$(L().nullish(),()=>void 0),title:$(I().nullish(),()=>void 0),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),rSe=$i([V({mimeType:$(I().nullish(),()=>void 0),text:I(),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),V({blob:I(),mimeType:$(I().nullish(),()=>void 0),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)})]),iSe=V({annotations:$(yZ.nullish(),()=>void 0),resource:rSe,_meta:$(H(I(),z()).nullish(),()=>void 0)}),bZ=$i([$xe.and(V({type:W(`text`)})),eSe.and(V({type:W(`image`)})),tSe.and(V({type:W(`audio`)})),nSe.and(V({type:W(`resource_link`)})),iSe.and(V({type:W(`resource`)}))]),aSe=V({content:bZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),oSe=V({path:I(),oldText:$(I().nullish(),()=>void 0),newText:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xZ=I(),sSe=V({terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),SZ=$i([aSe.and(V({type:W(`content`)})),oSe.and(V({type:W(`diff`)})),sSe.and(V({type:W(`terminal`)}))]),CZ=V({path:I(),line:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),wZ=V({toolCallId:gZ,kind:$(_Z.nullish(),()=>void 0),status:$(vZ.nullish(),()=>void 0),title:$(I().nullish(),()=>void 0),content:$(dZ(SZ).nullish(),()=>void 0),locations:$(dZ(CZ).nullish(),()=>void 0),rawInput:$(z().optional(),()=>void 0),rawOutput:$(z().optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),TZ=I(),cSe=$i([W(`allow_once`),W(`allow_always`),W(`reject_once`),W(`reject_always`)]),EZ=V({sessionId:pZ,toolCall:wZ,options:B(V({optionId:TZ,name:I(),kind:cSe,_meta:$(H(I(),z()).nullish(),()=>void 0)})),_meta:$(H(I(),z()).nullish(),()=>void 0)}),DZ=V({name:I(),value:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OZ=V({sessionId:pZ,command:I(),args:$(dZ(I()).optional(),()=>[]),env:$(dZ(DZ).optional(),()=>[]),cwd:$(I().nullish(),()=>void 0),outputByteLimit:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),kZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),AZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),jZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),MZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),NZ=V({sessionId:pZ,toolCallId:$(gZ.nullish(),()=>void 0)}),PZ=V({requestId:fZ}),lSe=W(`object`),uSe=$i([W(`email`),W(`uri`),W(`date`),W(`date-time`)]),FZ=V({const:I(),title:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),IZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minLength:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:I().nullish(),format:uSe.nullish(),default:$(I().nullish(),()=>void 0),enum:B(I()).nullish(),oneOf:B(FZ).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),LZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minimum:L().nullish(),maximum:L().nullish(),default:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),RZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minimum:L().nullish(),maximum:L().nullish(),default:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),default:$(R().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),BZ=V({enum:B(I()),_meta:$(H(I(),z()).nullish(),()=>void 0)}),dSe=V({anyOf:B(FZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),fSe=uZ($i([BZ.and(V({type:W(`string`)})),lZ(V({type:I()}),`type`,[`string`]),dSe]),`type`,[`string`]),VZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minItems:L().nullish(),maxItems:L().nullish(),items:fSe,default:$(dZ(I()).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),pSe=uZ($i([IZ.and(V({type:W(`string`)})),LZ.and(V({type:W(`number`)})),RZ.and(V({type:W(`integer`)})),zZ.and(V({type:W(`boolean`)})),VZ.and(V({type:W(`array`)})),lZ(V({type:I()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),mSe=V({type:$(lSe.optional().default(`object`),()=>`object`),title:$(I().nullish(),()=>void 0),properties:H(I(),pSe).optional().default({}),required:B(I()).nullish(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),HZ=ta($i([NZ,PZ]),V({requestedSchema:mSe})),UZ=I(),WZ=ta($i([NZ,PZ]),V({elicitationId:UZ,url:Wi()})),GZ=uZ(ta($i([HZ.and(V({mode:W(`form`)})),WZ.and(V({mode:W(`url`)})),lZ(ta($i([NZ,PZ]),V({mode:I()})),`mode`,[`form`,`url`])]),V({message:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),KZ=I(),hSe=V({serverId:KZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),qZ=I(),JZ=V({connectionId:qZ,method:I(),params:H(I(),z()).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gSe=V({connectionId:qZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),YZ=z();V({id:fZ,method:I(),params:$i([mZ,hZ,EZ,OZ,kZ,AZ,jZ,MZ,GZ,hSe,JZ,gSe,YZ]).nullish()});const XZ=Ki().gte(0).lte(65535),_Se=V({image:$(R().optional().default(!1),()=>!1),audio:$(R().optional().default(!1),()=>!1),embeddedContext:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vSe=V({http:$(R().optional().default(!1),()=>!1),sse:$(R().optional().default(!1),()=>!1),acp:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ySe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),bSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),xSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),SSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),CSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),wSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),TSe=V({list:$(ySe.nullish(),()=>void 0),delete:$(bSe.nullish(),()=>void 0),additionalDirectories:$(xSe.nullish(),()=>void 0),fork:$(SSe.nullish(),()=>void 0),resume:$(CSe.nullish(),()=>void 0),close:$(wSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ESe=V({logout:$(V({_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),DSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),OSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),kSe=V({syncKind:$i([W(`full`),W(`incremental`)]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ASe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),jSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),MSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),NSe=V({document:$(V({didOpen:$(OSe.nullish(),()=>void 0),didChange:$(kSe.nullish(),()=>void 0),didClose:$(ASe.nullish(),()=>void 0),didSave:$(jSe.nullish(),()=>void 0),didFocus:$(MSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),PSe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),FSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),ISe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),LSe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),RSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),zSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),BSe=V({recentFiles:$(PSe.nullish(),()=>void 0),relatedSnippets:$(FSe.nullish(),()=>void 0),editHistory:$(ISe.nullish(),()=>void 0),userActions:$(LSe.nullish(),()=>void 0),openFiles:$(RSe.nullish(),()=>void 0),diagnostics:$(zSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),VSe=V({events:$(NSe.nullish(),()=>void 0),context:$(BSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZZ=$i([W(`utf-16`),W(`utf-32`),W(`utf-8`)]),HSe=V({loadSession:$(R().optional().default(!1),()=>!1),promptCapabilities:$(_Se.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(vSe.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(TSe.optional().default({}),()=>({})),auth:$(ESe.optional().default({}),()=>({})),providers:$(DSe.nullish(),()=>void 0),nes:$(VSe.nullish(),()=>void 0),positionEncoding:$(ZZ.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),QZ=I(),USe=V({name:I(),label:$(I().nullish(),()=>void 0),secret:$(R().optional().default(!0),()=>!0),optional:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),WSe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),vars:sZ(dZ(USe),()=>[]),link:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),GSe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),args:$(dZ(I()).optional(),()=>[]),env:$(H(I(),I()).optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),KSe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),qSe=$i([WSe.and(V({type:W(`env_var`)})),GSe.and(V({type:W(`terminal`)})),KSe]),$Z=V({name:I(),title:$(I().nullish(),()=>void 0),version:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),JSe=V({protocolVersion:XZ,agentCapabilities:$(HSe.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(dZ(qSe).optional().default([]),()=>[]),agentInfo:$($Z.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),YSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),eQ=I(),tQ=$i([W(`anthropic`),W(`openai`),W(`azure`),W(`vertex`),W(`bedrock`),I()]),XSe=V({apiType:tQ,baseUrl:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZSe=V({providers:B(V({providerId:eQ,supported:sZ(dZ(tQ),()=>[]),required:R(),current:XSe.nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)})),_meta:$(H(I(),z()).nullish(),()=>void 0)}),QSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),$Se=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),eCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),nQ=I(),rQ=V({currentModeId:nQ,availableModes:sZ(dZ(V({id:nQ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),iQ=I(),tCe=$i([W(`mode`),W(`model`),W(`model_config`),W(`thought_level`),I()]),aQ=I(),oQ=V({value:aQ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),nCe=V({group:I(),name:I(),options:sZ(dZ(oQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),rCe=V({currentValue:aQ,options:$i([B(oQ),B(nCe)])}),iCe=V({currentValue:R()}),sQ=ta($i([rCe.and(V({type:W(`select`)})),iCe.and(V({type:W(`boolean`)}))]),V({id:iQ,name:I(),description:$(I().nullish(),()=>void 0),category:$(tCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),aCe=V({sessionId:pZ,modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),oCe=V({modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),sCe=V({sessions:sZ(dZ(V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),title:$(I().nullish(),()=>void 0),updatedAt:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),cCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),lCe=V({sessionId:pZ,modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),uCe=V({modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),dCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),fCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),pCe=V({configOptions:sZ(dZ(sQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),mCe=V({stopReason:$i([W(`end_turn`),W(`max_tokens`),W(`max_turn_requests`),W(`refusal`),W(`cancelled`)]),usage:$(V({totalTokens:L(),inputTokens:L(),outputTokens:L(),thoughtTokens:$(L().nullish(),()=>void 0),cachedReadTokens:$(L().nullish(),()=>void 0),cachedWriteTokens:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),hCe=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),cQ=I(),lQ=V({line:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(H(I(),z()).nullish(),()=>void 0)}),uQ=V({start:lQ,end:lQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),gCe=V({range:uQ,newText:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),_Ce=V({id:cQ,uri:I(),edits:B(gCe),cursorPosition:$(lQ.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vCe=V({id:cQ,uri:I(),position:lQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),yCe=V({id:cQ,uri:I(),position:lQ,newName:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),bCe=V({id:cQ,uri:I(),search:I(),replace:I(),isRegex:R().nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xCe=V({suggestions:B($i([_Ce.and(V({kind:W(`edit`)})),vCe.and(V({kind:W(`jump`)})),yCe.and(V({kind:W(`rename`)})),bCe.and(V({kind:W(`searchAndReplace`)}))])),_meta:$(H(I(),z()).nullish(),()=>void 0)}),SCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),dQ=z(),fQ=z(),pQ=V({code:$i([W(-32700),W(-32600),W(-32601),W(-32602),W(-32603),W(-32800),W(-32e3),W(-32002),Ki().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:I(),data:$(z().optional(),()=>void 0)});$i([V({id:fZ,result:$i([JSe,YSe,ZSe,QSe,$Se,eCe,aCe,oCe,sCe,cCe,lCe,uCe,dCe,fCe,pCe,mCe,hCe,xCe,SCe,dQ,fQ])}),V({id:fZ,error:pQ})]);const mQ=V({content:bZ,messageId:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),CCe=V({toolCallId:gZ,title:I(),kind:$(_Z.optional(),()=>void 0),status:$(vZ.optional(),()=>void 0),content:$(dZ(SZ).optional(),()=>[]),locations:$(dZ(CZ).optional(),()=>[]),rawInput:$(z().optional(),()=>void 0),rawOutput:$(z().optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),wCe=$i([W(`high`),W(`medium`),W(`low`)]),TCe=$i([W(`pending`),W(`in_progress`),W(`completed`)]),hQ=V({content:I(),priority:wCe,status:TCe,_meta:$(H(I(),z()).nullish(),()=>void 0)}),ECe=V({entries:sZ(dZ(hQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gQ=I(),DCe=V({planId:gQ,entries:sZ(dZ(hQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OCe=V({planId:gQ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),kCe=V({planId:gQ,content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ACe=V({plan:$i([DCe.and(V({type:W(`items`)})),OCe.and(V({type:W(`file`)})),kCe.and(V({type:W(`markdown`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),jCe=V({planId:gQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),MCe=V({hint:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),NCe=V({availableCommands:sZ(dZ(V({name:I(),description:I(),input:$(MCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),PCe=V({currentModeId:nQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),FCe=V({configOptions:sZ(dZ(sQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ICe=V({title:$(I().nullish(),()=>void 0),updatedAt:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),LCe=V({amount:L(),currency:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),RCe=V({used:L(),size:L(),cost:$(LCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),_Q=V({sessionId:pZ,update:$i([mQ.and(V({sessionUpdate:W(`user_message_chunk`)})),mQ.and(V({sessionUpdate:W(`agent_message_chunk`)})),mQ.and(V({sessionUpdate:W(`agent_thought_chunk`)})),CCe.and(V({sessionUpdate:W(`tool_call`)})),wZ.and(V({sessionUpdate:W(`tool_call_update`)})),ECe.and(V({sessionUpdate:W(`plan`)})),ACe.and(V({sessionUpdate:W(`plan_update`)})),jCe.and(V({sessionUpdate:W(`plan_removed`)})),NCe.and(V({sessionUpdate:W(`available_commands_update`)})),PCe.and(V({sessionUpdate:W(`current_mode_update`)})),FCe.and(V({sessionUpdate:W(`config_option_update`)})),ICe.and(V({sessionUpdate:W(`session_info_update`)})),RCe.and(V({sessionUpdate:W(`usage_update`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vQ=V({elicitationId:UZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),yQ=V({connectionId:qZ,method:I(),params:$(H(I(),z()).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),bQ=z();V({method:I(),params:$i([_Q,vQ,yQ,bQ]).nullish()});const zCe=V({readTextFile:$(R().optional().default(!1),()=>!1),writeTextFile:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),BCe=V({configOptions:$(V({boolean:$(V({_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),VCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),HCe=V({terminal:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),UCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),WCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),GCe=V({form:$(UCe.nullish(),()=>void 0),url:$(WCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),KCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),qCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),JCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),YCe=V({jump:$(KCe.nullish(),()=>void 0),rename:$(qCe.nullish(),()=>void 0),searchAndReplace:$(JCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xQ=V({protocolVersion:XZ,clientCapabilities:$(V({fs:$(zCe.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(R().optional().default(!1),()=>!1),session:$(BCe.nullish(),()=>void 0),plan:$(VCe.nullish(),()=>void 0),auth:$(HCe.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(GCe.nullish(),()=>void 0),nes:$(YCe.nullish(),()=>void 0),positionEncodings:$(dZ(ZZ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$($Z.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),SQ=V({methodId:QZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),CQ=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),wQ=V({providerId:eQ,apiType:tQ,baseUrl:I(),headers:H(I(),I()).optional(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),TQ=V({providerId:eQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),EQ=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),DQ=V({name:I(),value:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),XCe=V({name:I(),url:I(),headers:B(DQ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZCe=V({name:I(),url:I(),headers:B(DQ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),QCe=V({name:I(),serverId:KZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),$Ce=V({name:I(),command:I(),args:B(I()),env:B(DZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OQ=$i([XCe.and(V({type:W(`http`)})),ZCe.and(V({type:W(`sse`)})),QCe.and(V({type:W(`acp`)})),$Ce]),kQ=V({cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:sZ(dZ(OQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),AQ=V({mcpServers:sZ(dZ(OQ),()=>[]),cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),jQ=V({cwd:I().nullish(),cursor:I().nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),MQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),NQ=V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:$(dZ(OQ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),PQ=V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:$(dZ(OQ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),FQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),IQ=V({sessionId:pZ,modeId:nQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),LQ=ta($i([V({value:R(),type:W(`boolean`)}),V({value:aQ})]),V({sessionId:pZ,configId:iQ,_meta:$(H(I(),z()).nullish(),()=>void 0)})),RQ=V({sessionId:pZ,prompt:B(bZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ewe=V({uri:I(),name:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),twe=V({name:I(),owner:I(),remoteUrl:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zQ=V({workspaceUri:$(I().nullish(),()=>void 0),workspaceFolders:B(ewe).nullish(),repository:$(twe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),nwe=$i([W(`automatic`),W(`diagnostic`),W(`manual`)]),rwe=V({uri:I(),languageId:I(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),iwe=V({startLine:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),awe=V({uri:I(),excerpts:B(iwe),_meta:$(H(I(),z()).nullish(),()=>void 0)}),owe=V({uri:I(),diff:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),swe=V({action:I(),uri:I(),position:lQ,timestampMs:L(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),cwe=V({uri:I(),languageId:I(),visibleRange:$(uQ.nullish(),()=>void 0),lastFocusedMs:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),lwe=$i([W(`error`),W(`warning`),W(`information`),W(`hint`)]),uwe=V({uri:I(),range:uQ,severity:lwe,message:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),dwe=V({recentFiles:B(rwe).nullish(),relatedSnippets:B(awe).nullish(),editHistory:B(owe).nullish(),userActions:B(swe).nullish(),openFiles:B(cwe).nullish(),diagnostics:B(uwe).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),BQ=V({sessionId:pZ,uri:I(),version:L(),position:lQ,selection:uQ.nullish(),triggerKind:nwe,context:dwe.nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),VQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)});V({id:fZ,method:I(),params:$i([xQ,SQ,CQ,wQ,TQ,EQ,kQ,AQ,jQ,MQ,NQ,PQ,FQ,IQ,LQ,RQ,zQ,BQ,VQ,JZ,YZ]).nullish()});const fwe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),pwe=V({content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),mwe=V({optionId:TZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),hwe=V({outcome:$i([V({outcome:W(`cancelled`)}),mwe.and(V({outcome:W(`selected`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gwe=V({terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),_we=V({exitCode:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vwe=V({output:I(),truncated:R(),exitStatus:$(_we.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ywe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),bwe=V({exitCode:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xwe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),Swe=$i([I(),L(),L(),R(),B(I())]),HQ=V({content:H(I(),Swe).nullish()});$i([V({id:fZ,result:$i([fwe,pwe,hwe,gwe,vwe,ywe,bwe,xwe,uZ(ta($i([HQ.and(V({action:W(`accept`)})),V({action:W(`decline`)}),V({action:W(`cancel`)}),lZ(V({action:I()}),`action`,[`accept`,`cancel`,`decline`])]),V({_meta:$(H(I(),z()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),V({connectionId:qZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),fQ,dQ])}),V({id:fZ,error:pQ})]);const UQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),WQ=V({sessionId:pZ,uri:I(),languageId:I(),version:L(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),Cwe=V({range:uQ.nullish(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),GQ=V({sessionId:pZ,uri:I(),version:L(),contentChanges:sZ(dZ(Cwe),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),KQ=V({sessionId:pZ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),qQ=V({sessionId:pZ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),JQ=V({sessionId:pZ,uri:I(),version:L(),position:lQ,visibleRange:uQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),YQ=V({sessionId:pZ,id:cQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),XQ=V({sessionId:pZ,id:cQ,reason:$($i([W(`rejected`),W(`ignored`),W(`replaced`),W(`cancelled`)]).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)});V({method:I(),params:$i([UQ,WQ,GQ,KQ,qQ,JQ,YQ,XQ,yQ,bQ]).nullish()}),V({requestId:fZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),HZ.and(V({mode:W(`form`)})).and(V({message:I()})),WZ.and(V({mode:W(`url`)})).and(V({message:I()})),$i([NZ,PZ]).and(V({message:I()})),IZ.and(V({type:W(`string`)})),LZ.and(V({type:W(`number`)})),RZ.and(V({type:W(`integer`)})),zZ.and(V({type:W(`boolean`)})),VZ.and(V({type:W(`array`)})),BZ.and(V({type:W(`string`)})),HQ.and(V({action:W(`accept`)})),V({action:W(`decline`)}),V({action:W(`cancel`)});function ZQ(e){return e??{}}iZ.initialize,iZ.authenticate,iZ.logout,iZ.providers_list,iZ.providers_set,iZ.providers_disable,iZ.session_new,iZ.session_load,iZ.session_list,iZ.session_delete,iZ.session_fork,iZ.session_resume,iZ.session_close,iZ.session_set_mode,iZ.session_set_config_option,iZ.session_prompt,iZ.session_cancel,iZ.nes_start,iZ.nes_suggest,iZ.nes_accept,iZ.nes_reject,iZ.nes_close,iZ.document_did_open,iZ.document_did_change,iZ.document_did_close,iZ.document_did_save,iZ.document_did_focus,aZ.session_request_permission,aZ.session_update,aZ.fs_write_text_file,aZ.fs_read_text_file,aZ.terminal_create,aZ.terminal_output,aZ.terminal_release,aZ.terminal_wait_for_exit,aZ.terminal_kill,aZ.elicitation_create,aZ.elicitation_complete,Qxe.cancel_request;function QQ(e,t,n){return{method:e,params:t,mapResponse:n}}function $Q(e,t){return{method:e,params:t}}function e$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const wwe={initialize:QQ(iZ.initialize,xQ),newSession:QQ(iZ.session_new,kQ),loadSession:QQ(iZ.session_load,AQ,ZQ),unstable_forkSession:QQ(iZ.session_fork,NQ),listSessions:QQ(iZ.session_list,jQ),deleteSession:QQ(iZ.session_delete,MQ,ZQ),resumeSession:QQ(iZ.session_resume,PQ),closeSession:QQ(iZ.session_close,FQ,ZQ),setSessionMode:QQ(iZ.session_set_mode,IQ,ZQ),setSessionConfigOption:QQ(iZ.session_set_config_option,LQ),authenticate:QQ(iZ.authenticate,SQ,ZQ),unstable_listProviders:QQ(iZ.providers_list,CQ),unstable_setProvider:QQ(iZ.providers_set,wQ,ZQ),unstable_disableProvider:QQ(iZ.providers_disable,TQ,ZQ),logout:QQ(iZ.logout,EQ,ZQ),prompt:QQ(iZ.session_prompt,RQ),unstable_startNes:QQ(iZ.nes_start,zQ),unstable_suggestNes:QQ(iZ.nes_suggest,BQ),unstable_closeNes:QQ(iZ.nes_close,VQ,ZQ)},Twe={cancel:$Q(iZ.session_cancel,UQ),unstable_didOpenDocument:$Q(iZ.document_did_open,WQ),unstable_didChangeDocument:$Q(iZ.document_did_change,GQ),unstable_didCloseDocument:$Q(iZ.document_did_close,KQ),unstable_didSaveDocument:$Q(iZ.document_did_save,qQ),unstable_didFocusDocument:$Q(iZ.document_did_focus,JQ),unstable_acceptNes:$Q(iZ.nes_accept,YQ),unstable_rejectNes:$Q(iZ.nes_reject,XQ)},Ewe={requestPermission:QQ(aZ.session_request_permission,EZ),writeTextFile:QQ(aZ.fs_write_text_file,mZ,ZQ),readTextFile:QQ(aZ.fs_read_text_file,hZ),createTerminal:QQ(aZ.terminal_create,OZ),terminalOutput:QQ(aZ.terminal_output,kZ),releaseTerminal:QQ(aZ.terminal_release,AZ,ZQ),waitForTerminalExit:QQ(aZ.terminal_wait_for_exit,jZ),killTerminal:QQ(aZ.terminal_kill,MZ,ZQ),unstable_createElicitation:QQ(aZ.elicitation_create,GZ)},Dwe={sessionUpdate:$Q(aZ.session_update,_Q),unstable_completeElicitation:$Q(aZ.elicitation_complete,vQ)};e$(wwe),e$(Twe),e$(Ewe),e$(Dwe),iZ.initialize,iZ.authenticate,iZ.providers_list,iZ.providers_set,iZ.providers_disable,iZ.session_new,iZ.session_load,iZ.session_set_mode,iZ.session_set_config_option,iZ.session_prompt,iZ.session_list,iZ.session_delete,iZ.session_fork,iZ.session_resume,iZ.session_close,iZ.logout,iZ.nes_start,iZ.nes_suggest,iZ.nes_close,iZ.session_cancel,iZ.nes_accept,iZ.nes_reject,iZ.document_did_open,iZ.document_did_change,iZ.document_did_close,iZ.document_did_save,iZ.document_did_focus,aZ.session_request_permission,aZ.fs_write_text_file,aZ.fs_read_text_file,aZ.terminal_create,aZ.terminal_output,aZ.terminal_release,aZ.terminal_wait_for_exit,aZ.terminal_kill,aZ.elicitation_create,aZ.session_update,aZ.elicitation_complete;var Owe=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),t$=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=Owe(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),kwe=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=t$()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),Awe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),jwe=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=Awe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),Mwe=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=jwe();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
721
+ `,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors){if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`)}let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,O=r(e.colorize,w,b),ee=e.colorizeObjects?O:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:O,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:ee,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),kxe=nX(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),RX=nX(((e,t)=>{t.exports=r;let n=LX();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),zX=nX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=SX(),r=kxe(),i=LX(),a=RX();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),BX=nX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=SX(),r=IX(),i=LX(),a=zX();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),VX=nX(((e,t)=>{t.exports=r;let n=kX();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),HX=nX(((e,t)=>{t.exports=a;let{LEVELS:n}=SX(),r=kX(),i=FX();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&(typeof e[u]==`string`||typeof e[u]==`number`||typeof e[u]==`boolean`))return a.message(e[u])}})),UX=nX(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),WX=nX(((e,t)=>{t.exports=r;let n=MX();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),Axe=nX(((e,t)=>{t.exports={buildSafeSonicBoom:Txe(),createDate:DX(),deleteLogProperty:AX(),filterLog:jX(),formatTime:MX(),getPropertyValue:kX(),handleCustomLevelsNamesOpts:NX(),handleCustomLevelsOpts:PX(),interpretConditionals:FX(),isObject:IX(),isValidDate:EX(),joinLinesWithIndentation:LX(),noop:TX(),parseFactoryOptions:Oxe(),prettifyErrorLog:BX(),prettifyError:RX(),prettifyLevel:VX(),prettifyMessage:HX(),prettifyMetadata:UX(),prettifyObject:zX(),prettifyTime:WX(),splitPropertyKey:OX(),getLevelLabelData:CX()}})),jxe=nX(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),Mxe=nX(((e,t)=>{t.exports=h;let n=jxe(),r=IX(),i=BX(),a=VX(),o=HX(),s=UX(),c=zX(),l=WX(),u=jX(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=SX(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),Nxe=nX(((e,t)=>{let{isColorSupported:n}=bX(),r=Sxe(),{Transform:i}=iX(`node:stream`),a=wxe(),o=wX(),{ERROR_LIKE_KEYS:s,LEVEL_KEY:c,LEVEL_LABEL:l,MESSAGE_KEY:u,TIMESTAMP_KEY:d}=SX(),{buildSafeSonicBoom:f,parseFactoryOptions:p}=Axe(),m=Mxe(),h={colorize:n,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:s,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:c,levelLabel:l,messageFormat:null,messageKey:u,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:d,translateTime:!0,useOnlyCustomProps:!0};function g(e){let t=p(Object.assign({},h,e));return m.bind({...t,context:t})}function _(e={}){let t=g(e),n;return a(function(a){a.on(`message`,function n(r){!r||r.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:r.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||s,r.config.errorKey])),customLevels:r.config.levels.values}),t=g(e),a.off(`message`,n))});let o=new i({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:f({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),a.on(`unknown`,function(e){n.write(e+`
722
+ `)}),r(a,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}t.exports=_,t.exports.build=_,t.exports.PinoPretty=_,t.exports.prettyFactory=g,t.exports.colorizerFactory=o,t.exports.isColorSupported=n,t.exports.default=_})),GX=rX(yX(),1),Pxe=rX(Nxe(),1);const KX=new Map;function Fxe(e){let t=KX.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},KX.set(e,t)),t}var Ixe=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=Fxe(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await De(k(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Ne(this.#e,e,{flag:`a`});let t;try{t=te(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await je(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const qX=[`.ok`,`local`,`logs`];function Lxe(e){return j(e,...qX,`server-current.jsonl`)}function Rxe(e){return j(e,...qX,`server-prev.jsonl`)}var JX=class extends Le{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new Ixe({currentPath:Lxe(e.projectDir),previousPath:Rxe(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function zxe(){let e=Ju.getSpan(Gu.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function Bxe(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const YX=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function XX(e){return e===`silent`?1/0:GX.default.levels.values[e]??GX.default.levels.values.info}function ZX(e,t){return XX(e)<=XX(t)?e:t}var Vxe=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:GX.default.stdSerializers.err,error:GX.default.stdSerializers.err},mixin:zxe,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&YX.has(t)?t:e===`silent`?`silent`:ZX(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&YX.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:ZX(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,GX.default)(this.options,GX.default.transport({targets:this.transportConfigs}));let r;try{r=(0,Pxe.default)({colorize:Bxe(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new JX(this.fileSinkOpts);return this.activeFileSink=t,(0,GX.default)({...this.options,level:n},GX.default.multistream([{stream:t,level:e}]))}return(0,GX.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new JX(this.fileSinkOpts);return this.activeFileSink=i,(0,GX.default)({...this.options,level:n},GX.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,GX.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const Hxe=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new Vxe(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function QX(e){return Hxe.getLogger(e)}new rve({extensions:sP,deriveStructuralFreshness:!0}),yO(sP);var $X=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(j(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=A(t)?t:N(this.gitDir,t))}catch(e){if(!tZ(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(j(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return tZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:rZ(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(j(t.path,`config`),`utf-8`)}catch(e){return tZ(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=Gxe(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!nZ(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=N(t.path,e),r=M(t.path,n);if(r.startsWith(`..`)||A(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=Jxe(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!tZ(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(j(t.path,`packed-refs`),`utf-8`)}catch(e){return tZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return rZ(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function Uxe(e){return eZ(N(e),``)}function Wxe(e){let t=N(e),n=N(_e());if(t===n)return{kind:`absent`};let r=eZ(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=k(i);if(e===i||e===n)return{kind:`absent`};let r=eZ(e,M(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function eZ(e,t){let n=j(e,`.git`),r;try{r=te(n)}catch(e){return tZ(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new $X(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=A(o)?o:N(e,o);try{if(!te(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new $X(`linked`,e,t,n,s)}}function Gxe(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=Kxe(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=qxe(i[1]);if(a.length>0)return a}return null}function Kxe(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function qxe(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function tZ(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function nZ(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function Jxe(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?nZ(t[1])?{kind:`symbolic`,target:t[1]}:null:rZ(e)?{kind:`oid`,oid:e}:null}function rZ(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}process.platform===`darwin`||process.platform,new Set(sae);const Yxe=Object.values(rt).map(e=>e.mcpServerName.slice(oae.length)).filter(e=>e!==``);RegExp(`^open[-_ ]?knowledge(?:${Yxe.join(`|`)})?$`),new Set(Object.values(rt).map(Tt));const iZ={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},aZ={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},Xxe={cancel_request:`$/cancel_request`},oZ=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function sZ(e,t){let n=e.catch(t);return z().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),Dt):n.parse(e))}function cZ(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function lZ(e,t,n){return e.superRefine((e,r)=>{let i=cZ(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function uZ(e,t,n){return z().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return Dt}let o=a.data,s=cZ(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function dZ(e){return B(e.catch(oZ)).transform(e=>e.filter(e=>e!==oZ))}const fZ=$i([L(),I()]).nullable(),pZ=I(),mZ=V({sessionId:pZ,path:I(),content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),hZ=V({sessionId:pZ,path:I(),line:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gZ=I(),_Z=$i([W(`read`),W(`edit`),W(`delete`),W(`move`),W(`search`),W(`execute`),W(`think`),W(`fetch`),W(`switch_mode`),W(`other`)]),vZ=$i([W(`pending`),W(`in_progress`),W(`completed`),W(`failed`)]),yZ=V({audience:$(dZ($i([W(`assistant`),W(`user`)])).nullish(),()=>void 0),lastModified:$(I().nullish(),()=>void 0),priority:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),Zxe=V({annotations:$(yZ.nullish(),()=>void 0),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),Qxe=V({annotations:$(yZ.nullish(),()=>void 0),data:I(),mimeType:I(),uri:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),$xe=V({annotations:$(yZ.nullish(),()=>void 0),data:I(),mimeType:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),eSe=V({annotations:$(yZ.nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),mimeType:$(I().nullish(),()=>void 0),name:I(),size:$(L().nullish(),()=>void 0),title:$(I().nullish(),()=>void 0),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),tSe=$i([V({mimeType:$(I().nullish(),()=>void 0),text:I(),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),V({blob:I(),mimeType:$(I().nullish(),()=>void 0),uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)})]),nSe=V({annotations:$(yZ.nullish(),()=>void 0),resource:tSe,_meta:$(H(I(),z()).nullish(),()=>void 0)}),bZ=$i([Zxe.and(V({type:W(`text`)})),Qxe.and(V({type:W(`image`)})),$xe.and(V({type:W(`audio`)})),eSe.and(V({type:W(`resource_link`)})),nSe.and(V({type:W(`resource`)}))]),rSe=V({content:bZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),iSe=V({path:I(),oldText:$(I().nullish(),()=>void 0),newText:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xZ=I(),aSe=V({terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),SZ=$i([rSe.and(V({type:W(`content`)})),iSe.and(V({type:W(`diff`)})),aSe.and(V({type:W(`terminal`)}))]),CZ=V({path:I(),line:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),wZ=V({toolCallId:gZ,kind:$(_Z.nullish(),()=>void 0),status:$(vZ.nullish(),()=>void 0),title:$(I().nullish(),()=>void 0),content:$(dZ(SZ).nullish(),()=>void 0),locations:$(dZ(CZ).nullish(),()=>void 0),rawInput:$(z().optional(),()=>void 0),rawOutput:$(z().optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),TZ=I(),oSe=$i([W(`allow_once`),W(`allow_always`),W(`reject_once`),W(`reject_always`)]),EZ=V({sessionId:pZ,toolCall:wZ,options:B(V({optionId:TZ,name:I(),kind:oSe,_meta:$(H(I(),z()).nullish(),()=>void 0)})),_meta:$(H(I(),z()).nullish(),()=>void 0)}),DZ=V({name:I(),value:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OZ=V({sessionId:pZ,command:I(),args:$(dZ(I()).optional(),()=>[]),env:$(dZ(DZ).optional(),()=>[]),cwd:$(I().nullish(),()=>void 0),outputByteLimit:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),kZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),AZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),jZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),MZ=V({sessionId:pZ,terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),NZ=V({sessionId:pZ,toolCallId:$(gZ.nullish(),()=>void 0)}),PZ=V({requestId:fZ}),sSe=W(`object`),cSe=$i([W(`email`),W(`uri`),W(`date`),W(`date-time`)]),FZ=V({const:I(),title:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),IZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minLength:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:I().nullish(),format:cSe.nullish(),default:$(I().nullish(),()=>void 0),enum:B(I()).nullish(),oneOf:B(FZ).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),LZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minimum:L().nullish(),maximum:L().nullish(),default:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),RZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minimum:L().nullish(),maximum:L().nullish(),default:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),default:$(R().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),BZ=V({enum:B(I()),_meta:$(H(I(),z()).nullish(),()=>void 0)}),lSe=V({anyOf:B(FZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),uSe=uZ($i([BZ.and(V({type:W(`string`)})),lZ(V({type:I()}),`type`,[`string`]),lSe]),`type`,[`string`]),VZ=V({title:$(I().nullish(),()=>void 0),description:$(I().nullish(),()=>void 0),minItems:L().nullish(),maxItems:L().nullish(),items:uSe,default:$(dZ(I()).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),dSe=uZ($i([IZ.and(V({type:W(`string`)})),LZ.and(V({type:W(`number`)})),RZ.and(V({type:W(`integer`)})),zZ.and(V({type:W(`boolean`)})),VZ.and(V({type:W(`array`)})),lZ(V({type:I()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),fSe=V({type:$(sSe.optional().default(`object`),()=>`object`),title:$(I().nullish(),()=>void 0),properties:H(I(),dSe).optional().default({}),required:B(I()).nullish(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),HZ=ta($i([NZ,PZ]),V({requestedSchema:fSe})),UZ=I(),WZ=ta($i([NZ,PZ]),V({elicitationId:UZ,url:Wi()})),GZ=uZ(ta($i([HZ.and(V({mode:W(`form`)})),WZ.and(V({mode:W(`url`)})),lZ(ta($i([NZ,PZ]),V({mode:I()})),`mode`,[`form`,`url`])]),V({message:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),KZ=I(),pSe=V({serverId:KZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),qZ=I(),JZ=V({connectionId:qZ,method:I(),params:H(I(),z()).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),mSe=V({connectionId:qZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),YZ=z();V({id:fZ,method:I(),params:$i([mZ,hZ,EZ,OZ,kZ,AZ,jZ,MZ,GZ,pSe,JZ,mSe,YZ]).nullish()});const XZ=Ki().gte(0).lte(65535),hSe=V({image:$(R().optional().default(!1),()=>!1),audio:$(R().optional().default(!1),()=>!1),embeddedContext:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gSe=V({http:$(R().optional().default(!1),()=>!1),sse:$(R().optional().default(!1),()=>!1),acp:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),_Se=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),vSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),ySe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),bSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),xSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),SSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),CSe=V({list:$(_Se.nullish(),()=>void 0),delete:$(vSe.nullish(),()=>void 0),additionalDirectories:$(ySe.nullish(),()=>void 0),fork:$(bSe.nullish(),()=>void 0),resume:$(xSe.nullish(),()=>void 0),close:$(SSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),wSe=V({logout:$(V({_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),TSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),ESe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),DSe=V({syncKind:$i([W(`full`),W(`incremental`)]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),kSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),ASe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),jSe=V({document:$(V({didOpen:$(ESe.nullish(),()=>void 0),didChange:$(DSe.nullish(),()=>void 0),didClose:$(OSe.nullish(),()=>void 0),didSave:$(kSe.nullish(),()=>void 0),didFocus:$(ASe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),MSe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),NSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),PSe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),FSe=V({maxCount:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ISe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),LSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),RSe=V({recentFiles:$(MSe.nullish(),()=>void 0),relatedSnippets:$(NSe.nullish(),()=>void 0),editHistory:$(PSe.nullish(),()=>void 0),userActions:$(FSe.nullish(),()=>void 0),openFiles:$(ISe.nullish(),()=>void 0),diagnostics:$(LSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zSe=V({events:$(jSe.nullish(),()=>void 0),context:$(RSe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZZ=$i([W(`utf-16`),W(`utf-32`),W(`utf-8`)]),BSe=V({loadSession:$(R().optional().default(!1),()=>!1),promptCapabilities:$(hSe.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(gSe.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(CSe.optional().default({}),()=>({})),auth:$(wSe.optional().default({}),()=>({})),providers:$(TSe.nullish(),()=>void 0),nes:$(zSe.nullish(),()=>void 0),positionEncoding:$(ZZ.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),QZ=I(),VSe=V({name:I(),label:$(I().nullish(),()=>void 0),secret:$(R().optional().default(!0),()=>!0),optional:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),HSe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),vars:sZ(dZ(VSe),()=>[]),link:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),USe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),args:$(dZ(I()).optional(),()=>[]),env:$(H(I(),I()).optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),WSe=V({id:QZ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),GSe=$i([HSe.and(V({type:W(`env_var`)})),USe.and(V({type:W(`terminal`)})),WSe]),$Z=V({name:I(),title:$(I().nullish(),()=>void 0),version:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),KSe=V({protocolVersion:XZ,agentCapabilities:$(BSe.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(dZ(GSe).optional().default([]),()=>[]),agentInfo:$($Z.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),qSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),eQ=I(),tQ=$i([W(`anthropic`),W(`openai`),W(`azure`),W(`vertex`),W(`bedrock`),I()]),JSe=V({apiType:tQ,baseUrl:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),YSe=V({providers:B(V({providerId:eQ,supported:sZ(dZ(tQ),()=>[]),required:R(),current:JSe.nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)})),_meta:$(H(I(),z()).nullish(),()=>void 0)}),XSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),QSe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),nQ=I(),rQ=V({currentModeId:nQ,availableModes:sZ(dZ(V({id:nQ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),iQ=I(),$Se=$i([W(`mode`),W(`model`),W(`model_config`),W(`thought_level`),I()]),aQ=I(),oQ=V({value:aQ,name:I(),description:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),eCe=V({group:I(),name:I(),options:sZ(dZ(oQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),tCe=V({currentValue:aQ,options:$i([B(oQ),B(eCe)])}),nCe=V({currentValue:R()}),sQ=ta($i([tCe.and(V({type:W(`select`)})),nCe.and(V({type:W(`boolean`)}))]),V({id:iQ,name:I(),description:$(I().nullish(),()=>void 0),category:$($Se.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),rCe=V({sessionId:pZ,modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),iCe=V({modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),aCe=V({sessions:sZ(dZ(V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),title:$(I().nullish(),()=>void 0),updatedAt:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),oCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),sCe=V({sessionId:pZ,modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),cCe=V({modes:$(rQ.nullish(),()=>void 0),configOptions:$(dZ(sQ).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),lCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),uCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),dCe=V({configOptions:sZ(dZ(sQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),fCe=V({stopReason:$i([W(`end_turn`),W(`max_tokens`),W(`max_turn_requests`),W(`refusal`),W(`cancelled`)]),usage:$(V({totalTokens:L(),inputTokens:L(),outputTokens:L(),thoughtTokens:$(L().nullish(),()=>void 0),cachedReadTokens:$(L().nullish(),()=>void 0),cachedWriteTokens:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),pCe=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),cQ=I(),lQ=V({line:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(H(I(),z()).nullish(),()=>void 0)}),uQ=V({start:lQ,end:lQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),mCe=V({range:uQ,newText:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),hCe=V({id:cQ,uri:I(),edits:B(mCe),cursorPosition:$(lQ.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gCe=V({id:cQ,uri:I(),position:lQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),_Ce=V({id:cQ,uri:I(),position:lQ,newName:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vCe=V({id:cQ,uri:I(),search:I(),replace:I(),isRegex:R().nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),yCe=V({suggestions:B($i([hCe.and(V({kind:W(`edit`)})),gCe.and(V({kind:W(`jump`)})),_Ce.and(V({kind:W(`rename`)})),vCe.and(V({kind:W(`searchAndReplace`)}))])),_meta:$(H(I(),z()).nullish(),()=>void 0)}),bCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),dQ=z(),fQ=z(),pQ=V({code:$i([W(-32700),W(-32600),W(-32601),W(-32602),W(-32603),W(-32800),W(-32e3),W(-32002),Ki().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:I(),data:$(z().optional(),()=>void 0)});$i([V({id:fZ,result:$i([KSe,qSe,YSe,XSe,ZSe,QSe,rCe,iCe,aCe,oCe,sCe,cCe,lCe,uCe,dCe,fCe,pCe,yCe,bCe,dQ,fQ])}),V({id:fZ,error:pQ})]);const mQ=V({content:bZ,messageId:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xCe=V({toolCallId:gZ,title:I(),kind:$(_Z.optional(),()=>void 0),status:$(vZ.optional(),()=>void 0),content:$(dZ(SZ).optional(),()=>[]),locations:$(dZ(CZ).optional(),()=>[]),rawInput:$(z().optional(),()=>void 0),rawOutput:$(z().optional(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),SCe=$i([W(`high`),W(`medium`),W(`low`)]),CCe=$i([W(`pending`),W(`in_progress`),W(`completed`)]),hQ=V({content:I(),priority:SCe,status:CCe,_meta:$(H(I(),z()).nullish(),()=>void 0)}),wCe=V({entries:sZ(dZ(hQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gQ=I(),TCe=V({planId:gQ,entries:sZ(dZ(hQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ECe=V({planId:gQ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),DCe=V({planId:gQ,content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OCe=V({plan:$i([TCe.and(V({type:W(`items`)})),ECe.and(V({type:W(`file`)})),DCe.and(V({type:W(`markdown`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),kCe=V({planId:gQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),ACe=V({hint:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),jCe=V({availableCommands:sZ(dZ(V({name:I(),description:I(),input:$(ACe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),MCe=V({currentModeId:nQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),NCe=V({configOptions:sZ(dZ(sQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),PCe=V({title:$(I().nullish(),()=>void 0),updatedAt:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),FCe=V({amount:L(),currency:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ICe=V({used:L(),size:L(),cost:$(FCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),_Q=V({sessionId:pZ,update:$i([mQ.and(V({sessionUpdate:W(`user_message_chunk`)})),mQ.and(V({sessionUpdate:W(`agent_message_chunk`)})),mQ.and(V({sessionUpdate:W(`agent_thought_chunk`)})),xCe.and(V({sessionUpdate:W(`tool_call`)})),wZ.and(V({sessionUpdate:W(`tool_call_update`)})),wCe.and(V({sessionUpdate:W(`plan`)})),OCe.and(V({sessionUpdate:W(`plan_update`)})),kCe.and(V({sessionUpdate:W(`plan_removed`)})),jCe.and(V({sessionUpdate:W(`available_commands_update`)})),MCe.and(V({sessionUpdate:W(`current_mode_update`)})),NCe.and(V({sessionUpdate:W(`config_option_update`)})),PCe.and(V({sessionUpdate:W(`session_info_update`)})),ICe.and(V({sessionUpdate:W(`usage_update`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),vQ=V({elicitationId:UZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),yQ=V({connectionId:qZ,method:I(),params:$(H(I(),z()).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),bQ=z();V({method:I(),params:$i([_Q,vQ,yQ,bQ]).nullish()});const LCe=V({readTextFile:$(R().optional().default(!1),()=>!1),writeTextFile:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),RCe=V({configOptions:$(V({boolean:$(V({_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),BCe=V({terminal:$(R().optional().default(!1),()=>!1),_meta:$(H(I(),z()).nullish(),()=>void 0)}),VCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),HCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),UCe=V({form:$(VCe.nullish(),()=>void 0),url:$(HCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),WCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),GCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),KCe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),qCe=V({jump:$(WCe.nullish(),()=>void 0),rename:$(GCe.nullish(),()=>void 0),searchAndReplace:$(KCe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xQ=V({protocolVersion:XZ,clientCapabilities:$(V({fs:$(LCe.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(R().optional().default(!1),()=>!1),session:$(RCe.nullish(),()=>void 0),plan:$(zCe.nullish(),()=>void 0),auth:$(BCe.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(UCe.nullish(),()=>void 0),nes:$(qCe.nullish(),()=>void 0),positionEncodings:$(dZ(ZZ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$($Z.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),SQ=V({methodId:QZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),CQ=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),wQ=V({providerId:eQ,apiType:tQ,baseUrl:I(),headers:H(I(),I()).optional(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),TQ=V({providerId:eQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),EQ=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),DQ=V({name:I(),value:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),JCe=V({name:I(),url:I(),headers:B(DQ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),YCe=V({name:I(),url:I(),headers:B(DQ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),XCe=V({name:I(),serverId:KZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),ZCe=V({name:I(),command:I(),args:B(I()),env:B(DZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),OQ=$i([JCe.and(V({type:W(`http`)})),YCe.and(V({type:W(`sse`)})),XCe.and(V({type:W(`acp`)})),ZCe]),kQ=V({cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:sZ(dZ(OQ),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),AQ=V({mcpServers:sZ(dZ(OQ),()=>[]),cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),jQ=V({cwd:I().nullish(),cursor:I().nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),MQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),NQ=V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:$(dZ(OQ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),PQ=V({sessionId:pZ,cwd:I(),additionalDirectories:$(dZ(I()).optional(),()=>[]),mcpServers:$(dZ(OQ).optional(),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),FQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),IQ=V({sessionId:pZ,modeId:nQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),LQ=ta($i([V({value:R(),type:W(`boolean`)}),V({value:aQ})]),V({sessionId:pZ,configId:iQ,_meta:$(H(I(),z()).nullish(),()=>void 0)})),RQ=V({sessionId:pZ,prompt:B(bZ),_meta:$(H(I(),z()).nullish(),()=>void 0)}),QCe=V({uri:I(),name:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),$Ce=V({name:I(),owner:I(),remoteUrl:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),zQ=V({workspaceUri:$(I().nullish(),()=>void 0),workspaceFolders:B(QCe).nullish(),repository:$($Ce.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ewe=$i([W(`automatic`),W(`diagnostic`),W(`manual`)]),twe=V({uri:I(),languageId:I(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),nwe=V({startLine:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),rwe=V({uri:I(),excerpts:B(nwe),_meta:$(H(I(),z()).nullish(),()=>void 0)}),iwe=V({uri:I(),diff:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),awe=V({action:I(),uri:I(),position:lQ,timestampMs:L(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),owe=V({uri:I(),languageId:I(),visibleRange:$(uQ.nullish(),()=>void 0),lastFocusedMs:$(L().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),swe=$i([W(`error`),W(`warning`),W(`information`),W(`hint`)]),cwe=V({uri:I(),range:uQ,severity:swe,message:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),lwe=V({recentFiles:B(twe).nullish(),relatedSnippets:B(rwe).nullish(),editHistory:B(iwe).nullish(),userActions:B(awe).nullish(),openFiles:B(owe).nullish(),diagnostics:B(cwe).nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),BQ=V({sessionId:pZ,uri:I(),version:L(),position:lQ,selection:uQ.nullish(),triggerKind:ewe,context:lwe.nullish(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),VQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)});V({id:fZ,method:I(),params:$i([xQ,SQ,CQ,wQ,TQ,EQ,kQ,AQ,jQ,MQ,NQ,PQ,FQ,IQ,LQ,RQ,zQ,BQ,VQ,JZ,YZ]).nullish()});const uwe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),dwe=V({content:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),fwe=V({optionId:TZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),pwe=V({outcome:$i([V({outcome:W(`cancelled`)}),fwe.and(V({outcome:W(`selected`)}))]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),mwe=V({terminalId:xZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),hwe=V({exitCode:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),gwe=V({output:I(),truncated:R(),exitStatus:$(hwe.nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),_we=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),vwe=V({exitCode:$(Ki().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(I().nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)}),ywe=V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),bwe=$i([I(),L(),L(),R(),B(I())]),HQ=V({content:H(I(),bwe).nullish()});$i([V({id:fZ,result:$i([uwe,dwe,pwe,mwe,gwe,_we,vwe,ywe,uZ(ta($i([HQ.and(V({action:W(`accept`)})),V({action:W(`decline`)}),V({action:W(`cancel`)}),lZ(V({action:I()}),`action`,[`accept`,`cancel`,`decline`])]),V({_meta:$(H(I(),z()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),V({connectionId:qZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),V({_meta:$(H(I(),z()).nullish(),()=>void 0)}),fQ,dQ])}),V({id:fZ,error:pQ})]);const UQ=V({sessionId:pZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),WQ=V({sessionId:pZ,uri:I(),languageId:I(),version:L(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),xwe=V({range:uQ.nullish(),text:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),GQ=V({sessionId:pZ,uri:I(),version:L(),contentChanges:sZ(dZ(xwe),()=>[]),_meta:$(H(I(),z()).nullish(),()=>void 0)}),KQ=V({sessionId:pZ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),qQ=V({sessionId:pZ,uri:I(),_meta:$(H(I(),z()).nullish(),()=>void 0)}),JQ=V({sessionId:pZ,uri:I(),version:L(),position:lQ,visibleRange:uQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),YQ=V({sessionId:pZ,id:cQ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),XQ=V({sessionId:pZ,id:cQ,reason:$($i([W(`rejected`),W(`ignored`),W(`replaced`),W(`cancelled`)]).nullish(),()=>void 0),_meta:$(H(I(),z()).nullish(),()=>void 0)});V({method:I(),params:$i([UQ,WQ,GQ,KQ,qQ,JQ,YQ,XQ,yQ,bQ]).nullish()}),V({requestId:fZ,_meta:$(H(I(),z()).nullish(),()=>void 0)}),HZ.and(V({mode:W(`form`)})).and(V({message:I()})),WZ.and(V({mode:W(`url`)})).and(V({message:I()})),$i([NZ,PZ]).and(V({message:I()})),IZ.and(V({type:W(`string`)})),LZ.and(V({type:W(`number`)})),RZ.and(V({type:W(`integer`)})),zZ.and(V({type:W(`boolean`)})),VZ.and(V({type:W(`array`)})),BZ.and(V({type:W(`string`)})),HQ.and(V({action:W(`accept`)})),V({action:W(`decline`)}),V({action:W(`cancel`)});function ZQ(e){return e??{}}iZ.initialize,iZ.authenticate,iZ.logout,iZ.providers_list,iZ.providers_set,iZ.providers_disable,iZ.session_new,iZ.session_load,iZ.session_list,iZ.session_delete,iZ.session_fork,iZ.session_resume,iZ.session_close,iZ.session_set_mode,iZ.session_set_config_option,iZ.session_prompt,iZ.session_cancel,iZ.nes_start,iZ.nes_suggest,iZ.nes_accept,iZ.nes_reject,iZ.nes_close,iZ.document_did_open,iZ.document_did_change,iZ.document_did_close,iZ.document_did_save,iZ.document_did_focus,aZ.session_request_permission,aZ.session_update,aZ.fs_write_text_file,aZ.fs_read_text_file,aZ.terminal_create,aZ.terminal_output,aZ.terminal_release,aZ.terminal_wait_for_exit,aZ.terminal_kill,aZ.elicitation_create,aZ.elicitation_complete,Xxe.cancel_request;function QQ(e,t,n){return{method:e,params:t,mapResponse:n}}function $Q(e,t){return{method:e,params:t}}function e$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const Swe={initialize:QQ(iZ.initialize,xQ),newSession:QQ(iZ.session_new,kQ),loadSession:QQ(iZ.session_load,AQ,ZQ),unstable_forkSession:QQ(iZ.session_fork,NQ),listSessions:QQ(iZ.session_list,jQ),deleteSession:QQ(iZ.session_delete,MQ,ZQ),resumeSession:QQ(iZ.session_resume,PQ),closeSession:QQ(iZ.session_close,FQ,ZQ),setSessionMode:QQ(iZ.session_set_mode,IQ,ZQ),setSessionConfigOption:QQ(iZ.session_set_config_option,LQ),authenticate:QQ(iZ.authenticate,SQ,ZQ),unstable_listProviders:QQ(iZ.providers_list,CQ),unstable_setProvider:QQ(iZ.providers_set,wQ,ZQ),unstable_disableProvider:QQ(iZ.providers_disable,TQ,ZQ),logout:QQ(iZ.logout,EQ,ZQ),prompt:QQ(iZ.session_prompt,RQ),unstable_startNes:QQ(iZ.nes_start,zQ),unstable_suggestNes:QQ(iZ.nes_suggest,BQ),unstable_closeNes:QQ(iZ.nes_close,VQ,ZQ)},Cwe={cancel:$Q(iZ.session_cancel,UQ),unstable_didOpenDocument:$Q(iZ.document_did_open,WQ),unstable_didChangeDocument:$Q(iZ.document_did_change,GQ),unstable_didCloseDocument:$Q(iZ.document_did_close,KQ),unstable_didSaveDocument:$Q(iZ.document_did_save,qQ),unstable_didFocusDocument:$Q(iZ.document_did_focus,JQ),unstable_acceptNes:$Q(iZ.nes_accept,YQ),unstable_rejectNes:$Q(iZ.nes_reject,XQ)},wwe={requestPermission:QQ(aZ.session_request_permission,EZ),writeTextFile:QQ(aZ.fs_write_text_file,mZ,ZQ),readTextFile:QQ(aZ.fs_read_text_file,hZ),createTerminal:QQ(aZ.terminal_create,OZ),terminalOutput:QQ(aZ.terminal_output,kZ),releaseTerminal:QQ(aZ.terminal_release,AZ,ZQ),waitForTerminalExit:QQ(aZ.terminal_wait_for_exit,jZ),killTerminal:QQ(aZ.terminal_kill,MZ,ZQ),unstable_createElicitation:QQ(aZ.elicitation_create,GZ)},Twe={sessionUpdate:$Q(aZ.session_update,_Q),unstable_completeElicitation:$Q(aZ.elicitation_complete,vQ)};e$(Swe),e$(Cwe),e$(wwe),e$(Twe),iZ.initialize,iZ.authenticate,iZ.providers_list,iZ.providers_set,iZ.providers_disable,iZ.session_new,iZ.session_load,iZ.session_set_mode,iZ.session_set_config_option,iZ.session_prompt,iZ.session_list,iZ.session_delete,iZ.session_fork,iZ.session_resume,iZ.session_close,iZ.logout,iZ.nes_start,iZ.nes_suggest,iZ.nes_close,iZ.session_cancel,iZ.nes_accept,iZ.nes_reject,iZ.document_did_open,iZ.document_did_change,iZ.document_did_close,iZ.document_did_save,iZ.document_did_focus,aZ.session_request_permission,aZ.fs_write_text_file,aZ.fs_read_text_file,aZ.terminal_create,aZ.terminal_output,aZ.terminal_release,aZ.terminal_wait_for_exit,aZ.terminal_kill,aZ.elicitation_create,aZ.session_update,aZ.elicitation_complete;var Ewe=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),t$=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=Ewe(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),Dwe=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=t$()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),Owe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),kwe=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=Owe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),Awe=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=kwe();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
723
723
  `).join(`
724
724
  `+a),e.push(i+`m+`+n.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+t+` `+e[0]}function s(){return e.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...t){return process.stderr.write(i.formatWithOptions(e.inspectOpts,...t)+`
725
725
  `)}function l(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function u(){return process.env.DEBUG}function d(t){t.inspectOpts={};let n=Object.keys(e.inspectOpts);for(let r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}n.exports=t$()(e);let{formatters:f}=n.exports;f.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split(`
726
- `).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),n$=i(((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?kwe():Mwe()})),Nwe=i((e=>{var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});let r=t(`fs`),i=n(n$()).default(`@kwsites/file-exists`);function a(e,t,n){i(`checking %s`,e);try{let a=r.statSync(e);return a.isFile()&&t?(i(`[OK] path represents a file`),!0):a.isDirectory()&&n?(i(`[OK] path represents a directory`),!0):(i(`[FAIL] path represents something other than a file or directory`),!1)}catch(e){if(e.code===`ENOENT`)return i(`[FAIL] path is not accessible: %o`,e),!1;throw i(`[FATAL] %o`,e),e}}function o(t,n=e.READABLE){return a(t,(n&e.FILE)>0,(n&e.FOLDER)>0)}e.exists=o,e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER})),r$=i((e=>{function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(Nwe())}))();const i$=new WeakMap;function a$(...e){let t=new String(e);return i$.set(t,e),t}function o$(e){return e instanceof String&&i$.has(e)}var Pwe=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDeferred=e.deferred=void 0;function t(){let e,t,n=`pending`;return{promise:new Promise((n,r)=>{e=n,t=r}),done(t){n===`pending`&&(n=`resolved`,e(t))},fail(e){n===`pending`&&(n=`rejected`,t(e))},get fulfilled(){return n!==`pending`},get status(){return n}}}e.deferred=t,e.createDeferred=t})),s$=e(n$()),c$=Pwe();new Map([[`C`,!0],[`P`,!1],[`h`,!1],[`p`,!1],[`v`,!1],...{short:new Map([[`c`,!0]])}.short.entries()]);function l$(e,t,n=String(e)){let r=typeof e==`string`?RegExp(`\\s*${e.toLowerCase()}`):e;return function(e){if(r.test(e))return{category:t,message:`Configuring ${n} is not permitted without enabling ${t}`}}}function u$(e,t){return l$(RegExp(`\\s*${e.toLowerCase().replace(/\./g,`(..+)?.`)}`),t,e)}l$(`alias`,`allowUnsafeAlias`),l$(`core.askPass`,`allowUnsafeAskPass`),l$(`core.editor`,`allowUnsafeEditor`),l$(`core.fsmonitor`,`allowUnsafeFsMonitor`),l$(`core.gitProxy`,`allowUnsafeGitProxy`),l$(`core.hooksPath`,`allowUnsafeHooksPath`),l$(`core.pager`,`allowUnsafePager`),l$(`core.sshCommand`,`allowUnsafeSshCommand`),u$(`credential.helper`,`allowUnsafeCredentialHelper`),u$(`diff.command`,`allowUnsafeDiffExternal`),l$(`diff.external`,`allowUnsafeDiffExternal`),u$(`diff.textconv`,`allowUnsafeDiffTextConv`),u$(`filter.clean`,`allowUnsafeFilter`),u$(`filter.smudge`,`allowUnsafeFilter`),u$(`gpg.program`,`allowUnsafeGpgProgram`),l$(`init.templateDir`,`allowUnsafeTemplateDir`),u$(`merge.driver`,`allowUnsafeMergeDriver`),u$(`mergetool.path`,`allowUnsafeMergeDriver`),u$(`mergetool.cmd`,`allowUnsafeMergeDriver`),u$(`protocol.allow`,`allowUnsafeProtocolOverride`),u$(`remote.receivepack`,`allowUnsafePack`),u$(`remote.uploadpack`,`allowUnsafePack`),l$(`sequence.editor`,`allowUnsafeEditor`);function d$(e,t,n,r=String(t)){let i=typeof t==`string`?RegExp(`\\s*${t.toLowerCase()}`):t,a=`Use of ${e?`${e} with option `:``}${r} is not permitted without enabling ${n}`;return function(t,r){if((!e||t===e)&&i.test(r))return{category:n,message:a}}}d$(null,/--(upload|receive)-pack/,`allowUnsafePack`,`--upload-pack or --receive-pack`),d$(`clone`,/^-\w*u/,`allowUnsafePack`),d$(`clone`,`--u`,`allowUnsafePack`),d$(`push`,`--exec`,`allowUnsafePack`),d$(null,`--template`,`allowUnsafeTemplateDir`);var f$=Object.defineProperty,Fwe=Object.getOwnPropertyDescriptor,p$=Object.getOwnPropertyNames,Iwe=Object.prototype.hasOwnProperty,m$=(e,t)=>function(){return e&&(t=(0,e[p$(e)[0]])(e=0)),t},Lwe=(e,t)=>function(){return t||(0,e[p$(e)[0]])((t={exports:{}}).exports,t),t.exports},h$=(e,t)=>{for(var n in t)f$(e,n,{get:t[n],enumerable:!0})},Rwe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of p$(t))!Iwe.call(e,i)&&i!==n&&f$(e,i,{get:()=>t[i],enumerable:!(r=Fwe(t,i))||r.enumerable});return e},g$=e=>Rwe(f$({},`__esModule`,{value:!0}),e),_$,v$=m$({"src/lib/errors/git-error.ts"(){_$=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),y$,b$=m$({"src/lib/errors/git-response-error.ts"(){v$(),y$=class extends _${constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),x$,S$=m$({"src/lib/errors/task-configuration-error.ts"(){v$(),x$=class extends _${constructor(e){super(void 0,e)}}}});function C$(e){return typeof e==`function`?e:H$}function w$(e){return typeof e==`function`&&e!==H$}function T$(e,t){let n=e.indexOf(t);return n<=0?[e,``]:[e.substr(0,n),e.substr(n+1)]}function E$(e,t=0){return O$(e)&&e.length>t?e[t]:void 0}function D$(e,t=0){if(O$(e)&&e.length>t)return e[e.length-1-t]}function O$(e){return $$(e)}function k$(e=``,t=!0,n=`
727
- `){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function A$(e,t){return k$(e,!0).map(e=>t(e))}function j$(e){return(0,r$.exists)(e,r$.FOLDER)}function M$(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function zwe(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function N$(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function P$(e){return Array.isArray(e)?e:[e]}function F$(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function I$(e){return P$(e).map(e=>e instanceof String?e:String(e))}function L$(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function R$(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function z$(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function Bwe(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function Vwe(e=0){return new Promise(t=>setTimeout(t,e))}function B$(e){if(e!==!1)return e}var V$,H$,U$,W$=m$({"src/lib/utils/util.ts"(){e1(),V$=`\0`,H$=()=>{},U$=Object.prototype.toString.call.bind(Object.prototype.toString)}});function G$(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function K$(e,t){let n=o$(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function q$(e){return!!e&&U$(e)===`[object Object]`}function J$(e){return typeof e==`function`}var Y$,X$,Z$,Q$,$$,e1=m$({"src/lib/utils/argument-filters.ts"(){W$(),Y$=e=>Array.isArray(e),X$=e=>typeof e==`number`,Z$=e=>typeof e==`string`||o$(e),Q$=e=>Z$(e)||Array.isArray(e)&&e.every(Z$),$$=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),t1,Hwe=m$({"src/lib/utils/exit-codes.ts"(){t1=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(t1||{})}}),n1,Uwe=m$({"src/lib/utils/git-output-streams.ts"(){n1=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function Wwe(){throw Error(`LineParser:useMatches not implemented`)}var r1,i1,Gwe=m$({"src/lib/utils/line-parser.ts"(){r1=class{constructor(e,t){this.matches=[],this.useMatches=Wwe,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},i1=class extends r1{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Kwe(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...a1},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var a1,qwe=m$({"src/lib/utils/simple-git-options.ts"(){a1={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function o1(e,t=[]){return q$(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(o$(r))t.push(r);else if(K$(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)K$(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function s1(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return o1(c1(e),r),n||r.push(...Jwe(e)),r}function Jwe(e){return I$(G$(D$(e,+(typeof D$(e)==`function`)),Y$,[]))}function c1(e){return G$(D$(e,+!!J$(D$(e))),q$)}function l1(e,t=!0){let n=C$(D$(e));return t||w$(n)?n:void 0}var Ywe=m$({"src/lib/utils/task-options.ts"(){e1(),W$()}});function u1(e,t){return e(t.stdOut,t.stdErr)}function d1(e,t,n,r=!0){return P$(n).forEach(n=>{for(let i=k$(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var Xwe=m$({"src/lib/utils/task-parser.ts"(){W$()}}),f1={};h$(f1,{ExitCodes:()=>t1,GitOutputStreams:()=>n1,LineParser:()=>r1,NOOP:()=>H$,NULL:()=>V$,RemoteLineParser:()=>i1,append:()=>M$,appendTaskOptions:()=>o1,asArray:()=>P$,asCamelCase:()=>F$,asFunction:()=>C$,asNumber:()=>L$,asStringArray:()=>I$,bufferToString:()=>z$,callTaskParser:()=>u1,createInstanceConfig:()=>Kwe,delay:()=>Vwe,filterArray:()=>Y$,filterFunction:()=>J$,filterHasLength:()=>$$,filterNumber:()=>X$,filterPlainObject:()=>q$,filterPrimitives:()=>K$,filterString:()=>Z$,filterStringOrStringArray:()=>Q$,filterType:()=>G$,first:()=>E$,folderExists:()=>j$,forEachLineWithContent:()=>A$,getTrailingOptions:()=>s1,including:()=>zwe,isUserFunction:()=>w$,last:()=>D$,objectToString:()=>U$,orVoid:()=>B$,parseStringResponse:()=>d1,pick:()=>Bwe,prefixedArray:()=>R$,remove:()=>N$,splitOn:()=>T$,toLinesWithContent:()=>k$,trailingFunctionArgument:()=>l1,trailingOptionsArgument:()=>c1});var p1=m$({"src/lib/utils/index.ts"(){e1(),Hwe(),Uwe(),Gwe(),qwe(),Ywe(),Xwe(),W$()}}),m1={};h$(m1,{CheckRepoActions:()=>_1,checkIsBareRepoTask:()=>g1,checkIsRepoRootTask:()=>h1,checkIsRepoTask:()=>Zwe});function Zwe(e){switch(e){case`bare`:return g1();case`root`:return h1()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:v1,parser:y1}}function h1(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:v1,parser(e){return/^\.(git)?$/.test(e.trim())}}}function g1(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:v1,parser:y1}}function Qwe(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var _1,v1,y1,b1=m$({"src/lib/tasks/check-is-repo.ts"(){p1(),_1=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(_1||{}),v1=({exitCode:e},t,n,r)=>{if(e===128&&Qwe(t))return n(Buffer.from(`false`));r(t)},y1=e=>e.trim()===`true`}});function $we(e,t){let n=new x1(e),r=e?C1:S1;return k$(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(w1.test(t)?n.folders:n.files).push(t)}),n}var x1,S1,C1,w1,eTe=m$({"src/lib/responses/CleanSummary.ts"(){p1(),x1=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},S1=/^[a-z]+\s*/i,C1=/^[a-z]+\s+[a-z]+\s*/i,w1=/\/$/}}),T1={};h$(T1,{EMPTY_COMMANDS:()=>M1,adhocExecTask:()=>E1,configurationErrorTask:()=>D1,isBufferTask:()=>A1,isEmptyTask:()=>j1,straightThroughBufferTask:()=>k1,straightThroughStringTask:()=>O1});function E1(e){return{commands:M1,format:`empty`,parser:e}}function D1(e){return{commands:M1,format:`empty`,parser(){throw typeof e==`string`?new x$(e):e}}}function O1(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function k1(e){return{commands:e,format:`buffer`,parser(e){return e}}}function A1(e){return e.format===`buffer`}function j1(e){return e.format===`empty`||!e.commands.length}var M1,N1=m$({"src/lib/tasks/task.ts"(){S$(),M1=[]}}),P1={};h$(P1,{CONFIG_ERROR_INTERACTIVE_MODE:()=>I1,CONFIG_ERROR_MODE_REQUIRED:()=>L1,CONFIG_ERROR_UNKNOWN_OPTION:()=>R1,CleanOptions:()=>z1,cleanTask:()=>F1,cleanWithOptionsTask:()=>tTe,isCleanOptionsArray:()=>nTe});function tTe(e,t){let{cleanMode:n,options:r,valid:i}=rTe(e);return n?i.options?(r.push(...t),r.some(oTe)?D1(I1):F1(n,r)):D1(R1+JSON.stringify(e)):D1(L1)}function F1(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return $we(e===`n`,t)}}}function nTe(e){return Array.isArray(e)&&e.every(e=>B1.has(e))}function rTe(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{iTe(e)?(t=e,r.cleanMode=!0):r.options=r.options&&aTe(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function iTe(e){return e===`f`||e===`n`}function aTe(e){return/^-[a-z]$/i.test(e)&&B1.has(e.charAt(1))}function oTe(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var I1,L1,R1,z1,B1,V1=m$({"src/lib/tasks/clean.ts"(){eTe(),p1(),N1(),I1=`Git clean interactive mode is not supported`,L1=`Git clean mode parameter ("n" or "f") is required`,R1=`Git clean unknown option found in: `,z1=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(z1||{}),B1=new Set([`i`,...I$(Object.values(z1))])}});function sTe(e){let t=new U1;for(let n of H1(e))t.addValue(n.file,String(n.key),n.value);return t}function cTe(e,t){let n=null,r=[],i=new Map;for(let a of H1(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function lTe(e){return e.replace(/^(file):/,``)}function*H1(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=lTe(n[e++]),i=n[e++],a=t;if(i.includes(`
726
+ `).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),n$=i(((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?Dwe():Awe()})),jwe=i((e=>{var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});let r=t(`fs`),i=n(n$()).default(`@kwsites/file-exists`);function a(e,t,n){i(`checking %s`,e);try{let a=r.statSync(e);return a.isFile()&&t?(i(`[OK] path represents a file`),!0):a.isDirectory()&&n?(i(`[OK] path represents a directory`),!0):(i(`[FAIL] path represents something other than a file or directory`),!1)}catch(e){if(e.code===`ENOENT`)return i(`[FAIL] path is not accessible: %o`,e),!1;throw i(`[FATAL] %o`,e),e}}function o(t,n=e.READABLE){return a(t,(n&e.FILE)>0,(n&e.FOLDER)>0)}e.exists=o,e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER})),r$=i((e=>{function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(jwe())}))();const i$=new WeakMap;function a$(...e){let t=new String(e);return i$.set(t,e),t}function o$(e){return e instanceof String&&i$.has(e)}var Mwe=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDeferred=e.deferred=void 0;function t(){let e,t,n=`pending`;return{promise:new Promise((n,r)=>{e=n,t=r}),done(t){n===`pending`&&(n=`resolved`,e(t))},fail(e){n===`pending`&&(n=`rejected`,t(e))},get fulfilled(){return n!==`pending`},get status(){return n}}}e.deferred=t,e.createDeferred=t})),s$=e(n$()),c$=Mwe();new Map([[`C`,!0],[`P`,!1],[`h`,!1],[`p`,!1],[`v`,!1],...{short:new Map([[`c`,!0]])}.short.entries()]);function l$(e,t,n=String(e)){let r=typeof e==`string`?RegExp(`\\s*${e.toLowerCase()}`):e;return function(e){if(r.test(e))return{category:t,message:`Configuring ${n} is not permitted without enabling ${t}`}}}function u$(e,t){return l$(RegExp(`\\s*${e.toLowerCase().replace(/\./g,`(..+)?.`)}`),t,e)}l$(`alias`,`allowUnsafeAlias`),l$(`core.askPass`,`allowUnsafeAskPass`),l$(`core.editor`,`allowUnsafeEditor`),l$(`core.fsmonitor`,`allowUnsafeFsMonitor`),l$(`core.gitProxy`,`allowUnsafeGitProxy`),l$(`core.hooksPath`,`allowUnsafeHooksPath`),l$(`core.pager`,`allowUnsafePager`),l$(`core.sshCommand`,`allowUnsafeSshCommand`),u$(`credential.helper`,`allowUnsafeCredentialHelper`),u$(`diff.command`,`allowUnsafeDiffExternal`),l$(`diff.external`,`allowUnsafeDiffExternal`),u$(`diff.textconv`,`allowUnsafeDiffTextConv`),u$(`filter.clean`,`allowUnsafeFilter`),u$(`filter.smudge`,`allowUnsafeFilter`),u$(`gpg.program`,`allowUnsafeGpgProgram`),l$(`init.templateDir`,`allowUnsafeTemplateDir`),u$(`merge.driver`,`allowUnsafeMergeDriver`),u$(`mergetool.path`,`allowUnsafeMergeDriver`),u$(`mergetool.cmd`,`allowUnsafeMergeDriver`),u$(`protocol.allow`,`allowUnsafeProtocolOverride`),u$(`remote.receivepack`,`allowUnsafePack`),u$(`remote.uploadpack`,`allowUnsafePack`),l$(`sequence.editor`,`allowUnsafeEditor`);function d$(e,t,n,r=String(t)){let i=typeof t==`string`?RegExp(`\\s*${t.toLowerCase()}`):t,a=`Use of ${e?`${e} with option `:``}${r} is not permitted without enabling ${n}`;return function(t,r){if((!e||t===e)&&i.test(r))return{category:n,message:a}}}d$(null,/--(upload|receive)-pack/,`allowUnsafePack`,`--upload-pack or --receive-pack`),d$(`clone`,/^-\w*u/,`allowUnsafePack`),d$(`clone`,`--u`,`allowUnsafePack`),d$(`push`,`--exec`,`allowUnsafePack`),d$(null,`--template`,`allowUnsafeTemplateDir`);var f$=Object.defineProperty,Nwe=Object.getOwnPropertyDescriptor,p$=Object.getOwnPropertyNames,Pwe=Object.prototype.hasOwnProperty,m$=(e,t)=>function(){return e&&(t=(0,e[p$(e)[0]])(e=0)),t},Fwe=(e,t)=>function(){return t||(0,e[p$(e)[0]])((t={exports:{}}).exports,t),t.exports},h$=(e,t)=>{for(var n in t)f$(e,n,{get:t[n],enumerable:!0})},Iwe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of p$(t))!Pwe.call(e,i)&&i!==n&&f$(e,i,{get:()=>t[i],enumerable:!(r=Nwe(t,i))||r.enumerable});return e},g$=e=>Iwe(f$({},`__esModule`,{value:!0}),e),_$,v$=m$({"src/lib/errors/git-error.ts"(){_$=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),y$,b$=m$({"src/lib/errors/git-response-error.ts"(){v$(),y$=class extends _${constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),x$,S$=m$({"src/lib/errors/task-configuration-error.ts"(){v$(),x$=class extends _${constructor(e){super(void 0,e)}}}});function C$(e){return typeof e==`function`?e:H$}function w$(e){return typeof e==`function`&&e!==H$}function T$(e,t){let n=e.indexOf(t);return n<=0?[e,``]:[e.substr(0,n),e.substr(n+1)]}function E$(e,t=0){return O$(e)&&e.length>t?e[t]:void 0}function D$(e,t=0){if(O$(e)&&e.length>t)return e[e.length-1-t]}function O$(e){return $$(e)}function k$(e=``,t=!0,n=`
727
+ `){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function A$(e,t){return k$(e,!0).map(e=>t(e))}function j$(e){return(0,r$.exists)(e,r$.FOLDER)}function M$(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function Lwe(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function N$(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function P$(e){return Array.isArray(e)?e:[e]}function F$(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function I$(e){return P$(e).map(e=>e instanceof String?e:String(e))}function L$(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function R$(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function z$(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function Rwe(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function zwe(e=0){return new Promise(t=>setTimeout(t,e))}function B$(e){if(e!==!1)return e}var V$,H$,U$,W$=m$({"src/lib/utils/util.ts"(){e1(),V$=`\0`,H$=()=>{},U$=Object.prototype.toString.call.bind(Object.prototype.toString)}});function G$(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function K$(e,t){let n=o$(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function q$(e){return!!e&&U$(e)===`[object Object]`}function J$(e){return typeof e==`function`}var Y$,X$,Z$,Q$,$$,e1=m$({"src/lib/utils/argument-filters.ts"(){W$(),Y$=e=>Array.isArray(e),X$=e=>typeof e==`number`,Z$=e=>typeof e==`string`||o$(e),Q$=e=>Z$(e)||Array.isArray(e)&&e.every(Z$),$$=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),t1,Bwe=m$({"src/lib/utils/exit-codes.ts"(){t1=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(t1||{})}}),n1,Vwe=m$({"src/lib/utils/git-output-streams.ts"(){n1=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function Hwe(){throw Error(`LineParser:useMatches not implemented`)}var r1,i1,Uwe=m$({"src/lib/utils/line-parser.ts"(){r1=class{constructor(e,t){this.matches=[],this.useMatches=Hwe,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},i1=class extends r1{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Wwe(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...a1},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var a1,Gwe=m$({"src/lib/utils/simple-git-options.ts"(){a1={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function o1(e,t=[]){return q$(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(o$(r))t.push(r);else if(K$(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)K$(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function s1(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return o1(c1(e),r),n||r.push(...Kwe(e)),r}function Kwe(e){return I$(G$(D$(e,+(typeof D$(e)==`function`)),Y$,[]))}function c1(e){return G$(D$(e,+!!J$(D$(e))),q$)}function l1(e,t=!0){let n=C$(D$(e));return t||w$(n)?n:void 0}var qwe=m$({"src/lib/utils/task-options.ts"(){e1(),W$()}});function u1(e,t){return e(t.stdOut,t.stdErr)}function d1(e,t,n,r=!0){return P$(n).forEach(n=>{for(let i=k$(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var Jwe=m$({"src/lib/utils/task-parser.ts"(){W$()}}),f1={};h$(f1,{ExitCodes:()=>t1,GitOutputStreams:()=>n1,LineParser:()=>r1,NOOP:()=>H$,NULL:()=>V$,RemoteLineParser:()=>i1,append:()=>M$,appendTaskOptions:()=>o1,asArray:()=>P$,asCamelCase:()=>F$,asFunction:()=>C$,asNumber:()=>L$,asStringArray:()=>I$,bufferToString:()=>z$,callTaskParser:()=>u1,createInstanceConfig:()=>Wwe,delay:()=>zwe,filterArray:()=>Y$,filterFunction:()=>J$,filterHasLength:()=>$$,filterNumber:()=>X$,filterPlainObject:()=>q$,filterPrimitives:()=>K$,filterString:()=>Z$,filterStringOrStringArray:()=>Q$,filterType:()=>G$,first:()=>E$,folderExists:()=>j$,forEachLineWithContent:()=>A$,getTrailingOptions:()=>s1,including:()=>Lwe,isUserFunction:()=>w$,last:()=>D$,objectToString:()=>U$,orVoid:()=>B$,parseStringResponse:()=>d1,pick:()=>Rwe,prefixedArray:()=>R$,remove:()=>N$,splitOn:()=>T$,toLinesWithContent:()=>k$,trailingFunctionArgument:()=>l1,trailingOptionsArgument:()=>c1});var p1=m$({"src/lib/utils/index.ts"(){e1(),Bwe(),Vwe(),Uwe(),Gwe(),qwe(),Jwe(),W$()}}),m1={};h$(m1,{CheckRepoActions:()=>_1,checkIsBareRepoTask:()=>g1,checkIsRepoRootTask:()=>h1,checkIsRepoTask:()=>Ywe});function Ywe(e){switch(e){case`bare`:return g1();case`root`:return h1()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:v1,parser:y1}}function h1(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:v1,parser(e){return/^\.(git)?$/.test(e.trim())}}}function g1(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:v1,parser:y1}}function Xwe(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var _1,v1,y1,b1=m$({"src/lib/tasks/check-is-repo.ts"(){p1(),_1=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(_1||{}),v1=({exitCode:e},t,n,r)=>{if(e===128&&Xwe(t))return n(Buffer.from(`false`));r(t)},y1=e=>e.trim()===`true`}});function Zwe(e,t){let n=new x1(e),r=e?C1:S1;return k$(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(w1.test(t)?n.folders:n.files).push(t)}),n}var x1,S1,C1,w1,Qwe=m$({"src/lib/responses/CleanSummary.ts"(){p1(),x1=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},S1=/^[a-z]+\s*/i,C1=/^[a-z]+\s+[a-z]+\s*/i,w1=/\/$/}}),T1={};h$(T1,{EMPTY_COMMANDS:()=>M1,adhocExecTask:()=>E1,configurationErrorTask:()=>D1,isBufferTask:()=>A1,isEmptyTask:()=>j1,straightThroughBufferTask:()=>k1,straightThroughStringTask:()=>O1});function E1(e){return{commands:M1,format:`empty`,parser:e}}function D1(e){return{commands:M1,format:`empty`,parser(){throw typeof e==`string`?new x$(e):e}}}function O1(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function k1(e){return{commands:e,format:`buffer`,parser(e){return e}}}function A1(e){return e.format===`buffer`}function j1(e){return e.format===`empty`||!e.commands.length}var M1,N1=m$({"src/lib/tasks/task.ts"(){S$(),M1=[]}}),P1={};h$(P1,{CONFIG_ERROR_INTERACTIVE_MODE:()=>I1,CONFIG_ERROR_MODE_REQUIRED:()=>L1,CONFIG_ERROR_UNKNOWN_OPTION:()=>R1,CleanOptions:()=>z1,cleanTask:()=>F1,cleanWithOptionsTask:()=>$we,isCleanOptionsArray:()=>eTe});function $we(e,t){let{cleanMode:n,options:r,valid:i}=tTe(e);return n?i.options?(r.push(...t),r.some(iTe)?D1(I1):F1(n,r)):D1(R1+JSON.stringify(e)):D1(L1)}function F1(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return Zwe(e===`n`,t)}}}function eTe(e){return Array.isArray(e)&&e.every(e=>B1.has(e))}function tTe(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{nTe(e)?(t=e,r.cleanMode=!0):r.options=r.options&&rTe(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function nTe(e){return e===`f`||e===`n`}function rTe(e){return/^-[a-z]$/i.test(e)&&B1.has(e.charAt(1))}function iTe(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var I1,L1,R1,z1,B1,V1=m$({"src/lib/tasks/clean.ts"(){Qwe(),p1(),N1(),I1=`Git clean interactive mode is not supported`,L1=`Git clean mode parameter ("n" or "f") is required`,R1=`Git clean unknown option found in: `,z1=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(z1||{}),B1=new Set([`i`,...I$(Object.values(z1))])}});function aTe(e){let t=new U1;for(let n of H1(e))t.addValue(n.file,String(n.key),n.value);return t}function oTe(e,t){let n=null,r=[],i=new Map;for(let a of H1(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function sTe(e){return e.replace(/^(file):/,``)}function*H1(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=sTe(n[e++]),i=n[e++],a=t;if(i.includes(`
728
728
  `)){let e=T$(i,`
729
- `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var U1,uTe=m$({"src/lib/responses/ConfigList.ts"(){p1(),U1=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=D$(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function W1(e,t){return typeof e==`string`&&Object.hasOwn(G1,e)?e:t}function dTe(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function fTe(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return cTe(t,e)}}}function pTe(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return sTe(e)}}}function mTe(){return{addConfig(e,t,...n){return this._runTask(dTe(e,t,n[0]===!0,W1(n[1],`local`)),l1(arguments))},getConfig(e,t){return this._runTask(fTe(e,W1(t,void 0)),l1(arguments))},listConfig(...e){return this._runTask(pTe(W1(e[0],void 0)),l1(arguments))}}}var G1,K1=m$({"src/lib/tasks/config.ts"(){uTe(),p1(),G1=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(G1||{})}});function hTe(e){return J1.has(e)}var q1,J1,Y1=m$({"src/lib/tasks/diff-name-status.ts"(){q1=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(q1||{}),J1=new Set(Object.values(q1))}});function gTe(...e){return new $1().param(...e)}function _Te(e){let t=new Set,n={};return A$(e,e=>{let[r,i,a]=e.split(V$);t.add(r),(n[r]=n[r]||[]).push({line:L$(i),path:r,preview:a})}),{paths:t,results:n}}function vTe(){return{grep(e){let t=l1(arguments),n=s1(arguments);for(let e of X1)if(n.includes(e))return this._runTask(D1(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=gTe().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return _Te(e)}},t)}}}var X1,Z1,Q1,$1,e0=m$({"src/lib/tasks/grep.ts"(){p1(),N1(),X1=[`-h`],Z1=Symbol(`grepQuery`),$1=class{constructor(){this[Q1]=[]}*[(Q1=Z1,Symbol.iterator)](){for(let e of this[Z1])yield e}and(...e){return e.length&&this[Z1].push(`--and`,`(`,...R$(e,`-e`),`)`),this}param(...e){return this[Z1].push(...R$(e,`-e`)),this}}}}),t0={};h$(t0,{ResetMode:()=>r0,getResetMode:()=>bTe,resetTask:()=>yTe});function yTe(e,t){let n=[`reset`];return n0(e)&&n.push(`--${e}`),n.push(...t),O1(n)}function bTe(e){if(n0(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function n0(e){return typeof e==`string`&&i0.includes(e)}var r0,i0,a0=m$({"src/lib/tasks/reset.ts"(){p1(),N1(),r0=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(r0||{}),i0=I$(Object.values(r0))}});function xTe(){return(0,s$.default)(`simple-git`)}function o0(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function STe(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function s0(e,t,n,r=xTe()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=STe(G$(t,Z$),o,r);return l(n);function c(t,n){return M$(a,s0(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&o0(o,n)||H$,s=o0(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var c0=m$({"src/lib/git-logger.ts"(){p1(),s$.default.formatters.L=e=>String($$(e)?e.length:`-`),s$.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):U$(e)}}),l0,CTe=m$({"src/lib/runners/tasks-pending-queue.ts"(){v$(),c0(),l0=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:s0(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new _$(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function u0(e,t){return{method:E$(e.commands)||``,commands:t}}function wTe(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function d0(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var f0,TTe=m$({"src/lib/runners/git-executor-chain.ts"(){v$(),N1(),p1(),CTe(),f0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new l0}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(j1(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof _$?Object.assign(t,{task:e}):new _$(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,u0(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...u0(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),A1(e)?u1(e.parser,a):u1(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...u0(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,U$(e)),c(new n1(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new n1(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},u0(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{...u0(e,n),kill(e){u=e||u}});let d=Be(t,n,o);d.stdout.on(`data`,d0(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,d0(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,wTe(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...u0(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...u0(e,t),kill(e){n=e||n}}),n}}}}),p0={};h$(p0,{GitExecutor:()=>m0});var m0,ETe=m$({"src/lib/runners/git-executor.ts"(){TTe(),m0=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new f0(this,this._scheduler,this._plugins)}chain(){return new f0(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function DTe(e,t,n=H$){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof y$?OTe(t):t,void 0)})}function OTe(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=H$};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var kTe=m$({"src/lib/task-callback.ts"(){b$(),p1()}});function h0(e,t){return E1(n=>{if(!j$(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var ATe=m$({"src/lib/tasks/change-working-directory.ts"(){p1(),N1()}});function g0(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=N$(t,`-B`)),O1(t)}function jTe(){return{checkout(){return this._runTask(g0(s1(arguments,1)),l1(arguments))},checkoutBranch(e,t){return this._runTask(g0([`-b`,e,t,...s1(arguments)]),l1(arguments))},checkoutLocalBranch(e){return this._runTask(g0([`-b`,e,...s1(arguments)]),l1(arguments))}}}var MTe=m$({"src/lib/tasks/checkout.ts"(){p1(),N1()}});function NTe(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function PTe(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return d1(NTe(),[_0],e)}})}}}var _0,FTe=m$({"src/lib/tasks/count-objects.ts"(){p1(),_0=new r1(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=F$(t);Object.hasOwn(e,r)&&(e[r]=L$(n))})}});function ITe(e){return d1({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},v0,e)}var v0,LTe=m$({"src/lib/parsers/parse-commit.ts"(){p1(),v0=[new r1(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new r1(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new r1(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new r1(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function RTe(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...R$(e,`-m`),...t,...n],format:`utf-8`,parser:ITe}}function zTe(){return{commit(t,...n){let r=l1(arguments),i=e(t)||RTe(P$(t),P$(G$(n[0],Q$,[])),[...I$(G$(n[1],Y$,[])),...s1(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!Q$(e)&&D1(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var BTe=m$({"src/lib/tasks/commit.ts"(){LTe(),p1(),N1()}});function VTe(){return{firstCommit(){return this._runTask(O1([`rev-list`,`--max-parents=0`,`HEAD`],!0),l1(arguments))}}}var HTe=m$({"src/lib/tasks/first-commit.ts"(){p1(),N1()}});function UTe(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),O1(n,!0)}var WTe=m$({"src/lib/tasks/hash-object.ts"(){N1()}});function GTe(e,t,n){let r=String(n).trim(),i;if(i=b0.exec(r))return new y0(e,t,!1,i[1]);if(i=x0.exec(r))return new y0(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new y0(e,t,/^re/i.test(r),a)}var y0,b0,x0,KTe=m$({"src/lib/responses/InitSummary.ts"(){y0=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},b0=/^Init.+ repository in (.+)$/,x0=/^Rein.+ in (.+)$/}});function qTe(e){return e.includes(S0)}function JTe(e=!1,t,n){let r=[`init`,...n];return e&&!qTe(r)&&r.splice(1,0,S0),{commands:r,format:`utf-8`,parser(e){return GTe(r.includes(`--bare`),t,e)}}}var S0,YTe=m$({"src/lib/tasks/init.ts"(){KTe(),S0=`--bare`}});function C0(e){for(let t=0;t<e.length;t++){let n=w0.exec(e[t]);if(n)return`--${n[1]}`}return``}function XTe(e){return w0.test(e)}var w0,T0=m$({"src/lib/args/log-format.ts"(){w0=/^--(stat|numstat|name-only|name-status)(=|$)/}}),E0,ZTe=m$({"src/lib/responses/DiffSummary.ts"(){E0=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function D0(e=``){let t=M0[e];return e=>d1(new E0,t,e,!1)}var O0,k0,A0,j0,M0,N0=m$({"src/lib/parsers/parse-diff-summary.ts"(){T0(),ZTe(),Y1(),p1(),O0=[new r1(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:L$(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new r1(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:L$(n),after:L$(r),binary:!0})}),new r1(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=L$(t),e.insertions=L$(r?.[1]),e.deletions=L$(i?.[1])})],k0=[new r1(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=L$(t),a=L$(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new r1(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],A0=[new r1(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],j0=[new r1(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:B$(hTe(t)&&t),from:B$(!!a&&r!==a&&r),similarity:L$(n)})})],M0={"":O0,"--stat":O0,"--numstat":k0,"--name-status":j0,"--name-only":A0}}});function QTe(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function P0(e=L0,t=R0,n=``){let r=D0(n);return function(n){let i=k$(n.trim(),!1,F0).map(function(n){let i=n.split(I0),a=QTe(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var F0,I0,L0,R0,z0=m$({"src/lib/parsers/parse-list-log-summary.ts"(){p1(),N0(),T0(),F0=`òòòòòò `,I0=` òò`,L0=` ò `,R0=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),B0={};h$(B0,{diffSummaryTask:()=>$Te,validateLogFormatConfig:()=>V0});function $Te(e){let t=C0(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),V0(n)||{commands:n,format:`utf-8`,parser:D0(t)}}function V0(e){let t=e.filter(XTe);if(t.length>1)return D1(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return D1(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var H0=m$({"src/lib/tasks/diff.ts"(){T0(),N0(),N1()}});function eEe(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function tEe(e){return Object.keys(e).reduce((t,n)=>(n in W0||(t[n]=e[n]),t),{})}function U0(e={},t=[]){let n=G$(e.splitter,Z$,L0),[r,i]=eEe(q$(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${F0}${i}${I0}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return Z$(e.file)&&o.push(`--follow`,a$(e.file)),o1(tEe(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function nEe(e,t,n){let r=P0(e,t,C0(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function rEe(){return{log(...n){let r=l1(arguments),i=U0(c1(arguments),I$(G$(arguments[0],Y$,[]))),a=t(...n)||V0(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return nEe(e.splitter,e.fields,e.commands)}function t(e,t){return Z$(e)&&Z$(t)&&D1(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var W0,G0=m$({"src/lib/tasks/log.ts"(){T0(),z0(),p1(),N1(),H0(),W0=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(W0||{})}}),K0,q0,iEe=m$({"src/lib/responses/MergeSummary.ts"(){K0=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},q0=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),J0,Y0,aEe=m$({"src/lib/responses/PullSummary.ts"(){J0=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Y0=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function X0(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Z0(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:L$(t&&t[1]||`0`),delta:L$(n&&n[1]||`0`)}}var Q0,oEe=m$({"src/lib/parsers/parse-remote-objects.ts"(){p1(),Q0=[new i1(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=X0(e.remoteMessages);Object.assign(i,{[r]:L$(n)})}),new i1(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=X0(e.remoteMessages);Object.assign(i,{[r]:L$(n)})}),new i1(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=X0(e.remoteMessages);i.total=Z0(t),i.reused=Z0(n),i.packReused=L$(r)})]}});function $0(e,t){return d1({remoteMessages:new t2},e2,t)}var e2,t2,n2=m$({"src/lib/parsers/parse-remote-messages.ts"(){p1(),oEe(),e2=[new i1(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...Q0,new i1([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new i1([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:L$(t),summary:n,url:r}})],t2=class{constructor(){this.all=[]}}}});function sEe(e,t){let n=d1(new Y0,s2,[e,t]);return n.message&&n}var r2,i2,a2,o2,s2,c2,l2,u2=m$({"src/lib/parsers/parse-pull.ts"(){aEe(),p1(),n2(),r2=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,i2=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,a2=/^(create|delete) mode \d+ (.+)/,o2=[new r1(r2,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new r1(i2,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new r1(a2,(e,[t,n])=>{M$(e.files,n),M$(t===`create`?e.created:e.deleted,n)})],s2=[new r1(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new r1(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new r1(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],c2=(e,t)=>d1(new J0,o2,[e,t]),l2=(e,t)=>Object.assign(new J0,c2(e,t),$0(e,t))}}),d2,f2,p2,cEe=m$({"src/lib/parsers/parse-merge.ts"(){iEe(),p1(),u2(),d2=[new r1(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new r1(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new K0(t,n))}),new r1(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new K0(t,n,{deleteRef:r}))}),new r1(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new K0(t,null))}),new r1(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],f2=(e,t)=>Object.assign(p2(e,t),l2(e,t)),p2=e=>d1(new q0,d2,e)}});function m2(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=f2(e,t);if(n.failed)throw new y$(n);return n}}:D1(`Git.merge requires at least one option`)}var lEe=m$({"src/lib/tasks/merge.ts"(){b$(),cEe(),N1()}});function uEe(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var h2,g2,_2,dEe=m$({"src/lib/parsers/parse-push.ts"(){p1(),n2(),h2=[new r1(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new r1(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new r1(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(uEe(t,n,r))}),new r1(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new r1(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],g2=(e,t)=>{let n=_2(e,t),r=$0(e,t);return{...n,...r}},_2=(e,t)=>d1({pushed:[]},h2,[e,t])}}),v2={};h$(v2,{pushTagsTask:()=>fEe,pushTask:()=>y2});function fEe(e={},t){return M$(t,`--tags`),y2(e,t)}function y2(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),N$(n,`-v`),M$(n,`--verbose`),M$(n,`--porcelain`),{commands:n,format:`utf-8`,parser:g2}}var b2=m$({"src/lib/tasks/push.ts"(){dEe(),p1()}});function pEe(){return{showBuffer(){let e=[`show`,...s1(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(k1(e),l1(arguments))},show(){let e=[`show`,...s1(arguments,1)];return this._runTask(O1(e),l1(arguments))}}}var mEe=m$({"src/lib/tasks/show.ts"(){p1(),N1()}}),x2,S2,hEe=m$({"src/lib/responses/FileStatusSummary.ts"(){x2=/^(.+)\0(.+)$/,S2=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=x2.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function C2(e){let[t,n]=e.split(V$);return{from:n||t,to:t}}function w2(e,t,n){return[`${e}${t}`,n]}function T2(e,...t){return t.map(t=>w2(e,t,(e,t)=>e.conflicted.push(t)))}function gEe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=D2.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new S2(r,t,n))}}var E2,D2,O2,_Ee=m$({"src/lib/responses/StatusSummary.ts"(){p1(),hEe(),E2=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},D2=new Map([w2(` `,`A`,(e,t)=>e.created.push(t)),w2(` `,`D`,(e,t)=>e.deleted.push(t)),w2(` `,`M`,(e,t)=>e.modified.push(t)),w2(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),w2(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),w2(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),w2(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),w2(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),w2(`R`,` `,(e,t)=>{e.renamed.push(C2(t))}),w2(`R`,`M`,(e,t)=>{let n=C2(t);e.renamed.push(n),e.modified.push(n.to)}),w2(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),w2(`?`,`?`,(e,t)=>e.not_added.push(t)),...T2(`A`,`A`,`U`),...T2(`D`,`D`,`U`),...T2(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=G$(s?.[1],Z$,null),s=a.exec(t),e.tracking=G$(s?.[1],Z$,null),s=o.exec(t),s&&(e.current=G$(s?.[1],Z$,e.current)),e.detached=/\(no branch\)/.test(t)}]]),O2=function(e){let t=e.split(V$),n=new E2;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=V$+(t[e++]||``)),gEe(n,r))}return n}}});function vEe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!k2.includes(e))],parser(e){return O2(e)}}}var k2,yEe=m$({"src/lib/tasks/status.ts"(){_Ee(),k2=[`--null`,`-z`]}});function A2(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function bEe(){return A2(0,0,0,``,!1)}function xEe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:SEe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(j2));r(t)}})}}}function SEe(e){return e===j2?bEe():d1(A2(0,0,0,e),M2,e)}var j2,M2,CEe=m$({"src/lib/tasks/version.ts"(){p1(),j2=`installed=false`,M2=[new r1(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,A2(L$(t),L$(n),L$(r),i))}),new r1(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,A2(L$(t),L$(n),r,i))})]}});function N2(e,t,n,...r){return Z$(n)?t(n,G$(r[0],Z$),s1(arguments)):D1(`git.${e}() requires a string 'repoPath'`)}function wEe(){return{clone(e,...t){return this._runTask(N2(`clone`,P2,G$(e,Z$),...t),l1(arguments))},mirror(e,...t){return this._runTask(N2(`mirror`,F2,G$(e,Z$),...t),l1(arguments))}}}var P2,F2,TEe=m$({"src/lib/tasks/clone.ts"(){N1(),p1(),P2=(e,t,n)=>{let r=[`clone`,...n];return Z$(e)&&r.push(a$(e)),Z$(t)&&r.push(a$(t)),O1(r)},F2=(e,t,n)=>(M$(n,`--mirror`),P2(e,t,n))}}),I2={};h$(I2,{SimpleGitApi:()=>L2});var L2,EEe=m$({"src/lib/simple-git-api.ts"(){kTe(),ATe(),MTe(),FTe(),BTe(),K1(),HTe(),e0(),WTe(),YTe(),G0(),lEe(),b2(),mEe(),yEe(),N1(),CEe(),p1(),TEe(),L2=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&DTe(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(O1([`add`,...P$(e)]),l1(arguments))}cwd(e){let t=l1(arguments);return typeof e==`string`?this._runTask(h0(e,this._executor),t):typeof e?.path==`string`?this._runTask(h0(e.path,e.root&&this._executor||void 0),t):this._runTask(D1(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(UTe(e,t===!0),l1(arguments))}init(e){return this._runTask(JTe(e===!0,this._executor.cwd,s1(arguments)),l1(arguments))}merge(){return this._runTask(m2(s1(arguments)),l1(arguments))}mergeFromTo(e,t){return Z$(e)&&Z$(t)?this._runTask(m2([e,t,...s1(arguments)]),l1(arguments,!1)):this._runTask(D1(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=y2({remote:G$(arguments[0],Z$),branch:G$(arguments[1],Z$)},s1(arguments));return this._runTask(e,l1(arguments))}stash(){return this._runTask(O1([`stash`,...s1(arguments)]),l1(arguments))}status(){return this._runTask(vEe(s1(arguments)),l1(arguments))}},Object.assign(L2.prototype,jTe(),wEe(),zTe(),mTe(),PTe(),VTe(),vTe(),rEe(),pEe(),xEe())}}),R2={};h$(R2,{Scheduler:()=>B2});var z2,B2,DEe=m$({"src/lib/runners/scheduler.ts"(){p1(),c0(),z2=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,c$.createDeferred)();return{promise:t,done:n,id:e}}})(),B2=class{constructor(e=2){this.concurrency=e,this.logger=s0(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=M$(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),N$(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=M$(this.pending,z2());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),V2={};h$(V2,{applyPatchTask:()=>OEe});function OEe(e,t){return O1([`apply`,...t,...e])}var kEe=m$({"src/lib/tasks/apply-patch.ts"(){N1()}});function AEe(e,t){return{branch:e,hash:t,success:!0}}function jEe(e){return{branch:e,hash:null,success:!1}}var H2,MEe=m$({"src/lib/responses/BranchDeleteSummary.ts"(){H2=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function U2(e,t){return t===1&&G2.test(e)}var W2,G2,K2,q2,NEe=m$({"src/lib/parsers/parse-branch-delete.ts"(){MEe(),p1(),W2=/(\S+)\s+\(\S+\s([^)]+)\)/,G2=/^error[^']+'([^']+)'/m,K2=[new r1(W2,(e,[t,n])=>{let r=AEe(t,n);e.all.push(r),e.branches[t]=r}),new r1(G2,(e,[t])=>{let n=jEe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],q2=(e,t)=>d1(new H2,K2,[e,t])}}),J2,PEe=m$({"src/lib/responses/BranchSummary.ts"(){J2=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function Y2(e){return e?e.charAt(0):``}function X2(e,t=!1){return d1(new J2,t?[Q2]:Z2,e)}var Z2,Q2,FEe=m$({"src/lib/parsers/parse-branch.ts"(){PEe(),p1(),Z2=[new r1(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(Y2(t),!0,n,r,i)}),new r1(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(Y2(t),!1,n,r,i)})],Q2=new r1(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),$2={};h$($2,{branchLocalTask:()=>LEe,branchTask:()=>IEe,containsDeleteBranchCommand:()=>e4,deleteBranchTask:()=>zEe,deleteBranchesTask:()=>REe});function e4(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function IEe(e){let t=e4(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?q2(e,r).all[0]:X2(e,n)}}}function LEe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return X2(e)}}}function REe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return q2(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!U2(String(n),e))return i(n);r(t)}}}function zEe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return q2(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!U2(String(i),e))return o(i);throw new y$(n.parser(z$(r),z$(t)),String(i))}};return n}var BEe=m$({"src/lib/tasks/branch.ts"(){b$(),NEe(),FEe(),p1()}});function VEe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&se(t)}var t4,HEe=m$({"src/lib/responses/CheckIgnore.ts"(){t4=e=>e.split(/\n/g).map(VEe).filter(Boolean)}}),n4={};h$(n4,{checkIgnoreTask:()=>UEe});function UEe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:t4}}var WEe=m$({"src/lib/tasks/check-ignore.ts"(){HEe()}});function GEe(e,t){return d1({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},r4,[e,t])}var r4,KEe=m$({"src/lib/parsers/parse-fetch.ts"(){p1(),r4=[new r1(/From (.+)$/,(e,[t])=>{e.remote=t}),new r1(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new r1(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new r1(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new r1(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),i4={};h$(i4,{fetchTask:()=>JEe});function qEe(e){return/^--upload-pack(=|$)/.test(e)}function JEe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(qEe)?D1(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:GEe}}var YEe=m$({"src/lib/tasks/fetch.ts"(){KEe(),N1()}});function XEe(e){return d1({moves:[]},a4,e)}var a4,ZEe=m$({"src/lib/parsers/parse-move.ts"(){p1(),a4=[new r1(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),o4={};h$(o4,{moveTask:()=>QEe});function QEe(e,t){return{commands:[`mv`,`-v`,...P$(e),t],format:`utf-8`,parser:XEe}}var $Ee=m$({"src/lib/tasks/move.ts"(){ZEe(),p1()}}),s4={};h$(s4,{pullTask:()=>eDe});function eDe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return l2(e,t)},onError(e,t,n,r){let i=sEe(z$(e.stdOut),z$(e.stdErr));if(i)return r(new y$(i));r(t)}}}var tDe=m$({"src/lib/tasks/pull.ts"(){b$(),u2(),p1()}});function nDe(e){let t={};return c4(e,([e])=>t[e]={name:e}),Object.values(t)}function rDe(e){let t={};return c4(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function c4(e,t){A$(e,e=>t(e.split(/\s+/)))}var iDe=m$({"src/lib/responses/GetRemoteSummary.ts"(){p1()}}),l4={};h$(l4,{addRemoteTask:()=>aDe,getRemotesTask:()=>oDe,listRemotesTask:()=>sDe,remoteTask:()=>cDe,removeRemoteTask:()=>lDe});function aDe(e,t,n){return O1([`remote`,`add`,...n,e,t])}function oDe(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?rDe:nDe}}function sDe(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),O1(t)}function cDe(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),O1(t)}function lDe(e){return O1([`remote`,`remove`,e])}var uDe=m$({"src/lib/tasks/remote.ts"(){iDe(),N1()}}),u4={};h$(u4,{stashListTask:()=>dDe});function dDe(e={},t){let n=U0(e),r=[`stash`,`list`,...n.commands,...t],i=P0(n.splitter,n.fields,C0(r));return V0(r)||{commands:r,format:`utf-8`,parser:i}}var fDe=m$({"src/lib/tasks/stash-list.ts"(){T0(),z0(),H0(),G0()}}),d4={};h$(d4,{addSubModuleTask:()=>pDe,initSubModuleTask:()=>mDe,subModuleTask:()=>f4,updateSubModuleTask:()=>hDe});function pDe(e,t){return f4([`add`,e,t])}function mDe(e){return f4([`init`,...e])}function f4(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),O1(t)}function hDe(e){return f4([`update`,...e])}var gDe=m$({"src/lib/tasks/sub-module.ts"(){N1()}});function _De(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?p4(e,t):0:n?1:-1}function p4(e,t){return e===t?0:e>t?1:-1}function vDe(e){return e.trim()}function m4(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var h4,g4,yDe=m$({"src/lib/responses/TagList.ts"(){h4=class{constructor(e,t){this.all=e,this.latest=t}},g4=function(e,t=!1){let n=e.split(`
730
- `).map(vDe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return _De(m4(n[0]),m4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=p4(m4(n[e]),m4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new h4(n,r)}}}),_4={};h$(_4,{addAnnotatedTagTask:()=>SDe,addTagTask:()=>xDe,tagListTask:()=>bDe});function bDe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return g4(e,t)}}}function xDe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function SDe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var CDe=m$({"src/lib/tasks/tag.ts"(){yDe()}}),wDe=Lwe({"src/git.js"(e,t){var{GitExecutor:n}=(ETe(),g$(p0)),{SimpleGitApi:r}=(EEe(),g$(I2)),{Scheduler:i}=(DEe(),g$(R2)),{adhocExecTask:a,configurationErrorTask:o}=(N1(),g$(T1)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(p1(),g$(f1)),{applyPatchTask:g}=(kEe(),g$(V2)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(BEe(),g$($2)),{checkIgnoreTask:x}=(WEe(),g$(n4)),{checkIsRepoTask:S}=(b1(),g$(m1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(V1(),g$(P1)),{diffSummaryTask:T}=(H0(),g$(B0)),{fetchTask:E}=(YEe(),g$(i4)),{moveTask:D}=($Ee(),g$(o4)),{pullTask:O}=(tDe(),g$(s4)),{pushTagsTask:ee}=(b2(),g$(v2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=(uDe(),g$(l4)),{getResetMode:k,resetTask:oe}=(a0(),g$(t0)),{stashListTask:A}=(fDe(),g$(u4)),{addSubModuleTask:j,initSubModuleTask:se,subModuleTask:ce,updateSubModuleTask:M}=(gDe(),g$(d4)),{addAnnotatedTagTask:N,addTagTask:le,tagListTask:ue}=(CDe(),g$(_4)),{straightThroughBufferTask:de,straightThroughStringTask:fe}=(N1(),g$(T1));function P(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(P.prototype=Object.create(r.prototype)).constructor=P,P.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},P.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},P.prototype.stashList=function(e){return this._runTask(A(h(arguments)||{},c(e)&&e||[]),m(arguments))},P.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},P.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},P.prototype.pull=function(e,t,n,r){return this._runTask(O(f(e,u),f(t,u),p(arguments)),m(arguments))},P.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},P.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},P.prototype.tags=function(e,t){return this._runTask(ue(p(arguments)),m(arguments))},P.prototype.rebase=function(){return this._runTask(fe([`rebase`,...p(arguments)]),m(arguments))},P.prototype.reset=function(e){return this._runTask(oe(k(e),p(arguments)),m(arguments))},P.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(fe([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},P.prototype.addTag=function(e){let t=typeof e==`string`?le(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},P.prototype.addAnnotatedTag=function(e,t){return this._runTask(N(e,t),m(arguments))},P.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`&&t),m(arguments))},P.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`&&t),m(arguments))},P.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},P.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},P.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(fe(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},P.prototype.submoduleAdd=function(e,t,n){return this._runTask(j(e,t),m(arguments))},P.prototype.submoduleUpdate=function(e,t){return this._runTask(M(p(arguments,!0)),m(arguments))},P.prototype.submoduleInit=function(e,t){return this._runTask(se(p(arguments,!0)),m(arguments))},P.prototype.subModule=function(e,t){return this._runTask(ce(p(arguments)),m(arguments))},P.prototype.listRemote=function(){return this._runTask(re(p(arguments)),m(arguments))},P.prototype.addRemote=function(e,t,n){return this._runTask(te(e,t,p(arguments)),m(arguments))},P.prototype.removeRemote=function(e,t){return this._runTask(ae(e),m(arguments))},P.prototype.getRemotes=function(e,t){return this._runTask(ne(e===!0),m(arguments))},P.prototype.remote=function(e,t){return this._runTask(ie(p(arguments)),m(arguments))},P.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(fe(n),m(arguments))},P.prototype.updateServerInfo=function(e){return this._runTask(fe([`update-server-info`]),m(arguments))},P.prototype.pushTags=function(e,t){let n=ee({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},P.prototype.rm=function(e){return this._runTask(fe([`rm`,`-f`,...s(e)]),m(arguments))},P.prototype.rmKeepLocal=function(e){return this._runTask(fe([`rm`,`--cached`,...s(e)]),m(arguments))},P.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},P.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},P.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?de(r):fe(r);return this._runTask(a,n)},P.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):fe([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},P.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},P.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},P.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(fe(e,!0),m(arguments))},P.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},P.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},P.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},P.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},P.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=P}});v$(),v$(),v$(),b$(),S$(),b1(),V1(),K1(),Y1(),e0(),a0(),p1(),p1(),(0,c$.deferred)().promise,p1(),v$(),p1(),p1(),p1(),p1(),wDe(),b$();var TDe=i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let O=e=>new D(e);if(O.isPathValid=e=>T(e&&T.convert(e),e,p),O.default=O,t.exports=O,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}})),EDe=i(((e,t)=>{function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}let r=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function i(e){if(Buffer.isBuffer(e))return e;if(typeof e==`number`)return Buffer.alloc(e);if(typeof e==`string`)return Buffer.from(e);throw Error(`input must be buffer, number, or string, received `+typeof e)}function a(e){let t=i(4);return t.writeInt32BE(e,0),t}function o(e,t){e=i(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~~t^-1;for(var a=0;a<e.length;a++)n=r[(n^e[a])&255]^n>>>8;return n^-1}function s(){return a(o.apply(null,arguments))}s.signed=function(){return o.apply(null,arguments)},s.unsigned=function(){return o.apply(null,arguments)>>>0},t.exports=n(s)})),v4=i((e=>{var n=t(`fs`),r=t(`stream`).Transform,i=t(`stream`).PassThrough,a=t(`zlib`),o=t(`util`),s=t(`events`).EventEmitter,c=t(`events`).errorMonitor,l=EDe();e.ZipFile=u,e.dateToDosDateTime=j,o.inherits(u,s);function u(){this.outputStream=new i,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,function(){this.errored=!0})}u.prototype.addFile=function(e,t,r){var i=this;if(t=S(t,!1),r??={},!_(i)){var a=new w(t,!1,r);i.entries.push(a),n.stat(e,function(t,o){if(t)return i.emit(`error`,t);if(!o.isFile())return i.emit(`error`,Error(`not a file: `+e));a.uncompressedSize=o.size,r.mtime??a.setLastModDate(o.mtime),r.mode??a.setFileAttributesMode(o.mode),a.setFileDataPumpFunction(function(){var t=n.createReadStream(e);a.state=w.FILE_DATA_IN_PROGRESS,t.on(`error`,function(e){i.emit(`error`,e)}),p(i,a,t)}),h(i)})}},u.prototype.addReadStream=function(e,t,n){this.addReadStreamLazy(t,n,function(t){t(null,e)})},u.prototype.addReadStreamLazy=function(e,t,n){var r=this;if(typeof t==`function`&&(n=t,t=null),t??={},e=S(e,!1),!_(r)){var i=new w(e,!1,t);r.entries.push(i),i.setFileDataPumpFunction(function(){i.state=w.FILE_DATA_IN_PROGRESS,n(function(e,t){if(e)return r.emit(`error`,e);p(r,i,t)})}),h(r)}},u.prototype.addBuffer=function(e,t,n){var r=this;if(t=S(t,!1),e.length>1073741823)throw Error(`buffer too large: `+e.length+` > 1073741823`);if(n??={},n.size!=null)throw Error(`options.size not allowed`);if(_(r))return;var i=new w(t,!1,n);i.uncompressedSize=e.length,i.crc32=l.unsigned(e),i.crcAndFileSizeKnown=!0,r.entries.push(i),i.compressionLevel===0?o(e):a.deflateRaw(e,{level:i.compressionLevel},function(e,t){o(t)});function o(e){i.compressedSize=e.length,i.setFileDataPumpFunction(function(){f(r,e),f(r,i.getDataDescriptor()),i.state=w.FILE_DATA_DONE,setImmediate(function(){h(r)})}),h(r)}},u.prototype.addEmptyDirectory=function(e,t){var n=this;if(e=S(e,!0),t??={},t.size!=null)throw Error(`options.size not allowed`);if(t.compress!=null)throw Error(`options.compress not allowed`);if(t.compressionLevel!=null)throw Error(`options.compressionLevel not allowed`);if(!_(n)){var r=new w(e,!0,t);n.entries.push(r),r.setFileDataPumpFunction(function(){f(n,r.getDataDescriptor()),r.state=w.FILE_DATA_DONE,h(n)}),h(n)}};var d=fe([80,75,5,6]);u.prototype.end=function(e,t){if(typeof e==`function`&&(t=e,e=null),e??={},!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if(this.comment=typeof e.comment==`string`?ue(e.comment):e.comment,this.comment.length>65535)throw Error(`comment is too large`);if(P(this.comment,d))throw Error(`comment contains end of central directory record signature`)}else this.comment=C;h(this)}};function f(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function p(e,t,n){var r=new M,o=new ce,s=t.compressionLevel===0?new i:new a.DeflateRaw({level:t.compressionLevel}),c=new ce;n.pipe(r).pipe(o).pipe(s).pipe(c).pipe(e.outputStream,{end:!1}),c.on(`end`,function(){if(t.crc32=r.crc32,t.uncompressedSize==null)t.uncompressedSize=o.byteCount;else if(t.uncompressedSize!==o.byteCount)return e.emit(`error`,Error(`file data stream has unexpected number of bytes`));t.compressedSize=c.byteCount,e.outputStreamCursor+=t.compressedSize,f(e,t.getDataDescriptor()),t.state=w.FILE_DATA_DONE,h(e)})}function m(e){if(e.compress!=null&&e.compressionLevel!=null&&!!e.compress!=!!e.compressionLevel)throw Error(`conflicting settings for compress and compressionLevel`);return e.compressionLevel==null?e.compress===!1?0:6:e.compressionLevel}function h(e){if(e.allDone||e.errored)return;if(e.ended&&e.calculatedTotalSizeCallback!=null){var t=g(e);t!=null&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var n=r();function r(){for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.state<w.FILE_DATA_DONE)return n}return null}if(n!=null){if(n.state<w.READY_TO_PUMP_FILE_DATA||n.state===w.FILE_DATA_IN_PROGRESS)return;n.relativeOffsetOfLocalHeader=e.outputStreamCursor,f(e,n.getLocalFileHeader()),n.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach(function(t){f(e,t.getCentralDirectoryRecord())}),f(e,x(e)),e.outputStream.end(),e.allDone=!0)}function g(e){for(var t=0,n=0,r=0;r<e.entries.length;r++){var i=e.entries[r];if(i.compressionLevel!==0)return-1;if(i.state>=w.READY_TO_PUMP_FILE_DATA){if(i.uncompressedSize==null)return-1}else if(i.uncompressedSize==null)return null;i.relativeOffsetOfLocalHeader=t;var a=i.useZip64Format();t+=T+i.utf8FileName.length,t+=i.uncompressedSize,i.crcAndFileSizeKnown||(t+=a?re:ne),n+=ie+i.utf8FileName.length+i.fileComment.length,i.forceDosTimestamp||(n+=ae),a&&(n+=k)}var o=0;return(e.forceZip64Eocd||e.entries.length>=65535||n>=65535||t>=4294967295)&&(o+=v+y),o+=b+e.comment.length,t+n+o}function _(e){if(e.ended)throw Error(`cannot add entries after calling end()`);return!!e.errored}var v=56,y=20,b=22;function x(e,t){var n=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,n=!0);var i=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,a=i;(e.forceZip64Eocd||i>=4294967295)&&(a=4294967295,n=!0);var o=e.offsetOfStartOfCentralDirectory;if((e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(o=4294967295,n=!0),t)return n?v+y+b:b;var s=de(b+e.comment.length);if(s.writeUInt32LE(101010256,0),s.writeUInt16LE(0,4),s.writeUInt16LE(0,6),s.writeUInt16LE(r,8),s.writeUInt16LE(r,10),s.writeUInt32LE(a,12),s.writeUInt32LE(o,16),s.writeUInt16LE(e.comment.length,20),e.comment.copy(s,22),!n)return s;var c=de(v);c.writeUInt32LE(101075792,0),se(c,v-12,4),c.writeUInt16LE(O,12),c.writeUInt16LE(D,14),c.writeUInt32LE(0,16),c.writeUInt32LE(0,20),se(c,e.entries.length,24),se(c,e.entries.length,32),se(c,i,40),se(c,e.offsetOfStartOfCentralDirectory,48);var l=de(y);return l.writeUInt32LE(117853008,0),l.writeUInt32LE(0,4),se(l,e.outputStreamCursor,8),l.writeUInt32LE(1,16),Buffer.concat([c,l,s])}function S(e,t){if(e===``)throw Error(`empty metadataPath`);if(e=e.replace(/\\/g,`/`),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw Error(`absolute path: `+e);if(e.split(`/`).indexOf(`..`)!==-1)throw Error(`invalid relative path: `+e);var n=/\/$/.test(e);if(t)n||(e+=`/`);else if(n)throw Error(`file path cannot end with '/': `+e);return e}var C=de(0);function w(e,t,n){if(this.utf8FileName=fe(e),this.utf8FileName.length>65535)throw Error(`utf8 file name too long. `+utf8FileName.length+` > 65535`);if(this.isDirectory=t,this.state=w.WAITING_FOR_METADATA,this.setLastModDate(n.mtime==null?new Date:n.mtime),this.forceDosTimestamp=!!n.forceDosTimestamp,n.mode==null?this.setFileAttributesMode(t?16893:33204):this.setFileAttributesMode(n.mode),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,n.size!=null&&(this.uncompressedSize=n.size)),this.compressionLevel=t?0:m(n),this.forceZip64Format=!!n.forceZip64Format,n.fileComment){if(this.fileComment=typeof n.fileComment==`string`?fe(n.fileComment,`utf-8`):n.fileComment,this.fileComment.length>65535)throw Error(`fileComment is too large`)}else this.fileComment=C}w.WAITING_FOR_METADATA=0,w.READY_TO_PUMP_FILE_DATA=1,w.FILE_DATA_IN_PROGRESS=2,w.FILE_DATA_DONE=3,w.prototype.setLastModDate=function(e){this.mtime=e;var t=j(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},w.prototype.setFileAttributesMode=function(e){if((e&65535)!==e)throw Error(`invalid mode. expected: 0 <= `+e+` <= 65535`);this.externalFileAttributes=e<<16>>>0},w.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=w.READY_TO_PUMP_FILE_DATA},w.prototype.useZip64Format=function(){return this.forceZip64Format||this.uncompressedSize!=null&&this.uncompressedSize>4294967294||this.compressedSize!=null&&this.compressedSize>4294967294||this.relativeOffsetOfLocalHeader!=null&&this.relativeOffsetOfLocalHeader>4294967294};var T=30,E=20,D=45,O=831,ee=2048,te=8;w.prototype.getLocalFileHeader=function(){var e=0,t=0,n=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,n=this.uncompressedSize);var r=de(T),i=ee;return this.crcAndFileSizeKnown||(i|=te),r.writeUInt32LE(67324752,0),r.writeUInt16LE(E,4),r.writeUInt16LE(i,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(n,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var ne=16,re=24;w.prototype.getDataDescriptor=function(){if(this.crcAndFileSizeKnown)return C;if(this.useZip64Format()){var e=de(re);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),se(e,this.compressedSize,8),se(e,this.uncompressedSize,16),e}var e=de(ne);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e};var ie=46,ae=9,k=28;w.prototype.getCentralDirectoryRecord=function(){var e=de(ie),t=ee;this.crcAndFileSizeKnown||(t|=te);var n=C;if(!this.forceDosTimestamp){n=de(ae),n.writeUInt16LE(21589,0),n.writeUInt16LE(ae-4,2),n.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),n.writeUInt32LE(r,5)}var i=this.compressedSize,a=this.uncompressedSize,o=this.relativeOffsetOfLocalHeader,s=E,c=C;return this.useZip64Format()&&(i=4294967295,a=4294967295,o=4294967295,s=D,c=de(k),c.writeUInt16LE(1,0),c.writeUInt16LE(k-4,2),se(c,this.uncompressedSize,4),se(c,this.compressedSize,12),se(c,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(O,4),e.writeUInt16LE(s,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(i,20),e.writeUInt32LE(a,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(n.length+c.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(o,42),Buffer.concat([e,this.utf8FileName,n,c,this.fileComment])},w.prototype.getCompressionMethod=function(){return this.compressionLevel===0?0:8};var oe=new Date(1980,0,1),A=new Date(2107,11,31,23,59,58);function j(e){e<oe?e=oe:e>A&&(e=A);var t=0;t|=e.getDate()&31,t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var n=0;return n|=Math.floor(e.getSeconds()/2),n|=(e.getMinutes()&63)<<5,n|=(e.getHours()&31)<<11,{date:t,time:n}}function se(e,t,n){var r=Math.floor(t/4294967296),i=t%4294967296;e.writeUInt32LE(i,n),e.writeUInt32LE(r,n+4)}o.inherits(ce,r);function ce(e){r.call(this,e),this.byteCount=0}ce.prototype._transform=function(e,t,n){this.byteCount+=e.length,n(null,e)},o.inherits(M,r);function M(e){r.call(this,e),this.crc32=0}M.prototype._transform=function(e,t,n){this.crc32=l.unsigned(e,this.crc32),n(null,e)};var N=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;if(N.length!==256)throw Error(`assertion failure`);var le=null;function ue(e){if(/^[\x20-\x7e]*$/.test(e))return fe(e,`utf-8`);if(le==null){le={};for(var t=0;t<N.length;t++)le[N[t]]=t}for(var n=de(e.length),t=0;t<e.length;t++){var r=le[e[t]];if(r==null)throw Error(`character not encodable in CP437: `+JSON.stringify(e[t]));n[t]=r}return n}function de(e){de=t;try{return de(e)}catch{return de=n,de(e)}function t(e){return Buffer.allocUnsafe(e)}function n(e){return new Buffer(e)}}function fe(e,t){fe=n;try{return fe(e,t)}catch{return fe=r,fe(e,t)}function n(e,t){return Buffer.from(e,t)}function r(e,t){return new Buffer(e,t)}}function P(e,t){P=n;try{return P(e,t)}catch{return P=r,P(e,t)}function n(e,t){return e.includes(t)}function r(e,t){for(var n=0;n<=e.length-t.length;n++)for(var r=0;;r++){if(r===t.length)return!0;if(e[n+r]!==t[r])break}return!1}}})),y4=e(TDe(),1),DDe=e(v4(),1);Fe(o),[...new Set([`.git`,`node_modules`])];const b4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var ODe=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),kDe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=ODe(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),ADe=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),jDe=i((e=>{t(`fs`);var n=t(`zlib`);kDe();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:ADe();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=!!(r.generalPurposeBitFlag&2048);r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(t.decompress!==!1&&t.decompress!==!0)throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return!!(this.generalPurposeBitFlag&1)},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,!!(e&2048)),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}})),x4=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n){let i=e.charCodeAt(n);if(u[i]!==1){if(n===a||r(e,n,t)===void 0)return;break}}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===o)return;break}}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r){let i=e.charCodeAt(r);if(u[i]!==1){if(a(e,r,n,t)===void 0)return;break}}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===s)return;break}}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),MDe=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),NDe=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=MDe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=x4(),d=Buffer.from(`\r
731
- `),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16384;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1048576,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,O=0,ee=0,te=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let ne=0,re,ie=0,ae,k,oe,A,j=!1,se=!1,ce=!1;this._hparser=null;let M=new g(e=>{this._hparser=null,te=!1,oe=`text/plain`,ae=i,k=`7bit`,A=void 0,j=!1;let t;if(!e[`content-disposition`]){te=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){te=!0;return}if(n.params&&(n.params.name&&(A=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(oe=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(ae=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(k=e[`content-transfer-encoding`][0].toLowerCase()),oe===`application/octet-stream`||t!==void 0){if(ee===w){se||(se=!0,this.emit(`filesLimit`)),te=!0;return}if(++ee,this.listenerCount(`file`)===0){te=!0;return}ne=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,A,this._fileStream,{filename:t,encoding:k,mimeType:oe})}else{if(O===T){ce||(ce=!0,this.emit(`fieldsLimit`)),te=!0;return}if(++O,this.listenerCount(`field`)===0){te=!0;return}re=[],ie=0}}),N=0,le=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,M.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(N!==0){if(N===1){switch(t[n]){case 45:N=2,++n;break;case 13:N=3,++n;break;default:N=0}if(n===r)return}if(N===2){if(N=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,le(!1,p,0,1,!1),this._writecb=e}else if(N===3){if(N=0,t[n]===10){if(++n,D>=E||(this._hparser=M,n===r))break;continue retrydata}{let e=this._writecb;this._writecb=m,le(!1,f,0,1,!1),this._writecb=e}}}if(!te){if(this._fileStream){let e,a=Math.min(r-n,C-ne);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ne+=e.length,ne===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,te=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(re!==void 0){let e,a=Math.min(r-n,S-ie);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ie+=a,re.push(e),ie===S&&(te=!0,j=!0)}}break}if(e){if(N=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(re!==void 0){let e;switch(re.length){case 0:e=``;break;case 1:e=s(re[0],ae,0);break;default:e=s(Buffer.concat(re,ie),ae,0)}re=void 0,ie=0,this.emit(`field`,A,e,{nameTruncated:!1,valueTruncated:j,encoding:k,mimeType:oe})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,le),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),PDe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=x4();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1048576,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),FDe=i(((e,t)=>{let{parseContentType:n}=x4();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[NDe(),PDe()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}}));jDe(),FDe();function S4(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&T4(e.charCodeAt(r)))for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&T4(e.charCodeAt(r))){for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
729
+ `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var U1,cTe=m$({"src/lib/responses/ConfigList.ts"(){p1(),U1=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=D$(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function W1(e,t){return typeof e==`string`&&Object.hasOwn(G1,e)?e:t}function lTe(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function uTe(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return oTe(t,e)}}}function dTe(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return aTe(e)}}}function fTe(){return{addConfig(e,t,...n){return this._runTask(lTe(e,t,n[0]===!0,W1(n[1],`local`)),l1(arguments))},getConfig(e,t){return this._runTask(uTe(e,W1(t,void 0)),l1(arguments))},listConfig(...e){return this._runTask(dTe(W1(e[0],void 0)),l1(arguments))}}}var G1,K1=m$({"src/lib/tasks/config.ts"(){cTe(),p1(),G1=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(G1||{})}});function pTe(e){return J1.has(e)}var q1,J1,Y1=m$({"src/lib/tasks/diff-name-status.ts"(){q1=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(q1||{}),J1=new Set(Object.values(q1))}});function mTe(...e){return new $1().param(...e)}function hTe(e){let t=new Set,n={};return A$(e,e=>{let[r,i,a]=e.split(V$);t.add(r),(n[r]=n[r]||[]).push({line:L$(i),path:r,preview:a})}),{paths:t,results:n}}function gTe(){return{grep(e){let t=l1(arguments),n=s1(arguments);for(let e of X1)if(n.includes(e))return this._runTask(D1(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=mTe().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return hTe(e)}},t)}}}var X1,Z1,Q1,$1,e0=m$({"src/lib/tasks/grep.ts"(){p1(),N1(),X1=[`-h`],Z1=Symbol(`grepQuery`),$1=class{constructor(){this[Q1]=[]}*[(Q1=Z1,Symbol.iterator)](){for(let e of this[Z1])yield e}and(...e){return e.length&&this[Z1].push(`--and`,`(`,...R$(e,`-e`),`)`),this}param(...e){return this[Z1].push(...R$(e,`-e`)),this}}}}),t0={};h$(t0,{ResetMode:()=>r0,getResetMode:()=>vTe,resetTask:()=>_Te});function _Te(e,t){let n=[`reset`];return n0(e)&&n.push(`--${e}`),n.push(...t),O1(n)}function vTe(e){if(n0(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function n0(e){return typeof e==`string`&&i0.includes(e)}var r0,i0,a0=m$({"src/lib/tasks/reset.ts"(){p1(),N1(),r0=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(r0||{}),i0=I$(Object.values(r0))}});function yTe(){return(0,s$.default)(`simple-git`)}function o0(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function bTe(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function s0(e,t,n,r=yTe()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=bTe(G$(t,Z$),o,r);return l(n);function c(t,n){return M$(a,s0(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&o0(o,n)||H$,s=o0(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var c0=m$({"src/lib/git-logger.ts"(){p1(),s$.default.formatters.L=e=>String($$(e)?e.length:`-`),s$.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):U$(e)}}),l0,xTe=m$({"src/lib/runners/tasks-pending-queue.ts"(){v$(),c0(),l0=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:s0(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new _$(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function u0(e,t){return{method:E$(e.commands)||``,commands:t}}function STe(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function d0(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var f0,CTe=m$({"src/lib/runners/git-executor-chain.ts"(){v$(),N1(),p1(),xTe(),f0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new l0}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(j1(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof _$?Object.assign(t,{task:e}):new _$(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,u0(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...u0(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),A1(e)?u1(e.parser,a):u1(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...u0(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,U$(e)),c(new n1(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new n1(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},u0(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{...u0(e,n),kill(e){u=e||u}});let d=Be(t,n,o);d.stdout.on(`data`,d0(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,d0(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,STe(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...u0(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...u0(e,t),kill(e){n=e||n}}),n}}}}),p0={};h$(p0,{GitExecutor:()=>m0});var m0,wTe=m$({"src/lib/runners/git-executor.ts"(){CTe(),m0=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new f0(this,this._scheduler,this._plugins)}chain(){return new f0(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function TTe(e,t,n=H$){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof y$?ETe(t):t,void 0)})}function ETe(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=H$};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var DTe=m$({"src/lib/task-callback.ts"(){b$(),p1()}});function h0(e,t){return E1(n=>{if(!j$(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var OTe=m$({"src/lib/tasks/change-working-directory.ts"(){p1(),N1()}});function g0(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=N$(t,`-B`)),O1(t)}function kTe(){return{checkout(){return this._runTask(g0(s1(arguments,1)),l1(arguments))},checkoutBranch(e,t){return this._runTask(g0([`-b`,e,t,...s1(arguments)]),l1(arguments))},checkoutLocalBranch(e){return this._runTask(g0([`-b`,e,...s1(arguments)]),l1(arguments))}}}var ATe=m$({"src/lib/tasks/checkout.ts"(){p1(),N1()}});function jTe(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function MTe(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return d1(jTe(),[_0],e)}})}}}var _0,NTe=m$({"src/lib/tasks/count-objects.ts"(){p1(),_0=new r1(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=F$(t);Object.hasOwn(e,r)&&(e[r]=L$(n))})}});function PTe(e){return d1({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},v0,e)}var v0,FTe=m$({"src/lib/parsers/parse-commit.ts"(){p1(),v0=[new r1(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new r1(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new r1(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new r1(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function ITe(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...R$(e,`-m`),...t,...n],format:`utf-8`,parser:PTe}}function LTe(){return{commit(t,...n){let r=l1(arguments),i=e(t)||ITe(P$(t),P$(G$(n[0],Q$,[])),[...I$(G$(n[1],Y$,[])),...s1(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!Q$(e)&&D1(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var RTe=m$({"src/lib/tasks/commit.ts"(){FTe(),p1(),N1()}});function zTe(){return{firstCommit(){return this._runTask(O1([`rev-list`,`--max-parents=0`,`HEAD`],!0),l1(arguments))}}}var BTe=m$({"src/lib/tasks/first-commit.ts"(){p1(),N1()}});function VTe(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),O1(n,!0)}var HTe=m$({"src/lib/tasks/hash-object.ts"(){N1()}});function UTe(e,t,n){let r=String(n).trim(),i;if(i=b0.exec(r))return new y0(e,t,!1,i[1]);if(i=x0.exec(r))return new y0(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new y0(e,t,/^re/i.test(r),a)}var y0,b0,x0,WTe=m$({"src/lib/responses/InitSummary.ts"(){y0=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},b0=/^Init.+ repository in (.+)$/,x0=/^Rein.+ in (.+)$/}});function GTe(e){return e.includes(S0)}function KTe(e=!1,t,n){let r=[`init`,...n];return e&&!GTe(r)&&r.splice(1,0,S0),{commands:r,format:`utf-8`,parser(e){return UTe(r.includes(`--bare`),t,e)}}}var S0,qTe=m$({"src/lib/tasks/init.ts"(){WTe(),S0=`--bare`}});function C0(e){for(let t=0;t<e.length;t++){let n=w0.exec(e[t]);if(n)return`--${n[1]}`}return``}function JTe(e){return w0.test(e)}var w0,T0=m$({"src/lib/args/log-format.ts"(){w0=/^--(stat|numstat|name-only|name-status)(=|$)/}}),E0,YTe=m$({"src/lib/responses/DiffSummary.ts"(){E0=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function D0(e=``){let t=M0[e];return e=>d1(new E0,t,e,!1)}var O0,k0,A0,j0,M0,N0=m$({"src/lib/parsers/parse-diff-summary.ts"(){T0(),YTe(),Y1(),p1(),O0=[new r1(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:L$(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new r1(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:L$(n),after:L$(r),binary:!0})}),new r1(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=L$(t),e.insertions=L$(r?.[1]),e.deletions=L$(i?.[1])})],k0=[new r1(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=L$(t),a=L$(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new r1(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],A0=[new r1(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],j0=[new r1(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:B$(pTe(t)&&t),from:B$(!!a&&r!==a&&r),similarity:L$(n)})})],M0={"":O0,"--stat":O0,"--numstat":k0,"--name-status":j0,"--name-only":A0}}});function XTe(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function P0(e=L0,t=R0,n=``){let r=D0(n);return function(n){let i=k$(n.trim(),!1,F0).map(function(n){let i=n.split(I0),a=XTe(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var F0,I0,L0,R0,z0=m$({"src/lib/parsers/parse-list-log-summary.ts"(){p1(),N0(),T0(),F0=`òòòòòò `,I0=` òò`,L0=` ò `,R0=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),B0={};h$(B0,{diffSummaryTask:()=>ZTe,validateLogFormatConfig:()=>V0});function ZTe(e){let t=C0(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),V0(n)||{commands:n,format:`utf-8`,parser:D0(t)}}function V0(e){let t=e.filter(JTe);if(t.length>1)return D1(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return D1(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var H0=m$({"src/lib/tasks/diff.ts"(){T0(),N0(),N1()}});function QTe(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function $Te(e){return Object.keys(e).reduce((t,n)=>(n in W0||(t[n]=e[n]),t),{})}function U0(e={},t=[]){let n=G$(e.splitter,Z$,L0),[r,i]=QTe(q$(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${F0}${i}${I0}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return Z$(e.file)&&o.push(`--follow`,a$(e.file)),o1($Te(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function eEe(e,t,n){let r=P0(e,t,C0(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function tEe(){return{log(...n){let r=l1(arguments),i=U0(c1(arguments),I$(G$(arguments[0],Y$,[]))),a=t(...n)||V0(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return eEe(e.splitter,e.fields,e.commands)}function t(e,t){return Z$(e)&&Z$(t)&&D1(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var W0,G0=m$({"src/lib/tasks/log.ts"(){T0(),z0(),p1(),N1(),H0(),W0=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(W0||{})}}),K0,q0,nEe=m$({"src/lib/responses/MergeSummary.ts"(){K0=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},q0=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),J0,Y0,rEe=m$({"src/lib/responses/PullSummary.ts"(){J0=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Y0=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function X0(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Z0(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:L$(t&&t[1]||`0`),delta:L$(n&&n[1]||`0`)}}var Q0,iEe=m$({"src/lib/parsers/parse-remote-objects.ts"(){p1(),Q0=[new i1(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=X0(e.remoteMessages);Object.assign(i,{[r]:L$(n)})}),new i1(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=X0(e.remoteMessages);Object.assign(i,{[r]:L$(n)})}),new i1(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=X0(e.remoteMessages);i.total=Z0(t),i.reused=Z0(n),i.packReused=L$(r)})]}});function $0(e,t){return d1({remoteMessages:new t2},e2,t)}var e2,t2,n2=m$({"src/lib/parsers/parse-remote-messages.ts"(){p1(),iEe(),e2=[new i1(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...Q0,new i1([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new i1([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:L$(t),summary:n,url:r}})],t2=class{constructor(){this.all=[]}}}});function aEe(e,t){let n=d1(new Y0,s2,[e,t]);return n.message&&n}var r2,i2,a2,o2,s2,c2,l2,u2=m$({"src/lib/parsers/parse-pull.ts"(){rEe(),p1(),n2(),r2=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,i2=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,a2=/^(create|delete) mode \d+ (.+)/,o2=[new r1(r2,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new r1(i2,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new r1(a2,(e,[t,n])=>{M$(e.files,n),M$(t===`create`?e.created:e.deleted,n)})],s2=[new r1(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new r1(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new r1(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],c2=(e,t)=>d1(new J0,o2,[e,t]),l2=(e,t)=>Object.assign(new J0,c2(e,t),$0(e,t))}}),d2,f2,p2,oEe=m$({"src/lib/parsers/parse-merge.ts"(){nEe(),p1(),u2(),d2=[new r1(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new r1(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new K0(t,n))}),new r1(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new K0(t,n,{deleteRef:r}))}),new r1(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new K0(t,null))}),new r1(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],f2=(e,t)=>Object.assign(p2(e,t),l2(e,t)),p2=e=>d1(new q0,d2,e)}});function m2(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=f2(e,t);if(n.failed)throw new y$(n);return n}}:D1(`Git.merge requires at least one option`)}var sEe=m$({"src/lib/tasks/merge.ts"(){b$(),oEe(),N1()}});function cEe(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var h2,g2,_2,lEe=m$({"src/lib/parsers/parse-push.ts"(){p1(),n2(),h2=[new r1(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new r1(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new r1(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(cEe(t,n,r))}),new r1(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new r1(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],g2=(e,t)=>{let n=_2(e,t),r=$0(e,t);return{...n,...r}},_2=(e,t)=>d1({pushed:[]},h2,[e,t])}}),v2={};h$(v2,{pushTagsTask:()=>uEe,pushTask:()=>y2});function uEe(e={},t){return M$(t,`--tags`),y2(e,t)}function y2(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),N$(n,`-v`),M$(n,`--verbose`),M$(n,`--porcelain`),{commands:n,format:`utf-8`,parser:g2}}var b2=m$({"src/lib/tasks/push.ts"(){lEe(),p1()}});function dEe(){return{showBuffer(){let e=[`show`,...s1(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(k1(e),l1(arguments))},show(){let e=[`show`,...s1(arguments,1)];return this._runTask(O1(e),l1(arguments))}}}var fEe=m$({"src/lib/tasks/show.ts"(){p1(),N1()}}),x2,S2,pEe=m$({"src/lib/responses/FileStatusSummary.ts"(){x2=/^(.+)\0(.+)$/,S2=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=x2.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function C2(e){let[t,n]=e.split(V$);return{from:n||t,to:t}}function w2(e,t,n){return[`${e}${t}`,n]}function T2(e,...t){return t.map(t=>w2(e,t,(e,t)=>e.conflicted.push(t)))}function mEe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=D2.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new S2(r,t,n))}}var E2,D2,O2,hEe=m$({"src/lib/responses/StatusSummary.ts"(){p1(),pEe(),E2=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},D2=new Map([w2(` `,`A`,(e,t)=>e.created.push(t)),w2(` `,`D`,(e,t)=>e.deleted.push(t)),w2(` `,`M`,(e,t)=>e.modified.push(t)),w2(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),w2(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),w2(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),w2(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),w2(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),w2(`R`,` `,(e,t)=>{e.renamed.push(C2(t))}),w2(`R`,`M`,(e,t)=>{let n=C2(t);e.renamed.push(n),e.modified.push(n.to)}),w2(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),w2(`?`,`?`,(e,t)=>e.not_added.push(t)),...T2(`A`,`A`,`U`),...T2(`D`,`D`,`U`),...T2(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=G$(s?.[1],Z$,null),s=a.exec(t),e.tracking=G$(s?.[1],Z$,null),s=o.exec(t),s&&(e.current=G$(s?.[1],Z$,e.current)),e.detached=/\(no branch\)/.test(t)}]]),O2=function(e){let t=e.split(V$),n=new E2;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=V$+(t[e++]||``)),mEe(n,r))}return n}}});function gEe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!k2.includes(e))],parser(e){return O2(e)}}}var k2,_Ee=m$({"src/lib/tasks/status.ts"(){hEe(),k2=[`--null`,`-z`]}});function A2(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function vEe(){return A2(0,0,0,``,!1)}function yEe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:bEe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(j2));r(t)}})}}}function bEe(e){return e===j2?vEe():d1(A2(0,0,0,e),M2,e)}var j2,M2,xEe=m$({"src/lib/tasks/version.ts"(){p1(),j2=`installed=false`,M2=[new r1(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,A2(L$(t),L$(n),L$(r),i))}),new r1(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,A2(L$(t),L$(n),r,i))})]}});function N2(e,t,n,...r){return Z$(n)?t(n,G$(r[0],Z$),s1(arguments)):D1(`git.${e}() requires a string 'repoPath'`)}function SEe(){return{clone(e,...t){return this._runTask(N2(`clone`,P2,G$(e,Z$),...t),l1(arguments))},mirror(e,...t){return this._runTask(N2(`mirror`,F2,G$(e,Z$),...t),l1(arguments))}}}var P2,F2,CEe=m$({"src/lib/tasks/clone.ts"(){N1(),p1(),P2=(e,t,n)=>{let r=[`clone`,...n];return Z$(e)&&r.push(a$(e)),Z$(t)&&r.push(a$(t)),O1(r)},F2=(e,t,n)=>(M$(n,`--mirror`),P2(e,t,n))}}),I2={};h$(I2,{SimpleGitApi:()=>L2});var L2,wEe=m$({"src/lib/simple-git-api.ts"(){DTe(),OTe(),ATe(),NTe(),RTe(),K1(),BTe(),e0(),HTe(),qTe(),G0(),sEe(),b2(),fEe(),_Ee(),N1(),xEe(),p1(),CEe(),L2=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&TTe(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(O1([`add`,...P$(e)]),l1(arguments))}cwd(e){let t=l1(arguments);return typeof e==`string`?this._runTask(h0(e,this._executor),t):typeof e?.path==`string`?this._runTask(h0(e.path,e.root&&this._executor||void 0),t):this._runTask(D1(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(VTe(e,t===!0),l1(arguments))}init(e){return this._runTask(KTe(e===!0,this._executor.cwd,s1(arguments)),l1(arguments))}merge(){return this._runTask(m2(s1(arguments)),l1(arguments))}mergeFromTo(e,t){return Z$(e)&&Z$(t)?this._runTask(m2([e,t,...s1(arguments)]),l1(arguments,!1)):this._runTask(D1(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=y2({remote:G$(arguments[0],Z$),branch:G$(arguments[1],Z$)},s1(arguments));return this._runTask(e,l1(arguments))}stash(){return this._runTask(O1([`stash`,...s1(arguments)]),l1(arguments))}status(){return this._runTask(gEe(s1(arguments)),l1(arguments))}},Object.assign(L2.prototype,kTe(),SEe(),LTe(),fTe(),MTe(),zTe(),gTe(),tEe(),dEe(),yEe())}}),R2={};h$(R2,{Scheduler:()=>B2});var z2,B2,TEe=m$({"src/lib/runners/scheduler.ts"(){p1(),c0(),z2=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,c$.createDeferred)();return{promise:t,done:n,id:e}}})(),B2=class{constructor(e=2){this.concurrency=e,this.logger=s0(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=M$(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),N$(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=M$(this.pending,z2());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),V2={};h$(V2,{applyPatchTask:()=>EEe});function EEe(e,t){return O1([`apply`,...t,...e])}var DEe=m$({"src/lib/tasks/apply-patch.ts"(){N1()}});function OEe(e,t){return{branch:e,hash:t,success:!0}}function kEe(e){return{branch:e,hash:null,success:!1}}var H2,AEe=m$({"src/lib/responses/BranchDeleteSummary.ts"(){H2=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function U2(e,t){return t===1&&G2.test(e)}var W2,G2,K2,q2,jEe=m$({"src/lib/parsers/parse-branch-delete.ts"(){AEe(),p1(),W2=/(\S+)\s+\(\S+\s([^)]+)\)/,G2=/^error[^']+'([^']+)'/m,K2=[new r1(W2,(e,[t,n])=>{let r=OEe(t,n);e.all.push(r),e.branches[t]=r}),new r1(G2,(e,[t])=>{let n=kEe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],q2=(e,t)=>d1(new H2,K2,[e,t])}}),J2,MEe=m$({"src/lib/responses/BranchSummary.ts"(){J2=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function Y2(e){return e?e.charAt(0):``}function X2(e,t=!1){return d1(new J2,t?[Q2]:Z2,e)}var Z2,Q2,NEe=m$({"src/lib/parsers/parse-branch.ts"(){MEe(),p1(),Z2=[new r1(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(Y2(t),!0,n,r,i)}),new r1(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(Y2(t),!1,n,r,i)})],Q2=new r1(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),$2={};h$($2,{branchLocalTask:()=>FEe,branchTask:()=>PEe,containsDeleteBranchCommand:()=>e4,deleteBranchTask:()=>LEe,deleteBranchesTask:()=>IEe});function e4(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function PEe(e){let t=e4(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?q2(e,r).all[0]:X2(e,n)}}}function FEe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return X2(e)}}}function IEe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return q2(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!U2(String(n),e))return i(n);r(t)}}}function LEe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return q2(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!U2(String(i),e))return o(i);throw new y$(n.parser(z$(r),z$(t)),String(i))}};return n}var REe=m$({"src/lib/tasks/branch.ts"(){b$(),jEe(),NEe(),p1()}});function zEe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&se(t)}var t4,BEe=m$({"src/lib/responses/CheckIgnore.ts"(){t4=e=>e.split(/\n/g).map(zEe).filter(Boolean)}}),n4={};h$(n4,{checkIgnoreTask:()=>VEe});function VEe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:t4}}var HEe=m$({"src/lib/tasks/check-ignore.ts"(){BEe()}});function UEe(e,t){return d1({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},r4,[e,t])}var r4,WEe=m$({"src/lib/parsers/parse-fetch.ts"(){p1(),r4=[new r1(/From (.+)$/,(e,[t])=>{e.remote=t}),new r1(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new r1(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new r1(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new r1(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),i4={};h$(i4,{fetchTask:()=>KEe});function GEe(e){return/^--upload-pack(=|$)/.test(e)}function KEe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(GEe)?D1(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:UEe}}var qEe=m$({"src/lib/tasks/fetch.ts"(){WEe(),N1()}});function JEe(e){return d1({moves:[]},a4,e)}var a4,YEe=m$({"src/lib/parsers/parse-move.ts"(){p1(),a4=[new r1(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),o4={};h$(o4,{moveTask:()=>XEe});function XEe(e,t){return{commands:[`mv`,`-v`,...P$(e),t],format:`utf-8`,parser:JEe}}var ZEe=m$({"src/lib/tasks/move.ts"(){YEe(),p1()}}),s4={};h$(s4,{pullTask:()=>QEe});function QEe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return l2(e,t)},onError(e,t,n,r){let i=aEe(z$(e.stdOut),z$(e.stdErr));if(i)return r(new y$(i));r(t)}}}var $Ee=m$({"src/lib/tasks/pull.ts"(){b$(),u2(),p1()}});function eDe(e){let t={};return c4(e,([e])=>t[e]={name:e}),Object.values(t)}function tDe(e){let t={};return c4(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function c4(e,t){A$(e,e=>t(e.split(/\s+/)))}var nDe=m$({"src/lib/responses/GetRemoteSummary.ts"(){p1()}}),l4={};h$(l4,{addRemoteTask:()=>rDe,getRemotesTask:()=>iDe,listRemotesTask:()=>aDe,remoteTask:()=>oDe,removeRemoteTask:()=>sDe});function rDe(e,t,n){return O1([`remote`,`add`,...n,e,t])}function iDe(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?tDe:eDe}}function aDe(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),O1(t)}function oDe(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),O1(t)}function sDe(e){return O1([`remote`,`remove`,e])}var cDe=m$({"src/lib/tasks/remote.ts"(){nDe(),N1()}}),u4={};h$(u4,{stashListTask:()=>lDe});function lDe(e={},t){let n=U0(e),r=[`stash`,`list`,...n.commands,...t],i=P0(n.splitter,n.fields,C0(r));return V0(r)||{commands:r,format:`utf-8`,parser:i}}var uDe=m$({"src/lib/tasks/stash-list.ts"(){T0(),z0(),H0(),G0()}}),d4={};h$(d4,{addSubModuleTask:()=>dDe,initSubModuleTask:()=>fDe,subModuleTask:()=>f4,updateSubModuleTask:()=>pDe});function dDe(e,t){return f4([`add`,e,t])}function fDe(e){return f4([`init`,...e])}function f4(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),O1(t)}function pDe(e){return f4([`update`,...e])}var mDe=m$({"src/lib/tasks/sub-module.ts"(){N1()}});function hDe(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?p4(e,t):0:n?1:-1}function p4(e,t){return e===t?0:e>t?1:-1}function gDe(e){return e.trim()}function m4(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var h4,g4,_De=m$({"src/lib/responses/TagList.ts"(){h4=class{constructor(e,t){this.all=e,this.latest=t}},g4=function(e,t=!1){let n=e.split(`
730
+ `).map(gDe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return hDe(m4(n[0]),m4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=p4(m4(n[e]),m4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new h4(n,r)}}}),_4={};h$(_4,{addAnnotatedTagTask:()=>bDe,addTagTask:()=>yDe,tagListTask:()=>vDe});function vDe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return g4(e,t)}}}function yDe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function bDe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var xDe=m$({"src/lib/tasks/tag.ts"(){_De()}}),SDe=Fwe({"src/git.js"(e,t){var{GitExecutor:n}=(wTe(),g$(p0)),{SimpleGitApi:r}=(wEe(),g$(I2)),{Scheduler:i}=(TEe(),g$(R2)),{adhocExecTask:a,configurationErrorTask:o}=(N1(),g$(T1)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(p1(),g$(f1)),{applyPatchTask:g}=(DEe(),g$(V2)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(REe(),g$($2)),{checkIgnoreTask:x}=(HEe(),g$(n4)),{checkIsRepoTask:S}=(b1(),g$(m1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(V1(),g$(P1)),{diffSummaryTask:T}=(H0(),g$(B0)),{fetchTask:E}=(qEe(),g$(i4)),{moveTask:D}=(ZEe(),g$(o4)),{pullTask:O}=($Ee(),g$(s4)),{pushTagsTask:ee}=(b2(),g$(v2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=(cDe(),g$(l4)),{getResetMode:k,resetTask:oe}=(a0(),g$(t0)),{stashListTask:A}=(uDe(),g$(u4)),{addSubModuleTask:j,initSubModuleTask:se,subModuleTask:ce,updateSubModuleTask:M}=(mDe(),g$(d4)),{addAnnotatedTagTask:N,addTagTask:le,tagListTask:ue}=(xDe(),g$(_4)),{straightThroughBufferTask:de,straightThroughStringTask:fe}=(N1(),g$(T1));function P(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(P.prototype=Object.create(r.prototype)).constructor=P,P.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},P.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},P.prototype.stashList=function(e){return this._runTask(A(h(arguments)||{},c(e)&&e||[]),m(arguments))},P.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},P.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},P.prototype.pull=function(e,t,n,r){return this._runTask(O(f(e,u),f(t,u),p(arguments)),m(arguments))},P.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},P.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},P.prototype.tags=function(e,t){return this._runTask(ue(p(arguments)),m(arguments))},P.prototype.rebase=function(){return this._runTask(fe([`rebase`,...p(arguments)]),m(arguments))},P.prototype.reset=function(e){return this._runTask(oe(k(e),p(arguments)),m(arguments))},P.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(fe([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},P.prototype.addTag=function(e){let t=typeof e==`string`?le(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},P.prototype.addAnnotatedTag=function(e,t){return this._runTask(N(e,t),m(arguments))},P.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`&&t),m(arguments))},P.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`&&t),m(arguments))},P.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},P.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},P.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(fe(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},P.prototype.submoduleAdd=function(e,t,n){return this._runTask(j(e,t),m(arguments))},P.prototype.submoduleUpdate=function(e,t){return this._runTask(M(p(arguments,!0)),m(arguments))},P.prototype.submoduleInit=function(e,t){return this._runTask(se(p(arguments,!0)),m(arguments))},P.prototype.subModule=function(e,t){return this._runTask(ce(p(arguments)),m(arguments))},P.prototype.listRemote=function(){return this._runTask(re(p(arguments)),m(arguments))},P.prototype.addRemote=function(e,t,n){return this._runTask(te(e,t,p(arguments)),m(arguments))},P.prototype.removeRemote=function(e,t){return this._runTask(ae(e),m(arguments))},P.prototype.getRemotes=function(e,t){return this._runTask(ne(e===!0),m(arguments))},P.prototype.remote=function(e,t){return this._runTask(ie(p(arguments)),m(arguments))},P.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(fe(n),m(arguments))},P.prototype.updateServerInfo=function(e){return this._runTask(fe([`update-server-info`]),m(arguments))},P.prototype.pushTags=function(e,t){let n=ee({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},P.prototype.rm=function(e){return this._runTask(fe([`rm`,`-f`,...s(e)]),m(arguments))},P.prototype.rmKeepLocal=function(e){return this._runTask(fe([`rm`,`--cached`,...s(e)]),m(arguments))},P.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},P.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},P.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?de(r):fe(r);return this._runTask(a,n)},P.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):fe([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},P.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},P.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},P.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(fe(e,!0),m(arguments))},P.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},P.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},P.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},P.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},P.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=P}});v$(),v$(),v$(),b$(),S$(),b1(),V1(),K1(),Y1(),e0(),a0(),p1(),p1(),(0,c$.deferred)().promise,p1(),v$(),p1(),p1(),p1(),p1(),SDe(),b$();var CDe=i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let O=e=>new D(e);if(O.isPathValid=e=>T(e&&T.convert(e),e,p),O.default=O,t.exports=O,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}})),wDe=i(((e,t)=>{function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}let r=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function i(e){if(Buffer.isBuffer(e))return e;if(typeof e==`number`)return Buffer.alloc(e);if(typeof e==`string`)return Buffer.from(e);throw Error(`input must be buffer, number, or string, received `+typeof e)}function a(e){let t=i(4);return t.writeInt32BE(e,0),t}function o(e,t){e=i(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~~t^-1;for(var a=0;a<e.length;a++)n=r[(n^e[a])&255]^n>>>8;return n^-1}function s(){return a(o.apply(null,arguments))}s.signed=function(){return o.apply(null,arguments)},s.unsigned=function(){return o.apply(null,arguments)>>>0},t.exports=n(s)})),v4=i((e=>{var n=t(`fs`),r=t(`stream`).Transform,i=t(`stream`).PassThrough,a=t(`zlib`),o=t(`util`),s=t(`events`).EventEmitter,c=t(`events`).errorMonitor,l=wDe();e.ZipFile=u,e.dateToDosDateTime=j,o.inherits(u,s);function u(){this.outputStream=new i,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,function(){this.errored=!0})}u.prototype.addFile=function(e,t,r){var i=this;if(t=S(t,!1),r??={},!_(i)){var a=new w(t,!1,r);i.entries.push(a),n.stat(e,function(t,o){if(t)return i.emit(`error`,t);if(!o.isFile())return i.emit(`error`,Error(`not a file: `+e));a.uncompressedSize=o.size,r.mtime??a.setLastModDate(o.mtime),r.mode??a.setFileAttributesMode(o.mode),a.setFileDataPumpFunction(function(){var t=n.createReadStream(e);a.state=w.FILE_DATA_IN_PROGRESS,t.on(`error`,function(e){i.emit(`error`,e)}),p(i,a,t)}),h(i)})}},u.prototype.addReadStream=function(e,t,n){this.addReadStreamLazy(t,n,function(t){t(null,e)})},u.prototype.addReadStreamLazy=function(e,t,n){var r=this;if(typeof t==`function`&&(n=t,t=null),t??={},e=S(e,!1),!_(r)){var i=new w(e,!1,t);r.entries.push(i),i.setFileDataPumpFunction(function(){i.state=w.FILE_DATA_IN_PROGRESS,n(function(e,t){if(e)return r.emit(`error`,e);p(r,i,t)})}),h(r)}},u.prototype.addBuffer=function(e,t,n){var r=this;if(t=S(t,!1),e.length>1073741823)throw Error(`buffer too large: `+e.length+` > 1073741823`);if(n??={},n.size!=null)throw Error(`options.size not allowed`);if(_(r))return;var i=new w(t,!1,n);i.uncompressedSize=e.length,i.crc32=l.unsigned(e),i.crcAndFileSizeKnown=!0,r.entries.push(i),i.compressionLevel===0?o(e):a.deflateRaw(e,{level:i.compressionLevel},function(e,t){o(t)});function o(e){i.compressedSize=e.length,i.setFileDataPumpFunction(function(){f(r,e),f(r,i.getDataDescriptor()),i.state=w.FILE_DATA_DONE,setImmediate(function(){h(r)})}),h(r)}},u.prototype.addEmptyDirectory=function(e,t){var n=this;if(e=S(e,!0),t??={},t.size!=null)throw Error(`options.size not allowed`);if(t.compress!=null)throw Error(`options.compress not allowed`);if(t.compressionLevel!=null)throw Error(`options.compressionLevel not allowed`);if(!_(n)){var r=new w(e,!0,t);n.entries.push(r),r.setFileDataPumpFunction(function(){f(n,r.getDataDescriptor()),r.state=w.FILE_DATA_DONE,h(n)}),h(n)}};var d=fe([80,75,5,6]);u.prototype.end=function(e,t){if(typeof e==`function`&&(t=e,e=null),e??={},!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if(this.comment=typeof e.comment==`string`?ue(e.comment):e.comment,this.comment.length>65535)throw Error(`comment is too large`);if(P(this.comment,d))throw Error(`comment contains end of central directory record signature`)}else this.comment=C;h(this)}};function f(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function p(e,t,n){var r=new M,o=new ce,s=t.compressionLevel===0?new i:new a.DeflateRaw({level:t.compressionLevel}),c=new ce;n.pipe(r).pipe(o).pipe(s).pipe(c).pipe(e.outputStream,{end:!1}),c.on(`end`,function(){if(t.crc32=r.crc32,t.uncompressedSize==null)t.uncompressedSize=o.byteCount;else if(t.uncompressedSize!==o.byteCount)return e.emit(`error`,Error(`file data stream has unexpected number of bytes`));t.compressedSize=c.byteCount,e.outputStreamCursor+=t.compressedSize,f(e,t.getDataDescriptor()),t.state=w.FILE_DATA_DONE,h(e)})}function m(e){if(e.compress!=null&&e.compressionLevel!=null&&!!e.compress!=!!e.compressionLevel)throw Error(`conflicting settings for compress and compressionLevel`);return e.compressionLevel==null?e.compress===!1?0:6:e.compressionLevel}function h(e){if(e.allDone||e.errored)return;if(e.ended&&e.calculatedTotalSizeCallback!=null){var t=g(e);t!=null&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var n=r();function r(){for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.state<w.FILE_DATA_DONE)return n}return null}if(n!=null){if(n.state<w.READY_TO_PUMP_FILE_DATA||n.state===w.FILE_DATA_IN_PROGRESS)return;n.relativeOffsetOfLocalHeader=e.outputStreamCursor,f(e,n.getLocalFileHeader()),n.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach(function(t){f(e,t.getCentralDirectoryRecord())}),f(e,x(e)),e.outputStream.end(),e.allDone=!0)}function g(e){for(var t=0,n=0,r=0;r<e.entries.length;r++){var i=e.entries[r];if(i.compressionLevel!==0)return-1;if(i.state>=w.READY_TO_PUMP_FILE_DATA){if(i.uncompressedSize==null)return-1}else if(i.uncompressedSize==null)return null;i.relativeOffsetOfLocalHeader=t;var a=i.useZip64Format();t+=T+i.utf8FileName.length,t+=i.uncompressedSize,i.crcAndFileSizeKnown||(t+=a?re:ne),n+=ie+i.utf8FileName.length+i.fileComment.length,i.forceDosTimestamp||(n+=ae),a&&(n+=k)}var o=0;return(e.forceZip64Eocd||e.entries.length>=65535||n>=65535||t>=4294967295)&&(o+=v+y),o+=b+e.comment.length,t+n+o}function _(e){if(e.ended)throw Error(`cannot add entries after calling end()`);return!!e.errored}var v=56,y=20,b=22;function x(e,t){var n=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,n=!0);var i=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,a=i;(e.forceZip64Eocd||i>=4294967295)&&(a=4294967295,n=!0);var o=e.offsetOfStartOfCentralDirectory;if((e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(o=4294967295,n=!0),t)return n?v+y+b:b;var s=de(b+e.comment.length);if(s.writeUInt32LE(101010256,0),s.writeUInt16LE(0,4),s.writeUInt16LE(0,6),s.writeUInt16LE(r,8),s.writeUInt16LE(r,10),s.writeUInt32LE(a,12),s.writeUInt32LE(o,16),s.writeUInt16LE(e.comment.length,20),e.comment.copy(s,22),!n)return s;var c=de(v);c.writeUInt32LE(101075792,0),se(c,v-12,4),c.writeUInt16LE(O,12),c.writeUInt16LE(D,14),c.writeUInt32LE(0,16),c.writeUInt32LE(0,20),se(c,e.entries.length,24),se(c,e.entries.length,32),se(c,i,40),se(c,e.offsetOfStartOfCentralDirectory,48);var l=de(y);return l.writeUInt32LE(117853008,0),l.writeUInt32LE(0,4),se(l,e.outputStreamCursor,8),l.writeUInt32LE(1,16),Buffer.concat([c,l,s])}function S(e,t){if(e===``)throw Error(`empty metadataPath`);if(e=e.replace(/\\/g,`/`),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw Error(`absolute path: `+e);if(e.split(`/`).indexOf(`..`)!==-1)throw Error(`invalid relative path: `+e);var n=/\/$/.test(e);if(t)n||(e+=`/`);else if(n)throw Error(`file path cannot end with '/': `+e);return e}var C=de(0);function w(e,t,n){if(this.utf8FileName=fe(e),this.utf8FileName.length>65535)throw Error(`utf8 file name too long. `+utf8FileName.length+` > 65535`);if(this.isDirectory=t,this.state=w.WAITING_FOR_METADATA,this.setLastModDate(n.mtime==null?new Date:n.mtime),this.forceDosTimestamp=!!n.forceDosTimestamp,n.mode==null?this.setFileAttributesMode(t?16893:33204):this.setFileAttributesMode(n.mode),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,n.size!=null&&(this.uncompressedSize=n.size)),this.compressionLevel=t?0:m(n),this.forceZip64Format=!!n.forceZip64Format,n.fileComment){if(this.fileComment=typeof n.fileComment==`string`?fe(n.fileComment,`utf-8`):n.fileComment,this.fileComment.length>65535)throw Error(`fileComment is too large`)}else this.fileComment=C}w.WAITING_FOR_METADATA=0,w.READY_TO_PUMP_FILE_DATA=1,w.FILE_DATA_IN_PROGRESS=2,w.FILE_DATA_DONE=3,w.prototype.setLastModDate=function(e){this.mtime=e;var t=j(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},w.prototype.setFileAttributesMode=function(e){if((e&65535)!==e)throw Error(`invalid mode. expected: 0 <= `+e+` <= 65535`);this.externalFileAttributes=e<<16>>>0},w.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=w.READY_TO_PUMP_FILE_DATA},w.prototype.useZip64Format=function(){return this.forceZip64Format||this.uncompressedSize!=null&&this.uncompressedSize>4294967294||this.compressedSize!=null&&this.compressedSize>4294967294||this.relativeOffsetOfLocalHeader!=null&&this.relativeOffsetOfLocalHeader>4294967294};var T=30,E=20,D=45,O=831,ee=2048,te=8;w.prototype.getLocalFileHeader=function(){var e=0,t=0,n=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,n=this.uncompressedSize);var r=de(T),i=ee;return this.crcAndFileSizeKnown||(i|=te),r.writeUInt32LE(67324752,0),r.writeUInt16LE(E,4),r.writeUInt16LE(i,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(n,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var ne=16,re=24;w.prototype.getDataDescriptor=function(){if(this.crcAndFileSizeKnown)return C;if(this.useZip64Format()){var e=de(re);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),se(e,this.compressedSize,8),se(e,this.uncompressedSize,16),e}var e=de(ne);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e};var ie=46,ae=9,k=28;w.prototype.getCentralDirectoryRecord=function(){var e=de(ie),t=ee;this.crcAndFileSizeKnown||(t|=te);var n=C;if(!this.forceDosTimestamp){n=de(ae),n.writeUInt16LE(21589,0),n.writeUInt16LE(ae-4,2),n.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),n.writeUInt32LE(r,5)}var i=this.compressedSize,a=this.uncompressedSize,o=this.relativeOffsetOfLocalHeader,s=E,c=C;return this.useZip64Format()&&(i=4294967295,a=4294967295,o=4294967295,s=D,c=de(k),c.writeUInt16LE(1,0),c.writeUInt16LE(k-4,2),se(c,this.uncompressedSize,4),se(c,this.compressedSize,12),se(c,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(O,4),e.writeUInt16LE(s,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(i,20),e.writeUInt32LE(a,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(n.length+c.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(o,42),Buffer.concat([e,this.utf8FileName,n,c,this.fileComment])},w.prototype.getCompressionMethod=function(){return this.compressionLevel===0?0:8};var oe=new Date(1980,0,1),A=new Date(2107,11,31,23,59,58);function j(e){e<oe?e=oe:e>A&&(e=A);var t=0;t|=e.getDate()&31,t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var n=0;return n|=Math.floor(e.getSeconds()/2),n|=(e.getMinutes()&63)<<5,n|=(e.getHours()&31)<<11,{date:t,time:n}}function se(e,t,n){var r=Math.floor(t/4294967296),i=t%4294967296;e.writeUInt32LE(i,n),e.writeUInt32LE(r,n+4)}o.inherits(ce,r);function ce(e){r.call(this,e),this.byteCount=0}ce.prototype._transform=function(e,t,n){this.byteCount+=e.length,n(null,e)},o.inherits(M,r);function M(e){r.call(this,e),this.crc32=0}M.prototype._transform=function(e,t,n){this.crc32=l.unsigned(e,this.crc32),n(null,e)};var N=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;if(N.length!==256)throw Error(`assertion failure`);var le=null;function ue(e){if(/^[\x20-\x7e]*$/.test(e))return fe(e,`utf-8`);if(le==null){le={};for(var t=0;t<N.length;t++)le[N[t]]=t}for(var n=de(e.length),t=0;t<e.length;t++){var r=le[e[t]];if(r==null)throw Error(`character not encodable in CP437: `+JSON.stringify(e[t]));n[t]=r}return n}function de(e){de=t;try{return de(e)}catch{return de=n,de(e)}function t(e){return Buffer.allocUnsafe(e)}function n(e){return new Buffer(e)}}function fe(e,t){fe=n;try{return fe(e,t)}catch{return fe=r,fe(e,t)}function n(e,t){return Buffer.from(e,t)}function r(e,t){return new Buffer(e,t)}}function P(e,t){P=n;try{return P(e,t)}catch{return P=r,P(e,t)}function n(e,t){return e.includes(t)}function r(e,t){for(var n=0;n<=e.length-t.length;n++)for(var r=0;;r++){if(r===t.length)return!0;if(e[n+r]!==t[r])break}return!1}}})),y4=e(CDe(),1),TDe=e(v4(),1);Fe(o),[...new Set([`.git`,`node_modules`])];const b4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var EDe=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),DDe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=EDe(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),ODe=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),kDe=i((e=>{t(`fs`);var n=t(`zlib`);DDe();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:ODe();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=!!(r.generalPurposeBitFlag&2048);r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(t.decompress!==!1&&t.decompress!==!0)throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return!!(this.generalPurposeBitFlag&1)},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,!!(e&2048)),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}})),x4=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n){let i=e.charCodeAt(n);if(u[i]!==1){if(n===a||r(e,n,t)===void 0)return;break}}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===o)return;break}}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r){let i=e.charCodeAt(r);if(u[i]!==1){if(a(e,r,n,t)===void 0)return;break}}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===s)return;break}}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),ADe=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),jDe=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=ADe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=x4(),d=Buffer.from(`\r
731
+ `),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16384;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1048576,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,O=0,ee=0,te=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let ne=0,re,ie=0,ae,k,oe,A,j=!1,se=!1,ce=!1;this._hparser=null;let M=new g(e=>{this._hparser=null,te=!1,oe=`text/plain`,ae=i,k=`7bit`,A=void 0,j=!1;let t;if(!e[`content-disposition`]){te=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){te=!0;return}if(n.params&&(n.params.name&&(A=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(oe=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(ae=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(k=e[`content-transfer-encoding`][0].toLowerCase()),oe===`application/octet-stream`||t!==void 0){if(ee===w){se||(se=!0,this.emit(`filesLimit`)),te=!0;return}if(++ee,this.listenerCount(`file`)===0){te=!0;return}ne=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,A,this._fileStream,{filename:t,encoding:k,mimeType:oe})}else{if(O===T){ce||(ce=!0,this.emit(`fieldsLimit`)),te=!0;return}if(++O,this.listenerCount(`field`)===0){te=!0;return}re=[],ie=0}}),N=0,le=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,M.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(N!==0){if(N===1){switch(t[n]){case 45:N=2,++n;break;case 13:N=3,++n;break;default:N=0}if(n===r)return}if(N===2){if(N=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,le(!1,p,0,1,!1),this._writecb=e}else if(N===3){if(N=0,t[n]===10){if(++n,D>=E||(this._hparser=M,n===r))break;continue retrydata}{let e=this._writecb;this._writecb=m,le(!1,f,0,1,!1),this._writecb=e}}}if(!te){if(this._fileStream){let e,a=Math.min(r-n,C-ne);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ne+=e.length,ne===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,te=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(re!==void 0){let e,a=Math.min(r-n,S-ie);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ie+=a,re.push(e),ie===S&&(te=!0,j=!0)}}break}if(e){if(N=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(re!==void 0){let e;switch(re.length){case 0:e=``;break;case 1:e=s(re[0],ae,0);break;default:e=s(Buffer.concat(re,ie),ae,0)}re=void 0,ie=0,this.emit(`field`,A,e,{nameTruncated:!1,valueTruncated:j,encoding:k,mimeType:oe})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,le),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),MDe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=x4();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1048576,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),NDe=i(((e,t)=>{let{parseContentType:n}=x4();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[jDe(),MDe()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}}));kDe(),NDe();function S4(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&T4(e.charCodeAt(r)))for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&T4(e.charCodeAt(r))){for(r++;r<e.length&&T4(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
732
732
  `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31){if(w4(a)){t+=e.substring(i,r),d=2;break}d=6}r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(C4(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(C4(t));return o=15}if(w4(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
733
- `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!w4(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,w4(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!T4(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(C4(e)||w4(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function C4(e){return e===32||e===9}function w4(e){return e===10||e===13}function T4(e){return e>=48&&e<=57}var IDe;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(IDe||={});const E4=Array(20).fill(0).map((e,t)=>` `.repeat(t)),D4={" ":{"\n":Array(200).fill(0).map((e,t)=>`
733
+ `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!w4(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,w4(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!T4(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(C4(e)||w4(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function C4(e){return e===32||e===9}function w4(e){return e===10||e===13}function T4(e){return e>=48&&e<=57}var PDe;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(PDe||={});const E4=Array(20).fill(0).map((e,t)=>` `.repeat(t)),D4={" ":{"\n":Array(200).fill(0).map((e,t)=>`
734
734
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
735
735
  `+` `.repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
736
736
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
737
- `+` `.repeat(t))}},LDe=[`
737
+ `+` `.repeat(t))}},FDe=[`
738
738
  `,`\r`,`\r
739
- `];function RDe(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!k4(e,a-1);)a--;let c=s;for(;c<e.length&&!k4(e,c);)c++;i=e.substring(a,c),r=zDe(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=BDe(n,e),l=LDe.includes(c),u=0,d=0,f;f=n.insertSpaces?E4[n.tabSize||4]??O4(E4[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=S4(i,!1),h=!1;function g(){if(u>1)return O4(c,u)+O4(f,r+d);let e=f.length*(r+d);return!l||e>D4[p][c].length?c+O4(f,r+d):e<=0?c:D4[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(O4(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?E4[f.length*r]:O4(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(E4[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=E4[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=E4[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():E4[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():E4[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=E4[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=E4[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=E4[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function O4(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function zDe(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===E4[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function BDe(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
739
+ `];function IDe(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!k4(e,a-1);)a--;let c=s;for(;c<e.length&&!k4(e,c);)c++;i=e.substring(a,c),r=LDe(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=RDe(n,e),l=FDe.includes(c),u=0,d=0,f;f=n.insertSpaces?E4[n.tabSize||4]??O4(E4[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=S4(i,!1),h=!1;function g(){if(u>1)return O4(c,u)+O4(f,r+d);let e=f.length*(r+d);return!l||e>D4[p][c].length?c+O4(f,r+d):e<=0?c:D4[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(O4(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?E4[f.length*r]:O4(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(E4[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=E4[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=E4[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():E4[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():E4[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=E4[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=E4[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=E4[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function O4(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function LDe(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===E4[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function RDe(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
740
740
  `?`\r
741
741
  `:`\r`;if(n===`
742
742
  `)return`
743
743
  `}return e&&e.eol||`
744
744
  `}function k4(e,t){return`\r
745
- `.indexOf(e.charAt(t))!==-1}var A4;(function(e){e.DEFAULT={allowTrailingComma:!1}})(A4||={});function VDe(e,t=[],n=A4.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return P4(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function j4(e,t=[],n=A4.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}P4(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:HDe(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function M4(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function N4(e){switch(e.type){case`array`:return e.children.map(N4);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=N4(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function P4(e,t,n=A4.DEFAULT){let r=S4(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ee()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ee()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ee(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ee()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function HDe(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function UDe(e,t,n,r){let i=t.slice(),a=j4(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=M4(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return F4(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=M4(o,[s]);if(t!==void 0){if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return F4(e,{offset:i,length:a-i,content:``},r)}return F4(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r)}{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return F4(e,a,r)}}if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return F4(e,i,r)}if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return F4(e,i,r)}if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return F4(e,t,r)}throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function F4(e,t,n){if(!n.formattingOptions)return[t];let r=I4(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!k4(r,i-1);)i--;for(;a<r.length&&!k4(r,a);)a++}let o=RDe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=I4(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function I4(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var WDe;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(WDe||={});var GDe;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(GDe||={});const KDe=VDe,qDe=j4,L4=N4;var JDe;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(JDe||={});function R4(e,t,n,r){return UDe(e,t,n,r)}function z4(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=I4(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}const YDe=global.Request;var B4=class extends YDe{constructor(e,t){if(typeof e==`object`&&J4 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[r3]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[J4]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const V4=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},XDe=Symbol(`wrapBodyStream`),ZDe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),QDe=e=>e===null||ZDe.has(e),H4=Symbol(`bodyBufferedBeforeDisconnect`),U4=Symbol(`bodyBufferedLengthBeforeDisconnect`),W4=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),G4=e=>!(e instanceof Ue)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&QDe(e.readableEncoding),K4=(e,t)=>{if(e.readableDidRead&&!t||!G4(e))return;let n=e;if(n[H4]!==void 0)return n[H4];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[U4]!==void 0&&e.readableLength!==n[U4])r=o3();else{let n=t??[],i=e.read();i!==null&&n.push(W4(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=o3())}}return n[H4]=r,r},q4=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},$De=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new B4(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[XDe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=K4(r);if(e!==void 0){q4(t,e);return}}e||=Ie.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=K4(r);a.body=e===void 0?Ie.toWeb(r):new ReadableStream({start(t){q4(t,e)}})}}return new B4(t,a)},J4=Symbol(`getRequestCache`),Y4=Symbol(`requestCache`),X4=Symbol(`incomingKey`),Z4=Symbol(`urlKey`),eOe=Symbol(`methodKey`),Q4=Symbol(`headersKey`),$4=Symbol(`abortControllerKey`),e3=Symbol(`getAbortController`),tOe=Symbol(`abortRequest`),t3=Symbol(`bodyBuffer`),n3=Symbol(`bodyReadPromise`),r3=Symbol(`bodyConsumedDirectly`),i3=Symbol(`bodyLockReader`),a3=Symbol(`abortReason`),o3=()=>TypeError(`Body is unusable`),s3=()=>Promise.reject(o3()),nOe=new TextDecoder,rOe=e=>{if(e[r3])return s3();e[r3]=!0},iOe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),aOe=e=>(e[Q4]||=V4(e[X4])).get(`content-type`)||``,oOe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,sOe=e=>{if(!oOe.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},c3=(e,t,n)=>{if(e[r3])return s3();let r=e.method;if(r===`GET`||r===`HEAD`)return e[J4]()[t]();let i=sOe(r);if(i)return Promise.reject(i);if(e[Y4]&&r!==`TRACE`)return e[Y4][t]();let a=rOe(e);if(a)return a;let o=cOe(e);if(o){let t=Promise.resolve(n(o,e));return e[t3]=void 0,t}return lOe(e).then(t=>{let r=n(t,e);return e[t3]=void 0,r})},cOe=e=>{let t=e[X4];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},l3=(e,t)=>{if(t.errored)return t.errored;let n=e[a3];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},lOe=e=>{if(e[t3])return Promise.resolve(e[t3]);if(e[n3])return e[n3];let t=e[X4];if(t.readableDidRead)return s3();let n=K4(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[t3]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!G4(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=K4(t,i);o instanceof Error?r(o):o===void 0?r(a??l3(e,t)):(e[t3]=o,n(o))}),!0)},c=e=>{i.push(W4(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[t3]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(l3(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[n3]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[n3]=r,r},u3={get method(){return this[eOe]},get url(){return this[Z4]},get headers(){return this[Q4]||=V4(this[X4])},[tOe](e){this[a3]===void 0&&(this[a3]=e);let t=this[$4];t&&!t.signal.aborted&&t.abort(e)},[e3](){return this[$4]||=new AbortController,this[a3]!==void 0&&!this[$4].signal.aborted&&this[$4].abort(this[a3]),this[$4]},[J4](){let e=this[e3]();if(this[Y4])return this[Y4];let t=this.method;if(this[r3]&&t!==`GET`&&t!==`HEAD`){this[t3]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new B4(this[Z4],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[Y4]=r}return this[Y4]=$De(this.method,this[Z4],this.headers,this[X4],e)},get body(){if(!this[r3])return this[J4]().body;let e=this[J4]();return!this[i3]&&e.body&&(this[i3]=e.body.getReader()),e.body},get bodyUsed(){return this[r3]?!0:this[Y4]?this[Y4].bodyUsed:!1}};Object.defineProperty(u3,"signal",{get(){return this[e3]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(u3,e,{get(){return this[J4]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(u3,e,{value:function(){if(this[r3]){if(e===`clone`)throw o3();return s3()}return this[J4]()[e]()}})}),Object.defineProperty(u3,"text",{value:function(){return c3(this,`text`,e=>nOe.decode(e))}}),Object.defineProperty(u3,"arrayBuffer",{value:function(){return c3(this,`arrayBuffer`,e=>iOe(e))}}),Object.defineProperty(u3,"blob",{value:function(){return c3(this,`blob`,(e,t)=>{let n=aOe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(u3,"json",{value:function(){return this[r3]?s3():this.text().then(JSON.parse)}}),Object.defineProperty(u3,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Y4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(u3,B4.prototype);const d3=Symbol(`responseCache`),f3=Symbol(`getResponseCache`),p3=Symbol(`cache`),m3=global.Response;var h3=class e{#e;#t;[f3](){let e=this[p3],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[p3],this[d3]||=new m3(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof m3){let t=n[d3];if(t){this.#t=t,this[f3]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[p3]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[p3];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[f3]().headers}get status(){return this[p3]?.[0]??this[f3]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(h3.prototype,e,{get(){return this[f3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(h3.prototype,e,{value:function(){return this[f3]()[e]()}})}),Object.defineProperty(h3.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[d3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(h3,m3),Object.setPrototypeOf(h3.prototype,m3.prototype);const uOe=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,dOe=e=>e instanceof URL?e.href:uOe.test(e)?e:new URL(e).href,fOe=new Set([301,302,303,307,308]);Object.defineProperty(h3,"redirect",{value:function(e,t=302){if(!fOe.has(t))throw RangeError(`Invalid status code`);return new h3(null,{status:t,headers:{location:dOe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(h3,"json",{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new h3(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}});function pOe(e,t){let n;try{n=E(e)}catch{return t.map(({editor:e,root:t})=>({host:e,root:t,state:`absent`}))}let r=e=>{let t=M(n,e);if(!(t===``||t.startsWith(`..`)||A(t)))return t.split(le).join(`/`)};return t.map(({editor:t,root:i})=>{let a=j(e,i),o;try{o=_(a)}catch{return{host:t,root:i,state:`absent`}}let s;try{s=E(a)}catch{return{host:t,root:i,state:`absent`}}if(o.isSymbolicLink()){let e=r(s);return{host:t,root:i,state:`linked`,real:s,...e?{target:e}:{}}}if(s!==j(n,i)){let e=r(s);return{host:t,root:i,state:`linked-parent`,real:s,...e?{target:e}:{}}}return{host:t,root:i,state:`own`,real:s}})}i(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))();const mOe={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},g3=pa(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),_3=$i([I(),L().int()]),v3=I();Zi({ttl:L().optional(),pollInterval:L().optional()});const hOe=V({ttl:L().optional()}),gOe=V({taskId:I()}),y3=Zi({progressToken:_3.optional(),"io.modelcontextprotocol/related-task":gOe.optional()}),b3=V({_meta:y3.optional()}),x3=b3.extend({task:hOe.optional()}),S3=V({method:I(),params:b3.loose().optional()}),C3=V({_meta:y3.optional()}),w3=V({method:I(),params:C3.loose().optional()}),T3=Zi({_meta:y3.optional()}),E3=$i([I(),L().int()]),_Oe=V({jsonrpc:W(`2.0`),id:E3,...S3.shape}).strict(),vOe=V({jsonrpc:W(`2.0`),...w3.shape}).strict(),D3=V({jsonrpc:W(`2.0`),id:E3,result:T3}).strict();var yOe;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(yOe||={});const O3=V({jsonrpc:W(`2.0`),id:E3.optional(),error:V({code:L().int(),message:I(),data:z().optional()})}).strict();$i([_Oe,vOe,D3,O3]),$i([D3,O3]);const k3=T3.strict(),bOe=C3.extend({requestId:E3.optional(),reason:I().optional()}),A3=w3.extend({method:W(`notifications/cancelled`),params:bOe}),j3=V({icons:B(V({src:I(),mimeType:I().optional(),sizes:B(I()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),M3=V({name:I(),title:I().optional()}),N3=M3.extend({...M3.shape,...j3.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),xOe=ma(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ta(V({form:ta(V({applyDefaults:R().optional()}),H(I(),z())).optional(),url:g3.optional()}),H(I(),z()).optional())),SOe=Zi({list:g3.optional(),cancel:g3.optional(),requests:Zi({sampling:Zi({createMessage:g3.optional()}).optional(),elicitation:Zi({create:g3.optional()}).optional()}).optional()}),COe=Zi({list:g3.optional(),cancel:g3.optional(),requests:Zi({tools:Zi({call:g3.optional()}).optional()}).optional()}),wOe=V({experimental:H(I(),g3).optional(),sampling:V({context:g3.optional(),tools:g3.optional()}).optional(),elicitation:xOe.optional(),roots:V({listChanged:R().optional()}).optional(),tasks:SOe.optional(),extensions:H(I(),g3).optional()}),TOe=b3.extend({protocolVersion:I(),capabilities:wOe,clientInfo:N3}),EOe=S3.extend({method:W(`initialize`),params:TOe}),DOe=V({experimental:H(I(),g3).optional(),logging:g3.optional(),completions:g3.optional(),prompts:V({listChanged:R().optional()}).optional(),resources:V({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:V({listChanged:R().optional()}).optional(),tasks:COe.optional(),extensions:H(I(),g3).optional()}),OOe=T3.extend({protocolVersion:I(),capabilities:DOe,serverInfo:N3,instructions:I().optional()}),kOe=w3.extend({method:W(`notifications/initialized`),params:C3.optional()}),P3=S3.extend({method:W(`ping`),params:b3.optional()}),AOe=V({progress:L(),total:oa(L()),message:oa(I())}),jOe=V({...C3.shape,...AOe.shape,progressToken:_3}),F3=w3.extend({method:W(`notifications/progress`),params:jOe}),MOe=b3.extend({cursor:v3.optional()}),I3=S3.extend({params:MOe.optional()}),L3=T3.extend({nextCursor:v3.optional()}),NOe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),R3=V({taskId:I(),status:NOe,ttl:$i([L(),qi()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:oa(L()),statusMessage:oa(I())}),z3=T3.extend({task:R3}),POe=C3.merge(R3),B3=w3.extend({method:W(`notifications/tasks/status`),params:POe}),V3=S3.extend({method:W(`tasks/get`),params:b3.extend({taskId:I()})}),H3=T3.merge(R3),U3=S3.extend({method:W(`tasks/result`),params:b3.extend({taskId:I()})});T3.loose();const W3=I3.extend({method:W(`tasks/list`)}),G3=L3.extend({tasks:B(R3)}),K3=S3.extend({method:W(`tasks/cancel`),params:b3.extend({taskId:I()})});T3.merge(R3);const q3=V({uri:I(),mimeType:oa(I()),_meta:H(I(),z()).optional()}),J3=q3.extend({text:I()}),Y3=I().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),X3=q3.extend({blob:Y3}),Z3=U([`user`,`assistant`]),Q3=V({audience:B(Z3).optional(),priority:L().min(0).max(1).optional(),lastModified:ki({offset:!0}).optional()}),$3=V({...M3.shape,...j3.shape,uri:I(),description:oa(I()),mimeType:oa(I()),size:oa(L()),annotations:Q3.optional(),_meta:oa(Zi({}))}),FOe=V({...M3.shape,...j3.shape,uriTemplate:I(),description:oa(I()),mimeType:oa(I()),annotations:Q3.optional(),_meta:oa(Zi({}))}),IOe=I3.extend({method:W(`resources/list`)}),LOe=L3.extend({resources:B($3)}),ROe=I3.extend({method:W(`resources/templates/list`)}),zOe=L3.extend({resourceTemplates:B(FOe)}),e6=b3.extend({uri:I()}),BOe=e6,VOe=S3.extend({method:W(`resources/read`),params:BOe}),HOe=T3.extend({contents:B($i([J3,X3]))}),UOe=w3.extend({method:W(`notifications/resources/list_changed`),params:C3.optional()}),WOe=e6,GOe=S3.extend({method:W(`resources/subscribe`),params:WOe}),KOe=e6,qOe=S3.extend({method:W(`resources/unsubscribe`),params:KOe}),JOe=C3.extend({uri:I()}),YOe=w3.extend({method:W(`notifications/resources/updated`),params:JOe}),XOe=V({name:I(),description:oa(I()),required:oa(R())}),ZOe=V({...M3.shape,...j3.shape,description:oa(I()),arguments:oa(B(XOe)),_meta:oa(Zi({}))}),QOe=I3.extend({method:W(`prompts/list`)}),$Oe=L3.extend({prompts:B(ZOe)}),eke=b3.extend({name:I(),arguments:H(I(),I()).optional()}),tke=S3.extend({method:W(`prompts/get`),params:eke}),t6=V({type:W(`text`),text:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),n6=V({type:W(`image`),data:Y3,mimeType:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),r6=V({type:W(`audio`),data:Y3,mimeType:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),nke=V({type:W(`tool_use`),name:I(),id:I(),input:H(I(),z()),_meta:H(I(),z()).optional()}),rke=V({type:W(`resource`),resource:$i([J3,X3]),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),i6=$i([t6,n6,r6,$3.extend({type:W(`resource_link`)}),rke]),ike=V({role:Z3,content:i6}),ake=T3.extend({description:I().optional(),messages:B(ike)}),oke=w3.extend({method:W(`notifications/prompts/list_changed`),params:C3.optional()}),ske=V({title:I().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),cke=V({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),a6=V({...M3.shape,...j3.shape,description:I().optional(),inputSchema:V({type:W(`object`),properties:H(I(),g3).optional(),required:B(I()).optional()}).catchall(z()),outputSchema:V({type:W(`object`),properties:H(I(),g3).optional(),required:B(I()).optional()}).catchall(z()).optional(),annotations:ske.optional(),execution:cke.optional(),_meta:H(I(),z()).optional()}),lke=I3.extend({method:W(`tools/list`)}),uke=L3.extend({tools:B(a6)}),o6=T3.extend({content:B(i6).default([]),structuredContent:H(I(),z()).optional(),isError:R().optional()});o6.or(T3.extend({toolResult:z()}));const dke=x3.extend({name:I(),arguments:H(I(),z()).optional()}),fke=S3.extend({method:W(`tools/call`),params:dke}),pke=w3.extend({method:W(`notifications/tools/list_changed`),params:C3.optional()});V({autoRefresh:R().default(!0),debounceMs:L().int().nonnegative().default(300)});const s6=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),mke=b3.extend({level:s6}),hke=S3.extend({method:W(`logging/setLevel`),params:mke}),gke=C3.extend({level:s6,logger:I().optional(),data:z()}),_ke=w3.extend({method:W(`notifications/message`),params:gke}),vke=V({hints:B(V({name:I().optional()})).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),yke=V({mode:U([`auto`,`required`,`none`]).optional()}),bke=V({type:W(`tool_result`),toolUseId:I().describe(`The unique identifier for the corresponding tool call.`),content:B(i6).default([]),structuredContent:V({}).loose().optional(),isError:R().optional(),_meta:H(I(),z()).optional()}),xke=ea(`type`,[t6,n6,r6]),c6=ea(`type`,[t6,n6,r6,nke,bke]),Ske=V({role:Z3,content:$i([c6,B(c6)]),_meta:H(I(),z()).optional()}),Cke=x3.extend({messages:B(Ske),modelPreferences:vke.optional(),systemPrompt:I().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:B(I()).optional(),metadata:g3.optional(),tools:B(a6).optional(),toolChoice:yke.optional()}),wke=S3.extend({method:W(`sampling/createMessage`),params:Cke}),Tke=T3.extend({model:I(),stopReason:oa(U([`endTurn`,`stopSequence`,`maxTokens`]).or(I())),role:Z3,content:xke}),Eke=T3.extend({model:I(),stopReason:oa(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(I())),role:Z3,content:$i([c6,B(c6)])}),Dke=V({type:W(`boolean`),title:I().optional(),description:I().optional(),default:R().optional()}),Oke=V({type:W(`string`),title:I().optional(),description:I().optional(),minLength:L().optional(),maxLength:L().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:I().optional()}),kke=V({type:U([`number`,`integer`]),title:I().optional(),description:I().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),Ake=V({type:W(`string`),title:I().optional(),description:I().optional(),enum:B(I()),default:I().optional()}),jke=V({type:W(`string`),title:I().optional(),description:I().optional(),oneOf:B(V({const:I(),title:I()})),default:I().optional()}),Mke=$i([$i([V({type:W(`string`),title:I().optional(),description:I().optional(),enum:B(I()),enumNames:B(I()).optional(),default:I().optional()}),$i([Ake,jke]),$i([V({type:W(`array`),title:I().optional(),description:I().optional(),minItems:L().optional(),maxItems:L().optional(),items:V({type:W(`string`),enum:B(I())}),default:B(I()).optional()}),V({type:W(`array`),title:I().optional(),description:I().optional(),minItems:L().optional(),maxItems:L().optional(),items:V({anyOf:B(V({const:I(),title:I()}))}),default:B(I()).optional()})])]),Dke,Oke,kke]),Nke=$i([x3.extend({mode:W(`form`).optional(),message:I(),requestedSchema:V({type:W(`object`),properties:H(I(),Mke),required:B(I()).optional()})}),x3.extend({mode:W(`url`),message:I(),elicitationId:I(),url:I().url()})]),Pke=S3.extend({method:W(`elicitation/create`),params:Nke}),Fke=C3.extend({elicitationId:I()}),Ike=w3.extend({method:W(`notifications/elicitation/complete`),params:Fke}),Lke=T3.extend({action:U([`accept`,`decline`,`cancel`]),content:ma(e=>e===null?void 0:e,H(I(),$i([I(),L(),R(),B(I())])).optional())}),Rke=V({type:W(`ref/resource`),uri:I()}),zke=V({type:W(`ref/prompt`),name:I()}),Bke=b3.extend({ref:$i([zke,Rke]),argument:V({name:I(),value:I()}),context:V({arguments:H(I(),I()).optional()}).optional()}),Vke=S3.extend({method:W(`completion/complete`),params:Bke}),Hke=T3.extend({completion:Zi({values:B(I()).max(100),total:oa(L().int()),hasMore:oa(R())})}),Uke=V({uri:I().startsWith(`file://`),name:I().optional(),_meta:H(I(),z()).optional()}),Wke=S3.extend({method:W(`roots/list`),params:b3.optional()}),Gke=T3.extend({roots:B(Uke)}),Kke=w3.extend({method:W(`notifications/roots/list_changed`),params:C3.optional()});$i([P3,EOe,Vke,hke,tke,QOe,IOe,ROe,VOe,GOe,qOe,fke,lke,V3,U3,W3,K3]),$i([A3,F3,kOe,Kke,B3]),$i([k3,Tke,Eke,Lke,Gke,H3,G3,z3]),$i([P3,wke,Pke,Wke,V3,U3,W3,K3]),$i([A3,F3,_ke,YOe,UOe,pke,oke,B3,Ike]),$i([k3,OOe,Hke,ake,$Oe,LOe,zOe,HOe,o6,uke,H3,G3,z3]);var qke;(function(e){e.Completable=`McpCompletable`})(qke||={});var Jke=global.Request,l6=class extends Jke{constructor(e,t){typeof e==`object`&&u6 in e&&(e=e[u6]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},Yke=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},Xke=Symbol(`wrapBodyStream`),Zke=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new l6(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[Xke]){let e;a.body=new ReadableStream({async pull(t){try{e||=ze.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=ze.toWeb(r)}return new l6(t,a)},u6=Symbol(`getRequestCache`),d6=Symbol(`requestCache`),f6=Symbol(`incomingKey`),p6=Symbol(`urlKey`),Qke=Symbol(`headersKey`),m6=Symbol(`abortControllerKey`),h6={get method(){return this[f6].method||`GET`},get url(){return this[p6]},get headers(){return this[Qke]||=Yke(this[f6])},[Symbol(`getAbortController`)](){return this[u6](),this[m6]},[u6](){return this[m6]||=new AbortController,this[d6]||=Zke(this.method,this[p6],this.headers,this[f6],this[m6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(h6,e,{get(){return this[u6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(h6,e,{value:function(){return this[u6]()[e]()}})}),Object.defineProperty(h6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[d6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(h6,l6.prototype);var g6=Symbol(`responseCache`),_6=Symbol(`getResponseCache`),v6=Symbol(`cache`),y6=global.Response,b6=class e{#e;#t;[_6](){return delete this[v6],this[g6]||=new y6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[g6];if(e){this.#t=e,this[_6]();return}this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[v6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[v6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[_6]().headers}get status(){return this[v6]?.[0]??this[_6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(b6.prototype,e,{get(){return this[_6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(b6.prototype,e,{value:function(){return this[_6]()[e]()}})}),Object.defineProperty(b6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[g6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(b6,y6),Object.setPrototypeOf(b6.prototype,y6.prototype),global.crypto===void 0&&(global.crypto=Re);var $ke=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),eAe=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
745
+ `.indexOf(e.charAt(t))!==-1}var A4;(function(e){e.DEFAULT={allowTrailingComma:!1}})(A4||={});function zDe(e,t=[],n=A4.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return P4(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function j4(e,t=[],n=A4.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}P4(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:BDe(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function M4(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function N4(e){switch(e.type){case`array`:return e.children.map(N4);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=N4(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function P4(e,t,n=A4.DEFAULT){let r=S4(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ee()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ee()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ee(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ee()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function BDe(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function VDe(e,t,n,r){let i=t.slice(),a=j4(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=M4(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return F4(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=M4(o,[s]);if(t!==void 0){if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return F4(e,{offset:i,length:a-i,content:``},r)}return F4(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r)}{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return F4(e,a,r)}}if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return F4(e,i,r)}if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return F4(e,i,r)}if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return F4(e,t,r)}throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function F4(e,t,n){if(!n.formattingOptions)return[t];let r=I4(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!k4(r,i-1);)i--;for(;a<r.length&&!k4(r,a);)a++}let o=IDe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=I4(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function I4(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var HDe;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(HDe||={});var UDe;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(UDe||={});const WDe=zDe,GDe=j4,L4=N4;var KDe;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(KDe||={});function R4(e,t,n,r){return VDe(e,t,n,r)}function z4(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=I4(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}const qDe=global.Request;var B4=class extends qDe{constructor(e,t){if(typeof e==`object`&&J4 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[r3]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[J4]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const V4=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},JDe=Symbol(`wrapBodyStream`),YDe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),XDe=e=>e===null||YDe.has(e),H4=Symbol(`bodyBufferedBeforeDisconnect`),U4=Symbol(`bodyBufferedLengthBeforeDisconnect`),W4=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),G4=e=>!(e instanceof Ue)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&XDe(e.readableEncoding),K4=(e,t)=>{if(e.readableDidRead&&!t||!G4(e))return;let n=e;if(n[H4]!==void 0)return n[H4];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[U4]!==void 0&&e.readableLength!==n[U4])r=o3();else{let n=t??[],i=e.read();i!==null&&n.push(W4(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=o3())}}return n[H4]=r,r},q4=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},ZDe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new B4(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[JDe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=K4(r);if(e!==void 0){q4(t,e);return}}e||=Ie.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=K4(r);a.body=e===void 0?Ie.toWeb(r):new ReadableStream({start(t){q4(t,e)}})}}return new B4(t,a)},J4=Symbol(`getRequestCache`),Y4=Symbol(`requestCache`),X4=Symbol(`incomingKey`),Z4=Symbol(`urlKey`),QDe=Symbol(`methodKey`),Q4=Symbol(`headersKey`),$4=Symbol(`abortControllerKey`),e3=Symbol(`getAbortController`),$De=Symbol(`abortRequest`),t3=Symbol(`bodyBuffer`),n3=Symbol(`bodyReadPromise`),r3=Symbol(`bodyConsumedDirectly`),i3=Symbol(`bodyLockReader`),a3=Symbol(`abortReason`),o3=()=>TypeError(`Body is unusable`),s3=()=>Promise.reject(o3()),eOe=new TextDecoder,tOe=e=>{if(e[r3])return s3();e[r3]=!0},nOe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),rOe=e=>(e[Q4]||=V4(e[X4])).get(`content-type`)||``,iOe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,aOe=e=>{if(!iOe.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},c3=(e,t,n)=>{if(e[r3])return s3();let r=e.method;if(r===`GET`||r===`HEAD`)return e[J4]()[t]();let i=aOe(r);if(i)return Promise.reject(i);if(e[Y4]&&r!==`TRACE`)return e[Y4][t]();let a=tOe(e);if(a)return a;let o=oOe(e);if(o){let t=Promise.resolve(n(o,e));return e[t3]=void 0,t}return sOe(e).then(t=>{let r=n(t,e);return e[t3]=void 0,r})},oOe=e=>{let t=e[X4];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},l3=(e,t)=>{if(t.errored)return t.errored;let n=e[a3];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},sOe=e=>{if(e[t3])return Promise.resolve(e[t3]);if(e[n3])return e[n3];let t=e[X4];if(t.readableDidRead)return s3();let n=K4(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[t3]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!G4(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=K4(t,i);o instanceof Error?r(o):o===void 0?r(a??l3(e,t)):(e[t3]=o,n(o))}),!0)},c=e=>{i.push(W4(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[t3]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(l3(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[n3]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[n3]=r,r},u3={get method(){return this[QDe]},get url(){return this[Z4]},get headers(){return this[Q4]||=V4(this[X4])},[$De](e){this[a3]===void 0&&(this[a3]=e);let t=this[$4];t&&!t.signal.aborted&&t.abort(e)},[e3](){return this[$4]||=new AbortController,this[a3]!==void 0&&!this[$4].signal.aborted&&this[$4].abort(this[a3]),this[$4]},[J4](){let e=this[e3]();if(this[Y4])return this[Y4];let t=this.method;if(this[r3]&&t!==`GET`&&t!==`HEAD`){this[t3]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new B4(this[Z4],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[Y4]=r}return this[Y4]=ZDe(this.method,this[Z4],this.headers,this[X4],e)},get body(){if(!this[r3])return this[J4]().body;let e=this[J4]();return!this[i3]&&e.body&&(this[i3]=e.body.getReader()),e.body},get bodyUsed(){return this[r3]?!0:this[Y4]?this[Y4].bodyUsed:!1}};Object.defineProperty(u3,"signal",{get(){return this[e3]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(u3,e,{get(){return this[J4]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(u3,e,{value:function(){if(this[r3]){if(e===`clone`)throw o3();return s3()}return this[J4]()[e]()}})}),Object.defineProperty(u3,"text",{value:function(){return c3(this,`text`,e=>eOe.decode(e))}}),Object.defineProperty(u3,"arrayBuffer",{value:function(){return c3(this,`arrayBuffer`,e=>nOe(e))}}),Object.defineProperty(u3,"blob",{value:function(){return c3(this,`blob`,(e,t)=>{let n=rOe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(u3,"json",{value:function(){return this[r3]?s3():this.text().then(JSON.parse)}}),Object.defineProperty(u3,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Y4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(u3,B4.prototype);const d3=Symbol(`responseCache`),f3=Symbol(`getResponseCache`),p3=Symbol(`cache`),m3=global.Response;var h3=class e{#e;#t;[f3](){let e=this[p3],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[p3],this[d3]||=new m3(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof m3){let t=n[d3];if(t){this.#t=t,this[f3]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[p3]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[p3];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[f3]().headers}get status(){return this[p3]?.[0]??this[f3]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(h3.prototype,e,{get(){return this[f3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(h3.prototype,e,{value:function(){return this[f3]()[e]()}})}),Object.defineProperty(h3.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[d3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(h3,m3),Object.setPrototypeOf(h3.prototype,m3.prototype);const cOe=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,lOe=e=>e instanceof URL?e.href:cOe.test(e)?e:new URL(e).href,uOe=new Set([301,302,303,307,308]);Object.defineProperty(h3,"redirect",{value:function(e,t=302){if(!uOe.has(t))throw RangeError(`Invalid status code`);return new h3(null,{status:t,headers:{location:lOe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(h3,"json",{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new h3(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}});function dOe(e,t){let n;try{n=E(e)}catch{return t.map(({editor:e,root:t})=>({host:e,root:t,state:`absent`}))}let r=e=>{let t=M(n,e);if(!(t===``||t.startsWith(`..`)||A(t)))return t.split(le).join(`/`)};return t.map(({editor:t,root:i})=>{let a=j(e,i),o;try{o=_(a)}catch{return{host:t,root:i,state:`absent`}}let s;try{s=E(a)}catch{return{host:t,root:i,state:`absent`}}if(o.isSymbolicLink()){let e=r(s);return{host:t,root:i,state:`linked`,real:s,...e?{target:e}:{}}}if(s!==j(n,i)){let e=r(s);return{host:t,root:i,state:`linked-parent`,real:s,...e?{target:e}:{}}}return{host:t,root:i,state:`own`,real:s}})}i(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))();const fOe={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},g3=pa(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),_3=$i([I(),L().int()]),v3=I();Zi({ttl:L().optional(),pollInterval:L().optional()});const pOe=V({ttl:L().optional()}),mOe=V({taskId:I()}),y3=Zi({progressToken:_3.optional(),"io.modelcontextprotocol/related-task":mOe.optional()}),b3=V({_meta:y3.optional()}),x3=b3.extend({task:pOe.optional()}),S3=V({method:I(),params:b3.loose().optional()}),C3=V({_meta:y3.optional()}),w3=V({method:I(),params:C3.loose().optional()}),T3=Zi({_meta:y3.optional()}),E3=$i([I(),L().int()]),hOe=V({jsonrpc:W(`2.0`),id:E3,...S3.shape}).strict(),gOe=V({jsonrpc:W(`2.0`),...w3.shape}).strict(),D3=V({jsonrpc:W(`2.0`),id:E3,result:T3}).strict();var _Oe;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(_Oe||={});const O3=V({jsonrpc:W(`2.0`),id:E3.optional(),error:V({code:L().int(),message:I(),data:z().optional()})}).strict();$i([hOe,gOe,D3,O3]),$i([D3,O3]);const k3=T3.strict(),vOe=C3.extend({requestId:E3.optional(),reason:I().optional()}),A3=w3.extend({method:W(`notifications/cancelled`),params:vOe}),j3=V({icons:B(V({src:I(),mimeType:I().optional(),sizes:B(I()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),M3=V({name:I(),title:I().optional()}),N3=M3.extend({...M3.shape,...j3.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),yOe=ma(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ta(V({form:ta(V({applyDefaults:R().optional()}),H(I(),z())).optional(),url:g3.optional()}),H(I(),z()).optional())),bOe=Zi({list:g3.optional(),cancel:g3.optional(),requests:Zi({sampling:Zi({createMessage:g3.optional()}).optional(),elicitation:Zi({create:g3.optional()}).optional()}).optional()}),xOe=Zi({list:g3.optional(),cancel:g3.optional(),requests:Zi({tools:Zi({call:g3.optional()}).optional()}).optional()}),SOe=V({experimental:H(I(),g3).optional(),sampling:V({context:g3.optional(),tools:g3.optional()}).optional(),elicitation:yOe.optional(),roots:V({listChanged:R().optional()}).optional(),tasks:bOe.optional(),extensions:H(I(),g3).optional()}),COe=b3.extend({protocolVersion:I(),capabilities:SOe,clientInfo:N3}),wOe=S3.extend({method:W(`initialize`),params:COe}),TOe=V({experimental:H(I(),g3).optional(),logging:g3.optional(),completions:g3.optional(),prompts:V({listChanged:R().optional()}).optional(),resources:V({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:V({listChanged:R().optional()}).optional(),tasks:xOe.optional(),extensions:H(I(),g3).optional()}),EOe=T3.extend({protocolVersion:I(),capabilities:TOe,serverInfo:N3,instructions:I().optional()}),DOe=w3.extend({method:W(`notifications/initialized`),params:C3.optional()}),P3=S3.extend({method:W(`ping`),params:b3.optional()}),OOe=V({progress:L(),total:oa(L()),message:oa(I())}),kOe=V({...C3.shape,...OOe.shape,progressToken:_3}),F3=w3.extend({method:W(`notifications/progress`),params:kOe}),AOe=b3.extend({cursor:v3.optional()}),I3=S3.extend({params:AOe.optional()}),L3=T3.extend({nextCursor:v3.optional()}),jOe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),R3=V({taskId:I(),status:jOe,ttl:$i([L(),qi()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:oa(L()),statusMessage:oa(I())}),z3=T3.extend({task:R3}),MOe=C3.merge(R3),B3=w3.extend({method:W(`notifications/tasks/status`),params:MOe}),V3=S3.extend({method:W(`tasks/get`),params:b3.extend({taskId:I()})}),H3=T3.merge(R3),U3=S3.extend({method:W(`tasks/result`),params:b3.extend({taskId:I()})});T3.loose();const W3=I3.extend({method:W(`tasks/list`)}),G3=L3.extend({tasks:B(R3)}),K3=S3.extend({method:W(`tasks/cancel`),params:b3.extend({taskId:I()})});T3.merge(R3);const q3=V({uri:I(),mimeType:oa(I()),_meta:H(I(),z()).optional()}),J3=q3.extend({text:I()}),Y3=I().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),X3=q3.extend({blob:Y3}),Z3=U([`user`,`assistant`]),Q3=V({audience:B(Z3).optional(),priority:L().min(0).max(1).optional(),lastModified:ki({offset:!0}).optional()}),$3=V({...M3.shape,...j3.shape,uri:I(),description:oa(I()),mimeType:oa(I()),size:oa(L()),annotations:Q3.optional(),_meta:oa(Zi({}))}),NOe=V({...M3.shape,...j3.shape,uriTemplate:I(),description:oa(I()),mimeType:oa(I()),annotations:Q3.optional(),_meta:oa(Zi({}))}),POe=I3.extend({method:W(`resources/list`)}),FOe=L3.extend({resources:B($3)}),IOe=I3.extend({method:W(`resources/templates/list`)}),LOe=L3.extend({resourceTemplates:B(NOe)}),e6=b3.extend({uri:I()}),ROe=e6,zOe=S3.extend({method:W(`resources/read`),params:ROe}),BOe=T3.extend({contents:B($i([J3,X3]))}),VOe=w3.extend({method:W(`notifications/resources/list_changed`),params:C3.optional()}),HOe=e6,UOe=S3.extend({method:W(`resources/subscribe`),params:HOe}),WOe=e6,GOe=S3.extend({method:W(`resources/unsubscribe`),params:WOe}),KOe=C3.extend({uri:I()}),qOe=w3.extend({method:W(`notifications/resources/updated`),params:KOe}),JOe=V({name:I(),description:oa(I()),required:oa(R())}),YOe=V({...M3.shape,...j3.shape,description:oa(I()),arguments:oa(B(JOe)),_meta:oa(Zi({}))}),XOe=I3.extend({method:W(`prompts/list`)}),ZOe=L3.extend({prompts:B(YOe)}),QOe=b3.extend({name:I(),arguments:H(I(),I()).optional()}),$Oe=S3.extend({method:W(`prompts/get`),params:QOe}),t6=V({type:W(`text`),text:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),n6=V({type:W(`image`),data:Y3,mimeType:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),r6=V({type:W(`audio`),data:Y3,mimeType:I(),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),eke=V({type:W(`tool_use`),name:I(),id:I(),input:H(I(),z()),_meta:H(I(),z()).optional()}),tke=V({type:W(`resource`),resource:$i([J3,X3]),annotations:Q3.optional(),_meta:H(I(),z()).optional()}),i6=$i([t6,n6,r6,$3.extend({type:W(`resource_link`)}),tke]),nke=V({role:Z3,content:i6}),rke=T3.extend({description:I().optional(),messages:B(nke)}),ike=w3.extend({method:W(`notifications/prompts/list_changed`),params:C3.optional()}),ake=V({title:I().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),oke=V({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),a6=V({...M3.shape,...j3.shape,description:I().optional(),inputSchema:V({type:W(`object`),properties:H(I(),g3).optional(),required:B(I()).optional()}).catchall(z()),outputSchema:V({type:W(`object`),properties:H(I(),g3).optional(),required:B(I()).optional()}).catchall(z()).optional(),annotations:ake.optional(),execution:oke.optional(),_meta:H(I(),z()).optional()}),ske=I3.extend({method:W(`tools/list`)}),cke=L3.extend({tools:B(a6)}),o6=T3.extend({content:B(i6).default([]),structuredContent:H(I(),z()).optional(),isError:R().optional()});o6.or(T3.extend({toolResult:z()}));const lke=x3.extend({name:I(),arguments:H(I(),z()).optional()}),uke=S3.extend({method:W(`tools/call`),params:lke}),dke=w3.extend({method:W(`notifications/tools/list_changed`),params:C3.optional()});V({autoRefresh:R().default(!0),debounceMs:L().int().nonnegative().default(300)});const s6=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),fke=b3.extend({level:s6}),pke=S3.extend({method:W(`logging/setLevel`),params:fke}),mke=C3.extend({level:s6,logger:I().optional(),data:z()}),hke=w3.extend({method:W(`notifications/message`),params:mke}),gke=V({hints:B(V({name:I().optional()})).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),_ke=V({mode:U([`auto`,`required`,`none`]).optional()}),vke=V({type:W(`tool_result`),toolUseId:I().describe(`The unique identifier for the corresponding tool call.`),content:B(i6).default([]),structuredContent:V({}).loose().optional(),isError:R().optional(),_meta:H(I(),z()).optional()}),yke=ea(`type`,[t6,n6,r6]),c6=ea(`type`,[t6,n6,r6,eke,vke]),bke=V({role:Z3,content:$i([c6,B(c6)]),_meta:H(I(),z()).optional()}),xke=x3.extend({messages:B(bke),modelPreferences:gke.optional(),systemPrompt:I().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:B(I()).optional(),metadata:g3.optional(),tools:B(a6).optional(),toolChoice:_ke.optional()}),Ske=S3.extend({method:W(`sampling/createMessage`),params:xke}),Cke=T3.extend({model:I(),stopReason:oa(U([`endTurn`,`stopSequence`,`maxTokens`]).or(I())),role:Z3,content:yke}),wke=T3.extend({model:I(),stopReason:oa(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(I())),role:Z3,content:$i([c6,B(c6)])}),Tke=V({type:W(`boolean`),title:I().optional(),description:I().optional(),default:R().optional()}),Eke=V({type:W(`string`),title:I().optional(),description:I().optional(),minLength:L().optional(),maxLength:L().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:I().optional()}),Dke=V({type:U([`number`,`integer`]),title:I().optional(),description:I().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),Oke=V({type:W(`string`),title:I().optional(),description:I().optional(),enum:B(I()),default:I().optional()}),kke=V({type:W(`string`),title:I().optional(),description:I().optional(),oneOf:B(V({const:I(),title:I()})),default:I().optional()}),Ake=$i([$i([V({type:W(`string`),title:I().optional(),description:I().optional(),enum:B(I()),enumNames:B(I()).optional(),default:I().optional()}),$i([Oke,kke]),$i([V({type:W(`array`),title:I().optional(),description:I().optional(),minItems:L().optional(),maxItems:L().optional(),items:V({type:W(`string`),enum:B(I())}),default:B(I()).optional()}),V({type:W(`array`),title:I().optional(),description:I().optional(),minItems:L().optional(),maxItems:L().optional(),items:V({anyOf:B(V({const:I(),title:I()}))}),default:B(I()).optional()})])]),Tke,Eke,Dke]),jke=$i([x3.extend({mode:W(`form`).optional(),message:I(),requestedSchema:V({type:W(`object`),properties:H(I(),Ake),required:B(I()).optional()})}),x3.extend({mode:W(`url`),message:I(),elicitationId:I(),url:I().url()})]),Mke=S3.extend({method:W(`elicitation/create`),params:jke}),Nke=C3.extend({elicitationId:I()}),Pke=w3.extend({method:W(`notifications/elicitation/complete`),params:Nke}),Fke=T3.extend({action:U([`accept`,`decline`,`cancel`]),content:ma(e=>e===null?void 0:e,H(I(),$i([I(),L(),R(),B(I())])).optional())}),Ike=V({type:W(`ref/resource`),uri:I()}),Lke=V({type:W(`ref/prompt`),name:I()}),Rke=b3.extend({ref:$i([Lke,Ike]),argument:V({name:I(),value:I()}),context:V({arguments:H(I(),I()).optional()}).optional()}),zke=S3.extend({method:W(`completion/complete`),params:Rke}),Bke=T3.extend({completion:Zi({values:B(I()).max(100),total:oa(L().int()),hasMore:oa(R())})}),Vke=V({uri:I().startsWith(`file://`),name:I().optional(),_meta:H(I(),z()).optional()}),Hke=S3.extend({method:W(`roots/list`),params:b3.optional()}),Uke=T3.extend({roots:B(Vke)}),Wke=w3.extend({method:W(`notifications/roots/list_changed`),params:C3.optional()});$i([P3,wOe,zke,pke,$Oe,XOe,POe,IOe,zOe,UOe,GOe,uke,ske,V3,U3,W3,K3]),$i([A3,F3,DOe,Wke,B3]),$i([k3,Cke,wke,Fke,Uke,H3,G3,z3]),$i([P3,Ske,Mke,Hke,V3,U3,W3,K3]),$i([A3,F3,hke,qOe,VOe,dke,ike,B3,Pke]),$i([k3,EOe,Bke,rke,ZOe,FOe,LOe,BOe,o6,cke,H3,G3,z3]);var Gke;(function(e){e.Completable=`McpCompletable`})(Gke||={});var Kke=global.Request,l6=class extends Kke{constructor(e,t){typeof e==`object`&&u6 in e&&(e=e[u6]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},qke=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},Jke=Symbol(`wrapBodyStream`),Yke=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new l6(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[Jke]){let e;a.body=new ReadableStream({async pull(t){try{e||=ze.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=ze.toWeb(r)}return new l6(t,a)},u6=Symbol(`getRequestCache`),d6=Symbol(`requestCache`),f6=Symbol(`incomingKey`),p6=Symbol(`urlKey`),Xke=Symbol(`headersKey`),m6=Symbol(`abortControllerKey`),h6={get method(){return this[f6].method||`GET`},get url(){return this[p6]},get headers(){return this[Xke]||=qke(this[f6])},[Symbol(`getAbortController`)](){return this[u6](),this[m6]},[u6](){return this[m6]||=new AbortController,this[d6]||=Yke(this.method,this[p6],this.headers,this[f6],this[m6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(h6,e,{get(){return this[u6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(h6,e,{value:function(){return this[u6]()[e]()}})}),Object.defineProperty(h6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[d6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(h6,l6.prototype);var g6=Symbol(`responseCache`),_6=Symbol(`getResponseCache`),v6=Symbol(`cache`),y6=global.Response,b6=class e{#e;#t;[_6](){return delete this[v6],this[g6]||=new y6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[g6];if(e){this.#t=e,this[_6]();return}this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[v6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[v6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[_6]().headers}get status(){return this[v6]?.[0]??this[_6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(b6.prototype,e,{get(){return this[_6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(b6.prototype,e,{value:function(){return this[_6]()[e]()}})}),Object.defineProperty(b6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[g6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(b6,y6),Object.setPrototypeOf(b6.prototype,y6.prototype),global.crypto===void 0&&(global.crypto=Re);var Zke=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),Qke=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
746
746
  `:typeof d.splitUnquoted==`string`?d.splitUnquoted:``,m=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,_=h(e,new RegExp([`(`+n+`)`,`(`+m+`|`+o+`|`+a+`)+`].join(`|`),`g`));if(_.length===0)return[];t||={};var v=!1;return _.map(function(n){var i=n[0];if(!i||v)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,m=[],h=!1,_=null,y=!1,b;function x(){b+=1;var e,n,r=i.charAt(b);if(r===`{`){if(b+=1,i.charAt(b)===`}`)throw Error(`Bad substitution: `+i.slice(b-2,b+1));var a=1;for(e=b;a>0&&e<i.length;)i.charAt(e)===`{`&&i.charAt(e-1)===`$`?a+=1:i.charAt(e)===`}`&&--a,e+=1;if(a!==0)throw Error(`Bad substitution: `+i.slice(b));--e,n=i.slice(b,e),b=e}else if(/[*@#?$!_-]/.test(r))n=r,b+=1;else{var o=i.slice(b);e=o.match(/[^\w\d_]/),e?(n=o.slice(0,e.index),b+=e.index-1):(n=o,b=i.length)}return g(t,``,n)}function S(){if(_!==null){if(_===0)d!==``&&(m[m.length]=d,d=``);else{m[m.length]=d,d=``;for(var e=1;e<_;e+=1)m[m.length]=``}_=null}}for(b=0;b<i.length;b++){var C=i.charAt(b);if(p&&C!==u&&S(),y||=!a&&(C===`*`||C===`?`),o)d+=C,o=!1;else if(a)C===a?a=!1:a==c?d+=C:C===f?(b+=1,C=i.charAt(b),d+=C===l||C===f||C===u?C:f+C):d+=C===u?x():C;else if(C===l||C===c)a=C,h=!0;else if(r.test(C))return{op:i};else if(s.test(C)){v=!0;var w={comment:e.slice(n.index+b+1)};return d.length?[d,w]:[w]}else if(C===f)o=!0;else if(C===u){var T=x();if(!p)d+=T;else for(var E=0;E<T.length;E+=1){var D=T.charAt(E);p.indexOf(D)<0?(S(),d+=D):_===null?_=D===` `||D===` `||D===`
747
747
  `?0:1:D!==` `&&D!==` `&&D!==`
748
- `&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var O=1;O<_;O+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=$ke(),e.parse=eAe()}))();var x6;(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(x6||={}),x6.IF,x6.THEN,x6.ELSE,x6.ELIF,x6.FI,x6.FOR,x6.WHILE,x6.UNTIL,x6.DO,x6.DONE,x6.CASE,x6.ESAC,x6.IN,x6.FUNCTION,x6.SELECT,x6.TIME,x6.COPROC,x6.SEMI_SEMI_AND,x6.TLESS,x6.AND_DGREAT,x6.DBRACK_START,x6.DBRACK_END,x6.DPAREN_START,x6.DPAREN_END,x6.AND_AND,x6.OR_OR,x6.DSEMI,x6.SEMI_AND,x6.PIPE_AMP,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.CLOBBER,x6.AND_GREAT,x6.PIPE,x6.AMP,x6.SEMICOLON,x6.LPAREN,x6.RPAREN,x6.LESS,x6.GREAT,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.AND_GREAT,x6.AND_DGREAT,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.AND_GREAT,x6.AND_DGREAT,x6.AMP,x6.PIPE,x6.PIPE_AMP,x6.SEMICOLON,x6.AND_AND,x6.OR_OR,x6.DSEMI,x6.SEMI_AND,x6.SEMI_SEMI_AND;var S6=[{name:`echo`,load:async()=>(await import(`./echo-O45JWWI2-DGiwQF55.mjs`)).echoCommand},{name:`cat`,load:async()=>(await import(`./cat-RDUMLXKC-m8-l0dJv.mjs`)).catCommand},{name:`printf`,load:async()=>(await import(`./printf-CX64KX2P-Br1Ug2Ut.mjs`)).printfCommand},{name:`ls`,load:async()=>(await import(`./ls-KSXFZCWH-CDtp05HC.mjs`)).lsCommand},{name:`mkdir`,load:async()=>(await import(`./mkdir-TDEMSB6C-uC_QraB2.mjs`)).mkdirCommand},{name:`rmdir`,load:async()=>(await import(`./rmdir-XTQXT7RK-Cw3ocqh1.mjs`)).rmdirCommand},{name:`touch`,load:async()=>(await import(`./touch-DX2IJOQ4-uq_8eRY4.mjs`)).touchCommand},{name:`rm`,load:async()=>(await import(`./rm-RTZG23RL-BnOWGONG.mjs`)).rmCommand},{name:`cp`,load:async()=>(await import(`./cp-XOYR4ABJ-D42CslL1.mjs`)).cpCommand},{name:`mv`,load:async()=>(await import(`./mv-Z6MORUFL-B9PTkiG2.mjs`)).mvCommand},{name:`ln`,load:async()=>(await import(`./ln-4TRFBYAT-C2NklMBi.mjs`)).lnCommand},{name:`chmod`,load:async()=>(await import(`./chmod-SYMGL4JA-DTlWPHuG.mjs`)).chmodCommand},{name:`pwd`,load:async()=>(await import(`./pwd-D4OZ7N27-P0N9Gpk_.mjs`)).pwdCommand},{name:`readlink`,load:async()=>(await import(`./readlink-MI4GCHJF-wDvdfdV7.mjs`)).readlinkCommand},{name:`head`,load:async()=>(await import(`./head-HT2B6D2J-9R__Yy5p.mjs`)).headCommand},{name:`tail`,load:async()=>(await import(`./tail-S5ULNTJU-CnLzyp7W.mjs`)).tailCommand},{name:`wc`,load:async()=>(await import(`./wc-TQB3VNOX-CKtInFV_.mjs`)).wcCommand},{name:`stat`,load:async()=>(await import(`./stat-BT5A227F-DTts8oaN.mjs`)).statCommand},{name:`grep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).grepCommand},{name:`fgrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).fgrepCommand},{name:`egrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).egrepCommand},{name:`rg`,load:async()=>(await import(`./rg-XNF3R3II-DKI4o3y8.mjs`)).rgCommand},{name:`sed`,load:async()=>(await import(`./sed-JAPPVBEU-y4kzwh-U.mjs`)).sedCommand},{name:`awk`,load:async()=>(await import(`./awk2-BBAGSFUB-wDlbOPdF.mjs`)).awkCommand2},{name:`sort`,load:async()=>(await import(`./sort-DCNRDA7U-BRNZXaM9.mjs`)).sortCommand},{name:`uniq`,load:async()=>(await import(`./uniq-SUNANL47-C_dQux5r.mjs`)).uniqCommand},{name:`comm`,load:async()=>(await import(`./comm-5SLSESQG-B160yVYr.mjs`)).commCommand},{name:`cut`,load:async()=>(await import(`./cut-OPC3VAGB-DyTb922x.mjs`)).cutCommand},{name:`paste`,load:async()=>(await import(`./paste-7N6AFSDS-BbuyICrx.mjs`)).pasteCommand},{name:`tr`,load:async()=>(await import(`./tr-2HXZRDSW-BjPZn8n7.mjs`)).trCommand},{name:`rev`,load:async()=>(await import(`./rev-XOSYPP45-DJ7MH0ty.mjs`)).rev},{name:`nl`,load:async()=>(await import(`./nl-U5YJDM32-BioDr4pn.mjs`)).nl},{name:`fold`,load:async()=>(await import(`./fold-LDSORVYE-DzcV-vp8.mjs`)).fold},{name:`expand`,load:async()=>(await import(`./expand-DTNXU4LQ-Bpnv4ghU.mjs`)).expand},{name:`unexpand`,load:async()=>(await import(`./unexpand-RGTMIGZM-kHLFypbk.mjs`)).unexpand},{name:`strings`,load:async()=>(await import(`./strings-7PLOGTPD-DcSwox5x.mjs`)).strings},{name:`split`,load:async()=>(await import(`./split-SITCSYCZ-CXEcy-ww.mjs`)).split},{name:`column`,load:async()=>(await import(`./column-WLPMMSTS-DL3_07Lu.mjs`)).column},{name:`join`,load:async()=>(await import(`./join-GG2LDHE5-B2crRcrv.mjs`)).join},{name:`tee`,load:async()=>(await import(`./tee-O7VXZDCO-CPDtNjnw.mjs`)).teeCommand},{name:`find`,load:async()=>(await import(`./find-DH2ALKQS-CVRGx4iG.mjs`)).findCommand},{name:`basename`,load:async()=>(await import(`./basename-AA2KJYZQ-CZ6ADlYI.mjs`)).basenameCommand},{name:`dirname`,load:async()=>(await import(`./dirname-LEMTZZFS-DuDN0dhi.mjs`)).dirnameCommand},{name:`tree`,load:async()=>(await import(`./tree-LYXBS7DC-CIx1Kfia.mjs`)).treeCommand},{name:`du`,load:async()=>(await import(`./du-WO2ENHXQ-DZrvHJqf.mjs`)).duCommand},{name:`env`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).envCommand},{name:`printenv`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).printenvCommand},{name:`alias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).aliasCommand},{name:`unalias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).unaliasCommand},{name:`history`,load:async()=>(await import(`./history-J4QRNGRO-Co6e9xUo.mjs`)).historyCommand},{name:`xargs`,load:async()=>(await import(`./xargs-I6EZUCYF-BxxszDkV.mjs`)).xargsCommand},{name:`true`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).trueCommand},{name:`false`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).falseCommand},{name:`clear`,load:async()=>(await import(`./clear-5CZ5X4YR-BIhQHuOh.mjs`)).clearCommand},{name:`bash`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).bashCommand},{name:`sh`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).shCommand},{name:`jq`,load:async()=>(await import(`./jq-LYZFFBZB-BMLmD0PS.mjs`)).jqCommand},{name:`base64`,load:async()=>(await import(`./base64-4YMZCVJ5-DWBbgBRj.mjs`)).base64Command},{name:`diff`,load:async()=>(await import(`./diff-HJF2MPDN-DmTjb9f0.mjs`)).diffCommand},{name:`date`,load:async()=>(await import(`./date-DD7FVA2V-BSrLXaCI.mjs`)).dateCommand},{name:`sleep`,load:async()=>(await import(`./sleep-VZFPZFWA-DPmPUpYL.mjs`)).sleepCommand},{name:`timeout`,load:async()=>(await import(`./timeout-VRKMCG72-G3DVszag.mjs`)).timeoutCommand},{name:`time`,load:async()=>(await import(`./time-DEUO3QV2-CdVsJ04Z.mjs`)).timeCommand},{name:`seq`,load:async()=>(await import(`./seq-RN5ZUASB-PVf-rQ-S.mjs`)).seqCommand},{name:`expr`,load:async()=>(await import(`./expr-YYCVMXE3-BDOVRayn.mjs`)).exprCommand},{name:`md5sum`,load:async()=>(await import(`./md5sum-INMIK4DX-CRDOz6nr.mjs`)).md5sumCommand},{name:`sha1sum`,load:async()=>(await import(`./sha1sum-VJPNLNU6-BU98q8gr.mjs`)).sha1sumCommand},{name:`sha256sum`,load:async()=>(await import(`./sha256sum-PI32XWXY-CeL32a6r.mjs`)).sha256sumCommand},{name:`file`,load:async()=>(await import(`./file-IGDTDPLG-CUqZAlKT.mjs`)).fileCommand},{name:`html-to-markdown`,load:async()=>(await import(`./html-to-markdown-TFCECAGV-BDXFAacx.mjs`)).htmlToMarkdownCommand},{name:`help`,load:async()=>(await import(`./help-VVWX7SA5-Defr0Q9g.mjs`)).helpCommand},{name:`which`,load:async()=>(await import(`./which-XZHEH76L-BpfGDIeg.mjs`)).whichCommand},{name:`tac`,load:async()=>(await import(`./tac-SJGXQ4T2-vsCjLe3q.mjs`)).tac},{name:`hostname`,load:async()=>(await import(`./hostname-BK6HG2DE-CL_ll-mo.mjs`)).hostname},{name:`whoami`,load:async()=>(await import(`./whoami-DGKU3D2X-CbRRBIk3.mjs`)).whoami},{name:`od`,load:async()=>(await import(`./od-VJEF2UR5-DcvNzw_D.mjs`)).od},{name:`gzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gzipCommand},{name:`gunzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gunzipCommand},{name:`zcat`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).zcatCommand}];(typeof __BROWSER__>`u`||!__BROWSER__)&&(S6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-BRGDcHqv.mjs`)).tarCommand}),S6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),S6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),S6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DVwda1Ow.mjs`)).sqlite3Command}));var C6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(C6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).python3Command}),C6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).pythonCommand}));var w6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(w6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).jsExecCommand}),w6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
748
+ `&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var O=1;O<_;O+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=Zke(),e.parse=Qke()}))();var x6;(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(x6||={}),x6.IF,x6.THEN,x6.ELSE,x6.ELIF,x6.FI,x6.FOR,x6.WHILE,x6.UNTIL,x6.DO,x6.DONE,x6.CASE,x6.ESAC,x6.IN,x6.FUNCTION,x6.SELECT,x6.TIME,x6.COPROC,x6.SEMI_SEMI_AND,x6.TLESS,x6.AND_DGREAT,x6.DBRACK_START,x6.DBRACK_END,x6.DPAREN_START,x6.DPAREN_END,x6.AND_AND,x6.OR_OR,x6.DSEMI,x6.SEMI_AND,x6.PIPE_AMP,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.CLOBBER,x6.AND_GREAT,x6.PIPE,x6.AMP,x6.SEMICOLON,x6.LPAREN,x6.RPAREN,x6.LESS,x6.GREAT,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.AND_GREAT,x6.AND_DGREAT,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.LESS,x6.GREAT,x6.DLESS,x6.DGREAT,x6.LESSAND,x6.GREATAND,x6.LESSGREAT,x6.DLESSDASH,x6.CLOBBER,x6.TLESS,x6.AND_GREAT,x6.AND_DGREAT,x6.AMP,x6.PIPE,x6.PIPE_AMP,x6.SEMICOLON,x6.AND_AND,x6.OR_OR,x6.DSEMI,x6.SEMI_AND,x6.SEMI_SEMI_AND;var S6=[{name:`echo`,load:async()=>(await import(`./echo-O45JWWI2-DGiwQF55.mjs`)).echoCommand},{name:`cat`,load:async()=>(await import(`./cat-RDUMLXKC-m8-l0dJv.mjs`)).catCommand},{name:`printf`,load:async()=>(await import(`./printf-CX64KX2P-Br1Ug2Ut.mjs`)).printfCommand},{name:`ls`,load:async()=>(await import(`./ls-KSXFZCWH-CDtp05HC.mjs`)).lsCommand},{name:`mkdir`,load:async()=>(await import(`./mkdir-TDEMSB6C-uC_QraB2.mjs`)).mkdirCommand},{name:`rmdir`,load:async()=>(await import(`./rmdir-XTQXT7RK-Cw3ocqh1.mjs`)).rmdirCommand},{name:`touch`,load:async()=>(await import(`./touch-DX2IJOQ4-uq_8eRY4.mjs`)).touchCommand},{name:`rm`,load:async()=>(await import(`./rm-RTZG23RL-BnOWGONG.mjs`)).rmCommand},{name:`cp`,load:async()=>(await import(`./cp-XOYR4ABJ-D42CslL1.mjs`)).cpCommand},{name:`mv`,load:async()=>(await import(`./mv-Z6MORUFL-B9PTkiG2.mjs`)).mvCommand},{name:`ln`,load:async()=>(await import(`./ln-4TRFBYAT-C2NklMBi.mjs`)).lnCommand},{name:`chmod`,load:async()=>(await import(`./chmod-SYMGL4JA-DTlWPHuG.mjs`)).chmodCommand},{name:`pwd`,load:async()=>(await import(`./pwd-D4OZ7N27-P0N9Gpk_.mjs`)).pwdCommand},{name:`readlink`,load:async()=>(await import(`./readlink-MI4GCHJF-wDvdfdV7.mjs`)).readlinkCommand},{name:`head`,load:async()=>(await import(`./head-HT2B6D2J-9R__Yy5p.mjs`)).headCommand},{name:`tail`,load:async()=>(await import(`./tail-S5ULNTJU-CnLzyp7W.mjs`)).tailCommand},{name:`wc`,load:async()=>(await import(`./wc-TQB3VNOX-CKtInFV_.mjs`)).wcCommand},{name:`stat`,load:async()=>(await import(`./stat-BT5A227F-DTts8oaN.mjs`)).statCommand},{name:`grep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).grepCommand},{name:`fgrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).fgrepCommand},{name:`egrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).egrepCommand},{name:`rg`,load:async()=>(await import(`./rg-XNF3R3II-DKI4o3y8.mjs`)).rgCommand},{name:`sed`,load:async()=>(await import(`./sed-JAPPVBEU-y4kzwh-U.mjs`)).sedCommand},{name:`awk`,load:async()=>(await import(`./awk2-BBAGSFUB-wDlbOPdF.mjs`)).awkCommand2},{name:`sort`,load:async()=>(await import(`./sort-DCNRDA7U-BRNZXaM9.mjs`)).sortCommand},{name:`uniq`,load:async()=>(await import(`./uniq-SUNANL47-C_dQux5r.mjs`)).uniqCommand},{name:`comm`,load:async()=>(await import(`./comm-5SLSESQG-B160yVYr.mjs`)).commCommand},{name:`cut`,load:async()=>(await import(`./cut-OPC3VAGB-DyTb922x.mjs`)).cutCommand},{name:`paste`,load:async()=>(await import(`./paste-7N6AFSDS-BbuyICrx.mjs`)).pasteCommand},{name:`tr`,load:async()=>(await import(`./tr-2HXZRDSW-BjPZn8n7.mjs`)).trCommand},{name:`rev`,load:async()=>(await import(`./rev-XOSYPP45-DJ7MH0ty.mjs`)).rev},{name:`nl`,load:async()=>(await import(`./nl-U5YJDM32-BioDr4pn.mjs`)).nl},{name:`fold`,load:async()=>(await import(`./fold-LDSORVYE-DzcV-vp8.mjs`)).fold},{name:`expand`,load:async()=>(await import(`./expand-DTNXU4LQ-Bpnv4ghU.mjs`)).expand},{name:`unexpand`,load:async()=>(await import(`./unexpand-RGTMIGZM-kHLFypbk.mjs`)).unexpand},{name:`strings`,load:async()=>(await import(`./strings-7PLOGTPD-DcSwox5x.mjs`)).strings},{name:`split`,load:async()=>(await import(`./split-SITCSYCZ-CXEcy-ww.mjs`)).split},{name:`column`,load:async()=>(await import(`./column-WLPMMSTS-DL3_07Lu.mjs`)).column},{name:`join`,load:async()=>(await import(`./join-GG2LDHE5-B2crRcrv.mjs`)).join},{name:`tee`,load:async()=>(await import(`./tee-O7VXZDCO-CPDtNjnw.mjs`)).teeCommand},{name:`find`,load:async()=>(await import(`./find-DH2ALKQS-CVRGx4iG.mjs`)).findCommand},{name:`basename`,load:async()=>(await import(`./basename-AA2KJYZQ-CZ6ADlYI.mjs`)).basenameCommand},{name:`dirname`,load:async()=>(await import(`./dirname-LEMTZZFS-DuDN0dhi.mjs`)).dirnameCommand},{name:`tree`,load:async()=>(await import(`./tree-LYXBS7DC-CIx1Kfia.mjs`)).treeCommand},{name:`du`,load:async()=>(await import(`./du-WO2ENHXQ-DZrvHJqf.mjs`)).duCommand},{name:`env`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).envCommand},{name:`printenv`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).printenvCommand},{name:`alias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).aliasCommand},{name:`unalias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).unaliasCommand},{name:`history`,load:async()=>(await import(`./history-J4QRNGRO-Co6e9xUo.mjs`)).historyCommand},{name:`xargs`,load:async()=>(await import(`./xargs-I6EZUCYF-BxxszDkV.mjs`)).xargsCommand},{name:`true`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).trueCommand},{name:`false`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).falseCommand},{name:`clear`,load:async()=>(await import(`./clear-5CZ5X4YR-BIhQHuOh.mjs`)).clearCommand},{name:`bash`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).bashCommand},{name:`sh`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).shCommand},{name:`jq`,load:async()=>(await import(`./jq-LYZFFBZB-BMLmD0PS.mjs`)).jqCommand},{name:`base64`,load:async()=>(await import(`./base64-4YMZCVJ5-DWBbgBRj.mjs`)).base64Command},{name:`diff`,load:async()=>(await import(`./diff-HJF2MPDN-DmTjb9f0.mjs`)).diffCommand},{name:`date`,load:async()=>(await import(`./date-DD7FVA2V-BSrLXaCI.mjs`)).dateCommand},{name:`sleep`,load:async()=>(await import(`./sleep-VZFPZFWA-DPmPUpYL.mjs`)).sleepCommand},{name:`timeout`,load:async()=>(await import(`./timeout-VRKMCG72-G3DVszag.mjs`)).timeoutCommand},{name:`time`,load:async()=>(await import(`./time-DEUO3QV2-CdVsJ04Z.mjs`)).timeCommand},{name:`seq`,load:async()=>(await import(`./seq-RN5ZUASB-PVf-rQ-S.mjs`)).seqCommand},{name:`expr`,load:async()=>(await import(`./expr-YYCVMXE3-BDOVRayn.mjs`)).exprCommand},{name:`md5sum`,load:async()=>(await import(`./md5sum-INMIK4DX-CRDOz6nr.mjs`)).md5sumCommand},{name:`sha1sum`,load:async()=>(await import(`./sha1sum-VJPNLNU6-BU98q8gr.mjs`)).sha1sumCommand},{name:`sha256sum`,load:async()=>(await import(`./sha256sum-PI32XWXY-CeL32a6r.mjs`)).sha256sumCommand},{name:`file`,load:async()=>(await import(`./file-IGDTDPLG-CUqZAlKT.mjs`)).fileCommand},{name:`html-to-markdown`,load:async()=>(await import(`./html-to-markdown-TFCECAGV-BDXFAacx.mjs`)).htmlToMarkdownCommand},{name:`help`,load:async()=>(await import(`./help-VVWX7SA5-Defr0Q9g.mjs`)).helpCommand},{name:`which`,load:async()=>(await import(`./which-XZHEH76L-BpfGDIeg.mjs`)).whichCommand},{name:`tac`,load:async()=>(await import(`./tac-SJGXQ4T2-vsCjLe3q.mjs`)).tac},{name:`hostname`,load:async()=>(await import(`./hostname-BK6HG2DE-CL_ll-mo.mjs`)).hostname},{name:`whoami`,load:async()=>(await import(`./whoami-DGKU3D2X-CbRRBIk3.mjs`)).whoami},{name:`od`,load:async()=>(await import(`./od-VJEF2UR5-DcvNzw_D.mjs`)).od},{name:`gzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gzipCommand},{name:`gunzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gunzipCommand},{name:`zcat`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).zcatCommand}];(typeof __BROWSER__>`u`||!__BROWSER__)&&(S6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-BRGDcHqv.mjs`)).tarCommand}),S6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),S6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),S6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DVwda1Ow.mjs`)).sqlite3Command}));var C6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(C6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).python3Command}),C6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).pythonCommand}));var w6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(w6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).jsExecCommand}),w6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
749
749
  No effect; the command does nothing.
750
750
  Exit Status:
751
751
  Always succeeds.`]],[`.`,[`. filename [arguments]`,`Execute commands from a file in the current shell.
@@ -1092,37 +1092,37 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
1092
1092
  job specification, and reports its termination status.
1093
1093
  Exit Status:
1094
1094
  Returns the status of the last ID; fails if ID is invalid or an invalid
1095
- option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var T6=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),E6=i(((e,n)=>{let{EMPTY_BUFFER:r}=T6(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),tAe=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),D6=i(((e,n)=>{let r=t(`zlib`),i=E6(),a=tAe(),{kStatusCode:o}=T6(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!m){let e=this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit;m=new a(e)}}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),O6=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=T6(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),k6=i(((e,n)=>{let{Writable:r}=t(`stream`),i=D6(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=T6(),{concat:l,toArrayBuffer:u,unmask:d}=E6(),{isValidStatusCode:f,isValidUTF8:p}=O6(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),A6=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=D6(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=T6(),{isBlob:u,isValidStatusCode:d}=O6(),{mask:f,toBuffer:p}=E6(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8192,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),nAe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=T6(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),j6=i(((e,t)=>{let{tokenChars:n}=O6();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),M6=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=D6(),m=k6(),h=A6(),{isBlob:g}=O6(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=T6(),{EventTarget:{addEventListener:E,removeEventListener:D}}=nAe(),{format:O,parse:ee}=j6(),{toBuffer:te}=E6(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var k=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),oe(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,N),i.on(`drain`,le),i.on(`error`,ue),i.on(`message`,fe),i.on(`ping`,P),i.on(`pong`,pe),a.onerror=he,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,_e),t.on(`data`,ve),t.on(`end`,ye),t.on(`error`,be),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ce(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ge(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ce(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(k,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(k.prototype,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(k,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(k.prototype,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(k,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(k.prototype,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(k,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(k.prototype,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(k.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(k.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),k.prototype.addEventListener=E,k.prototype.removeEventListener=D,n.exports=k;function oe(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:re[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;A(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?se:j),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=O({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{ce(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,A(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ce(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{A(e,SyntaxError(`Invalid URL: ${a}`));return}oe(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||ce(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==k.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ce(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ce(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){ce(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ce(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ce(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){ce(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{ce(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function A(e,t){e._readyState=k.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function j(e){return e.path=e.socketPath,o.connect(e)}function se(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function ce(e,t,n){e._readyState=k.CLOSING;let r=Error(n);Error.captureStackTrace(r,ce),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(A,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function M(e,t,n){if(t){let n=g(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function N(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,ve),process.nextTick(me,n._socket),e===1005?n.close():n.close(e,t))}function le(){let e=this[w];e.isPaused||e._socket.resume()}function ue(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,ve),process.nextTick(me,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function de(){this[w].emitClose()}function fe(e,t){this[w].emit(`message`,e,t)}function P(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function pe(e){this[w].emit(`pong`,e)}function me(e){e.resume()}function he(e){let t=this[w];t.readyState!==k.CLOSED&&(t.readyState===k.OPEN&&(t._readyState=k.CLOSING,ge(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function ge(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function _e(){let e=this[w];if(this.removeListener(`close`,_e),this.removeListener(`data`,ve),this.removeListener(`end`,ye),e._readyState=k.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,de),e._receiver.on(`finish`,de))}function ve(e){this[w]._receiver.write(e)||this.pause()}function ye(){let e=this[w];e._readyState=k.CLOSING,e._receiver.end(),this.end()}function be(){let e=this[w];this.removeListener(`error`,be),this.on(`error`,T),e&&(e._readyState=k.CLOSING,this.destroy())}})),rAe=i(((e,n)=>{M6();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),N6=i(((e,t)=>{let{tokenChars:n}=O6();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),iAe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=j6(),c=D6(),l=N6(),u=M6(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=T6(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
1095
+ option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var T6=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),E6=i(((e,n)=>{let{EMPTY_BUFFER:r}=T6(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),$ke=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),D6=i(((e,n)=>{let r=t(`zlib`),i=E6(),a=$ke(),{kStatusCode:o}=T6(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!m){let e=this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit;m=new a(e)}}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),O6=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=T6(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),k6=i(((e,n)=>{let{Writable:r}=t(`stream`),i=D6(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=T6(),{concat:l,toArrayBuffer:u,unmask:d}=E6(),{isValidStatusCode:f,isValidUTF8:p}=O6(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),A6=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=D6(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=T6(),{isBlob:u,isValidStatusCode:d}=O6(),{mask:f,toBuffer:p}=E6(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8192,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),eAe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=T6(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),j6=i(((e,t)=>{let{tokenChars:n}=O6();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),M6=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=D6(),m=k6(),h=A6(),{isBlob:g}=O6(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=T6(),{EventTarget:{addEventListener:E,removeEventListener:D}}=eAe(),{format:O,parse:ee}=j6(),{toBuffer:te}=E6(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var k=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),oe(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,N),i.on(`drain`,le),i.on(`error`,ue),i.on(`message`,fe),i.on(`ping`,P),i.on(`pong`,pe),a.onerror=he,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,_e),t.on(`data`,ve),t.on(`end`,ye),t.on(`error`,be),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ce(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ge(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){M(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ce(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(k,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(k.prototype,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(k,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(k.prototype,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(k,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(k.prototype,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(k,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(k.prototype,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(k.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(k.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),k.prototype.addEventListener=E,k.prototype.removeEventListener=D,n.exports=k;function oe(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:re[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;A(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?se:j),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=O({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{ce(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,A(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ce(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{A(e,SyntaxError(`Invalid URL: ${a}`));return}oe(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||ce(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==k.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ce(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ce(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){ce(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ce(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ce(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){ce(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{ce(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function A(e,t){e._readyState=k.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function j(e){return e.path=e.socketPath,o.connect(e)}function se(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function ce(e,t,n){e._readyState=k.CLOSING;let r=Error(n);Error.captureStackTrace(r,ce),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(A,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function M(e,t,n){if(t){let n=g(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function N(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,ve),process.nextTick(me,n._socket),e===1005?n.close():n.close(e,t))}function le(){let e=this[w];e.isPaused||e._socket.resume()}function ue(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,ve),process.nextTick(me,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function de(){this[w].emitClose()}function fe(e,t){this[w].emit(`message`,e,t)}function P(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function pe(e){this[w].emit(`pong`,e)}function me(e){e.resume()}function he(e){let t=this[w];t.readyState!==k.CLOSED&&(t.readyState===k.OPEN&&(t._readyState=k.CLOSING,ge(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function ge(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function _e(){let e=this[w];if(this.removeListener(`close`,_e),this.removeListener(`data`,ve),this.removeListener(`end`,ye),e._readyState=k.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,de),e._receiver.on(`finish`,de))}function ve(e){this[w]._receiver.write(e)||this.pause()}function ye(){let e=this[w];e._readyState=k.CLOSING,e._receiver.end(),this.end()}function be(){let e=this[w];this.removeListener(`error`,be),this.on(`error`,T),e&&(e._readyState=k.CLOSING,this.destroy())}})),tAe=i(((e,n)=>{M6();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),N6=i(((e,t)=>{let{tokenChars:n}=O6();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),nAe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=j6(),c=D6(),l=N6(),u=M6(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=T6(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
1096
1096
  `).join(`\r
1097
1097
  `)),i.removeListener(`error`,_),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(g,this)})),l(d,r)}};function h(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function g(e){e._state=2,e.emit(`close`)}function _(){this.destroy()}function v(e,t,n,r){n||=i.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
1098
1098
  `)+`\r
1099
1099
  \r
1100
- `+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));rAe(),j6(),D6(),k6(),A6(),N6(),M6(),iAe();let P6,F6,I6,L6,R6=!0;typeof process<`u`&&({FORCE_COLOR:P6,NODE_DISABLE_COLORS:F6,NO_COLOR:I6,TERM:L6}=process.env||{},R6=process.stdout&&process.stdout.isTTY);const z6={enabled:!F6&&I6==null&&L6!==`dumb`&&(P6!=null&&P6!==`0`||R6),reset:V6(0,0),bold:V6(1,22),dim:V6(2,22),italic:V6(3,23),underline:V6(4,24),inverse:V6(7,27),hidden:V6(8,28),strikethrough:V6(9,29),black:V6(30,39),red:V6(31,39),green:V6(32,39),yellow:V6(33,39),blue:V6(34,39),magenta:V6(35,39),cyan:V6(36,39),white:V6(37,39),gray:V6(90,39),grey:V6(90,39),bgBlack:V6(40,49),bgRed:V6(41,49),bgGreen:V6(42,49),bgYellow:V6(43,49),bgBlue:V6(44,49),bgMagenta:V6(45,49),bgCyan:V6(46,49),bgWhite:V6(47,49)};function B6(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function aAe(e,t){let n={has:e,keys:t};return n.reset=z6.reset.bind(n),n.bold=z6.bold.bind(n),n.dim=z6.dim.bind(n),n.italic=z6.italic.bind(n),n.underline=z6.underline.bind(n),n.inverse=z6.inverse.bind(n),n.hidden=z6.hidden.bind(n),n.strikethrough=z6.strikethrough.bind(n),n.black=z6.black.bind(n),n.red=z6.red.bind(n),n.green=z6.green.bind(n),n.yellow=z6.yellow.bind(n),n.blue=z6.blue.bind(n),n.magenta=z6.magenta.bind(n),n.cyan=z6.cyan.bind(n),n.white=z6.white.bind(n),n.gray=z6.gray.bind(n),n.grey=z6.grey.bind(n),n.bgBlack=z6.bgBlack.bind(n),n.bgRed=z6.bgRed.bind(n),n.bgGreen=z6.bgGreen.bind(n),n.bgYellow=z6.bgYellow.bind(n),n.bgBlue=z6.bgBlue.bind(n),n.bgMagenta=z6.bgMagenta.bind(n),n.bgCyan=z6.bgCyan.bind(n),n.bgWhite=z6.bgWhite.bind(n),n}function V6(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:z6.enabled?B6(this.keys,t+``):t+``):t===void 0?aAe([e],[n]):z6.enabled?B6([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const oAe=String.fromCharCode;String.fromCodePoint,oAe(65535);const H6=typeof TextEncoder<`u`?new TextEncoder:null;let U6=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});U6&&U6.decode(new Uint8Array).length===1&&(U6=null);const W6=e=>Error(e);new Uint8Array(3e4).length/3,H6&&H6.encodeInto,W6(`Unexpected end of array`),W6(`Integer out of Range`),Date.now;var G6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),K6=a(import.meta.url),q6=G6(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),J6=G6(((e,t)=>{let{EMPTY_BUFFER:n}=q6(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=K6(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),sAe=G6(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),Y6=G6(((e,t)=>{let n=K6(`zlib`),r=J6(),i=sAe(),{kStatusCode:a}=q6(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),X6=G6(((e,t)=>{let{isUtf8:n}=K6(`buffer`),{hasBlob:r}=q6(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=K6(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),Z6=G6(((e,t)=>{let{Writable:n}=K6(`stream`),r=Y6(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=q6(),{concat:c,toArrayBuffer:l,unmask:u}=J6(),{isValidStatusCode:d,isValidUTF8:f}=X6(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),Q6=G6(((e,t)=>{let{Duplex:n}=K6(`stream`),{randomFillSync:r}=K6(`crypto`),i=Y6(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=q6(),{isBlob:c,isValidStatusCode:l}=X6(),{mask:u,toBuffer:d}=J6(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8192,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),cAe=G6(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=q6(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),$6=G6(((e,t)=>{let{tokenChars:n}=X6();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),e8=G6(((e,t)=>{let n=K6(`events`),r=K6(`https`),i=K6(`http`),a=K6(`net`),o=K6(`tls`),{randomBytes:s,createHash:c}=K6(`crypto`),{Duplex:l,Readable:u}=K6(`stream`),{URL:d}=K6(`url`),f=Y6(),p=Z6(),m=Q6(),{isBlob:h}=X6(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=q6(),{EventTarget:{addEventListener:T,removeEventListener:E}}=cAe(),{format:D,parse:O}=$6(),{toBuffer:ee}=J6(),te=Symbol(`kAborted`),ne=[8,13],re=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ie=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var ae=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),k(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,M),i.on(`drain`,N),i.on(`error`,le),i.on(`message`,de),i.on(`ping`,fe),i.on(`pong`,P),a.onerror=me,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ge),t.on(`data`,_e),t.on(`end`,ve),t.on(`error`,ye),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){se(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),he(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){se(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ae,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae.prototype,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae.prototype,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae.prototype,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),Object.defineProperty(ae.prototype,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(ae.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(ae.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),ae.prototype.addEventListener=T,ae.prototype.removeEventListener=E,t.exports=ae;function k(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:ne[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!ne.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ne.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;oe(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?j:A),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ie.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{se(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[te]||(S=e._req=null,oe(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){se(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{oe(e,SyntaxError(`Invalid URL: ${i}`));return}k(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||se(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==ae.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){se(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){se(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){se(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){se(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{se(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){se(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{se(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function oe(e,t){e._readyState=ae.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function A(e){return e.path=e.socketPath,a.connect(e)}function j(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function se(e,t,n){e._readyState=ae.CLOSING;let r=Error(n);Error.captureStackTrace(r,se),t.setHeader?(t[te]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(oe,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function ce(e,t,n){if(t){let n=h(t)?t.size:ee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${re[e.readyState]})`);process.nextTick(n,t)}}function M(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,_e),process.nextTick(pe,n._socket),e===1005?n.close():n.close(e,t))}function N(){let e=this[C];e.isPaused||e._socket.resume()}function le(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,_e),process.nextTick(pe,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function ue(){this[C].emitClose()}function de(e,t){this[C].emit(`message`,e,t)}function fe(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function P(e){this[C].emit(`pong`,e)}function pe(e){e.resume()}function me(e){let t=this[C];t.readyState!==ae.CLOSED&&(t.readyState===ae.OPEN&&(t._readyState=ae.CLOSING,he(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function he(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ge(){let e=this[C];if(this.removeListener(`close`,ge),this.removeListener(`data`,_e),this.removeListener(`end`,ve),e._readyState=ae.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,ue),e._receiver.on(`finish`,ue))}function _e(e){this[C]._receiver.write(e)||this.pause()}function ve(){let e=this[C];e._readyState=ae.CLOSING,e._receiver.end(),this.end()}function ye(){let e=this[C];this.removeListener(`error`,ye),this.on(`error`,w),e&&(e._readyState=ae.CLOSING,this.destroy())}})),lAe=G6(((e,t)=>{e8();let{Duplex:n}=K6(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),uAe=G6(((e,t)=>{let{tokenChars:n}=X6();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),dAe=G6(((e,t)=>{let n=K6(`events`),r=K6(`http`),{Duplex:i}=K6(`stream`),{createHash:a}=K6(`crypto`),o=$6(),s=Y6(),c=uAe(),l=e8(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=q6(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
1100
+ `+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));tAe(),j6(),D6(),k6(),A6(),N6(),M6(),nAe();let P6,F6,I6,L6,R6=!0;typeof process<`u`&&({FORCE_COLOR:P6,NODE_DISABLE_COLORS:F6,NO_COLOR:I6,TERM:L6}=process.env||{},R6=process.stdout&&process.stdout.isTTY);const z6={enabled:!F6&&I6==null&&L6!==`dumb`&&(P6!=null&&P6!==`0`||R6),reset:V6(0,0),bold:V6(1,22),dim:V6(2,22),italic:V6(3,23),underline:V6(4,24),inverse:V6(7,27),hidden:V6(8,28),strikethrough:V6(9,29),black:V6(30,39),red:V6(31,39),green:V6(32,39),yellow:V6(33,39),blue:V6(34,39),magenta:V6(35,39),cyan:V6(36,39),white:V6(37,39),gray:V6(90,39),grey:V6(90,39),bgBlack:V6(40,49),bgRed:V6(41,49),bgGreen:V6(42,49),bgYellow:V6(43,49),bgBlue:V6(44,49),bgMagenta:V6(45,49),bgCyan:V6(46,49),bgWhite:V6(47,49)};function B6(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function rAe(e,t){let n={has:e,keys:t};return n.reset=z6.reset.bind(n),n.bold=z6.bold.bind(n),n.dim=z6.dim.bind(n),n.italic=z6.italic.bind(n),n.underline=z6.underline.bind(n),n.inverse=z6.inverse.bind(n),n.hidden=z6.hidden.bind(n),n.strikethrough=z6.strikethrough.bind(n),n.black=z6.black.bind(n),n.red=z6.red.bind(n),n.green=z6.green.bind(n),n.yellow=z6.yellow.bind(n),n.blue=z6.blue.bind(n),n.magenta=z6.magenta.bind(n),n.cyan=z6.cyan.bind(n),n.white=z6.white.bind(n),n.gray=z6.gray.bind(n),n.grey=z6.grey.bind(n),n.bgBlack=z6.bgBlack.bind(n),n.bgRed=z6.bgRed.bind(n),n.bgGreen=z6.bgGreen.bind(n),n.bgYellow=z6.bgYellow.bind(n),n.bgBlue=z6.bgBlue.bind(n),n.bgMagenta=z6.bgMagenta.bind(n),n.bgCyan=z6.bgCyan.bind(n),n.bgWhite=z6.bgWhite.bind(n),n}function V6(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:z6.enabled?B6(this.keys,t+``):t+``):t===void 0?rAe([e],[n]):z6.enabled?B6([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const iAe=String.fromCharCode;String.fromCodePoint,iAe(65535);const H6=typeof TextEncoder<`u`?new TextEncoder:null;let U6=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});U6&&U6.decode(new Uint8Array).length===1&&(U6=null);const W6=e=>Error(e);new Uint8Array(3e4).length/3,H6&&H6.encodeInto,W6(`Unexpected end of array`),W6(`Integer out of Range`),Date.now;var G6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),K6=a(import.meta.url),q6=G6(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),J6=G6(((e,t)=>{let{EMPTY_BUFFER:n}=q6(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=K6(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),aAe=G6(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),Y6=G6(((e,t)=>{let n=K6(`zlib`),r=J6(),i=aAe(),{kStatusCode:a}=q6(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),X6=G6(((e,t)=>{let{isUtf8:n}=K6(`buffer`),{hasBlob:r}=q6(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=K6(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),Z6=G6(((e,t)=>{let{Writable:n}=K6(`stream`),r=Y6(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=q6(),{concat:c,toArrayBuffer:l,unmask:u}=J6(),{isValidStatusCode:d,isValidUTF8:f}=X6(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),Q6=G6(((e,t)=>{let{Duplex:n}=K6(`stream`),{randomFillSync:r}=K6(`crypto`),i=Y6(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=q6(),{isBlob:c,isValidStatusCode:l}=X6(),{mask:u,toBuffer:d}=J6(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8192,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),oAe=G6(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=q6(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),$6=G6(((e,t)=>{let{tokenChars:n}=X6();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),e8=G6(((e,t)=>{let n=K6(`events`),r=K6(`https`),i=K6(`http`),a=K6(`net`),o=K6(`tls`),{randomBytes:s,createHash:c}=K6(`crypto`),{Duplex:l,Readable:u}=K6(`stream`),{URL:d}=K6(`url`),f=Y6(),p=Z6(),m=Q6(),{isBlob:h}=X6(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=q6(),{EventTarget:{addEventListener:T,removeEventListener:E}}=oAe(),{format:D,parse:O}=$6(),{toBuffer:ee}=J6(),te=Symbol(`kAborted`),ne=[8,13],re=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ie=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var ae=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),k(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,M),i.on(`drain`,N),i.on(`error`,le),i.on(`message`,de),i.on(`ping`,fe),i.on(`pong`,P),a.onerror=me,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ge),t.on(`data`,_e),t.on(`end`,ve),t.on(`error`,ye),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){se(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),he(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ce(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){se(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ae,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae.prototype,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae.prototype,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae.prototype,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),Object.defineProperty(ae.prototype,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(ae.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(ae.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),ae.prototype.addEventListener=T,ae.prototype.removeEventListener=E,t.exports=ae;function k(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:ne[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!ne.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ne.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;oe(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?j:A),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ie.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{se(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[te]||(S=e._req=null,oe(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){se(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{oe(e,SyntaxError(`Invalid URL: ${i}`));return}k(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||se(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==ae.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){se(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){se(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){se(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){se(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{se(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){se(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{se(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function oe(e,t){e._readyState=ae.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function A(e){return e.path=e.socketPath,a.connect(e)}function j(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function se(e,t,n){e._readyState=ae.CLOSING;let r=Error(n);Error.captureStackTrace(r,se),t.setHeader?(t[te]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(oe,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function ce(e,t,n){if(t){let n=h(t)?t.size:ee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${re[e.readyState]})`);process.nextTick(n,t)}}function M(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,_e),process.nextTick(pe,n._socket),e===1005?n.close():n.close(e,t))}function N(){let e=this[C];e.isPaused||e._socket.resume()}function le(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,_e),process.nextTick(pe,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function ue(){this[C].emitClose()}function de(e,t){this[C].emit(`message`,e,t)}function fe(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function P(e){this[C].emit(`pong`,e)}function pe(e){e.resume()}function me(e){let t=this[C];t.readyState!==ae.CLOSED&&(t.readyState===ae.OPEN&&(t._readyState=ae.CLOSING,he(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function he(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ge(){let e=this[C];if(this.removeListener(`close`,ge),this.removeListener(`data`,_e),this.removeListener(`end`,ve),e._readyState=ae.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,ue),e._receiver.on(`finish`,ue))}function _e(e){this[C]._receiver.write(e)||this.pause()}function ve(){let e=this[C];e._readyState=ae.CLOSING,e._receiver.end(),this.end()}function ye(){let e=this[C];this.removeListener(`error`,ye),this.on(`error`,w),e&&(e._readyState=ae.CLOSING,this.destroy())}})),sAe=G6(((e,t)=>{e8();let{Duplex:n}=K6(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),cAe=G6(((e,t)=>{let{tokenChars:n}=X6();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),lAe=G6(((e,t)=>{let n=K6(`events`),r=K6(`http`),{Duplex:i}=K6(`stream`),{createHash:a}=K6(`crypto`),o=$6(),s=Y6(),c=cAe(),l=e8(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=q6(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
1101
1101
  `).join(`\r
1102
1102
  `)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
1103
1103
  `)+`\r
1104
1104
  \r
1105
- `+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));lAe(),Z6(),Q6(),e8(),dAe(),Yu(),new Set(see);const fAe=new Set;function t8(e){fAe.add(e)}function pAe(){return Ju.getTracer(`open-knowledge-server`)}async function mAe(e,t,n){return pAe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Wu.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}QX(`loss-capture`),V({ts:L(),schemaVersion:L(),seq:L(),event:I(),docName:I(),writerId:I().nullable(),site:I().optional(),direction:I().optional(),lostLen:L().optional(),digest:I().optional(),checkpointSha:I().optional(),which:I().optional(),witnessAvailable:R().optional(),connections:L().optional()}),QX(`checkpoint-chain`);function n8(e){try{return E.native(e)}catch{return e}}`${Jie.map(e=>`${e}/`).join(`
1105
+ `+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));sAe(),Z6(),Q6(),e8(),lAe(),Yu(),new Set(see);const uAe=new Set;function t8(e){uAe.add(e)}function dAe(){return Ju.getTracer(`open-knowledge-server`)}async function fAe(e,t,n){return dAe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Wu.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}QX(`loss-capture`),V({ts:L(),schemaVersion:L(),seq:L(),event:I(),docName:I(),writerId:I().nullable(),site:I().optional(),direction:I().optional(),lostLen:L().optional(),digest:I().optional(),checkpointSha:I().optional(),which:I().optional(),witnessAvailable:R().optional(),connections:L().optional()}),QX(`checkpoint-chain`);function n8(e){try{return E.native(e)}catch{return e}}`${Jie.map(e=>`${e}/`).join(`
1106
1106
  `)}${ld.join(`
1107
- `)}`;function hAe(e){try{return process.kill(e,0),`signalable`}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`?`foreign`:`absent`}}function r8(e){return hAe(e)!==`absent`}function gAe(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}QX(`shadow-lock`),QX(`shadow-op-gate`),QX(`shadow-repo`),(()=>{let e=process.env.OK_GIT_TIMEOUT_MS;if(!e)return 3e4;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e4})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_GC_TIMEOUT_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),(()=>{let e=process.env.OK_SHADOW_STAGE_TIMEOUT_MS;if(!e)return 3e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e5})();const _Ae=fd.map(e=>`.ok/${e}/`),vAe=ld.map(e=>`.ok/${e}`),i8=[..._Ae.map(e=>`**/${e}`),...vAe.map(e=>`**/${e}`),`**/.ok/watcher-settle-fence-*`,qye];`${i8.join(`
1108
- `)}`,i8.flatMap(e=>[`-x`,e]),wJ.fileSystem,wJ.gitUpstream,wJ.service,wJ.generator,QX(`bridge-loss-detector`),QX(`checkpoint`);function a8(e){let t=oe(e).toLowerCase();return Dd.includes(t)}function yAe(e){let t=e.toLowerCase();for(let n of Dd)if(t.endsWith(n))return e.slice(0,-n.length);return e}function bAe(e){return e===`__system__`}const xAe=new Set(iae);function SAe(e){return xAe.has(e)}function CAe(e){return aae(e)}function wAe(e){return bAe(e)||SAe(e)||CAe(e)}function o8(e){return e.replace(/\\/g,`/`)}QX(`directory-root`);function s8(e){try{return te(N(e,`.ok/config.yml`)).isFile()}catch(e){let t=e?.code;if(t===`ENOENT`||t===`ENOTDIR`)return!1;throw e}}function c8(e){return{...e,windowsHide:!0}}const l8=QX(`content-filter`);Fe(o);const u8=[`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`],d8=new Set([`node_modules`,`.venv`,`venv`,`env`,`__pycache__`,`vendor`,`dist`,`build`,`out`,`output`,`.next`,`.nuxt`,`.svelte-kit`,`.astro`,`.turbo`,`.cache`,`.parcel-cache`,`coverage`,`.git`,`.ok`,`.open-knowledge`,`.openknowledge`,...u8,`Library`,`Applications`,`.Trash`]),f8=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,...u8]),p8=new Set([`worktrees`,`local`]);function m8(e){return d8.has(e)||f8.has(e.toLowerCase())}function h8(e){let t=Vl(e);if(!Hl(t))throw Error(`Invalid attachment folder path`);if(t===`./`)return{kind:`sibling`};if(t===`/`||t===`.`)return{kind:`content-root`};let n=t.startsWith(`./`),r=(n?t.slice(2):t).split(`/`).filter(e=>e!==``&&e!==`.`).join(`/`);return r===``?n?{kind:`sibling`}:{kind:`content-root`}:{kind:n?`doc-relative`:`fixed`,path:r}}function TAe(e){throw Error(`[AttachmentFolderShape] unhandled variant: ${JSON.stringify(e)}`)}function EAe(e,t,n){let r=oe(e).slice(1).toLowerCase();if(!Gc.has(r)||t.kind===`sibling`)return!1;let i=e.lastIndexOf(`/`),a=i===-1?``:e.slice(0,i);if(t.kind===`content-root`)return a===``;if(t.kind===`fixed`)return a===t.path||a.startsWith(`${t.path}/`);if(t.kind===`doc-relative`){let e=a===``?[]:a.split(`/`),r=t.path.split(`/`);for(let t=0;t<=e.length-r.length;t++)if(r.every((n,r)=>e[t+r]===n)&&n(e.slice(0,t).join(`/`)))return!0;return!1}return TAe(t)}function g8(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e].toLowerCase();if(f8.has(r)&&!(t&&r===`.ok`&&!p8.has((n[e+1]??``).toLowerCase())))return!0}return!1}function DAe(e){return g8(e)||w8(e)}function _8(e,t){return DAe(e.slice(t.length+1))}function v8(e){return e.startsWith(`.ok/skills/`)&&!_8(e,`.ok/skills`)}function OAe(e){return e===`.ok`||e===`.ok/skills`||v8(e)}const y8=new Set([`.ok`,...u8]),kAe=new Set([...d8].filter(e=>!y8.has(e))),AAe=[`.git`,`node_modules`,`.ok/local`,`.ok/worktrees`].flatMap(e=>[e,`${e}/**`,`**/${e}`,`**/${e}/**`]);function jAe(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);return t.includes(`..`)?!1:t.some(e=>kAe.has(e))?!0:t.some((e,n)=>e.toLowerCase()===`.ok`&&p8.has((t[n+1]??``).toLowerCase()))}const MAe=[`.gitignore`,`.ok`,`.ok/config.yml`,`.ok/.gitignore`,`.ok/schemas/frontmatter.json`,`.ok/templates/example.md`,`.ok/skills/example/SKILL.md`,`docs/.ok`,`docs/.ok/frontmatter.yml`,`docs/.ok/templates/example.md`,...u8.flatMap(e=>[e,`${e}/skills/example/SKILL.md`])];function NAe(e){let t=e.trim();if(!t||t.startsWith(`!`)||t.startsWith(`#`))return!1;let n=t.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);if(n.includes(`..`))return!0;if(jAe(t))return!1;if(n.some(e=>y8.has(e)))return!0;try{let e=(0,y4.default)().add(t);return MAe.some(t=>e.ignores(t))}catch{return!0}}function PAe(e){let t=e.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!NAe(e));return[...new Set([...t,...AAe])]}function b8(e,t){for(let n=0;n<t;n++)if(m8(e[n]))return!0;return!1}function x8(e){let t=e.split(`/`),n=t.length;return n<3||t[n-3]!==`.ok`||t[n-2]!==`templates`||oe(t[n-1])!==`.md`?!1:!b8(t,n-3)}function S8(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!b8(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`&&!b8(t,n-2)}function FAe(e){let t=e.split(`/`),n=t.length;return t[0]===`.ok`&&(n===2&&(t[1]===`config.yml`||t[1]===`.gitignore`)||n===3&&t[1]===`schemas`&&t[2].toLowerCase().endsWith(`.json`))||x8(e)?!0:n>=2&&t[n-1]===`frontmatter.yml`&&t[n-2]===`.ok`&&!b8(t,n-2)}function IAe(e){return e===`.ok`||e===`.ok/schemas`||S8(e)}function LAe(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function C8(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`)&&!_8(e,n))return!0;return!1}function RAe(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`)&&!_8(e,n))return!0;return!1}const zAe=new Set([`.ds_store`,`.localized`,`thumbs.db`,`desktop.ini`,`.directory`]);function w8(e){return zAe.has(e.slice(e.lastIndexOf(`/`)+1).toLowerCase())}const BAe=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function T8(e){for(let t of e.split(`/`))if(BAe.has(t.toLowerCase()))return!0;return!1}const VAe=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),HAe=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function E8(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||VAe.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of HAe)if(t.endsWith(e))return!0;return!1}function UAe(e,t){return t===e||t.startsWith(`${e}/`)}function WAe(e,t,n,r){let i=n===void 0,a=new Map;function o(e){let t=a.get(e);if(t!==void 0)return t;let n;try{n=s8(e)}catch{return!1}return a.set(e,n),n}return{isInside(n,a){if(!i||n===``)return!1;let s=a?.pathBase===`project`?e:t;if(r?.(N(s,n)))return!0;let c=s;for(let e of n.split(`/`))if(c=j(c,e),o(c))return!0;return!1},reset(){a.clear()}}}const D8=[`.gitignore`,`.okignore`];function GAe(e,t){let n=KAe(e);if(n===null)return[];let r=[];O8(j(n,`info`,`exclude`),t,r,`info/exclude`);let i=qAe(e);return i&&O8(i,t,r,`global excludesfile`),r}function KAe(e){let t=l(`git`,[`rev-parse`,`--git-common-dir`],c8({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:N(e,t.stdout.trim())}function qAe(e){let t=l(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],c8({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return JAe()}function JAe(){let e=process.env.XDG_CONFIG_HOME?.trim(),t=e&&e.length>0?e:j(_e(),`.config`);return j(t,`git`,`ignore`)}function O8(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...A8(r))}catch(t){l8.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function YAe(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=h8(e.attachmentFolderPath??`./`),s=e.skillRootPaths??new Set,c=WAe(t,n,i,e.isContentScopeExcluded),l=o8(M(t,n)),u=l.startsWith(`..`),d,f,p,m,h=0,_=0,v=0;function y(){let e=(0,y4.default)(),r=(0,y4.default)();e.add(`.git`);let i=[],a=0,o=0;for(let n of D8){let o=j(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=A8(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){l8.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(l&&!u)for(let t of D8){let i=j(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,o++;let s=A8(n).map(e=>j8(e,l));e.add(s),t===`.okignore`&&r.add(s)}catch(e){l8.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let s={value:a};o+=M8(n,t,e,r,s),a=s.value;let c=GAe(t,s);a=s.value,c.length>0&&(i.push(...c),e.add(c));let y=PAe(i);return d=e,f=r,p=i,m=y,h=i.length,_=o,v=a,{patternCount:h,nestedFileCount:_,bytes:v}}y();let b=new Map;function x(e,t){if(u&&t?.pathBase!==`project`)return!1;let n=t?.pathBase===`project`||!l?e:`${l}/${e}`;return!n.startsWith(`..`)&&d.ignores(n)}function C(e,t){return t.pathBase===`project`||!l?e:`${l}/${e}`}function w(e){if(u)return!1;let t=l?`${l}/${e}`:e;return f.ignores(t)}let T=()=>{i===void 0&&k8(n,``,x,b)};T();function E(e){return wAe(yAe(e))}function D(e){for(let t of e.split(`/`))if(m8(t))return!0;return!u&&x(e)}let O=null,ee=null;return{isExcluded(e,t){if(E(e)||E8(e)||T8(e)||c.isInside(e,t?.syncScope)||!t?.bypassFilters&&LAe(e,s)&&!C8(e,a))return!0;if(!t?.bypassFilters&&(v8(e)||C8(e,a)&&!x(e))){if(i!==void 0)return e!==i;if(a8(e))return!1;let t=oe(e).slice(1).toLowerCase();return!Gc.has(t)}if(!t?.bypassFilters&&x8(e)||!t?.bypassFilters&&t?.syncScope!==void 0&&FAe(C(e,t.syncScope))&&!x(e,t.syncScope))return i!==void 0&&e!==i;if(g8(e,t?.showOk)||w8(e))return!0;if(i!==void 0)return e!==i;if(t?.bypassFilters)return t.respectOkignore===!0&&w(e);if(D(e))return!0;if(a8(e)||EAe(e,o,e=>(b.get(e)??0)>0))return!1;let n=oe(e).slice(1).toLowerCase();if(Gc.has(n)){let t=k(e),n=t===`.`?``:t;if((b.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(T8(e)||c.isInside(e,t?.syncScope))return!0;if(!t?.bypassFilters&&(OAe(e)||S8(e)||t?.syncScope!==void 0&&IAe(C(e,t.syncScope))||RAe(e,a)))return!1;if(g8(e,t?.showOk))return!0;if(i!==void 0)return!UAe(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(w(e)||w(`${e}/`));for(let t of e.split(`/`))if(m8(t))return!0;return u?!1:x(e,t?.syncScope)||x(`${e}/`,t?.syncScope)},isPathIgnored(e,t){return E(e)||E8(e)||T8(e)?!0:v8(e)||C8(e,a)&&!x(e)||x8(e)?!1:g8(e)||w8(e)?!0:!t?.bypassFilters&&D(e)},isExcludedByIgnoreFiles(e){return e.split(`/`).some(m8)||u?!1:x(e)},getWatcherIgnoreGlobs(){return m},incrementMdDir(e){let t=e===`.`?``:e;b.set(t,(b.get(t)??0)+1)},decrementMdDir(e){let t=e===`.`?``:e,n=b.get(t)??0;n<=1?b.delete(t):b.set(t,n-1)},rebuildDirCount(){let e=new Map(b);b.clear();try{T()}catch(t){for(let[t,n]of e)b.set(t,n);l8.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},setAttachmentFolderPath(e){o=h8(e)},refreshInPlaceSkillDirs(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){l8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}},inPlaceSkillDirsFingerprint(){return[...a].sort().join(`
1107
+ `)}`;function pAe(e){try{return process.kill(e,0),`signalable`}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`?`foreign`:`absent`}}function r8(e){return pAe(e)!==`absent`}function mAe(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}QX(`shadow-lock`),QX(`shadow-op-gate`),QX(`shadow-repo`),(()=>{let e=process.env.OK_GIT_TIMEOUT_MS;if(!e)return 3e4;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e4})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_GC_TIMEOUT_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),(()=>{let e=process.env.OK_SHADOW_STAGE_TIMEOUT_MS;if(!e)return 3e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e5})();const hAe=fd.map(e=>`.ok/${e}/`),gAe=ld.map(e=>`.ok/${e}`),i8=[...hAe.map(e=>`**/${e}`),...gAe.map(e=>`**/${e}`),`**/.ok/watcher-settle-fence-*`,Gye];`${i8.join(`
1108
+ `)}`,i8.flatMap(e=>[`-x`,e]),wJ.fileSystem,wJ.gitUpstream,wJ.service,wJ.generator,QX(`bridge-loss-detector`),QX(`checkpoint`);function a8(e){let t=oe(e).toLowerCase();return Dd.includes(t)}function _Ae(e){let t=e.toLowerCase();for(let n of Dd)if(t.endsWith(n))return e.slice(0,-n.length);return e}function vAe(e){return e===`__system__`}const yAe=new Set(iae);function bAe(e){return yAe.has(e)}function xAe(e){return aae(e)}function SAe(e){return vAe(e)||bAe(e)||xAe(e)}function o8(e){return e.replace(/\\/g,`/`)}QX(`directory-root`);function s8(e){try{return te(N(e,`.ok/config.yml`)).isFile()}catch(e){let t=e?.code;if(t===`ENOENT`||t===`ENOTDIR`)return!1;throw e}}function c8(e){return{...e,windowsHide:!0}}const l8=QX(`content-filter`);Fe(o);const u8=[`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`],d8=new Set([`node_modules`,`.venv`,`venv`,`env`,`__pycache__`,`vendor`,`dist`,`build`,`out`,`output`,`.next`,`.nuxt`,`.svelte-kit`,`.astro`,`.turbo`,`.cache`,`.parcel-cache`,`coverage`,`.git`,`.ok`,`.open-knowledge`,`.openknowledge`,...u8,`Library`,`Applications`,`.Trash`]),f8=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,...u8]),p8=new Set([`worktrees`,`local`]);function m8(e){return d8.has(e)||f8.has(e.toLowerCase())}function h8(e){let t=Vl(e);if(!Hl(t))throw Error(`Invalid attachment folder path`);if(t===`./`)return{kind:`sibling`};if(t===`/`||t===`.`)return{kind:`content-root`};let n=t.startsWith(`./`),r=(n?t.slice(2):t).split(`/`).filter(e=>e!==``&&e!==`.`).join(`/`);return r===``?n?{kind:`sibling`}:{kind:`content-root`}:{kind:n?`doc-relative`:`fixed`,path:r}}function CAe(e){throw Error(`[AttachmentFolderShape] unhandled variant: ${JSON.stringify(e)}`)}function wAe(e,t,n){let r=oe(e).slice(1).toLowerCase();if(!Gc.has(r)||t.kind===`sibling`)return!1;let i=e.lastIndexOf(`/`),a=i===-1?``:e.slice(0,i);if(t.kind===`content-root`)return a===``;if(t.kind===`fixed`)return a===t.path||a.startsWith(`${t.path}/`);if(t.kind===`doc-relative`){let e=a===``?[]:a.split(`/`),r=t.path.split(`/`);for(let t=0;t<=e.length-r.length;t++)if(r.every((n,r)=>e[t+r]===n)&&n(e.slice(0,t).join(`/`)))return!0;return!1}return CAe(t)}function g8(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e].toLowerCase();if(f8.has(r)&&!(t&&r===`.ok`&&!p8.has((n[e+1]??``).toLowerCase())))return!0}return!1}function TAe(e){return g8(e)||w8(e)}function _8(e,t){return TAe(e.slice(t.length+1))}function v8(e){return e.startsWith(`.ok/skills/`)&&!_8(e,`.ok/skills`)}function EAe(e){return e===`.ok`||e===`.ok/skills`||v8(e)}const y8=new Set([`.ok`,...u8]),DAe=new Set([...d8].filter(e=>!y8.has(e))),OAe=[`.git`,`node_modules`,`.ok/local`,`.ok/worktrees`].flatMap(e=>[e,`${e}/**`,`**/${e}`,`**/${e}/**`]);function kAe(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);return t.includes(`..`)?!1:t.some(e=>DAe.has(e))?!0:t.some((e,n)=>e.toLowerCase()===`.ok`&&p8.has((t[n+1]??``).toLowerCase()))}const AAe=[`.gitignore`,`.ok`,`.ok/config.yml`,`.ok/.gitignore`,`.ok/schemas/frontmatter.json`,`.ok/templates/example.md`,`.ok/skills/example/SKILL.md`,`docs/.ok`,`docs/.ok/frontmatter.yml`,`docs/.ok/templates/example.md`,...u8.flatMap(e=>[e,`${e}/skills/example/SKILL.md`])];function jAe(e){let t=e.trim();if(!t||t.startsWith(`!`)||t.startsWith(`#`))return!1;let n=t.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);if(n.includes(`..`))return!0;if(kAe(t))return!1;if(n.some(e=>y8.has(e)))return!0;try{let e=(0,y4.default)().add(t);return AAe.some(t=>e.ignores(t))}catch{return!0}}function MAe(e){let t=e.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!jAe(e));return[...new Set([...t,...OAe])]}function b8(e,t){for(let n=0;n<t;n++)if(m8(e[n]))return!0;return!1}function x8(e){let t=e.split(`/`),n=t.length;return n<3||t[n-3]!==`.ok`||t[n-2]!==`templates`||oe(t[n-1])!==`.md`?!1:!b8(t,n-3)}function S8(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!b8(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`&&!b8(t,n-2)}function NAe(e){let t=e.split(`/`),n=t.length;return t[0]===`.ok`&&(n===2&&(t[1]===`config.yml`||t[1]===`.gitignore`)||n===3&&t[1]===`schemas`&&t[2].toLowerCase().endsWith(`.json`))||x8(e)?!0:n>=2&&t[n-1]===`frontmatter.yml`&&t[n-2]===`.ok`&&!b8(t,n-2)}function PAe(e){return e===`.ok`||e===`.ok/schemas`||S8(e)}function FAe(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function C8(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`)&&!_8(e,n))return!0;return!1}function IAe(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`)&&!_8(e,n))return!0;return!1}const LAe=new Set([`.ds_store`,`.localized`,`thumbs.db`,`desktop.ini`,`.directory`]);function w8(e){return LAe.has(e.slice(e.lastIndexOf(`/`)+1).toLowerCase())}const RAe=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function T8(e){for(let t of e.split(`/`))if(RAe.has(t.toLowerCase()))return!0;return!1}const zAe=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),BAe=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function E8(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||zAe.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of BAe)if(t.endsWith(e))return!0;return!1}function VAe(e,t){return t===e||t.startsWith(`${e}/`)}function HAe(e,t,n,r){let i=n===void 0,a=new Map;function o(e){let t=a.get(e);if(t!==void 0)return t;let n;try{n=s8(e)}catch{return!1}return a.set(e,n),n}return{isInside(n,a){if(!i||n===``)return!1;let s=a?.pathBase===`project`?e:t;if(r?.(N(s,n)))return!0;let c=s;for(let e of n.split(`/`))if(c=j(c,e),o(c))return!0;return!1},reset(){a.clear()}}}const D8=[`.gitignore`,`.okignore`];function UAe(e,t){let n=WAe(e);if(n===null)return[];let r=[];O8(j(n,`info`,`exclude`),t,r,`info/exclude`);let i=GAe(e);return i&&O8(i,t,r,`global excludesfile`),r}function WAe(e){let t=l(`git`,[`rev-parse`,`--git-common-dir`],c8({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:N(e,t.stdout.trim())}function GAe(e){let t=l(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],c8({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return KAe()}function KAe(){let e=process.env.XDG_CONFIG_HOME?.trim(),t=e&&e.length>0?e:j(_e(),`.config`);return j(t,`git`,`ignore`)}function O8(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...A8(r))}catch(t){l8.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function qAe(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=h8(e.attachmentFolderPath??`./`),s=e.skillRootPaths??new Set,c=HAe(t,n,i,e.isContentScopeExcluded),l=o8(M(t,n)),u=l.startsWith(`..`),d,f,p,m,h=0,_=0,v=0;function y(){let e=(0,y4.default)(),r=(0,y4.default)();e.add(`.git`);let i=[],a=0,o=0;for(let n of D8){let o=j(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=A8(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){l8.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(l&&!u)for(let t of D8){let i=j(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,o++;let s=A8(n).map(e=>j8(e,l));e.add(s),t===`.okignore`&&r.add(s)}catch(e){l8.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let s={value:a};o+=M8(n,t,e,r,s),a=s.value;let c=UAe(t,s);a=s.value,c.length>0&&(i.push(...c),e.add(c));let y=MAe(i);return d=e,f=r,p=i,m=y,h=i.length,_=o,v=a,{patternCount:h,nestedFileCount:_,bytes:v}}y();let b=new Map;function x(e,t){if(u&&t?.pathBase!==`project`)return!1;let n=t?.pathBase===`project`||!l?e:`${l}/${e}`;return!n.startsWith(`..`)&&d.ignores(n)}function C(e,t){return t.pathBase===`project`||!l?e:`${l}/${e}`}function w(e){if(u)return!1;let t=l?`${l}/${e}`:e;return f.ignores(t)}let T=()=>{i===void 0&&k8(n,``,x,b)};T();function E(e){return SAe(_Ae(e))}function D(e){for(let t of e.split(`/`))if(m8(t))return!0;return!u&&x(e)}let O=null,ee=null;return{isExcluded(e,t){if(E(e)||E8(e)||T8(e)||c.isInside(e,t?.syncScope)||!t?.bypassFilters&&FAe(e,s)&&!C8(e,a))return!0;if(!t?.bypassFilters&&(v8(e)||C8(e,a)&&!x(e))){if(i!==void 0)return e!==i;if(a8(e))return!1;let t=oe(e).slice(1).toLowerCase();return!Gc.has(t)}if(!t?.bypassFilters&&x8(e)||!t?.bypassFilters&&t?.syncScope!==void 0&&NAe(C(e,t.syncScope))&&!x(e,t.syncScope))return i!==void 0&&e!==i;if(g8(e,t?.showOk)||w8(e))return!0;if(i!==void 0)return e!==i;if(t?.bypassFilters)return t.respectOkignore===!0&&w(e);if(D(e))return!0;if(a8(e)||wAe(e,o,e=>(b.get(e)??0)>0))return!1;let n=oe(e).slice(1).toLowerCase();if(Gc.has(n)){let t=k(e),n=t===`.`?``:t;if((b.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(T8(e)||c.isInside(e,t?.syncScope))return!0;if(!t?.bypassFilters&&(EAe(e)||S8(e)||t?.syncScope!==void 0&&PAe(C(e,t.syncScope))||IAe(e,a)))return!1;if(g8(e,t?.showOk))return!0;if(i!==void 0)return!VAe(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(w(e)||w(`${e}/`));for(let t of e.split(`/`))if(m8(t))return!0;return u?!1:x(e,t?.syncScope)||x(`${e}/`,t?.syncScope)},isPathIgnored(e,t){return E(e)||E8(e)||T8(e)?!0:v8(e)||C8(e,a)&&!x(e)||x8(e)?!1:g8(e)||w8(e)?!0:!t?.bypassFilters&&D(e)},isExcludedByIgnoreFiles(e){return e.split(`/`).some(m8)||u?!1:x(e)},getWatcherIgnoreGlobs(){return m},incrementMdDir(e){let t=e===`.`?``:e;b.set(t,(b.get(t)??0)+1)},decrementMdDir(e){let t=e===`.`?``:e,n=b.get(t)??0;n<=1?b.delete(t):b.set(t,n-1)},rebuildDirCount(){let e=new Map(b);b.clear();try{T()}catch(t){for(let[t,n]of e)b.set(t,n);l8.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},setAttachmentFolderPath(e){o=h8(e)},refreshInPlaceSkillDirs(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){l8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}},inPlaceSkillDirsFingerprint(){return[...a].sort().join(`
1109
1109
  `)},peekFreshInPlaceSkillDirsFingerprint(){if(!e.rescanInPlaceSkillDirs)return[...a].sort().join(`
1110
1110
  `);try{return[...e.rescanInPlaceSkillDirs(a)].sort().join(`
1111
1111
  `)}catch{return[...a].sort().join(`
1112
- `)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){l8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,g=_,S=v,C=Date.now();return mAe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await XAe(n,x,b);let a=Date.now()-C;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),l8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a}}catch(e){d=t,f=o,p=s,m=l,h=u,_=g,v=S,b.clear();try{T()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let n=e instanceof Error?e.message:String(e);return l8.warn({err:e instanceof Error?e:Error(n)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:n}}}})};return O===null?t(o):(ee===null&&(ee=O.catch(()=>null).then(()=>(ee=null,t(o)))),ee)}}}async function XAe(e,t,n){let r=[{dir:e,relPath:``}],i=0;for(;r.length>0;){let{dir:e,relPath:a}=r.pop();i+=1,i>=50&&(i=0,await new Promise(e=>setImmediate(e)));let o;try{o=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);continue}for(let i of o){let o=a?`${a}/${i.name}`:i.name;if(i.isDirectory()){if(m8(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:j(e,i.name),relPath:o})}else i.isFile()&&a8(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function k8(e,t,n,r){let i;try{i=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(m8(a.name)||n(i)||n(`${i}/`))continue;k8(j(e,a.name),i,n,r)}else a.isFile()&&a8(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function A8(e){return e.split(`
1113
- `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function j8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function M8(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return l8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||m8(s.name))continue;let a=j(e,s.name),c=o8(M(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of D8){let t=j(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=A8(a).map(e=>j8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){l8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=M8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const ZAe=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function N8(e){return e.replace(ZAe,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function P8(e){let t=N8(e);for(let e=0;e<4;e++){let e=N8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const QAe=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(P8));new Set([...fd,...ld,...Kie].map(P8));function $Ae(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}$Ae(QAe);const F8=I().min(1).refine(e=>!e.includes(`\0`)&&A(e)&&se(e)===e);ea(`kind`,[V({kind:W(`file`),path:F8}),V({kind:W(`tree`),path:F8,excluded:B(F8)}).refine(({path:e,excluded:t})=>t.every(t=>M(e,t)!==``&&eje(e,t)))]),V({server_instance_id:I().min(1),owner_token:Hi(),pid:L().int().positive(),lease_protocol:I().min(1),project_dir:F8,scope_json:I(),started_at:ki()});function eje(e,t){let n=M(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!A(n)}RegExp(`<(${AJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const tje=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,nje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,I8=String.raw`([^\]\n]*)`,L8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,R8=e=>RegExp(`(!?)${tje}`,e),z8=(e,t)=>RegExp(`(!?)\\[${e}\\]${nje}`,t);R8(`y`),R8(`g`),z8(I8,`y`),z8(L8,`y`),z8(I8,`g`),z8(L8,`g`);const rje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(rje,`y`),QX(`file-watcher`),QX(`conflict-authority`),QX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),t8(()=>{}),QX(`bridge-watchdog`),t8(()=>{}),QX(`server-observers`),QX(`server-observers`),QX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)ije(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function ije(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const B8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(B8));const aje=Object.keys(B8),oje={discovery:`user`,project:`project`,"write-skill":`user`},V8=aje.filter(e=>oje[e]===`user`);new Set(V8.map(e=>B8[e]));const H8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function U8(e){return new URL(e).pathname.endsWith(`.ts`)}function sje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(j(`/Applications`,H8,e)),(!s||n.home!==void 0)&&o.push(j(a,`Applications`,H8,e))),U8(t)?(o.push(fe(new URL(`../assets/skills/${e}`,t))),o):(o.push(fe(new URL(`../dist/assets/skills/${e}`,t))),o.push(fe(new URL(`../assets/skills/${e}`,t))),o.push(fe(new URL(`./assets/skills/${e}`,t))),o)}function cje(e,t,n){let r=U8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function W8(e,t={}){let n=sje(e,import.meta.url,t);for(let e of n)if(g(e))return e;throw Error(cje(e,import.meta.url,n))}function lje(e=N(k(fe(import.meta.url)),`..`,`package.json`)){try{let t=JSON.parse(S(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}lje();function uje(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
1112
+ `)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){l8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,g=_,S=v,C=Date.now();return fAe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await JAe(n,x,b);let a=Date.now()-C;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),l8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a}}catch(e){d=t,f=o,p=s,m=l,h=u,_=g,v=S,b.clear();try{T()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let n=e instanceof Error?e.message:String(e);return l8.warn({err:e instanceof Error?e:Error(n)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:n}}}})};return O===null?t(o):(ee===null&&(ee=O.catch(()=>null).then(()=>(ee=null,t(o)))),ee)}}}async function JAe(e,t,n){let r=[{dir:e,relPath:``}],i=0;for(;r.length>0;){let{dir:e,relPath:a}=r.pop();i+=1,i>=50&&(i=0,await new Promise(e=>setImmediate(e)));let o;try{o=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);continue}for(let i of o){let o=a?`${a}/${i.name}`:i.name;if(i.isDirectory()){if(m8(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:j(e,i.name),relPath:o})}else i.isFile()&&a8(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function k8(e,t,n,r){let i;try{i=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(m8(a.name)||n(i)||n(`${i}/`))continue;k8(j(e,a.name),i,n,r)}else a.isFile()&&a8(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function A8(e){return e.split(`
1113
+ `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function j8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function M8(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return l8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||m8(s.name))continue;let a=j(e,s.name),c=o8(M(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of D8){let t=j(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=A8(a).map(e=>j8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){l8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=M8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const YAe=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function N8(e){return e.replace(YAe,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function P8(e){let t=N8(e);for(let e=0;e<4;e++){let e=N8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const XAe=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(P8));new Set([...fd,...ld,...Kie].map(P8));function ZAe(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}ZAe(XAe);const F8=I().min(1).refine(e=>!e.includes(`\0`)&&A(e)&&se(e)===e);ea(`kind`,[V({kind:W(`file`),path:F8}),V({kind:W(`tree`),path:F8,excluded:B(F8)}).refine(({path:e,excluded:t})=>t.every(t=>M(e,t)!==``&&QAe(e,t)))]),V({server_instance_id:I().min(1),owner_token:Hi(),pid:L().int().positive(),lease_protocol:I().min(1),project_dir:F8,scope_json:I(),started_at:ki()});function QAe(e,t){let n=M(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!A(n)}RegExp(`<(${AJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const $Ae=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,eje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,I8=String.raw`([^\]\n]*)`,L8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,R8=e=>RegExp(`(!?)${$Ae}`,e),z8=(e,t)=>RegExp(`(!?)\\[${e}\\]${eje}`,t);R8(`y`),R8(`g`),z8(I8,`y`),z8(L8,`y`),z8(I8,`g`),z8(L8,`g`);const tje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(tje,`y`),QX(`file-watcher`),QX(`conflict-authority`),QX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),t8(()=>{}),QX(`bridge-watchdog`),t8(()=>{}),QX(`server-observers`),QX(`server-observers`),QX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)nje(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function nje(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const B8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(B8));const rje=Object.keys(B8),ije={discovery:`user`,project:`project`,"write-skill":`user`},V8=rje.filter(e=>ije[e]===`user`);new Set(V8.map(e=>B8[e]));const H8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function U8(e){return new URL(e).pathname.endsWith(`.ts`)}function aje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(j(`/Applications`,H8,e)),(!s||n.home!==void 0)&&o.push(j(a,`Applications`,H8,e))),U8(t)?(o.push(fe(new URL(`../assets/skills/${e}`,t))),o):(o.push(fe(new URL(`../dist/assets/skills/${e}`,t))),o.push(fe(new URL(`../assets/skills/${e}`,t))),o.push(fe(new URL(`./assets/skills/${e}`,t))),o)}function oje(e,t,n){let r=U8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function W8(e,t={}){let n=aje(e,import.meta.url,t);for(let e of n)if(g(e))return e;throw Error(oje(e,import.meta.url,n))}function sje(){try{let e=k(fe(import.meta.url)),t=N(e,`..`,`package.json`),n=JSON.parse(S(t,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}sje();function cje(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
1114
1114
  `),process.exit(2));let s=new Set(n),c={roots:[{uri:t.pathToFileURL(i).href,name:`chat files`}]},l=e.spawn(a,o,{cwd:r,stdio:[`pipe`,`pipe`,`inherit`],windowsHide:!0}),u=l.stdin,d=l.stdout;(u===null||d===null)&&(process.stderr.write(`ok-browser relay: the browser server has no pipes
1115
1115
  `),process.exit(1));let f=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,p=e=>{u.write(`${JSON.stringify(e)}\n`)},m=e=>{process.stdout.write(`${JSON.stringify(e)}\n`)},h=(e,t)=>{process.stderr.write(`ok-browser relay: dropped a ${e} line that ${t}\n`)},g=(e,t,n)=>{if(e.trim()===``)return null;let r;try{r=JSON.parse(e)}catch{return h(t,`is not JSON`),null}let i=f(r);if(i!==null)return i;if(Array.isArray(r))for(let e of r){let t=f(e);t?.method!==void 0&&t.id!==void 0&&n({jsonrpc:`2.0`,id:t.id,error:{code:-32600,message:`Batched messages are not supported`}})}return h(t,`is not a single JSON-RPC message`),null},_=e=>{let t=g(e,`client`,m);if(t===null||t.method===`notifications/roots/list_changed`)return null;let n=f(t.params),r=n?.name;return t.method===`tools/call`&&(typeof r!=`string`||!s.has(r))?(t.id!==void 0&&m({jsonrpc:`2.0`,id:t.id,error:{code:-32602,message:`Tool ${String(r)} is not available`}}),null):(t.method===`initialize`&&n!==null&&(n.capabilities={...f(n.capabilities),roots:{listChanged:!1}}),JSON.stringify(t))},v=e=>{let t=g(e,`server`,p);if(t===null)return null;if(t.method===`roots/list`)return t.id!==void 0&&p({jsonrpc:`2.0`,id:t.id,result:c}),null;let n=f(t.result),r=n?.tools;if(n===null||!Array.isArray(r))return e;let i=r.filter(e=>{let t=f(e)?.name;return typeof t==`string`&&s.has(t)});for(let e of i){let t=f(f(e)?.annotations);t!==null&&(t.readOnlyHint=!1)}return n.tools=i,JSON.stringify(t)},y=(e,t,n,r)=>{let i=``,a=e=>{let r=n(e);r!==null&&t.write(`${r}\n`)};e.setEncoding(`utf8`),e.on(`data`,e=>{i+=String(e);let t=i.indexOf(`
1116
1116
  `);for(;t!==-1;)a(i.slice(0,t)),i=i.slice(t+1),t=i.indexOf(`
1117
- `)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}const G8=V({name:I(),version:I().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});$i([B(G8),H(I(),G8).transform(e=>Object.values(e))]).pipe(ire([G8])),`${uje.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const dje=String.raw`(?![\p{L}\p{M}\p{N}_])`;RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})${dje}(?:[\\s,:;!.\\-–—]+|$)`,`iu`),Fe(x),QX(`agent-registry-apply`),QX(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),Od.cursor,Od.codex,Od[`claude-desktop`],t8(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),QX(`external-change-attribution`),QX(`mermaid-validator`),QX(`rename-log`),QX(`history`);function K8(e){return St.filter(t=>g(j(e,t.hostDir)))}function q8(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}q8(_t,bS),[...q8(vt,bS)].sort((e,t)=>{let n=b4.indexOf(e.editor),r=b4.indexOf(t.editor);return(n===-1?b4.length:n)-(r===-1?b4.length:r)||e.editor.localeCompare(t.editor)}),QX(`installed-skills-marker`),QX(`skill-import`),QX(`backlinks`),QX(`local-target-inventory`),QX(`tag-index`),EP(),QX(`derived-document-index`);const J8={start:L().int().nonnegative().optional(),end:L().int().nonnegative().optional(),quote:I().min(1).optional(),prefix:I().max(1e3).optional(),suffix:I().max(1e3).optional()};V({docName:I().min(1),...J8,propertyKey:I().min(1).optional(),propertyPath:B($i([I(),L().int().nonnegative()])).optional(),body:I(),queue:R().optional(),summary:I().optional()});const Y8=Hi();ea(`action`,[V({action:W(`edit`),id:Y8,body:I(),summary:I().optional()}),V({action:W(`resolve`),id:Y8,summary:I().optional()}),V({action:W(`reopen`),id:Y8,summary:I().optional()}),V({action:W(`replace`),id:Y8,...J8,summary:I().optional()}),V({action:W(`queue`),id:Y8,summary:I().optional()}),V({action:W(`unqueue`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-prepare`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-complete`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-prepare-batch`),ids:B(Y8).min(1).max(200),summary:I().optional()}),V({action:W(`dispatch-complete-batch`),ids:B(Y8).min(1).max(200),summary:I().optional()})]),QX(`embeddings`),QX(`embeddings`);function fje(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}fje(Nl),QX(`embeddings`),QX(`embeddings`);const pje=/^[A-Za-z0-9-]{8,64}$/;let X8=null;function mje(e){return j(e??_e(),`.ok`,`machine-id`)}function hje(e){if(e===void 0&&X8!==null)return X8;let t=mje(e),n=null;try{let e=S(t,`utf-8`).trim();pje.test(e)&&(n=e)}catch{}if(n===null){n=Ee();try{v(k(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){QX(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(X8=n),n}QX(`process-lock`);function gje(e,t){return N(e,`${t}.lock`)}function _je(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function vje(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=_je(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}QX(`asset-references`),QX(`file-ops`),QX(`upload-streaming`);const Z8=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,Q8=`Canonical ids: ${Fye().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;I().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),I().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),I().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),I().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),I().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const yje=V({value:I(),truncatedFrom:L().optional(),hint:I().optional()}).describe(`Normalized change-note summary, when one was recorded.`),bje=B(H(I(),z()));H(I(),z()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),B(Qd).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings, or `warnings` carries `link-check-deferred`, in which case the links were not checked because the server is still starting or busy with other writes. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" | "excluded" }`. `excluded` means the file exists on disk but a .gitignore or .okignore rule keeps it out of the project; a `!` rule in .okignore re-includes it or its folder. Report-only — the write landed regardless; fix in a follow-up edit.'),ef.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),yje.optional(),B(Xd).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit. `link-check-deferred` means links were not checked because the server is still starting or busy with other writes — that doc is re-checked only by a later write or edit of it, or an `audit`, which can time out until startup finishes."),B(V({name:I(),description:I().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const xje=I().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function $8(e){return{text:xje,...e}}function Sje(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}Sje(`the server`);function Cje(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}Cje(`the server`),QX(`git-checkout`),QX(`git-worktree-status`),QX(`managed-artifact-persistence`),QX(`timeline`),QX(`suggest-links`),new Intl.Segmenter(`und`,{granularity:`word`}),QX(`git-context`),QX(`clone-flow`),Fe(o),B8.project,Object.fromEntries(Object.entries(xS).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
1118
- `),QX(`skills-leaderboard`),QX(`handoff-dispatch`),V({target:U(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:I().min(1).max(4096),workspacePath:I().optional()}),V({}).loose(),QX(`github-permissions`),QX(`github-reference`),QX(`github-reference`),QX(`link-preview.guarded-fetch`),QX(`link-preview.cache`),QX(`saved-themes`),V({enabled:R(),active:R(),git:V({state:U([`not-applicable`,`ready`,`missing`,`conflict`,`unavailable`]),ownership:U([`open-knowledge`,`existing`]).optional()}),applied:R().optional(),reason:U([`git-conflict`,`git-unavailable`,`config-write`]).optional()}),V({enabled:R()}).strict(),QX(`managed-rename`),Object.assign(mOe,{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),QX(`search`),QX(`skill-install`),QX(`write-advisory`),QX(`api`),V({principalId:I().optional(),tabSessionId:I().optional(),expectedServerInstanceId:I().optional(),expectedBranch:I().optional(),expectedDocLineageEpoch:I().optional(),clientProtocolVersion:L().optional(),clientRuntimeVersion:I().optional(),clientKind:I().optional()}).loose(),new He,t8(()=>{}),[...Aae],["Read-only validation of markdownlint, frontmatter, OKF and broken internal links. Requires the Hocuspocus server. No args scans all in-scope .md/.mdx; `path` narrows to file/folder. `links` is the navigation/graph tool.","ran names selected `markdownlint`, `frontmatter`, `okf`, `links`. A family absent from `ran` was not checked. A selected family remains in ran if degraded; warnings explain why and it may still have contributed findings. okf covers document and project-tree OKF checks here.",`Broken links are reported under the source doc. Default-on validation.suppressLogLinkAdvisories omits links inside lowercase log.md/log.mdx at any depth; LOG.md is ordinary. brokenLinkSuppression reports reason reserved-log-policy and count without paths/hrefs. Logs are append-only history: never rewrite old entries to clear links. links({kind:'dead'}) reads raw state.`,`Diagnostics carry source, code, message, 0-based LSP range (link columns approximate) and severity. Broken links default to warning; validation.links can raise/hide them. Only problematic files are listed; fileCount/errorCount/warningCount reflect full scan. Output is capped at 10 files × 10 diagnostics each and project-wide at 10 warnings; omittedWarningCount reports dropped warnings. Narrow path reduces competing files; per-file caps still apply. Follow runtime hints for document lint and raw dead links; project-tree OKF findings remain capped.`,`Nothing is modified. Auto-fix document lint with lint({document,fix:true}); fix broken links with edit/write.`].join(`
1117
+ `)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}const G8=V({name:I(),version:I().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});$i([B(G8),H(I(),G8).transform(e=>Object.values(e))]).pipe(ire([G8])),`${cje.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const lje=String.raw`(?![\p{L}\p{M}\p{N}_])`;RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})${lje}(?:[\\s,:;!.\\-–—]+|$)`,`iu`),Fe(x),QX(`agent-registry-apply`),QX(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),Od.cursor,Od.codex,Od[`claude-desktop`],t8(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),QX(`external-change-attribution`),QX(`mermaid-validator`),QX(`rename-log`),QX(`history`);function K8(e){return St.filter(t=>g(j(e,t.hostDir)))}function q8(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}q8(_t,bS),[...q8(vt,bS)].sort((e,t)=>{let n=b4.indexOf(e.editor),r=b4.indexOf(t.editor);return(n===-1?b4.length:n)-(r===-1?b4.length:r)||e.editor.localeCompare(t.editor)}),QX(`installed-skills-marker`),QX(`skill-import`),QX(`backlinks`),QX(`local-target-inventory`),QX(`tag-index`),EP(),QX(`derived-document-index`);const J8={start:L().int().nonnegative().optional(),end:L().int().nonnegative().optional(),quote:I().min(1).optional(),prefix:I().max(1e3).optional(),suffix:I().max(1e3).optional()};V({docName:I().min(1),...J8,propertyKey:I().min(1).optional(),propertyPath:B($i([I(),L().int().nonnegative()])).optional(),body:I(),queue:R().optional(),summary:I().optional()});const Y8=Hi();ea(`action`,[V({action:W(`edit`),id:Y8,body:I(),summary:I().optional()}),V({action:W(`resolve`),id:Y8,summary:I().optional()}),V({action:W(`reopen`),id:Y8,summary:I().optional()}),V({action:W(`replace`),id:Y8,...J8,summary:I().optional()}),V({action:W(`queue`),id:Y8,summary:I().optional()}),V({action:W(`unqueue`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-prepare`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-complete`),id:Y8,summary:I().optional()}),V({action:W(`dispatch-prepare-batch`),ids:B(Y8).min(1).max(200),summary:I().optional()}),V({action:W(`dispatch-complete-batch`),ids:B(Y8).min(1).max(200),summary:I().optional()})]),QX(`embeddings`),QX(`embeddings`);function uje(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}uje(Nl),QX(`embeddings`),QX(`embeddings`);const dje=/^[A-Za-z0-9-]{8,64}$/;let X8=null;function fje(e){return j(e??_e(),`.ok`,`machine-id`)}function pje(e){if(e===void 0&&X8!==null)return X8;let t=fje(e),n=null;try{let e=S(t,`utf-8`).trim();dje.test(e)&&(n=e)}catch{}if(n===null){n=Ee();try{v(k(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){QX(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(X8=n),n}QX(`process-lock`);function mje(e,t){return N(e,`${t}.lock`)}function hje(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function gje(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=hje(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}QX(`asset-references`),QX(`file-ops`),QX(`upload-streaming`);const Z8=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,Q8=`Canonical ids: ${Fye().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;I().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),I().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),I().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),I().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),I().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const _je=V({value:I(),truncatedFrom:L().optional(),hint:I().optional()}).describe(`Normalized change-note summary, when one was recorded.`),vje=B(H(I(),z()));H(I(),z()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),B(Qd).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings, or `warnings` carries `link-check-deferred`, in which case the links were not checked because the server is still starting or busy with other writes. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" | "excluded" }`. `excluded` means the file exists on disk but a .gitignore or .okignore rule keeps it out of the project; a `!` rule in .okignore re-includes it or its folder. Report-only — the write landed regardless; fix in a follow-up edit.'),ef.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),_je.optional(),B(Xd).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit. `link-check-deferred` means links were not checked because the server is still starting or busy with other writes — that doc is re-checked only by a later write or edit of it, or an `audit`, which can time out until startup finishes."),B(V({name:I(),description:I().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const yje=I().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function $8(e){return{text:yje,...e}}function bje(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}bje(`the server`);function xje(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}xje(`the server`),QX(`git-checkout`),QX(`git-worktree-status`),QX(`managed-artifact-persistence`),QX(`timeline`),QX(`suggest-links`),new Intl.Segmenter(`und`,{granularity:`word`}),QX(`git-context`),QX(`clone-flow`),Fe(o),B8.project,Object.fromEntries(Object.entries(xS).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
1118
+ `),QX(`skills-leaderboard`),QX(`handoff-dispatch`),V({target:U(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:I().min(1).max(4096),workspacePath:I().optional()}),V({}).loose(),QX(`github-permissions`),QX(`github-reference`),QX(`github-reference`),QX(`link-preview.guarded-fetch`),QX(`link-preview.cache`),QX(`saved-themes`),V({enabled:R(),active:R(),git:V({state:U([`not-applicable`,`ready`,`missing`,`conflict`,`unavailable`]),ownership:U([`open-knowledge`,`existing`]).optional()}),applied:R().optional(),reason:U([`git-conflict`,`git-unavailable`,`config-write`]).optional()}),V({enabled:R()}).strict(),QX(`managed-rename`),Object.assign(fOe,{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),QX(`search`),QX(`skill-install`),QX(`write-advisory`),QX(`api`),V({principalId:I().optional(),tabSessionId:I().optional(),expectedServerInstanceId:I().optional(),expectedBranch:I().optional(),expectedDocLineageEpoch:I().optional(),clientProtocolVersion:L().optional(),clientRuntimeVersion:I().optional(),clientKind:I().optional()}).loose(),new He,t8(()=>{}),[...Aae],["Read-only validation of markdownlint, frontmatter, OKF and broken internal links. Requires the Hocuspocus server. No args scans all in-scope .md/.mdx; `path` narrows to file/folder. `links` is the navigation/graph tool.","ran names selected `markdownlint`, `frontmatter`, `okf`, `links`. A family absent from `ran` was not checked. A selected family remains in ran if degraded; warnings explain why and it may still have contributed findings. okf covers document and project-tree OKF checks here.",`Broken links are reported under the source doc. Default-on validation.suppressLogLinkAdvisories omits links inside lowercase log.md/log.mdx at any depth; LOG.md is ordinary. brokenLinkSuppression reports reason reserved-log-policy and count without paths/hrefs. Logs are append-only history: never rewrite old entries to clear links. links({kind:'dead'}) reads raw state.`,`Diagnostics carry source, code, message, 0-based LSP range (link columns approximate) and severity. Broken links default to warning; validation.links can raise/hide them. Only problematic files are listed; fileCount/errorCount/warningCount reflect full scan. Output is capped at 10 files × 10 diagnostics each and project-wide at 10 warnings; omittedWarningCount reports dropped warnings. Narrow path reduces competing files; per-file caps still apply. Follow runtime hints for document lint and raw dead links; project-tree OKF findings remain capped.`,`Nothing is modified. Auto-fix document lint with lint({document,fix:true}); fix broken links with edit/write.`].join(`
1119
1119
  `),[`Save a project-wide checkpoint of every document. Requires the Hocuspocus server. Optional summary ≤80 chars defaults to "Checkpoint version"; avoid secrets or PII because it persists in git history. Returns version (40-char SHA). Find it with history and restore one doc with restore_version({document,version}).`].join(`
1120
1120
  `),[`Read effective config merged defaults → user → project; no running OK server needed. Optional key is a dotted path (content, appearance.theme); omit for the full config. All fields are readable. Re-read after disk changes or before relying on an old value.`,"Removed server.*, mcp.*, github.*, preview.baseUrl and preview.scriptSrc return exists:false; appearance.preview.autoOpen remains live. This is a pure read. Use `install` skillFolders for folder topology."].join(`
1121
- `),I().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),I().optional().describe(Z8),$8({value:z().describe(`Resolved config value at the requested path (or full config).`),exists:R().optional().describe('Whether the requested path resolved to a value. `false` distinguishes "path absent" from "path explicitly set to null". Always emitted — `true` on a full-config read.'),key:I().optional().describe(`Echo of the requested dotted key (absent when reading the full config).`)});const wje=[`lock`],Tje=$i([oo,qi()]),Eje=$i([I(),L(),R(),B(z()),H(I(),z()),qi()]);H(I(),Eje).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))Tje.safeParse(r).success||t.addIssue({code:`custom`,path:[n],message:`invalid frontmatter value — allowed: a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects; a top-level key may be null to delete it, but nested null is not allowed`})}).describe(`Metadata as a key→value map. Values may be a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects. Merge-patch: include a top-level key to set it, set a top-level key to null to delete it; keys you omit are unchanged. A nested object REPLACES the existing subtree at that key (send the full subtree you want). Example: { title: "Q3 Planning", tags: ["planning"], metadata: { version: "1.0", author: "Inkeep" } }.`),U([`append`,`prepend`,`replace`]).describe(`Where content lands. replace = overwrite the whole body (default for a new doc; required for an existing doc). append / prepend = add to the end / start.`),U(Dd).describe("File format for a NEW doc: `.md` (default) or `.mdx` (Markdown + JSX components). Honored only on create — an existing doc keeps its on-disk extension. Takes precedence over an extension typed into `path`."),U(Ed).describe(`Level: "project" (default — a Project skill: lives in this KB wherever its folder is, shared with teammates via git) or "global" (a Global skill: lives under your user home, available in every project on this machine — not shared, not version-tracked). Pass the literal value "global" for a Global skill.`),new Set(uJ),[`Delete exactly one document, folder, template, skill or asset. Requires the Hocuspocus server. Irreversible; deleting a doc leaves inbound redlinks. Call links({kind:'backlinks',document}) BEFORE deleting.`,`document: path or paths array; folder: recursive folder path; template: {path:'<folder>/<name>'}; asset: {path:'<folder>/<file.ext>'}. skill: {name} deletes the whole bundle, or {name,files:['references/x.md']} deletes selected files. Template/skill deletion is attributed and cleans empty .ok/ directories.`].join(`
1121
+ `),I().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),I().optional().describe(Z8),$8({value:z().describe(`Resolved config value at the requested path (or full config).`),exists:R().optional().describe('Whether the requested path resolved to a value. `false` distinguishes "path absent" from "path explicitly set to null". Always emitted — `true` on a full-config read.'),key:I().optional().describe(`Echo of the requested dotted key (absent when reading the full config).`)});const Sje=[`lock`],Cje=$i([oo,qi()]),wje=$i([I(),L(),R(),B(z()),H(I(),z()),qi()]);H(I(),wje).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))Cje.safeParse(r).success||t.addIssue({code:`custom`,path:[n],message:`invalid frontmatter value — allowed: a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects; a top-level key may be null to delete it, but nested null is not allowed`})}).describe(`Metadata as a key→value map. Values may be a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects. Merge-patch: include a top-level key to set it, set a top-level key to null to delete it; keys you omit are unchanged. A nested object REPLACES the existing subtree at that key (send the full subtree you want). Example: { title: "Q3 Planning", tags: ["planning"], metadata: { version: "1.0", author: "Inkeep" } }.`),U([`append`,`prepend`,`replace`]).describe(`Where content lands. replace = overwrite the whole body (default for a new doc; required for an existing doc). append / prepend = add to the end / start.`),U(Dd).describe("File format for a NEW doc: `.md` (default) or `.mdx` (Markdown + JSX components). Honored only on create — an existing doc keeps its on-disk extension. Takes precedence over an extension typed into `path`."),U(Ed).describe(`Level: "project" (default — a Project skill: lives in this KB wherever its folder is, shared with teammates via git) or "global" (a Global skill: lives under your user home, available in every project on this machine — not shared, not version-tracked). Pass the literal value "global" for a Global skill.`),new Set(uJ),[`Delete exactly one document, folder, template, skill or asset. Requires the Hocuspocus server. Irreversible; deleting a doc leaves inbound redlinks. Call links({kind:'backlinks',document}) BEFORE deleting.`,`document: path or paths array; folder: recursive folder path; template: {path:'<folder>/<name>'}; asset: {path:'<folder>/<file.ext>'}. skill: {name} deletes the whole bundle, or {name,files:['references/x.md']} deletes selected files. Template/skill deletion is attributed and cleans empty .ok/ directories.`].join(`
1122
1122
  `),["Edit exactly one `document`, `folder`, `template`, or `skill`: body find/replace OR metadata, never both in one call. Requires the Hocuspocus server.","`document: {path, find, replace, occurrence?}` edits body only; frontmatter-intersecting finds are rejected. occurrence selects a match (1 = first). `{path, frontmatter}` merge-patches metadata; null deletes a key.","`folder: {path, frontmatter}` patches metadata (no body). `template: {path: '<folder>/<name>', ...}` takes body find/replace/occurrence or frontmatter.","`skill: {name, ...}` takes body find/replace/occurrence OR description (its only metadata leaf). Recorded, unedited copies refresh from the source on watcher/startup sync; links reflect edits immediately. Hand-edited copies are preserved.",`Optional summary: one-line outcome ≤80 chars for any edit, persisted to git history; avoid secrets or PII.`,`Read structuredContent.document.warnings: content-divergence/disk-edit-reconciled means re-read with exec; mermaid-parse-error means the edit landed but fix the fence and re-edit.`,Q8].join(`
1123
- `);const Dje=[`node_modules`,`.git`,`dist`,`build`,`.next`,`.turbo`,`.nuxt`,`coverage`,`.cache`,`.parcel-cache`,`.vercel`,`.ok`,`.claude`];[...new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-lname`,`-ilname`])],new Set(Dje),QX(`mcp:exec`),["STOP: with `.ok/`, use exec for in-scope .md/.mdx; native Read/Grep/Glob omit wiki context. Native tools are for source code, non-markdown or projects without .ok/. See the open-knowledge skill for the full rule and escape hatch.",`Read-only bash-like command; returns stdout and enrichedPaths with frontmatter, backlinks/forward links, unresolved comments, shadow-repo activity and git history with human/agent attribution. Unresolved comments are open human review requests: consider before editing and report them.`,`Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or pipe per call. No &&, ;, subshells, writes or redirection (including <). Use multiple paths or separate calls.`,`cwd: command paths resolve inside explicit absolute cwd, or the client's sole advertised root. With zero/multiple roots pass cwd; traversal above it is rejected.`,`Stdout provenance: ls <dir>/ labels the directory; single-file cat/head/tail labels its path. Multi-file cat has no header; enrichedPaths still lists files. Piped head/tail preserve upstream provenance.`,`Examples: exec({command:'cat notes/a.md'}); exec({command:'grep -rn oauth notes/ | head -5'}); exec({command:'ls',cwd:'/abs/project'}).`].join(`
1123
+ `);const Tje=[`node_modules`,`.git`,`dist`,`build`,`.next`,`.turbo`,`.nuxt`,`coverage`,`.cache`,`.parcel-cache`,`.vercel`,`.ok`,`.claude`];[...new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-lname`,`-ilname`])],new Set(Tje),QX(`mcp:exec`),["STOP: with `.ok/`, use exec for in-scope .md/.mdx; native Read/Grep/Glob omit wiki context. Native tools are for source code, non-markdown or projects without .ok/. See the open-knowledge skill for the full rule and escape hatch.",`Read-only bash-like command; returns stdout and enrichedPaths with frontmatter, backlinks/forward links, unresolved comments, shadow-repo activity and git history with human/agent attribution. Unresolved comments are open human review requests: consider before editing and report them.`,`Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or pipe per call. No &&, ;, subshells, writes or redirection (including <). Use multiple paths or separate calls.`,`cwd: command paths resolve inside explicit absolute cwd, or the client's sole advertised root. With zero/multiple roots pass cwd; traversal above it is rejected.`,`Stdout provenance: ls <dir>/ labels the directory; single-file cat/head/tail labels its path. Multi-file cat has no header; enrichedPaths still lists files. Piped head/tail preserve upstream provenance.`,`Examples: exec({command:'cat notes/a.md'}); exec({command:'grep -rn oauth notes/ | head -5'}); exec({command:'ls',cwd:'/abs/project'}).`].join(`
1124
1124
  `),[`Get the full browser URL for this project or a document/folder/skill, or an absolute markdown file outside the project. Opening is demand: auto-starts OK under the normal OK_MCP_AUTOSTART gate and waits briefly for UI; cold calls can take seconds. Other tools return route-only previewUrl paths; use this tool for an openable URL, never guess ports or hunt via the OpenKnowledge CLI's ps/status.`,`Choose one: document (extension-less), folder (trailing-slash route), skill:{name,scope?} (project default), or file (absolute .md/.mdx in a loose-file/worktree session). file ignores cwd; other targets use current project. Omit targets for UI root.`,`When YOUR host opens URLs, navigate its embedded browser to url; Claude Code Desktop uses preview_start({url}) then navigate({url}). Only a stdio host without a browser tool should open the URL in the system browser. A CLI without a browser can use the OpenKnowledge CLI's open <doc> for OK Desktop. This tool forces browser access even when Desktop is installed.`,`INSIDE OK's terminal/agent panel, use returned okOpenCommand instead; never paste url in the answer. If no UI is reachable, returns url:null, baseUrl:null, running:false, autoOpen plus state-specific recovery text (autostart disabled, no spawn authority or UI timeout). Follow it.`].join(`
1125
- `),I().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),I().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),V({name:I().min(1).regex(eye,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:U(Ed).optional().describe("Skill scope; defaults to `project`.")}).optional().describe("Skill to resolve an editor preview URL for; returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`."),I().optional().describe("Absolute path to a single markdown file to open, including one OUTSIDE any Open Knowledge project. Resolves to the running single-file (or worktree) session whose content directory contains it and returns that session’s `url`. Mutually exclusive with `document` / `folder` / `skill`. When `file` is set, `cwd` is ignored."),I().optional().describe(Z8),$8({url:I().nullable().describe("Browser-reachable URL — the UI base joined with the doc route when `document` is given, else the UI root. `null` when no UI is running."),baseUrl:I().nullable().describe("Browser-reachable origin of the running UI (e.g. `http://localhost:5173`). `null` when no UI is running."),running:R().describe(`Whether a UI is running for the project.`),autoOpen:R().describe("User-scoped preview-auto-open preference (`appearance.preview.autoOpen`). When `true`, the agent should route the preview using capability-based routing (in-app browser if available, system browser as fallback). When `false`, the user is managing their own preview view (OK Desktop window, a browser tab they opened, etc.) — the agent must NOT open or refresh any preview UI, and should surface this URL only on direct user ask. Resolved fresh on every call; defaults to `true`."),okOpenCommand:I().nullable().optional().describe("Machine-readable form of the hosted-agent steer: when the calling agent runs inside an OpenKnowledge surface (the desktop app’s built-in terminal, or its in-app agent panel) AND a doc/folder/skill target was given, the exact OpenKnowledge CLI `open` command to run to bring it up for the user. Run it INSTEAD of navigating `url`, and do not paste `url` into your reply — the user is already in the app it points at. `null`/absent in every other context (navigate `url` per your host instead).")}),V({version:I().describe("40-char commit SHA for this entry — pass to `restore_version({ document, version })`."),timestamp:I().describe(`ISO timestamp of the entry.`),author:I().describe(`Author display name.`),authorEmail:I().describe(`Author email.`),kind:U([`checkpoint`,`wip`,`upstream`]).describe(`Entry kind: checkpoint / wip / upstream.`),message:I().describe(`Commit subject (the checkpoint summary, when one was set).`),contributors:bje.describe(`Per-contributor records parsed from the commit (writer id, name, docs, summaries).`),checkpoint:z().nullable().describe(`Checkpoint metadata when this entry is a checkpoint, else null.`)}),[`Read version history: pass exactly one document, folder or skill. Requires the Hocuspocus server. Returns shadow-repo entries newest first; version is a 40-char SHA for restore_version({document,version}) or restore_version({skill,version}).`,`document accepts optional .md/.mdx. folder lists attributed template/frontmatter activity; empty string is project root. skill is a project-scope name; global skills are unversioned. Optional branch (current default), limit (50 default, 200 max), offset (0), kind (checkpoint/upstream/wip), author and excludeAuthor (name/email).`].join(`
1125
+ `),I().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),I().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),V({name:I().min(1).regex(eye,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:U(Ed).optional().describe("Skill scope; defaults to `project`.")}).optional().describe("Skill to resolve an editor preview URL for; returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`."),I().optional().describe("Absolute path to a single markdown file to open, including one OUTSIDE any Open Knowledge project. Resolves to the running single-file (or worktree) session whose content directory contains it and returns that session’s `url`. Mutually exclusive with `document` / `folder` / `skill`. When `file` is set, `cwd` is ignored."),I().optional().describe(Z8),$8({url:I().nullable().describe("Browser-reachable URL — the UI base joined with the doc route when `document` is given, else the UI root. `null` when no UI is running."),baseUrl:I().nullable().describe("Browser-reachable origin of the running UI (e.g. `http://localhost:5173`). `null` when no UI is running."),running:R().describe(`Whether a UI is running for the project.`),autoOpen:R().describe("User-scoped preview-auto-open preference (`appearance.preview.autoOpen`). When `true`, the agent should route the preview using capability-based routing (in-app browser if available, system browser as fallback). When `false`, the user is managing their own preview view (OK Desktop window, a browser tab they opened, etc.) — the agent must NOT open or refresh any preview UI, and should surface this URL only on direct user ask. Resolved fresh on every call; defaults to `true`."),okOpenCommand:I().nullable().optional().describe("Machine-readable form of the hosted-agent steer: when the calling agent runs inside an OpenKnowledge surface (the desktop app’s built-in terminal, or its in-app agent panel) AND a doc/folder/skill target was given, the exact OpenKnowledge CLI `open` command to run to bring it up for the user. Run it INSTEAD of navigating `url`, and do not paste `url` into your reply — the user is already in the app it points at. `null`/absent in every other context (navigate `url` per your host instead).")}),V({version:I().describe("40-char commit SHA for this entry — pass to `restore_version({ document, version })`."),timestamp:I().describe(`ISO timestamp of the entry.`),author:I().describe(`Author display name.`),authorEmail:I().describe(`Author email.`),kind:U([`checkpoint`,`wip`,`upstream`]).describe(`Entry kind: checkpoint / wip / upstream.`),message:I().describe(`Commit subject (the checkpoint summary, when one was set).`),contributors:vje.describe(`Per-contributor records parsed from the commit (writer id, name, docs, summaries).`),checkpoint:z().nullable().describe(`Checkpoint metadata when this entry is a checkpoint, else null.`)}),[`Read version history: pass exactly one document, folder or skill. Requires the Hocuspocus server. Returns shadow-repo entries newest first; version is a 40-char SHA for restore_version({document,version}) or restore_version({skill,version}).`,`document accepts optional .md/.mdx. folder lists attributed template/frontmatter activity; empty string is project root. skill is a project-scope name; global skills are unversioned. Optional branch (current default), limit (50 default, 200 max), offset (0), kind (checkpoint/upstream/wip), author and excludeAuthor (name/email).`].join(`
1126
1126
  `),[...uJ,..._J],[`Import an external agentskills.io/skills.sh skill as managed content. Requires the Hocuspocus server. source accepts a full skills.sh page URL (including website catalogs), owner/repo[/subpath], git URL, or local/file:// path. skill picks one from a multi-skill source. scope: project (default, versioned/shared) or global (user-wide, unversioned).`,`Writes the .agents/skills/<name>/ hub with provenance in .ok/skills-lock.json. Scripts are NEVER executed. add selects editor locations; import always places the skill somewhere. Use install later to change placement/form/source. Name collisions use <name>-imported, never overwrite; identical content-hash re-import is a no-op.`].join(`
1127
1127
  `),new Set(_J),["Manage where a SKILL is available: `{name, add?, remove?, convert?, mode?, source?, scope?}` or `{skillFolders: {...}}` alone. Requires the Hocuspocus server. One real source folder plus managed copies/symlinks; the source still loads with no extra locations. Use delete to remove the skill everywhere.",`name is the bundle identity: lowercase letters/digits/hyphens, ≤64 chars. Locations: claude/cursor/codex/copilot/opencode/pi, agents (.agents/skills), or custom root containing '/' such as .team/skills. Custom roots are project-relative, home-relative at global scope. scope: project (default, shared via git) or global (user-wide).`,`add/remove change membership; omitting both installs to configured editors. remove cannot remove the source; folder aliases unfollow minus this skill and keep others. Differing copies are preserved; editor removal may succeed and leave them in place.`,`mode: link = live symlink for source updates (copy where the OS refuses symlinks); copy = separate folder, refreshed on watcher/startup sync while unedited. Hand-edited copies fork; differing copies are preserved and cannot be converted. Requires add or convert; affects named locations only, no skill-wide default. Omit mode on add to inherit form. convert requires mode and changes form without membership; name all locations for uniformity.`,`source moves the real folder; its old location becomes a symlink. Run alone, not with add/remove. Source SKILL.md with conflict markers, invalid/missing frontmatter, XML in name/description or reserved open-knowledge* names is refused before projection.`,`skillFolders runs alone without name. link: {action:'link', scope, root, target}; target required, merge then symlink root; equal entries deduplicate, differing skills abort, interrupted merges can rerun. unlink: {action:'unlink', scope, root, exclude?}; makes a real directory of per-skill symlinks, excluding named skills and retaining others. add-root: {action:'add-root', scope, root}; declares a custom root for install/link.`].join(`
1128
1128
  `),[`Read the wiki-link graph. Requires the Hocuspocus server. kind is one value or an array; results merge, failures go in errors. Use audit for validation.`,"`backlinks`/`forward`/`suggest` require document. suggest finds unlinked prose mentions; excerpt is normalized context, NOT edit-ready text. Re-read with exec, locate the real text using offset, then edit into a wiki-link.","`dead` lists raw unresolved internal targets; sourceDocuments optionally filters with OR semantics. Includes skill docs and lowercase log.md/log.mdx: inspect deliberately, never use as a repair queue or rewrite existing log entries to clear findings.","`orphans` finds disconnected pages; mode incoming/outgoing/both. `hubs` lists most-linked pages; limit defaults 20."].join(`
@@ -1131,10 +1131,10 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
1131
1131
  `),[`Read the authoring palette: markdown-native components/examples/guidance, themed html preview embedPatterns (charts, stat cards, SVG, interactive controls), and CSS tokens. No running OK server needed. Optional components:[ids] adds full JSX props in componentDetails plus notFound; ids are case-sensitive, max 32. cwd selects project.`,`Prefer native forms: > [!NOTE], <details>, mermaid fences, $math$. For interactive HTML/JS/CSS use html preview starters and var(--chart-1)/var(--foreground) tokens for light/dark themes. Inside SVG use style="fill: var(--chart-1)", not a fill presentation attribute.`,`Delimiters are live even in ordinary prose: ==highlight==, $inline math$/$$block math$$, %%comment%% and <!-- comment --> (HIDES text), ~~strikethrough~~. Keep literal pairs in an inline code span or backslash-escape either delimiter. For ~~ escape BOTH tildes on both sides; one-sided escaping is rewritten on save.`,`Preview iframes have open network access for external HTTPS resources/fetch/fonts/maps. They are sandboxed null-origin frames and cannot access the knowledge base, cookies or auth.`].join(`
1132
1132
  `),B(I().min(1)).max(32).optional().describe("Canonical ids to expand to full JSX-form detail (max 32, case-sensitive). Returns `componentDetails` + `notFound`."),I().optional().describe(Z8),$8({version:W(1).describe(`Schema version stamp — bump for breaking shape changes.`),components:B(V({id:I(),displayName:I(),description:I(),authoring:U([`markdown`,`jsx`]).describe("`markdown` — write the markdown-native form OK auto-promotes; `jsx` — write the JSX tag directly (no markdown-native form exists)."),example:I().describe(`Copy-ready source for the authoring form.`),guidance:I().describe(`One line on when / how to use this construct.`)})).describe(`Canonical authoring constructs, keyed by the form an agent should write.`),embedPatterns:B(V({id:I(),title:I(),description:I(),snippet:I().describe("A complete, theme-wired ```html preview fenced block.")})).describe("Copy-ready themed `html preview` starters."),tokens:B(V({name:I().describe("CSS custom-property name, e.g. `--chart-1`."),light:I(),dark:I()})).describe("Theme tokens injected into every preview iframe — reference with `var(--name)`."),componentDetails:B(H(I(),z())).optional().describe("Full JSX-form prop schema for the requested `components` ids (when provided)."),notFound:B(I()).optional().describe("Requested `components` ids that did not match any canonical.")}),[`Restore exactly one document or skill to version (40-char SHA from history). Requires the Hocuspocus server. document accepts optional .md/.mdx; restore is append-only through CRDT and visible to connected editors. skill is a PROJECT-scope name (global is unversioned); its folder is rewritten. Recorded, unedited copies refresh on watcher/startup sync; links reflect edits immediately. Hand-edited copies are preserved.`,`Optional summary ≤80 chars; avoid secrets or PII, persisted to git history. content-divergence in structuredContent.warnings means restore landed but bytes differ: re-read with exec to see the converged result.`].join(`
1133
1133
  `),QX(`mcp:search`),[`Ranked search across ALL non-ignored files and folders. Requires the Hocuspocus server. All file name/path values are indexed; only markdown bodies are indexed. Run in parallel with exec grep for exhaustive literal content search, especially code/config/data.`,`Pass query; intent full_text (default) includes bodies, omnibar searches title/path/folders. scopes: page/folder/file/content; defaults follow intent. limit: 20 default, 100 max. Ranking combines title boost, BM25 and recency; hits include signals, and pages include snippets (other files are name-only).`,`When workspace semantic search is enabled, full_text adds embeddings by default; query and matching content go to the configured provider. Set semantic:false for lexical-only/no embedding egress. Response semantic reports coverage.`,`ready:false means an incomplete cold index, not an authoritative empty result. Wait 2–3 seconds before retrying; after 2–3 retries use exec grep. If the server is down, follow recovery text; exec grep is the server-free search fallback.`].join(`
1134
- `),I().describe(`Search query — title, path, or body terms.`),U([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),B(U([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),L().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),R().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),I().optional().describe(Z8);const Oje=V({kind:U([`page`,`folder`,`file`]),path:I(),docName:I(),title:I().nullable(),score:L(),signals:V({lexical:L(),fullText:L(),recency:L(),vector:L().optional()}),snippet:I().optional(),previewUrl:I().nullable(),previewUrlSource:U(wje).optional()});$8({cwd:I(),query:I(),intent:I(),resultCount:L().int(),results:B(Oje),elapsedMs:L().nullable(),semantic:SJ.optional(),ready:W(!1).optional()}),[`Build a shareable GitHub-substrate URL for a teammate to receive a doc/folder subtree in OpenKnowledge, pinned to current branch. Requires the Hocuspocus server. Read-only, no commits/pushes/fetch. Publishing is a user act: agents do NOT publish; a missing remote returns Share-wizard guidance.`,"`path` is content-relative, docs accept .md/.mdx, empty string means root folder. `kind` doc/folder is optional for auto-probe (.mdx → .md → directory); REQUIRED when `path` is empty (use folder). Optional `cwd` selects project. Requires a named branch, GitHub/GH Enterprise origin, and branch already pushed."].join(`
1135
- `),$8({ok:R().describe(`Success discriminator.`),shareUrl:I().optional().describe(`Marketing share URL (success only).`),sharedUrl:I().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:I().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:U([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:Pd.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:U([...Nd.options,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:I().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:I().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:I().optional().describe(`Internal: preview-URL provenance.`)});const e5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",kje=V({id:I().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:I().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:U([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, refreshed from the source on watcher/startup sync while unedited (hand edits fork it); symlink = live link to the source.`),audience:B(I()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:R().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});V({name:I().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:U([`project`,`global`]).describe(e5),description:I().optional().describe(`The skill's one-line description (when present).`),installed:R().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:B(I()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:B(kje).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:U([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:B(I()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const Aje=V({path:I().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:U([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});V({name:I().describe(`Skill name (its identity).`),scope:U([`project`,`global`]).describe(e5),description:I().describe(`The skill's one-line description (empty if none).`),body:I().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:B(Aje).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),V({path:I().describe(`Skill-relative path read.`),kind:U([`reference`,`script`]).describe("`reference` or `script`."),text:I().describe(`Full text of the bundle file.`)}),V({name:I().describe("Skill name to pass as `skill` to `import`."),source:I().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:I().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:L().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:I().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),[`Read-only skill discovery. Requires the Hocuspocus server. query searches the skills.sh marketplace and returns import-ready name/source/description/publisher/install-count rows. Import a chosen row with import({source,skill:name}); external rows are not managed or active editor content until imported/projected.`,`Omit name to list Project and Global managed skills with scope/description/hosts. name reads description/body plus a bundle files list (path/kind, no inline text); name+file reads one reference/script/bundle file. Optional scope; name-only prefers Project. Address skills by name/scope, never raw .ok/ paths or native cat.`,`Built-in open-knowledge* runtime skills are already in your skill list; do not fetch them here. Use write/edit/delete/move/install for changes.`].join(`
1134
+ `),I().describe(`Search query — title, path, or body terms.`),U([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),B(U([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),L().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),R().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),I().optional().describe(Z8);const Eje=V({kind:U([`page`,`folder`,`file`]),path:I(),docName:I(),title:I().nullable(),score:L(),signals:V({lexical:L(),fullText:L(),recency:L(),vector:L().optional()}),snippet:I().optional(),previewUrl:I().nullable(),previewUrlSource:U(Sje).optional()});$8({cwd:I(),query:I(),intent:I(),resultCount:L().int(),results:B(Eje),elapsedMs:L().nullable(),semantic:SJ.optional(),ready:W(!1).optional()}),[`Build a shareable GitHub-substrate URL for a teammate to receive a doc/folder subtree in OpenKnowledge, pinned to current branch. Requires the Hocuspocus server. Read-only, no commits/pushes/fetch. Publishing is a user act: agents do NOT publish; a missing remote returns Share-wizard guidance.`,"`path` is content-relative, docs accept .md/.mdx, empty string means root folder. `kind` doc/folder is optional for auto-probe (.mdx → .md → directory); REQUIRED when `path` is empty (use folder). Optional `cwd` selects project. Requires a named branch, GitHub/GH Enterprise origin, and branch already pushed."].join(`
1135
+ `),$8({ok:R().describe(`Success discriminator.`),shareUrl:I().optional().describe(`Marketing share URL (success only).`),sharedUrl:I().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:I().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:U([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:Pd.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:U([...Nd.options,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:I().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:I().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:I().optional().describe(`Internal: preview-URL provenance.`)});const e5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",Dje=V({id:I().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:I().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:U([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, refreshed from the source on watcher/startup sync while unedited (hand edits fork it); symlink = live link to the source.`),audience:B(I()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:R().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});V({name:I().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:U([`project`,`global`]).describe(e5),description:I().optional().describe(`The skill's one-line description (when present).`),installed:R().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:B(I()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:B(Dje).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:U([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:B(I()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const Oje=V({path:I().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:U([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});V({name:I().describe(`Skill name (its identity).`),scope:U([`project`,`global`]).describe(e5),description:I().describe(`The skill's one-line description (empty if none).`),body:I().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:B(Oje).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),V({path:I().describe(`Skill-relative path read.`),kind:U([`reference`,`script`]).describe("`reference` or `script`."),text:I().describe(`Full text of the bundle file.`)}),V({name:I().describe("Skill name to pass as `skill` to `import`."),source:I().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:I().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:L().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:I().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),[`Read-only skill discovery. Requires the Hocuspocus server. query searches the skills.sh marketplace and returns import-ready name/source/description/publisher/install-count rows. Import a chosen row with import({source,skill:name}); external rows are not managed or active editor content until imported/projected.`,`Omit name to list Project and Global managed skills with scope/description/hosts. name reads description/body plus a bundle files list (path/kind, no inline text); name+file reads one reference/script/bundle file. Optional scope; name-only prefers Project. Address skills by name/scope, never raw .ok/ paths or native cat.`,`Built-in open-knowledge* runtime skills are already in your skill list; do not fetch them here. Use write/edit/delete/move/install for changes.`].join(`
1136
1136
  `),["Create/replace exactly one `document`, `folder`, `template`, `skill`, or `asset`; use `documents` for an ordered batch. Requires the Hocuspocus server.","Nested paths such as `guides/overview` can be documents; put all requested blocks in one `document.content`. Use `folder` only for separate pages.","`document: {path, content|template, frontmatter?, position?}`: content and template are exclusive. Existing docs require position: replace/append/prepend; new docs default replace. frontmatter with literal content forces replace, even with append/prepend. Recent edits by another writer can refuse replace; follow the recovery response; append/prepend/edit bypass this refusal. Peers are per MCP connection; own writes and writers sharing a connection do not refuse each other; connected editors can. No agentId is needed.","`folder: {path, frontmatter?}` creates NEW folders; edit existing ones. `template: {path: '<folder>/<name>', content, frontmatter: {title, description?, tags?}}` creates reusable doc templates.","`skill: {name, description, body, scope?}` writes agent guidance; lowercase letters/digits/hyphens name is identity, description is when to use it. New skills use the default skill home; existing ones keep their real folder. Use install for editors.","`asset: {path, content|source}` uploads binary image/file: base64 content or local source path. `documents` takes document specs and reports each result.",`Optional summary: one-line outcome ≤80 chars, persisted to git history; avoid secrets or PII. Batches need per-entry summary; top-level is ignored.`,`Read response warnings: content-divergence/disk-edit-reconciled means re-read; mermaid-parse-error means the write landed but fix the fence.`,Q8].join(`
1137
- `),QX(`config-persistence`),QX(`generated-index-git-attributes`),QX(`head-watcher`),QX(`shadow-gc`),QX(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),QX(`mermaid-persistence`),QX(`persistence`),QX(`persistence-staleness`),QX(`recovered-file-target`),QX(`removed-docs-journal`),QX(`server-observers`),QX(`github-account`),QX(`sync-engine`),Fe(o),new Set(vye);const t5=[`no-push-permission`,`auth-error`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`unsafe-incoming-symlinks`];new Set(t5),[...t5],(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})(),(()=>{let e=Object.freeze({origin:`generated-index`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let n5=null;t8(()=>{n5?.disable(),n5=null}),QX(`skill-migrate`);function r5(e){return[{host:`agents`,root:bS},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=b4.indexOf(e.host),r=b4.indexOf(t.host);return(n===-1?b4.length:n)-(r===-1?b4.length:r)||e.host.localeCompare(t.host)})}r5(_t),r5(vt),Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const jje=Ul;yX(),Fe(o),QX(`project-git`);var i5=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),a5=i((e=>{let{InvalidArgumentError:t}=i5();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),o5=i((e=>{let{humanReadableArgName:t}=a5();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1137
+ `),QX(`config-persistence`),QX(`generated-index-git-attributes`),QX(`head-watcher`),QX(`shadow-gc`),QX(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),QX(`mermaid-persistence`),QX(`persistence`),QX(`persistence-staleness`),QX(`recovered-file-target`),QX(`removed-docs-journal`),QX(`server-observers`),QX(`github-account`),QX(`sync-engine`),Fe(o),new Set(vye);const t5=[`no-push-permission`,`auth-error`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`unsafe-incoming-symlinks`];new Set(t5),[...t5],(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})(),(()=>{let e=Object.freeze({origin:`generated-index`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let n5=null;t8(()=>{n5?.disable(),n5=null}),QX(`skill-migrate`);function r5(e){return[{host:`agents`,root:bS},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=b4.indexOf(e.host),r=b4.indexOf(t.host);return(n===-1?b4.length:n)-(r===-1?b4.length:r)||e.host.localeCompare(t.host)})}r5(_t),r5(vt),Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const kje=Ul;yX(),Fe(o),QX(`project-git`);var i5=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),a5=i((e=>{let{InvalidArgumentError:t}=i5();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),o5=i((e=>{let{humanReadableArgName:t}=a5();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1138
1138
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
1139
1139
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
1140
1140
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),s5=i((e=>{let{InvalidArgumentError:t}=i5();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -1143,7 +1143,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
1143
1143
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
1144
1144
  - too many short flags`):i.test(t)?Error(`${n}
1145
1145
  - too many long flags`):Error(`${n}
1146
- - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Mje=i((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),Nje=i((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=a5(),{CommanderError:l}=i5(),{Help:u,stripColor:d}=o5(),{Option:f,DualOptions:p}=s5(),{suggestSimilar:m}=Mje();var h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
1146
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Aje=i((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),jje=i((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=a5(),{CommanderError:l}=i5(),{Help:u,stripColor:d}=o5(),{Option:f,DualOptions:p}=s5(),{suggestSimilar:m}=Aje();var h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
1147
1147
  - specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
1148
1148
  Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e}),this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return r[n]=this._storeOptionsAsProperties?this:this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new f(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
1149
1149
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0||e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{let n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{let n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof f)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
@@ -1152,7 +1152,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
1152
1152
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1153
1153
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
1154
1154
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
1155
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:Pje,createCommand:Fje,createArgument:Ije,createOption:Lje,CommanderError:Rje,InvalidArgumentError:zje,InvalidOptionArgumentError:Bje,Command:Vje,Argument:Hje,Option:Uje,Help:Wje}=e(i((e=>{let{Argument:t}=a5(),{Command:n}=Nje(),{CommanderError:r,InvalidArgumentError:i}=i5(),{Help:a}=o5(),{Option:o}=s5();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;function Gje(e){let{projectDir:t,contentDir:n,sampleCap:r=5}=e,i=[],a=[];try{_(n)}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[`cannot access content directory ${n}: ${e instanceof Error?e.message:String(e)}`]}}let o;try{o=YAe({projectDir:t,contentDir:n})}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[e instanceof Error?e.message:String(e)]}}function s(e){let t;try{t=w(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);i.push(`could not read directory ${M(n,e)||`.`}: ${r}`);return}for(let r of t){let t=j(e,r.name);if(r.isSymbolicLink()){let e;try{e=E(t)}catch(e){let r=e.code;r===`ENOENT`||r===`ELOOP`?i.push(`broken or cyclic symlink: ${M(n,t)}`):i.push(`cannot resolve symlink ${M(n,t)}: ${r??`unknown error`}`);continue}let r;try{r=te(e)}catch{continue}if(r.isDirectory()){let e=M(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=M(n,t);if(o.isExcluded(e))continue;a.push(e)}}else if(r.isDirectory()){let e=M(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=M(n,t);if(o.isExcluded(e))continue;a.push(e)}}}return s(n),{totalCount:a.length,sample:a.slice(0,r),contentDir:n,warnings:i}}function Kje(e){let t=ft(),n=e.split(/\r?\n/,1)[0]??``;if(n===jY(t))return!0;let r=kY(t);return n.startsWith(r)&&/^-v\d+$/.test(n.slice(r.length))}function c5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&Kje(n)}function qje(e){return{command:`ok-pi-managed-extension`,args:[e]}}function l5(e={}){let t=e.mode===`dev`,n=ft(),r=t?jY(n):AY(n),i=`${Tt(n)}_`,a={unix:PY({...e,platformName:`darwin`}),win32:PY({...e,platformName:`win32`})};return`${r}
1155
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:Mje,createCommand:Nje,createArgument:Pje,createOption:Fje,CommanderError:Ije,InvalidArgumentError:Lje,InvalidOptionArgumentError:Rje,Command:zje,Argument:Bje,Option:Vje,Help:Hje}=e(i((e=>{let{Argument:t}=a5(),{Command:n}=jje(),{CommanderError:r,InvalidArgumentError:i}=i5(),{Help:a}=o5(),{Option:o}=s5();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;function Uje(e){let{projectDir:t,contentDir:n,sampleCap:r=5}=e,i=[],a=[];try{_(n)}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[`cannot access content directory ${n}: ${e instanceof Error?e.message:String(e)}`]}}let o;try{o=qAe({projectDir:t,contentDir:n})}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[e instanceof Error?e.message:String(e)]}}function s(e){let t;try{t=w(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);i.push(`could not read directory ${M(n,e)||`.`}: ${r}`);return}for(let r of t){let t=j(e,r.name);if(r.isSymbolicLink()){let e;try{e=E(t)}catch(e){let r=e.code;r===`ENOENT`||r===`ELOOP`?i.push(`broken or cyclic symlink: ${M(n,t)}`):i.push(`cannot resolve symlink ${M(n,t)}: ${r??`unknown error`}`);continue}let r;try{r=te(e)}catch{continue}if(r.isDirectory()){let e=M(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=M(n,t);if(o.isExcluded(e))continue;a.push(e)}}else if(r.isDirectory()){let e=M(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=M(n,t);if(o.isExcluded(e))continue;a.push(e)}}}return s(n),{totalCount:a.length,sample:a.slice(0,r),contentDir:n,warnings:i}}function Wje(e){let t=ft(),n=e.split(/\r?\n/,1)[0]??``;if(n===jY(t))return!0;let r=kY(t);return n.startsWith(r)&&/^-v\d+$/.test(n.slice(r.length))}function c5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&Wje(n)}function Gje(e){return{command:`ok-pi-managed-extension`,args:[e]}}function l5(e={}){let t=e.mode===`dev`,n=ft(),r=t?jY(n):AY(n),i=`${Tt(n)}_`,a={unix:PY({...e,platformName:`darwin`}),win32:PY({...e,platformName:`win32`})};return`${r}
1156
1156
  /**
1157
1157
  * Open Knowledge bridge for Pi — MANAGED FILE, written by \`${mt()} init\`.
1158
1158
  * Hand edits are overwritten whenever OK re-syncs this project; remove it
@@ -1495,61 +1495,61 @@ export default function okBridge(pi: {
1495
1495
  }
1496
1496
  });
1497
1497
  }
1498
- `}function Jje(e,t){let n=M(n8(t),n8(e));return n.length>0&&!n.startsWith(`..`)&&!A(n)}const Yje=e=>{try{let t=s(`git`,[`rev-parse`,`--show-toplevel`],c8({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function Xje(e,t={}){let n=t.homeDir??_e(),r=t.gitTopLevel??Yje,i=N(e),a;try{a=E(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(s8(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Jje(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}var u5=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function d5(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new u5(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);f5(e,t)}function Zje(e,t){f5(e,t)}function f5(e,t){p5(e,t)}function p5(e,t){let n=t,r;try{r=E(n)}catch{r=N(n)}let i=k(e);for(;i.length>1&&i!==le;){let t;try{t=E(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let n=M(r,t);if(n===``||!n.startsWith(`..`)&&!A(n))return;throw new u5(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function m5(e,t){let n=k(t),r=g(t)?`overwritten`:`written`;if(r===`written`&&g(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return O(n,{recursive:!0,force:!0}),v(k(n),{recursive:!0}),m(e,n,{recursive:!0}),r}function h5(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g5(e,t,n){try{if(te(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=KDe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!h5(a))return!1;let o=a[e.topLevelKey];if(!h5(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!h5(s))return!1;let c=s[e.serverName(t)];return h5(c)&&c.enabled===!1?!1:VY(c)||Bbe(c)}function Qje(e){let t=$a[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:Oa(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$Y[n.editor]??null}function $je(e,t,n={}){if(!oee.includes(e.id))return!0;let r=Qje(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&g5(r,t,i))return!0;try{return g5(e,t,e.configPath(t,n.home))}catch{return!1}}function eMe(e){let t=new Set(yt.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function tMe(e,t){if(eMe(t).length===0)return null;let n=j(e,bS,xt,`SKILL.md`);try{let t=W8(`project`,{checkDesktop:!0});return d5(k(n),e),{editorId:`agents`,label:`.agents hub`,action:m5(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _5(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!$je(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=W8(`project`,{checkDesktop:!0});d5(k(r),t);let i=m5(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function nMe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=k(n);return g(n)?(Zje(r,t),O(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function rMe(){let e=mY();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function iMe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=T(t)}catch(t){return pY(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=A(i)?i:j(k(t),i)}}let v5;function aMe(){return v5===void 0&&(v5=rMe()),v5}function y5(e,t=aMe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){pY(`resolveSymlinkWritePath threw`,e)}return iMe(e)}const b5=`**/.ok/*`,x5=`!**/.ok/skills/`;function S5(e){let t=[`.ok/`,`.okignore`];for(let n of vY){let r=$Y[n];r.projectConfigPath&&t.push(pMe(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function C5(e){let t=j(e,...Oye);if(!g(t))return[];try{let e=Mye(S(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=_t[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function oMe(e,t){let n=w5(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:T5(n)};let r=E5(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=new Set(C5(e)),o=[],s=a.size===0?i:i.split(`
1498
+ `}function Kje(e,t){let n=M(n8(t),n8(e));return n.length>0&&!n.startsWith(`..`)&&!A(n)}const qje=e=>{try{let t=s(`git`,[`rev-parse`,`--show-toplevel`],c8({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function Jje(e,t={}){let n=t.homeDir??_e(),r=t.gitTopLevel??qje,i=N(e),a;try{a=E(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(s8(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Kje(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}var u5=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function d5(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new u5(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);f5(e,t)}function Yje(e,t){f5(e,t)}function f5(e,t){p5(e,t)}function p5(e,t){let n=t,r;try{r=E(n)}catch{r=N(n)}let i=k(e);for(;i.length>1&&i!==le;){let t;try{t=E(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let n=M(r,t);if(n===``||!n.startsWith(`..`)&&!A(n))return;throw new u5(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function m5(e,t){let n=k(t),r=g(t)?`overwritten`:`written`;if(r===`written`&&g(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return O(n,{recursive:!0,force:!0}),v(k(n),{recursive:!0}),m(e,n,{recursive:!0}),r}function h5(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g5(e,t,n){try{if(te(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=WDe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!h5(a))return!1;let o=a[e.topLevelKey];if(!h5(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!h5(s))return!1;let c=s[e.serverName(t)];return h5(c)&&c.enabled===!1?!1:VY(c)||Rbe(c)}function Xje(e){let t=$a[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:Oa(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$Y[n.editor]??null}function Zje(e,t,n={}){if(!oee.includes(e.id))return!0;let r=Xje(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&g5(r,t,i))return!0;try{return g5(e,t,e.configPath(t,n.home))}catch{return!1}}function Qje(e){let t=new Set(yt.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function $je(e,t){if(Qje(t).length===0)return null;let n=j(e,bS,xt,`SKILL.md`);try{let t=W8(`project`,{checkDesktop:!0});return d5(k(n),e),{editorId:`agents`,label:`.agents hub`,action:m5(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _5(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Zje(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=W8(`project`,{checkDesktop:!0});d5(k(r),t);let i=m5(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function eMe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=k(n);return g(n)?(Yje(r,t),O(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function tMe(){let e=mY();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function nMe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=T(t)}catch(t){return pY(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=A(i)?i:j(k(t),i)}}let v5;function rMe(){return v5===void 0&&(v5=tMe()),v5}function y5(e,t=rMe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){pY(`resolveSymlinkWritePath threw`,e)}return nMe(e)}const b5=`**/.ok/*`,x5=`!**/.ok/skills/`;function S5(e){let t=[`.ok/`,`.okignore`];for(let n of vY){let r=$Y[n];r.projectConfigPath&&t.push(dMe(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function C5(e){let t=j(e,...Oye);if(!g(t))return[];try{let e=Mye(S(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=_t[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function iMe(e,t){let n=w5(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:T5(n)};let r=E5(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=new Set(C5(e)),o=[],s=a.size===0?i:i.split(`
1499
1499
  `).filter(e=>{let t=e.trim();return!a.has(t)||(o.push(t),!1)}).join(`
1500
1500
  `),c=k5(s),l=[],u=[];for(let e of t)O5(c,e)?u.push(e):l.push(e);if(l.length===0&&o.length===0)return{kind:`updated`,appended:l,alreadyPresent:u,removed:[]};let d=l.length===0||s.length===0||s.endsWith(`
1501
1501
  `)?``:`
1502
1502
  `,f=l.length===0?``:`${l.join(`
1503
- `)}\n`;try{re(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function sMe(e,t){let n=E5(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>D5(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(b5),i.add(x5);for(let t of C5(e))i.add(t);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
1503
+ `)}\n`;try{re(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function aMe(e,t){let n=E5(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>D5(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(b5),i.add(x5);for(let t of C5(e))i.add(t);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
1504
1504
  `),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=[...s];if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
1505
- `);if(u!==a)try{re(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function cMe(e){let t=E5(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=k5(n),i=S5(e);for(let e of i)if(O5(r,e))return`local-only`;return r.has(b5)?`local-only`:`shared`}function lMe(e){let t=E5(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=k5(n),i=[...S5(e),...C5(e)].filter(e=>O5(r,e)),a=new Set(i),o=[];for(let e of Object.values(_t))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===b5||e===x5){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function w5(e,t){let n=[];for(let r of t){let t=N(e,r);if(g(t))try{s(`git`,[`ls-files`,`--error-unmatch`,...Nye([r])],c8({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const uMe=/^[\w.\-/]+$/;function dMe(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function fMe(e){return uMe.test(e)?e:dMe(kJ(e))}function T5(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${fMe(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
1506
- `)}function E5(e){let t=Kxe(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=j(e.path,`info`);return g(n)?{kind:`ok`,path:j(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function D5(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function O5(e,t){for(let n of D5(t))if(e.has(n))return!0;return!1}function k5(e){let t=new Set;for(let n of e.split(`
1507
- `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function pMe(e,t){return mMe(M(t,e))}function mMe(e){return le===`/`?e:e.split(le).join(`/`)}function A5(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function j5(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function hMe(e){for(let t of e.split(`
1508
- `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function M5(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function N5(e){try{return te(e).mode&511}catch{return}}function gMe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1505
+ `);if(u!==a)try{re(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function oMe(e){let t=E5(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=k5(n),i=S5(e);for(let e of i)if(O5(r,e))return`local-only`;return r.has(b5)?`local-only`:`shared`}function sMe(e){let t=E5(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=k5(n),i=[...S5(e),...C5(e)].filter(e=>O5(r,e)),a=new Set(i),o=[];for(let e of Object.values(_t))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===b5||e===x5){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function w5(e,t){let n=[];for(let r of t){let t=N(e,r);if(g(t))try{s(`git`,[`ls-files`,`--error-unmatch`,...Nye([r])],c8({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const cMe=/^[\w.\-/]+$/;function lMe(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function uMe(e){return cMe.test(e)?e:lMe(kJ(e))}function T5(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${uMe(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
1506
+ `)}function E5(e){let t=Wxe(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=j(e.path,`info`);return g(n)?{kind:`ok`,path:j(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function D5(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function O5(e,t){for(let n of D5(t))if(e.has(n))return!0;return!1}function k5(e){let t=new Set;for(let n of e.split(`
1507
+ `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function dMe(e,t){return fMe(M(t,e))}function fMe(e){return le===`/`?e:e.split(le).join(`/`)}function A5(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function j5(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function pMe(e){for(let t of e.split(`
1508
+ `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function M5(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function N5(e){try{return te(e).mode&511}catch{return}}function mMe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1509
1509
  `)?`\r
1510
1510
  `:`
1511
- `,a=R4(r,t,void 0,{formattingOptions:{...hMe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${z4(r,a)}`;return{text:o,changed:o!==e}}const _Me={allowTrailingComma:!0,disallowComments:!1};function vMe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function P5(e){let t=[],n=qDe(e,t,_Me);return t.some(t=>!vMe(t,e))||n?.type!==`object`?null:n}function F5(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&L4(e)===t&&(n+=1)}return n}function I5(e,t){VJ(e,`${JSON.stringify(t,null,2)}\n`)}function yMe(e,t){let n=wbe(t);VJ(e,n.endsWith(`
1512
- `)?n:`${n}\n`)}function bMe(e,t){let n=(0,xs.stringify)(t);VJ(e,n.endsWith(`
1513
- `)?n:`${n}\n`)}const L5=10485760;function R5(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>R5(e,t[n]));if(dY(e)&&dY(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&R5(e[n],t[n]))}return!1}function xMe(e,t,n){return dY(e)&&n.every(n=>R5(e[n],t[n]))}function SMe(e){for(let t of e.split(`
1514
- `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function z5(e,t,n){return t===void 0?[e,n]:[e,t,n]}function B5(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function V5(e,t,n){let r=e[t];return n===void 0?r:dY(r)?r[n]:void 0}function CMe(e,t,n,r,i,a=!1,o=!1){if(!g(e))return o?{kind:`unchanged`}:(I5(e,B5(t,i,n,r)),{kind:`written`});let s;try{s=S(e,`utf-8`)}catch(e){return pY(`json config read failed`,e),{kind:`declined`,reason:A5(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(I5(e,B5(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>L5)return{kind:`declined`,reason:`oversize`};let c=P5(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(F5(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=V5(L4(c),t,i),u=dY(l)?l[n]:void 0,d=u!==void 0,f=HY(r);if(d&&a?FY(u):d&&xMe(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
1511
+ `,a=R4(r,t,void 0,{formattingOptions:{...pMe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${z4(r,a)}`;return{text:o,changed:o!==e}}const hMe={allowTrailingComma:!0,disallowComments:!1};function gMe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function P5(e){let t=[],n=GDe(e,t,hMe);return t.some(t=>!gMe(t,e))||n?.type!==`object`?null:n}function F5(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&L4(e)===t&&(n+=1)}return n}function I5(e,t){VJ(e,`${JSON.stringify(t,null,2)}\n`)}function _Me(e,t){let n=Sbe(t);VJ(e,n.endsWith(`
1512
+ `)?n:`${n}\n`)}function vMe(e,t){let n=(0,xs.stringify)(t);VJ(e,n.endsWith(`
1513
+ `)?n:`${n}\n`)}const L5=10485760;function R5(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>R5(e,t[n]));if(dY(e)&&dY(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&R5(e[n],t[n]))}return!1}function yMe(e,t,n){return dY(e)&&n.every(n=>R5(e[n],t[n]))}function bMe(e){for(let t of e.split(`
1514
+ `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function z5(e,t,n){return t===void 0?[e,n]:[e,t,n]}function B5(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function V5(e,t,n){let r=e[t];return n===void 0?r:dY(r)?r[n]:void 0}function xMe(e,t,n,r,i,a=!1,o=!1){if(!g(e))return o?{kind:`unchanged`}:(I5(e,B5(t,i,n,r)),{kind:`written`});let s;try{s=S(e,`utf-8`)}catch(e){return pY(`json config read failed`,e),{kind:`declined`,reason:A5(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(I5(e,B5(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>L5)return{kind:`declined`,reason:`oversize`};let c=P5(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(F5(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=V5(L4(c),t,i),u=dY(l)?l[n]:void 0,d=u!==void 0,f=HY(r);if(d&&a?FY(u):d&&yMe(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
1515
1515
  `)?`\r
1516
1516
  `:`
1517
- `,_={...SMe(m),eol:h},v=z5(t,i,n),y=m;if(o)for(let e of d?UY(u,r):[]){let t=R4(y,[...v,e],void 0,{formattingOptions:_});y=z4(y,t)}else if(d&&!a&&VY(u))for(let e of f){let t=R4(y,[...v,e],r[e],{formattingOptions:_});y=z4(y,t)}else{let e=R4(y,v,r,{formattingOptions:_});y=z4(y,e)}let b=`${p?``:``}${y}`;return b!==s&&VJ(e,b,{mode:N5(e)}),o&&b===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function wMe(e,t,n,r,i,a=!1,o=!1){let s=``;if(g(t))try{s=S(t,`utf-8`)}catch(e){return pY(`toml config read failed`,e),{kind:`declined`,reason:A5(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(yMe(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let l=s.charCodeAt(0)===65279,u=l?s.slice(1):s,d=M5(u),f=c||u.endsWith(`
1518
- `),p,m=!1;try{let t=TMe(e,u,n,r);if(o){let n=u;for(let a of t===void 0?[]:UY(t,i))n=e.removeEntryKey(n,r,a).text;p={text:n,existed:t!==void 0}}else{let n=EMe(t,i,a);m=n.kind===`replace`;let o=m?e.removeEntry(u,r).text:u;if(n.kind===`merge`)for(let t of n.prune)o=e.removeEntryKey(o,r,t).text;p=e.upsertEntry(o,r,i)}}catch(e){return pY(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let h=p.text;f?h.endsWith(`
1517
+ `,_={...bMe(m),eol:h},v=z5(t,i,n),y=m;if(o)for(let e of d?UY(u,r):[]){let t=R4(y,[...v,e],void 0,{formattingOptions:_});y=z4(y,t)}else if(d&&!a&&VY(u))for(let e of f){let t=R4(y,[...v,e],r[e],{formattingOptions:_});y=z4(y,t)}else{let e=R4(y,v,r,{formattingOptions:_});y=z4(y,e)}let b=`${p?``:``}${y}`;return b!==s&&VJ(e,b,{mode:N5(e)}),o&&b===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function SMe(e,t,n,r,i,a=!1,o=!1){let s=``;if(g(t))try{s=S(t,`utf-8`)}catch(e){return pY(`toml config read failed`,e),{kind:`declined`,reason:A5(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(_Me(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let l=s.charCodeAt(0)===65279,u=l?s.slice(1):s,d=M5(u),f=c||u.endsWith(`
1518
+ `),p,m=!1;try{let t=CMe(e,u,n,r);if(o){let n=u;for(let a of t===void 0?[]:UY(t,i))n=e.removeEntryKey(n,r,a).text;p={text:n,existed:t!==void 0}}else{let n=wMe(t,i,a);m=n.kind===`replace`;let o=m?e.removeEntry(u,r).text:u;if(n.kind===`merge`)for(let t of n.prune)o=e.removeEntryKey(o,r,t).text;p=e.upsertEntry(o,r,i)}}catch(e){return pY(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let h=p.text;f?h.endsWith(`
1519
1519
  `)||(h=`${h}\n`):h=h.replace(/\n+$/,``),d&&(h=h.replace(/\r\n/g,`
1520
1520
  `).replace(/\n/g,`\r
1521
- `));let _=`${l?``:``}${h}`;return _!==s&&VJ(t,_,{mode:N5(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function TMe(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=dY(i)?i[r]:void 0;return dY(a)?a:void 0}function EMe(e,t,n){return e===void 0||FY(e)?{kind:`merge`,prune:[]}:n||!VY(e)?{kind:`replace`}:{kind:`merge`,prune:UY(e,t)}}function DMe(e,t,n,r,i=!1,a=!1){let o=``;if(g(e))try{o=S(e,`utf-8`)}catch(e){return pY(`yaml config read failed`,e),{kind:`declined`,reason:A5(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(bMe(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>L5)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,xs.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,xs.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,xs.isCollection)(f)&&(i?FY(f.toJSON()):VY(f.toJSON()));if(a){if(d&&(0,xs.isCollection)(f))for(let e of UY(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of HY(r))r[e]===void 0?l.deleteIn([...u,e]):l.setIn([...u,e],l.createNode(r[e]));else l.setIn(u,l.createNode(r));let m=l.toString(),h=M5(c);c.endsWith(`
1521
+ `));let _=`${l?``:``}${h}`;return _!==s&&VJ(t,_,{mode:N5(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function CMe(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=dY(i)?i[r]:void 0;return dY(a)?a:void 0}function wMe(e,t,n){return e===void 0||FY(e)?{kind:`merge`,prune:[]}:n||!VY(e)?{kind:`replace`}:{kind:`merge`,prune:UY(e,t)}}function TMe(e,t,n,r,i=!1,a=!1){let o=``;if(g(e))try{o=S(e,`utf-8`)}catch(e){return pY(`yaml config read failed`,e),{kind:`declined`,reason:A5(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(vMe(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>L5)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,xs.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,xs.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,xs.isCollection)(f)&&(i?FY(f.toJSON()):VY(f.toJSON()));if(a){if(d&&(0,xs.isCollection)(f))for(let e of UY(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of HY(r))r[e]===void 0?l.deleteIn([...u,e]):l.setIn([...u,e],l.createNode(r[e]));else l.setIn(u,l.createNode(r));let m=l.toString(),h=M5(c);c.endsWith(`
1522
1522
  `)?m.endsWith(`
1523
1523
  `)||(m=`${m}\n`):m=m.replace(/\n+$/,``),h&&(m=m.replace(/\r\n/g,`
1524
1524
  `).replace(/\n/g,`\r
1525
- `));let _=`${s?``:``}${m}`;return _!==o&&VJ(e,_,{mode:N5(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const OMe=`A dev build registers OpenKnowledge MCP in project config only, never in user-level editor config. Run \`${ht} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`,kMe=`open-knowledge-ui`;function H5(e,t,n){try{let r=e.detectPath?.(t,n)??k(e.configPath(t,n));return g(r)}catch{return!1}}function U5(e,t,n){try{let r=N(k(e.configPath(t,n))),i=N(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+le)}catch{return!1}}function W5(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!g(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||U5(e,t,r);if(!i&&c&&!H5(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{d5(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return jMe(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||v(k(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{UJ(`${o}.lock`,()=>{let t=y5(o).writePath;if(s||v(k(t),{recursive:!0}),e.format===`toml`){let r=wMe(_Y(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=DMe(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=CMe(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const AMe={pi:l5};function jMe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=AMe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(k(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{UJ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}VJ(t,c,e===null?void 0:{mode:N5(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function MMe(e){let t=nxe(e.editors).filter(e=>e.scope===`global`);if(ut())return t.map(t=>({editorId:t.id,label:t.label,action:`failed`,configPath:t.configPath(``,e.home),serverName:t.serverName(``),error:OMe}));let n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>W5(t,``,n,e.home))}function G5(e,t,n,r){let i=q5(e,t,n,r);return i.kind===`present`?i.entry:null}function K5(e,t,n,r){let i=V5(e,t,r);if(!dY(i))return{kind:`no-entry`};let a=i[n];return dY(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function q5(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(te(i).size>L5)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:A5(e)}}let a;try{a=S(i,`utf-8`)}catch(e){return{kind:`decline`,reason:A5(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:qje(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=_Y().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return K5(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,xs.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:K5(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=P5(a);return s?F5(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:K5(L4(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function NMe(e,t){let n=[];for(let r of vY)r!==`claude-desktop`&&H5($Y[r],e,t)&&n.push(r);return n}function J5(e){return e===`opencode`?Gbe:Wbe}function PMe(e,t,n){let r=$Y[e],i=J5(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=G5(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}const Y5=8192;function X5(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 FMe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const IMe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function LMe(e){return e.replace(IMe,`$1"[REDACTED-DEVICE-ID]"`)}function Z5(e){return LMe(FMe(e))}const RMe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Q5(e){if(typeof e!=`string`)return null;let t=RMe.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 zMe(e){let t=b(e,`r`);try{let e=Buffer.alloc(Y5),n=0,r=!1;for(;n<Y5;){let i=C(t,e,n,Y5-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{f(t)}}function BMe(e){try{let t=zMe(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:Q5(a)}}catch{return{kind:`unreadable`}}}function $5(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function VMe(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=w(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=j(e,t.name),r;try{r=te(n).mtimeMs}catch{continue}if(r<i)continue;let c=BMe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!$5(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 e7=`state/os-termination-evidence.json`,t7=6048e5,n7=`/Library/Logs/DiagnosticReports`,r7=/openknowledge/i,HMe=it.map(e=>at(rt[e]));function UMe(e={}){return(t,n)=>new Promise(r=>{try{o(t,n,{encoding:`utf8`,timeout:e.timeoutMs??15e3,maxBuffer:e.maxBuffer??16777216,windowsHide:!0},(e,t,n)=>{r({...WMe(e),stdout:t,stderr:n})})}catch(e){let t=e.code;r({status:null,stdout:``,stderr:``,errorCode:typeof t==`string`?t:`spawn-failed`})}})}function WMe(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 i7(e){if(e.errorCode!==void 0)return e.errorCode;if(e.signal!==void 0)return`signal ${e.signal}`;let t=(e.stderr.trim().split(`
1525
+ `));let _=`${s?``:``}${m}`;return _!==o&&VJ(e,_,{mode:N5(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const EMe=`A dev build registers OpenKnowledge MCP in project config only, never in user-level editor config. Run \`${ht} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`,DMe=`open-knowledge-ui`;function H5(e,t,n){try{let r=e.detectPath?.(t,n)??k(e.configPath(t,n));return g(r)}catch{return!1}}function U5(e,t,n){try{let r=N(k(e.configPath(t,n))),i=N(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+le)}catch{return!1}}function W5(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!g(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||U5(e,t,r);if(!i&&c&&!H5(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{d5(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return kMe(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||v(k(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{UJ(`${o}.lock`,()=>{let t=y5(o).writePath;if(s||v(k(t),{recursive:!0}),e.format===`toml`){let r=SMe(_Y(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=TMe(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=xMe(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const OMe={pi:l5};function kMe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=OMe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(k(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{UJ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}VJ(t,c,e===null?void 0:{mode:N5(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function AMe(e){let t=exe(e.editors).filter(e=>e.scope===`global`);if(ut())return t.map(t=>({editorId:t.id,label:t.label,action:`failed`,configPath:t.configPath(``,e.home),serverName:t.serverName(``),error:EMe}));let n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>W5(t,``,n,e.home))}function G5(e,t,n,r){let i=q5(e,t,n,r);return i.kind===`present`?i.entry:null}function K5(e,t,n,r){let i=V5(e,t,r);if(!dY(i))return{kind:`no-entry`};let a=i[n];return dY(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function q5(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(te(i).size>L5)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:A5(e)}}let a;try{a=S(i,`utf-8`)}catch(e){return{kind:`decline`,reason:A5(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Gje(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=_Y().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return K5(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,xs.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:K5(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=P5(a);return s?F5(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:K5(L4(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function jMe(e,t){let n=[];for(let r of vY)r!==`claude-desktop`&&H5($Y[r],e,t)&&n.push(r);return n}function J5(e){return e===`opencode`?Ube:Hbe}function MMe(e,t,n){let r=$Y[e],i=J5(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=G5(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}const Y5=8192;function X5(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 NMe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const PMe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function FMe(e){return e.replace(PMe,`$1"[REDACTED-DEVICE-ID]"`)}function Z5(e){return FMe(NMe(e))}const IMe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Q5(e){if(typeof e!=`string`)return null;let t=IMe.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 LMe(e){let t=b(e,`r`);try{let e=Buffer.alloc(Y5),n=0,r=!1;for(;n<Y5;){let i=C(t,e,n,Y5-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{f(t)}}function RMe(e){try{let t=LMe(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:Q5(a)}}catch{return{kind:`unreadable`}}}function $5(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function zMe(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=w(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=j(e,t.name),r;try{r=te(n).mtimeMs}catch{continue}if(r<i)continue;let c=RMe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!$5(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 e7=`state/os-termination-evidence.json`,t7=6048e5,n7=`/Library/Logs/DiagnosticReports`,r7=/openknowledge/i,BMe=it.map(e=>at(rt[e]));function VMe(e={}){return(t,n)=>new Promise(r=>{try{o(t,n,{encoding:`utf8`,timeout:e.timeoutMs??15e3,maxBuffer:e.maxBuffer??16777216,windowsHide:!0},(e,t,n)=>{r({...HMe(e),stdout:t,stderr:n})})}catch(e){let t=e.code;r({status:null,stdout:``,stderr:``,errorCode:typeof t==`string`?t:`spawn-failed`})}})}function HMe(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 i7(e){if(e.errorCode!==void 0)return e.errorCode;if(e.signal!==void 0)return`signal ${e.signal}`;let t=(e.stderr.trim().split(`
1526
1526
  `)[0]??``).replace(/\S*\/journal\/\S*/g,`<journal path>`).replace(/\b[0-9a-f]{32}\b/gi,`<id>`);return`exit ${e.status}${t===``?``:`: ${t}`}`}function a7(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 o7(e,t){return{...e,outcome:`unavailable`,unavailableReason:t}}function s7(e){return{...e,outcome:e.events.length>0?`collected`:`none-in-window`}}function c7(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function l7(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function u7(e,t){let n=t.indexOf(`
1527
- `);if(n===-1)return null;let r,i;try{r=l7(JSON.parse(t.slice(0,n))),i=l7(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=l7(e);t===null||typeof t.name!=`string`||!$5(t.name)||a.push({name:t.name,pid:c7(t.pid),killReason:typeof t.reason==`string`?t.reason:null,residentPages:c7(t.rpages),lifetimeMaxPages:c7(t.lifetimeMax)})}let o=Q5(r.timestamp);return{kind:`jetsam`,at:o===null?null:new Date(o).toISOString(),file:e,pageSize:c7(l7(i.memoryStatus)?.pageSize),largestProcessOwned:typeof i.largestProcess==`string`?$5(i.largestProcess):null,ownedProcesses:a}}const d7=/^JetsamEvent-.*\.ips$/;function f7(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 GMe(e,t){let n=a7(`darwin`,`macos-jetsam`,[j(e,`JetsamEvent-*.ips`)]),r;try{r=await ke(e)}catch(e){return o7(n,e.code??`unknown`)}let i=f7(await Promise.all(r.filter(e=>d7.test(e)).map(async t=>{try{return{file:t,mtimeMs:(await Me(j(e,t))).mtimeMs}}catch{return{file:t,mtimeMs:null}}})),t.getTime()-t7,50,`newest-first`);n.unparseable+=i.statFailed,n.droppedOverCap=i.droppedOverCap;for(let t of i.files){let r=null;try{r=u7(t,await Oe(j(e,t),`utf8`))}catch{}r===null?n.unparseable+=1:r.ownedProcesses.length===0?n.foreignIgnored+=1:n.events.push(r)}return s7(n)}const KMe=new Set([`vm-pageshortage`,`vm-compressor-thrashing`,`vm-pageout-starvation`,`low-swap`,`sustained-memory-pressure`]);function qMe(e,t=n7){let n;try{n=w(t)}catch(e){return{outcome:`unavailable`,unavailableReason:e.code??`unknown`}}let r=e.fromMs-1e3,i=null,a=n.filter(e=>d7.test(e)).map(e=>{try{return{file:e,mtimeMs:te(j(t,e)).mtimeMs}}catch(t){return i??=t.code??`unknown`,{file:e,mtimeMs:null}}}),o=f7(a,r,5,`oldest-first`),s=0,c=o.statFailed,l=0,u=null;for(let n of o.files){let i;try{i=S(j(t,n),`utf8`)}catch(e){c+=1,u??=e.code??`unknown`;continue}s+=1;let a=u7(n,i);if(a===null){l+=1;continue}let o=a.at===null?null:Date.parse(a.at);if(o!==null&&(o<r||o>e.toMs))continue;let d=a.ownedProcesses.find(t=>t.pid===e.pid&&t.killReason!==null);if(d!==void 0&&d.killReason!==null)return{outcome:`killed`,source:`macos-jetsam`,at:a.at,killReason:d.killReason,victimChosenByPriority:KMe.has(d.killReason),largestProcessOwned:a.largestProcessOwned,residentBytes:d.residentPages===null||a.pageSize===null?null:d.residentPages*a.pageSize,reportsRead:s}}if(i!==null&&o.statFailed===a.length)return{outcome:`unavailable`,unavailableReason:i};if(s===0&&u!==null)return{outcome:`unavailable`,unavailableReason:u};let d=o.droppedOverCap;return c===0&&l===0&&d===0?{outcome:`not-killed`,reportsRead:s,unreadable:0,unparseable:0,skippedNewerOverCap:0}:{outcome:`inconclusive`,reportsRead:s,unreadable:c,unparseable:l,skippedNewerOverCap:d}}const p7=[`--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`],m7=[`--user`,`--no-pager`,`--output=short-iso-precise`,`--since=-7d`,`--grep=Fatal Wayland communication error|Wayland protocol error|X IO error|Missing X server`],h7=/^(\S+) \S+ ([^:\s[]+)(?:\[\d+\])?: (.*)$/,JMe=/\[(\d+)(?::\d+)?:\d{4}\/\d{6}\.\d+:[A-Z0-9]+:[^\]]*\]\s*(.*)$/,YMe=/^desktop\.\d{4}-\d{2}-\d{2}\.log$/;async function XMe(e,t){let n=new Set,r;try{r=await ke(e)}catch{return{pids:n,unreadable:!0}}let i=!1;for(let a of r){if(!YMe.test(a))continue;let r=j(e,a);try{if(t.getTime()-(await Me(r)).mtimeMs>t7)continue;for(let e of(await Oe(r,`utf8`)).split(`
1528
- `)){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 ZMe(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:r7.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 QMe(e){let t=[],n=0,r=0;for(let i of e.split(`
1529
- `)){if(i.trim()===``||i.startsWith(`-- `))continue;let e=h7.exec(i);if(e===null){r+=1;continue}let[,a=``,o=``,s=``]=e;if(!r7.test(s)){n+=1;continue}let c=ZMe(o,s);if(c===null){r+=1;continue}t.push({kind:`journal`,at:a,...c})}return{events:t,foreignIgnored:n,unparseable:r}}function $Me(e){let t=[],n=0,r=0;for(let i of e.split(`
1530
- `)){if(i.trim()===``||i.startsWith(`-- `))continue;let e=h7.exec(i);if(e===null){r+=1;continue}let[,a=``,,o=``]=e,s=JMe.exec(o);if(s===null){n+=1;continue}t.push({at:a,pid:Number(s[1]),detail:(s[2]??``).slice(0,200)})}return{lines:t,foreignIgnored:n,unparseable:r}}async function eNe(e,t,n){let r=$Me(e);if(r.lines.length===0)return{...r,events:[],unattributed:null};let i=await XMe(t,n),a=[],o=0;for(let e of r.lines){if(!i.pids.has(e.pid)){o+=1;continue}a.push({kind:`journal`,at:e.at,origin:`chromium`,action:`display-connection-lost`,pid:e.pid,processName:null,unit:null,trigger:/Wayland/.test(e.detail)?`wayland`:`x11`,detail:e.detail})}let s=i.pids.size>0&&!i.unreadable;if(o>0&&!s){let e=i.unreadable?`desktop logs unreadable`:`no desktop.boot pid in desktop logs`;return{events:a,foreignIgnored:r.foreignIgnored,unparseable:r.unparseable,unattributed:`${o} Chromium display line(s) not attributed, ${e}`}}return{events:a,foreignIgnored:r.foreignIgnored+o,unparseable:r.unparseable,unattributed:null}}function g7(e){return e.status===0||e.status===1&&/^-- No entries --$/m.test(e.stdout)}async function tNe(e,t,n){let r=a7(`linux`,`linux-journal`,[`journalctl ${p7.join(` `)}`,`journalctl ${m7.join(` `)}`]),[i,a]=await Promise.all([e(`journalctl`,[...p7]),e(`journalctl`,[...m7])]),o=[];if(g7(i)){let e=QMe(i.stdout);r.droppedOverCap+=Math.max(0,e.events.length-50),r.events.push(...e.events.slice(-50)),r.foreignIgnored+=e.foreignIgnored,r.unparseable+=e.unparseable,/not seeing messages from other users/i.test(`${i.stdout}\n${i.stderr}`)&&(r.restrictedToCurrentUser=!0)}else o.push(`system journal: ${i7(i)}`);if(g7(a)){let e=await eNe(a.stdout,n,t);r.droppedOverCap+=Math.max(0,e.events.length-50),r.events.push(...e.events.slice(-50)),r.foreignIgnored+=e.foreignIgnored,r.unparseable+=e.unparseable,e.unattributed!==null&&o.push(`user journal: ${e.unattributed}`)}else o.push(`user journal: ${i7(a)}`);return o.length===2?o7(r,o.join(`; `)):o.length===1?{...r,outcome:`partial`,unavailableReason:o.join(`; `)}:s7(r)}const nNe={41:`Microsoft-Windows-Kernel-Power`,1074:`User32`,2004:`Microsoft-Windows-Resource-Exhaustion-Detector`,6008:`EventLog`},rNe={1e3:`Application Error`,1001:`Windows Error Reporting`,1002:`Application Hang`};function _7(e){return e===`System`?nNe:rNe}function iNe(e){let t=`System[(${Object.keys(_7(e)).map(e=>`EventID=${e}`).join(` or `)}) and TimeCreated[timediff(@SystemTime) <= ${t7}]]`;return e===`System`?`*[${t}]`:`*[${t} and EventData[${HMe.map(e=>`Data='${e}'`).join(` or `)}]]`}function v7(e){return[`qe`,e,`/q:${iNe(e)}`,`/f:xml`,`/rd:true`,`/c:200`]}function aNe(e){return ue.join(e??`C:\\Windows`,`System32`,`wevtutil.exe`)}function oNe(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&apos;/g,`'`).replace(/&amp;/g,`&`)}function sNe(e){return/[\\/]/.test(e)||/^[a-z]:/i.test(e)}function y7(e,t){let n=RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,`g`);return[...e.matchAll(n)].map(e=>oNe(e[1]??``).trim())}function cNe(e,t){let n=_7(e),r=[],i=0,a=0;for(let o of t.match(/<Event[\s>][\s\S]*?<\/Event>/g)??[]){let t=/<Provider\s+Name=['"]([^'"]+)['"]/.exec(o)?.[1],s=Number(/<EventID[^>]*>(\d+)<\/EventID>/.exec(o)?.[1]),c=/<TimeCreated\s+SystemTime=['"]([^'"]+)['"]/.exec(o)?.[1];if(t===void 0||!Number.isInteger(s)||c===void 0){a+=1;continue}if(n[s]!==t){i+=1;continue}let l=y7(o,`Data`),u=y7(o,`Name`),d=[...l,...u].some(e=>r7.test(e));if(e===`Application`&&!d){i+=1;continue}r.push({kind:`windows-event`,at:c,log:e,provider:t,eventId:s,mentionsOpenKnowledge:d,data:e===`Application`?l.filter(e=>e!==``&&!sNe(e)):[]})}return{events:r,foreignIgnored:i,unparseable:a}}async function lNe(e,t){let n=aNe(t),r=[`System`,`Application`],i=a7(`win32`,`windows-event-log`,r.map(e=>`${n} ${v7(e).join(` `)}`)),a=await Promise.all(r.map(async t=>({log:t,result:await e(n,v7(t))}))),o=[];for(let{log:e,result:t}of a){if(t.status!==0){o.push(`${e}: ${i7(t)}`);continue}let n=cNe(e,t.stdout);i.droppedOverCap+=Math.max(0,n.events.length-50),i.events.push(...n.events.slice(0,50)),i.foreignIgnored+=n.foreignIgnored,i.unparseable+=n.unparseable}return o.length===r.length?o7(i,o.join(`; `)):o.length>0?{...i,outcome:`partial`,unavailableReason:o.join(`; `)}:s7(i)}async function b7(e={}){let t=e.platform??process.platform,n=e.runCommand??UMe(),r=(e.now??(()=>new Date))();switch(t){case`darwin`:return GMe(e.macosReportsDir??n7,r);case`linux`:return tNe(n,r,e.desktopLogsDir??j(RJ(),`logs`));case`win32`:return lNe(n,e.systemRoot??process.env.SystemRoot);default:return{...a7(t,null,[]),outcome:`unsupported`}}}const uNe={schemaVersion:1,outcome:`not-collected`};function x7(e){return`${JSON.stringify(e??uNe,null,2)}\n`}const dNe=rt.stable.appId;function S7(){return j(RJ(),`bug-reports`)}function fNe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=S7(),r=`${t}-bugreport`,i=j(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=j(n,`${r}-${e}.zip`);return i}function C7(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function w7(e,t){let n=j(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(j(e,`.ok`))?Te(`sha256`).update(N(e)).digest(`hex`).slice(0,12):null}function pNe(){let e={timestamp:new Date().toISOString(),platform:ye(),osType:Ce(),osRelease:be(),hostname:`[redacted]`,uptime:we(),freeMem:ge(),totalMem:Se(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=c(`sw_vers -productVersion 2>/dev/null`,c8({encoding:`utf8`})).trim()}catch{}try{let t=j(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const mNe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function T7(e){let t=ae(e);return mNe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function hNe(e,t){return O7(e,t).files}const gNe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function E7(e,t=dNe){let n=j(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return gNe.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>j(n,e.entry)))}function D7(e){if(!g(e))return[];try{let t=new Map;for(let n of w(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>j(e,t))}catch{return[]}}function O7(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=w(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>j(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(T7),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!T7(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function _Ne(e){let t=j(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,sd,ad].map(e=>j(t,e)).filter(e=>g(e))}:{files:[]}}function vNe(e){let t=j(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>j(t,e)).filter(e=>g(e))}:{files:[]}}function yNe(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Te(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function k7(e){let t=e.revealDocNames?e.content:yNe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=BP(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function A7(e){for(let t of e.files)try{let n=S(t,`utf8`);k7({zipfile:e.zipfile,name:`${e.prefix}/${ae(t)}`,content:t.endsWith(`.ips`)?Z5(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function bNe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??j(RJ(),`logs`),s=t.projectDir?w7(t.projectDir,i):null;v(k(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=pNe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=O7(s,o),{files:d}=t.projectDir?_Ne(t.projectDir):{files:[]},{files:f}=t.projectDir?vNe(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let g=[],_=[],{ZipFile:y}=await Promise.resolve().then(()=>e(v4(),1)),b=new y;A7({zipfile:b,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:t.bugReportLedgerFiles??[],prefix:TJ,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??ae(e.sourcePath)}`;b.addBuffer(t,n),_.push(n);let r=C7(e,n);r!==null&&g.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&k7({zipfile:b,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let x=new Set(m.map(e=>`diagnostic-reports/${ae(e)}`)),C=_.filter(e=>x.has(e)),w=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:X5(t.diagnosticReports,C.length);b.addBuffer(Buffer.from(`${w}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`),k7({zipfile:b,name:e7,content:x7(t.osTerminationEvidence),redact:n,revealDocNames:!0,bundleFiles:_,redactions:g});let T=JSON.stringify(c,null,2);b.addBuffer(Buffer.from(T,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let E={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:c};b.addBuffer(Buffer.from(JSON.stringify(E,null,2),`utf8`),`MANIFEST.json`);let D=g.reduce((e,t)=>e+t.lineCount,0),O=new Set(p.map(e=>`logs/${ae(e)}`)),ee=_.filter(e=>O.has(e)),te=new Set((t.bugReportLedgerFiles??[]).map(e=>`${TJ}/${ae(e)}`)),ne=_.filter(e=>te.has(e)),re=s?_.filter(e=>e.startsWith(`logs/`)&&!T7(e)&&!O.has(e)):[],ie=C.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],oe=ie.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...ie]:[`Redaction was disabled for this bundle; file contents are unmodified.`],A=[`# Bug Report Bundle`,``,`Generated: ${E.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${E.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...re.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...re.map(e=>`- ${e}`),``]:[],...ee.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...ee.map(e=>`- ${e}`),``]:[],...C.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...C.map(e=>`- ${e}`),``]:[],...(t.osTerminationEvidence?.events.length??0)>0?[`Termination records: read from the operating system's own logs, covering`,`the last 7 days, to explain an exit the app could not record itself. On`,`macOS: the memory-pressure (jetsam) reports`,`that list processes of this app, with each one's memory use and whether`,`it was killed. On Linux: kernel and systemd-oomd out-of-memory kills of`,`this app, as structured fields with the machine name, cgroup paths and`,`user id left out, plus display-connection errors this app's desktop`,`process wrote to the user's own journal, with Chromium's message cut to`,`200 characters. On Windows: crash and hang records for this app with`,`file paths left out, plus the time of every shutdown, restart, power`,`loss and low-memory warning on the machine, whatever caused it:`,`- ${e7}`,``]:[],...ne.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...ne.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${zP.join(`, `)}`,D>0?`${D} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...ie,``,`This bundle is safe to attach to a GitHub issue.`]:oe].join(`
1531
- `);b.addBuffer(Buffer.from(A,`utf8`),`README.md`),b.end();let se=h(r);return b.outputStream.pipe(se),await new Promise((e,t)=>{se.on(`close`,e),se.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:D},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:D,generatedAt:E.generatedAt}}}function j7(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 M7(e){return Te(`sha256`).update(e).digest(`hex`)}function N7(e){return j(RJ(N(e)),`pi-trust`)}function P7(e,t){return j(N7(e),M7(N(t)))}function F7(e,t,n){return j(P7(e,t),`${M7(n)}.json`)}var I7=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${j7(e)} ${j7(t)}; ${j7(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function L7(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 I7(e,`could not ${t}: ${i}`,a,n)}function R7(e){let t;try{t=_(e)}catch(t){if(t.code===`ENOENT`)return!1;throw L7(e,`be inspected`,t)}if(!t.isDirectory())throw new I7(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function z7(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function B7(e,t){if(!dY(e)||!z7(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==N(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==N(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==N(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!dY(e.previous))throw new I7(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&&z7(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&z7(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new I7(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 V7(e,t,n){let r;try{r=_(n)}catch(e){throw L7(n,`be inspected`,e)}if(!r.isFile())throw new I7(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=S(n,`utf8`)}catch(e){throw L7(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new I7(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=B7(a,n);if(o.cwd!==N(t)||n!==F7(e,t,o.canonicalTrustPath))throw new I7(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 H7(e,t){let{record:n,path:r}=t;for(let t of[N7(e),P7(e,n.cwd)])if(!R7(t))throw new I7(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=V7(e,n.cwd,r);if(!Pe(i.record,n))throw new I7(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function xNe(e,t,n,r,i){let a={version:1,cwd:N(t),configuredTrustPath:N(n),canonicalTrustPath:N(r),state:`pending`,previous:i},o=F7(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Pe(B7(JSON.parse(s),o),a))throw new I7(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);R7(N7(e)),R7(k(o));try{v(k(o),{recursive:!0,mode:448})}catch(e){throw L7(k(o),`be created`,e)}let c;try{c=_(o,{throwIfNoEntry:!1})}catch(e){throw L7(o,`be inspected`,e)}if(c)throw new I7(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{VJ(o,s,{mode:384})}catch(e){throw L7(o,`be written`,e)}return{path:o,record:a}}function SNe(e,t){let n=H7(e,t);if(n.record.state!==`pending`)throw new I7(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{VJ(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw L7(n.path,`be committed`,e)}return{path:n.path,record:r}}function U7(e,t){if(!R7(N7(e)))return[];let n=P7(e,t);if(!R7(n))return[];let r;try{r=w(n).sort()}catch(e){throw L7(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>V7(e,t,j(n,r)))}function W7(e,t){let n=H7(e,t);try{ne(n.path)}catch(e){throw L7(n.path,`be removed after reconciling its grant`,e)}for(let t of[k(n.path),N7(e)])try{ee(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw L7(t,`be removed after reconciling its grant`,e)}}var CNe=i(((e,n)=>{var r=t(`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`)}}})),wNe=i(((e,n)=>{var r=t(`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())}}})),TNe=i(((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}})),G7=i(((e,n)=>{var r=t(`fs`),i=CNe(),a=wNe(),o=TNe(),s=t(`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(`
1532
- 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]),t(`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=T,e.createWriteStream=E;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);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,"FileWriteStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(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 C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(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 D(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))}}})),ENe=i(((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}})),DNe=i((e=>{var t=ENe();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}}})),ONe=i(((e,t)=>{t.exports=DNe()})),kNe=i(((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`)})),ANe=i(((e,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=t(`assert`),o=kNe(),s=/^win/i.test(r.platform),c=t(`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)}}})),jNe=i(((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})),MNe=i(((e,n)=>{let r=t(`path`),i=G7(),a=ONe(),o=ANe(),s=jNe(),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})),NNe=i(((e,t)=>{let n=G7();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}})),K7=e(i(((e,t)=>{let n=MNe(),{toPromise:r,toSync:i,toSyncOptions:a}=NNe();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 q7=5e3;function J7(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 ${q7}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Y7(e,t){}function X7(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 PNe(e,t,n){await Xye(`${t}.ok.lock`,async()=>{let t=performance.now()+q7,r;for(;;)try{r=await K7.default.lock(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Ve(J7(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}X7(i,e)},{onWarn:Y7})}function FNe(e,t,n){UJ(`${t}.ok.lock`,()=>{let t=performance.now()+q7,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=K7.default.lockSync(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,J7(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}X7(a,e)},{onWarn:Y7})}const INe=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var Z7=class extends Error{name=`PiResourceInspectionError`};function Q7(e){let t;try{t=_(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=te(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new Z7(j5(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function LNe(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function RNe(e,t,n){let r=e;try{let i=E(e),a;r=t;try{a=E(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=N(t)}let o=j(a,`.agents`,`skills`),s=[];for(let e of INe)r=j(i,`.pi`,e),Q7(r)&&s.push(r);if(r=j(i,`.pi`,`extensions`),Q7(r))for(let t of w(r).sort()){let i=j(r,t);N(n)!==j(N(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[j(i,`.pi`,`skills`),j(i,`.agents`,`skills`)])if(e!==o&&(r=e,Q7(e)))for(let t of w(e).sort())LNe(t)||s.push(j(e,t));let c=k(i);for(;c!==i;){r=j(c,`.agents`,`skills`),r!==o&&Q7(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 ${j7(r)}: ${e instanceof Z7?e.message:j5(A5(e))}`}}}function $7(e){let t;try{t=_(e).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:A5(e)}}let n=y5(e);if(n.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!te(n.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:t&&e.code===`ENOENT`?`missing-symlink-target`:A5(e)}}return{kind:`ready`,path:n.writePath,symlink:t}}function e9(e,t,n){let r=N(e),i=ZY({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:$Y.pi.projectConfigPath(r),trustPath:j(i,`trust.json`)}}function t9(e){try{let t=E(e);return te(t).isDirectory()?(d(t,p.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${j7(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${j7(e)} could not be resolved or accessed: ${j7(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function n9(e){let t=t9(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${j7(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function r9(e,t,n){let r=q5($Y.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 MY(i)?{state:`own-current`,text:a}:c5(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function i9(e,t){let n;try{n=S(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:A5(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 dY(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
1533
- `)}:{state:`unreadable`,reason:`invalid-json`}}function zNe(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 j5(e)}}function a9(e,t){return{kind:`refused`,error:`trust store ${j7(e)}: ${zNe(t)}`}}function o9(e){let t=$7(e);try{switch(t.kind){case`declined`:return a9(e,t.reason);case`ready`:return{kind:`ready`,path:E(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=k(e),r=[ae(e)],i=_(n,{throwIfNoEntry:!1});for(;!i;){let t=k(n);if(t===n)return a9(e,`unavailable-root`);r.unshift(ae(n)),n=t,i=_(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:j(E(n),...r)}}catch(t){return a9(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:A5(t))}}catch(t){return a9(e,A5(t))}}function s9(e,t){let n=o9(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?a9(e,`path-changed`):n}function BNe(e,t,n){let r=e9(e,t,n),i=t9(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=r9(r.cwd,r.bridgePath,t).state,o=o9(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:i9(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:VNe(r.bridgePath).displayNames}}function VNe(e){let t=k(e),n=ae(e);try{return{displayNames:w(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>j7(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function HNe(e,t={mode:`published`},n,r,i){let a=e9(e,n,r),o=t9(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 ${j7(i)} no longer matches the current directory ${j7(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=r9(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=l5(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=W5($Y.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}`:j7(e.error)}}let l=await UNe(a.trustPath,o.project,n??_e());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function UNe(e,t,n){let r=t.canonical,i=o9(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{v(k(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await PNe(e,i.path,()=>{let o=n9(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=s9(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=i9(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=a9(e,c.reason).error;return}let l=l9(n,()=>{let t=U7(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&W7(n,t),xNe(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?`
1534
- `:``),f=N5(s.path);VJ(s.path,d,f===void 0?void 0:{mode:f}),l9(n,()=>SNe(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}return a}function WNe(e){let t=[],n=e;try{for(;;){if(_(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=E(n);return te(e).isDirectory()?(d(e,p.X_OK),j(e,...t)):void 0}let e=k(n);if(e===n)return;t.unshift(ae(n)),n=e}}catch{return}}function c9(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(`
1527
+ `);if(n===-1)return null;let r,i;try{r=l7(JSON.parse(t.slice(0,n))),i=l7(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=l7(e);t===null||typeof t.name!=`string`||!$5(t.name)||a.push({name:t.name,pid:c7(t.pid),killReason:typeof t.reason==`string`?t.reason:null,residentPages:c7(t.rpages),lifetimeMaxPages:c7(t.lifetimeMax)})}let o=Q5(r.timestamp);return{kind:`jetsam`,at:o===null?null:new Date(o).toISOString(),file:e,pageSize:c7(l7(i.memoryStatus)?.pageSize),largestProcessOwned:typeof i.largestProcess==`string`?$5(i.largestProcess):null,ownedProcesses:a}}const d7=/^JetsamEvent-.*\.ips$/;function f7(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 UMe(e,t){let n=a7(`darwin`,`macos-jetsam`,[j(e,`JetsamEvent-*.ips`)]),r;try{r=await ke(e)}catch(e){return o7(n,e.code??`unknown`)}let i=f7(await Promise.all(r.filter(e=>d7.test(e)).map(async t=>{try{return{file:t,mtimeMs:(await Me(j(e,t))).mtimeMs}}catch{return{file:t,mtimeMs:null}}})),t.getTime()-t7,50,`newest-first`);n.unparseable+=i.statFailed,n.droppedOverCap=i.droppedOverCap;for(let t of i.files){let r=null;try{r=u7(t,await Oe(j(e,t),`utf8`))}catch{}r===null?n.unparseable+=1:r.ownedProcesses.length===0?n.foreignIgnored+=1:n.events.push(r)}return s7(n)}const WMe=new Set([`vm-pageshortage`,`vm-compressor-thrashing`,`vm-pageout-starvation`,`low-swap`,`sustained-memory-pressure`]);function GMe(e,t=n7){let n;try{n=w(t)}catch(e){return{outcome:`unavailable`,unavailableReason:e.code??`unknown`}}let r=e.fromMs-1e3,i=null,a=n.filter(e=>d7.test(e)).map(e=>{try{return{file:e,mtimeMs:te(j(t,e)).mtimeMs}}catch(t){return i??=t.code??`unknown`,{file:e,mtimeMs:null}}}),o=f7(a,r,5,`oldest-first`),s=0,c=o.statFailed,l=0,u=null;for(let n of o.files){let i;try{i=S(j(t,n),`utf8`)}catch(e){c+=1,u??=e.code??`unknown`;continue}s+=1;let a=u7(n,i);if(a===null){l+=1;continue}let o=a.at===null?null:Date.parse(a.at);if(o!==null&&(o<r||o>e.toMs))continue;let d=a.ownedProcesses.find(t=>t.pid===e.pid&&t.killReason!==null);if(d!==void 0&&d.killReason!==null)return{outcome:`killed`,source:`macos-jetsam`,at:a.at,killReason:d.killReason,victimChosenByPriority:WMe.has(d.killReason),largestProcessOwned:a.largestProcessOwned,residentBytes:d.residentPages===null||a.pageSize===null?null:d.residentPages*a.pageSize,reportsRead:s}}if(i!==null&&o.statFailed===a.length)return{outcome:`unavailable`,unavailableReason:i};if(s===0&&u!==null)return{outcome:`unavailable`,unavailableReason:u};let d=o.droppedOverCap;return c===0&&l===0&&d===0?{outcome:`not-killed`,reportsRead:s,unreadable:0,unparseable:0,skippedNewerOverCap:0}:{outcome:`inconclusive`,reportsRead:s,unreadable:c,unparseable:l,skippedNewerOverCap:d}}const p7=[`--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`],m7=[`--user`,`--no-pager`,`--output=short-iso-precise`,`--since=-7d`,`--grep=Fatal Wayland communication error|Wayland protocol error|X IO error|Missing X server`],h7=/^(\S+) \S+ ([^:\s[]+)(?:\[\d+\])?: (.*)$/,KMe=/\[(\d+)(?::\d+)?:\d{4}\/\d{6}\.\d+:[A-Z0-9]+:[^\]]*\]\s*(.*)$/,qMe=/^desktop\.\d{4}-\d{2}-\d{2}\.log$/;async function JMe(e,t){let n=new Set,r;try{r=await ke(e)}catch{return{pids:n,unreadable:!0}}let i=!1;for(let a of r){if(!qMe.test(a))continue;let r=j(e,a);try{if(t.getTime()-(await Me(r)).mtimeMs>t7)continue;for(let e of(await Oe(r,`utf8`)).split(`
1528
+ `)){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 YMe(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:r7.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 XMe(e){let t=[],n=0,r=0;for(let i of e.split(`
1529
+ `)){if(i.trim()===``||i.startsWith(`-- `))continue;let e=h7.exec(i);if(e===null){r+=1;continue}let[,a=``,o=``,s=``]=e;if(!r7.test(s)){n+=1;continue}let c=YMe(o,s);if(c===null){r+=1;continue}t.push({kind:`journal`,at:a,...c})}return{events:t,foreignIgnored:n,unparseable:r}}function ZMe(e){let t=[],n=0,r=0;for(let i of e.split(`
1530
+ `)){if(i.trim()===``||i.startsWith(`-- `))continue;let e=h7.exec(i);if(e===null){r+=1;continue}let[,a=``,,o=``]=e,s=KMe.exec(o);if(s===null){n+=1;continue}t.push({at:a,pid:Number(s[1]),detail:(s[2]??``).slice(0,200)})}return{lines:t,foreignIgnored:n,unparseable:r}}async function QMe(e,t,n){let r=ZMe(e);if(r.lines.length===0)return{...r,events:[],unattributed:null};let i=await JMe(t,n),a=[],o=0;for(let e of r.lines){if(!i.pids.has(e.pid)){o+=1;continue}a.push({kind:`journal`,at:e.at,origin:`chromium`,action:`display-connection-lost`,pid:e.pid,processName:null,unit:null,trigger:/Wayland/.test(e.detail)?`wayland`:`x11`,detail:e.detail})}let s=i.pids.size>0&&!i.unreadable;if(o>0&&!s){let e=i.unreadable?`desktop logs unreadable`:`no desktop.boot pid in desktop logs`;return{events:a,foreignIgnored:r.foreignIgnored,unparseable:r.unparseable,unattributed:`${o} Chromium display line(s) not attributed, ${e}`}}return{events:a,foreignIgnored:r.foreignIgnored+o,unparseable:r.unparseable,unattributed:null}}function g7(e){return e.status===0||e.status===1&&/^-- No entries --$/m.test(e.stdout)}async function $Me(e,t,n){let r=a7(`linux`,`linux-journal`,[`journalctl ${p7.join(` `)}`,`journalctl ${m7.join(` `)}`]),[i,a]=await Promise.all([e(`journalctl`,[...p7]),e(`journalctl`,[...m7])]),o=[];if(g7(i)){let e=XMe(i.stdout);r.droppedOverCap+=Math.max(0,e.events.length-50),r.events.push(...e.events.slice(-50)),r.foreignIgnored+=e.foreignIgnored,r.unparseable+=e.unparseable,/not seeing messages from other users/i.test(`${i.stdout}\n${i.stderr}`)&&(r.restrictedToCurrentUser=!0)}else o.push(`system journal: ${i7(i)}`);if(g7(a)){let e=await QMe(a.stdout,n,t);r.droppedOverCap+=Math.max(0,e.events.length-50),r.events.push(...e.events.slice(-50)),r.foreignIgnored+=e.foreignIgnored,r.unparseable+=e.unparseable,e.unattributed!==null&&o.push(`user journal: ${e.unattributed}`)}else o.push(`user journal: ${i7(a)}`);return o.length===2?o7(r,o.join(`; `)):o.length===1?{...r,outcome:`partial`,unavailableReason:o.join(`; `)}:s7(r)}const eNe={41:`Microsoft-Windows-Kernel-Power`,1074:`User32`,2004:`Microsoft-Windows-Resource-Exhaustion-Detector`,6008:`EventLog`},tNe={1e3:`Application Error`,1001:`Windows Error Reporting`,1002:`Application Hang`};function _7(e){return e===`System`?eNe:tNe}function nNe(e){let t=`System[(${Object.keys(_7(e)).map(e=>`EventID=${e}`).join(` or `)}) and TimeCreated[timediff(@SystemTime) <= ${t7}]]`;return e===`System`?`*[${t}]`:`*[${t} and EventData[${BMe.map(e=>`Data='${e}'`).join(` or `)}]]`}function v7(e){return[`qe`,e,`/q:${nNe(e)}`,`/f:xml`,`/rd:true`,`/c:200`]}function rNe(e){return ue.join(e??`C:\\Windows`,`System32`,`wevtutil.exe`)}function iNe(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&apos;/g,`'`).replace(/&amp;/g,`&`)}function aNe(e){return/[\\/]/.test(e)||/^[a-z]:/i.test(e)}function y7(e,t){let n=RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,`g`);return[...e.matchAll(n)].map(e=>iNe(e[1]??``).trim())}function oNe(e,t){let n=_7(e),r=[],i=0,a=0;for(let o of t.match(/<Event[\s>][\s\S]*?<\/Event>/g)??[]){let t=/<Provider\s+Name=['"]([^'"]+)['"]/.exec(o)?.[1],s=Number(/<EventID[^>]*>(\d+)<\/EventID>/.exec(o)?.[1]),c=/<TimeCreated\s+SystemTime=['"]([^'"]+)['"]/.exec(o)?.[1];if(t===void 0||!Number.isInteger(s)||c===void 0){a+=1;continue}if(n[s]!==t){i+=1;continue}let l=y7(o,`Data`),u=y7(o,`Name`),d=[...l,...u].some(e=>r7.test(e));if(e===`Application`&&!d){i+=1;continue}r.push({kind:`windows-event`,at:c,log:e,provider:t,eventId:s,mentionsOpenKnowledge:d,data:e===`Application`?l.filter(e=>e!==``&&!aNe(e)):[]})}return{events:r,foreignIgnored:i,unparseable:a}}async function sNe(e,t){let n=rNe(t),r=[`System`,`Application`],i=a7(`win32`,`windows-event-log`,r.map(e=>`${n} ${v7(e).join(` `)}`)),a=await Promise.all(r.map(async t=>({log:t,result:await e(n,v7(t))}))),o=[];for(let{log:e,result:t}of a){if(t.status!==0){o.push(`${e}: ${i7(t)}`);continue}let n=oNe(e,t.stdout);i.droppedOverCap+=Math.max(0,n.events.length-50),i.events.push(...n.events.slice(0,50)),i.foreignIgnored+=n.foreignIgnored,i.unparseable+=n.unparseable}return o.length===r.length?o7(i,o.join(`; `)):o.length>0?{...i,outcome:`partial`,unavailableReason:o.join(`; `)}:s7(i)}async function b7(e={}){let t=e.platform??process.platform,n=e.runCommand??VMe(),r=(e.now??(()=>new Date))();switch(t){case`darwin`:return UMe(e.macosReportsDir??n7,r);case`linux`:return $Me(n,r,e.desktopLogsDir??j(RJ(),`logs`));case`win32`:return sNe(n,e.systemRoot??process.env.SystemRoot);default:return{...a7(t,null,[]),outcome:`unsupported`}}}const cNe={schemaVersion:1,outcome:`not-collected`};function x7(e){return`${JSON.stringify(e??cNe,null,2)}\n`}const lNe=rt.stable.appId;function S7(){return j(RJ(),`bug-reports`)}function uNe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=S7(),r=`${t}-bugreport`,i=j(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=j(n,`${r}-${e}.zip`);return i}function C7(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function w7(e,t){let n=j(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(j(e,`.ok`))?Te(`sha256`).update(N(e)).digest(`hex`).slice(0,12):null}function dNe(){let e={timestamp:new Date().toISOString(),platform:ye(),osType:Ce(),osRelease:be(),hostname:`[redacted]`,uptime:we(),freeMem:ge(),totalMem:Se(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=c(`sw_vers -productVersion 2>/dev/null`,c8({encoding:`utf8`})).trim()}catch{}try{let t=j(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const fNe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function T7(e){let t=ae(e);return fNe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function pNe(e,t){return O7(e,t).files}const mNe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function E7(e,t=lNe){let n=j(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return mNe.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>j(n,e.entry)))}function D7(e){if(!g(e))return[];try{let t=new Map;for(let n of w(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>j(e,t))}catch{return[]}}function O7(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=w(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>j(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(T7),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!T7(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function hNe(e){let t=j(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,sd,ad].map(e=>j(t,e)).filter(e=>g(e))}:{files:[]}}function gNe(e){let t=j(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>j(t,e)).filter(e=>g(e))}:{files:[]}}function _Ne(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Te(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function k7(e){let t=e.revealDocNames?e.content:_Ne(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=BP(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function A7(e){for(let t of e.files)try{let n=S(t,`utf8`);k7({zipfile:e.zipfile,name:`${e.prefix}/${ae(t)}`,content:t.endsWith(`.ips`)?Z5(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function vNe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??j(RJ(),`logs`),s=t.projectDir?w7(t.projectDir,i):null;v(k(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=dNe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=O7(s,o),{files:d}=t.projectDir?hNe(t.projectDir):{files:[]},{files:f}=t.projectDir?gNe(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let g=[],_=[],{ZipFile:y}=await Promise.resolve().then(()=>e(v4(),1)),b=new y;A7({zipfile:b,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:t.bugReportLedgerFiles??[],prefix:TJ,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),A7({zipfile:b,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??ae(e.sourcePath)}`;b.addBuffer(t,n),_.push(n);let r=C7(e,n);r!==null&&g.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&k7({zipfile:b,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let x=new Set(m.map(e=>`diagnostic-reports/${ae(e)}`)),C=_.filter(e=>x.has(e)),w=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:X5(t.diagnosticReports,C.length);b.addBuffer(Buffer.from(`${w}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`),k7({zipfile:b,name:e7,content:x7(t.osTerminationEvidence),redact:n,revealDocNames:!0,bundleFiles:_,redactions:g});let T=JSON.stringify(c,null,2);b.addBuffer(Buffer.from(T,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let E={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:c};b.addBuffer(Buffer.from(JSON.stringify(E,null,2),`utf8`),`MANIFEST.json`);let D=g.reduce((e,t)=>e+t.lineCount,0),O=new Set(p.map(e=>`logs/${ae(e)}`)),ee=_.filter(e=>O.has(e)),te=new Set((t.bugReportLedgerFiles??[]).map(e=>`${TJ}/${ae(e)}`)),ne=_.filter(e=>te.has(e)),re=s?_.filter(e=>e.startsWith(`logs/`)&&!T7(e)&&!O.has(e)):[],ie=C.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],oe=ie.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...ie]:[`Redaction was disabled for this bundle; file contents are unmodified.`],A=[`# Bug Report Bundle`,``,`Generated: ${E.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${E.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...re.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...re.map(e=>`- ${e}`),``]:[],...ee.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...ee.map(e=>`- ${e}`),``]:[],...C.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...C.map(e=>`- ${e}`),``]:[],...(t.osTerminationEvidence?.events.length??0)>0?[`Termination records: read from the operating system's own logs, covering`,`the last 7 days, to explain an exit the app could not record itself. On`,`macOS: the memory-pressure (jetsam) reports`,`that list processes of this app, with each one's memory use and whether`,`it was killed. On Linux: kernel and systemd-oomd out-of-memory kills of`,`this app, as structured fields with the machine name, cgroup paths and`,`user id left out, plus display-connection errors this app's desktop`,`process wrote to the user's own journal, with Chromium's message cut to`,`200 characters. On Windows: crash and hang records for this app with`,`file paths left out, plus the time of every shutdown, restart, power`,`loss and low-memory warning on the machine, whatever caused it:`,`- ${e7}`,``]:[],...ne.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...ne.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${zP.join(`, `)}`,D>0?`${D} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...ie,``,`This bundle is safe to attach to a GitHub issue.`]:oe].join(`
1531
+ `);b.addBuffer(Buffer.from(A,`utf8`),`README.md`),b.end();let se=h(r);return b.outputStream.pipe(se),await new Promise((e,t)=>{se.on(`close`,e),se.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:D},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:D,generatedAt:E.generatedAt}}}function j7(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 M7(e){return Te(`sha256`).update(e).digest(`hex`)}function N7(e){return j(RJ(N(e)),`pi-trust`)}function P7(e,t){return j(N7(e),M7(N(t)))}function F7(e,t,n){return j(P7(e,t),`${M7(n)}.json`)}var I7=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${j7(e)} ${j7(t)}; ${j7(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function L7(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 I7(e,`could not ${t}: ${i}`,a,n)}function R7(e){let t;try{t=_(e)}catch(t){if(t.code===`ENOENT`)return!1;throw L7(e,`be inspected`,t)}if(!t.isDirectory())throw new I7(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function z7(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function B7(e,t){if(!dY(e)||!z7(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==N(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==N(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==N(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!dY(e.previous))throw new I7(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&&z7(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&z7(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new I7(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 V7(e,t,n){let r;try{r=_(n)}catch(e){throw L7(n,`be inspected`,e)}if(!r.isFile())throw new I7(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=S(n,`utf8`)}catch(e){throw L7(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new I7(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=B7(a,n);if(o.cwd!==N(t)||n!==F7(e,t,o.canonicalTrustPath))throw new I7(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 H7(e,t){let{record:n,path:r}=t;for(let t of[N7(e),P7(e,n.cwd)])if(!R7(t))throw new I7(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=V7(e,n.cwd,r);if(!Pe(i.record,n))throw new I7(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function yNe(e,t,n,r,i){let a={version:1,cwd:N(t),configuredTrustPath:N(n),canonicalTrustPath:N(r),state:`pending`,previous:i},o=F7(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Pe(B7(JSON.parse(s),o),a))throw new I7(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);R7(N7(e)),R7(k(o));try{v(k(o),{recursive:!0,mode:448})}catch(e){throw L7(k(o),`be created`,e)}let c;try{c=_(o,{throwIfNoEntry:!1})}catch(e){throw L7(o,`be inspected`,e)}if(c)throw new I7(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{VJ(o,s,{mode:384})}catch(e){throw L7(o,`be written`,e)}return{path:o,record:a}}function bNe(e,t){let n=H7(e,t);if(n.record.state!==`pending`)throw new I7(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{VJ(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw L7(n.path,`be committed`,e)}return{path:n.path,record:r}}function U7(e,t){if(!R7(N7(e)))return[];let n=P7(e,t);if(!R7(n))return[];let r;try{r=w(n).sort()}catch(e){throw L7(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>V7(e,t,j(n,r)))}function W7(e,t){let n=H7(e,t);try{ne(n.path)}catch(e){throw L7(n.path,`be removed after reconciling its grant`,e)}for(let t of[k(n.path),N7(e)])try{ee(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw L7(t,`be removed after reconciling its grant`,e)}}var xNe=i(((e,n)=>{var r=t(`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`)}}})),SNe=i(((e,n)=>{var r=t(`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())}}})),CNe=i(((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}})),G7=i(((e,n)=>{var r=t(`fs`),i=xNe(),a=SNe(),o=CNe(),s=t(`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(`
1532
+ 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]),t(`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=T,e.createWriteStream=E;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);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,"FileWriteStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(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 C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(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 D(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))}}})),wNe=i(((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}})),TNe=i((e=>{var t=wNe();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}}})),ENe=i(((e,t)=>{t.exports=TNe()})),DNe=i(((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`)})),ONe=i(((e,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=t(`assert`),o=DNe(),s=/^win/i.test(r.platform),c=t(`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)}}})),kNe=i(((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})),ANe=i(((e,n)=>{let r=t(`path`),i=G7(),a=ENe(),o=ONe(),s=kNe(),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})),jNe=i(((e,t)=>{let n=G7();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}})),K7=e(i(((e,t)=>{let n=ANe(),{toPromise:r,toSync:i,toSyncOptions:a}=jNe();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 q7=5e3;function J7(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 ${q7}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Y7(e,t){}function X7(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 MNe(e,t,n){await Jye(`${t}.ok.lock`,async()=>{let t=performance.now()+q7,r;for(;;)try{r=await K7.default.lock(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Ve(J7(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}X7(i,e)},{onWarn:Y7})}function NNe(e,t,n){UJ(`${t}.ok.lock`,()=>{let t=performance.now()+q7,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=K7.default.lockSync(k(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,J7(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}X7(a,e)},{onWarn:Y7})}const PNe=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var Z7=class extends Error{name=`PiResourceInspectionError`};function Q7(e){let t;try{t=_(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=te(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new Z7(j5(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function FNe(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function INe(e,t,n){let r=e;try{let i=E(e),a;r=t;try{a=E(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=N(t)}let o=j(a,`.agents`,`skills`),s=[];for(let e of PNe)r=j(i,`.pi`,e),Q7(r)&&s.push(r);if(r=j(i,`.pi`,`extensions`),Q7(r))for(let t of w(r).sort()){let i=j(r,t);N(n)!==j(N(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[j(i,`.pi`,`skills`),j(i,`.agents`,`skills`)])if(e!==o&&(r=e,Q7(e)))for(let t of w(e).sort())FNe(t)||s.push(j(e,t));let c=k(i);for(;c!==i;){r=j(c,`.agents`,`skills`),r!==o&&Q7(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 ${j7(r)}: ${e instanceof Z7?e.message:j5(A5(e))}`}}}function $7(e){let t;try{t=_(e).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:A5(e)}}let n=y5(e);if(n.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!te(n.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:t&&e.code===`ENOENT`?`missing-symlink-target`:A5(e)}}return{kind:`ready`,path:n.writePath,symlink:t}}function e9(e,t,n){let r=N(e),i=ZY({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:$Y.pi.projectConfigPath(r),trustPath:j(i,`trust.json`)}}function t9(e){try{let t=E(e);return te(t).isDirectory()?(d(t,p.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${j7(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${j7(e)} could not be resolved or accessed: ${j7(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function n9(e){let t=t9(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${j7(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function r9(e,t,n){let r=q5($Y.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 MY(i)?{state:`own-current`,text:a}:c5(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function i9(e,t){let n;try{n=S(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:A5(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 dY(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
1533
+ `)}:{state:`unreadable`,reason:`invalid-json`}}function LNe(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 j5(e)}}function a9(e,t){return{kind:`refused`,error:`trust store ${j7(e)}: ${LNe(t)}`}}function o9(e){let t=$7(e);try{switch(t.kind){case`declined`:return a9(e,t.reason);case`ready`:return{kind:`ready`,path:E(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=k(e),r=[ae(e)],i=_(n,{throwIfNoEntry:!1});for(;!i;){let t=k(n);if(t===n)return a9(e,`unavailable-root`);r.unshift(ae(n)),n=t,i=_(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:j(E(n),...r)}}catch(t){return a9(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:A5(t))}}catch(t){return a9(e,A5(t))}}function s9(e,t){let n=o9(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?a9(e,`path-changed`):n}function RNe(e,t,n){let r=e9(e,t,n),i=t9(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=r9(r.cwd,r.bridgePath,t).state,o=o9(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:i9(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:zNe(r.bridgePath).displayNames}}function zNe(e){let t=k(e),n=ae(e);try{return{displayNames:w(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>j7(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function BNe(e,t={mode:`published`},n,r,i){let a=e9(e,n,r),o=t9(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 ${j7(i)} no longer matches the current directory ${j7(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=r9(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=l5(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=W5($Y.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}`:j7(e.error)}}let l=await VNe(a.trustPath,o.project,n??_e());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function VNe(e,t,n){let r=t.canonical,i=o9(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{v(k(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await MNe(e,i.path,()=>{let o=n9(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=s9(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=i9(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=a9(e,c.reason).error;return}let l=l9(n,()=>{let t=U7(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&W7(n,t),yNe(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?`
1534
+ `:``),f=N5(s.path);VJ(s.path,d,f===void 0?void 0:{mode:f}),l9(n,()=>bNe(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}return a}function HNe(e){let t=[],n=e;try{for(;;){if(_(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=E(n);return te(e).isDirectory()?(d(e,p.X_OK),j(e,...t)):void 0}let e=k(n);if(e===n)return;t.unshift(ae(n)),n=e}}catch{return}}function c9(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(`
1535
1535
  `)}:n.detail===void 0?n:{...n,detail:i.join(`
1536
- `)}}function GNe(e,t,n,r={}){let i=e9(e,t,n),a=t??_e(),o=t9(i.cwd),s=o.kind===`refused`&&r.recordedOnly?WNe(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=l9(a,()=>{let e=U7(a,i.cwd);return c===void 0||c===i.cwd?e:[...U7(a,c),...e]})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}if(l.length===0&&r.recordedOnly)return o.kind===`ready`||s!==void 0?{action:`not-present`}:{action:`kept-unverified`,error:`${o.error}. OpenKnowledge could not verify whether this path refers to a project with recorded Pi trust; cleanup was left pending. Retry once the project path can be resolved to check again.`};if(o.kind===`refused`){if(l.length===0)return{action:`kept-unverified`,error:o.error};let e=l.map(({path:e,record:t})=>`key ${j7(JSON.stringify(t.cwd))}; configured store ${j7(JSON.stringify(t.configuredTrustPath))}; recorded destination ${j7(JSON.stringify(t.canonicalTrustPath))}; ownership record ${j7(JSON.stringify(e))} (${t.state})`);return{action:`kept-unverified`,error:[`${o.error}. OpenKnowledge kept these Pi trust ownership records; current trust decisions were not checked:`,...e,`To review manually, close Pi, verify the intended store against its recorded destination, and inspect only the exact key. A pending record does not prove setup completed or ownership of a current grant. If you choose to undo a current true decision, restore the recorded previous value, or remove that key only when no previous entry was recorded. Preserve other current decisions; parent-folder and global trust settings still apply.`].join(`
1537
- `)}}let u=RNe(o.project.canonical,a,$Y.pi.projectConfigPath(o.project.canonical));if(u.kind===`unreadable`)return{action:`kept-unverified`,error:u.error};let d=u.kind===`shared`?u.paths:[],f=[],p=new Map,m=(e,t)=>{let n=p.get(e);if(!n){let t=o9(e);if(t.kind===`refused`){f.push({action:`refused-unreadable`,error:t.error});return}n={trustPath:e,resolved:t,keys:new Map},p.set(e,n)}if(t){if(n.resolved.path!==t.record.canonicalTrustPath){f.push({action:`refused-unreadable`,error:`Pi trust store ${j7(e)} no longer points to its recorded destination ${j7(t.record.canonicalTrustPath)}; restore the intended file location or symlink, then retry`});return}n.keys.set(t.record.cwd,{cwd:t.record.cwd,mode:`recorded`,receipt:t})}};for(let e of l)m(e.record.configuredTrustPath,e);m(i.trustPath);for(let e of p.values()){for(let t of[o.project.canonical,i.cwd])e.keys.has(t)||e.keys.set(t,{cwd:t,mode:`inspect`,receipt:l.find(n=>n.record.cwd===t&&n.record.canonicalTrustPath===e.resolved.path)});f.push(KNe(e,a,d,o.project))}return c9(f)}function l9(e,t){try{return t()}catch(t){throw t instanceof I7?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${j7(j(RJ(e),`pi-trust`))}: ${j7(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function KNe(e,t,n,r){let{trustPath:i,resolved:a}=e,o=[...e.keys.values()];if(!o.some(e=>e.mode===`recorded`)&&a.kind===`missing`)return{action:`not-present`};if(a.kind===`missing`)try{_(k(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${j7(k(a.path))} is unavailable: ${j7(e instanceof Error?e.message:String(e))}. Restore access to its parent directory or mounted drive, then retry; the ownership record was kept.`}}let s=[],c={result:{action:`not-present`}};try{FNe(i,a.path,()=>{let e=n9(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=s9(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=i9(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:a9(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:l9(t,()=>U7(t,e.cwd).find(e=>e.record.canonicalTrustPath===l.path))}));if(d.some(e=>e.receipt&&e.receipt.record.configuredTrustPath!==e.expectedConfiguredPath)){c.result={action:`failed`,error:`The Pi trust ownership record changed during cleanup; retry to read its current location.`};return}for(let e of d){try{qNe(e,t,i,l.path,u,n,r,c)}catch(t){let n=j7(t instanceof Error?t.message:String(t)),r=t instanceof I7?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${j7(JSON.stringify(e.cwd))} in ${j7(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:j7(e instanceof Error?e.message:String(e))})}return c9([...s,c.result])}function qNe(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&l9(t,()=>W7(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${j7(JSON.stringify(c))} entry from ${j7(n)}; parent-folder and global trust settings still apply.`;if(a.length>0&&c===o.canonical){let n=`kept Pi's folder trust because other resources still need it: ${a.slice(0,3).map(e=>j7(JSON.stringify(e))).join(`, `)}${a.length>3?` (+${a.length-3} more)`:``}. ${u} Removing this grant may stop Pi from loading those resources, including any not listed here.`;s.result={action:`kept-shared`,detail:n},l&&e.mode===`recorded`&&l9(t,()=>W7(t,l)),s.result={action:`kept-shared`,detail:`${n} ${l?e.mode===`recorded`?`OpenKnowledge has relinquished this grant and will not revoke it on later cleanup runs.`:`OpenKnowledge kept the existing ownership record; cleanup of its recorded location remains incomplete.`:`OpenKnowledge has no ownership record for this grant and will not revoke it on later cleanup runs.`}`};return}if(e.mode===`inspect`||!l||l.record.state===`pending`){let e=l?l.record.state===`pending`?`its ownership record is pending after an interrupted setup; completion cannot be verified. Re-running setup or cleanup does not reconcile this record while the folder remains trusted.`:`OpenKnowledge must reconcile its recorded location at ${j7(l.record.configuredTrustPath)} before removing it.`:`no OpenKnowledge ownership record exists; this includes every grant made before ownership recording was introduced.`;s.result={action:`kept-unowned`,detail:`${c===o.canonical?`kept Pi's folder trust because ${e}`:`kept a Pi trust entry under a non-canonical project path because ${e} Pi uses the real project directory instead of this key.`} ${u}`};return}let d={...i.entries};l.record.previous.present?d[c]=l.record.previous.value:delete d[c];let f=JSON.stringify(d,null,2)+(i.trailingNewline?`
1538
- `:``),p=N5(r);VJ(r,f,p===void 0?void 0:{mode:p}),i.entries=d,l9(t,()=>W7(t,l)),s.result={action:`removed`}}function JNe(e){return MY(e)||FY(e)||c5(e)}const u9=10485760;function d9(e,t,n,r=!1){let i=GNe(e,t,n,{recordedOnly:r});switch(i.action){case`removed`:case`not-present`:return{trust:i.action};case`kept-shared`:case`kept-unowned`:return{trust:i.action,trustDetail:i.detail};case`failed`:case`refused-unreadable`:case`kept-unverified`:{let e=r?`Trust cleanup remains incomplete`:`The bridge file was left untouched`;throw Error(`Pi trust cleanup failed (${i.action}):\n${i.error}\n${e} so cleanup can be retried.`)}default:throw Error(`unhandled Pi trust cleanup result: ${i}`)}}function f9(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=d9(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function YNe(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=$7(a);if(o.kind===`not-present`)return f9(e,t,n,i);if(o.kind===`declined`)return o;let s=q5(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return f9(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!JNe(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=d9(t,n,i);try{O(a,{force:!0})}catch(t){throw e.trustDetail?Error(`${t instanceof Error?t.message:String(t)}\n${e.trustDetail}`,{cause:t}):t}return{kind:`removed`,...e}}return e.format===`toml`?QNe(o.path,c):e.format===`yaml`?ZNe(o.path,e.topLevelKey,c):XNe(o.path,e.topLevelKey,e.serverMapSubKey,c)}function XNe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}if(Buffer.byteLength(i,`utf-8`)>u9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=gMe(i,z5(t,n,r));return o?(VJ(e,a,{mode:N5(e)}),{kind:`removed`}):{kind:`not-present`}}function ZNe(e,t,n){let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}if(Buffer.byteLength(r,`utf-8`)>u9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,xs.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=M5(a);a.trim()===``||a.endsWith(`
1536
+ `)}}function UNe(e,t,n,r={}){let i=e9(e,t,n),a=t??_e(),o=t9(i.cwd),s=o.kind===`refused`&&r.recordedOnly?HNe(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=l9(a,()=>{let e=U7(a,i.cwd);return c===void 0||c===i.cwd?e:[...U7(a,c),...e]})}catch(e){return{action:`failed`,error:j7(e instanceof Error?e.message:String(e))}}if(l.length===0&&r.recordedOnly)return o.kind===`ready`||s!==void 0?{action:`not-present`}:{action:`kept-unverified`,error:`${o.error}. OpenKnowledge could not verify whether this path refers to a project with recorded Pi trust; cleanup was left pending. Retry once the project path can be resolved to check again.`};if(o.kind===`refused`){if(l.length===0)return{action:`kept-unverified`,error:o.error};let e=l.map(({path:e,record:t})=>`key ${j7(JSON.stringify(t.cwd))}; configured store ${j7(JSON.stringify(t.configuredTrustPath))}; recorded destination ${j7(JSON.stringify(t.canonicalTrustPath))}; ownership record ${j7(JSON.stringify(e))} (${t.state})`);return{action:`kept-unverified`,error:[`${o.error}. OpenKnowledge kept these Pi trust ownership records; current trust decisions were not checked:`,...e,`To review manually, close Pi, verify the intended store against its recorded destination, and inspect only the exact key. A pending record does not prove setup completed or ownership of a current grant. If you choose to undo a current true decision, restore the recorded previous value, or remove that key only when no previous entry was recorded. Preserve other current decisions; parent-folder and global trust settings still apply.`].join(`
1537
+ `)}}let u=INe(o.project.canonical,a,$Y.pi.projectConfigPath(o.project.canonical));if(u.kind===`unreadable`)return{action:`kept-unverified`,error:u.error};let d=u.kind===`shared`?u.paths:[],f=[],p=new Map,m=(e,t)=>{let n=p.get(e);if(!n){let t=o9(e);if(t.kind===`refused`){f.push({action:`refused-unreadable`,error:t.error});return}n={trustPath:e,resolved:t,keys:new Map},p.set(e,n)}if(t){if(n.resolved.path!==t.record.canonicalTrustPath){f.push({action:`refused-unreadable`,error:`Pi trust store ${j7(e)} no longer points to its recorded destination ${j7(t.record.canonicalTrustPath)}; restore the intended file location or symlink, then retry`});return}n.keys.set(t.record.cwd,{cwd:t.record.cwd,mode:`recorded`,receipt:t})}};for(let e of l)m(e.record.configuredTrustPath,e);m(i.trustPath);for(let e of p.values()){for(let t of[o.project.canonical,i.cwd])e.keys.has(t)||e.keys.set(t,{cwd:t,mode:`inspect`,receipt:l.find(n=>n.record.cwd===t&&n.record.canonicalTrustPath===e.resolved.path)});f.push(WNe(e,a,d,o.project))}return c9(f)}function l9(e,t){try{return t()}catch(t){throw t instanceof I7?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${j7(j(RJ(e),`pi-trust`))}: ${j7(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function WNe(e,t,n,r){let{trustPath:i,resolved:a}=e,o=[...e.keys.values()];if(!o.some(e=>e.mode===`recorded`)&&a.kind===`missing`)return{action:`not-present`};if(a.kind===`missing`)try{_(k(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${j7(k(a.path))} is unavailable: ${j7(e instanceof Error?e.message:String(e))}. Restore access to its parent directory or mounted drive, then retry; the ownership record was kept.`}}let s=[],c={result:{action:`not-present`}};try{NNe(i,a.path,()=>{let e=n9(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=s9(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=i9(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:a9(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:l9(t,()=>U7(t,e.cwd).find(e=>e.record.canonicalTrustPath===l.path))}));if(d.some(e=>e.receipt&&e.receipt.record.configuredTrustPath!==e.expectedConfiguredPath)){c.result={action:`failed`,error:`The Pi trust ownership record changed during cleanup; retry to read its current location.`};return}for(let e of d){try{GNe(e,t,i,l.path,u,n,r,c)}catch(t){let n=j7(t instanceof Error?t.message:String(t)),r=t instanceof I7?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${j7(JSON.stringify(e.cwd))} in ${j7(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:j7(e instanceof Error?e.message:String(e))})}return c9([...s,c.result])}function GNe(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&l9(t,()=>W7(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${j7(JSON.stringify(c))} entry from ${j7(n)}; parent-folder and global trust settings still apply.`;if(a.length>0&&c===o.canonical){let n=`kept Pi's folder trust because other resources still need it: ${a.slice(0,3).map(e=>j7(JSON.stringify(e))).join(`, `)}${a.length>3?` (+${a.length-3} more)`:``}. ${u} Removing this grant may stop Pi from loading those resources, including any not listed here.`;s.result={action:`kept-shared`,detail:n},l&&e.mode===`recorded`&&l9(t,()=>W7(t,l)),s.result={action:`kept-shared`,detail:`${n} ${l?e.mode===`recorded`?`OpenKnowledge has relinquished this grant and will not revoke it on later cleanup runs.`:`OpenKnowledge kept the existing ownership record; cleanup of its recorded location remains incomplete.`:`OpenKnowledge has no ownership record for this grant and will not revoke it on later cleanup runs.`}`};return}if(e.mode===`inspect`||!l||l.record.state===`pending`){let e=l?l.record.state===`pending`?`its ownership record is pending after an interrupted setup; completion cannot be verified. Re-running setup or cleanup does not reconcile this record while the folder remains trusted.`:`OpenKnowledge must reconcile its recorded location at ${j7(l.record.configuredTrustPath)} before removing it.`:`no OpenKnowledge ownership record exists; this includes every grant made before ownership recording was introduced.`;s.result={action:`kept-unowned`,detail:`${c===o.canonical?`kept Pi's folder trust because ${e}`:`kept a Pi trust entry under a non-canonical project path because ${e} Pi uses the real project directory instead of this key.`} ${u}`};return}let d={...i.entries};l.record.previous.present?d[c]=l.record.previous.value:delete d[c];let f=JSON.stringify(d,null,2)+(i.trailingNewline?`
1538
+ `:``),p=N5(r);VJ(r,f,p===void 0?void 0:{mode:p}),i.entries=d,l9(t,()=>W7(t,l)),s.result={action:`removed`}}function KNe(e){return MY(e)||FY(e)||c5(e)}const u9=10485760;function d9(e,t,n,r=!1){let i=UNe(e,t,n,{recordedOnly:r});switch(i.action){case`removed`:case`not-present`:return{trust:i.action};case`kept-shared`:case`kept-unowned`:return{trust:i.action,trustDetail:i.detail};case`failed`:case`refused-unreadable`:case`kept-unverified`:{let e=r?`Trust cleanup remains incomplete`:`The bridge file was left untouched`;throw Error(`Pi trust cleanup failed (${i.action}):\n${i.error}\n${e} so cleanup can be retried.`)}default:throw Error(`unhandled Pi trust cleanup result: ${i}`)}}function f9(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=d9(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function qNe(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=$7(a);if(o.kind===`not-present`)return f9(e,t,n,i);if(o.kind===`declined`)return o;let s=q5(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return f9(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!KNe(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=d9(t,n,i);try{O(a,{force:!0})}catch(t){throw e.trustDetail?Error(`${t instanceof Error?t.message:String(t)}\n${e.trustDetail}`,{cause:t}):t}return{kind:`removed`,...e}}return e.format===`toml`?XNe(o.path,c):e.format===`yaml`?YNe(o.path,e.topLevelKey,c):JNe(o.path,e.topLevelKey,e.serverMapSubKey,c)}function JNe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}if(Buffer.byteLength(i,`utf-8`)>u9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=mMe(i,z5(t,n,r));return o?(VJ(e,a,{mode:N5(e)}),{kind:`removed`}):{kind:`not-present`}}function YNe(e,t,n){let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}if(Buffer.byteLength(r,`utf-8`)>u9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,xs.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=M5(a);a.trim()===``||a.endsWith(`
1539
1539
  `)?c.endsWith(`
1540
1540
  `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
1541
1541
  `).replace(/\n/g,`\r
1542
- `));let u=`${i?``:``}${c}`;return u!==r&&VJ(e,u,{mode:N5(e)}),{kind:`removed`}}function QNe(e,t){let n=_Y();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=M5(a),s=a.trim()===``||a.endsWith(`
1542
+ `));let u=`${i?``:``}${c}`;return u!==r&&VJ(e,u,{mode:N5(e)}),{kind:`removed`}}function XNe(e,t){let n=_Y();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:A5(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=M5(a),s=a.trim()===``||a.endsWith(`
1543
1543
  `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
1544
1544
  `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
1545
1545
  `).replace(/\n/g,`\r
1546
- `));let u=`${i?``:``}${l}`;return u!==r&&VJ(e,u,{mode:N5(e)}),{kind:`removed`}}function $Ne(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function ePe(e){let{priorCommand:t,priorArgs:n}=p9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function p9(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 m9(e,t,n={}){let r=gje(e,t),i;try{i=S(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??hje()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ve());if(!a||typeof a!=`object`||!gAe(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??r8)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}async function tPe(e,t=void 0){let n=m9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=vje(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function nPe(e,t={}){return{targets:aPe(e,t.isAlive??r8)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}function rPe(e){try{return dt()}catch(t){e?.warn({err:t},`stop channel check skipped: ${t instanceof Error?t.message:String(t)}`);return}}async function iPe(e){let t=e.inspect??(()=>m9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??tPe,o=e.logger??void 0,s=t(),c=nPe(s,{isAlive:e.isAlive});if(c.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};let l=s.status===`alive`||s.status===`foreign-host`?s.lock.channel:void 0;if(e.force!==!0&&typeof l==`string`&&l.length>0){let t=e.selfChannel??rPe(o);if(t!==void 0&&l!==t)return i(`Not stopping: the server at ${e.lockDir} belongs to ${eee(l)}. `+(l===`dev`?`Stop it from that dev build, or run \`${ht} stop\` with OK_CHANNEL=dev set, or re-run with --force to terminate anyway.`:`Stop it from that app or its CLI, or re-run with --force to terminate anyway.`)),o?.warn({lockDir:e.lockDir,holderChannel:l,selfChannel:t,pids:c.targets.map(e=>e.pid)},`stop declined: server belongs to another channel`),{stopped:[],failed:[],hadTargets:!0,declined:{otherChannel:l}}}if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:c.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let u=[],d=[];for(let e of c.targets)try{n(e.pid,`SIGTERM`),u.push(e)}catch(t){d.push({target:e,error:t instanceof Error?t.message:String(t)})}return u.length>0&&r(`Stopped: ${u.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:u.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:d.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),d.length>0&&i(`Failed to stop: ${d.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:u,failed:d,hadTargets:!0}}function aPe(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}function h9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,xs.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return dY(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function oPe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=Zu({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function sPe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=GJ(`user`,t),s=LJ({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=h9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=nd({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?id(i.value):i.value;return t&&a.push(...Tye({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=N(t,`.ok`,`config.yml`),u=c(l,!0),d=c(GJ(`project-local`,t)),f=tae(s.value,u,d),p=jje.safeParse(f);if(!p.success){let e=h9(l),t={code:`SCHEMA_INVALID`,issues:oPe(p.error.issues,e)};throw Error(eae(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function g9(e){return e.replace(/:\d+$/,``)}function _9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function v9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=gc(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function y9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=gc(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function cPe(e){let t=v9(e);if(t)return{kind:`doc`,...t};let n=y9(e);return n?{kind:`folder`,...n}:null}async function lPe(e,t){let n,r;try{n=await Ae(N(e)),r=await Ae(N(k(e)))}catch{return{kind:`not-git`}}if(!b9(n,r))return{kind:`symlink-escape`};let i=j(n,`.git`),a;try{a=te(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Ae(i)}catch{return{kind:`not-git`}}if(!b9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=Gxe(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=_9(c);if(l===null)return{kind:`non-github`};let u=gc(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function b9(e,t){if(e===t)return!0;let n=M(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const uPe=`# >>> open-knowledge cli >>>`,dPe=`# <<< open-knowledge cli <<<`,fPe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function pPe(e){return Dye(dt(),e)}function x9(e,t,n=[]){let r=g(j(e,B8[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function mPe(e,t){let n=vY.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=yt.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:bS}));return[...n,...r]}function S9(e,t,n,r){let i=pOe(e,mPe(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function hPe(e,t){let n=(t??_e()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function gPe(e,t){let n=$Y[e];return U5(n,``,t)&&!H5(n,``,t)}function C9(e,t,n,r,i){let a=$Y[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?hPe(o,r):void 0,c=q5(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&gPe(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];MY(r)&&i.push(`reclaim-permissive`),FY(r)&&i.push(`pre-approval-exact`),J5(e)(r)&&i.push(`injection-functional`);let o=WY(a,n);return i.length>0&&(o!==null&&Ube(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:Rbe(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function _Pe(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Oa(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:x9(j(n,bS),`discovery`,S9(n,vt,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=vt[i];return e===null||n===void 0?null:K8(n).some(e=>e.editorId===i)?x9(j(n,e),`discovery`,S9(n,vt,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=_t[i];return e===null?null:x9(j(t,e),`project`,S9(t,_t,i,`project`))}case`editor-user-config`:return C9(i,e.strictness,t,n);case`editor-project-config`:{let r=$Y[i].projectConfigPath?.(t);return r===void 0?null:C9(i,e.strictness,t,n,r)}}}}[...V8.map(e=>B8[e])];function vPe(e){if(!A(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=N(e);if(t===le||k(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function w9(e){let t=vPe(e),n=[];for(let e of V8){let r=B8[e];n.push({path:j(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of St)n.push({path:j(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function yPe(e,t){let n=[];for(let r of w9(e))if(r.bundleId===t)try{O(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const bPe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=W5(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=_5(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function xPe(e,t,n={},r=bPe){let i=[];for(let a of t){let t=$Y[a];for(let a of r)i.push(a.write(t,e,n))}let a=tMe(e,t);return a&&i.push({integration:`project-skill`,editorId:a.editorId,action:a.action,...a.path?{path:a.path}:{},...a.error?{error:a.error}:{}}),i}function SPe(e,t,n={}){return{integrations:xPe(e,t,n)}}function T9(e,t){let n=vt[e];return n===null?null:j(t,...n.split(`/`),B8.discovery,`SKILL.md`)}function CPe(e,t){let n=T9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!K8(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=W8(`discovery`,{checkDesktop:!0});return p5(k(n),t),{editorId:e,label:e,action:m5(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function wPe(e){return g(j(e,...`.agents/skills`.split(`/`),B8.discovery))?!0:gt.some(t=>{let n=T9(t,e);return n!==null&&g(k(n))})}function TPe(e,t){let n=T9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=k(n);try{return g(n)?(p5(r,t),O(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function EPe(e){return LJ({absPath:GJ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function E9({home:e=_e(),env:t=process.env}={}){let n=EPe(e),{override:r,preferenceList:i}=tbe(t),{locale:a,source:o}=PP({override:r,storedPreference:n,supportedLocales:Kc,preferenceList:i,autoDetectableLocales:Jc});return{preference:n,locale:a,source:o,systemLanguages:i}}function D9(e){let t=new Set([e]);try{t.add(E.native(e))}catch{return[e].filter(e=>e.length>0)}return[...t].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}function O9(e,t){let n=e;for(let e of t)n.includes(e)&&(n=n.split(e).join(`<CONTENT_DIR>`));return n}function DPe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e,t){if(typeof e==`string`)return O9(e,t.contentDirSpellings);if(Array.isArray(e))return e.map(e=>k9(e,t));if(!DPe(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=k9(i,t);return n}function A9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1546
+ `));let u=`${i?``:``}${l}`;return u!==r&&VJ(e,u,{mode:N5(e)}),{kind:`removed`}}function ZNe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function QNe(e){let{priorCommand:t,priorArgs:n}=p9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function p9(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 m9(e,t,n={}){let r=mje(e,t),i;try{i=S(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??pje()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ve());if(!a||typeof a!=`object`||!mAe(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??r8)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}async function $Ne(e,t=void 0){let n=m9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=gje(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function ePe(e,t={}){return{targets:rPe(e,t.isAlive??r8)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}function tPe(e){try{return dt()}catch(t){e?.warn({err:t},`stop channel check skipped: ${t instanceof Error?t.message:String(t)}`);return}}async function nPe(e){let t=e.inspect??(()=>m9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??$Ne,o=e.logger??void 0,s=t(),c=ePe(s,{isAlive:e.isAlive});if(c.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};let l=s.status===`alive`||s.status===`foreign-host`?s.lock.channel:void 0;if(e.force!==!0&&typeof l==`string`&&l.length>0){let t=e.selfChannel??tPe(o);if(t!==void 0&&l!==t)return i(`Not stopping: the server at ${e.lockDir} belongs to ${eee(l)}. `+(l===`dev`?`Stop it from that dev build, or run \`${ht} stop\` with OK_CHANNEL=dev set, or re-run with --force to terminate anyway.`:`Stop it from that app or its CLI, or re-run with --force to terminate anyway.`)),o?.warn({lockDir:e.lockDir,holderChannel:l,selfChannel:t,pids:c.targets.map(e=>e.pid)},`stop declined: server belongs to another channel`),{stopped:[],failed:[],hadTargets:!0,declined:{otherChannel:l}}}if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:c.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let u=[],d=[];for(let e of c.targets)try{n(e.pid,`SIGTERM`),u.push(e)}catch(t){d.push({target:e,error:t instanceof Error?t.message:String(t)})}return u.length>0&&r(`Stopped: ${u.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:u.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:d.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),d.length>0&&i(`Failed to stop: ${d.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:u,failed:d,hadTargets:!0}}function rPe(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}function h9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,xs.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return dY(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function iPe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=Zu({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function aPe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=GJ(`user`,t),s=LJ({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=h9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=nd({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?id(i.value):i.value;return t&&a.push(...Tye({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=N(t,`.ok`,`config.yml`),u=c(l,!0),d=c(GJ(`project-local`,t)),f=tae(s.value,u,d),p=kje.safeParse(f);if(!p.success){let e=h9(l),t={code:`SCHEMA_INVALID`,issues:iPe(p.error.issues,e)};throw Error(eae(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function g9(e){return e.replace(/:\d+$/,``)}function _9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:g9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function v9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=gc(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function y9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=gc(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function oPe(e){let t=v9(e);if(t)return{kind:`doc`,...t};let n=y9(e);return n?{kind:`folder`,...n}:null}async function sPe(e,t){let n,r;try{n=await Ae(N(e)),r=await Ae(N(k(e)))}catch{return{kind:`not-git`}}if(!b9(n,r))return{kind:`symlink-escape`};let i=j(n,`.git`),a;try{a=te(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Ae(i)}catch{return{kind:`not-git`}}if(!b9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=Uxe(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=_9(c);if(l===null)return{kind:`non-github`};let u=gc(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function b9(e,t){if(e===t)return!0;let n=M(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const cPe=`# >>> open-knowledge cli >>>`,lPe=`# <<< open-knowledge cli <<<`,uPe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function dPe(e){return Dye(dt(),e)}function x9(e,t,n=[]){let r=g(j(e,B8[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function fPe(e,t){let n=vY.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=yt.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:bS}));return[...n,...r]}function S9(e,t,n,r){let i=dOe(e,fPe(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function pPe(e,t){let n=(t??_e()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function mPe(e,t){let n=$Y[e];return U5(n,``,t)&&!H5(n,``,t)}function C9(e,t,n,r,i){let a=$Y[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?pPe(o,r):void 0,c=q5(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&mPe(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];MY(r)&&i.push(`reclaim-permissive`),FY(r)&&i.push(`pre-approval-exact`),J5(e)(r)&&i.push(`injection-functional`);let o=WY(a,n);return i.length>0&&(o!==null&&Vbe(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:Ibe(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function hPe(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Oa(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:x9(j(n,bS),`discovery`,S9(n,vt,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=vt[i];return e===null||n===void 0?null:K8(n).some(e=>e.editorId===i)?x9(j(n,e),`discovery`,S9(n,vt,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=_t[i];return e===null?null:x9(j(t,e),`project`,S9(t,_t,i,`project`))}case`editor-user-config`:return C9(i,e.strictness,t,n);case`editor-project-config`:{let r=$Y[i].projectConfigPath?.(t);return r===void 0?null:C9(i,e.strictness,t,n,r)}}}}[...V8.map(e=>B8[e])];function gPe(e){if(!A(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=N(e);if(t===le||k(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function w9(e){let t=gPe(e),n=[];for(let e of V8){let r=B8[e];n.push({path:j(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of St)n.push({path:j(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function _Pe(e,t){let n=[];for(let r of w9(e))if(r.bundleId===t)try{O(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const vPe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=W5(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=_5(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function yPe(e,t,n={},r=vPe){let i=[];for(let a of t){let t=$Y[a];for(let a of r)i.push(a.write(t,e,n))}let a=$je(e,t);return a&&i.push({integration:`project-skill`,editorId:a.editorId,action:a.action,...a.path?{path:a.path}:{},...a.error?{error:a.error}:{}}),i}function bPe(e,t,n={}){return{integrations:yPe(e,t,n)}}function T9(e,t){let n=vt[e];return n===null?null:j(t,...n.split(`/`),B8.discovery,`SKILL.md`)}function xPe(e,t){let n=T9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!K8(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=W8(`discovery`,{checkDesktop:!0});return p5(k(n),t),{editorId:e,label:e,action:m5(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function SPe(e){return g(j(e,...`.agents/skills`.split(`/`),B8.discovery))?!0:gt.some(t=>{let n=T9(t,e);return n!==null&&g(k(n))})}function CPe(e,t){let n=T9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=k(n);try{return g(n)?(p5(r,t),O(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function wPe(e){return LJ({absPath:GJ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function E9({home:e=_e(),env:t=process.env}={}){let n=wPe(e),{override:r,preferenceList:i}=$ye(t),{locale:a,source:o}=PP({override:r,storedPreference:n,supportedLocales:Kc,preferenceList:i,autoDetectableLocales:Jc});return{preference:n,locale:a,source:o,systemLanguages:i}}function D9(e){let t=new Set([e]);try{t.add(E.native(e))}catch{return[e].filter(e=>e.length>0)}return[...t].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}function O9(e,t){let n=e;for(let e of t)n.includes(e)&&(n=n.split(e).join(`<CONTENT_DIR>`));return n}function TPe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e,t){if(typeof e==`string`)return O9(e,t.contentDirSpellings);if(Array.isArray(e))return e.map(e=>k9(e,t));if(!TPe(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=k9(i,t);return n}function A9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1547
1547
  `),i=n.split(`
1548
1548
  `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=k9(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
1549
1549
  `)}\n`:a.join(`
1550
1550
  `);re(e,o)}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1551
1551
  `)?`
1552
- `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}function N9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>j(e,t.name))}catch{return[]}}const OPe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function kPe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}const APe=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function jPe(e){let t={contentDirSpellings:D9(e.contentDir)};for(let n of APe)for(let r of N9(j(e.stagingDir,n)))kPe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(j(e.stagingDir,`state`))){let e=ae(n);n.endsWith(`.jsonl`)?A9(n,t):OPe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function MPe(e){return j(e,...F9,R9)}function NPe(e){return j(e,...F9,z9)}function PPe(e){return j(e,...I9,B9)}function FPe(e){return j(e,...I9,V9)}function IPe(e){return j(e,...L9,H9)}function LPe(e){return j(e,...L9,U9)}const W9=1e3;async function RPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function zPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function BPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function VPe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1553
- `)}\n`:null}catch{return null}}function HPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function UPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function WPe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function GPe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,xs.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function KPe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return KPe(e.maxBytes)}function qPe(e){let t=q9(GJ(`project`,e)),n=q9(GJ(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function JPe(e){return Te(`sha256`).update(e).digest(`hex`)}function X9(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const YPe=[`"doc.name"`,`"docName"`];function XPe(e){let t=S(e,`utf-8`),n=0;for(let e of YPe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(k(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,Z5(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=j(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const ZPe=new Set([`.jsonl`]);function QPe(e){let t=e.lastIndexOf(`.`);return t!==-1&&ZPe.has(e.slice(t))}const $Pe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function eFe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&$Pe.has(e.slice(t))}function tFe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!eFe(r))continue;let{redacted:i,patterns:a,lineCount:o}=BP(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return M(e,t).split(le).join(`/`)}async function nFe(e){let t=N(e.contentDir),n=N(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??RPe,a=r.fetchAgentEffects??zPe,o=r.fetchWatcherRecent??BPe,s=r.readShadowHead??HPe,c=r.readCheckpointRefs??UPe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.86.19-beta.3`),d=r.readDesktopEnv??G9,f=r.readLanguage??E9,p=r.readRuntime??WPe,h=r.isOtlpPushEnabled??GPe,_=y(j(xe(),`ok-bundle-`));try{v(j(_,`telemetry`),{recursive:!0}),v(j(_,`logs`),{recursive:!0}),v(j(_,`state`),{recursive:!0}),Z9(MPe(n),j(_,`telemetry`,R9)),Z9(NPe(n),j(_,`telemetry`,z9)),Z9(PPe(n),j(_,`logs`,B9)),Z9(FPe(n),j(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,j(_,`logs`,ae(t)));for(let t of e.userStateFiles??[])Z9(t,j(_,TJ,ae(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,j(_,`diagnostic-reports`,ae(t)))&&(y+=1);let b=j(n,`.ok`,`local`),x=j(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,j(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(j(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(j(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=VPe(n);e!==null&&re(j(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(j(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(j(_,`state`,`checkpoint-refs.txt`),D),Z9(IPe(n),j(_,`state`,H9)),Z9(LPe(n),j(_,`state`,U9)),Z9(j(b,`last-spawn-error.log`),j(_,`state`,`last-spawn-error.log`)),Z9(j(b,od),j(_,`state`,od)),Z9(j(b,sd),j(_,`state`,sd)),Z9(j(b,ad),j(_,`state`,ad));let ee=p(),ne=d(),ie=f(),k={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(j(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let oe=C===`running`?`running
1554
- `:`not-running (${w})\n`;re(j(_,`state`,`server-status.txt`),oe);let A=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:X5(e.diagnosticReports,y);if(re(j(_,`state`,`diagnostic-reports-status.txt`),`${A}\n`),re(j(_,e7),x7(e.osTerminationEvidence)),e.processDir&&g(e.processDir)){let t=j(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let se=e.redact===!0;se&&jPe({stagingDir:_,contentDir:t}),e.note&&re(j(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=tFe(_));for(let t of e.extraFiles??[]){let e=t.zipName??ae(t.sourcePath);if(!Z9(t.sourcePath,j(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=C7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let M=qPe(n),N=Q9(_),le=[],ue=0,de=0;for(let e of N){let t=$9(_,e),n=te(e).size,r=QPe(t)?X9(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=XPe(e))}let fe={applied:se};ce!==null&&(fe.secretScrub=ce);let P={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:JPe(t),absolutePath:se?`<CONTENT_DIR>`:t},telemetry:{localSink:M,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:le};re(j(_,`manifest.json`),`${JSON.stringify(P,null,2)}\n`);let pe=D9(t),me=N.some(e=>{try{let t=S(e,`utf-8`);return pe.some(e=>t.includes(e))}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:ue,fileCount:le.length,docNameCount:de,contentDirVisible:me,redacted:se},ge=!1;return{stagingDir:_,manifest:P,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function rFe(e){let{collected:t,outputPath:n}=e,r=k(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new DDe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function iFe(e,t){let n=j(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,xs.parse)(S(n,`utf-8`)),r=dY(t)?t.content:void 0,i=dY(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return N(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return N(e)}async function aFe(e,t,n,r,i,a){let o=w7(t,e.logger),s=await nFe({contentDir:iFe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...hNe(o,e.userLogsDir??j(RJ(),`logs`)),...E7(e.cachesDir??j(_e(),`Library`,`Caches`))],userStateFiles:D7(e.bugReportsDir??S7()),diagnosticReports:i,osTerminationEvidence:a,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(k(e.outputPath),{recursive:!0}),await rFe({collected:s,outputPath:e.outputPath});let t=s.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:o,files:s.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:s.manifest.createdAt}}}finally{s.cleanup()}}async function oFe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??E9,i=()=>VMe(e.diagnosticReportsDir??j(_e(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return aFe(e,t,n,r,i(),await b7(e.osTerminationEvidenceDeps));let{zipPath:a,summary:o}=await bNe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:E7(e.cachesDir??j(_e(),`Library`,`Caches`)),bugReportLedgerFiles:D7(e.bugReportsDir??S7()),diagnosticReports:e.level===`full`?i():void 0,osTerminationEvidence:e.level===`full`?await b7(e.osTerminationEvidenceDeps):void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{vY as ALL_EDITOR_IDS,yY as EDITOR_LABELS,$Y as EDITOR_TARGETS,Pbe as HOSTS_WITH_USER_SKILL_DIR,kMe as LAUNCH_CONFIG_NAME,uPe as PATH_SHIM_BEGIN,fPe as PATH_SHIM_BLOCK_RE,dPe as PATH_SHIM_END,u5 as ProjectPathSafetyError,oMe as addOkPathsToGitExclude,d5 as assertProjectPathSafe,PY as buildManagedServerEntry,$Ne as buildMcpConfigDeclineEvent,ePe as buildMcpConfigMigrateEvent,WY as canonicalEntryFor,q5 as classifyExistingMcpEntry,oFe as collectReportBundle,_Pe as createCliProbeResolver,ZJ as createTokenStore,fNe as defaultBugReportZipPath,Ke as detectGh,Ye as detectGhAccounts,NMe as detectInstalledEditors,UY as droppedManagedKeys,txe as editorConfigPathDisplay,exe as editorEntryLocator,HNe as ensurePiBridge,qMe as findJetsamKillSync,T5 as formatTrackedRemediation,lMe as getExcludedOkPaths,C5 as getInstalledSkillProjectionPaths,Nbe as getNativeTomlMcpEditor,S5 as getOkArtifactPaths,MY as isEntryUpToDate,FY as isOwnManagedEntry,sPe as loadConfig,abe as makeLazyProbeTokenStore,S7 as okBugReportsDir,v9 as parseGitHubBlobUrl,cPe as parseGitHubShareUrl,y9 as parseGitHubTreeUrl,_9 as parseGitUrl,pPe as pathInstallMarkerPath,Gje as previewContent,PMe as probeOwnManagedEditorMcpEntry,BNe as probePiBridgeState,w5 as probeTrackedOkPaths,G5 as readExistingMcpEntry,cMe as readSharingMode,BP as redactContent,sMe as removeOkPathsFromGitExclude,YNe as removeOwnMcpEntry,nMe as removeProjectSkill,yPe as removeUserGlobalSkillBundle,TPe as removeUserSkill,Xje as resolveProjectRoot,iPe as runStop,p9 as truncatePriorEntry,w9 as userGlobalSkillBundleTargets,wPe as userSkillPresentAnywhere,lPe as validateLocalFolderForShare,W5 as writeEditorMcpConfig,SPe as writeProjectAiIntegrations,_5 as writeProjectSkill,MMe as writeUserMcpConfigs,CPe as writeUserSkill};
1552
+ `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}function N9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>j(e,t.name))}catch{return[]}}const EPe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function DPe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}const OPe=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function kPe(e){let t={contentDirSpellings:D9(e.contentDir)};for(let n of OPe)for(let r of N9(j(e.stagingDir,n)))DPe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(j(e.stagingDir,`state`))){let e=ae(n);n.endsWith(`.jsonl`)?A9(n,t):EPe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function APe(e){return j(e,...F9,R9)}function jPe(e){return j(e,...F9,z9)}function MPe(e){return j(e,...I9,B9)}function NPe(e){return j(e,...I9,V9)}function PPe(e){return j(e,...L9,H9)}function FPe(e){return j(e,...L9,U9)}const W9=1e3;async function IPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function LPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function RPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function zPe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1553
+ `)}\n`:null}catch{return null}}function BPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function VPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function HPe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function UPe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,xs.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function WPe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return WPe(e.maxBytes)}function GPe(e){let t=q9(GJ(`project`,e)),n=q9(GJ(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function KPe(e){return Te(`sha256`).update(e).digest(`hex`)}function qPe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const JPe=[`"doc.name"`,`"docName"`];function X9(e){let t=S(e,`utf-8`),n=0;for(let e of JPe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(k(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,Z5(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=j(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const YPe=new Set([`.jsonl`]);function XPe(e){let t=e.lastIndexOf(`.`);return t!==-1&&YPe.has(e.slice(t))}const ZPe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function QPe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&ZPe.has(e.slice(t))}function $Pe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!QPe(r))continue;let{redacted:i,patterns:a,lineCount:o}=BP(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return M(e,t).split(le).join(`/`)}async function eFe(e){let t=N(e.contentDir),n=N(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??IPe,a=r.fetchAgentEffects??LPe,o=r.fetchWatcherRecent??RPe,s=r.readShadowHead??BPe,c=r.readCheckpointRefs??VPe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.86.19`),d=r.readDesktopEnv??G9,f=r.readLanguage??E9,p=r.readRuntime??HPe,h=r.isOtlpPushEnabled??UPe,_=y(j(xe(),`ok-bundle-`));try{v(j(_,`telemetry`),{recursive:!0}),v(j(_,`logs`),{recursive:!0}),v(j(_,`state`),{recursive:!0}),Z9(APe(n),j(_,`telemetry`,R9)),Z9(jPe(n),j(_,`telemetry`,z9)),Z9(MPe(n),j(_,`logs`,B9)),Z9(NPe(n),j(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,j(_,`logs`,ae(t)));for(let t of e.userStateFiles??[])Z9(t,j(_,TJ,ae(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,j(_,`diagnostic-reports`,ae(t)))&&(y+=1);let b=j(n,`.ok`,`local`),x=j(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,j(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(j(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(j(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=zPe(n);e!==null&&re(j(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(j(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(j(_,`state`,`checkpoint-refs.txt`),D),Z9(PPe(n),j(_,`state`,H9)),Z9(FPe(n),j(_,`state`,U9)),Z9(j(b,`last-spawn-error.log`),j(_,`state`,`last-spawn-error.log`)),Z9(j(b,od),j(_,`state`,od)),Z9(j(b,sd),j(_,`state`,sd)),Z9(j(b,ad),j(_,`state`,ad));let ee=p(),ne=d(),ie=f(),k={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(j(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let oe=C===`running`?`running
1554
+ `:`not-running (${w})\n`;re(j(_,`state`,`server-status.txt`),oe);let A=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:X5(e.diagnosticReports,y);if(re(j(_,`state`,`diagnostic-reports-status.txt`),`${A}\n`),re(j(_,e7),x7(e.osTerminationEvidence)),e.processDir&&g(e.processDir)){let t=j(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let se=e.redact===!0;se&&kPe({stagingDir:_,contentDir:t}),e.note&&re(j(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=$Pe(_));for(let t of e.extraFiles??[]){let e=t.zipName??ae(t.sourcePath);if(!Z9(t.sourcePath,j(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=C7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let M=GPe(n),N=Q9(_),le=[],ue=0,de=0;for(let e of N){let t=$9(_,e),n=te(e).size,r=XPe(t)?qPe(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=X9(e))}let fe={applied:se};ce!==null&&(fe.secretScrub=ce);let P={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:KPe(t),absolutePath:se?`<CONTENT_DIR>`:t},telemetry:{localSink:M,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:le};re(j(_,`manifest.json`),`${JSON.stringify(P,null,2)}\n`);let pe=D9(t),me=N.some(e=>{try{let t=S(e,`utf-8`);return pe.some(e=>t.includes(e))}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:ue,fileCount:le.length,docNameCount:de,contentDirVisible:me,redacted:se},ge=!1;return{stagingDir:_,manifest:P,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function tFe(e){let{collected:t,outputPath:n}=e,r=k(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new TDe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function nFe(e,t){let n=j(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,xs.parse)(S(n,`utf-8`)),r=dY(t)?t.content:void 0,i=dY(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return N(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return N(e)}async function rFe(e,t,n,r,i,a){let o=w7(t,e.logger),s=await eFe({contentDir:nFe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...pNe(o,e.userLogsDir??j(RJ(),`logs`)),...E7(e.cachesDir??j(_e(),`Library`,`Caches`))],userStateFiles:D7(e.bugReportsDir??S7()),diagnosticReports:i,osTerminationEvidence:a,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(k(e.outputPath),{recursive:!0}),await tFe({collected:s,outputPath:e.outputPath});let t=s.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:o,files:s.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:s.manifest.createdAt}}}finally{s.cleanup()}}async function iFe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??E9,i=()=>zMe(e.diagnosticReportsDir??j(_e(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return rFe(e,t,n,r,i(),await b7(e.osTerminationEvidenceDeps));let{zipPath:a,summary:o}=await vNe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:E7(e.cachesDir??j(_e(),`Library`,`Caches`)),bugReportLedgerFiles:D7(e.bugReportsDir??S7()),diagnosticReports:e.level===`full`?i():void 0,osTerminationEvidence:e.level===`full`?await b7(e.osTerminationEvidenceDeps):void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{vY as ALL_EDITOR_IDS,yY as EDITOR_LABELS,$Y as EDITOR_TARGETS,Mbe as HOSTS_WITH_USER_SKILL_DIR,DMe as LAUNCH_CONFIG_NAME,cPe as PATH_SHIM_BEGIN,uPe as PATH_SHIM_BLOCK_RE,lPe as PATH_SHIM_END,u5 as ProjectPathSafetyError,iMe as addOkPathsToGitExclude,d5 as assertProjectPathSafe,PY as buildManagedServerEntry,ZNe as buildMcpConfigDeclineEvent,QNe as buildMcpConfigMigrateEvent,WY as canonicalEntryFor,q5 as classifyExistingMcpEntry,iFe as collectReportBundle,hPe as createCliProbeResolver,ZJ as createTokenStore,uNe as defaultBugReportZipPath,Ke as detectGh,Ye as detectGhAccounts,jMe as detectInstalledEditors,UY as droppedManagedKeys,$be as editorConfigPathDisplay,Qbe as editorEntryLocator,BNe as ensurePiBridge,GMe as findJetsamKillSync,T5 as formatTrackedRemediation,sMe as getExcludedOkPaths,C5 as getInstalledSkillProjectionPaths,jbe as getNativeTomlMcpEditor,S5 as getOkArtifactPaths,MY as isEntryUpToDate,FY as isOwnManagedEntry,aPe as loadConfig,rbe as makeLazyProbeTokenStore,S7 as okBugReportsDir,v9 as parseGitHubBlobUrl,oPe as parseGitHubShareUrl,y9 as parseGitHubTreeUrl,_9 as parseGitUrl,dPe as pathInstallMarkerPath,Uje as previewContent,MMe as probeOwnManagedEditorMcpEntry,RNe as probePiBridgeState,w5 as probeTrackedOkPaths,G5 as readExistingMcpEntry,oMe as readSharingMode,BP as redactContent,aMe as removeOkPathsFromGitExclude,qNe as removeOwnMcpEntry,eMe as removeProjectSkill,_Pe as removeUserGlobalSkillBundle,CPe as removeUserSkill,Jje as resolveProjectRoot,nPe as runStop,p9 as truncatePriorEntry,w9 as userGlobalSkillBundleTargets,SPe as userSkillPresentAnywhere,sPe as validateLocalFolderForShare,W5 as writeEditorMcpConfig,bPe as writeProjectAiIntegrations,_5 as writeProjectSkill,AMe as writeUserMcpConfigs,xPe as writeUserSkill};
1555
1555
  //# sourceMappingURL=index.mjs.map