@inkeep/open-knowledge 0.89.1-beta.1 → 0.89.1-beta.2
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-DoMRl0kg.mjs → cli-hrqP4h40.mjs} +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/constants-Ctl7_9xt.mjs +1 -0
- package/dist/{dist-Bi-hqCKx.mjs → dist-Bjkn1RDc.mjs} +1 -1
- package/dist/{dist-8R56vWE-.mjs → dist-CFnRgnNU.mjs} +1 -1
- package/dist/index.mjs +198 -198
- package/dist/init-CVv8JJj8.mjs +1 -0
- package/dist/{init-B1caImSA.mjs → init-Cx9Rxf7N.mjs} +2 -2
- package/dist/{launch-json-removal-Dpm10YBT.mjs → launch-json-removal-CYWS0JND.mjs} +1 -1
- package/dist/{loader-DkbZGq6T.mjs → loader-CRzZ3bL9.mjs} +1 -1
- package/dist/loader-CljrifDX.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-BW5Abi4P.mjs → md-manager-BGnqyqi1-k6vY_bE4.mjs} +153 -153
- package/dist/{open-browser-zFYM6iXO.mjs → open-browser-DXHuWSGK.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-CVpqLSkj.mjs +1 -0
- package/dist/{preview-C8nzFJW5.mjs → preview-D7EfH4h5.mjs} +1 -1
- package/dist/public/assets/{AccountSection-d2DSPRXQ.js → AccountSection-CERERS6j.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-BSSMbl61.js → ActivityModeContent-DsgyoCAB.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-DfUA6cgg.js → AddPropertiesButton-_zrUbf4N.js} +2 -2
- package/dist/public/assets/{AgentConnectionsSection-t6Fpnhjm.js → AgentConnectionsSection-CQ49GpCE.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-jAt-TAsd.js → AgentDiffPane-Daq416te.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-Bqt8JDzy.js → AttachmentsSection-C8yIqGgR.js} +1 -1
- package/dist/public/assets/{AuthModal-CEKKOx6U.js → AuthModal-shp17yMo.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-D_PZiiCF.js → CodeMirrorPropInput-B-R29uWw.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-2wCt57l-.js → ContentRulesSection-C4jtLWxn.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-CS5Pw4WQ.js → DiffViewBoundary-H4_pqUgM.js} +1 -1
- package/dist/public/assets/{DocumentContext-T-KceKym.js → DocumentContext-Bz1OROnW.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CgxZqe-m.js → EditorModeToggle-dMBJ7uvp.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-CiCWuNjV.js → ExcalidrawDocEditor-s16H6agQ.js} +1 -1
- package/dist/public/assets/FeedbackForm-HXxtaDLX.js +1 -0
- package/dist/public/assets/{GraphPanel-DGKZ04lM.js → GraphPanel-DRGSNs9N.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DDZ84JyP.js → ImportSkillDialog-DfWdbonc.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-C4fLunLf.js → LinkPreviewsSection-vhHB3jqD.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-iI0gtQzd.js → LintConfigEditor-KrTSqaDB.js} +1 -1
- package/dist/public/assets/{LintingSection-DtVkHxc5.js → LintingSection-CKZ3P8VS.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-7-hqZaM9.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-BIXkL5qN.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BnR2Xn5X.js → MermaidDocEditor-Bsw-oIqc.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-Bf0XE9pR.js → NetworkAccessSection-SJS-J4JQ.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-Vt0-ODLw.js → ProjectTemplatesSection-BtbNNop0.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BgXMz3jE.js → PropertyDisplayRow-gRWBu_Kg.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-BkOtFKRk.js → PublishToGitHubDialog-CX7tkKOb.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-uXi2oPSE.js → RegisteredAgentIcon-_iMx9Az2.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DVP6ixbi.js → SchemaConfigEditor-CJVq58QC.js} +1 -1
- package/dist/public/assets/{SearchSection-ABP0q_sa.js → SearchSection-CAZXZVs_.js} +1 -1
- package/dist/public/assets/{SessionsHost-Dte9NiYB.js → SessionsHost-DLBNm1gB.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CEfy3hqh.js → SettingsDialogBody-BxqtBG99.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-eckzNsyO.js → ShareReceiveMissDialog-Bdve40Xh.js} +1 -1
- package/dist/public/assets/{SkillCostValue-D-VQUaZz.js → SkillCostValue-DNnKBu48.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-DcanSYND.js → SkillForkDialog-t2ZNulFL.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-DHtst-Z3.js → SkillInstallMenu-DahqFJUv.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-icYzVwfl.js → SkillOriginInline-DKy_SaSe.js} +1 -1
- package/dist/public/assets/{SkillPluginBundleDialog-fDl9XkF_.js → SkillPluginBundleDialog-cTIzGDgu.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-qwg2LGuz.js → SkillToolbarControls-CnGzFcPo.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-B0O776zf.js → SkillsManagerSection-DiiHZBGr.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-CvurVze_.js → SlidesToolbarControls-B_Dhwngm.js} +1 -1
- package/dist/public/assets/{SourceEditor-CatzT1iq.js → SourceEditor-Cv8ZrrkC.js} +1 -1
- package/dist/public/assets/{SpellingSettings-Dd69GxTK.js → SpellingSettings-D6-fXq3W.js} +1 -1
- package/dist/public/assets/{SyncSection-Ca-Xy2EQ.js → SyncSection-BspMrZD7.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-LuYwQEO9.js → SyncStatusBadge-Bx2KarKA.js} +1 -1
- package/dist/public/assets/{TemplateRow-DGghua5F.js → TemplateRow-XFA6UCGx.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-yfig3-dd.js → TerminalLaunchContext-BAhOMkGh.js} +1 -1
- package/dist/public/assets/{TerminalPanel-LjBUjgpU.js → TerminalPanel-DtZKl5jl.js} +1 -1
- package/dist/public/assets/{TerminalSection-D6eIWvZc.js → TerminalSection-DxNqZbKr.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BGZGyTWG.js → TerminalWindowApp-DHk1oWfn.js} +1 -1
- package/dist/public/assets/{TextDocEditor-BxohQ1uJ.js → TextDocEditor-BoLk6UF6.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-BvzKQgAy.js → ThemePluginSection-DlR5YwFJ.js} +2 -2
- package/dist/public/assets/{ThreadView-CvnueAl8.js → ThreadView-BvW_Y71B.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CYADEwc-.js → TimelineDiffPane-D3NayLjV.js} +1 -1
- package/dist/public/assets/{agent-connections-7HpNzYjL.js → agent-connections-A_hhtqiR.js} +1 -1
- package/dist/public/assets/{agent-registry-UV4Vx43J.js → agent-registry-C8nA2jGj.js} +1 -1
- package/dist/public/assets/{bridge-B2_zG6bo.js → bridge-D_Rj4MRC.js} +2 -2
- package/dist/public/assets/{catalog-C1Qnqxzu.js → catalog-DBWj7XRF.js} +1 -1
- package/dist/public/assets/{client-version-Bfa5zjVY.js → client-version-Bc6-pPZH.js} +1 -1
- package/dist/public/assets/{comment-chips-BQvEP061.js → comment-chips-Cd4-qRSd.js} +5 -5
- package/dist/public/assets/{config-provider-Dg0pvVd3.js → config-provider-DWypxu7o.js} +2 -2
- package/dist/public/assets/config-schema-D2jSQFMM.js +1 -0
- package/dist/public/assets/css-color-to-hex-CBqBwe8H.js +1 -0
- package/dist/public/assets/{doc-undo-manager-BaBypMUn.js → doc-undo-manager-Dq7MEh0L.js} +1 -1
- package/dist/public/assets/field-controls--PQCqQDj.js +1 -0
- package/dist/public/assets/{field-controls-lpcOn5ho.js → field-controls-BLyaKOIe.js} +1 -1
- package/dist/public/assets/{globals-BYIZIFwj.css → globals-BgIL5v2b.css} +1 -1
- package/dist/public/assets/{ime-composition-CNKa_WNE.js → ime-composition-Ddcsd_YR.js} +1 -1
- package/dist/public/assets/{index-CbmLy0-g.js → index-CWC_qSFs.js} +8 -8
- package/dist/public/assets/{lint-config-client-B7GJyltx.js → lint-config-client-Z9sBKSEv.js} +1 -1
- package/dist/public/assets/{lint-plugins-Du-m3J6J.js → lint-plugins-DgSC9Hv9.js} +1 -1
- package/dist/public/assets/{markdown-lint-DYkBgJHq.js → markdown-lint-DFVEIaWA.js} +3 -3
- package/dist/public/assets/{markdownlint-rule-browser-DwBeBBtP.js → markdownlint-rule-browser-BtgtXrJR.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-Ct_jE4k0.js → pending-receive-nav-store-D3jGzX3B.js} +1 -1
- package/dist/public/assets/{preferred-session-events-BT1NIHCN.js → preferred-session-events-CTqivfdw.js} +1 -1
- package/dist/public/assets/{progress-DMIqmKvY.js → progress-DXOKC1pm.js} +1 -1
- package/dist/public/assets/{saved-themes-client-BNonffrJ.js → saved-themes-client-kxsT1xkU.js} +1 -1
- package/dist/public/assets/{schema-section-BaTjzAhd.js → schema-section-vZpCCiqz.js} +1 -1
- package/dist/public/assets/schemas-api-GCpzPElr.js +112 -0
- package/dist/public/assets/{selection-context-Fu_wQpkM.js → selection-context-BtD-1e1A.js} +1 -1
- package/dist/public/assets/{skills-api-D9_3ttAz.js → skills-api-CVU5BFea.js} +1 -1
- package/dist/public/assets/{src-B4a34TOq.js → src-Cns8pcXR.js} +1 -1
- package/dist/public/assets/storage-scope-BlKX94ye.js +1 -0
- package/dist/public/assets/{tag-pill-input-DFLCUQhM.js → tag-pill-input-DvxgZAy7.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DNK1TcaX.js → telemetry-impl-CTRjXhrU.js} +1 -1
- package/dist/public/assets/{telemetry-startup-CY8mIIm_.js → telemetry-startup-BGY04k1y.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-CJnkcylC.js → terminal-launch-events-UxbfDwWi.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DCE1CeMS.js → typing-burst-detector-BCKiPmgE.js} +1 -1
- package/dist/public/assets/{uninstall-DW889IYH.js → uninstall-CNTtZHbH.js} +1 -1
- package/dist/public/assets/{use-activity-panel-g25TnKuz.js → use-activity-panel-BCatF3V2.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-UYP8FtjI.js → use-apply-config-color-theme-BHhf55f_.js} +2 -2
- package/dist/public/assets/{use-conflicts-DBMds-hY.js → use-conflicts-Cjhz5bOW.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BEAKdQrK.js → use-live-xterm-theme-DG6GUzYC.js} +1 -1
- package/dist/public/assets/{use-open-skill-DeG5hihF.js → use-open-skill-CmjcCu7y.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-Dd4pXwms.js → use-semantic-search-status-DlI1OyTd.js} +1 -1
- package/dist/public/assets/{use-skill-origin-Aw9Y3_sH.js → use-skill-origin-BcCOnd8W.js} +1 -1
- package/dist/public/assets/{use-skill-targets--mN_luk9.js → use-skill-targets-6us5Gawv.js} +1 -1
- package/dist/public/assets/{use-skills-CHU2m8ND.js → use-skills-Bd0z2p-y.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BFVYbUe3.js → use-terminal-enabled-DnXMHuVl.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-bZsvIfJA.js → use-timeline-entry-diff-i74pejmy.js} +1 -1
- package/dist/public/assets/{use-workspace-BTtr5NT8.js → use-workspace-CaZ8F0je.js} +1 -1
- package/dist/public/index.html +49 -49
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-C87Q_s9m.mjs → registry-probes-DqhiJA72.mjs} +1 -1
- package/dist/{removal-file-path-BVzrYa4N.mjs → removal-file-path-tM0-bc0E.mjs} +1 -1
- package/dist/{repair-launch-json-BAbNzm6q.mjs → repair-launch-json-NWK_VIUK.mjs} +1 -1
- package/dist/{repair-mcp-configs-uPKkEuAq.mjs → repair-mcp-configs-DoaRPP36.mjs} +1 -1
- package/dist/src-B-cOKkJj.mjs +1 -0
- package/dist/{src-T7yMw7Rk.mjs → src-BYrd3rNT.mjs} +1 -1
- package/dist/start-B5mowFnR.mjs +1 -0
- package/dist/{start-CGUUaJ72.mjs → start-DNoQwNnQ.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-DlPi9CHI.mjs +0 -1
- package/dist/init-d50PXKW8.mjs +0 -1
- package/dist/loader-iWYllkM7.mjs +0 -1
- package/dist/preview-CiFL_iQR.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CuqeRgLg.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CEfW7Yn2.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CXfmLo8A.js +0 -1
- package/dist/public/assets/config-schema-DVLRpubh.js +0 -1
- package/dist/public/assets/css-color-to-hex-CWNe6sew.js +0 -1
- package/dist/public/assets/field-controls-CijrX0Ja.js +0 -1
- package/dist/public/assets/schemas-api-CqmliOdH.js +0 -112
- package/dist/public/assets/storage-scope-BDcuM4d_.js +0 -1
- package/dist/src-CKoirByP.mjs +0 -1
- package/dist/start-Ba5kwiBn.mjs +0 -1
- /package/dist/public/assets/{globals-d08vt3yt.js → globals-BTW-fzbN.js} +0 -0
package/dist/public/assets/{SlidesToolbarControls-CvurVze_.js → SlidesToolbarControls-B_Dhwngm.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{i as o,n as s,t as c}from"./tooltip-BjuCvy5N.js";import{t as l}from"./button-DzgjsZzC.js";import{n as u}from"./dist-BGzUo_18.js";import{n as d,t as f}from"./workspace-paths-BjilyZF6.js";import{t as p}from"./createLucideIcon-DdBzwsHe.js";import{n as m}from"./bridge-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{i as o,n as s,t as c}from"./tooltip-BjuCvy5N.js";import{t as l}from"./button-DzgjsZzC.js";import{n as u}from"./dist-BGzUo_18.js";import{n as d,t as f}from"./workspace-paths-BjilyZF6.js";import{t as p}from"./createLucideIcon-DdBzwsHe.js";import{n as m}from"./bridge-D_Rj4MRC.js";import{n as h}from"./use-workspace-CaZ8F0je.js";import{t as g}from"./trace-api-nQInEDYS.js";var _=p(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{g.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=m(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=m(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();async function E(e,t,n,r){let i=u.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){u.dismiss(i);return}if(a.reason===`cancelled`){u.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}u.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),u.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),p=w(n,`slides`),m=O(p),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!p||m!==`available`)return null;let C=g==null?null:d(g.contentDir,f(a),g.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=c,j=l,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(o,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(s,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Bn as n,Cn as r,Gt as i,Jt as a,K as o,Q as s,Qt as c,U as l,Vn as u,Y as ee,in as d,lr as te,pr as f,q as ne,qt as p,rn as m,wt as re,xn as ie}from"./DocumentContext-T-KceKym.js";import{t as h}from"./react-f2sANaYj.js";import{r as ae}from"./dist-Nvb76hAm.js";import{n as oe}from"./dist-PQ5KMVDh.js";import{t as g}from"./compiler-runtime-BfE3aGVn.js";import{_t as _}from"./schemas-api-CqmliOdH.js";import{i as se}from"./use-apply-config-theme-CYFG76sS.js";import{T as ce,b as v,c as le,n as ue,o as y,r as de,t as fe,v as b,w as pe}from"./typing-burst-detector-DCE1CeMS.js";import{Q as me,Vn as x,a as he,gt as S,i as ge,mt as C,o as _e,x as w,zn as ve}from"./CodeMirrorPropInput-D_PZiiCF.js";import{a as T,i as E}from"./constants-skills-Coq7kn_k.js";import{t as ye}from"./diagnostic-breadcrumb-Mg7sdCfQ.js";import{n as D}from"./perf-CYJlqBBt.js";import{m as be}from"./config-provider-Dg0pvVd3.js";import{$ as O,At as k,Ct as A,E as j,J as M,K as N,Mt as P,N as F,Nt as I,Tt as xe,X as L,at as R,b as z,et as B,ft as Se,g as V,l as H,lt as Ce,ot as U,pt as W,st as G,tt as K,ut as q,v as J,wt as Y}from"./dist-CoJBCixp.js";import{a as we,i as Te}from"./cm-theme-DpKmjLo0.js";import{i as Ee,t as X}from"./dist-W5hM-kQ3.js";import{i as Z,n as Q,o as De,r as Oe}from"./dist-kajsw8zD.js";import{o as ke,r as Ae}from"./selection-context-Fu_wQpkM.js";import{C as je,D as Me,t as Ne}from"./markdown-lint-DYkBgJHq.js";import{l as Pe}from"./lint-config-client-B7GJyltx.js";import{a as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./dist-DMhg0Xyd.js";import{n as He,t as Ue}from"./src-B4a34TOq.js";var $=e(h(),1),We=g();function Ge(){let e=m();return e===null?null:new Set(e.keys())}function Ke(e,t,n){let r=[],a=F(e);if(n!=null){let i=[];for(let{from:e,to:n}of t)a.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return i.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>i.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);E.lastIndex=0;for(let e=E.exec(t);e!==null;e=E.exec(t)){let t=e[2];if(!T(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(N.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:o,to:s}of t)a.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let a=e.doc.sliceString(t.from,t.to),o=a.length-a.replace(/^`+/,``).length,s=a.length-a.replace(/`+$/,``).length,c=a.slice(o,a.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&T(l)&&n!=null)return r.push(N.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=i.exec(c);if(u)return r.push(N.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),N.set(r)}function qe(e){let t=a(e);return t===null?[]:[L.fromClass(class{decorations;constructor(e){this.decorations=Ke(e.state,e.visibleRanges,Ge())}update(e){(e.docChanged||e.viewportChanged||F(e.startState)!==F(e.state))&&(this.decorations=Ke(e.view.state,e.view.visibleRanges,Ge()))}},{decorations:e=>e.decorations}),M.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=m()?.get(i);return e===void 0?c():window.location.hash=d(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=p(t,e,o),!0)}})]}var Je=N.line({attributes:{dir:`auto`}});function Ye(e){let t=new k;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,Je),r=n.to+1}return t.finish()}var Xe=L.fromClass(class{decorations;constructor(e){this.decorations=Ye(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ye(e.view))}},{decorations:e=>e.decorations}),Ze=[M.perLineTextDirection.of(!0),Xe],Qe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),$e=`cm-lint-local-target`;function et(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 tt(e,t){let n=V(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Qe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function nt(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function rt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=tt(e,et(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:nt(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:$e})}return r}var it=P.define();function at(e){let t={findings:[]};return[Ie(e=>C()?rt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(it)))}),L.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:it.of(null)}),Ve(n)},i=b(e,e=>{e.status===`loaded`&&r(e.findings)}),a=S(()=>r(t.findings));return{destroy(){i(),a()}}})]}function ot(e,t){return e.enabled?[Le(),Ie(async n=>ct(n.state.doc,await je(n.state.doc.toString(),e,t)),{delay:600})]:[]}function st(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 ct(e,t){let n=[];for(let r of t){let t=st(e,r.range.start),i=st(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=lt(r);o&&(a.actions=[o]),n.push(a)}return n}function lt(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:st(n,e.range.start),to:st(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var ut=[q(),U(),G(),J(),B(),K(),xe.allowMultipleSelections.of(!0),j(),H(),Oe(),Q(),W(),O(),R(),Fe(),Ce.of([...Z,...X,...Be,...z,...De,...ze])],dt=N.mark({class:`cm-link-ref-broken`}),ft=/^\s{0,3}\[([^\]]+)\]:\s/,pt=/\[([^\]]*)\]\[([^\]]*)\]/g,mt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ht(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 gt(e){let t=[];return F(e).iterate({enter(e){if(mt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function _t(e){let t=new Set,n=[],r=e.doc,i=gt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ht(n.from,i))continue;let a=ft.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ht(t.from,i)&&!ft.test(t.text))for(pt.lastIndex=0;;){let e=pt.exec(t.text);if(!e)break;let r=t.from+e.index;if(ht(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(dt.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),N.set(a)}var vt=I.define({create(e){return _t(e)},update(e,t){return t.docChanged?_t(t.state):e},provide:e=>M.decorations.from(e)}),yt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,bt=N.mark({class:`cm-del`}),xt=N.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),St=N.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Ct(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function wt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!_.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(_.test(r.text))return{from:t.from,to:r.to}}return null}function Tt(e,t){let n=[],r=F(e),i=wt(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(bt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=yt.exec(r.text),a=i?i[1].length:2,o=N.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=Ct(r.text),a=N.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(xt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),N.set(n)}var Et=class{decorations;constructor(e){this.decorations=Tt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||F(e.startState)!==F(e.state))&&(this.decorations=Tt(e.view.state,e.view.visibleRanges))}},Dt=L.fromClass(Et,{decorations:e=>e.decorations});function Ot(){return[Dt,vt]}function kt(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function At(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||kt(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(),D(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var jt=new WeakMap;function Mt(e){return L.define(t=>{let n=At(e);return jt.set(t,n),{destroy(){n.destroy()}}})}function Nt(e,t){let n=jt.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var Pt=t(),Ft=P.define();function It(e,t){try{Nt(t.view,!1)}finally{try{u(t)}finally{x(e,t.view)}}}function Lt(e,t,n){let r=y(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return ye(ue,{...a,outcome:`no-target`}),!1;let o=f(n,`outline`,()=>{e.dispatch({selection:Y.cursor(i.from),effects:M.scrollIntoView(i.from,{y:`start`})}),e.focus()});return ye(ue,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Rt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);f(r,`raw-mdx`,()=>{e.dispatch({selection:Y.cursor(a),effects:M.scrollIntoView(a,{y:`center`})}),e.focus()})})}function zt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return f(n,`problems-row`,()=>{e.dispatch({selection:Y.cursor(o),effects:M.scrollIntoView(o,{y:`start`})}),e.focus()})}function Bt(e){let t=(0,We.c)(57),{docName:i,ytext:a,provider:c,placeholder:u,isSourceModeActive:d}=e,f=(0,$.useRef)(null),p=(0,$.useRef)(null),[m,h]=(0,$.useState)(null);if(m)throw m;let{resolvedTheme:g}=oe(),{_}=ae(),v;t[0]===_?v=t[1]:(v=_({id:`xbdtfY`}),t[0]=_,t[1]=v);let y=v,{merged:b}=se(),me=(0,$.useRef)(d),x=b?.editor?.wordWrap??!0,{data:S}=Pe(i),C;t[2]!==S?.effective||t[3]!==b?(C=S?.effective??(b?.contentRules?Me(b.contentRules):Ne),t[2]=S?.effective,t[3]=b,t[4]=C):C=t[4];let w=C,T;t[5]===w?T=t[6]:(T=JSON.stringify(w),t[5]=w,t[6]=T);let E=T,D=(0,$.useRef)(null),O;t[7]!==y||t[8]!==i||t[9]!==d||t[10]!==w||t[11]!==u||t[12]!==c||t[13]!==g||t[14]!==x||t[15]!==a?(O=()=>{let e=f.current;if(!e)return;let t=c.configuration.name??``,o,l=Ht;try{o=n({docName:t,container:e,sizeStats:{viewCount:0,bytes:a.length},factory:e=>{let n=null,o=new be(a);try{let ee=re({ydoc:c.document,ytext:a,docName:t}),d=new A,f=new A,ne=new A,p=new A,m=new M({state:xe.create({doc:a.toString(),extensions:[Te(y),ut,Ze,Re({scrollToMatch:e=>te(t,`find-match`)?M.scrollIntoView(e,{y:`start`}):Ft.of(null)}),Ce.of([Ee]),Ue(a,c.awareness,{undoManager:o}),Ce.of(He),Mt({docName:t,ytext:a,undoManager:o}),...ge({themeCompartment:d,resolvedTheme:g,ydoc:c.document,wordWrapCompartment:f,wordWrap:x,currentDocName:t}),Ot(),qe(t),s(),p.of(ot(w,i)),at(i),ee,M.updateListener.of(e=>{ie(e)&&r(t)}),M.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,pe(t,`source`,ce(e.view)),Ae(t,`source`,ke(e.view,t))},120))}),ne.of(Se(u??``)),M.theme({"&":{height:`100%`}}),M.scrollMargins.of(Vt)]}),parent:e});pe(t,`source`,ce(m)),Ae(t,`source`,ke(m,t));let h=m.contentDOM;return h.addEventListener(`keydown`,l),h.addEventListener(`paste`,l),h.addEventListener(`drop`,l),h.addEventListener(`cut`,l),{view:m,ydoc:c.document,ytext:a,provider:c,undoManager:o,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:ne,lintCompartment:p}}catch(e){let t=e;throw o.destroy(),t}}}),D.current=o,p.current=o.view,Nt(o.view,d),ve(i,o.view,`sourceEditor`),fe()&&o.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&It(i,e)}},t[7]=y,t[8]=i,t[9]=d,t[10]=w,t[11]=u,t[12]=c,t[13]=g,t[14]=x,t[15]=a,t[16]=O):O=t[16];let k;t[17]!==c||t[18]!==a?(k=[a,c],t[17]=c,t[18]=a,t[19]=k):k=t[19],(0,$.useEffect)(O,k);let j,N;t[20]===d?(j=t[21],N=t[22]):(j=()=>{me.current=d;let e=p.current;e&&Nt(e,d)},N=[d],t[20]=d,t[21]=j,t[22]=N),(0,$.useEffect)(j,N);let P,F;t[23]===i?(P=t[24],F=t[25]):(P=()=>{},F=[i],t[23]=i,t[24]=P,t[25]=F),(0,$.useEffect)(P,F);let I,L;t[26]===g?(I=t[27],L=t[28]):(I=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(g===`dark`?he:_e)})},L=[g],t[26]=g,t[27]=I,t[28]=L),(0,$.useEffect)(I,L);let R,z;t[29]===x?(R=t[30],z=t[31]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?M.lineWrapping:[])})},z=[x],t[29]=x,t[30]=R,t[31]=z),(0,$.useEffect)(R,z);let B,V;t[32]===u?(B=t[33],V=t[34]):(B=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(Se(u??``))})},V=[u],t[32]=u,t[33]=B,t[34]=V),(0,$.useEffect)(B,V);let H,U;t[35]===y?(H=t[36],U=t[37]):(H=()=>{let e=D.current;e&&we(e.view,y)},U=[y],t[35]=y,t[36]=H,t[37]=U),(0,$.useEffect)(H,U);let W;t[38]!==i||t[39]!==w?(W=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(ot(w,i))})},t[38]=i,t[39]=w,t[40]=W):W=t[40];let G;t[41]===E?G=t[42]:(G=[E],t[41]=E,t[42]=G),(0,$.useEffect)(W,G);let K,q;t[43]!==i||t[44]!==d?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`source`||!d)return;let n=p.current;if(!n){ye(ue,{docName:i,mode:`source`,index:t.index,outcome:`no-view`});return}Lt(n,t,i)&&t.onNavigated?.(n.contentDOM),o(i)};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},q=[i,d],t[43]=i,t[44]=d,t[45]=K,t[46]=q):(K=t[45],q=t[46]),(0,$.useEffect)(K,q);let J,Y;t[47]!==i||t[48]!==d?(J=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||!d)return;let n=p.current;n&&zt(n,t,i)&&(o(i),t.onNavigated?.(n.contentDOM))};return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},Y=[i,d],t[47]=i,t[48]=d,t[49]=J,t[50]=Y):(J=t[49],Y=t[50]),(0,$.useEffect)(J,Y);let X,Z;t[51]!==i||t[52]!==d||t[53]!==c?(X=()=>{if(!d)return;let e=p.current;if(!e)return;let t=ee(i);if(!t)return;if(t.kind!==`selection-offset`){ne(i),t.kind===`outline`?Lt(e,t.detail,i)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?zt(e,t.detail,i)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Rt(e,t.detail,()=>me.current,i);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=ee(i);t?.kind===`selection-offset`&&(r=l({view:e,docName:i,navigation:t,ydoc:c.document,transition:{from:`wysiwyg`,to:`source`}}),r&&ne(i))}),()=>{n=!0,r?.cancel(`mode-flip`)}},Z=[i,d,c],t[51]=i,t[52]=d,t[53]=c,t[54]=X,t[55]=Z):(X=t[54],Z=t[55]),(0,$.useEffect)(X,Z);let Q;return t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,Pt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[56]=Q):Q=t[56],Q}function Vt(){return{top:w()}}function Ht(){return me()}export{Bt as SourceEditor,Rt as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Bn as n,Cn as r,Gt as i,Jt as a,K as o,Q as s,Qt as c,U as l,Vn as u,Y as ee,in as d,lr as te,pr as f,q as ne,qt as p,rn as m,wt as re,xn as ie}from"./DocumentContext-Bz1OROnW.js";import{t as h}from"./react-f2sANaYj.js";import{r as ae}from"./dist-Nvb76hAm.js";import{n as oe}from"./dist-PQ5KMVDh.js";import{t as g}from"./compiler-runtime-BfE3aGVn.js";import{_t as _}from"./schemas-api-GCpzPElr.js";import{i as se}from"./use-apply-config-theme-CYFG76sS.js";import{T as ce,b as v,c as le,n as ue,o as y,r as de,t as fe,v as b,w as pe}from"./typing-burst-detector-BCKiPmgE.js";import{Q as me,Vn as x,a as he,gt as S,i as ge,mt as C,o as _e,x as w,zn as ve}from"./CodeMirrorPropInput-B-R29uWw.js";import{a as T,i as E}from"./constants-skills-Coq7kn_k.js";import{t as ye}from"./diagnostic-breadcrumb-Mg7sdCfQ.js";import{n as D}from"./perf-CYJlqBBt.js";import{m as be}from"./config-provider-DWypxu7o.js";import{$ as O,At as k,Ct as A,E as j,J as M,K as N,Mt as P,N as F,Nt as I,Tt as xe,X as L,at as R,b as z,et as B,ft as Se,g as V,l as H,lt as Ce,ot as U,pt as W,st as G,tt as K,ut as q,v as J,wt as Y}from"./dist-CoJBCixp.js";import{a as we,i as Te}from"./cm-theme-DpKmjLo0.js";import{i as Ee,t as X}from"./dist-W5hM-kQ3.js";import{i as Z,n as Q,o as De,r as Oe}from"./dist-kajsw8zD.js";import{o as ke,r as Ae}from"./selection-context-BtD-1e1A.js";import{C as je,D as Me,t as Ne}from"./markdown-lint-DFVEIaWA.js";import{l as Pe}from"./lint-config-client-Z9sBKSEv.js";import{a as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./dist-DMhg0Xyd.js";import{n as He,t as Ue}from"./src-Cns8pcXR.js";var $=e(h(),1),We=g();function Ge(){let e=m();return e===null?null:new Set(e.keys())}function Ke(e,t,n){let r=[],a=F(e);if(n!=null){let i=[];for(let{from:e,to:n}of t)a.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return i.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>i.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);E.lastIndex=0;for(let e=E.exec(t);e!==null;e=E.exec(t)){let t=e[2];if(!T(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(N.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:o,to:s}of t)a.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let a=e.doc.sliceString(t.from,t.to),o=a.length-a.replace(/^`+/,``).length,s=a.length-a.replace(/`+$/,``).length,c=a.slice(o,a.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&T(l)&&n!=null)return r.push(N.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=i.exec(c);if(u)return r.push(N.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),N.set(r)}function qe(e){let t=a(e);return t===null?[]:[L.fromClass(class{decorations;constructor(e){this.decorations=Ke(e.state,e.visibleRanges,Ge())}update(e){(e.docChanged||e.viewportChanged||F(e.startState)!==F(e.state))&&(this.decorations=Ke(e.view.state,e.view.visibleRanges,Ge()))}},{decorations:e=>e.decorations}),M.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=m()?.get(i);return e===void 0?c():window.location.hash=d(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=p(t,e,o),!0)}})]}var Je=N.line({attributes:{dir:`auto`}});function Ye(e){let t=new k;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,Je),r=n.to+1}return t.finish()}var Xe=L.fromClass(class{decorations;constructor(e){this.decorations=Ye(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ye(e.view))}},{decorations:e=>e.decorations}),Ze=[M.perLineTextDirection.of(!0),Xe],Qe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),$e=`cm-lint-local-target`;function et(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 tt(e,t){let n=V(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Qe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function nt(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function rt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=tt(e,et(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:nt(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:$e})}return r}var it=P.define();function at(e){let t={findings:[]};return[Ie(e=>C()?rt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(it)))}),L.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:it.of(null)}),Ve(n)},i=b(e,e=>{e.status===`loaded`&&r(e.findings)}),a=S(()=>r(t.findings));return{destroy(){i(),a()}}})]}function ot(e,t){return e.enabled?[Le(),Ie(async n=>ct(n.state.doc,await je(n.state.doc.toString(),e,t)),{delay:600})]:[]}function st(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 ct(e,t){let n=[];for(let r of t){let t=st(e,r.range.start),i=st(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=lt(r);o&&(a.actions=[o]),n.push(a)}return n}function lt(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:st(n,e.range.start),to:st(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var ut=[q(),U(),G(),J(),B(),K(),xe.allowMultipleSelections.of(!0),j(),H(),Oe(),Q(),W(),O(),R(),Fe(),Ce.of([...Z,...X,...Be,...z,...De,...ze])],dt=N.mark({class:`cm-link-ref-broken`}),ft=/^\s{0,3}\[([^\]]+)\]:\s/,pt=/\[([^\]]*)\]\[([^\]]*)\]/g,mt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ht(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 gt(e){let t=[];return F(e).iterate({enter(e){if(mt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function _t(e){let t=new Set,n=[],r=e.doc,i=gt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ht(n.from,i))continue;let a=ft.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ht(t.from,i)&&!ft.test(t.text))for(pt.lastIndex=0;;){let e=pt.exec(t.text);if(!e)break;let r=t.from+e.index;if(ht(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(dt.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),N.set(a)}var vt=I.define({create(e){return _t(e)},update(e,t){return t.docChanged?_t(t.state):e},provide:e=>M.decorations.from(e)}),yt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,bt=N.mark({class:`cm-del`}),xt=N.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),St=N.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Ct(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function wt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!_.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(_.test(r.text))return{from:t.from,to:r.to}}return null}function Tt(e,t){let n=[],r=F(e),i=wt(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(bt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=yt.exec(r.text),a=i?i[1].length:2,o=N.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=Ct(r.text),a=N.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(xt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),N.set(n)}var Et=class{decorations;constructor(e){this.decorations=Tt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||F(e.startState)!==F(e.state))&&(this.decorations=Tt(e.view.state,e.view.visibleRanges))}},Dt=L.fromClass(Et,{decorations:e=>e.decorations});function Ot(){return[Dt,vt]}function kt(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function At(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||kt(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(),D(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var jt=new WeakMap;function Mt(e){return L.define(t=>{let n=At(e);return jt.set(t,n),{destroy(){n.destroy()}}})}function Nt(e,t){let n=jt.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var Pt=t(),Ft=P.define();function It(e,t){try{Nt(t.view,!1)}finally{try{u(t)}finally{x(e,t.view)}}}function Lt(e,t,n){let r=y(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return ye(ue,{...a,outcome:`no-target`}),!1;let o=f(n,`outline`,()=>{e.dispatch({selection:Y.cursor(i.from),effects:M.scrollIntoView(i.from,{y:`start`})}),e.focus()});return ye(ue,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Rt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);f(r,`raw-mdx`,()=>{e.dispatch({selection:Y.cursor(a),effects:M.scrollIntoView(a,{y:`center`})}),e.focus()})})}function zt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return f(n,`problems-row`,()=>{e.dispatch({selection:Y.cursor(o),effects:M.scrollIntoView(o,{y:`start`})}),e.focus()})}function Bt(e){let t=(0,We.c)(57),{docName:i,ytext:a,provider:c,placeholder:u,isSourceModeActive:d}=e,f=(0,$.useRef)(null),p=(0,$.useRef)(null),[m,h]=(0,$.useState)(null);if(m)throw m;let{resolvedTheme:g}=oe(),{_}=ae(),v;t[0]===_?v=t[1]:(v=_({id:`xbdtfY`}),t[0]=_,t[1]=v);let y=v,{merged:b}=se(),me=(0,$.useRef)(d),x=b?.editor?.wordWrap??!0,{data:S}=Pe(i),C;t[2]!==S?.effective||t[3]!==b?(C=S?.effective??(b?.contentRules?Me(b.contentRules):Ne),t[2]=S?.effective,t[3]=b,t[4]=C):C=t[4];let w=C,T;t[5]===w?T=t[6]:(T=JSON.stringify(w),t[5]=w,t[6]=T);let E=T,D=(0,$.useRef)(null),O;t[7]!==y||t[8]!==i||t[9]!==d||t[10]!==w||t[11]!==u||t[12]!==c||t[13]!==g||t[14]!==x||t[15]!==a?(O=()=>{let e=f.current;if(!e)return;let t=c.configuration.name??``,o,l=Ht;try{o=n({docName:t,container:e,sizeStats:{viewCount:0,bytes:a.length},factory:e=>{let n=null,o=new be(a);try{let ee=re({ydoc:c.document,ytext:a,docName:t}),d=new A,f=new A,ne=new A,p=new A,m=new M({state:xe.create({doc:a.toString(),extensions:[Te(y),ut,Ze,Re({scrollToMatch:e=>te(t,`find-match`)?M.scrollIntoView(e,{y:`start`}):Ft.of(null)}),Ce.of([Ee]),Ue(a,c.awareness,{undoManager:o}),Ce.of(He),Mt({docName:t,ytext:a,undoManager:o}),...ge({themeCompartment:d,resolvedTheme:g,ydoc:c.document,wordWrapCompartment:f,wordWrap:x,currentDocName:t}),Ot(),qe(t),s(),p.of(ot(w,i)),at(i),ee,M.updateListener.of(e=>{ie(e)&&r(t)}),M.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,pe(t,`source`,ce(e.view)),Ae(t,`source`,ke(e.view,t))},120))}),ne.of(Se(u??``)),M.theme({"&":{height:`100%`}}),M.scrollMargins.of(Vt)]}),parent:e});pe(t,`source`,ce(m)),Ae(t,`source`,ke(m,t));let h=m.contentDOM;return h.addEventListener(`keydown`,l),h.addEventListener(`paste`,l),h.addEventListener(`drop`,l),h.addEventListener(`cut`,l),{view:m,ydoc:c.document,ytext:a,provider:c,undoManager:o,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:ne,lintCompartment:p}}catch(e){let t=e;throw o.destroy(),t}}}),D.current=o,p.current=o.view,Nt(o.view,d),ve(i,o.view,`sourceEditor`),fe()&&o.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&It(i,e)}},t[7]=y,t[8]=i,t[9]=d,t[10]=w,t[11]=u,t[12]=c,t[13]=g,t[14]=x,t[15]=a,t[16]=O):O=t[16];let k;t[17]!==c||t[18]!==a?(k=[a,c],t[17]=c,t[18]=a,t[19]=k):k=t[19],(0,$.useEffect)(O,k);let j,N;t[20]===d?(j=t[21],N=t[22]):(j=()=>{me.current=d;let e=p.current;e&&Nt(e,d)},N=[d],t[20]=d,t[21]=j,t[22]=N),(0,$.useEffect)(j,N);let P,F;t[23]===i?(P=t[24],F=t[25]):(P=()=>{},F=[i],t[23]=i,t[24]=P,t[25]=F),(0,$.useEffect)(P,F);let I,L;t[26]===g?(I=t[27],L=t[28]):(I=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(g===`dark`?he:_e)})},L=[g],t[26]=g,t[27]=I,t[28]=L),(0,$.useEffect)(I,L);let R,z;t[29]===x?(R=t[30],z=t[31]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?M.lineWrapping:[])})},z=[x],t[29]=x,t[30]=R,t[31]=z),(0,$.useEffect)(R,z);let B,V;t[32]===u?(B=t[33],V=t[34]):(B=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(Se(u??``))})},V=[u],t[32]=u,t[33]=B,t[34]=V),(0,$.useEffect)(B,V);let H,U;t[35]===y?(H=t[36],U=t[37]):(H=()=>{let e=D.current;e&&we(e.view,y)},U=[y],t[35]=y,t[36]=H,t[37]=U),(0,$.useEffect)(H,U);let W;t[38]!==i||t[39]!==w?(W=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(ot(w,i))})},t[38]=i,t[39]=w,t[40]=W):W=t[40];let G;t[41]===E?G=t[42]:(G=[E],t[41]=E,t[42]=G),(0,$.useEffect)(W,G);let K,q;t[43]!==i||t[44]!==d?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`source`||!d)return;let n=p.current;if(!n){ye(ue,{docName:i,mode:`source`,index:t.index,outcome:`no-view`});return}Lt(n,t,i)&&t.onNavigated?.(n.contentDOM),o(i)};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},q=[i,d],t[43]=i,t[44]=d,t[45]=K,t[46]=q):(K=t[45],q=t[46]),(0,$.useEffect)(K,q);let J,Y;t[47]!==i||t[48]!==d?(J=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||!d)return;let n=p.current;n&&zt(n,t,i)&&(o(i),t.onNavigated?.(n.contentDOM))};return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},Y=[i,d],t[47]=i,t[48]=d,t[49]=J,t[50]=Y):(J=t[49],Y=t[50]),(0,$.useEffect)(J,Y);let X,Z;t[51]!==i||t[52]!==d||t[53]!==c?(X=()=>{if(!d)return;let e=p.current;if(!e)return;let t=ee(i);if(!t)return;if(t.kind!==`selection-offset`){ne(i),t.kind===`outline`?Lt(e,t.detail,i)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?zt(e,t.detail,i)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Rt(e,t.detail,()=>me.current,i);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=ee(i);t?.kind===`selection-offset`&&(r=l({view:e,docName:i,navigation:t,ydoc:c.document,transition:{from:`wysiwyg`,to:`source`}}),r&&ne(i))}),()=>{n=!0,r?.cancel(`mode-flip`)}},Z=[i,d,c],t[51]=i,t[52]=d,t[53]=c,t[54]=X,t[55]=Z):(X=t[54],Z=t[55]),(0,$.useEffect)(X,Z);let Q;return t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,Pt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[56]=Q):Q=t[56],Q}function Vt(){return{top:w()}}function Ht(){return me()}export{Bt as SourceEditor,Rt as applyRawMdxNavigation};
|