@inkeep/open-knowledge 0.78.0-beta.0 → 0.78.0-beta.1
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-CqnSfysY.mjs +1 -0
- package/dist/{dist-DrwvV8ac.mjs → dist-D0NB38wf.mjs} +1 -1
- package/dist/{dist--Fj3tje5.mjs → dist-H727Mac0.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-DI1gfxzX.mjs → init-C0ht_YRB.mjs} +2 -2
- package/dist/init-Dmfw9165.mjs +1 -0
- package/dist/{launch-json-removal-BUU52XaH.mjs → launch-json-removal-BayfH9oD.mjs} +1 -1
- package/dist/loader-BaY7osJS.mjs +1 -0
- package/dist/{loader-Y0pjcUKl.mjs → loader-BwEW4OHx.mjs} +1 -1
- package/dist/{open-browser-Qoh0UyYo.mjs → open-browser-BnVmN9HA.mjs} +1 -1
- package/dist/{preview-kp3tgpeK.mjs → preview-CJ4lC6m4.mjs} +1 -1
- package/dist/preview-rn0piPQ2.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-9eG8YBKX.js → ActivityModeContent-By3_IMI2.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CygNgwxc.js → AddPropertiesButton-Ds4lHG87.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-CFiM8xEM.js → AgentDiffPane-D9SHwzkL.js} +1 -1
- package/dist/public/assets/{AgentIconCluster-HL0VW7ex.js → AgentIconCluster-D4c5FBAw.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-DfpeZqHy.js → AgentThreadClientBinder-B_EgL186.js} +1 -1
- package/dist/public/assets/{ConfigSharingInfoTooltip-DTnyEAkk.js → ConfigSharingInfoTooltip-cmnGMRyM.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-xByJh_yy.js → ConsentDialogBody-BqIjS2gR.js} +1 -1
- package/dist/public/assets/{DocumentContext-C7SiRLQb.js → DocumentContext-C3MFq3ua.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CjygF6yK.js → EditorModeToggle-BeTnxhxA.js} +1 -1
- package/dist/public/assets/FeedbackForm-CchQrgi0.js +1 -0
- package/dist/public/assets/{GraphPanel-PUtu-HoI.js → GraphPanel-D5xZaXcb.js} +1 -1
- package/dist/public/assets/{ImageAttachments-BY2Tiper.js → ImageAttachments-DJgsccSw.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-0B5W-rTi.js → ImportSkillDialog-BuL9v-6W.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-2RE7lwuU.js → LintConfigEditor-bFtZkDDa.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DqjUJDga.js → ManagedArtifactProperties-BogBt9Ik.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DrztV163.js +1 -0
- package/dist/public/assets/{PropertyDisplayRow-CDDGu8nj.js → PropertyDisplayRow-CIz5E76a.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-BVloizGt.js → ReportBugDialogBody-BdLhyQ-4.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-XGUcCKYj.js → ReportBugMenuTrigger-BTrSdrQf.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-HLOCQnGt.js → SchemaConfigEditor-CfZbORWL.js} +1 -1
- package/dist/public/assets/SessionsHost-m1vUsJgF.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-CbiPCUKo.js → SettingsDialogBody-D_GVq8_Z.js} +1 -1
- package/dist/public/assets/{SkillCostValue-VNM6buqE.js → SkillCostValue-BjMa_RzW.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-DTKc6Fb2.js → SkillInstallMenu-cLslx-4M.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-B9szZlfW.js → SkillOriginInline-ghHkXApt.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CiUk7ClP.js → SkillToolbarControls-S5KMiPEx.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-CXtA7p5I.js → SlidesToolbarControls-DgebeZ1o.js} +1 -1
- package/dist/public/assets/{SourceEditor-5m-rKk0W.js → SourceEditor-wsG_saIm.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BKJLHAK8.js → TerminalPanel-B72jSABs.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DG1kmrG5.js → TerminalWindowApp-CqFoMmN8.js} +1 -1
- package/dist/public/assets/ThreadView-DK8pgUsH.js +21 -0
- package/dist/public/assets/{TimelineDiffPane-C2wFbjXz.js → TimelineDiffPane-4ZOOyITN.js} +1 -1
- package/dist/public/assets/{agent-connection-status-DRTKkkhz.js → agent-connection-status-BpmHdteI.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DlDU-uGh.js → auth-state-cache-B3gDmMGR.js} +1 -1
- package/dist/public/assets/{comment-chips-h2R6X8ZK.js → comment-chips-C2qbaCxd.js} +1 -1
- package/dist/public/assets/{index-CcD0riyO.js → index-Dg8USqVa.js} +7 -7
- package/dist/public/assets/launch-agent-thread--2IQ94Jw.js +1 -0
- package/dist/public/assets/{markdownlint-rule-browser-CrVGD-9N.js → markdownlint-rule-browser-Deli4eWi.js} +1 -1
- package/dist/public/assets/{preferred-session-events-aK8uTZkY.js → preferred-session-events-BRTAOH0T.js} +1 -1
- package/dist/public/assets/progress-BUZ09BFV.js +10 -0
- package/dist/public/assets/{project-paths-BTqSbaer.js → project-paths-C72_JOWy.js} +1 -1
- package/dist/public/assets/{select-ByJwKu6h.js → select-D_BhUvh8.js} +1 -1
- package/dist/public/assets/{selection-context-CzFcwgS3.js → selection-context-Bh3Wccul.js} +1 -1
- package/dist/public/assets/{tag-pill-input-MxBCbORt.js → tag-pill-input-Bs1Otf32.js} +1 -1
- package/dist/public/assets/thread-client-Cpl5iQ-N.js +3 -0
- package/dist/public/assets/{tooltip-BnyyQDRs.js → tooltip-DVBVVaAs.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-Djy23xa6.js → typing-burst-detector-BsYaC0Hm.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BiJM5Lyy.js → use-activity-panel-C3WeDBAl.js} +1 -1
- package/dist/public/assets/{use-open-skill-CvMMiXmv.js → use-open-skill-MLwbsxuR.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CHwFHTJT.js → use-timeline-entry-diff-CoUYWVFF.js} +1 -1
- package/dist/public/index.html +23 -23
- package/dist/{registry-probes-BEL6kY2a.mjs → registry-probes-Trc22gkn.mjs} +1 -1
- package/dist/{removal-file-path-tAXTvjxX.mjs → removal-file-path-BJLJdU25.mjs} +1 -1
- package/dist/{repair-launch-json-D5502WRP.mjs → repair-launch-json-Dy1MyLSZ.mjs} +1 -1
- package/dist/{repair-mcp-configs-DI9LEPQs.mjs → repair-mcp-configs-xBQEG0AX.mjs} +1 -1
- package/dist/{src-DEL9l4YA.mjs → src-CI2gZlGL.mjs} +1 -1
- package/dist/src-DdAWkvJ7.mjs +1 -0
- package/dist/start-CyNiscGq.mjs +1 -0
- package/dist/{start-BFSCPRdk.mjs → start-DvYJMlYp.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-Dx41km5O.mjs +0 -1
- package/dist/init-nKepqoOu.mjs +0 -1
- package/dist/loader-2RC3eI_T.mjs +0 -1
- package/dist/preview-CxIkF9m4.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CRF733qz.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-D9GiE7xi.js +0 -1
- package/dist/public/assets/SessionsHost-BLdclyM0.js +0 -2
- package/dist/public/assets/ThreadView-Dwdgs8fd.js +0 -21
- package/dist/public/assets/launch-agent-thread-LhwTEmF8.js +0 -1
- package/dist/public/assets/progress-BoD5XUOb.js +0 -9
- package/dist/public/assets/thread-client-shDMogrR.js +0 -3
- package/dist/src-BmFQC4vg.mjs +0 -1
- package/dist/start-itGfoXph.mjs +0 -1
package/dist/public/assets/{SlidesToolbarControls-CXtA7p5I.js → SlidesToolbarControls-DgebeZ1o.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-HKX9wT1K.js";import{i as s,n as c,t as l}from"./tooltip-
|
|
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-HKX9wT1K.js";import{i as s,n as c,t as l}from"./tooltip-DVBVVaAs.js";import{Dn as u}from"./dist-BBWka618.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-Dczkx4vn.js";import{n as h}from"./use-workspace-JzehlodO.js";import{t as g}from"./createLucideIcon-B6ULg5PN.js";var _=g(`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{d.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=u(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=u(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=f.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){f.dismiss(i);return}if(a.reason===`cancelled`){f.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}f.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)),f.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(),d=w(n,`slides`),f=O(d),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!d||f!==`available`)return null;let C=g==null?null:p(g.contentDir,m(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=l,j=o,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)(s,{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)(c,{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{Ct as n,In as r,Kt as i,Ot as a,Wt as o,X as s,gt as c,jn as l,kt as u,ln as d,un as f,vt as p,yt as m}from"./DocumentContext-C7SiRLQb.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{$s as v,Ci as y,O as b,Rs as x,Us as S,ga as ee}from"./dist-BBWka618.js";import{i as te}from"./use-apply-config-theme-B5w38X1P.js";import{H as ne,I as re,L as ie,N as ae,T as oe,b as C,c as se,n as w,o as T,r as ce,t as le,v as E,w as ue,z as de}from"./typing-burst-detector-Djy23xa6.js";import{S as D,a as fe,et as O,gt as pe,i as me,nt as k,o as he,vt as A,z as j}from"./CodeMirrorPropInput-CmvXuenG.js";import{t as ge}from"./diagnostic-breadcrumb-ZzsGTt1a.js";import{a as M}from"./startup-marks-CP0XYWYE.js";import{p as _e}from"./config-provider-ClTAXVvb.js";import{$ as N,At as P,Ct as F,E as I,J as L,K as R,Mt as z,N as B,Nt as V,Tt as ve,X as H,at as U,b as W,et as G,ft as ye,g as K,l as q,lt as be,ot as J,pt as Y,st as X,tt as Z,ut as xe,v as Se,wt as Ce}from"./dist-AflZtDqw.js";import{i as we,t as Te}from"./dist-BVlXaanp.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-Dt26oMwk.js";import{o as Ae,r as je}from"./selection-context-CzFcwgS3.js";import{l as Me}from"./lint-config-client-CnphqIMJ.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-C3zCvqLK.js";import{n as Be,t as Ve}from"./src-Bsvkxusv.js";var Q=e(h(),1),He=_();function Ue(){let e=a();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=B(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);S.lastIndex=0;for(let e=S.exec(t);e!==null;e=S.exec(t)){let t=e[2];if(!v(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(R.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(l!==void 0&&v(l)&&n!=null)return r.push(R.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=c.exec(s);if(u)return r.push(R.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),R.set(r)}function Ge(e){let t=m(e);return t===null?[]:[H.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),o=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(o!==void 0){r.preventDefault();let e=a()?.get(o);return e===void 0?n():window.location.hash=u(o,e),!0}let s=r.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(r.preventDefault(),window.location.hash=p(t,e,c),!0)}})]}var Ke=R.line({attributes:{dir:`auto`}});function qe(e){let t=new P;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=H.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=[L.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=K(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:C(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=z.define();function rt(e){let t={findings:[]};return[Pe(e=>O()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),H.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=E(e,e=>{e.status===`loaded`&&r(e.findings)}),a=k(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await y(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=[xe(),J(),X(),Se(),G(),Z(),ve.allowMultipleSelections.of(!0),I(),q(),ke(),De(),Y(),N(),U(),Ne(),be.of([...Ee,...Te,...Re,...W,...Oe,...Le])],ct=R.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 B(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),R.set(a)}var ht=V.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>L.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=R.mark({class:`cm-del`}),vt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=R.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(!x.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(x.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=B(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=R.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=R.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),R.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=H.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(),M(`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 H.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=z.define();function Nt(e,t){try{At(t.view,!1)}finally{try{f(t)}finally{A(e,t.view)}}}function Pt(e,t,n){let i=T(e.state.doc),a=i[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:i.length};if(!a){ge(w,{...o,outcome:`no-target`});return}let s=r(n,`outline`,()=>{e.dispatch({selection:Ce.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});ge(w,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,i){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);r(i,`raw-mdx`,()=>{e.dispatch({selection:Ce.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let i=e.state.doc,a=Math.min(Math.max(t.line,1),i.lines),o=i.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return r(n,`problems-row`,()=>{e.dispatch({selection:Ce.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:a,placeholder:c,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=te(),y=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(n),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?ee(v.contentRules):b),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let T=C,E;t[3]===T?E=t[4]:(E=JSON.stringify(T),t[3]=T,t[4]=E);let D=E,O=(0,Q.useRef)(null),k;t[5]!==n||t[6]!==u||t[7]!==T||t[8]!==c||t[9]!==a||t[10]!==_||t[11]!==x||t[12]!==r?(k=()=>{let e=f.current;if(!e)return;let t=a.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let u=null,d=new _e(r);try{let f=s({ydoc:a.document,ytext:r,docName:t}),p=new F,m=new F,h=new F,v=new F,y=new L({state:ve.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>l(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Mt.of(null)}),be.of([we]),Ve(r,a.awareness,{undoManager:d}),be.of(Be),kt({docName:t,ytext:r,undoManager:d}),...me({themeCompartment:p,resolvedTheme:_,ydoc:a.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ne(),v.of(it(T,n)),rt(n),f,L.updateListener.of(e=>{o(e)&&i(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,ue(t,`source`,oe(e.view)),je(t,`source`,Ae(e.view,t))},120))}),h.of(ye(c??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(y)),je(t,`source`,Ae(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:a.document,ytext:r,provider:a,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),O.current=m,p.current=m.view,At(m.view,u),pe(n,m.view,`sourceEditor`),le()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;O.current=null,p.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=u,t[7]=T,t[8]=c,t[9]=a,t[10]=_,t[11]=x,t[12]=r,t[13]=k):k=t[13];let A;t[14]!==a||t[15]!==r?(A=[r,a],t[14]=a,t[15]=r,t[16]=A):A=t[16],(0,Q.useEffect)(k,A);let j,M;t[17]===u?(j=t[18],M=t[19]):(j=()=>{y.current=u;let e=p.current;e&&At(e,u)},M=[u],t[17]=u,t[18]=j,t[19]=M),(0,Q.useEffect)(j,M);let N,P;t[20]===n?(N=t[21],P=t[22]):(N=()=>{},P=[n],t[20]=n,t[21]=N,t[22]=P),(0,Q.useEffect)(N,P);let I,R;t[23]===_?(I=t[24],R=t[25]):(R=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?fe:he)})},I=[_],t[23]=_,t[24]=I,t[25]=R),(0,Q.useEffect)(R,I);let z,B;t[26]===x?(z=t[27],B=t[28]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?L.lineWrapping:[])})},B=[x],t[26]=x,t[27]=z,t[28]=B),(0,Q.useEffect)(z,B);let V,H;t[29]===c?(V=t[30],H=t[31]):(V=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},H=[c],t[29]=c,t[30]=V,t[31]=H),(0,Q.useEffect)(V,H);let U;t[32]!==n||t[33]!==T?(U=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(T,n))})},t[32]=n,t[33]=T,t[34]=U):U=t[34];let W;t[35]===D?W=t[36]:(W=[D],t[35]=D,t[36]=W),(0,Q.useEffect)(U,W);let G,K;t[37]!==n||t[38]!==u?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!u)return;let r=p.current;if(!r){ge(w,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),re(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},K=[n,u],t[37]=n,t[38]=u,t[39]=G,t[40]=K):(G=t[39],K=t[40]),(0,Q.useEffect)(G,K);let q,J;t[41]!==n||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!u)return;let r=p.current;r&&It(r,t,n)&&re(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,u],t[41]=n,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==u||t[47]!==a?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ae({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ie(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,u,a],t[45]=n,t[46]=u,t[47]=a,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:D()}}function zt(){return j()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ct as n,In as r,Kt as i,Ot as a,Wt as o,X as s,gt as c,jn as l,kt as u,ln as d,un as f,vt as p,yt as m}from"./DocumentContext-C3MFq3ua.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{$s as v,Ci as y,O as b,Rs as x,Us as S,ga as ee}from"./dist-BBWka618.js";import{i as te}from"./use-apply-config-theme-B5w38X1P.js";import{H as ne,I as re,L as ie,N as ae,T as oe,b as C,c as se,n as w,o as T,r as ce,t as le,v as E,w as ue,z as de}from"./typing-burst-detector-BsYaC0Hm.js";import{S as D,a as fe,et as O,gt as pe,i as me,nt as k,o as he,vt as A,z as j}from"./CodeMirrorPropInput-CmvXuenG.js";import{t as ge}from"./diagnostic-breadcrumb-ZzsGTt1a.js";import{a as M}from"./startup-marks-CP0XYWYE.js";import{p as _e}from"./config-provider-ClTAXVvb.js";import{$ as N,At as P,Ct as F,E as I,J as L,K as R,Mt as z,N as B,Nt as V,Tt as ve,X as H,at as U,b as W,et as G,ft as ye,g as K,l as q,lt as be,ot as J,pt as Y,st as X,tt as Z,ut as xe,v as Se,wt as Ce}from"./dist-AflZtDqw.js";import{i as we,t as Te}from"./dist-BVlXaanp.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-Dt26oMwk.js";import{o as Ae,r as je}from"./selection-context-Bh3Wccul.js";import{l as Me}from"./lint-config-client-CnphqIMJ.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-C3zCvqLK.js";import{n as Be,t as Ve}from"./src-Bsvkxusv.js";var Q=e(h(),1),He=_();function Ue(){let e=a();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=B(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);S.lastIndex=0;for(let e=S.exec(t);e!==null;e=S.exec(t)){let t=e[2];if(!v(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(R.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(l!==void 0&&v(l)&&n!=null)return r.push(R.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=c.exec(s);if(u)return r.push(R.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),R.set(r)}function Ge(e){let t=m(e);return t===null?[]:[H.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),o=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(o!==void 0){r.preventDefault();let e=a()?.get(o);return e===void 0?n():window.location.hash=u(o,e),!0}let s=r.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(r.preventDefault(),window.location.hash=p(t,e,c),!0)}})]}var Ke=R.line({attributes:{dir:`auto`}});function qe(e){let t=new P;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=H.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=[L.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=K(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:C(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=z.define();function rt(e){let t={findings:[]};return[Pe(e=>O()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),H.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=E(e,e=>{e.status===`loaded`&&r(e.findings)}),a=k(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await y(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=[xe(),J(),X(),Se(),G(),Z(),ve.allowMultipleSelections.of(!0),I(),q(),ke(),De(),Y(),N(),U(),Ne(),be.of([...Ee,...Te,...Re,...W,...Oe,...Le])],ct=R.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 B(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),R.set(a)}var ht=V.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>L.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=R.mark({class:`cm-del`}),vt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=R.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(!x.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(x.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=B(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=R.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=R.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),R.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=H.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(),M(`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 H.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=z.define();function Nt(e,t){try{At(t.view,!1)}finally{try{f(t)}finally{A(e,t.view)}}}function Pt(e,t,n){let i=T(e.state.doc),a=i[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:i.length};if(!a){ge(w,{...o,outcome:`no-target`});return}let s=r(n,`outline`,()=>{e.dispatch({selection:Ce.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});ge(w,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,i){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);r(i,`raw-mdx`,()=>{e.dispatch({selection:Ce.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let i=e.state.doc,a=Math.min(Math.max(t.line,1),i.lines),o=i.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return r(n,`problems-row`,()=>{e.dispatch({selection:Ce.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:a,placeholder:c,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=te(),y=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(n),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?ee(v.contentRules):b),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let T=C,E;t[3]===T?E=t[4]:(E=JSON.stringify(T),t[3]=T,t[4]=E);let D=E,O=(0,Q.useRef)(null),k;t[5]!==n||t[6]!==u||t[7]!==T||t[8]!==c||t[9]!==a||t[10]!==_||t[11]!==x||t[12]!==r?(k=()=>{let e=f.current;if(!e)return;let t=a.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let u=null,d=new _e(r);try{let f=s({ydoc:a.document,ytext:r,docName:t}),p=new F,m=new F,h=new F,v=new F,y=new L({state:ve.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>l(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Mt.of(null)}),be.of([we]),Ve(r,a.awareness,{undoManager:d}),be.of(Be),kt({docName:t,ytext:r,undoManager:d}),...me({themeCompartment:p,resolvedTheme:_,ydoc:a.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ne(),v.of(it(T,n)),rt(n),f,L.updateListener.of(e=>{o(e)&&i(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,ue(t,`source`,oe(e.view)),je(t,`source`,Ae(e.view,t))},120))}),h.of(ye(c??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(y)),je(t,`source`,Ae(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:a.document,ytext:r,provider:a,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),O.current=m,p.current=m.view,At(m.view,u),pe(n,m.view,`sourceEditor`),le()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;O.current=null,p.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=u,t[7]=T,t[8]=c,t[9]=a,t[10]=_,t[11]=x,t[12]=r,t[13]=k):k=t[13];let A;t[14]!==a||t[15]!==r?(A=[r,a],t[14]=a,t[15]=r,t[16]=A):A=t[16],(0,Q.useEffect)(k,A);let j,M;t[17]===u?(j=t[18],M=t[19]):(j=()=>{y.current=u;let e=p.current;e&&At(e,u)},M=[u],t[17]=u,t[18]=j,t[19]=M),(0,Q.useEffect)(j,M);let N,P;t[20]===n?(N=t[21],P=t[22]):(N=()=>{},P=[n],t[20]=n,t[21]=N,t[22]=P),(0,Q.useEffect)(N,P);let I,R;t[23]===_?(I=t[24],R=t[25]):(R=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?fe:he)})},I=[_],t[23]=_,t[24]=I,t[25]=R),(0,Q.useEffect)(R,I);let z,B;t[26]===x?(z=t[27],B=t[28]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?L.lineWrapping:[])})},B=[x],t[26]=x,t[27]=z,t[28]=B),(0,Q.useEffect)(z,B);let V,H;t[29]===c?(V=t[30],H=t[31]):(V=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},H=[c],t[29]=c,t[30]=V,t[31]=H),(0,Q.useEffect)(V,H);let U;t[32]!==n||t[33]!==T?(U=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(T,n))})},t[32]=n,t[33]=T,t[34]=U):U=t[34];let W;t[35]===D?W=t[36]:(W=[D],t[35]=D,t[36]=W),(0,Q.useEffect)(U,W);let G,K;t[37]!==n||t[38]!==u?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!u)return;let r=p.current;if(!r){ge(w,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),re(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},K=[n,u],t[37]=n,t[38]=u,t[39]=G,t[40]=K):(G=t[39],K=t[40]),(0,Q.useEffect)(G,K);let q,J;t[41]!==n||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!u)return;let r=p.current;r&&It(r,t,n)&&re(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,u],t[41]=n,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==u||t[47]!==a?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ae({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ie(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,u,a],t[45]=n,t[46]=u,t[47]=a,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:D()}}function zt(){return j()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|
|
@@ -1,4 +1,4 @@
|
|
|
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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-HKX9wT1K.js";import{Ac as c,Dc as l,Ec as u,Mc as d,Oc as f,Tc as p,bc as m,jc as h,wc as g}from"./dist-BBWka618.js";import{r as _}from"./use-apply-config-theme-B5w38X1P.js";import{t as v}from"./triangle-alert-CCeXtPLU.js";import{t as y}from"./x-DIayTyoR.js";import{f as b,p as ee,u as te}from"./doc-paths-Cchodm9a.js";import{n as ne}from"./page-list-cache-DzovwSp2.js";import{f as x,h as S}from"./file-tree-adapter-DLjG7Vd1.js";import{t as re}from"./use-live-xterm-theme-BFttHtXj.js";import{i as C,r as w}from"./terminal-command-events-B_odljGI.js";import{t as T}from"./TerminalStartingNotice-DaOP2MEM.js";import{a as E,f as ie,m as ae,t as D,u as O,v as k,y as oe}from"./agent-connection-status-
|
|
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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-HKX9wT1K.js";import{Ac as c,Dc as l,Ec as u,Mc as d,Oc as f,Tc as p,bc as m,jc as h,wc as g}from"./dist-BBWka618.js";import{r as _}from"./use-apply-config-theme-B5w38X1P.js";import{t as v}from"./triangle-alert-CCeXtPLU.js";import{t as y}from"./x-DIayTyoR.js";import{f as b,p as ee,u as te}from"./doc-paths-Cchodm9a.js";import{n as ne}from"./page-list-cache-DzovwSp2.js";import{f as x,h as S}from"./file-tree-adapter-DLjG7Vd1.js";import{t as re}from"./use-live-xterm-theme-BFttHtXj.js";import{i as C,r as w}from"./terminal-command-events-B_odljGI.js";import{t as T}from"./TerminalStartingNotice-DaOP2MEM.js";import{a as E,f as ie,m as ae,t as D,u as O,v as k,y as oe}from"./agent-connection-status-BpmHdteI.js";var se=a();function ce(e){throw Error(`unhandled pty create reason: ${String(e)}`)}function le(e){throw Error(`unhandled pty adopt reason: ${String(e)}`)}var ue=2,de=1,fe=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(ue,Math.floor(u/e.css.cell.width)),rows:Math.max(de,Math.floor(l/e.css.cell.height))}}},pe=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],me=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],A;function j(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var he=class{constructor(){if(this.version=`6`,!A){A=new Uint8Array(65536),A.fill(1),A[0]=0,A.fill(0,1,32),A.fill(0,127,160),A.fill(2,4352,4448),A[9001]=2,A[9002]=2,A.fill(2,11904,42192),A[12351]=1,A.fill(2,44032,55204),A.fill(2,63744,64256),A.fill(2,65040,65050),A.fill(2,65072,65136),A.fill(2,65280,65377),A.fill(2,65504,65511);for(let e=0;e<pe.length;++e)A.fill(0,pe[e][0],pe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?A[e]:j(e,me)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=pt.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return pt.createPropertyValue(0,n,r)}},M=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?be.isErrorNoTelemetry(e)?new be(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./ReportBugMenuTrigger-
|
|
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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./ReportBugMenuTrigger-BTrSdrQf.js";import{t as o}from"./config-provider-ClTAXVvb.js";import{t as s}from"./use-installed-clis-DYoBxFbg.js";import{t as c}from"./use-live-xterm-theme-BFttHtXj.js";import{SessionsHost as l}from"./SessionsHost-m1vUsJgF.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,s;t[0]===n?s=t[1]:(s=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=s);let c=r===null,l;t[2]===c?l=t[3]:(l=(0,f.jsx)(a,{systemWide:c}),t[2]=c,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[s,l]}),t[4]=r,t[5]=i,t[6]=s,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),a=c(i),o=s(),[p,m]=(0,d.useState)(null),_;t[0]===a.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:a.background}}),t[0]=a.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==o?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:o,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=o,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
|