1import{r as o,j as L}from"./index-Cpmd6tCp.js";import{S as R,C,E as n,a as x,k as y,h as D,l as S,d as T,p as H,r as N,b as j,c as z,s as w,D as g,H as E,t as r}from"./codemirror.chunk-CLhMQAUm.js";import"./mermaid-to-excalidraw-D-aVQaad.js";const G=R.define({token(e){return e.match(/^%%.*$/)?"comment":e.match(/^"(?:[^"\\]|\\.)*"/)?"string":e.match(/^(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|mindmap|journey|gitGraph|timeline|quadrantChart|sankey|xychart)\b/i)||e.match(/^(TB|TD|BT|RL|LR)\b/)||e.match(/^(subgraph|end|participant|actor|loop|alt|else|opt|par|critical|break|rect|note|over|activate|deactivate|title|section|class|style|linkStyle|classDef|click)\b/i)?"keyword":e.match(/^[-.=<>|ox]+>/)||e.match(/^<[-.=<>|ox]+/)||e.match(/^--+|\.\.+|==+/)?"operator":e.match(/^[[\](){}|<>]/)?"bracket":e.match(/^[A-Za-z_][A-Za-z0-9_]*/)?"variableName":e.match(/^\d+(\.\d+)?/)?"number":e.match(/^[,:;]/)?"punctuation":(e.eatSpace()||e.next(),null)}});function M(){return G}const q=n.theme({"&":{backgroundColor:"#1e1e1e",color:"#d4d4d4"},".cm-content":{caretColor:"#fff"},".cm-cursor":{borderLeftColor:"#fff"},".cm-gutters":{backgroundColor:"#1e1e1e",color:"#858585",border:"none"},".cm-activeLineGutter":{backgroundColor:"#2a2a2a"},".cm-activeLine":{backgroundColor:"#2a2a2a"},".cm-errorLine":{backgroundColor:"rgba(255, 0, 0, 0.15)"}},{dark:!0}),A=E.define([{tag:r.keyword,color:"#569cd6"},{tag:r.string,color:"#ce9178"},{tag:r.comment,color:"#6a9955"},{tag:r.number,color:"#b5cea8"},{tag:r.operator,color:"#d4d4d4"},{tag:r.punctuation,color:"#d4d4d4"},{tag:r.variableName,color:"#9cdcfe"},{tag:r.bracket,color:"#ffd700"}]),B=n.theme({"&":{backgroundColor:"#ffffff",color:"#1e1e1e"},".cm-content":{caretColor:"#000"},".cm-cursor":{borderLeftColor:"#000"},".cm-gutters":{backgroundColor:"#fff",color:"#999",border:"none"},".cm-activeLineGutter":{backgroundColor:"#e8e8e8"},".cm-activeLine":{backgroundColor:"#e8e8e8"},".cm-errorLine":{backgroundColor:"rgba(255, 0, 0, 0.1)"}}),Z=E.define([{tag:r.keyword,color:"#0000ff"},{tag:r.string,color:"#a31515"},{tag:r.comment,color:"#008000"},{tag:r.number,color:"#098658"},{tag:r.operator,color:"#1e1e1e"},{tag:r.punctuation,color:"#1e1e1e"},{tag:r.variableName,color:"#001080"},{tag:r.bracket,color:"#af00db"}]),_=g.line({class:"cm-errorLine"}),P=(e,c)=>{if(!e||e<1||e>c.lines)return n.decorations.of(g.none);const s=c.line(e);return n.decorations.of(g.set([_.range(s.from)]))},v=e=>e==="dark"?[q,w(A)]:[B,w(Z)],I=({value:e,onChange:c,onKeyboardSubmit:s,placeholder:m,theme:l,errorLine:h})=>{const d=o.useRef(null),i=o.useRef(null),p=o.useRef(c),f=o.useRef(s),k=o.useRef(new C),b=o.useRef(new C);return p.current=c,f.current=s,o.useEffect(()=>{if(!d.current)return;const t=k.current,a=new n({state:x.create({doc:e,extensions:[y.of([{key:"Mod-Enter",run:()=>{var u;return(u=f.current)==null||u.call(f),!0}},{key:"Mod-Shift-z",run:N,preventDefault:!0}]),n.updateListener.of(u=>{u.docChanged&&p.current(u.state.doc.toString())}),D(),y.of([...j,...z]),S(),n.lineWrapping,t.of(v(l)),b.current.of([]),M(),T({drawRangeCursor:!0}),...m?[H(m)]:[]]}),parent:d.current});return i.current=a,a.focus(),()=>{a.destroy(),i.current=null}},[]),o.useEffect(()=>{const t=i.current;t&&t.dispatch({effects:k.current.reconfigure(v(l))})},[l]),o.useEffect(()=>{const t=i.current;t&&t.dispatch({effects:b.current.reconfigure(P(h,t.state.doc))})},[h]),o.useEffect(()=>{const t=i.current;if(!t)return;const a=t.state.doc.toString();e!==a&&t.dispatch({changes:{from:0,to:a.length,insert:e}})},[e]),L("div",{ref:d,className:"ttd-dialog-input ttd-dialog-input--codemirror"})};export{I as default}; 2//# sourceMappingURL=CodeMirrorEditor-Bq-VtIyL.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.