@inkeep/open-knowledge 0.86.13-beta.10 → 0.86.13-beta.12
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/cli.mjs +60 -60
- package/dist/constants-lgAziYdA.mjs +1 -0
- package/dist/{dist-BtFk8Dn5.mjs → dist-DDooM-sn.mjs} +1 -1
- package/dist/{dist-zDNN5V7x.mjs → dist-DMsiT-GE.mjs} +504 -504
- package/dist/index.mjs +39 -39
- package/dist/init-BkJRnB38.mjs +1 -0
- package/dist/{init-Bo66a3_W.mjs → init-cLsVOMGp.mjs} +27 -27
- package/dist/{launch-json-removal-D2m8-6U5.mjs → launch-json-removal-CN1CHgue.mjs} +1 -1
- package/dist/loader-CPOmChym.mjs +1 -0
- package/dist/{loader-y-TrZa6Y.mjs → loader-Du9EUjvS.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-C2aCFGjW.mjs → md-manager-BGnqyqi1-BzZ_8EQ9.mjs} +145 -145
- package/dist/{open-browser-DsUxGgtf.mjs → open-browser-DHuw6ESt.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-Bx9qkaKf.mjs +1 -0
- package/dist/{preview-CbBEJMmR.mjs → preview-TPjat07q.mjs} +1 -1
- package/dist/public/assets/{AccountSection-Bs5nCrXk.js → AccountSection-DkNM-aaM.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-QZ6d-7a4.js → ActivityModeContent-Cz9Cmowv.js} +1 -1
- package/dist/public/assets/AddPropertiesButton-D6KoQYQE.js +2 -0
- package/dist/public/assets/{AgentConnectionsSection-BCB6XaTz.js → AgentConnectionsSection-BHPetKxr.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BIGQK6zr.js → AgentDiffPane-BTmo_vE5.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-GZU1laTi.js → AttachmentsSection-BIAEmImw.js} +1 -1
- package/dist/public/assets/{AuthModal-BbqjE98j.js → AuthModal-X5G4DTEx.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CYcNRDd1.js → CodeMirrorPropInput-Cb0qKX2H.js} +2 -2
- package/dist/public/assets/{ContentRulesSection-B6dL8ZBP.js → ContentRulesSection-BHp_wZCB.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-BSQYq_58.js → DiffViewBoundary-oJWWxAbN.js} +1 -1
- package/dist/public/assets/DocumentContext-quy6vWUt.js +108 -0
- package/dist/public/assets/{EditorModeToggle-CGKBO5_T.js → EditorModeToggle-DdtUpmIe.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-DyADjHP1.js → ExcalidrawDocEditor-CtYrgqrg.js} +1 -1
- package/dist/public/assets/FeedbackForm-DLLqiHqI.js +1 -0
- package/dist/public/assets/{GraphPanel-Bq6fUIBW.js → GraphPanel-CGNdettK.js} +1 -1
- package/dist/public/assets/ImportSkillDialog-kYtjXTYj.js +1 -0
- package/dist/public/assets/{LinkPreviewsSection-BJQr4hsZ.js → LinkPreviewsSection-BB1bjNg_.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DQ5irABI.js → LintConfigEditor-B0L5rUzm.js} +1 -1
- package/dist/public/assets/{LintingSection-TzAf7Zhn.js → LintingSection-Cp1X5inf.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BJZH6nDl.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-FyrkWzBk.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-MalnE6MS.js → MermaidDocEditor-YIXLKQfo.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-B6Mxh9fH.js → NetworkAccessSection-Da92wrve.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-BJbZ6ugB.js → ProjectTemplatesSection-D0Bkx3KQ.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-Bhq5IJJj.js → PropertyDisplayRow-ClnrK420.js} +1 -1
- package/dist/public/assets/PublishToGitHubDialog-D4r8iRIM.js +1 -0
- package/dist/public/assets/{RegisteredAgentIcon-BTIzsPkU.js → RegisteredAgentIcon-BBb2bLOu.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-1sW0c_7W.js → SchemaConfigEditor-asdMFShP.js} +1 -1
- package/dist/public/assets/{SearchSection-DEgJ0y5m.js → SearchSection-tlJeLCrv.js} +1 -1
- package/dist/public/assets/{SessionsHost-BPWZxT3I.js → SessionsHost-CgCN1gRH.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-B2BSEdIW.js → SettingsDialogBody-BHz_4a8o.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-DhU5uYRo.js → ShareReceiveMissDialog-klxlJzHP.js} +1 -1
- package/dist/public/assets/SkillCostValue-D5Fs2LwC.js +1 -0
- package/dist/public/assets/{SkillForkDialog-T24C2iFH.js → SkillForkDialog-D2Yx1mWH.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-CVZobEsw.js → SkillInstallMenu-CKLbtuQf.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-Cs841f5S.js → SkillOriginInline-wxzjBFG4.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CqAyp6Az.js → SkillToolbarControls-B_2irbtq.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-zB4Uxwuv.js → SkillsManagerSection-mwDQPVoO.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DONal-Wm.js → SlidesToolbarControls-CTikn8Fl.js} +1 -1
- package/dist/public/assets/{SourceEditor-BqQ3Y-LD.js → SourceEditor-B9jPdpu5.js} +1 -1
- package/dist/public/assets/{SpellingSettings-DYJq-G4I.js → SpellingSettings-Dg988vdp.js} +1 -1
- package/dist/public/assets/{SyncSection-BfQaTVj6.js → SyncSection-DydtYVIG.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-CcOAba6C.js → SyncStatusBadge-CNGrCDAE.js} +1 -1
- package/dist/public/assets/TemplateRow-DaShyoRV.js +7 -0
- package/dist/public/assets/{TerminalLaunchContext-CI-TpGRC.js → TerminalLaunchContext-CjAWwlH6.js} +1 -1
- package/dist/public/assets/{TerminalPanel-C-9jJEyf.js → TerminalPanel-BkBzM1qp.js} +1 -1
- package/dist/public/assets/{TerminalSection-D_zPc-5s.js → TerminalSection-C1eHc1i7.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CjxHa1xm.js → TerminalWindowApp-CiDlz-Ud.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Wae2EW6d.js → TextDocEditor-C4fsSdta.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-B4bn24Mz.js → ThemePluginSection-BxYvt_G_.js} +1 -1
- package/dist/public/assets/ThreadView-NsjJBfHS.js +28 -0
- package/dist/public/assets/{TimelineDiffPane-L_lcOo0j.js → TimelineDiffPane-csNGBZSW.js} +1 -1
- package/dist/public/assets/{agent-connections-D0ME1tAk.js → agent-connections-GLwwfeSQ.js} +1 -1
- package/dist/public/assets/{agent-registry-ozT_yaRC.js → agent-registry-DoeDgmSS.js} +1 -1
- package/dist/public/assets/{bridge-2KtDdwjE.js → bridge-BeevbgaB.js} +3 -3
- package/dist/public/assets/{card--B2B-S7V.js → card-CnyJ4_sf.js} +1 -1
- package/dist/public/assets/{catalog-nLe25VOf.js → catalog-BCZP9v1Y.js} +1 -1
- package/dist/public/assets/{client-version-DRmVURs6.js → client-version-COAujf9p.js} +1 -1
- package/dist/public/assets/comment-chips-Dpwh4USo.js +8 -0
- package/dist/public/assets/{config-provider-CMGxknTv.js → config-provider-CogbMSvj.js} +2 -2
- package/dist/public/assets/config-schema-DKntRUA6.js +1 -0
- package/dist/public/assets/{css-color-to-hex-DQ05tiK8.js → css-color-to-hex-4NoG2bwl.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-DM1dhLyU.js → doc-undo-manager-Bqo4zf83.js} +1 -1
- package/dist/public/assets/{field-controls-oxASn1fW.js → field-controls-BTAnIIPw.js} +1 -1
- package/dist/public/assets/field-controls-Vvo0Lkt_.js +1 -0
- package/dist/public/assets/globals-CoB8ny3x.css +1 -0
- package/dist/public/assets/{ime-composition-CVvlqJvS.js → ime-composition-CyG03EgC.js} +1 -1
- package/dist/public/assets/index-B2jMcsUA.js +2205 -0
- package/dist/public/assets/{lint-config-client-BuUP6NLf.js → lint-config-client-VoxUDald.js} +1 -1
- package/dist/public/assets/{lint-plugins-D3pWsdpr.js → lint-plugins-21YnDuGP.js} +1 -1
- package/dist/public/assets/{markdown-lint-CBp7xF-c.js → markdown-lint-3sYz4zE8.js} +3 -3
- package/dist/public/assets/{markdownlint-rule-browser-as77OQBK.js → markdownlint-rule-browser-BljyAq4y.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BLM2BXeS.js → pending-receive-nav-store-CpSN4HBn.js} +1 -1
- package/dist/public/assets/{preferred-session-events-CnOkpJRh.js → preferred-session-events-DLC-rarq.js} +1 -1
- package/dist/public/assets/progress-Bt7UMtSN.js +10 -0
- package/dist/public/assets/saved-themes-client-oll3c0ta.js +1 -0
- package/dist/public/assets/{schema-section-BCpxeE0s.js → schema-section-DJ6iEynt.js} +1 -1
- package/dist/public/assets/{schemas-api-CzJwuc5a.js → schemas-api-CD98jV86.js} +1 -1
- package/dist/public/assets/{selection-context-DtCqhwLp.js → selection-context-D7XIW34q.js} +1 -1
- package/dist/public/assets/{skills-api-DvWR87JW.js → skills-api-Brm92vtB.js} +1 -1
- package/dist/public/assets/{src-0Fjiu8Ee.js → src-D-d779sD.js} +1 -1
- package/dist/public/assets/storage-scope-ldi41iCU.js +1 -0
- package/dist/public/assets/{tag-pill-input-pJw3xLYa.js → tag-pill-input-B9jOgw8L.js} +1 -1
- package/dist/public/assets/{telemetry-impl-CiBHq5jX.js → telemetry-impl-D2OTUygc.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Bx1Ou5CS.js → telemetry-startup-DeW1YLJb.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-NfdixyJK.js → terminal-launch-events-DZK4WV54.js} +1 -1
- package/dist/public/assets/typing-burst-detector-CyrCfMRK.js +8 -0
- package/dist/public/assets/{uninstall-BNoyrj3Z.js → uninstall-B2fm_4nD.js} +1 -1
- package/dist/public/assets/{use-activity-panel-rBSeNU8G.js → use-activity-panel-DPGRlmhU.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-CCEfjhx6.js → use-apply-config-color-theme-DM_OGSn8.js} +2 -2
- package/dist/public/assets/{use-conflicts-CbOb-v8_.js → use-conflicts-Dp9K6H4i.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-B01fmTZm.js → use-live-xterm-theme-hdzVNKye.js} +1 -1
- package/dist/public/assets/{use-open-skill-BTJs0gX2.js → use-open-skill-CE_m88gf.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-BDGrlrdq.js → use-semantic-search-status-8EpcV5XC.js} +1 -1
- package/dist/public/assets/{use-skill-origin-DaM89Ogz.js → use-skill-origin-Bepbv7aT.js} +1 -1
- package/dist/public/assets/{use-skill-targets-DM75u-dx.js → use-skill-targets-ClLUioyZ.js} +1 -1
- package/dist/public/assets/{use-skills-C2Qanq6V.js → use-skills-DLU1dAsd.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-Dji-voVH.js → use-terminal-enabled-OJQP8BOu.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CayouyDf.js → use-timeline-entry-diff-DLGmI-9t.js} +2 -2
- package/dist/public/assets/{use-workspace-D0A0ZmBO.js → use-workspace-Bgh-YT5K.js} +1 -1
- package/dist/public/index.html +48 -48
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-BJWtQrWp.mjs → registry-probes-C6-7mNBK.mjs} +3 -3
- package/dist/{removal-file-path-BR4RNXcl.mjs → removal-file-path-DGHqE3V9.mjs} +1 -1
- package/dist/{repair-launch-json-DmpNX9VR.mjs → repair-launch-json-Df4heHjd.mjs} +1 -1
- package/dist/{repair-mcp-configs-CZLPtP2X.mjs → repair-mcp-configs-BxNlmyXQ.mjs} +1 -1
- package/dist/src-CB2AxHE5.mjs +16 -0
- package/dist/src-D6R5qRPv.mjs +1 -0
- package/dist/start-BpsPEUY2.mjs +1 -0
- package/dist/{start-DHtveWWg.mjs → start-DP79VDPx.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-3stEn79A.mjs +0 -1
- package/dist/init-DF6ACYPR.mjs +0 -1
- package/dist/loader-x88zzCxw.mjs +0 -1
- package/dist/preview-DbfOwJ87.mjs +0 -1
- package/dist/public/assets/AddPropertiesButton-BGwemosV.js +0 -2
- package/dist/public/assets/DocumentContext-N1JDW9op.js +0 -108
- package/dist/public/assets/FeedbackForm-vdwPygKT.js +0 -1
- package/dist/public/assets/ImportSkillDialog-D5fwO9J1.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CAT-uTtW.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CTpxKtXr.js +0 -1
- package/dist/public/assets/PublishToGitHubDialog-DX9ygaL5.js +0 -1
- package/dist/public/assets/SkillCostValue-B-ShSIvZ.js +0 -1
- package/dist/public/assets/TemplateRow-FUuKGsGA.js +0 -7
- package/dist/public/assets/ThreadView-BTyF_a0t.js +0 -28
- package/dist/public/assets/comment-chips-BWPMH63j.js +0 -8
- package/dist/public/assets/config-schema-C37da9RL.js +0 -1
- package/dist/public/assets/field-controls-fZhMOzql.js +0 -1
- package/dist/public/assets/globals-G6Xf2xYI.css +0 -1
- package/dist/public/assets/index-CGrF4mlZ.js +0 -2205
- package/dist/public/assets/progress-DgonS0yg.js +0 -10
- package/dist/public/assets/saved-themes-client-CnQnBq4q.js +0 -1
- package/dist/public/assets/storage-scope-DIpOO45g.js +0 -1
- package/dist/public/assets/typing-burst-detector-D3vEJrYF.js +0 -8
- package/dist/src-Ba8v6dFj.mjs +0 -16
- package/dist/src-vTgTOkUj.mjs +0 -1
- package/dist/start-D6MYrFRx.mjs +0 -1
- /package/dist/public/assets/{globals-aghZx9Sb.js → globals-DOAk0eiA.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ht as n,It as r,Mt as i,Qn as a,Tn as o,Vt as s,an as c,jt as l,kt as u,lt as ee,qn as te,sn as ne,wn as d}from"./DocumentContext-N1JDW9op.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{pt as h}from"./schemas-api-CzJwuc5a.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-D3vEJrYF.js";import{$n as S,S as C,X as w,Zn as fe,a as pe,ft as T,i as me,mt as E,o as he}from"./CodeMirrorPropInput-CYcNRDd1.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-CMGxknTv.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-DtCqhwLp.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-CBp7xF-c.js";import{l as Me}from"./lint-config-client-BuUP6NLf.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-Y68DvxP6.js";import{n as Be,t as Ve}from"./src-0Fjiu8Ee.js";var Q=e(f(),1),He=m();function Ue(){let e=s();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&D(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=u.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=i(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(i){let a=i.target?.closest?.(`[data-skill-ref]`),o=a instanceof HTMLElement?a.dataset.skillRef:void 0;if(o!==void 0){i.preventDefault();let e=s()?.get(o);return e===void 0?r():window.location.hash=n(o,e),!0}let c=i.target?.closest?.(`.cm-skill-path-link`),u=c instanceof HTMLElement?c.dataset.skillPath:void 0;return u===void 0?!1:(i.preventDefault(),window.location.hash=l(t,e,u),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=E(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{o(t)}finally{S(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i){k(y,{...o,outcome:`no-target`});return}let s=a(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});k(y,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,o=Math.min(t.offset,i.length);a(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),o=r.line(i),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return a(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),l=(0,Q.useRef)(null),[u,f]=(0,Q.useState)(null);if(u)throw u;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,u,p=zt;try{u=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let l=ee({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>te(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),l,F.updateListener.of(e=>{c(e)&&ne(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=u,l.current=u.view,At(u.view,o),fe(n,u.view,`sourceEditor`),le()&&u.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,l.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,l.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=l.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=l.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=l.current;r&&It(r,t,n)&&_(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=l.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:C()}}function zt(){return w()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ht as n,It as r,Mt as i,Qn as a,Tn as o,Vt as s,an as c,jt as l,kt as u,lt as ee,qn as te,sn as ne,wn as d}from"./DocumentContext-quy6vWUt.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{ht as h}from"./schemas-api-CD98jV86.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-CyrCfMRK.js";import{Qn as fe,Z as S,a as pe,er as C,ht as w,i as me,o as he,pt as T,x as E}from"./CodeMirrorPropInput-Cb0qKX2H.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-CogbMSvj.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-D7XIW34q.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-3sYz4zE8.js";import{l as Me}from"./lint-config-client-VoxUDald.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-Y68DvxP6.js";import{n as Be,t as Ve}from"./src-D-d779sD.js";var Q=e(f(),1),He=m();function Ue(){let e=s();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&D(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=u.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=i(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(i){let a=i.target?.closest?.(`[data-skill-ref]`),o=a instanceof HTMLElement?a.dataset.skillRef:void 0;if(o!==void 0){i.preventDefault();let e=s()?.get(o);return e===void 0?r():window.location.hash=n(o,e),!0}let c=i.target?.closest?.(`.cm-skill-path-link`),u=c instanceof HTMLElement?c.dataset.skillPath:void 0;return u===void 0?!1:(i.preventDefault(),window.location.hash=l(t,e,u),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=w(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{o(t)}finally{C(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i){k(y,{...o,outcome:`no-target`});return}let s=a(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});k(y,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,o=Math.min(t.offset,i.length);a(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),o=r.line(i),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return a(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),l=(0,Q.useRef)(null),[u,f]=(0,Q.useState)(null);if(u)throw u;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,u,p=zt;try{u=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let l=ee({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>te(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),l,F.updateListener.of(e=>{c(e)&&ne(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=u,l.current=u.view,At(u.view,o),fe(n,u.view,`sourceEditor`),le()&&u.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,l.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,l.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=l.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=l.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=l.current;r&&It(r,t,n)&&_(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=l.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return S()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|