@inkeep/open-knowledge 0.68.5 → 0.68.7-beta.0
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.
- package/dist/{acp-harness-probe-CdThI_5J.mjs → acp-harness-probe-CImEzSyM.mjs} +2 -2
- package/dist/cli.mjs +48 -48
- package/dist/config-schema.json +1 -1
- package/dist/config.project-local.schema.json +1 -1
- package/dist/constants-ojQbinxA.mjs +2 -0
- package/dist/{fs-traced-C8gNIaHq.mjs → fs-traced-DgX7lP1u.mjs} +2 -2
- package/dist/fs-traced-Q0dJJRAw.mjs +1 -0
- package/dist/{git-handle-DnoBon5O.mjs → git-handle-C0onz3KH.mjs} +2 -2
- package/dist/git-handle-GcGVb-Kt.mjs +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +171 -170
- package/dist/{init-awwoGR7Q.mjs → init-Bg_ijtfG.mjs} +34 -34
- package/dist/init-CyqTyEph.mjs +1 -0
- package/dist/{launch-json-removal-DBb9lR1z.mjs → launch-json-removal-D2I_RQIb.mjs} +2 -2
- package/dist/loader-D1OGLNCQ.mjs +1 -0
- package/dist/{loader-Ca0nq0TT.mjs → loader-rVQOJDtS.mjs} +2 -2
- package/dist/md-manager--OJ_B4tb.mjs +2 -0
- package/dist/{open-browser-iFLZcDi8.mjs → open-browser-DmtCotYQ.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-Cg27ZlYv.mjs +1 -0
- package/dist/{preview-CDhwt0Oj.mjs → preview-DKOsPDvo.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-CTYc4r-M.js → ActivityModeContent-iAy7Htyr.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-BHzYZdaA.js → AddPropertiesButton-BKA885SM.js} +2 -2
- package/dist/public/assets/{AgentDiffPane-CgDh65X-.js → AgentDiffPane-C7KIvUPF.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-BfzzW91s.js → AgentThreadClientBinder-D1mSPUsr.js} +1 -1
- package/dist/public/assets/{BugReportHistory-BFeDHqqW.js → BugReportHistory-C2-fO6T3.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-BTq3iS9V.js → BugReportHistoryDialog-Cdci6g1O.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-cqsfRNDV.js +3 -0
- package/dist/public/assets/{ConsentDialogBody-e0bDGpfC.js → ConsentDialogBody-BHbzcNb7.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-C_NVhw3Y.js → DiffViewBoundary-BDQV_30P.js} +1 -1
- package/dist/public/assets/DocumentContext-DOMEoUbL.js +38 -0
- package/dist/public/assets/{EditorModeToggle-c5TOBudF.js → EditorModeToggle-cEaO7U1B.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-DiSbCa-4.js → EnableSyncConfirmDialog-CxKyhSRR.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-DoDpRzmC.js → ExcalidrawDocEditor-Bw1wZL5r.js} +1 -1
- package/dist/public/assets/FeedbackForm-D0S2l1ev.js +1 -0
- package/dist/public/assets/{GraphPanel-BUWA0D9J.js → GraphPanel-r8Gqxdvr.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-CdC9Dc5x.js → ImportSkillDialog-BHRZuf__.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Bj_WTICg.js → LintConfigEditor-DaQG-dlP.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-wYlXlIDm.js → ManagedArtifactProperties-BDuoxjvO.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BpjEvg_3.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-ufgVBY_B.js → MermaidDocEditor-DudmyU3i.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BqncBWH_.js → PropertyDisplayRow-C9iyg7W9.js} +1 -1
- package/dist/public/assets/ReportBugDialogBody-t1LnS7cf.js +3 -0
- package/dist/public/assets/{ReportBugMenuTrigger-BTdzj2n4.js → ReportBugMenuTrigger-BaIKHhOn.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-JS9t3cVS.js → SchemaConfigEditor-BLIfeCsm.js} +1 -1
- package/dist/public/assets/{SessionsHost-DuRJyyf0.js → SessionsHost-DuAZF3Zj.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-S8BOIyhs.js → SettingsDialogBody-txHlPNWp.js} +4 -4
- package/dist/public/assets/{ShareBranchSwitchDialog-4R7TrS-D.js → ShareBranchSwitchDialog-CgntPdis.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Cmq2hZPb.js → ShareReceiveDialog-C5Rig4O-.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DHkouI0P.js → ShareReceiveMissDialog-D6-ck0Uu.js} +1 -1
- package/dist/public/assets/{SkillCostValue-DHSmxhI-.js → SkillCostValue-BMSdP6MA.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-B27-_Aay.js → SkillEditBanner-D_nkf6Qd.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-BAZRmLVh.js → SkillForkDialog-D2HU42pf.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-D_8pSxzw.js → SkillInstallMenu-Bcy54X0U.js} +2 -2
- package/dist/public/assets/{SkillOriginInline-BSlC26uH.js → SkillOriginInline-CwgwWmps.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-D7sBmfgp.js → SkillToolbarControls-B8Ab7ngc.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-BxNx9-Fx.js → SlidesToolbarControls-Dz6effyN.js} +1 -1
- package/dist/public/assets/{SourceEditor-Ck_ph2zm.js → SourceEditor-CrOhJB84.js} +1 -1
- package/dist/public/assets/{TerminalPanel-uwQJYmWz.js → TerminalPanel-MpZfhb9K.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CMLGSKlU.js → TerminalWindowApp-BP8AoRew.js} +1 -1
- package/dist/public/assets/{TextDocEditor-BMniHrmA.js → TextDocEditor-BOdJgOXT.js} +1 -1
- package/dist/public/assets/{ThreadView-9Zn6djZ0.js → ThreadView-BsHCDmQB.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CNF7LQC7.js → TimelineDiffPane-DDVqWMSH.js} +1 -1
- package/dist/public/assets/{agent-diff-store-PmNFw1bf.js → agent-diff-store-CQtqUq4i.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DvM3i1AO.js → auth-state-cache-CgquP1B2.js} +4 -4
- package/dist/public/assets/{bug-report-send-manager-TlhphH7d.js → bug-report-send-manager-B4I-UPj9.js} +1 -1
- package/dist/public/assets/client-version-BEh3tGFq.js +1 -0
- package/dist/public/assets/{comment-chips-Dc7VfDxa.js → comment-chips-CNyMXpWs.js} +1 -1
- package/dist/public/assets/config-provider-qLyaitI2.js +5 -0
- package/dist/public/assets/{dist-CMzT53pm.js → dist-D6JA916i.js} +4 -4
- package/dist/public/assets/{doc-hash-CbN6l-bN.js → doc-hash-Dx9hwyex.js} +1 -1
- package/dist/public/assets/{documents-events-BQph4Rf_.js → documents-events-DR8HEJoe.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BpMqjQeh.js → file-tree-adapter-C4gKqxzg.js} +1 -1
- package/dist/public/assets/{file-tree-utils-D3vfryrA.js → file-tree-utils-DGw50SVS.js} +1 -1
- package/dist/public/assets/{folder-config-api-BGqXA_Yc.js → folder-config-api-D4N0ED0-.js} +1 -1
- package/dist/public/assets/{globals-CL98nbsz.css → globals-ByagJMEb.css} +1 -1
- package/dist/public/assets/i18n-Bl2radzN.js +1 -0
- package/dist/public/assets/{index-BvzVFp9A.js → index-r_qRX3GR.js} +14 -14
- package/dist/public/assets/{launcher-selection-Q4ZIQ0VB.js → launcher-selection-BZDeoOtN.js} +1 -1
- package/dist/public/assets/{lint-config-client-nUUp3gxC.js → lint-config-client-DBF47lRL.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-Dw2Ln--S.js → markdownlint-rule-browser-CF1tj7Rc.js} +1 -1
- package/dist/public/assets/messages-6fcD2J3f.js +1 -0
- package/dist/public/assets/messages-BcgMON4t.js +1 -0
- package/dist/public/assets/messages-BfSRfllp.js +1 -0
- package/dist/public/assets/messages-BzB2vjb8.js +1 -0
- package/dist/public/assets/messages-CFC4xaZ5.js +1 -0
- package/dist/public/assets/messages-CHyeSnWa.js +1 -0
- package/dist/public/assets/messages-DZE-VzhB.js +1 -0
- package/dist/public/assets/messages-DZfszRg3.js +1 -0
- package/dist/public/assets/messages-DnatZmOM.js +1 -0
- package/dist/public/assets/messages-DrjcM4fb.js +1 -0
- package/dist/public/assets/messages-DvrupXSr.js +1 -0
- package/dist/public/assets/messages-DwrUkQ2i.js +1 -0
- package/dist/public/assets/page-list-cache-DZPKVqeA.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-CZWELP1p.js → pending-receive-nav-store-BwS0HcBd.js} +1 -1
- package/dist/public/assets/{progress-Bcz6XuxC.js → progress-CzJ7mESr.js} +3 -3
- package/dist/public/assets/{project-paths-5B1myPxo.js → project-paths-BGMK3dxo.js} +1 -1
- package/dist/public/assets/{prop-types-BkTKnQXu.js → prop-types-gfjew8MI.js} +1 -1
- package/dist/public/assets/{receive-store-BQjSh3hv.js → receive-store-OL80o-sI.js} +1 -1
- package/dist/public/assets/{selection-context-hxGStP38.js → selection-context-DI5wlbAC.js} +1 -1
- package/dist/public/assets/{skill-scope-QdZW9jQB.js → skill-scope-D9dg7q4P.js} +1 -1
- package/dist/public/assets/{skills-api-_0gvQ7uH.js → skills-api-BU5k9WYz.js} +1 -1
- package/dist/public/assets/{src-AID8LMTH.js → src-CgbeuLkc.js} +1 -1
- package/dist/public/assets/{startup-marks-BrgDU-FF.js → startup-marks-Ml5LD4ks.js} +1 -1
- package/dist/public/assets/{tag-pill-input-ORi2pYBF.js → tag-pill-input-vfk8h50K.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BE1C7c1m.js → target-navigation-intent-Dpq3EXpz.js} +1 -1
- package/dist/public/assets/{telemetry-impl-VsKSwoCW.js → telemetry-impl-CPT6yQPK.js} +1 -1
- package/dist/public/assets/{telemetry-startup-CqPO3R20.js → telemetry-startup-BmgX6zXI.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-BBkrKOa9.js → terminal-cli-display-XU6hL6_q.js} +1 -1
- package/dist/public/assets/{terminal-command-events-De5Ifk_s.js → terminal-command-events-DBrAYz2u.js} +1 -1
- package/dist/public/assets/typing-burst-detector-CFwuUzqv.js +8 -0
- package/dist/public/assets/{uninstall-3URh0Jfo.js → uninstall-DAfbja6D.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DueILXKJ.js → use-activity-panel-DDXrfY-K.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-B7J-6HE8.js → use-apply-config-color-theme-D-13D2Xt.js} +1 -1
- package/dist/public/assets/{use-collab-url-2h75iiK6.js → use-collab-url-CqeAlJNl.js} +1 -1
- package/dist/public/assets/{use-conflicts-aEERGkga.js → use-conflicts-CXDbJNoF.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-tJoPOgqZ.js → use-live-xterm-theme-aXDStBRf.js} +1 -1
- package/dist/public/assets/{use-open-skill-CIPHnSEU.js → use-open-skill--yVdWHLf.js} +1 -1
- package/dist/public/assets/{use-settings-route-DwMidANO.js → use-settings-route-WFqgyKMc.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BCC3l5H8.js → use-skill-origin-M6b5sY_s.js} +1 -1
- package/dist/public/assets/{use-skills-rVlSdbIJ.js → use-skills-dKHpTH68.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BfHLzUUx.js → use-terminal-enabled-DWnQ-hY2.js} +1 -1
- package/dist/public/assets/use-timeline-entry-diff-BLDu0nkY.js +6 -0
- package/dist/public/assets/{use-workspace-BzePm1UL.js → use-workspace-DAuqjfCS.js} +1 -1
- package/dist/public/index.html +52 -52
- package/dist/public/uninstall.html +6 -6
- package/dist/{repair-launch-json-ZKrEoixC.mjs → repair-launch-json-CbptI-SC.mjs} +2 -2
- package/dist/{repair-mcp-configs-6TjePRwI.mjs → repair-mcp-configs-DJ580q99.mjs} +2 -2
- package/dist/{repair-skills-BEtsD-_R.mjs → repair-skills-TrS-7N9q.mjs} +2 -2
- package/dist/repair-skills-zn5HSgoM.mjs +1 -0
- package/dist/{resolve-project-root-GuD0zdTB.mjs → resolve-project-root-CLNohNKz.mjs} +3 -3
- package/dist/schemas/v0/config.project-local.schema.json +1 -1
- package/dist/server-lock-D-DD35fh.mjs +1 -0
- package/dist/{server-lock-BIDrb6q3.mjs → server-lock-DKS1ePB3.mjs} +2 -2
- package/dist/{skill-teardown-Bk4eOAS-.mjs → skill-teardown-DvGC-0MI.mjs} +2 -2
- package/dist/{sleep-CFk6IVkN.mjs → sleep-zea4v2sB.mjs} +2 -2
- package/dist/{src-CDcerRX2.mjs → src-B2bAQ64a.mjs} +4 -4
- package/dist/src-B8bduDrv.mjs +21 -0
- package/dist/src-BTBVMfJ4.mjs +2045 -0
- package/dist/src-BYxFlKxM.mjs +1 -0
- package/dist/src-C4D-_N3T.mjs +1 -0
- package/dist/start-BzoiQEDW.mjs +5 -0
- package/dist/start-qmtydMW_.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-Dwg2z20_.mjs +0 -2
- package/dist/fs-traced-CMCYO7L0.mjs +0 -1
- package/dist/git-handle-CgzfmB2x.mjs +0 -1
- package/dist/init-qLxpt9pm.mjs +0 -1
- package/dist/loader-BltYx1K9.mjs +0 -1
- package/dist/md-manager-BcWiy3AP.mjs +0 -2
- package/dist/preview-C6v9I-o4.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-CI296ELX.js +0 -3
- package/dist/public/assets/DocumentContext-Dc72CCLX.js +0 -38
- package/dist/public/assets/FeedbackForm-BUzq3_LW.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CuGR3_vr.js +0 -1
- package/dist/public/assets/ReportBugDialogBody-CmxYVKGf.js +0 -3
- package/dist/public/assets/client-version-DgAHPE5j.js +0 -1
- package/dist/public/assets/config-provider-CgKzlU66.js +0 -5
- package/dist/public/assets/i18n-BDM0SfuE.js +0 -1
- package/dist/public/assets/messages-BCDzGZ-z.js +0 -1
- package/dist/public/assets/messages-BIKExws8.js +0 -1
- package/dist/public/assets/messages-BRuH4eGg.js +0 -1
- package/dist/public/assets/messages-BbmzhhGy.js +0 -1
- package/dist/public/assets/messages-Bm1_dKft.js +0 -1
- package/dist/public/assets/messages-CgeWrYpD.js +0 -1
- package/dist/public/assets/messages-CpNH27MF.js +0 -1
- package/dist/public/assets/messages-CrOuHdVj.js +0 -1
- package/dist/public/assets/messages-D-KzxOns.js +0 -1
- package/dist/public/assets/messages-Do2oL-dp.js +0 -1
- package/dist/public/assets/messages-JDwxbJeu.js +0 -1
- package/dist/public/assets/messages-Yj8SVZjn.js +0 -1
- package/dist/public/assets/page-list-cache-D2uEX_G6.js +0 -1
- package/dist/public/assets/typing-burst-detector-BY6dOLpb.js +0 -8
- package/dist/public/assets/use-timeline-entry-diff-Qs4mKP9p.js +0 -6
- package/dist/repair-skills-DMUMX0Fe.mjs +0 -1
- package/dist/server-lock-C1GmzCcn.mjs +0 -1
- package/dist/src-DEeDpkHD.mjs +0 -1
- package/dist/src-DXMPKJnx.mjs +0 -2045
- package/dist/src-G8KmzYRf.mjs +0 -1
- package/dist/src-hS3R1miu.mjs +0 -20
- package/dist/start-Df0HIk3X.mjs +0 -1
- package/dist/start-idTf0Cy-.mjs +0 -5
- /package/dist/public/assets/{globals-QZHWoM5P.js → globals-DIT-uAXH.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,r as n,t as r}from"./chunk-DTipWd-i.mjs";import{A as i,At as a,Ct as o,Dt as s,E as c,Et as l,Ft as u,G as d,Gt as f,Ht as p,It as m,Jt as h,Kt as g,L as _,Lt as v,Mt as y,P as b,Rt as x,T as S,Ut as C,Vt as w,Wt as T,X as E,Z as D,Zt as O,at as ee,ct as te,et as ne,jt as re,kt as k,lt as ie,mt as ae,nt as oe,q as A,r as se,rt as ce,tt as le,v as j,x as M,yt as ue,zt as N}from"./sleep-
|
|
1
|
+
import{i as e,o as t,r as n,t as r}from"./chunk-DTipWd-i.mjs";import{A as i,At as a,Ct as o,Dt as s,E as c,Et as l,Ft as u,G as d,Gt as f,Ht as p,It as m,Jt as h,Kt as g,L as _,Lt as v,Mt as y,P as b,Rt as x,T as S,Ut as C,Vt as w,Wt as T,X as E,Z as D,Zt as O,at as ee,ct as te,et as ne,jt as re,kt as k,lt as ie,mt as ae,nt as oe,q as A,r as se,rt as ce,tt as le,v as j,x as M,yt as ue,zt as N}from"./sleep-zea4v2sB.mjs";import{n as de,t as fe}from"./markdownit-BNz2xGu4.mjs";import P from"node:path";import pe from"node:process";import{fileURLToPath as me}from"node:url";import{access as he,accessSync as ge,readFile as F,readFileSync as _e}from"node:fs";import{EOL as ve,homedir as ye}from"node:os";function be(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Se(e.position):`start`in e||`end`in e?Se(e):`line`in e||`column`in e?xe(e):``}function xe(e){return Ce(e&&e.line)+`:`+Ce(e&&e.column)}function Se(e){return xe(e&&e.start)+`-`+xe(e&&e.end)}function Ce(e){return e&&typeof e==`number`?e:1}var we=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=be(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};we.prototype.file=``,we.prototype.name=``,we.prototype.reason=``,we.prototype.message=``,we.prototype.stack=``,we.prototype.column=void 0,we.prototype.line=void 0,we.prototype.ancestors=void 0,we.prototype.cause=void 0,we.prototype.fatal=void 0,we.prototype.place=void 0,we.prototype.ruleId=void 0,we.prototype.source=void 0;var Te=t(r(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``;break}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
|
|
2
2
|
`,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``;break}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&`).replace(o,`<`).replace(s,`>`).replace(c,`¶<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`;break}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0;break}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length;break}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o)if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p);break}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
|
|
3
3
|
`),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
|
|
4
4
|
`],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `;break}n[s+1]=o+encodeURI(this.diffs[s][1])+`
|
|
@@ -16,7 +16,7 @@ import{i as e,o as t,r as n,t as r}from"./chunk-DTipWd-i.mjs";import{A as i,At a
|
|
|
16
16
|
`,Math.max(0,t-1))+1,r=e.indexOf(`
|
|
17
17
|
`,t);return e.slice(n,r===-1?e.length:r)}function jt(e,t,n){let r=At(e,t);return r===null?`absent`:Ot(r,n===1)}function Mt(e,t,n){if(n<=1||t>e.length)return`absent`;let r=e.lastIndexOf(`
|
|
18
18
|
`,Math.max(0,t-1)),i=n;for(;r>0;){let t=e.lastIndexOf(`
|
|
19
|
-
`,r-1)+1,n=e.slice(t,r);if(i--,n.trim()!==``)return Ot(n,i===1);r=t-1}return`absent`}function Nt(e){return e>=2?e:0}function Pt(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n=t.replace(/^\n+/,``);return n.replace(/\n+$/,``).length===0?{leading:0,trailing:0}:{leading:Nt(t.length-n.length),trailing:Nt(n.length-n.replace(/\n+$/,``).length-1)}}function Ft(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function It(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:Nt(t.leading.length),i=n.length===0||t.trailing===void 0?0:Nt(t.trailing.length-1);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(Ft(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(Ft(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}const Lt=/^(?:\r?\n)+/;function Rt(e){return Pt(e).leading>0}function eee(e){let t=Rt(e);return{project:e=>Vt(e,t),unproject:(e,n)=>Ht(e,n,t)}}function zt(e,t){if(t)return{boundary:``,text:e};let{frontmatter:n,body:r}=He(e),i=r.match(Lt);if(!i)return{boundary:``,text:e};let a=r.slice(i[0].length);return n===``&&Ve.test(a)?{boundary:``,text:e}:{boundary:i[0],text:n+a}}function Bt(e,t){if(t===``)return e;let{frontmatter:n,body:r}=He(e);return n+t+r}function Vt(e,t){if(t)return e;let n=zt(e,t).text;return He(n).frontmatter===``?n:Bt(n,`
|
|
19
|
+
`,r-1)+1,n=e.slice(t,r);if(i--,n.trim()!==``)return Ot(n,i===1);r=t-1}return`absent`}function Nt(e,t){return e>=(t===`leading`?2:1)?e:0}function Pt(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n=t.replace(/^\n+/,``);return n.replace(/\n+$/,``).length===0?{leading:0,trailing:0}:{leading:Nt(t.length-n.length,`leading`),trailing:Nt(n.length-n.replace(/\n+$/,``).length-1,`trailing`)}}function Ft(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function It(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:Nt(t.leading.length,`leading`),i=n.length===0||t.trailing===void 0?0:Nt(t.trailing.length-1,`trailing`);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(Ft(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(Ft(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}const Lt=/^(?:\r?\n)+/;function Rt(e){return Pt(e).leading>0}function eee(e){let t=Rt(e);return{project:e=>Vt(e,t),unproject:(e,n)=>Ht(e,n,t)}}function zt(e,t){if(t)return{boundary:``,text:e};let{frontmatter:n,body:r}=He(e),i=r.match(Lt);if(!i)return{boundary:``,text:e};let a=r.slice(i[0].length);return n===``&&Ve.test(a)?{boundary:``,text:e}:{boundary:i[0],text:n+a}}function Bt(e,t){if(t===``)return e;let{frontmatter:n,body:r}=He(e);return n+t+r}function Vt(e,t){if(t)return e;let n=zt(e,t).text;return He(n).frontmatter===``?n:Bt(n,`
|
|
20
20
|
`)}function Ht(e,t,n){return n?e:Bt(zt(e,n).text,zt(t,n).boundary)}function Ut(e,t){if(e===``)return{slot:``,body:t};let n=t.match(/^\r?\n/);return n?{slot:n[0],body:t.slice(n[0].length)}:{slot:``,body:t}}function Wt(e){let{frontmatter:t,body:n}=He(e);if(t===``)return Pt(e);let r=Ut(t,n).body;return/^\n*$/.test(r)?Pt(e):Pt(r)}function Gt(e,t){let n=Wt(e),r=Wt(t);return n.leading!==r.leading||n.trailing!==r.trailing}function Kt(e,t=16){let n=e.trim();return n.length<t?!1:!(n.startsWith(`<`)||n.startsWith("```")||n.startsWith(`|`))}function qt(e,t=16){let n=new Map;for(let r of e.split(`
|
|
21
21
|
`)){if(!Kt(r,t))continue;let e=r.trim();n.set(e,(n.get(e)??0)+1)}return n}function Jt(e,t,n=16){let r=qt(t,n),i=[];for(let[t,a]of qt(e,n))a>=2&&a>(r.get(t)??0)&&i.push(t);return i}function Yt(e){let t=new Map;for(let n of e.split(`
|
|
22
22
|
`))n.trim()!==``&&t.set(n,(t.get(n)??0)+1);return t}function Xt(e,t,n){let r=Yt(e),i=Yt(t),a=Yt(n);for(let[e,t]of r)if(t>(i.get(e)??0)&&t>(a.get(e)??0))return!0;return!1}function Zt(e,t,n){let r=Yt(e),i=Yt(t),a=Yt(n),o=[];for(let[e,t]of r)t>(i.get(e)??0)&&t>(a.get(e)??0)&&o.push(e);return o}function Qt(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++){let r=t[e];n[r]?n[r].push(e):n[r]=[e]}let r=[{buffer1index:-1,buffer2index:-1,chain:null}];for(let t=0;t<e.length;t++){let i=n[e[t]]||[],a=0,o=r[0];for(let e of i){let n;for(n=a;n<r.length&&!(r[n].buffer2index<e&&(n===r.length-1||r[n+1].buffer2index>e));n++);if(n<r.length){let i={buffer1index:t,buffer2index:e,chain:r[n]};if(a===r.length?r.push(o):r[a]=o,a=n+1,o=i,a===r.length)break}}r[a]=o}return r[r.length-1]}function $t(e,t){let n=Qt(e,t),r=[],i=e.length,a=t.length;for(let o=n;o!==null;o=o.chain){let n=i-o.buffer1index-1,s=a-o.buffer2index-1;i=o.buffer1index,a=o.buffer2index,(n||s)&&r.push({buffer1:[i+1,n],buffer1Content:e.slice(i+1,i+1+n),buffer2:[a+1,s],buffer2Content:t.slice(a+1,a+1+s)})}return r.reverse(),r}function en(e,t,n){let r=[];function i(e,t){r.push({ab:t,oStart:e.buffer1[0],oLength:e.buffer1[1],abStart:e.buffer2[0],abLength:e.buffer2[1]})}$t(t,e).forEach(e=>i(e,`a`)),$t(t,n).forEach(e=>i(e,`b`)),r.sort((e,t)=>e.oStart-t.oStart);let a=[],o=0;function s(e){e>o&&(a.push({stable:!0,buffer:`o`,bufferStart:o,bufferLength:e-o,bufferContent:t.slice(o,e)}),o=e)}for(;r.length;){let i=r.shift(),c=i.oStart,l=i.oStart+i.oLength,u=[i];for(s(c);r.length;){let e=r[0],t=e.oStart;if(t>l)break;l=Math.max(l,t+e.oLength),u.push(r.shift())}if(u.length===1){if(i.abLength>0){let t=i.ab===`a`?e:n;a.push({stable:!0,buffer:i.ab,bufferStart:i.abStart,bufferLength:i.abLength,bufferContent:t.slice(i.abStart,i.abStart+i.abLength)})}}else{let r={a:[e.length,-1,t.length,-1],b:[n.length,-1,t.length,-1]};for(;u.length;){i=u.shift();let e=i.oStart,t=e+i.oLength,n=i.abStart,a=n+i.abLength,o=r[i.ab];o[0]=Math.min(n,o[0]),o[1]=Math.max(a,o[1]),o[2]=Math.min(e,o[2]),o[3]=Math.max(t,o[3])}let o=r.a[0]+(c-r.a[2]),s=r.a[1]+(l-r.a[3]),d=r.b[0]+(c-r.b[2]),f=r.b[1]+(l-r.b[3]),p={stable:!1,aStart:o,aLength:s-o,aContent:e.slice(o,s),oStart:c,oLength:l-c,oContent:t.slice(c,l),bStart:d,bLength:f-d,bContent:n.slice(d,f)};a.push(p)}o=l}return s(t.length),a}function tn(e,t,n,r){r=Object.assign({excludeFalseConflicts:!0,stringSeparator:/\s+/},r),typeof e==`string`&&(e=e.split(r.stringSeparator)),typeof t==`string`&&(t=t.split(r.stringSeparator)),typeof n==`string`&&(n=n.split(r.stringSeparator));let i=[],a=en(e,t,n),o=[];function s(){o.length&&i.push({ok:o}),o=[]}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return a.forEach(e=>{e.stable?o.push(...e.bufferContent):r.excludeFalseConflicts&&c(e.aContent,e.bContent)?o.push(...e.aContent):(s(),i.push({conflict:{a:e.aContent,aIndex:e.aStart,o:e.oContent,oIndex:e.oStart,b:e.bContent,bIndex:e.bStart}}))}),s(),i}const nn=new Te.default;nn.Match_Threshold=.5;function rn(e,t,n){let r=an(e,t,n);return dn(e,t,n,r),r}function an(e,t,n){if(e===t)return n;if(e===n||t===n)return t;let r=tn(t.split(`
|
|
@@ -192,7 +192,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
192
192
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Kx,this.editor.getAttributes(qx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=E_({find:Jx,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=E_({find:Jx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(qx)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Xx=/^\s*(\[([( |x])?\])\s$/,Zx=B_.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,qh(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>R_(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Jh(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[E_({find:Xx,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Qx=B_.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,qh(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
193
193
|
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=L_(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=L_(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});d_.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Ox.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(kx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Bx.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Yx.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Zx.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Qx.configure(this.options.taskList)),e}});var $x=` `,eS=`\xA0`,tS=B_.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,qh(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===$x||n[0].text===$x||n[0].raw===eS||n[0].text===eS)&&r.length===1&&r[0].type===`text`&&(r[0].text===$x||r[0].text===eS)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?$x:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,iS=n_.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,qh(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[C_({find:nS,type:this.type})]},addPasteRules(){return[V_({find:rS,type:this.type})]}}),aS=iS,oS=B_.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),sS=n_.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,qh(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cS=sS;function lS(e={}){return new qc({view(t){return new uS(t,e)}})}var uS=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=pc(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},dS=class e extends Pc{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):Pc.near(r)}content(){return L.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new fS(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!mS(e)||!hS(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!z.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};dS.prototype.visible=!1,dS.findFrom=dS.findGapCursorFrom,Pc.jsonID(`gapcursor`,dS);var fS=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return dS.valid(t)?new dS(t):Pc.near(t)}};function pS(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function mS(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||pS(e.type))return!0;if(e.inlineContent)return!1}}return!0}function hS(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||pS(e.type))return!0;if(e.inlineContent)return!1}}return!0}function gS(){return new qc({props:{decorations:xS,createSelectionBetween(e,t,n){return t.pos==n.pos&&dS.valid(n)?new dS(n):null},handleClick:yS,handleKeyDown:_S,handleDOMEvents:{beforeinput:bS}}})}const _S=gm({ArrowLeft:vS(`horiz`,-1),ArrowRight:vS(`horiz`,1),ArrowUp:vS(`vert`,-1),ArrowDown:vS(`vert`,1)});function vS(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof R){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=dS.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new dS(c))),!0):!1}}function yS(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!dS.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&z.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new dS(r))),!0)}function bS(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof dS))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=I.empty;for(let e=r.length-1;e>=0;e--)i=I.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new L(i,0,0));return a.setSelection(R.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function xS(e){if(!(e.selection instanceof dS))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,hp.create(e.doc,[fp.widget(e.selection.head,t,{key:`gapcursor`})])}var SS=200,CS=function(){};CS.prototype.append=function(e){return e.length?(e=CS.from(e),!this.length&&e||e.length<SS&&this.leafAppend(e)||this.length<SS&&e.leafPrepend(this)||this.appendInner(e)):this},CS.prototype.prepend=function(e){return e.length?CS.from(e).append(this):this},CS.prototype.appendInner=function(e){return new TS(this,e)},CS.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?CS.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},CS.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},CS.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},CS.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},CS.from=function(e){return e instanceof CS?e:e&&e.length?new wS(e):CS.empty};var wS=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=SS)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=SS)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(CS);CS.empty=new wS([]);var TS=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(CS),ES=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new OS(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new OS(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new OS(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>AS&&(s=DS(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Ms;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new OS(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new OS(i,o,l))}else r.push(new OS(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new OS(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new OS(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(CS.from(i.reverse()),a)}};ES.empty=new ES(CS.empty,0);function DS(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var OS=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},kS=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}};const AS=20;function jS(e,t,n,r){let i=n.getMeta(zS),a;if(i)return i.historyState;n.getMeta(BS)&&(e=new kS(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(zS))return o.getMeta(zS).redo?new kS(e.done.addTransform(n,void 0,r,RS(t)),e.undone,NS(n.mapping.maps),e.prevTime,e.prevComposition):new kS(e.done,e.undone.addTransform(n,void 0,r,RS(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!MS(n,e.prevRanges)),s=o?PS(e.prevRanges,n.mapping):NS(n.mapping.maps);return new kS(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,RS(t)),ES.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new kS(e.done.rebased(n,a),e.undone.rebased(n,a),PS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new kS(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),PS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function MS(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function NS(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function PS(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function FS(e,t,n){let r=RS(t),i=zS.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new kS(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(zS,{redo:n,historyState:c})}let IS=!1,LS=null;function RS(e){let t=e.plugins;if(LS!=t){IS=!1,LS=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){IS=!0;break}}return IS}const zS=new Xc(`history`),BS=new Xc(`closeHistory`);function VS(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new qc({key:zS,state:{init(){return new kS(ES.empty,ES.empty,null,0,-1)},apply(t,n,r){return jS(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?US:n==`historyRedo`?WS:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function HS(e,t){return(n,r)=>{let i=zS.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=FS(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}const US=HS(!1,!0),WS=HS(!0,!0);d_.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new qc({key:new Xc(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var GS=d_.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[lS(this.options)]}});d_.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new qc({key:new Xc(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return hp.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(fp.node(t,t+e.nodeSize,{class:this.options.className}))}),hp.create(e,a)}}})]}});var KS=d_.create({name:`gapCursor`,addProseMirrorPlugins(){return[gS()]},extendNodeSchema(e){return{allowGapCursor:Vh(B(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),qS=`placeholder`;function JS(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}d_.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:qS,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${JS(this.options.dataAttribute)}`:`data-${qS}`;return[new qc({key:new Xc(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&xg(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=fp.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),hp.create(t,a)}}})]}}),d_.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new qc({key:new Xc(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Sg(n.selection)||e.view.dragging?null:hp.create(n.doc,[fp.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function YS({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var XS=d_.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Xc(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new qc({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!YS({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!YS({node:r,types:n})}}})]}}),ZS=d_.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>US(e,t),redo:()=>({state:e,dispatch:t})=>WS(e,t)}},addProseMirrorPlugins(){return[VS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),QS=d_.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(Q_.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(mx.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Ox.configure(this.options.bulletList)),this.options.code!==!1&&e.push(vx.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(G_.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(bx.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(GS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(KS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(dv.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(pv.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(ZS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(xx.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(iv.configure(this.options.italic)),this.options.listItem!==!1&&e.push(kx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Bx.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Nv.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Yx.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(tS.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(iS.configure(this.options.strike)),this.options.text!==!1&&e.push(oS.configure(this.options.text)),this.options.underline!==!1&&e.push(sS.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(XS.configure(this.options?.trailingNode)),e}});const $S=hx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),eC=yx.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),tC=B_.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),nC=n_.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),rC=d_.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function iC(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function aC(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function oC(e){let{selection:t}=e;return t instanceof R?t.$cursor:null}function sC(e){let t=oC(e);if(!t||t.parentOffset!==0)return!1;let n=iC(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:aC(t.node(n-1).child(r-1))}function cC(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function lC(e){let t=oC(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=iC(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=cC(t,n);return r!==null&&r<n}const uC=d_.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!sC(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return el(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!lC(e.state))return!1;let{state:t,view:n}=e;return tl(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),dC=d_.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new qc({key:new Xc(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
|
|
194
194
|
|
|
195
|
-
`)}})]}}),fC=n_.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function pC(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||mC(n)===r?!0:Nr(e)===t}function mC(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const hC=aS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),gC=fx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),_C=Zb.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),vC=Qb.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),yC=B_.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:lv,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),bC=/^(?:---|—-|___\s|\*\*\*\s)$/;function xC(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const SC=Sx.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[w_({find:bC,type:this.type,getAttributes:e=>({sourceRaw:xC(e)})})]}}),CC=cS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function wC(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function TC(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const EC=B_.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:lv,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=wC(e.attrs.alias),i=wC(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},TC({target:n,alias:r,anchor:i})]}});function DC(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function OC(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const kC=[xv,iy,Sv,ry,EC,B_.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:lv,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=wC(e.attrs.alias),i=wC(e.attrs.anchor),a=wC(e.attrs.resolvedSrc),o=DC(n);if(ie.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},OC({target:n,alias:r,anchor:i})]}}),yC,ty,ny,av,ov,hC,CC,eC,K_,$S,mv,SC,Bv,hv,Vv,fv,sv,rC,fC,dC,QS.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),uC,gC.configure({resizable:!0}),$b,vC,_C,bv.configure({inline:!0}),gv,sy,nC,tC,uv,cv];function AC(e){let{frontmatter:t}=He(e);if(t===``)return null;let n;try{let e=(0,tt.parseDocument)(We(t));if(e.errors.length>0)return null;n=e.toJS()}catch{return null}return typeof n!=`object`||!n||Array.isArray(n)?null:n}const jC=/^[a-zA-Z0-9][\w/-]*$/;function MC(e){return e.startsWith(`#`)?e.slice(1):e}function NC(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function PC(e){if(!e||e.trim()===``)return[];let{map:t}=rt(e);if(!t)return[];let n=NC(t.tags),r=[];for(let e of n){let t=MC(e);jC.test(t)&&r.push(t)}return r}const FC=N({changes:k(y(`kind`,[N({key:C(),kind:m(`added`),after:Ie}).loose(),N({key:C(),kind:m(`removed`),before:Ie}).loose(),N({key:C(),kind:m(`changed`),before:Ie,after:Ie}).loose()])),unparseable:N({before:C(),after:C()}).loose().nullable()}).loose();function IC(e){let{fenced:t}=lt(e),n=dt(t);if(n.map===null)return{fenced:t,map:{},keys:[],parseError:n.parseError};let r=ct(n.doc);return{fenced:t,map:n.map,keys:r.length>0?r:Object.keys(n.map),parseError:void 0}}function LC(e,t){let n=IC(e),r=IC(t);if(n.parseError!==void 0||r.parseError!==void 0)return{changes:[],unparseable:{before:n.fenced,after:r.fenced}};let i=[],a=new Set;for(let e of r.keys){if(a.has(e))continue;a.add(e);let t=r.map[e];if(t===void 0)continue;let o=n.map[e];if(o===void 0){i.push({key:e,kind:`added`,after:t});continue}Be(o,t)||i.push({key:e,kind:`changed`,before:o,after:t})}for(let e of n.keys){if(a.has(e))continue;a.add(e);let t=n.map[e];t!==void 0&&i.push({key:e,kind:`removed`,before:t})}return{changes:i,unparseable:null}}function RC(e,t){switch(e){case`darwin`:return[`/opt/homebrew/bin`,`/usr/local/bin`,`/opt/local/bin`,`${t}/.local/bin`,`${t}/.asdf/shims`,`${t}/.local/share/mise/shims`];case`win32`:return[];default:return[`/usr/local/bin`,`/home/linuxbrew/.linuxbrew/bin`,`${t}/.local/bin`,`${t}/.asdf/shims`,`${t}/.local/share/mise/shims`]}}function zC(e,t,n){let r=n.delimiter,i=(e??``).split(r).filter(e=>e.length>0),a=new Set(i),o=[];for(let e of t)!a.has(e)&&n.isDir(e)&&(a.add(e),o.push(e));return[...i,...o].join(r)}function BC(e,t){return zC(e,RC(t.platform,t.homeDir),t)}function VC(e,t){switch(e){case`darwin`:return[`${t}/Library/pnpm`,`${t}/.bun/bin`,`${t}/.volta/bin`,`${t}/.yarn/bin`,`${t}/.npm-global/bin`];case`win32`:return[];default:return[`${t}/.local/share/pnpm`,`${t}/.bun/bin`,`${t}/.volta/bin`,`${t}/.yarn/bin`,`${t}/.npm-global/bin`]}}function HC(e,t){return zC(e,[...RC(t.platform,t.homeDir),...VC(t.platform,t.homeDir)],t)}function UC(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${ja}`,[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${ja}__${e}`),`${UC(`mcp_servers.${ja}.default_tools_approval_mode="approve"`)}`,3072-WC("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function WC(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function GC(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const KC=new Set([`opencode.json`]),qC=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function JC(e){return qC.test(e)}function YC(e){return JC(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:KC.has(e.slice(e.lastIndexOf(`/`)+1))}function XC(e,t){let n=GC(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const ZC=C().superRefine(XC).optional(),QC=C().superRefine(XC),$C={agentId:C().optional(),agentName:C().optional(),colorSeed:C().optional(),clientName:C().optional(),clientVersion:C().optional(),label:C().optional()},ew=C().optional(),tw=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,nw=y(`kind`,[N({kind:m(`doc`),docPath:C().min(1)}).loose(),N({kind:m(`folder`),folderPath:C()}).loose()]),rw=l([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),iw=l([`current`,`stale`,`absent`,`empty`]),aw=y(`ok`,[N({ok:m(!0),shareUrl:C().min(1),sharedUrl:C().min(1),branch:C().min(1),freshness:iw.optional().catch(void 0)}).loose(),N({ok:m(!1),error:rw,branch:C().min(1).optional()}).loose()]),ow=l([`user`,`org`]),sw=N({login:C().min(1),kind:ow,avatarUrl:C().optional()}).loose(),cw=l([`auth-required`,`network`]),lw=y(`ok`,[N({ok:m(!0),owners:k(sw)}).loose(),N({ok:m(!1),error:cw}).loose()]),uw=y(`ok`,[N({ok:m(!0),available:a()}).loose(),N({ok:m(!1),error:cw}).loose()]),dw=l([`public`,`private`]),fw=N({owner:C().min(1),name:C().min(1),visibility:dw,description:C().optional()}).loose(),pw=l([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),mw=y(`ok`,[N({ok:m(!0),ownerLogin:C().min(1),repoName:C().min(1),cloneUrl:C().min(1),defaultBranch:C().min(1)}).loose(),N({ok:m(!1),error:pw}).loose()]);function hw(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const gw=e=>e.refine(hw,`invalid branch name`);function _w(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const vw=[/could not read (username|password)/i,/terminal prompts disabled/i,/user interactivity has been disabled/i,/unable to get password from user/i],yw=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],bw=[/permission denied.*\(publickey\)/i,/host key verification failed/i],xw=/fatal:.*repository.*not found/i,Sw=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,xw];function Cw(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function ww(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${Cw(e)}`;return vw.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:yw.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:bw.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Sw.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:xw.test(t)?{kind:`auth`,subclass:`not-found-as-identity`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function Tw(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const Ew={shareTargetExists:a(),dirtyConflicts:N({conflicts:a(),files:k(C().min(1))}).loose(),branchIsLocal:a(),shareTargetOnOriginBranch:a().optional()},Dw=y(`detached`,[N({detached:m(!1),currentBranch:C().min(1).nullable(),currentHeadSha:s(),...Ew}).loose(),N({detached:m(!0),currentBranch:s(),currentHeadSha:C().min(1),...Ew}).loose()]),Ow=N({branch:gw(C().min(1)),principalId:C().optional(),fastForward:a().optional()}).loose(),kw=l([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]),Aw=y(`ok`,[N({ok:m(!0)}).loose(),N({ok:m(!1),reason:kw,files:k(C().min(1)).optional(),otherWorktreePath:C().min(1).optional()}).loose()]);l([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const jw=N({branch:gw(C().min(1)),path:C(),kind:l([`doc`,`folder`]),contentRootDepth:x().int().min(1).max(65535).optional()}).loose(),Mw=y(`verdict`,[N({verdict:m(`on-origin`)}).loose(),N({verdict:m(`renamed`),renamedTo:C().min(1)}).loose(),N({verdict:m(`deleted`)}).loose(),N({verdict:m(`never-on-branch`)}).loose(),N({verdict:m(`changed-locally`)}).loose(),N({verdict:m(`unknown`)}).loose()]).catch({verdict:`unknown`}),Nw=N({startedAt:C().min(1),httpListenMs:x().nonnegative().optional(),seedWalkMs:x().nonnegative().optional(),indexesMs:x().nonnegative().optional(),readyMs:x().nonnegative().optional(),fileCount:x().nonnegative().optional()}),Pw=N({serverInstanceId:C().min(1),currentBranch:C().min(1).optional(),currentDiskAckSVs:p(C().min(1),C().min(1)).optional(),boot:Nw.optional(),collabClients:x().int().nonnegative().optional()}).loose(),Fw=N({id:C().min(1),display_name:C().min(1),display_email:C(),source:l([`git-config`,`synthesized`]),created_at:C().min(1)}).loose(),Iw=N({collabUrl:C().nullable(),previewUrl:C().nullable(),port:x(),singleFile:a().default(!1)}).loose(),Lw=l(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`));function Rw(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const zw=N({type:Lw,title:C().min(1),status:x().int().min(400).max(599),instance:C().regex(tw,`instance must be urn:uuid:<uuid>`).optional(),detail:C().optional()}).loose(),Bw=N({parentDocName:C().min(1),placement:l([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:C().min(1).optional(),agentName:C().min(1).optional()}).loose(),Vw=N({src:C().min(1),path:C().min(1).optional(),deduped:a().optional()}).loose(),Hw=N({url:C().min(1),dir:C().min(1),branch:C().min(1).refine(hw,`invalid branch name`).optional()}).loose(),Uw=N({type:m(`error`),problem:zw}).loose();function Ww(e,t){let n=t.map(e=>[se(e),e]);for(let t of e){let e=se(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Gw(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ww([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ww(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const Kw=[`.ok`,`local`,`installed-skills.json`],qw=l(Hi),Jw=v({hosts:k(C()),scope:qw,scripts:a(),installedAt:h(),projection:l([`symlink`,`copy`]).optional(),contentHash:C().optional()}),Yw=v({schema:m(1),skills:p(C(),Jw).default({})});function Xw(){return{schema:1,skills:{}}}function Zw(e){let t;try{t=JSON.parse(e)}catch{return null}let n=Yw.safeParse(t);return n.success?n.data:null}const Qw=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],$w=Qw.map(e=>e.name);function eT(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
195
|
+
`)}})]}}),fC=n_.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function pC(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||mC(n)===r?!0:Nr(e)===t}function mC(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const hC=aS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),gC=fx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),_C=Zb.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),vC=Qb.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),yC=B_.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:lv,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),bC=/^(?:---|—-|___\s|\*\*\*\s)$/;function xC(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const SC=Sx.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[w_({find:bC,type:this.type,getAttributes:e=>({sourceRaw:xC(e)})})]}}),CC=cS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function wC(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function TC(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const EC=B_.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:lv,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=wC(e.attrs.alias),i=wC(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},TC({target:n,alias:r,anchor:i})]}});function DC(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function OC(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const kC=[xv,iy,Sv,ry,EC,B_.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:lv,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:wC(e.getAttribute(`data-alias`)),anchor:wC(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=wC(e.attrs.alias),i=wC(e.attrs.anchor),a=wC(e.attrs.resolvedSrc),o=DC(n);if(ie.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},OC({target:n,alias:r,anchor:i})]}}),yC,ty,ny,av,ov,hC,CC,eC,K_,$S,mv,SC,Bv,hv,Vv,fv,sv,rC,fC,dC,QS.configure({trailingNode:!1,undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),uC,gC.configure({resizable:!0}),$b,vC,_C,bv.configure({inline:!0}),gv,sy,nC,tC,uv,cv];function AC(e){let{frontmatter:t}=He(e);if(t===``)return null;let n;try{let e=(0,tt.parseDocument)(We(t));if(e.errors.length>0)return null;n=e.toJS()}catch{return null}return typeof n!=`object`||!n||Array.isArray(n)?null:n}const jC=/^[a-zA-Z0-9][\w/-]*$/;function MC(e){return e.startsWith(`#`)?e.slice(1):e}function NC(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function PC(e){if(!e||e.trim()===``)return[];let{map:t}=rt(e);if(!t)return[];let n=NC(t.tags),r=[];for(let e of n){let t=MC(e);jC.test(t)&&r.push(t)}return r}const FC=N({changes:k(y(`kind`,[N({key:C(),kind:m(`added`),after:Ie}).loose(),N({key:C(),kind:m(`removed`),before:Ie}).loose(),N({key:C(),kind:m(`changed`),before:Ie,after:Ie}).loose()])),unparseable:N({before:C(),after:C()}).loose().nullable()}).loose();function IC(e){let{fenced:t}=lt(e),n=dt(t);if(n.map===null)return{fenced:t,map:{},keys:[],parseError:n.parseError};let r=ct(n.doc);return{fenced:t,map:n.map,keys:r.length>0?r:Object.keys(n.map),parseError:void 0}}function LC(e,t){let n=IC(e),r=IC(t);if(n.parseError!==void 0||r.parseError!==void 0)return{changes:[],unparseable:{before:n.fenced,after:r.fenced}};let i=[],a=new Set;for(let e of r.keys){if(a.has(e))continue;a.add(e);let t=r.map[e];if(t===void 0)continue;let o=n.map[e];if(o===void 0){i.push({key:e,kind:`added`,after:t});continue}Be(o,t)||i.push({key:e,kind:`changed`,before:o,after:t})}for(let e of n.keys){if(a.has(e))continue;a.add(e);let t=n.map[e];t!==void 0&&i.push({key:e,kind:`removed`,before:t})}return{changes:i,unparseable:null}}function RC(e,t){switch(e){case`darwin`:return[`/opt/homebrew/bin`,`/usr/local/bin`,`/opt/local/bin`,`${t}/.local/bin`,`${t}/.asdf/shims`,`${t}/.local/share/mise/shims`];case`win32`:return[];default:return[`/usr/local/bin`,`/home/linuxbrew/.linuxbrew/bin`,`${t}/.local/bin`,`${t}/.asdf/shims`,`${t}/.local/share/mise/shims`]}}function zC(e,t,n){let r=n.delimiter,i=(e??``).split(r).filter(e=>e.length>0),a=new Set(i),o=[];for(let e of t)!a.has(e)&&n.isDir(e)&&(a.add(e),o.push(e));return[...i,...o].join(r)}function BC(e,t){return zC(e,RC(t.platform,t.homeDir),t)}function VC(e,t){switch(e){case`darwin`:return[`${t}/Library/pnpm`,`${t}/.bun/bin`,`${t}/.volta/bin`,`${t}/.yarn/bin`,`${t}/.npm-global/bin`];case`win32`:return[];default:return[`${t}/.local/share/pnpm`,`${t}/.bun/bin`,`${t}/.volta/bin`,`${t}/.yarn/bin`,`${t}/.npm-global/bin`]}}function HC(e,t){return zC(e,[...RC(t.platform,t.homeDir),...VC(t.platform,t.homeDir)],t)}function UC(e){return`'${e.replace(/'/g,`'\\''`)}'`}`${ja}`,[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${ja}__${e}`),`${UC(`mcp_servers.${ja}.default_tools_approval_mode="approve"`)}`,3072-WC("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function WC(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function GC(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const KC=new Set([`opencode.json`]),qC=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function JC(e){return qC.test(e)}function YC(e){return JC(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:KC.has(e.slice(e.lastIndexOf(`/`)+1))}function XC(e,t){let n=GC(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const ZC=C().superRefine(XC).optional(),QC=C().superRefine(XC),$C={agentId:C().optional(),agentName:C().optional(),colorSeed:C().optional(),clientName:C().optional(),clientVersion:C().optional(),label:C().optional()},ew=C().optional(),tw=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,nw=y(`kind`,[N({kind:m(`doc`),docPath:C().min(1)}).loose(),N({kind:m(`folder`),folderPath:C()}).loose()]),rw=l([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),iw=l([`current`,`stale`,`absent`,`empty`]),aw=y(`ok`,[N({ok:m(!0),shareUrl:C().min(1),sharedUrl:C().min(1),branch:C().min(1),freshness:iw.optional().catch(void 0)}).loose(),N({ok:m(!1),error:rw,branch:C().min(1).optional()}).loose()]),ow=l([`user`,`org`]),sw=N({login:C().min(1),kind:ow,avatarUrl:C().optional()}).loose(),cw=l([`auth-required`,`network`]),lw=y(`ok`,[N({ok:m(!0),owners:k(sw)}).loose(),N({ok:m(!1),error:cw}).loose()]),uw=y(`ok`,[N({ok:m(!0),available:a()}).loose(),N({ok:m(!1),error:cw}).loose()]),dw=l([`public`,`private`]),fw=N({owner:C().min(1),name:C().min(1),visibility:dw,description:C().optional()}).loose(),pw=l([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),mw=y(`ok`,[N({ok:m(!0),ownerLogin:C().min(1),repoName:C().min(1),cloneUrl:C().min(1),defaultBranch:C().min(1)}).loose(),N({ok:m(!1),error:pw}).loose()]);function hw(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const gw=e=>e.refine(hw,`invalid branch name`);function _w(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const vw=[/could not read (username|password)/i,/terminal prompts disabled/i,/user interactivity has been disabled/i,/unable to get password from user/i],yw=[/insufficient scopes/i,/missing.*scope/i,/required scope/i],bw=[/permission denied.*\(publickey\)/i,/host key verification failed/i],xw=/fatal:.*repository.*not found/i,Sw=[/\b(401|403)\b/,/authentication failed/i,/authorization failed/i,/invalid credentials/i,/credential helper/i,/bad credentials/i,/token.*expired/i,/expired.*token/i,xw];function Cw(e){if(typeof e!=`object`||!e)return``;let t=e.git;return t==null?``:String(t)}function ww(e){if(e==null)return{kind:`non-auth`};let t=`${e instanceof Error?e.message:String(e)}\n${Cw(e)}`;return vw.some(e=>e.test(t))?{kind:`auth`,subclass:`no-credential`}:yw.some(e=>e.test(t))?{kind:`auth`,subclass:`scope-mismatch`}:bw.some(e=>e.test(t))?{kind:`auth`,subclass:`ssh-auth`}:Sw.some(e=>e.test(t))?/\b401\b/.test(t)||/token.*expired/i.test(t)?{kind:`auth`,subclass:`401`}:/\b403\b/.test(t)?{kind:`auth`,subclass:`403`}:xw.test(t)?{kind:`auth`,subclass:`not-found-as-identity`}:{kind:`auth`,subclass:`unknown-auth`}:{kind:`non-auth`}}function Tw(e){return e.kind===`auth`?e.subclass===`no-credential`||e.subclass===`401`||e.subclass===`unknown-auth`:!1}const Ew={shareTargetExists:a(),dirtyConflicts:N({conflicts:a(),files:k(C().min(1))}).loose(),branchIsLocal:a(),shareTargetOnOriginBranch:a().optional()},Dw=y(`detached`,[N({detached:m(!1),currentBranch:C().min(1).nullable(),currentHeadSha:s(),...Ew}).loose(),N({detached:m(!0),currentBranch:s(),currentHeadSha:C().min(1),...Ew}).loose()]),Ow=N({branch:gw(C().min(1)),principalId:C().optional(),fastForward:a().optional()}).loose(),kw=l([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]),Aw=y(`ok`,[N({ok:m(!0)}).loose(),N({ok:m(!1),reason:kw,files:k(C().min(1)).optional(),otherWorktreePath:C().min(1).optional()}).loose()]);l([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]);const jw=N({branch:gw(C().min(1)),path:C(),kind:l([`doc`,`folder`]),contentRootDepth:x().int().min(1).max(65535).optional()}).loose(),Mw=y(`verdict`,[N({verdict:m(`on-origin`)}).loose(),N({verdict:m(`renamed`),renamedTo:C().min(1)}).loose(),N({verdict:m(`deleted`)}).loose(),N({verdict:m(`never-on-branch`)}).loose(),N({verdict:m(`changed-locally`)}).loose(),N({verdict:m(`unknown`)}).loose()]).catch({verdict:`unknown`}),Nw=N({startedAt:C().min(1),httpListenMs:x().nonnegative().optional(),seedWalkMs:x().nonnegative().optional(),indexesMs:x().nonnegative().optional(),readyMs:x().nonnegative().optional(),fileCount:x().nonnegative().optional()}),Pw=N({serverInstanceId:C().min(1),currentBranch:C().min(1).optional(),currentDiskAckSVs:p(C().min(1),C().min(1)).optional(),boot:Nw.optional(),collabClients:x().int().nonnegative().optional()}).loose(),Fw=N({id:C().min(1),display_name:C().min(1),display_email:C(),source:l([`git-config`,`synthesized`]),created_at:C().min(1)}).loose(),Iw=N({collabUrl:C().nullable(),previewUrl:C().nullable(),port:x(),singleFile:a().default(!1)}).loose(),Lw=l(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`));function Rw(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const zw=N({type:Lw,title:C().min(1),status:x().int().min(400).max(599),instance:C().regex(tw,`instance must be urn:uuid:<uuid>`).optional(),detail:C().optional()}).loose(),Bw=N({parentDocName:C().min(1),placement:l([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:C().min(1).optional(),agentName:C().min(1).optional()}).loose(),Vw=N({src:C().min(1),path:C().min(1).optional(),deduped:a().optional()}).loose(),Hw=N({url:C().min(1),dir:C().min(1),branch:C().min(1).refine(hw,`invalid branch name`).optional()}).loose(),Uw=N({type:m(`error`),problem:zw}).loose();function Ww(e,t){let n=t.map(e=>[se(e),e]);for(let t of e){let e=se(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Gw(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ww([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ww(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const Kw=[`.ok`,`local`,`installed-skills.json`],qw=l(Hi),Jw=v({hosts:k(C()),scope:qw,scripts:a(),installedAt:h(),projection:l([`symlink`,`copy`]).optional(),contentHash:C().optional()}),Yw=v({schema:m(1),skills:p(C(),Jw).default({})});function Xw(){return{schema:1,skills:{}}}function Zw(e){let t;try{t=JSON.parse(e)}catch{return null}let n=Yw.safeParse(t);return n.success?n.data:null}const Qw=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],$w=Qw.map(e=>e.name);function eT(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
196
196
|
`).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of Qw)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
|
|
197
197
|
`),patterns:[...t],lineCount:n}}function tT(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
|
|
198
198
|
`)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}const nT={};function rT(e,t){let n=t||nT;return iT(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function iT(e,t,n){if(oT(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return aT(e.children,t,n)}return Array.isArray(e)?aT(e,t,n):``}function aT(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=iT(e[i],t,n);return r.join(``)}function oT(e){return!!(e&&typeof e==`object`)}const sT={AElig:`Æ`,AMP:`&`,Aacute:`Á`,Abreve:`Ă`,Acirc:`Â`,Acy:`А`,Afr:`𝔄`,Agrave:`À`,Alpha:`Α`,Amacr:`Ā`,And:`⩓`,Aogon:`Ą`,Aopf:`𝔸`,ApplyFunction:``,Aring:`Å`,Ascr:`𝒜`,Assign:`≔`,Atilde:`Ã`,Auml:`Ä`,Backslash:`∖`,Barv:`⫧`,Barwed:`⌆`,Bcy:`Б`,Because:`∵`,Bernoullis:`ℬ`,Beta:`Β`,Bfr:`𝔅`,Bopf:`𝔹`,Breve:`˘`,Bscr:`ℬ`,Bumpeq:`≎`,CHcy:`Ч`,COPY:`©`,Cacute:`Ć`,Cap:`⋒`,CapitalDifferentialD:`ⅅ`,Cayleys:`ℭ`,Ccaron:`Č`,Ccedil:`Ç`,Ccirc:`Ĉ`,Cconint:`∰`,Cdot:`Ċ`,Cedilla:`¸`,CenterDot:`·`,Cfr:`ℭ`,Chi:`Χ`,CircleDot:`⊙`,CircleMinus:`⊖`,CirclePlus:`⊕`,CircleTimes:`⊗`,ClockwiseContourIntegral:`∲`,CloseCurlyDoubleQuote:`”`,CloseCurlyQuote:`’`,Colon:`∷`,Colone:`⩴`,Congruent:`≡`,Conint:`∯`,ContourIntegral:`∮`,Copf:`ℂ`,Coproduct:`∐`,CounterClockwiseContourIntegral:`∳`,Cross:`⨯`,Cscr:`𝒞`,Cup:`⋓`,CupCap:`≍`,DD:`ⅅ`,DDotrahd:`⤑`,DJcy:`Ђ`,DScy:`Ѕ`,DZcy:`Џ`,Dagger:`‡`,Darr:`↡`,Dashv:`⫤`,Dcaron:`Ď`,Dcy:`Д`,Del:`∇`,Delta:`Δ`,Dfr:`𝔇`,DiacriticalAcute:`´`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,DiacriticalGrave:"`",DiacriticalTilde:`˜`,Diamond:`⋄`,DifferentialD:`ⅆ`,Dopf:`𝔻`,Dot:`¨`,DotDot:`⃜`,DotEqual:`≐`,DoubleContourIntegral:`∯`,DoubleDot:`¨`,DoubleDownArrow:`⇓`,DoubleLeftArrow:`⇐`,DoubleLeftRightArrow:`⇔`,DoubleLeftTee:`⫤`,DoubleLongLeftArrow:`⟸`,DoubleLongLeftRightArrow:`⟺`,DoubleLongRightArrow:`⟹`,DoubleRightArrow:`⇒`,DoubleRightTee:`⊨`,DoubleUpArrow:`⇑`,DoubleUpDownArrow:`⇕`,DoubleVerticalBar:`∥`,DownArrow:`↓`,DownArrowBar:`⤓`,DownArrowUpArrow:`⇵`,DownBreve:`̑`,DownLeftRightVector:`⥐`,DownLeftTeeVector:`⥞`,DownLeftVector:`↽`,DownLeftVectorBar:`⥖`,DownRightTeeVector:`⥟`,DownRightVector:`⇁`,DownRightVectorBar:`⥗`,DownTee:`⊤`,DownTeeArrow:`↧`,Downarrow:`⇓`,Dscr:`𝒟`,Dstrok:`Đ`,ENG:`Ŋ`,ETH:`Ð`,Eacute:`É`,Ecaron:`Ě`,Ecirc:`Ê`,Ecy:`Э`,Edot:`Ė`,Efr:`𝔈`,Egrave:`È`,Element:`∈`,Emacr:`Ē`,EmptySmallSquare:`◻`,EmptyVerySmallSquare:`▫`,Eogon:`Ę`,Eopf:`𝔼`,Epsilon:`Ε`,Equal:`⩵`,EqualTilde:`≂`,Equilibrium:`⇌`,Escr:`ℰ`,Esim:`⩳`,Eta:`Η`,Euml:`Ë`,Exists:`∃`,ExponentialE:`ⅇ`,Fcy:`Ф`,Ffr:`𝔉`,FilledSmallSquare:`◼`,FilledVerySmallSquare:`▪`,Fopf:`𝔽`,ForAll:`∀`,Fouriertrf:`ℱ`,Fscr:`ℱ`,GJcy:`Ѓ`,GT:`>`,Gamma:`Γ`,Gammad:`Ϝ`,Gbreve:`Ğ`,Gcedil:`Ģ`,Gcirc:`Ĝ`,Gcy:`Г`,Gdot:`Ġ`,Gfr:`𝔊`,Gg:`⋙`,Gopf:`𝔾`,GreaterEqual:`≥`,GreaterEqualLess:`⋛`,GreaterFullEqual:`≧`,GreaterGreater:`⪢`,GreaterLess:`≷`,GreaterSlantEqual:`⩾`,GreaterTilde:`≳`,Gscr:`𝒢`,Gt:`≫`,HARDcy:`Ъ`,Hacek:`ˇ`,Hat:`^`,Hcirc:`Ĥ`,Hfr:`ℌ`,HilbertSpace:`ℋ`,Hopf:`ℍ`,HorizontalLine:`─`,Hscr:`ℋ`,Hstrok:`Ħ`,HumpDownHump:`≎`,HumpEqual:`≏`,IEcy:`Е`,IJlig:`IJ`,IOcy:`Ё`,Iacute:`Í`,Icirc:`Î`,Icy:`И`,Idot:`İ`,Ifr:`ℑ`,Igrave:`Ì`,Im:`ℑ`,Imacr:`Ī`,ImaginaryI:`ⅈ`,Implies:`⇒`,Int:`∬`,Integral:`∫`,Intersection:`⋂`,InvisibleComma:``,InvisibleTimes:``,Iogon:`Į`,Iopf:`𝕀`,Iota:`Ι`,Iscr:`ℐ`,Itilde:`Ĩ`,Iukcy:`І`,Iuml:`Ï`,Jcirc:`Ĵ`,Jcy:`Й`,Jfr:`𝔍`,Jopf:`𝕁`,Jscr:`𝒥`,Jsercy:`Ј`,Jukcy:`Є`,KHcy:`Х`,KJcy:`Ќ`,Kappa:`Κ`,Kcedil:`Ķ`,Kcy:`К`,Kfr:`𝔎`,Kopf:`𝕂`,Kscr:`𝒦`,LJcy:`Љ`,LT:`<`,Lacute:`Ĺ`,Lambda:`Λ`,Lang:`⟪`,Laplacetrf:`ℒ`,Larr:`↞`,Lcaron:`Ľ`,Lcedil:`Ļ`,Lcy:`Л`,LeftAngleBracket:`⟨`,LeftArrow:`←`,LeftArrowBar:`⇤`,LeftArrowRightArrow:`⇆`,LeftCeiling:`⌈`,LeftDoubleBracket:`⟦`,LeftDownTeeVector:`⥡`,LeftDownVector:`⇃`,LeftDownVectorBar:`⥙`,LeftFloor:`⌊`,LeftRightArrow:`↔`,LeftRightVector:`⥎`,LeftTee:`⊣`,LeftTeeArrow:`↤`,LeftTeeVector:`⥚`,LeftTriangle:`⊲`,LeftTriangleBar:`⧏`,LeftTriangleEqual:`⊴`,LeftUpDownVector:`⥑`,LeftUpTeeVector:`⥠`,LeftUpVector:`↿`,LeftUpVectorBar:`⥘`,LeftVector:`↼`,LeftVectorBar:`⥒`,Leftarrow:`⇐`,Leftrightarrow:`⇔`,LessEqualGreater:`⋚`,LessFullEqual:`≦`,LessGreater:`≶`,LessLess:`⪡`,LessSlantEqual:`⩽`,LessTilde:`≲`,Lfr:`𝔏`,Ll:`⋘`,Lleftarrow:`⇚`,Lmidot:`Ŀ`,LongLeftArrow:`⟵`,LongLeftRightArrow:`⟷`,LongRightArrow:`⟶`,Longleftarrow:`⟸`,Longleftrightarrow:`⟺`,Longrightarrow:`⟹`,Lopf:`𝕃`,LowerLeftArrow:`↙`,LowerRightArrow:`↘`,Lscr:`ℒ`,Lsh:`↰`,Lstrok:`Ł`,Lt:`≪`,Map:`⤅`,Mcy:`М`,MediumSpace:` `,Mellintrf:`ℳ`,Mfr:`𝔐`,MinusPlus:`∓`,Mopf:`𝕄`,Mscr:`ℳ`,Mu:`Μ`,NJcy:`Њ`,Nacute:`Ń`,Ncaron:`Ň`,Ncedil:`Ņ`,Ncy:`Н`,NegativeMediumSpace:``,NegativeThickSpace:``,NegativeThinSpace:``,NegativeVeryThinSpace:``,NestedGreaterGreater:`≫`,NestedLessLess:`≪`,NewLine:`
|
|
@@ -357,4 +357,4 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
357
357
|
`);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=k9(n.join(`
|
|
358
358
|
`))[O9];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
|
|
359
359
|
`).replace(/\n+$/,``)}}function j9(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=He(t);if(n===``)return{identity:{},starterContent:t};let i=We(n),a=Ane(i);if(a)return{identity:a.identity,starterContent:A9(a.docFrontmatterText,r)};let{frontmatter:o}=He(r);if(o!==``)return{identity:k9(i),starterContent:r};let s=k9(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:A9(i,r)}}function jne(e,t){let{docFrontmatterText:n,markdown:r}=kne(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,tt.stringify)({[O9]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function Mne(e){return j9(e).starterContent}const M9=e=>e*8+4;M9(92),M9(40);const Nne=/^(#{1,6})\s+(.+)$/;function Pne(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(Nne);if(!n)return null;let r=n[2].trim(),i=j1(r,t);return i?{level:n[1].length,text:r,slug:i}:null}Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const Fne={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},Ine=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],Lne={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function Rne(e,t=Ine){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const zne={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function N9(e){return e?zne[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const Bne={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function Vne(e){let t=e?.trim();return t?Bne[N9(t)]??t:`Agent`}function P9(e){if(!e.includes(`%`))return e;let t;try{t=decodeURIComponent(e)}catch{return e}return t===`.`||t===`..`||t.includes(`/`)||t.includes(`\\`)||t.includes(`\0`)?e:t}function F9(e){return e===`.`||e===`..`?e:encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.codePointAt(0)?.toString(16).toUpperCase()}`)}function Hne(e){return e.split(`/`).map(F9).join(`/`)}function I9(e){return e.split(`/`).map(P9).join(`/`)}function L9(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=P9(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=`.${(s[1]??``).toLowerCase()}`;if(!sa.includes(e))return null}let c=o.startsWith(`/`),l=c?o.slice(1):o,u=c?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[],d=l.split(`/`),f=d.length-1;for(let e=0;e<d.length;e++){let t=P9(d[e]??``);if(e===f&&(t=Ki(t)),t===`..`){if(u.length===0)return null;u.pop()}else t!==`.`&&t!==``&&u.push(t)}return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}function Une(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}const R9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function z9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function B9(e){let t=e.trim();return R9.test(t)||t.startsWith(`//`)}function Wne(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(B9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=I9(r<0?n:n.slice(0,r)),a=Zi(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=Xi(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=L9(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=z9(i);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c,literal:!1}:null}function V9(e,t){let n=e.trim();if(!n)return null;if(B9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=z9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r,literal:!0}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Gne(e,t,n){let r=e.trim();if(!r||R9.test(r)||r.startsWith(`//`)||r.startsWith(`#`))return null;let i=r.indexOf(`#`),a=((i>=0?r.slice(0,i):r).split(`?`)[0]??``).trim();if(!a)return null;let o=a.startsWith(`/`),s=o?a.slice(1):a,c=o?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of s.split(`/`))if(e===`..`){if(c.length===0)return null;c.pop()}else e!==`.`&&e!==``&&c.push(n.literal?e:P9(e));return c.length===0?null:c.join(`/`)}function H9(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function U9(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function W9(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function G9(e){return e.split(`/`).filter(e=>e!==``)}function Kne(e,t){let n=W9(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function K9(e,t){let n=W9(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:G9(r).length}function q9(e,t){let n=G9(e),r=G9(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function qne(){let e=new Map;function t(t){let n=H9(t);if(n===``)return;let r=U9(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=H9(t),r=U9(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=W9(H9(n)),o=[],s=[];for(let e of i)Kne(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=K9(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=K9(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=q9(a,W9(t));for(let r=1;r<e.length;r++){let i=e[r],o=q9(a,W9(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function Jne(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function Yne(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function J9(e){let t=e?.trim();return t===void 0||t===``?void 0:t}function Xne(e){return e.reason!==void 0||J9(e.note)!==void 0||J9(e.email)!==void 0}function Zne(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol===`https:`)return t;let n=t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`;return t.protocol===`http:`&&n?t:null}function Qne(){return Zne((typeof process>`u`?void 0:J9(process.env?.OK_FEEDBACK_INTAKE_ORIGIN))??`https://openknowledge.ai`)}function $ne(e){let t=J9(e);if(t!==void 0)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?t:void 0}async function Y9(e,t,n){try{let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(n)});if(r.ok){let e=await r.json().catch(()=>null);return{ok:!0,reference:typeof e?.reference==`string`?e.reference:``}}return r.status===400||r.status===413?{ok:!1,reason:`invalid`}:r.status===503?{ok:!1,reason:`unavailable`}:{ok:!1,reason:`error`}}catch(e){return{ok:!1,reason:e instanceof Error&&(e.name===`TimeoutError`||e.name===`AbortError`)?`timeout`:`error`}}}async function ere(e,t={}){let n=Qne();if(n===null)return{ok:!1,reason:`error`};let r=new URL(`/api/feedback`,n),i=J9(e.note),a=$ne(e.email),o={kind:`uninstall`,reasons:e.reason===void 0?[]:[e.reason],...i===void 0?{}:{message:i},appVersion:e.appVersion,platform:e.platform,source:e.source},s=Date.now()+(t.timeoutMs??4e3),c=()=>s-Date.now();if(a===void 0)return Y9(r,o,c());let l=await Y9(r,{...o,email:a},c());return l.ok||l.reason!==`invalid`||c()<=0?l:Y9(r,o,c())}function X9(e){return`pagesBySlug`in e}function tre(e){return X9(e)?e.pages:e}function nre(e,t){return X9(e)?e.assetPaths??new Set:t??new Set}function Z9(e,t){return X9(e)?e.filePaths??new Set:t??new Set}function Q9(e,t){return e<t?-1:+(e>t)}function rre(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function ire(e,t){let n=new Map,r=[...e].sort(Q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function are(e,t){let n=k1(e);if(n){if(X9(t))return t.pagesBySlug.get(n);for(let e of t)if(k1(e)===n)return e}}function ore(e,t){if(e.includes(`/`))return;let n=k1(e);if(!n)return;if(X9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);k1(t===-1?e:e.slice(t+1))===n&&(r===void 0||Q9(e,r)<0)&&(r=e)}return r}function sre(e){let t=e.trim();if(!t)return[];let n=k1(t);return n.length>0&&n!==t?[n]:[]}function $9(e,t){let n=e.trim();if(!n)return;let r=tre(t);if(r.has(n))return n;let i=are(n,t);if(i)return i;for(let e of sre(n))if(r.has(e))return e;return cre(n,r)||ore(n,t)}function cre(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function lre(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function ure(e,t,n){let r=lre(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(Q9)[0]??null}function dre(e,t,n){let r=V9(e,t);return r===null||r.kind!==`asset`||ure(r.url,nre(n),Z9(n))!==null||$9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}export{p9 as $,Ow as $a,x$ as $i,A2 as $n,Ca as $o,O0 as $r,Sr as $s,p3 as $t,D9 as A,oH as Aa,_t as Ac,v1 as Ai,E4 as An,Ua as Ao,Y0 as Ar,$i as As,k3 as At,dne as B,Xw as Ba,We as Bc,P$ as Bi,c4 as Bn,za as Bo,W0 as Br,xi as Bs,n6 as Bt,N9 as C,jq as Ca,Ut as Cc,k1 as Ci,W4 as Cn,AC as Co,C2 as Cr,Hi as Cs,$3 as Ct,Mne as D,SG as Da,bt as Dc,x1 as Di,P4 as Dn,Xc as Do,d2 as Dr,Gi as Ds,S3 as Dt,jne as E,CG as Ea,Tt as Ec,b1 as Ei,e3 as En,rg as Eo,p2 as Er,Ui as Es,x3 as Et,Cne as F,cD as Fa,st as Fc,e1 as Fi,C4 as Fn,Ga as Fo,$0 as Fr,Mi as Fs,W3 as Ft,Xte as G,Fw as Ga,K$ as Gi,d4 as Gn,Na as Go,z0 as Gr,iee as Gs,y3 as Gt,ane as H,Gw as Ha,ze as Hc,V$ as Hi,m4 as Hn,Ra as Ho,V0 as Hr,bi as Hs,N3 as Ht,pne as I,$w as Ia,$e as Ic,J$ as Ii,g4 as In,Xa as Io,Q0 as Ir,Ai as Is,r3 as It,ene as J,Uw as Ja,G$ as Ji,X2 as Jn,Ea as Jo,F0 as Jr,ti as Js,u3 as Jt,Zte as K,zw as Ka,q$ as Ki,$2 as Kn,ka as Ko,B0 as Kr,oi as Ks,_3 as Kt,mne as L,eT as La,et as Lc,X$ as Li,h4 as Ln,no as Lo,t2 as Lr,Oi as Ls,r6 as Lt,One as M,UV as Ma,ft as Mc,d1 as Mi,v4 as Mn,Wa as Mo,Z0 as Mr,Zi as Ms,E3 as Mt,E9 as N,MV as Na,rt as Nc,s1 as Ni,y4 as Nn,Ja as No,n2 as Nr,na as Ns,D3 as Nt,j9 as O,qW as Oa,yt as Oc,y1 as Oi,k4 as On,I as Oo,i2 as Or,ta as Os,C3 as Ot,Sne as P,nR as Pa,it as Pc,Z$ as Pi,b4 as Pn,to as Po,r2 as Pr,oa as Ps,O3 as Pt,Ute as Q,Dw as Qa,a$ as Qi,k2 as Qn,da as Qo,I0 as Qr,Tr as Qs,Y3 as Qt,yne as R,Kw as Ra,Ue as Rc,a1 as Ri,f4 as Rn,Ha as Ro,K0 as Rr,ki as Rs,l6 as Rt,Vne as S,Gq as Sa,Gt as Sc,N1 as Si,X4 as Sn,PC as So,x2 as Sr,Vi as Ss,e6 as St,O9 as T,FG as Ta,Et as Tc,S1 as Ti,U4 as Tn,TC as To,f2 as Tr,Wi as Ts,b3 as Tt,rne as U,Iw as Ua,Ae as Uc,j$ as Ui,s4 as Un,ja as Uo,G0 as Ur,ci as Us,g3 as Ut,fne as V,Zw as Va,Ie as Vc,F$ as Vi,p4 as Vn,Ba as Vo,H0 as Vr,yi as Vs,I3 as Vt,ine as W,Hw as Wa,ke as Wc,B$ as Wi,u4 as Wn,Ma as Wo,R0 as Wr,_i as Ws,v3 as Wt,tne as X,Bw as Xa,k$ as Xi,Q2 as Xn,Ta as Xo,j0 as Xr,Er as Xs,f3 as Xt,nne as Y,Vw as Ya,U$ as Yi,Z2 as Yn,Da as Yo,L0 as Yr,si as Ys,d3 as Yt,f9 as Z,Rw as Za,h$ as Zi,e4 as Zn,ua as Zo,M0 as Zr,Dr as Zs,J3 as Zt,F9 as _,Yq as _a,on as _c,Z1 as _i,J4 as _n,GC as _o,S2 as _r,Fi as _s,z4 as _t,Xne as a,b$ as aa,_r as ac,m0 as ai,o3 as an,uw as ao,M2 as ar,ba as as,_6 as at,Fne as b,$q as ba,Jt as bc,Y1 as bi,q4 as bn,BC as bo,g2 as br,qi as bs,Q4 as bt,Yne as c,_$ as ca,rr as cc,w0 as ci,R3 as cn,mw as co,N2 as cr,va as cs,v6 as ct,Wne as d,e$ as da,An as dc,c0 as di,c3 as dn,ww as do,U2 as dr,la as ds,d6 as dt,o$ as ea,xr as ec,A0 as ei,m3 as en,Aw as eo,D2 as er,fa as es,Bte as et,V9 as f,n$ as fa,jn as fc,u0 as fi,o6 as fn,_w as fo,W2 as fr,ca as fs,m6 as ft,Hne as g,qq as ga,rn as gc,X1 as gi,F4 as gn,JC as go,u2 as gr,Ri as gs,R4 as gt,I9 as h,uQ as ha,fn as hc,o0 as hi,L4 as hn,YC as ho,l2 as hr,zi as hs,u6 as ht,$9 as i,i$ as ia,yr as ic,v0 as ii,q3 as in,iw as io,j2 as ir,_a as is,Tte as it,Ene as j,eH as ja,lt as jc,m1 as ji,_4 as jn,Ya as jo,X0 as jr,Ji as js,T3 as jt,Dne as k,sH as ka,vt as kc,_1 as ki,w4 as kn,ro as ko,a2 as kr,aa as ks,A3 as kt,qne as l,D$ as la,Nn as lc,n0 as li,i6 as ln,jw as lo,L2 as lr,Sa as ls,y6 as lt,Gne as m,dQ as ma,cn as mc,s0 as mi,t3 as mn,hw as mo,H2 as mr,Pi as ms,f6 as mt,rre as n,C$ as na,wr as nc,_0 as ni,z3 as nn,nw as no,z2 as nr,xa as ns,xte as nt,ere as o,r$ as oa,mr as oc,p0 as oi,s3 as on,lw as oo,E2 as or,ya as os,x6 as ot,B9 as p,xQ as pa,tee as pc,l0 as pi,s6 as pn,Tw as po,V2 as pr,sa as ps,p6 as pt,w9 as q,Pw as qa,N$ as qi,Y2 as qn,Aa as qo,P0 as qr,ai as qs,l3 as qt,dre as r,E$ as ra,Cr as rc,g0 as ri,G3 as rn,aw as ro,B2 as rr,ma as rs,Rte as rt,Jne as s,y$ as sa,or as sc,x0 as si,L3 as sn,fw as so,F2 as sr,wa as ss,b6 as st,ire as t,S$ as ta,br as tc,D0 as ti,Z4 as tn,rw as to,O2 as tr,pa as ts,r9 as tt,Une as u,O$ as ua,zn as uc,d0 as ui,a6 as un,Mw as uo,R2 as ur,ga as us,g6 as ut,L9 as v,Jq as va,Xt as vc,R1 as vi,H4 as vn,UC as vo,b2 as vr,Li as vs,B4 as vt,Pne as w,XK as wa,kt as wc,C1 as wi,G4 as wn,kC as wo,m2 as wr,Ni as ws,h3 as wt,Rne as x,Wq as xa,eee as xc,J1 as xi,Y4 as xn,LC as xo,h2 as xr,Bi as xs,X3 as xt,Lne as y,sJ as ya,Zt as yc,q1 as yi,K4 as yn,HC as yo,v2 as yr,Ii as ys,F3 as yt,hne as z,Yw as za,He as zc,o1 as zi,l4 as zn,Va as zo,J0 as zr,ji as zs,P3 as zt};
|
|
360
|
-
//# sourceMappingURL=src-
|
|
360
|
+
//# sourceMappingURL=src-B2bAQ64a.mjs.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{Ha as t,Ia as n,La as r,ac as i,oc as a}from"./src-B2bAQ64a.mjs";import{$ as o,Ct as s,Q as c,c as l,s as u}from"./sleep-zea4v2sB.mjs";import{Bi as d,ct as ee,ei as f,h as p,lt as m,st as h,ut as g,xr as _}from"./src-BTBVMfJ4.mjs";import{A as v,I as y,L as b,O as x}from"./fs-traced-DgX7lP1u.mjs";import{C as S,S as C,_ as w,d as T,f as E,r as D}from"./server-lock-DKS1ePB3.mjs";import{t as O}from"./yazl-DejPO9b3.mjs";import{_ as k,h as te,m as A,v as j,x as M}from"./resolve-project-root-CLNohNKz.mjs";import{c as N}from"./colors-DSyAT9Cz.mjs";import{a as ne,i as re}from"./acp-harness-probe-CImEzSyM.mjs";import{D as ie,E as P,S as ae,T as F,_ as oe,b as se,o as ce}from"./init-Bg_ijtfG.mjs";import{n as le}from"./constants-ojQbinxA.mjs";import{t as ue}from"./is-object-Bw0-z8qH.mjs";import"./loader-rVQOJDtS.mjs";import"./skill-teardown-DvGC-0MI.mjs";import"./preview-DKOsPDvo.mjs";import{execSync as de,spawnSync as fe}from"node:child_process";import{basename as I,dirname as L,join as R,relative as pe,resolve as z,sep as me}from"node:path";import{cpSync as he,createWriteStream as ge,existsSync as B,lstatSync as _e,mkdirSync as V,mkdtempSync as ve,readFileSync as H,readdirSync as U,readlinkSync as ye,rmSync as be,statSync as xe,writeFileSync as W}from"node:fs";import{arch as Se,freemem as Ce,homedir as G,hostname as we,platform as Te,release as Ee,tmpdir as De,totalmem as Oe,type as ke,uptime as Ae}from"node:os";import"node:fs/promises";import{createHash as je}from"node:crypto";var Me=s();let Ne;function Pe(){return Ne}function Fe(e,t){if(t!==void 0&&t.length>0)return t;try{return f(e)?.rootPath}catch{return}}function Ie(e){let t=Fe(e.cwd,e.configuredProjectName),n=p({name:`cli`,project:t});return Ne=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const Le=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Re(e,t,n=f){if(e!==void 0&&!Le.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ze=null;function Be(e){ze=e}function Ve(){return ze??process.cwd()}const He=`Open Knowledge`;function Ue(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return k(t).join(j({...e,platformName:t}),n)}function We(e={}){let t=e.platformName??process.platform,n=e.home??G(),r=e.env??process.env,i=k(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Ge(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Ke(e){let t=R(e,`state.json`);if(!B(t))return[];let n;try{n=JSON.parse(H(t,`utf-8`))}catch{return[]}return Ge(n)??[]}function qe(e){let t=R(e,`state.json`);if(!B(t))return!1;try{return Ge(JSON.parse(H(t,`utf-8`)))!==null}catch{return!1}}function Je(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 Ye(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`\\`.repeat(t-t%2)+`/`})}const Xe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ze(e){return e.replace(Xe,`$1"[REDACTED-DEVICE-ID]"`)}function Qe(e){return Ze(Ye(e))}const $e=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function et(e){if(typeof e!=`string`)return null;let t=$e.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 tt(e){try{let t=H(e,`utf-8`),n=t.indexOf(`
|
|
2
|
+
`),r=n===-1?t:t.slice(0,n),i=JSON.parse(r);if(typeof i!=`object`||!i)return{kind:`unreadable`};let{name:a,app_name:o,timestamp:s}=i,c=typeof a==`string`?a:typeof o==`string`?o:null;return c===null?{kind:`unreadable`}:{kind:`named`,name:c,timestampMs:et(s)}}catch{return{kind:`unreadable`}}}function nt(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function rt(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=U(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=R(e,t.name),r;try{r=xe(n).mtimeMs}catch{continue}if(r<i)continue;let c=tt(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!nt(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`}}function K(){return R(G(),`.ok`,`bug-reports`)}function it(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=K(),r=`${t}-bugreport`,i=R(n,`${r}.zip`);for(let e=2;B(i);e+=1)i=R(n,`${r}-${e}.zip`);return i}function at(e,t){let n=R(e,`.ok`,`config.yml`);if(B(n))try{let e=H(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 B(R(e,`.ok`))?je(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function ot(){let e={timestamp:new Date().toISOString(),platform:Te(),osType:ke(),osRelease:Ee(),hostname:`[redacted]`,uptime:Ae(),freeMem:Ce(),totalMem:Oe(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=de(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=R(__dirname,`..`,`..`,`package.json`);B(t)&&(e.okVersion=JSON.parse(H(t,`utf8`)).version)}catch{}return e}const st=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function ct(e){let t=I(e);return st.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function lt(e,t){return pt(e,t).files}const ut=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function dt(e,t=ne){let n=R(e,`${t}.ShipIt`);if(!B(n))return[];let r;try{r=U(n)}catch{return[]}return ut.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=>R(n,e.entry)))}function ft(e){if(!B(e))return[];try{let t=new Map;for(let n of U(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-i.length):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=>R(e,t))}catch{return[]}}function pt(e,t){if(!B(t))return{files:[],excludedByProjectSlug:0};let n=U(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>R(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(ct),i=[],a=r.filter(t=>{try{return H(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=>!ct(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function mt(e){let t=R(e,`.ok`,`local`);return B(t)?{files:[`server.lock`,`last-spawn-error.log`,u].map(e=>R(t,e)).filter(e=>B(e))}:{files:[]}}function ht(e){let t=R(e,`.ok`,`local`,`logs`);return B(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>R(t,e)).filter(e=>B(e))}:{files:[]}}function gt(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#${je(`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 _t(e){let t=e.revealDocNames?e.content:gt(e.content).text;if(e.redact){let{redacted:n,patterns:i,lineCount:a}=r(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),i.length>0&&e.redactions.push({file:e.name,lineCount:a,patterns:i})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function q(e){for(let t of e.files)try{let n=H(t,`utf8`);_t({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?Qe(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 vt(t){let{redact:r,outputPath:i,logger:o}=t,s=t.revealDocNames??!1,c=t.userLogsDir??R(G(),`.ok`,`logs`),l=t.projectDir?at(t.projectDir,o):null;V(L(i),{recursive:!0}),o?.info({projectSlug:l},`gathering diagnostic data`);let u=ot();u.desktop=t.desktop??null,u.language=t.language??null;let{files:d,excludedByProjectSlug:ee}=pt(l,c),{files:f}=t.projectDir?mt(t.projectDir):{files:[]},{files:p}=t.projectDir?ht(t.projectDir):{files:[]},m=t.shipItLogFiles??[],h=t.diagnosticReports?.files??[];o?.info({logFileCount:d.length,logFilesExcludedByProjectSlug:ee,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length,diagnosticReportCount:h.length},`files collected`);let g=[],_=[],{ZipFile:v}=await import(`./yazl-BwMlCqRQ.mjs`).then(t=>e(t.default,1)),y=new v;q({zipfile:y,files:[...d,...m],prefix:`logs`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:f,prefix:`lockdir`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:p,prefix:`local-logs`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:a,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:h,prefix:`diagnostic-reports`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o});for(let e of t.extraFiles??[])try{let t=H(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;y.addBuffer(t,n),_.push(n)}catch(t){o?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&_t({zipfile:y,name:`note.txt`,content:t.note,redact:r,revealDocNames:s,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${I(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Je(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let C=JSON.stringify(u,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:_,redactions:g,sysinfo:u};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=g.reduce((e,t)=>e+t.lineCount,0),E=new Set(m.map(e=>`logs/${I(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${a}/${I(e)}`)),k=_.filter(e=>O.has(e)),te=l?_.filter(e=>e.startsWith(`logs/`)&&!ct(e)&&!E.has(e)):[],A=x.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.`]:[],j=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],M=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...te.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:`,...te.map(e=>`- ${e}`),``]:[],...D.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:`,...D.map(e=>`- ${e}`),``]:[],...x.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:`,...x.map(e=>`- ${e}`),``]:[],...k.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:`,...k.map(e=>`- ${e}`),``]:[],...r?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${n.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:j].join(`
|
|
3
|
+
`);y.addBuffer(Buffer.from(M,`utf8`),`README.md`),y.end();let N=ge(i);return y.outputStream.pipe(N),await new Promise((e,t)=>{N.on(`close`,e),N.on(`error`,t)}),o?.info({bundlePath:i,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:i,summary:{projectSlug:l,files:_,redactions:g,redactedLineCount:T,generatedAt:w.generatedAt}}}var yt=e(O(),1),J=e(N(),1);function bt(e){return b({absPath:v(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function xt({home:e=G(),env:n=process.env}={}){let r=bt(e),{override:i,preferenceList:a}=x(n),{locale:s,source:l}=t({override:i,storedPreference:r,supportedLocales:o,preferenceList:a,autoDetectableLocales:c});return{preference:r,locale:s,source:l,systemLanguages:a}}function St(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ct(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e,t){if(typeof e==`string`)return St(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Y(e,t));if(!Ct(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Y(i,t);return n}function wt(e,t){let n=H(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
4
|
+
`),i=n.split(`
|
|
5
|
+
`),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=Y(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}W(e,r?`${a.join(`
|
|
6
|
+
`)}\n`:a.join(`
|
|
7
|
+
`))}function Tt(e,t){let n=H(e,`utf-8`);if(n.trim().length!==0)try{let r=Y(JSON.parse(n),t),i=n.endsWith(`
|
|
8
|
+
`)?`
|
|
9
|
+
`:``;W(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=St(n,t.contentDir);r!==n&&W(e,r)}}function Et(e,t){let n=H(e,`utf-8`),r=St(n,t.contentDir);r!==n&&W(e,r)}function Dt(e){try{return U(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>R(e,t.name))}catch{return[]}}const Ot=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function kt(e){return/\.log\.\d+$/.test(e)}function At(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||kt(e)}const jt=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Mt(e){let t={contentDir:e.contentDir};for(let n of jt)for(let r of Dt(R(e.stagingDir,n)))At(r)?wt(r,t):r.endsWith(`.json`)?Tt(r,t):Et(r,t);for(let n of Dt(R(e.stagingDir,`state`))){let e=I(n);n.endsWith(`.jsonl`)?wt(n,t):Ot.has(e)?Tt(n,t):Et(n,t)}}const Nt=[`.ok`,`local`,`telemetry`],Pt=[`.ok`,`local`,`logs`],Ft=[`.ok`,`local`,`loss-capture`],It=`spans-current.jsonl`,Lt=`spans-prev.jsonl`,Rt=`server-current.jsonl`,zt=`server-prev.jsonl`,Bt=`loss-current.jsonl`,Vt=`loss-prev.jsonl`;function Ht(e){return R(e,...Nt,It)}function Ut(e){return R(e,...Nt,Lt)}function Wt(e){return R(e,...Pt,Rt)}function Gt(e){return R(e,...Pt,zt)}function Kt(e){return R(e,...Ft,Bt)}function qt(e){return R(e,...Ft,Vt)}const Jt=1e3;async function Yt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Jt)});return t.ok?await t.text():null}catch{return null}}async function Xt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Jt)});return t.ok?await t.text():null}catch{return null}}async function Zt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Jt)});return t.ok?await t.text():null}catch{return null}}function Qt(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(`
|
|
10
|
+
`)}\n`:null}catch{return null}}function $t(e){let t=R(e,`.git`,`ok`);if(!B(t))return null;let n=fe(`git`,[`-C`,t,`log`,`--oneline`,`-50`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function en(e){let t=R(e,`.git`,`ok`);if(!B(t))return null;let n=fe(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function tn(){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 nn(){return{nodeVersion:process.version,platform:Te(),arch:Se()}}function rn(){return process.env.OTEL_SDK_DISABLED===`false`}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function an(e){if(!B(e))return{};let t;try{t=(0,Me.parse)(H(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(!X(t))return{};let n=t.telemetry;if(!X(n))return{};let r=n.localSink;return X(r)?r:{}}function on(e){return typeof e==`boolean`?e:void 0}function sn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Z(e){if(X(e))return sn(e.maxBytes)}function cn(e){let t=an(v(`project`,e)),n=an(v(`project-local`,e));return{enabled:on(n.enabled)??on(t.enabled)??!0,spansMaxBytes:Z(n.spans)??Z(t.spans)??52428800,logsMaxBytes:Z(n.logs)??Z(t.logs)??26214400}}function ln(e){return je(`sha256`).update(e).digest(`hex`)}function un(e){let t=H(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const dn=[`"doc.name"`,`"docName"`];function fn(e){let t=H(e,`utf-8`),n=0;for(let e of dn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!B(e))return!1;try{return V(L(t),{recursive:!0}),e.endsWith(`.ips`)?W(t,Qe(H(e,`utf-8`))):he(e,t),!0}catch{return!1}}function pn(e){let t=[],n=e=>{let r=U(e,{withFileTypes:!0});for(let i of r){let r=R(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const mn=new Set([`.jsonl`]);function hn(e){let t=e.lastIndexOf(`.`);return t===-1?!1:mn.has(e.slice(t))}const gn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function _n(e){if(kt(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:gn.has(e.slice(t))}function vn(e){let t=[];for(let n of pn(e)){let i=yn(e,n);if(!_n(i))continue;let{redacted:a,patterns:o,lineCount:s}=r(H(n,`utf-8`));o.length!==0&&(W(n,a),t.push({file:i,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function yn(e,t){return pe(e,t).split(me).join(`/`)}async function bn(e){let t=z(e.contentDir),n=z(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Yt,o=r.fetchAgentEffects??Xt,s=r.fetchWatcherRecent??Zt,c=r.readShadowHead??$t,d=r.readCheckpointRefs??en,ee=r.now??(()=>new Date),f=r.okVersion??(()=>le),p=r.readDesktopEnv??tn,m=r.readLanguage??xt,h=r.readRuntime??nn,g=r.isOtlpPushEnabled??rn,_=ve(R(De(),`ok-bundle-`));try{V(R(_,`telemetry`),{recursive:!0}),V(R(_,`logs`),{recursive:!0}),V(R(_,`state`),{recursive:!0}),Q(Ht(n),R(_,`telemetry`,It)),Q(Ut(n),R(_,`telemetry`,Lt)),Q(Wt(n),R(_,`logs`,Rt)),Q(Gt(n),R(_,`logs`,zt));for(let t of e.userLogFiles??[])Q(t,R(_,`logs`,I(t)));for(let t of e.userStateFiles??[])Q(t,R(_,a,I(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Q(t,R(_,`diagnostic-reports`,I(t)))&&(v+=1);let y=R(n,`.ok`,`local`),b=R(y,`server.lock`),x=`not-running`,S=`no server.lock`,C=null;if(B(b)){Q(b,R(_,`state`,`server.lock`));try{let e=H(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:S=`lock present but no port`}catch{S=`lock present but unparseable`}}if(C!==null){let e=await i(C);e===null?S=`agent-presence endpoint at :${C} unreachable`:(W(R(_,`state`,`agent-presence.json`),e),x=`running`,S=``);let t=await o(C);t!==null&&W(R(_,`state`,`agent-effects.json`),t);let n=await s(C);if(n!==null){let e=Qt(n);e!==null&&W(R(_,`state`,`watcher-recent.jsonl`),e)}}let w=c(t);w!==null&&W(R(_,`state`,`shadow-head.txt`),w);let T=d(t);T!==null&&W(R(_,`state`,`checkpoint-refs.txt`),T),Q(Kt(n),R(_,`state`,Bt)),Q(qt(n),R(_,`state`,Vt)),Q(R(y,`last-spawn-error.log`),R(_,`state`,`last-spawn-error.log`)),Q(R(y,l),R(_,`state`,l)),Q(R(y,u),R(_,`state`,u));let E=h(),D=p(),O=m(),k={ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O}};W(R(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let te=x===`running`?`running
|
|
11
|
+
`:`not-running (${S})\n`;W(R(_,`state`,`server-status.txt`),te);let A=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:Je(e.diagnosticReports,v);if(W(R(_,`state`,`diagnostic-reports-status.txt`),`${A}\n`),e.processDir&&B(e.processDir)){let t=R(_,`process`);V(t,{recursive:!0}),he(e.processDir,t,{recursive:!0})}let j=e.redact===!0;j&&Mt({stagingDir:_,contentDir:t}),e.note&&W(R(_,`note.txt`),e.note);let M=null;e.scrubSecrets===!0&&(M=vn(_));for(let t of e.extraFiles??[])Q(t.sourcePath,R(_,`extra`,t.zipName??I(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let N=cn(n),ne=pn(_),re=[],ie=0,P=0;for(let e of ne){let t=yn(_,e),n=xe(e).size,r=hn(t)?un(e):0;re.push({path:t,bytes:n,lines:r}),ie+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(P+=fn(e))}let ae={applied:j};M!==null&&(ae.secretScrub=M);let F={schemaVersion:2,createdAt:ee().toISOString(),ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O},contentDir:{pathSha256:ln(t),absolutePath:j?`<CONTENT_DIR>`:t},telemetry:{localSink:N,otlpPushEnabled:g()},redaction:ae,serverStatus:x,files:re};W(R(_,`manifest.json`),`${JSON.stringify(F,null,2)}\n`);let oe=ne.some(e=>{try{return H(e,`utf-8`).includes(t)}catch{return!1}}),se={stagedDiagnosticReports:v,totalBytes:ie,fileCount:re.length,docNameCount:P,contentDirVisible:oe,redacted:j},ce=!1;return{stagingDir:_,manifest:F,summary:se,cleanup:()=>{ce||(ce=!0,be(_,{recursive:!0,force:!0}))}}}catch(e){throw be(_,{recursive:!0,force:!0}),e}}async function xn(e){let{collected:t,outputPath:n}=e,r=L(n);if(!B(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new yt.ZipFile,a=pn(t.stagingDir);for(let e of a){let n=yn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=ge(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 Sn(e,t){let n=R(e,`.ok`,`config.yml`);if(B(n))try{let t=(0,Me.parse)(H(n,`utf-8`)),r=ue(t)?t.content:void 0,i=ue(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(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 z(e)}async function Cn(e,t,n,r,i){let a=at(t,e.logger),o=await bn({contentDir:Sn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...lt(a,e.userLogsDir??R(G(),`.ok`,`logs`)),...dt(e.cachesDir??R(G(),`Library`,`Caches`))],userStateFiles:ft(e.bugReportsDir??K()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{V(L(e.outputPath),{recursive:!0}),await xn({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function wn(e){let{projectDir:t}=e,n=e.readDesktopEnv??tn,r=e.readLanguage??xt,i=()=>rt(e.diagnosticReportsDir??R(G(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return Cn(e,t,n,r,i());let{zipPath:a,summary:o}=await vt({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:dt(e.cachesDir??R(G(),`Library`,`Caches`)),bugReportLedgerFiles:ft(e.bugReportsDir??K()),diagnosticReports:e.level===`full`?i():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}}}function $(e,t,n={}){let r=E(e,t);if(!B(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(H(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!S(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??C)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??w())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??we();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Tn(e){return e.replace(/:\d+$/,``)}function En(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Tn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Tn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Tn(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}const Dn=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function On(e){return R(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const kn={existsSync:e=>B(e),readFileSync:(e,t)=>H(e,t),lstatSync:e=>_e(e),readlinkSync:e=>ye(e)};function An(e,t=kn){let n=On(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function jn(e){let t=e.replace(Dn,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Mn(e,t,n=kn){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function Nn(e){return A(e)||te(e)||ae(e)}const Pn=10*1024*1024;function Fn(e,t,n,r){let i=ce(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Nn(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);if(e.format===`file`){be(a,{force:!0});let e=re(t,n);return{kind:`removed`,trust:e.action,...e.error===void 0?{}:{trustError:e.error}}}return e.format===`toml`?Rn(a,o):e.format===`yaml`?Ln(a,e.topLevelKey,o):In(a,e.topLevelKey,e.serverMapSubKey,o)}function In(e,t,n,r){let i;try{i=H(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>Pn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=ie(i,oe(t,n,r));return o?(y(e,a,{mode:F(e)}),{kind:`removed`}):{kind:`not-present`}}function Ln(e,t,n){let r;try{r=H(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>Pn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,Me.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=P(a);a.trim()===``||a.endsWith(`
|
|
12
|
+
`)?c.endsWith(`
|
|
13
|
+
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
14
|
+
`).replace(/\n/g,`\r
|
|
15
|
+
`));let u=`${i?``:``}${c}`;return u!==r&&y(e,u,{mode:F(e)}),{kind:`removed`}}function Rn(e,t){let n=se();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=H(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=P(a),s=a.trim()===``||a.endsWith(`
|
|
16
|
+
`),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(`
|
|
17
|
+
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
18
|
+
`).replace(/\n/g,`\r
|
|
19
|
+
`));let u=`${i?``:``}${l}`;return u!==r&&y(e,u,{mode:F(e)}),{kind:`removed`}}function zn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Bn(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&D(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:ee(n),command:n,isDesktop:zn(n)}}function Hn(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const Un=new Set([`running`,`desktop`,`foreign`]);function Wn(e){switch(e){case`running`:return J.default.green(e);case`desktop`:return J.default.blue(e);case`foreign`:return J.default.cyan(e);case`stale`:return J.default.yellow(e)}}function Gn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Kn(e){return`${Gn(e.server.usage)} | ${Gn(e.ui?.usage??null)}`}function qn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Jn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,qn(e),Kn(e),Hn(e),String(e.server.pid),Bn(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Wn(Hn(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=J.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
20
|
+
`)}async function Yn(e={}){let t=e.discover??h,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??m,a=e.resolveUsage??g,o=await t(),s=[];for(let e of o){let t=n(e),r=Vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Hn(e)}));r(JSON.stringify(e,null,2));return}r(Jn(e.all?s:s.filter(e=>Un.has(Hn(e)))))}function Xn(){return new M(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Yn({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Zn(e,t=Pe()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=T(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});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 Qn(e,t={}){return{targets:er(e,t.isAlive??C)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function $n(e){let t=e.inspect??(()=>$(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??Zn,o=e.logger??Pe(),s=Qn(t(),{isAlive:e.isAlive});if(s.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};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:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function er(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function tr(e,t=C){let n=await h(),r=null;for(let i of n){let n=$(i,`server`);if(er(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function nr(e,t){let n=await $n({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function rr(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function ir(e){let t=await h(),n=0;for(let r of t)r!==e&&er($(r,`server`),C)&&n++;return n}function ar(e){return new M(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=_(process.cwd()),n=await $n({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await ir(t);console.log(rr(process.cwd(),e,{listingFollows:e>0})),e>0&&await Yn({})}return}if(i===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)er($(n,`server`),C)&&(await nr(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await tr(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await nr(t,r);return}let a=z(Ve(),i),o=_(a),s=[],c=await $n({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(rr(a,await ir(o)))})}export{Ke as C,Re as D,Be as E,Pe as O,Ue as S,Ve as T,K as _,Fn as a,He as b,On as c,En as d,$ as f,it as g,xn as h,Xn as i,Ie as k,An as l,bn as m,$n as n,Dn as o,wn as p,ar as r,Mn as s,Zn as t,jn as u,rt as v,qe as w,We as x,Je as y};
|
|
21
|
+
//# sourceMappingURL=src-B8bduDrv.mjs.map
|