@inkeep/open-knowledge 0.86.0-beta.15 → 0.86.0-beta.16
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 +6 -6
- package/dist/constants-tSID-kT5.mjs +1 -0
- package/dist/{dist-DikfvdOD.mjs → dist-5zDm1fr3.mjs} +1 -1
- package/dist/dist-DUtSOpBB.mjs +2212 -0
- package/dist/index.mjs +5 -5
- package/dist/{init-CWtHKTHv.mjs → init-B3soXeyK.mjs} +2 -2
- package/dist/init-BW-4zw1V.mjs +1 -0
- package/dist/{launch-json-removal-BB-oqIRC.mjs → launch-json-removal-2nQyZjaq.mjs} +1 -1
- package/dist/{loader-CkZGQ9i_.mjs → loader-BWtNORi7.mjs} +1 -1
- package/dist/loader-niePATP1.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-CMF2qMhD.mjs → md-manager-BGnqyqi1-C80pMLi7.mjs} +1 -1
- package/dist/{open-browser-CsFrf5v1.mjs → open-browser-Buji7DpA.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-2dl7HtCm.mjs +1 -0
- package/dist/{preview-DraobKxC.mjs → preview-DoJ3QZhu.mjs} +1 -1
- package/dist/public/assets/{AccountSection-X0gfkEFU.js → AccountSection-C8VrxwD0.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-BHxvvcEZ.js → ActivityModeContent-CG-sT-V6.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CbMt9j6h.js → AddPropertiesButton-DtKuaSoE.js} +2 -2
- package/dist/public/assets/{AgentConnectionsSection-C99QFz6Q.js → AgentConnectionsSection-DZe1baEO.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-m_zTMTCy.js → AgentDiffPane-DGDfHO0m.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-BBKp2KZL.js → AttachmentsSection-DZ39jLXo.js} +1 -1
- package/dist/public/assets/{AuthModal-CaYJDCrL.js → AuthModal-CHid1zIl.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-KdXe7bVw.js → CodeMirrorPropInput-CWwqakNd.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-TEbxas-J.js → ContentRulesSection-CQVYRse1.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-DTwemWjU.js → DiffViewBoundary-L0r4YmEw.js} +1 -1
- package/dist/public/assets/{DocumentContext-DnGK7f-7.js → DocumentContext-BYGgYZ2Z.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-4-oU20Yd.js → EditorModeToggle-C2u2HBDQ.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-bEBqk79B.js → ExcalidrawDocEditor-3cWFGLDA.js} +1 -1
- package/dist/public/assets/FeedbackForm-DVva0ToF.js +1 -0
- package/dist/public/assets/{GraphPanel-D8IPaKtn.js → GraphPanel-75Gq3M8g.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-BIlSi8jA.js → ImportSkillDialog-Bmm_A48M.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-iivOiJ_A.js → LinkPreviewsSection-D1vvIPmT.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DHGeIjIC.js → LintConfigEditor-BQisgkvH.js} +1 -1
- package/dist/public/assets/{LintingSection-DtSj5SS_.js → LintingSection-DzEZScQO.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-D66m8JEi.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-DCt4z2iG.js → ManagedArtifactProperties-hfYg5-6i.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-C7FGmTIS.js → MermaidDocEditor-MIv7KZv3.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-B9a9_24L.js → NetworkAccessSection-BCuxmoVW.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-CVxoKTpG.js → ProjectTemplatesSection-BPIa6vCf.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-D56ZpX2V.js → PropertyDisplayRow-985cBoeD.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-NPQKGvMw.js → PublishToGitHubDialog-5rf5f26y.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-CNf09bvo.js → RegisteredAgentIcon-B86I4fPj.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-Cyjg356T.js → SchemaConfigEditor-BUucWy8_.js} +1 -1
- package/dist/public/assets/{SearchSection-BMqoHUM4.js → SearchSection-BzFkDyqq.js} +1 -1
- package/dist/public/assets/{SessionsHost-CRgShvSB.js → SessionsHost-B6hl-W6e.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BkrW_nE0.js → SettingsDialogBody-B3ybsuOx.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-Cl--AVvA.js → ShareReceiveMissDialog-B-YOLLM0.js} +1 -1
- package/dist/public/assets/{SkillCostValue-Br3p-1t8.js → SkillCostValue-D7i9jTwb.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-HHZBdD9G.js → SkillForkDialog-BePu5Ab7.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-CYZkBfwA.js → SkillInstallMenu-ChTMNTo3.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DaVrUMXJ.js → SkillOriginInline-BIqEXUYx.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DaFIqkzD.js → SkillToolbarControls-E4QCWXxQ.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-D4vdwn-z.js → SkillsManagerSection-CcVBU5-5.js} +1 -1
- package/dist/public/assets/{SlidesPluginSection-CIIOqcY1.js → SlidesPluginSection-DuYQPOmz.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-groMA2mx.js → SlidesToolbarControls-PbLGA15n.js} +1 -1
- package/dist/public/assets/{SourceEditor-D9ScUImM.js → SourceEditor-DNYR7CKG.js} +1 -1
- package/dist/public/assets/{SpellingSettings-D5xCXWwh.js → SpellingSettings-Bk20lUSX.js} +1 -1
- package/dist/public/assets/{SyncSection-1f2TKL_Y.js → SyncSection-DAj-Y4pM.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-CchTDe6B.js → SyncStatusBadge-WyZgmb6D.js} +1 -1
- package/dist/public/assets/{TemplateRow-Z1Yy07aA.js → TemplateRow-BOTg2YrV.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-DncO203O.js → TerminalLaunchContext-yYGkG_wD.js} +1 -1
- package/dist/public/assets/{TerminalPanel-D4_fMtJN.js → TerminalPanel-BSqB23c-.js} +1 -1
- package/dist/public/assets/{TerminalSection-RkwpYNK6.js → TerminalSection-P_OJ8LrU.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-Bizq7T-M.js → TerminalWindowApp-Dq_KzvrR.js} +1 -1
- package/dist/public/assets/{TextDocEditor-oVi7i468.js → TextDocEditor-BjIk7zxI.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-CDwd2bcE.js → ThemePluginSection-m8Juee1X.js} +1 -1
- package/dist/public/assets/{ThreadView-D5-hmsZf.js → ThreadView-E0-pZsPE.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-Do2sxIBv.js → TimelineDiffPane-BCirg-Ku.js} +1 -1
- package/dist/public/assets/{_envelope-DwyyiIO_-B2czcEJX.js → _envelope-q8XHEv4O-C-Qnl5Tu.js} +1 -1
- package/dist/public/assets/{agent-connections-Dj9-89rY.js → agent-connections-Ceoyy8dY.js} +1 -1
- package/dist/public/assets/{agent-registry-CUdBP9oP.js → agent-registry-BMw1B8Te.js} +1 -1
- package/dist/public/assets/{bridge-D0M08jrS.js → bridge-D7uDalkC.js} +1 -1
- package/dist/public/assets/{card-V6OFaQxm.js → card-BluRJrIS.js} +1 -1
- package/dist/public/assets/{catalog-eC0BYrwO.js → catalog-Cmn9-Gjm.js} +1 -1
- package/dist/public/assets/{client-version-BA6OCZa0.js → client-version-B-y3fQk6.js} +1 -1
- package/dist/public/assets/{comment-chips-DibE8LRk.js → comment-chips-DKKh1Wi2.js} +1 -1
- package/dist/public/assets/{config-provider-CAQzJBPy.js → config-provider-D8_UrWWz.js} +1 -1
- package/dist/public/assets/config-schema-yQrjUXxd.js +1 -0
- package/dist/public/assets/{css-color-to-hex-9GaMLm_g.js → css-color-to-hex-Bzp4vTWU.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-C-PBG9o0.js → doc-undo-manager-DTOg0O1B.js} +1 -1
- package/dist/public/assets/field-controls-Cwx83Wji.js +1 -0
- package/dist/public/assets/{field-controls-DrKhqiB3.js → field-controls-owKYZxR_.js} +1 -1
- package/dist/public/assets/{frontmatter-tags-BEkbJ1mW.js → frontmatter-tags-DRQIboHc.js} +1 -1
- package/dist/public/assets/{globals-DWENDqiP.css → globals-vYef5b1j.css} +1 -1
- package/dist/public/assets/{handoff-Ccrokk1b.js → handoff-Dqe1NvVI.js} +1 -1
- package/dist/public/assets/{index-1of4dc7v.js → index-DLKZwfmM.js} +8 -8
- package/dist/public/assets/{lint-config-client-D-AsWIBw.js → lint-config-client-BjslZut3.js} +1 -1
- package/dist/public/assets/{lint-plugins-ia8X-ZL0.js → lint-plugins-IJ9ueIoq.js} +1 -1
- package/dist/public/assets/{markdown-lint-DQqFORQu.js → markdown-lint-DHBRQg5Y.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DX9d-HpW.js → markdownlint-rule-browser-Cg9L-VTb.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-8PO3ggjr.js → pending-receive-nav-store-Bk339Ry2.js} +1 -1
- package/dist/public/assets/{preferred-session-events-BfQyHO9O.js → preferred-session-events-_-dJd5Q5.js} +1 -1
- package/dist/public/assets/{progress-C_P5sjg5.js → progress-B1YifhRi.js} +1 -1
- package/dist/public/assets/{saved-themes-client-Cu2_CM_R.js → saved-themes-client-DrFMFctS.js} +1 -1
- package/dist/public/assets/{schema-section-BYiWkCRw.js → schema-section-ZwfGVrsG.js} +1 -1
- package/dist/public/assets/{schemas-api-DbKS2FSh.js → schemas-api-CzN0ZSyO.js} +1 -1
- package/dist/public/assets/{selection-context-62-2q0su.js → selection-context-CXnTKou6.js} +1 -1
- package/dist/public/assets/{skills-api-B9YEcMtk.js → skills-api-DZKblPpK.js} +1 -1
- package/dist/public/assets/{src-Fp8fTIEP.js → src-CRjeSyxi.js} +1 -1
- package/dist/public/assets/storage-scope-RkgOxsbY.js +1 -0
- package/dist/public/assets/{tag-pill-input-CMMRt7b4.js → tag-pill-input-C2esRppI.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DI8suaT4.js → telemetry-impl-BGHJxX__.js} +1 -1
- package/dist/public/assets/{telemetry-startup-BXbrCtKM.js → telemetry-startup-CqIGLqf1.js} +1 -1
- package/dist/public/assets/terminal-cli-display-CsSKkkvh.js +1 -0
- package/dist/public/assets/{terminal-command-events-Bi72Lcf-.js → terminal-command-events-gsyNmK4P.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-C_GWUJjY.js → terminal-launch-events-0aq4jWnV.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B8FrkdJE.js → typing-burst-detector-BXH_c9PZ.js} +1 -1
- package/dist/public/assets/{uninstall-yrbrkUSW.js → uninstall-B-uEWMBM.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DzIIKheA.js → use-activity-panel-BfzIZAB_.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-D0H8BLH0.js → use-apply-config-color-theme-Ddh-kKyn.js} +1 -1
- package/dist/public/assets/{use-conflicts-WBuTv_RW.js → use-conflicts-BMDLXGd4.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-B-M8VGC3.js → use-live-xterm-theme-M-20jT-Q.js} +1 -1
- package/dist/public/assets/{use-open-skill-BhVtYf3Z.js → use-open-skill-DvN-m1ye.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-T5fnhjCX.js → use-semantic-search-status-BkAAt8Ua.js} +1 -1
- package/dist/public/assets/{use-skill-origin-CGXvvIZH.js → use-skill-origin-CKhQalbz.js} +1 -1
- package/dist/public/assets/{use-skill-targets-ED9Nr02L.js → use-skill-targets-6h1qor3V.js} +1 -1
- package/dist/public/assets/{use-skills-NvVxu3-j.js → use-skills-CdEaAQQ2.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-QNCXx6AL.js → use-terminal-enabled-xuYKn-zp.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CCXFO0cF.js → use-timeline-entry-diff-DhWXFbDg.js} +1 -1
- package/dist/public/assets/{use-workspace-eebQ7TvN.js → use-workspace-DLSxs3j7.js} +1 -1
- package/dist/public/index.html +52 -52
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-DfYNGpUS.mjs → registry-probes-DJmzCjem.mjs} +1 -1
- package/dist/{removal-file-path-D4yFgvd3.mjs → removal-file-path-D5mxCa9S.mjs} +1 -1
- package/dist/{repair-launch-json-hnw7Vz4K.mjs → repair-launch-json-VFb4aQfh.mjs} +1 -1
- package/dist/{repair-mcp-configs-Bymhl_R4.mjs → repair-mcp-configs-XpRJH2-z.mjs} +1 -1
- package/dist/{src-W8epkuZh.mjs → src-MRx7oPfu.mjs} +1 -1
- package/dist/src-txFqzl0c.mjs +1 -0
- package/dist/start-B2lITndM.mjs +1 -0
- package/dist/{start-BNM-Ewl9.mjs → start-Com2PFXp.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-CaFOyprZ.mjs +0 -1
- package/dist/dist-DO09Y6M7.mjs +0 -2212
- package/dist/init-DhRgHqpq.mjs +0 -1
- package/dist/loader-BW4TZHVu.mjs +0 -1
- package/dist/preview-BPuQatlI.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CJFCHJ2Q.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-37I-gX2R.js +0 -1
- package/dist/public/assets/config-schema-BRXEDN1T.js +0 -1
- package/dist/public/assets/field-controls-BXxM4mAl.js +0 -1
- package/dist/public/assets/storage-scope-DTSZLReS.js +0 -1
- package/dist/public/assets/terminal-cli-display-D_usGdw9.js +0 -1
- package/dist/src-BZsowcmP.mjs +0 -1
- package/dist/start-BFgwkKPg.mjs +0 -1
- /package/dist/public/assets/{globals-ChqKDCf_.js → globals-CXjhlGNL.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-DnGK7f-7.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-DbKS2FSh.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-B8FrkdJE.js";import{Gn as fe,S,U as C,a as pe,at as w,i as me,o as he,qn as T,st as E}from"./CodeMirrorPropInput-KdXe7bVw.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-CAQzJBPy.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-62-2q0su.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-DQqFORQu.js";import{l as Me}from"./lint-config-client-D-AsWIBw.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-qdJz-0d0.js";import{n as Be,t as Ve}from"./src-Fp8fTIEP.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=>w()?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{T(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:S()}}function zt(){return C()}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-BYGgYZ2Z.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-CzN0ZSyO.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-BXH_c9PZ.js";import{Gn as fe,S,U as C,a as pe,at as w,i as me,o as he,qn as T,st as E}from"./CodeMirrorPropInput-CWwqakNd.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-D8_UrWWz.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-CXnTKou6.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-DHBRQg5Y.js";import{l as Me}from"./lint-config-client-BjslZut3.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-qdJz-0d0.js";import{n as Be,t as Ve}from"./src-CRjeSyxi.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=>w()?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{T(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:S()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|