@inkeep/open-knowledge 0.84.0-beta.14 → 0.84.0-beta.15
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-Dx_xivnl.mjs +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +1 -1
- package/dist/init-D6udPHxT.mjs +1 -0
- package/dist/{init-PjjvTgrO.mjs → init-D7xJ2Da1.mjs} +2 -2
- package/dist/{launch-json-removal-DlVzHl6B.mjs → launch-json-removal-yITANHVv.mjs} +1 -1
- package/dist/{loader-BQS4fl0m.mjs → loader-DEsJ6cbi.mjs} +1 -1
- package/dist/loader-cbffIJh0.mjs +1 -0
- package/dist/{preview-3gk2i1xX.mjs → preview-BpNAQwx1.mjs} +1 -1
- package/dist/preview-CWFiSHpN.mjs +1 -0
- package/dist/public/assets/AboutSection-D_23z-dF.js +1 -0
- package/dist/public/assets/{AccountSection-CcrCMfiM.js → AccountSection-CX8JFSjG.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-Dxzg-NgH.js → ActivityModeContent-BEykNw6x.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-BUhk-vu0.js → AddPropertiesButton-QwmSbaJ_.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-B_LwSP7B.js → AgentDiffPane-CW6t8oHQ.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-BJiZQ2MV.js → AttachmentsSection-DJe75llC.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DkRMFYIK.js → CodeMirrorPropInput-Bw2exRGi.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-D4g32j4R.js → ContentRulesSection-DjXLncHK.js} +1 -1
- package/dist/public/assets/{DocumentContext-BZi2BNlk.js → DocumentContext-DxFlTFCf.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CCHArnnt.js → EditorModeToggle-BqdUrhSe.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-ffnyxme7.js → ExcalidrawDocEditor-B_6khl7R.js} +1 -1
- package/dist/public/assets/FeedbackForm-Ba24EUkr.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-D_5FqPZM.js → ImportSkillDialog-DXmAbBD6.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-rwx7LdIg.js → LinkPreviewsSection-KiL4sajy.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DaoCksvr.js → LintConfigEditor-C245enSy.js} +1 -1
- package/dist/public/assets/{LintingSection-D5I7tYlt.js → LintingSection-Fz0wphRq.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-CUpup7ho.js → ManagedArtifactProperties-8EMT2aWH.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CZRptWJk.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-B3KYptUs.js → MermaidDocEditor-CEpP16q2.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-LjctJODc.js → NetworkAccessSection-DFuCKJ8K.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-7RWIVmXg.js → ProjectTemplatesSection-B-AUPC6m.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-CrzwKvEA.js → PropertyDisplayRow-BrzUitO1.js} +2 -2
- package/dist/public/assets/{PublishToGitHubDialog-DYdMkEyQ.js → PublishToGitHubDialog-UZDC6_Vr.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DIGJxK72.js → SchemaConfigEditor-CcJ5M-75.js} +1 -1
- package/dist/public/assets/{SearchSection-BS4FOrKH.js → SearchSection-64mL6tsL.js} +1 -1
- package/dist/public/assets/{SessionsHost-BtjoWr0r.js → SessionsHost-MdX8mKaO.js} +2 -2
- package/dist/public/assets/SettingsDialogBody-C2zy-q5H.js +2 -0
- package/dist/public/assets/{ShareReceiveMissDialog-DUrgcHzv.js → ShareReceiveMissDialog-DXX82j6K.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-Cvg-HsNg.js → SkillToolbarControls-D7q-4E-v.js} +1 -1
- package/dist/public/assets/{SlidesPluginSection-DuBoITZp.js → SlidesPluginSection-Dc5MqsXL.js} +1 -1
- package/dist/public/assets/{SourceEditor-D9DNsiLu.js → SourceEditor-CGMTOKej.js} +1 -1
- package/dist/public/assets/{SpellingSettings-BpZv35LE.js → SpellingSettings-DUJM89JE.js} +1 -1
- package/dist/public/assets/{SyncSection-CrxvCruv.js → SyncSection-CXjvKELx.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-BDB1rnZs.js → SyncStatusBadge-C0M3Vh9t.js} +1 -1
- package/dist/public/assets/{TerminalSection-D8ayxcw-.js → TerminalSection-CxpJhGiA.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-5w8Pgr5J.js → TerminalWindowApp-Ds3qDmZM.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CJVX7Iiq.js → TextDocEditor-D4uIqVnA.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-Dj2GGGoa.js → ThemePluginSection-CizNpiAG.js} +1 -1
- package/dist/public/assets/{ThreadView-B8B9FyFL.js → ThreadView-CJtpu--q.js} +3 -3
- package/dist/public/assets/{TimelineDiffPane-Dap3gK1f.js → TimelineDiffPane-q1KqK6Y3.js} +1 -1
- package/dist/public/assets/{comment-chips-BuYSFClb.js → comment-chips-BGf8nvaY.js} +1 -1
- package/dist/public/assets/{config-provider-CyBtB5MG.js → config-provider-MlOyOUAX.js} +1 -1
- package/dist/public/assets/config-schema-DSj91SAu.js +1 -0
- package/dist/public/assets/{doc-undo-manager-SYl0ECng.js → doc-undo-manager-Cqbr9JQk.js} +1 -1
- package/dist/public/assets/{field-controls-BBWVj3AF.js → field-controls-BLwJrin4.js} +1 -1
- package/dist/public/assets/field-controls-BxZbpvVJ.js +1 -0
- package/dist/public/assets/index-C2sVwj67.js +2205 -0
- package/dist/public/assets/{lint-config-client-CB91vevq.js → lint-config-client-DhP_RDHH.js} +1 -1
- package/dist/public/assets/{lint-plugins-CvfQPI2r.js → lint-plugins-DSBUViTP.js} +1 -1
- package/dist/public/assets/{markdown-lint-ZeKFkjFe.js → markdown-lint-BmjyI9ZU.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-BbmlUEor.js → markdownlint-rule-browser-BADH1Lka.js} +1 -1
- package/dist/public/assets/messages-BT33WTY4.js +1 -0
- package/dist/public/assets/messages-B_gBh8es.js +1 -0
- package/dist/public/assets/messages-BkJsr6GH.js +1 -0
- package/dist/public/assets/messages-CUhRQF6Z.js +1 -0
- package/dist/public/assets/messages-CfM_V0is.js +1 -0
- package/dist/public/assets/messages-Cilh2EEK.js +1 -0
- package/dist/public/assets/messages-CoC6kH02.js +1 -0
- package/dist/public/assets/messages-D8jal7DN.js +1 -0
- package/dist/public/assets/messages-DHbSVEtI.js +1 -0
- package/dist/public/assets/messages-DlgKcLpa.js +1 -0
- package/dist/public/assets/messages-Dot6gpGm.js +1 -0
- package/dist/public/assets/messages-Dy_NuDHm.js +1 -0
- package/dist/public/assets/messages-Zy-8a3Uz.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-BRYTI4O-.js → pending-receive-nav-store-DBlCLQls.js} +1 -1
- package/dist/public/assets/{progress-CTEVJNXO.js → progress-CRDr9er-.js} +1 -1
- package/dist/public/assets/{saved-themes-client-DQK5ylqX.js → saved-themes-client-CSjCi4YD.js} +1 -1
- package/dist/public/assets/{schema-section-BdTNVIyL.js → schema-section-H3icVnyE.js} +1 -1
- package/dist/public/assets/{selection-context-D9wsGgDp.js → selection-context-DioyxMXd.js} +1 -1
- package/dist/public/assets/{src-DOSqBXQd.js → src-CuvAhAc9.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DYOSyLF7.js → telemetry-impl-IKiAVHH4.js} +2 -2
- package/dist/public/assets/{telemetry-startup-CjpELDqd.js → telemetry-startup-BFzjCsbk.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CNLhok7Q.js → typing-burst-detector-DbyT-0Jk.js} +1 -1
- package/dist/public/assets/{uninstall-CfBkwPz3.js → uninstall-Bo2t4rIS.js} +1 -1
- package/dist/public/assets/{use-activity-panel-JcDF_NGH.js → use-activity-panel-vvKYIJn4.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-quJJgq3F.js → use-apply-config-language-D-iaXzSu.js} +2 -2
- package/dist/public/assets/{use-open-skill-BejdmcK8.js → use-open-skill-DeZKcKIH.js} +1 -1
- package/dist/public/assets/use-settings-route-CikTq5Vq.js +1 -0
- package/dist/public/assets/{use-terminal-enabled-CqtBhC9Q.js → use-terminal-enabled-Bettx1jk.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-JiMHabs-.js → use-timeline-entry-diff-CPNjboIa.js} +1 -1
- package/dist/public/index.html +22 -22
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-BJWCp_zI.mjs → registry-probes-DgQrTNN0.mjs} +1 -1
- package/dist/{removal-file-path-CnXRatEs.mjs → removal-file-path-DFn5hKsA.mjs} +1 -1
- package/dist/{repair-launch-json-DCtFnoyJ.mjs → repair-launch-json-DKTYbYxZ.mjs} +1 -1
- package/dist/{repair-mcp-configs-BbWY7hPn.mjs → repair-mcp-configs-DeeefhTM.mjs} +1 -1
- package/dist/{src-BQPZHOpx.mjs → src-DxlSnL0q.mjs} +1 -1
- package/dist/src-TaiFuA_p.mjs +1 -0
- package/dist/{start-6rBE8R0Q.mjs → start-DjkskNc7.mjs} +2 -2
- package/dist/start-kmmviJeA.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-B3X-QRRf.mjs +0 -1
- package/dist/init-SyGGlOHV.mjs +0 -1
- package/dist/loader-aoEqsyEe.mjs +0 -1
- package/dist/preview-BhWNX5ES.mjs +0 -1
- package/dist/public/assets/FeedbackForm-DNCliMhK.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Cjwb2bDX.js +0 -1
- package/dist/public/assets/SettingsDialogBody-BA2gB2VO.js +0 -2
- package/dist/public/assets/config-schema-Dj0e1pm8.js +0 -1
- package/dist/public/assets/field-controls-BshUGsc5.js +0 -1
- package/dist/public/assets/index-CbKG13-E.js +0 -2205
- package/dist/public/assets/messages-ANXyJliY.js +0 -1
- package/dist/public/assets/messages-B1FZsv56.js +0 -1
- package/dist/public/assets/messages-B4Ao4T-h.js +0 -1
- package/dist/public/assets/messages-BcdGkp91.js +0 -1
- package/dist/public/assets/messages-CHvjKumb.js +0 -1
- package/dist/public/assets/messages-D0VuVwkB.js +0 -1
- package/dist/public/assets/messages-DY9xlGMT.js +0 -1
- package/dist/public/assets/messages-DfEF3nXA.js +0 -1
- package/dist/public/assets/messages-MLW9EqLI.js +0 -1
- package/dist/public/assets/messages-WD_ZkqZv.js +0 -1
- package/dist/public/assets/messages-WyXTlpZd.js +0 -1
- package/dist/public/assets/messages-dexq95NM.js +0 -1
- package/dist/public/assets/messages-jgN1s75x.js +0 -1
- package/dist/public/assets/use-settings-route-BVEU1nrV.js +0 -1
- package/dist/src-B6vlrcvu.mjs +0 -1
- package/dist/start-uwbHcniG.mjs +0 -1
- /package/dist/public/assets/{AgentConnectionsSection-DuO_iqz2.js → AgentConnectionsSection-C4Y6AXkF.js} +0 -0
- /package/dist/public/assets/{HotkeysSection-CR1clX0T.js → HotkeysSection-BroWUkWa.js} +0 -0
- /package/dist/public/assets/{IntegrationsSection-DXEcrIhV.js → IntegrationsSection-Bem--yGZ.js} +0 -0
- /package/dist/public/assets/{OkCliPathRow-uIsebjQL.js → OkCliPathRow-BtSsFiGL.js} +0 -0
- /package/dist/public/assets/{OkignoreSection-BsqOZ0wD.js → OkignoreSection-DYAQ4Haz.js} +0 -0
- /package/dist/public/assets/{SharingSection-B3wW6gUI.js → SharingSection-XR4AeJT9.js} +0 -0
- /package/dist/public/assets/{SkillsManagerSection-C4ytRUcq.js → SkillsManagerSection-DJfOBpFG.js} +0 -0
- /package/dist/public/assets/{__vite-browser-external-B5RT0rw6.js → __vite-browser-external-pK7FQf_r.js} +0 -0
- /package/dist/public/assets/{calendar-o4QOcHc0.js → calendar-CEVo5Hrz.js} +0 -0
- /package/dist/public/assets/{code-highlighter-impl-DMSeGAy3.js → code-highlighter-impl-BTCJ4NQn.js} +0 -0
package/dist/public/assets/{SlidesPluginSection-DuBoITZp.js → SlidesPluginSection-Dc5MqsXL.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{t as o}from"./button-DzgjsZzC.js";import{t as s}from"./arrow-up-right-nJaICi16.js";import{t as c}from"./terminal-Cpb4l1oH.js";import{r as l}from"./use-settings-route-
|
|
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{t as o}from"./button-DzgjsZzC.js";import{t as s}from"./arrow-up-right-nJaICi16.js";import{t as c}from"./terminal-Cpb4l1oH.js";import{r as l}from"./use-settings-route-CikTq5Vq.js";import{t as u}from"./external-link-CldCnbtR.js";import{t as d}from"./CopyButton-BGYz3S5f.js";import{r as f,t as p}from"./terminal-command-events-DylLB9_L.js";import{i as m,n as h,t as g}from"./input-group-MLVCQYFm.js";import{t as _}from"./SettingsSectionHeader-D-JSH4bX.js";var v=a(),y=e(n(),1),b=t(),x=f(`install-slidev`)??``,S=`https://sli.dev/guide/install`,C=`https://openknowledge.ai/docs/plugins/slidev`;function w(){let e=(0,v.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={kind:`checking`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),i,a;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=!0,t=()=>{let t=window.okDesktop?.slides;if(t==null){r({kind:`unsupported`});return}t.status().then(t=>{e&&r(t.available?{kind:`available`,source:t.source}:{kind:`missing`})}).catch(t=>{console.warn(`[slides] settings availability probe failed:`,t),e&&r({kind:`check-failed`})})};return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,y.useEffect)(i,a),n}function T(){let e=window.okDesktop;return e?.terminal!=null&&e.config?.ptyAvailable===!0}function E(e){let t=(0,v.c)(23),{availability:n}=e,{_:a}=i();if(n.kind===`checking`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-checking`,children:(0,b.jsx)(r,{id:`P8AnMN`})}),t[0]=e):e=t[0],e}if(n.kind===`check-failed`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-check-failed`,children:(0,b.jsx)(r,{id:`49Mb7P`})}),t[1]=e):e=t[1],e}if(n.kind===`unsupported`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-unsupported`,children:(0,b.jsx)(r,{id:`lScd1O`})}),t[2]=e):e=t[2],e}if(n.kind===`available`){let e;return t[3]===n.source?e=t[4]:(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-available`,children:n.source===`project-local`?(0,b.jsx)(r,{id:`el2KyL`}):(0,b.jsx)(r,{id:`xxRpzT`})}),t[3]=n.source,t[4]=e),e}let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,b.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,children:(0,b.jsx)(r,{id:`HPaAxt`})}),t[5]=l):l=t[5];let u;t[6]===a?u=t[7]:(u=a({id:`hz076O`}),t[6]=a,t[7]=u);let f;t[8]===u?f=t[9]:(f=(0,b.jsx)(m,{readOnly:!0,value:x,"aria-label":u,className:`font-mono text-xs`,"data-testid":`slides-install-command`,onFocus:A}),t[8]=u,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,b.jsx)(h,{align:`inline-end`,children:(0,b.jsx)(d,{copyContent:x})}),t[10]=p):p=t[10];let _;t[11]===f?_=t[12]:(_=(0,b.jsxs)(g,{children:[f,p]}),t[11]=f,t[12]=_);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=T()?(0,b.jsxs)(o,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`slides-run-install`,onClick:k,children:[(0,b.jsx)(c,{"aria-hidden":!0,className:`size-3.5`}),(0,b.jsx)(r,{id:`hVAkI8`})]}):null,t[13]=y):y=t[13];let C;t[14]===a?C=t[15]:(C=a({id:`NfraGd`}),t[14]=a,t[15]=C);let w,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,b.jsx)(r,{id:`1NgrlY`}),E=(0,b.jsx)(s,{"aria-hidden":!0,className:`size-3`}),t[16]=w,t[17]=E):(w=t[16],E=t[17]);let j;t[18]===C?j=t[19]:(j=(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[y,(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,onClick:O,onAuxClick:D,"aria-label":C,className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`slides-install-docs-link`,children:[w,E]})]}),t[18]=C,t[19]=j);let M;return t[20]!==j||t[21]!==_?(M=(0,b.jsxs)(`div`,{className:`space-y-3`,"data-testid":`slides-status-missing`,children:[l,_,j]}),t[20]=j,t[21]=_,t[22]=M):M=t[22],M}function D(e){return u(e,S)}function O(e){return u(e,S)}function k(){typeof window<`u`&&l(window.location.hash)&&window.history.back(),p(`install-slidev`)}function A(e){return e.currentTarget.select()}function j(){let e=(0,v.c)(3),t=w(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,b.jsx)(_,{titleId:`settings-plugin-slides-title`,title:`Slidev`,scope:`user`,beta:!0,docUrl:C,children:(0,b.jsx)(r,{id:`L3w0_C`,components:{0:(0,b.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,b.jsxs)(`section`,{"aria-labelledby":`settings-plugin-slides-title`,className:`space-y-4`,"data-testid":`settings-plugin-slides`,children:[n,(0,b.jsx)(`div`,{"aria-live":`polite`,children:(0,b.jsx)(E,{availability:t})})]}),e[1]=t,e[2]=i),i}export{j as SlidesPluginSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Gt as r,Ln as i,Mn as a,Z as o,_t as s,bt as c,dn as l,kt as u,qt as ee,un as te,wt as d,yt as f}from"./DocumentContext-BZi2BNlk.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{ht as g}from"./schemas-api-BbYGQuTW.js";import{i as _}from"./use-apply-config-theme-CYFG76sS.js";import{H as ne,I as v,L as re,N as ie,T as ae,b as y,c as oe,n as se,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-CNLhok7Q.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-DkRMFYIK.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{m as ge}from"./config-provider-CyBtB5MG.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 ye,ot as K,pt as q,st as J,tt as Y,ut as X,v as be,wt as Z}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-D9wsGgDp.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-ZeKFkjFe.js";import{l as Me}from"./lint-config-client-CB91vevq.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-CzJghaXH.js";import{n as Be,t as Ve}from"./src-DOSqBXQd.js";var Q=e(p(),1),He=h();function Ue(){let e=u();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,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[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=c(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(r){let i=r.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){r.preventDefault();let e=u()?.get(a);return e===void 0?d():window.location.hash=n(a,e),!0}let o=r.target?.closest?.(`.cm-skill-path-link`),s=o instanceof HTMLElement?o.dataset.skillPath:void 0;return s===void 0?!1:(r.preventDefault(),window.location.hash=f(t,e,s),!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:y(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=[X(),K(),J(),be(),U(),Y(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),q(),j(),V(),Ne(),ye.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(!g.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(g.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{l(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){k(se,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:Z.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});k(se,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:Z.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:Z.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:i,provider:s,placeholder:c,isSourceModeActive:l}=e,u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(null);if(f)throw f;let{resolvedTheme:h}=m(),{merged:g}=_(),y=(0,Q.useRef)(l),b=g?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==g?(S=x?.effective??(g?.contentRules?Ae(g.contentRules):je),t[0]=x?.effective,t[1]=g,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]!==l||t[7]!==C||t[8]!==c||t[9]!==s||t[10]!==h||t[11]!==b||t[12]!==i?(D=()=>{let e=u.current;if(!e)return;let t=s.configuration.name??``,f,m=zt;try{f=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let l=null,u=new ge(i);try{let te=o({ydoc:s.document,ytext:i,docName:t}),d=new N,f=new N,p=new N,g=new N,_=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>a(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),ye.of([xe]),Ve(i,s.awareness,{undoManager:u}),ye.of(Be),kt({docName:t,ytext:i,undoManager:u}),...me({themeCompartment:d,resolvedTheme:h,ydoc:s.document,wordWrapCompartment:f,wordWrap:b,currentDocName:t}),Tt(),Ge(t),ne(),g.of(it(C,n)),rt(n),te,F.updateListener.of(e=>{r(e)&&ee(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(l!==null&&clearTimeout(l),l=setTimeout(()=>{l=null,ue(t,`source`,ae(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(c??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,ae(_)),Oe(t,`source`,De(_,t));let v=_.contentDOM;return v.addEventListener(`keydown`,m),v.addEventListener(`paste`,m),v.addEventListener(`drop`,m),v.addEventListener(`cut`,m),{view:_,ydoc:s.document,ytext:i,provider:s,undoManager:u,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:g}}catch(e){let t=e;throw u.destroy(),t}}}),E.current=f,d.current=f.view,At(f.view,l),fe(n,f.view,`sourceEditor`),le()&&f.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,d.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,d.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=l,t[7]=C,t[8]=c,t[9]=s,t[10]=h,t[11]=b,t[12]=i,t[13]=D):D=t[13];let O;t[14]!==s||t[15]!==i?(O=[i,s],t[14]=s,t[15]=i,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===l?(A=t[18],j=t[19]):(A=()=>{y.current=l;let e=d.current;e&&At(e,l)},j=[l],t[17]=l,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]===h?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?pe:he)})},I=[h],t[23]=h,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]===c?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(c??``))})},V=[c],t[29]=c,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]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!l)return;let r=d.current;if(!r){k(se,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),v(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,l],t[37]=n,t[38]=l,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let K,q;t[41]!==n||t[42]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!l)return;let r=d.current;r&&It(r,t,n)&&v(n)};return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},q=[n,l],t[41]=n,t[42]=l,t[43]=K,t[44]=q):(K=t[43],q=t[44]),(0,Q.useEffect)(K,q);let J,Y;t[45]!==n||t[46]!==l||t[47]!==s?(J=()=>{if(!l)return;let e=d.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){re(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,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ie({view:e,docName:n,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&re(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},Y=[n,l,s],t[45]=n,t[46]=l,t[47]=s,t[48]=J,t[49]=Y):(J=t[48],Y=t[49]),(0,Q.useEffect)(J,Y);let X;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,jt.jsx)(`div`,{ref:u,className:`source-editor h-full pb-3`}),t[50]=X):X=t[50],X}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{At as n,Gt as r,Ln as i,Mn as a,Z as o,_t as s,bt as c,dn as l,kt as u,qt as ee,un as te,wt as d,yt as f}from"./DocumentContext-DxFlTFCf.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{ht as g}from"./schemas-api-BbYGQuTW.js";import{i as _}from"./use-apply-config-theme-CYFG76sS.js";import{H as ne,I as v,L as re,N as ie,T as ae,b as y,c as oe,n as se,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-DbyT-0Jk.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-Bw2exRGi.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{m as ge}from"./config-provider-MlOyOUAX.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 ye,ot as K,pt as q,st as J,tt as Y,ut as X,v as be,wt as Z}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-DioyxMXd.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BmjyI9ZU.js";import{l as Me}from"./lint-config-client-DhP_RDHH.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-CzJghaXH.js";import{n as Be,t as Ve}from"./src-CuvAhAc9.js";var Q=e(p(),1),He=h();function Ue(){let e=u();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,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[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=c(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(r){let i=r.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){r.preventDefault();let e=u()?.get(a);return e===void 0?d():window.location.hash=n(a,e),!0}let o=r.target?.closest?.(`.cm-skill-path-link`),s=o instanceof HTMLElement?o.dataset.skillPath:void 0;return s===void 0?!1:(r.preventDefault(),window.location.hash=f(t,e,s),!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:y(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=[X(),K(),J(),be(),U(),Y(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),q(),j(),V(),Ne(),ye.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(!g.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(g.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{l(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){k(se,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:Z.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});k(se,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:Z.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:Z.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:i,provider:s,placeholder:c,isSourceModeActive:l}=e,u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(null);if(f)throw f;let{resolvedTheme:h}=m(),{merged:g}=_(),y=(0,Q.useRef)(l),b=g?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==g?(S=x?.effective??(g?.contentRules?Ae(g.contentRules):je),t[0]=x?.effective,t[1]=g,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]!==l||t[7]!==C||t[8]!==c||t[9]!==s||t[10]!==h||t[11]!==b||t[12]!==i?(D=()=>{let e=u.current;if(!e)return;let t=s.configuration.name??``,f,m=zt;try{f=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let l=null,u=new ge(i);try{let te=o({ydoc:s.document,ytext:i,docName:t}),d=new N,f=new N,p=new N,g=new N,_=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>a(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),ye.of([xe]),Ve(i,s.awareness,{undoManager:u}),ye.of(Be),kt({docName:t,ytext:i,undoManager:u}),...me({themeCompartment:d,resolvedTheme:h,ydoc:s.document,wordWrapCompartment:f,wordWrap:b,currentDocName:t}),Tt(),Ge(t),ne(),g.of(it(C,n)),rt(n),te,F.updateListener.of(e=>{r(e)&&ee(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(l!==null&&clearTimeout(l),l=setTimeout(()=>{l=null,ue(t,`source`,ae(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(c??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,ae(_)),Oe(t,`source`,De(_,t));let v=_.contentDOM;return v.addEventListener(`keydown`,m),v.addEventListener(`paste`,m),v.addEventListener(`drop`,m),v.addEventListener(`cut`,m),{view:_,ydoc:s.document,ytext:i,provider:s,undoManager:u,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:g}}catch(e){let t=e;throw u.destroy(),t}}}),E.current=f,d.current=f.view,At(f.view,l),fe(n,f.view,`sourceEditor`),le()&&f.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,d.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,d.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=l,t[7]=C,t[8]=c,t[9]=s,t[10]=h,t[11]=b,t[12]=i,t[13]=D):D=t[13];let O;t[14]!==s||t[15]!==i?(O=[i,s],t[14]=s,t[15]=i,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===l?(A=t[18],j=t[19]):(A=()=>{y.current=l;let e=d.current;e&&At(e,l)},j=[l],t[17]=l,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]===h?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?pe:he)})},I=[h],t[23]=h,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]===c?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(c??``))})},V=[c],t[29]=c,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]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!l)return;let r=d.current;if(!r){k(se,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),v(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,l],t[37]=n,t[38]=l,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let K,q;t[41]!==n||t[42]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!l)return;let r=d.current;r&&It(r,t,n)&&v(n)};return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},q=[n,l],t[41]=n,t[42]=l,t[43]=K,t[44]=q):(K=t[43],q=t[44]),(0,Q.useEffect)(K,q);let J,Y;t[45]!==n||t[46]!==l||t[47]!==s?(J=()=>{if(!l)return;let e=d.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){re(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,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ie({view:e,docName:n,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&re(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},Y=[n,l,s],t[45]=n,t[46]=l,t[47]=s,t[48]=J,t[49]=Y):(J=t[48],Y=t[49]),(0,Q.useEffect)(J,Y);let X;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,jt.jsx)(`div`,{ref:u,className:`source-editor h-full pb-3`}),t[50]=X):X=t[50],X}function Rt(){return{top:S()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|