@evandu/super-pi 0.1.159 → 0.1.160

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.
Files changed (30) hide show
  1. package/dist/client/.super-pi-client-sources.json +4 -4
  2. package/dist/client/assets/{CodeMirrorEditor-BB0GyCns.js → CodeMirrorEditor-DeH4azrn.js} +2 -2
  3. package/dist/client/assets/{dist-BT4A5Gts.js → dist-7jfYXjWH.js} +1 -1
  4. package/dist/client/assets/{dist-DIgk0yLa.js → dist-BeLF-5JB.js} +1 -1
  5. package/dist/client/assets/{dist-BZlYaGxq.js → dist-Bl20l56d.js} +1 -1
  6. package/dist/client/assets/{dist-DxoyfcUP.js → dist-BotfOUXo.js} +1 -1
  7. package/dist/client/assets/{dist-BJPYIQat.js → dist-Br9aGZZB.js} +1 -1
  8. package/dist/client/assets/{dist-BBvvLw1T.js → dist-C1FnggSV.js} +1 -1
  9. package/dist/client/assets/{dist-BDxBEqt3.js → dist-C1iGzBNB.js} +1 -1
  10. package/dist/client/assets/{dist-DuhZOzpj.js → dist-CA4ywFCU.js} +1 -1
  11. package/dist/client/assets/{dist-D8Zpt_js.js → dist-CBAhomD3.js} +1 -1
  12. package/dist/client/assets/{dist-BQjIO_bJ.js → dist-CNdHgilU.js} +1 -1
  13. package/dist/client/assets/{dist-BCZnYgeb.js → dist-CdG0dOlF.js} +1 -1
  14. package/dist/client/assets/{dist-BeCgVWwJ.js → dist-CgShg9H1.js} +1 -1
  15. package/dist/client/assets/{dist-D4twfstd.js → dist-ClXbSHKM.js} +1 -1
  16. package/dist/client/assets/{dist-rXWbM1pb.js → dist-CrIX2hon.js} +1 -1
  17. package/dist/client/assets/{dist-DndOTsBF.js → dist-CrwnaHWk.js} +1 -1
  18. package/dist/client/assets/{dist-DdCTaTc1.js → dist-CsDwtK1F.js} +1 -1
  19. package/dist/client/assets/{dist-BQK5OciP.js → dist-DWHnCS4H.js} +1 -1
  20. package/dist/client/assets/{dist-W281b4I1.js → dist-DefZp4Fa.js} +1 -1
  21. package/dist/client/assets/{dist-R_rLoe1G.js → dist-DjepRcJQ.js} +1 -1
  22. package/dist/client/assets/{dist-CH0-OHWZ.js → dist-Fa50HH8A.js} +1 -1
  23. package/dist/client/assets/{dist-DSE_w05B.js → dist-QI-T3k9i.js} +1 -1
  24. package/dist/client/assets/{dist-BZNEPjC8.js → dist-u0a7h80y.js} +1 -1
  25. package/dist/client/assets/{index-OdImWK16.css → index-CYvr3uNw.css} +1 -1
  26. package/dist/client/assets/index-D3XEFVty.js +102 -0
  27. package/dist/client/index.html +2 -2
  28. package/dist/server/http-server.js +3 -3
  29. package/package.json +1 -1
  30. package/dist/client/assets/index-C2caXFC3.js +0 -102
@@ -1,5 +1,5 @@
1
1
  {
2
- "hash": "67eccd036f91dc42885d083622c62d0ac84cb5cb2f9e5b5b3973f53f8203b806",
2
+ "hash": "f0085f8283d0a0b75514355f9dc867f5e13cafe83a3b5565d6f8eb54e4134a7f",
3
3
  "files": {
4
4
  "src/client/App.tsx": "dd1c42f8503bab57a08330ae3f5a4ca21a7017a3fdcc8a06a959de34d2450d7d",
5
5
  "src/client/CodeMirrorEditor.tsx": "b6b6479effa1482eda710f04a26f3af843515526e129ca5bc70692cca9074b09",
@@ -12,7 +12,7 @@
12
12
  "src/client/KnowledgePanel.tsx": "4f7230cfe610cd86d63aa143c82f6195b3c4208ef0bea703f92104ef27237704",
13
13
  "src/client/MarkdownView.tsx": "4f04a8f3c9381946e5d2f957ac4fb74a6b16272e90375fb4dc6bd3a43d7c744d",
14
14
  "src/client/MemoryPanel.tsx": "59a74f5789f43708245b6f62ba3b873ad91804f64c1e352403d5b7dffd478fdc",
15
- "src/client/ProjectControlPanel.tsx": "d35961170154aeb8d39d25344dfdebc373c59380156108a43390a0242588df44",
15
+ "src/client/ProjectControlPanel.tsx": "4472265b42ba9a054adbe9943a21930735ed6de19b031bc41298960013d869ed",
16
16
  "src/client/ProjectExecutionTools.tsx": "4c4d9c34b16dbd3e720f79b6be689831188b13f677cd89abdcdb7890e814c50a",
17
17
  "src/client/ScheduledTasksPanel.tsx": "ad8d929b73c7d332730fd41a8594e3d79930161121d5727b94d39a089d36d9c8",
18
18
  "src/client/SlashCommandMenu.tsx": "69cd0a9d5e35f41f703e91a845e5bd750c952d2957be03b5528e156e60bf6ecb",
@@ -29,7 +29,7 @@
29
29
  "src/client/pending-operations.ts": "8a5f9e9711c0f875c8ed194196c218162de5270298dad4091351d41294c859d7",
30
30
  "src/client/session-tree.ts": "affc00d2264926d615a38e458a89d3a8c651b74135bbfe004d0a9be9b14a0c86",
31
31
  "src/client/slash-commands.ts": "b792018fb67bd9e6f777397b0720b8b3aa565a4d8f7a76f94fec097ddf749480",
32
- "src/client/styles.css": "5e94c23506f33a8b71964fdedb7d68318b0dbea3821860b37e1a24720f7f6531",
32
+ "src/client/styles.css": "32f9ccc529772fc8c11dc11f66d20cc139c6ca6a8fcfc1db895f8cb61cea350f",
33
33
  "src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
34
34
  "src/client/theme.tsx": "5892479a802f41e7d45adeb5170efbf555b240f8581528bcde7bf2d99c635010",
35
35
  "src/client/tool-launcher.ts": "40fb4974362bbc8c73ecd651da1abce251fc28857564a9321037adcfdb0bfe24",
@@ -39,5 +39,5 @@
39
39
  "src/client/types.ts": "b4d24bfabf230e29b984cf698aeb579c19797139a2b358f1a4e61cafce02964d",
40
40
  "src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
41
41
  },
42
- "recordedAt": "2026-11-04T08:09:41.654Z"
42
+ "recordedAt": "2026-11-04T08:40:38.463Z"
43
43
  }
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-rXWbM1pb.js","assets/dist-BQK5OciP.js","assets/index-C2caXFC3.js","assets/index-OdImWK16.css","assets/dist-R_rLoe1G.js","assets/dist-BDxBEqt3.js","assets/dist-BZlYaGxq.js","assets/dist-DuhZOzpj.js","assets/dist-DxoyfcUP.js","assets/dist-DIgk0yLa.js","assets/dist-D8Zpt_js.js","assets/dist-BCZnYgeb.js","assets/dist-D4twfstd.js","assets/dist-DdCTaTc1.js","assets/dist-DndOTsBF.js","assets/dist-W281b4I1.js","assets/dist-BeCgVWwJ.js","assets/dist-CH0-OHWZ.js","assets/dist-BJPYIQat.js","assets/dist-DSE_w05B.js","assets/dist-BQjIO_bJ.js","assets/dist-BZNEPjC8.js","assets/dist-BT4A5Gts.js","assets/dist-BBvvLw1T.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r,s as i,t as a}from"./index-C2caXFC3.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-rXWbM1pb.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-BZlYaGxq.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-DxoyfcUP.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-D8Zpt_js.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-D8Zpt_js.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-BCZnYgeb.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-D4twfstd.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-W281b4I1.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-BeCgVWwJ.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-BeCgVWwJ.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-CH0-OHWZ.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-BJPYIQat.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-BJPYIQat.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-BJPYIQat.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-DdCTaTc1.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-DdCTaTc1.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-DdCTaTc1.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-DdCTaTc1.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-DndOTsBF.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-DSE_w05B.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-DSE_w05B.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-DSE_w05B.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-BQjIO_bJ.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-BZNEPjC8.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-BQK5OciP.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-R_rLoe1G.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-BT4A5Gts.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-BBvvLw1T.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-rXWbM1pb.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-BDxBEqt3.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CrIX2hon.js","assets/dist-DWHnCS4H.js","assets/index-D3XEFVty.js","assets/index-CYvr3uNw.css","assets/dist-DjepRcJQ.js","assets/dist-C1iGzBNB.js","assets/dist-Bl20l56d.js","assets/dist-CA4ywFCU.js","assets/dist-BotfOUXo.js","assets/dist-BeLF-5JB.js","assets/dist-CBAhomD3.js","assets/dist-CdG0dOlF.js","assets/dist-ClXbSHKM.js","assets/dist-CsDwtK1F.js","assets/dist-CrwnaHWk.js","assets/dist-DefZp4Fa.js","assets/dist-CgShg9H1.js","assets/dist-Fa50HH8A.js","assets/dist-Br9aGZZB.js","assets/dist-QI-T3k9i.js","assets/dist-CNdHgilU.js","assets/dist-u0a7h80y.js","assets/dist-7jfYXjWH.js","assets/dist-C1FnggSV.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,r,s as i,t as a}from"./index-D3XEFVty.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-CrIX2hon.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-Bl20l56d.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-BotfOUXo.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-CBAhomD3.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-CBAhomD3.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-CdG0dOlF.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-ClXbSHKM.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-DefZp4Fa.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-CgShg9H1.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-CgShg9H1.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-Fa50HH8A.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-Br9aGZZB.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-Br9aGZZB.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-Br9aGZZB.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-CsDwtK1F.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-CsDwtK1F.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-CsDwtK1F.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-CsDwtK1F.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-CrwnaHWk.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-QI-T3k9i.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-QI-T3k9i.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-QI-T3k9i.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-CNdHgilU.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-u0a7h80y.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-DWHnCS4H.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-DjepRcJQ.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-7jfYXjWH.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-C1FnggSV.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-CrIX2hon.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-C1iGzBNB.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
@@ -1 +1 @@
1
- import{S as e,a as t,b as n,g as r,h as i,i as a,m as o,n as s,p as c,r as l,s as u,t as d,y as f}from"./dist-BQK5OciP.js";import{n as p,r as m}from"./dist-R_rLoe1G.js";import{l as ee}from"./dist-BDxBEqt3.js";import{IndentContext as te,getIndentUnit as ne,getIndentation as re,indentString as h,indentUnit as ie,matchBrackets as g,syntaxTree as _}from"./dist-rXWbM1pb.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=y(e.state,n.from);return r.line?oe(e):r.block?fe(e):!1};function v(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=v(S,0),se=v(S,1),ce=v(S,2),le=v(x,0),ue=v(x,1),de=v(x,2),fe=v((e,t)=>x(e,t,me(t)),0);function y(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var b=50;function pe(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-b,r),o=e.sliceDoc(i,i+b),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+b),d=e.sliceDoc(i-b,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function me(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function x(e,t,n=t.selection.ranges){let r=n.map(e=>y(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>pe(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=y(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var C=d.define(),he=d.define(),ge=u.define(),_e=u.define({combine(e){return f(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),w=o.define({create(){return A.empty},update(e,t){let n=t.state.facet(_e),i=t.annotation(C);if(i){let r=D.fromTransaction(t,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=r?O(o,o.length,n.minDepth,r):Ne(o,t.startState.selection),new A(a==0?i.rest:o,a==0?o:i.rest)}let a=t.annotation(he);if((a==`full`||a==`before`)&&(e=e.isolate()),t.annotation(r.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=D.fromTransaction(t),s=t.annotation(r.time),c=t.annotation(r.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new A(e.done.map(D.fromJSON),e.undone.map(D.fromJSON))}});function ve(e={}){return[w,_e.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?be:e.inputType==`historyRedo`?E:null;return n?(e.preventDefault(),n(t)):!1}})]}var ye=w;function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(w,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var be=T(0,!1),E=T(1,!1),xe=T(0,!0),Se=T(1,!0);function Ce(e){return function(t){let n=t.field(w,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}var we=Ce(0),Te=Ce(1);function Ee(e){return function(t){let n=t.field(w,!1);if(!n)return!1;let r=e==0?n.done:n.undone;return r.length>0&&r[0].selectionsAfter.length>0}}var De=Ee(0),Oe=Ee(0),D=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&l.fromJSON(n.changes),[],n.mapped&&s.fromJSON(n.mapped),n.startSelection&&t.fromJSON(n.startSelection),n.selectionsAfter.map(t.fromJSON))}static fromTransaction(t,n){let r=k;for(let e of t.startState.facet(ge)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,k)}static selection(t){return new e(void 0,k,void 0,void 0,t)}};function O(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ke(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Ae(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function je(e,t){return e.length?t.length?e.concat(t):e:t}var k=[],Me=200;function Ne(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Me));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),O(e,e.length-1,1e9,n.setSelAfter(r)))}return[D.selection([t])]}function Pe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Fe(e,t){if(!e.length)return e;let n=e.length,r=k;for(;n;){let i=Ie(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[D.selection(r)]:k}function Ie(e,t,n){let r=je(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):k,n);if(!e.changes)return D.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new D(i,c.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Le=/^(input\.type|delete)($|\.)/,A=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Le.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,ke(s.changes,t.changes))||r==`input.type.compose`)?O(o,o.length-1,i.minDepth,new D(t.changes.compose(s.changes),je(c.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,k)):O(o,o.length,i.minDepth,t),new e(o,k,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:k;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Ae(a[a.length-1],t)?this:new e(Ne(this.done,t),this.undone,n,r)}addMapping(t){return new e(Fe(this.done,t),Fe(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:C.of({side:e,rest:Pe(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?k:r.slice(0,r.length-1);return i.mapped&&(n=Fe(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:C.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};A.empty=new A(k,k);var Re=[{key:`Mod-z`,run:be,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:E,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:E,preventDefault:!0},{key:`Mod-u`,run:xe,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Se,preventDefault:!0}];function j(e,n){return t.create(e.ranges.map(n),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function N({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection,!0)&&(t(M(e,r)),!0)}function P(e,n){return t.cursor(n?e.to:e.from)}function F(e,t){return N(e,n=>n.empty?e.moveByChar(n,t):P(n,t))}function I(e){return e.textDirectionAt(e.state.selection.main.head)==p.LTR}var L=e=>F(e,!I(e)),ze=e=>F(e,I(e)),Be=e=>F(e,!0),Ve=e=>F(e,!1);function He(n,r,i){let a=r.head,o=n.doc.lineAt(a);return a=a==(i?o.to:o.from)?i?Math.min(n.doc.length,o.to+1):Math.max(0,o.from-1):o.from+e(o.text,a-o.from,i),t.cursor(a,i?-1:1)}function Ue(e,t){return N(e,n=>n.empty?He(e.state,n,t):P(n,t))}var We=e=>Ue(e,!0),Ge=e=>Ue(e,!1);function R(e,t){return N(e,n=>n.empty?e.moveByGroup(n,t):P(n,t))}var Ke=e=>R(e,!I(e)),qe=e=>R(e,I(e)),Je=e=>R(e,!0),Ye=e=>R(e,!1);function Xe(e,t,n){let r=e.state.charCategorizer(t),i=r(n),o=i!=a.Space;return e=>{let t=r(e);return t==a.Space?(o=!1,!0):o&&t==i}}var Ze=e=>N(e,t=>t.empty?e.moveByChar(t,!0,n=>Xe(e,t.head,n)):P(t,!0)),Qe=typeof Intl<`u`&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:`word`}):null;function $e(e,n,r){let i=e.state.charCategorizer(n.from),o=a.Space,s=n.from,c=0,l=!1,u=!1,d=!1,f=t=>{if(l)return!1;s+=r?t.length:-t.length;let n=i(t),f;if(n==a.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(n=-1),o==a.Space&&(o=n),o!=n)return!1;if(o==a.Word){if(t.toLowerCase()==t){if(!r&&u)return!1;d=!0}else if(d){if(r)return!1;l=!0}else{if(u&&r&&i(f=e.state.sliceDoc(s,s+1))==a.Word&&f.toLowerCase()==f)return!1;u=!0}}return c++,!0},p=e.moveByChar(n,r,e=>(f(e),f));if(Qe&&o==a.Word&&p.from==n.from+c*(r?1:-1)){let i=Math.min(n.head,p.head),a=Math.max(n.head,p.head),o=e.state.sliceDoc(i,a);if(o.length>1&&/[\u4E00-\uffff]/.test(o)){let e=Array.from(Qe.segment(o));if(e.length>1)return r?t.cursor(n.head+e[1].index,-1):t.cursor(p.head+e[e.length-1].index,1)}}return p}function et(e,t){return N(e,n=>n.empty?$e(e,n,t):P(n,t))}var tt=e=>et(e,!0),nt=e=>et(e,!1);function rt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,n,r){let i=_(e).resolveInner(n.head),a=r?ee.closedBy:ee.openedBy;for(let t=n.head;;){let n=r?i.childAfter(t):i.childBefore(t);if(!n)break;rt(e,n,a)?i=n:t=r?n.to:n.from}let o=i.type.prop(a),s,c;return c=o&&(s=r?g(e,i.from,1):g(e,i.to,-1))&&s.matched?r?s.end.to:s.end.from:r?i.to:i.from,t.cursor(c,r?-1:1)}var it=e=>N(e,t=>z(e.state,t,!I(e))),at=e=>N(e,t=>z(e.state,t,I(e)));function ot(e,t){return N(e,n=>{if(!n.empty)return P(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var B=e=>ot(e,!1),V=e=>ot(e,!0);function st(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ct(e,t){let n=st(e),{state:r}=e,i=j(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):P(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(M(r,i),{effects:a}),!0}var H=e=>ct(e,!1),U=e=>ct(e,!0);function W(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.cursor(i.from+r))}return a}var lt=e=>N(e,t=>W(e,t,!0)),ut=e=>N(e,t=>W(e,t,!1)),dt=e=>N(e,t=>W(e,t,!I(e))),ft=e=>N(e,t=>W(e,t,I(e))),pt=e=>N(e,t=>e.moveToLineBoundary(t,!1,!1)),mt=e=>N(e,t=>e.moveToLineBoundary(t,!0,!1));function ht(e,n,r){let i=!1,a=j(e.selection,n=>{let a=g(e,n.head,-1)||g(e,n.head,1)||n.head>0&&g(e,n.head-1,1)||n.head<e.doc.length&&g(e,n.head+1,-1);if(!a||!a.end)return n;i=!0;let o=a.start.from==n.head?a.end.to:a.end.from;return r?t.range(n.anchor,o):t.cursor(o)});return i?(n(M(e,a)),!0):!1}var gt=({state:e,dispatch:t})=>ht(e,t,!1),_t=({state:e,dispatch:t})=>ht(e,t,!0);function G(e,n,r){let i=j(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.range(e.head,e.anchor));let i=r(e);return t.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(M(e.state,i)),!0)}function K(e,t){return G(e,t,n=>e.moveByChar(n,t))}var q=e=>K(e,!I(e)),vt=e=>K(e,I(e)),yt=e=>K(e,!0),bt=e=>K(e,!1),xt=e=>G(e,!0,t=>He(e.state,t,!0)),St=e=>G(e,!1,t=>He(e.state,t,!1));function J(e,t){return G(e,t,n=>e.moveByGroup(n,t))}var Ct=e=>J(e,!I(e)),wt=e=>J(e,I(e)),Tt=e=>J(e,!0),Et=e=>J(e,!1),Dt=e=>G(e,!0,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)));function Ot(e,t){return G(e,t,n=>$e(e,n,t))}var kt=e=>Ot(e,!0),At=e=>Ot(e,!1),jt=e=>{let t=!I(e);return G(e,t,n=>z(e.state,n,t))},Mt=e=>{let t=I(e);return G(e,t,n=>z(e.state,n,t))};function Nt(e,t){return G(e,t,n=>e.moveVertically(n,t))}var Pt=e=>Nt(e,!1),Ft=e=>Nt(e,!0);function It(e,t){return G(e,t,n=>e.moveVertically(n,t,st(e).height))}var Lt=e=>It(e,!1),Rt=e=>It(e,!0),zt=e=>G(e,!0,t=>W(e,t,!0)),Bt=e=>G(e,!1,t=>W(e,t,!1)),Vt=e=>{let t=!I(e);return G(e,t,n=>W(e,n,t))},Ht=e=>{let t=I(e);return G(e,t,n=>W(e,n,t))},Ut=e=>G(e,!1,n=>t.cursor(e.lineBlockAt(n.head).from)),Wt=e=>G(e,!0,n=>t.cursor(e.lineBlockAt(n.head).to)),Gt=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),Kt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),Jt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Yt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Xt=({state:e,dispatch:n})=>{let r=Q(e).map(({from:n,to:r})=>t.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.create(r),userEvent:`select`})),!0},Zt=({state:e,dispatch:n})=>{let r=j(e.selection,n=>{let r=_(e),i=r.resolveStack(n.from,1);if(n.empty){let e=r.resolveStack(n.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:r}=e;if((r.from<n.from&&r.to>=n.to||r.to>n.to&&r.from<=n.from)&&e.next)return t.undirectionalRange(r.from,r.to)}return n});return!r.eq(e.selection)&&(n(M(e,r)),!0)};function Qt(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(M(r,t.create(a,a.length-1))),!0)}var $t=e=>Qt(e,!1),en=e=>Qt(e,!0),tn=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.create([r.main]):r.main.empty||(i=t.create([t.cursor(r.main.head)])),i?(n(M(e,i)),!0):!1};function Y(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=X(e,t,!1)):t>a&&(r=`delete.forward`,t=X(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=X(e,a,!1),o=X(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?m.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function X(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var nn=(t,r,i)=>Y(t,a=>{let o=a.from,{state:s}=t,c=s.doc.lineAt(o),l,u;if(i&&!r&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,o-c.from))){if(l[l.length-1]==` `)return o-1;let e=n(l,s.tabSize)%ne(s)||ne(s);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)o--;u=o}else u=e(c.text,o-c.from,r,r)+c.from,u==o&&c.number!=(r?s.doc.lines:1)?u+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from))&&(u=e(c.text,u-c.from,!1,!1)+c.from);return u}),Z=e=>nn(e,!1,!0),rn=e=>nn(e,!1,!1),an=e=>nn(e,!0,!1),on=(t,n)=>Y(t,r=>{let i=r.head,{state:a}=t,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let t=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=e(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(t!=null&&u!=t)break;(l!=` `||i!=r.head)&&(t=u),i=c}return i}),sn=e=>on(e,!1),cn=e=>on(e,!0),ln=e=>Y(e,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)).head),un=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dn=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),fn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),pn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r=``,i=e.doc.iter();;){if(i.next(),i.lineBreak||i.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),i.done)break;r=``}else r=i.value;t+=i.value.length}return n.length?(t(e.update({changes:n,userEvent:`delete`})),!0):!1},hn=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:i.of([``,``])},range:t.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},gn=({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,a=n.doc.lineAt(i),o=i==a.from?i-1:e(a.text,i-a.from,!1)+a.from,s=i==a.to?i+1:e(a.text,i-a.from,!0)+a.from;return{changes:{from:o,to:s,insert:n.doc.slice(i,s).append(n.doc.slice(o,i))},range:t.cursor(s)}});return!i.changes.empty&&(r(n.update(i,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function _n(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of Q(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var vn=({state:e,dispatch:t})=>_n(e,t,!1),yn=({state:e,dispatch:t})=>_n(e,t,!0);function bn(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var xn=({state:e,dispatch:t})=>bn(e,t,!1),Sn=({state:e,dispatch:t})=>bn(e,t,!0),Cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=j(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0},wn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:`input`})),!0),Tn=({state:e,dispatch:n})=>(n(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:t.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:`input`})),!0);function En(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(ee.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Dn=kn(!1),On=kn(!0);function kn(e){return({state:r,dispatch:a})=>{if(r.readOnly)return!1;let o=r.changeByRange(a=>{let{from:o,to:s}=a,c=r.doc.lineAt(o),l=!e&&o==s&&En(r,o);e&&(o=s=(s<=c.to?c:r.doc.lineAt(s)).to);let u=new te(r,{simulateBreak:o,simulateDoubleBreak:!!l}),d=re(u,o);for(d??=n(/^\s*/.exec(r.doc.lineAt(o).text)[0],r.tabSize);s<c.to&&/\s/.test(c.text[s-c.from]);)s++;l?{from:o,to:s}=l:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let f=[``,h(r,d)];return l&&f.push(h(r,u.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:i.of(f)},range:t.cursor(o+1+f[1].length)}});return a(r.update(o,{scrollIntoView:!0,userEvent:`input`})),!0}}function An(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var jn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new te(e,{overrideIndentation:e=>n[e]??-1}),i=An(e,(t,i,a)=>{let o=re(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=h(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},$=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ie)})}),{userEvent:`input.indent`})),!0),Mn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let a=n(i,e.tabSize),o=0,s=h(e,Math.max(0,a-ne(e)));for(;o<i.length&&o<s.length&&i.charCodeAt(o)==s.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Nn=e=>(e.setTabFocusMode(),!0),Pn=e=>(e.setTabFocusMode(2e3),!0),Fn=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?$({state:e,dispatch:t}):(t(e.update(e.replaceSelection(` `),{scrollIntoView:!0,userEvent:`input`})),!0),In=[{key:`Ctrl-b`,run:L,shift:q,preventDefault:!0},{key:`Ctrl-f`,run:ze,shift:vt},{key:`Ctrl-p`,run:B,shift:Pt},{key:`Ctrl-n`,run:V,shift:Ft},{key:`Ctrl-a`,run:pt,shift:Ut},{key:`Ctrl-e`,run:mt,shift:Wt},{key:`Ctrl-d`,run:an},{key:`Ctrl-h`,run:Z},{key:`Ctrl-k`,run:un},{key:`Ctrl-Alt-h`,run:sn},{key:`Ctrl-o`,run:hn},{key:`Ctrl-t`,run:gn},{key:`Ctrl-v`,run:U}],Ln=[{key:`ArrowLeft`,run:L,shift:q,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ke,shift:Ct,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dt,shift:Vt,preventDefault:!0},{key:`ArrowRight`,run:ze,shift:vt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qe,shift:wt,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ft,shift:Ht,preventDefault:!0},{key:`ArrowUp`,run:B,shift:Pt,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Gt,shift:qt},{mac:`Ctrl-ArrowUp`,run:H,shift:Lt},{key:`ArrowDown`,run:V,shift:Ft,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Kt,shift:Jt},{mac:`Ctrl-ArrowDown`,run:U,shift:Rt},{key:`PageUp`,run:H,shift:Lt},{key:`PageDown`,run:U,shift:Rt},{key:`Home`,run:ut,shift:Bt,preventDefault:!0},{key:`Mod-Home`,run:Gt,shift:qt},{key:`End`,run:lt,shift:zt,preventDefault:!0},{key:`Mod-End`,run:Kt,shift:Jt},{key:`Enter`,run:Dn,shift:Dn},{key:`Mod-a`,run:Yt},{key:`Backspace`,run:Z,shift:Z,preventDefault:!0},{key:`Delete`,run:an,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:sn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:cn,preventDefault:!0},{mac:`Mod-Backspace`,run:fn,preventDefault:!0},{mac:`Mod-Delete`,run:pn,preventDefault:!0}].concat(In.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Rn=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:it,shift:jt},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:at,shift:Mt},{key:`Alt-ArrowUp`,run:vn},{key:`Shift-Alt-ArrowUp`,run:xn},{key:`Alt-ArrowDown`,run:yn},{key:`Shift-Alt-ArrowDown`,run:Sn},{key:`Mod-Alt-ArrowUp`,run:$t},{key:`Mod-Alt-ArrowDown`,run:en},{key:`Escape`,run:tn},{key:`Mod-Enter`,run:On},{key:`Alt-l`,mac:`Ctrl-l`,run:Xt},{key:`Mod-i`,run:Zt,preventDefault:!0},{key:`Mod-[`,run:Mn},{key:`Mod-]`,run:$},{key:`Mod-Alt-\\`,run:jn},{key:`Shift-Mod-k`,run:Cn},{key:`Shift-Mod-\\`,run:gt},{key:`Mod-/`,run:ae},{key:`Alt-A`,mac:`Ctrl-A`,run:le},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Nn}].concat(Ln),zn={key:`Tab`,run:$,shift:Mn};export{$t as addCursorAbove,en as addCursorBelow,ue as blockComment,de as blockUncomment,Oe as canRedoSelection,De as canUndoSelection,Sn as copyLineDown,xn as copyLineUp,Ve as cursorCharBackward,Ge as cursorCharBackwardLogical,Be as cursorCharForward,We as cursorCharForwardLogical,L as cursorCharLeft,ze as cursorCharRight,Kt as cursorDocEnd,Gt as cursorDocStart,Ye as cursorGroupBackward,Je as cursorGroupForward,Ze as cursorGroupForwardWin,Ke as cursorGroupLeft,qe as cursorGroupRight,ut as cursorLineBoundaryBackward,lt as cursorLineBoundaryForward,dt as cursorLineBoundaryLeft,ft as cursorLineBoundaryRight,V as cursorLineDown,mt as cursorLineEnd,pt as cursorLineStart,B as cursorLineUp,gt as cursorMatchingBracket,U as cursorPageDown,H as cursorPageUp,nt as cursorSubwordBackward,tt as cursorSubwordForward,it as cursorSyntaxLeft,at as cursorSyntaxRight,Rn as defaultKeymap,Z as deleteCharBackward,rn as deleteCharBackwardStrict,an as deleteCharForward,sn as deleteGroupBackward,cn as deleteGroupForward,ln as deleteGroupForwardWin,Cn as deleteLine,fn as deleteLineBoundaryBackward,pn as deleteLineBoundaryForward,un as deleteToLineEnd,dn as deleteToLineStart,mn as deleteTrailingWhitespace,In as emacsStyleKeymap,ve as history,ye as historyField,Re as historyKeymap,Mn as indentLess,$ as indentMore,jn as indentSelection,zn as indentWithTab,On as insertBlankLine,wn as insertNewline,Dn as insertNewlineAndIndent,Tn as insertNewlineKeepIndent,Fn as insertTab,ge as invertedEffects,he as isolateHistory,se as lineComment,ce as lineUncomment,yn as moveLineDown,vn as moveLineUp,E as redo,Te as redoDepth,Se as redoSelection,Yt as selectAll,bt as selectCharBackward,St as selectCharBackwardLogical,yt as selectCharForward,xt as selectCharForwardLogical,q as selectCharLeft,vt as selectCharRight,Jt as selectDocEnd,qt as selectDocStart,Et as selectGroupBackward,Tt as selectGroupForward,Dt as selectGroupForwardWin,Ct as selectGroupLeft,wt as selectGroupRight,Xt as selectLine,Bt as selectLineBoundaryBackward,zt as selectLineBoundaryForward,Vt as selectLineBoundaryLeft,Ht as selectLineBoundaryRight,Ft as selectLineDown,Wt as selectLineEnd,Ut as selectLineStart,Pt as selectLineUp,_t as selectMatchingBracket,Rt as selectPageDown,Lt as selectPageUp,Zt as selectParentSyntax,At as selectSubwordBackward,kt as selectSubwordForward,jt as selectSyntaxLeft,Mt as selectSyntaxRight,tn as simplifySelection,hn as splitLine,Ln as standardKeymap,Pn as temporarilySetTabFocusMode,le as toggleBlockComment,fe as toggleBlockCommentByLine,ae as toggleComment,oe as toggleLineComment,Nn as toggleTabFocusMode,gn as transposeChars,be as undo,we as undoDepth,xe as undoSelection};
1
+ import{S as e,a as t,b as n,g as r,h as i,i as a,m as o,n as s,p as c,r as l,s as u,t as d,y as f}from"./dist-DWHnCS4H.js";import{n as p,r as m}from"./dist-DjepRcJQ.js";import{l as ee}from"./dist-C1iGzBNB.js";import{IndentContext as te,getIndentUnit as ne,getIndentation as re,indentString as h,indentUnit as ie,matchBrackets as g,syntaxTree as _}from"./dist-CrIX2hon.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=y(e.state,n.from);return r.line?oe(e):r.block?fe(e):!1};function v(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=v(S,0),se=v(S,1),ce=v(S,2),le=v(x,0),ue=v(x,1),de=v(x,2),fe=v((e,t)=>x(e,t,me(t)),0);function y(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var b=50;function pe(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-b,r),o=e.sliceDoc(i,i+b),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+b),d=e.sliceDoc(i-b,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function me(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function x(e,t,n=t.selection.ranges){let r=n.map(e=>y(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>pe(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=y(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var C=d.define(),he=d.define(),ge=u.define(),_e=u.define({combine(e){return f(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),w=o.define({create(){return A.empty},update(e,t){let n=t.state.facet(_e),i=t.annotation(C);if(i){let r=D.fromTransaction(t,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=r?O(o,o.length,n.minDepth,r):Ne(o,t.startState.selection),new A(a==0?i.rest:o,a==0?o:i.rest)}let a=t.annotation(he);if((a==`full`||a==`before`)&&(e=e.isolate()),t.annotation(r.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=D.fromTransaction(t),s=t.annotation(r.time),c=t.annotation(r.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new A(e.done.map(D.fromJSON),e.undone.map(D.fromJSON))}});function ve(e={}){return[w,_e.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?be:e.inputType==`historyRedo`?E:null;return n?(e.preventDefault(),n(t)):!1}})]}var ye=w;function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(w,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var be=T(0,!1),E=T(1,!1),xe=T(0,!0),Se=T(1,!0);function Ce(e){return function(t){let n=t.field(w,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}var we=Ce(0),Te=Ce(1);function Ee(e){return function(t){let n=t.field(w,!1);if(!n)return!1;let r=e==0?n.done:n.undone;return r.length>0&&r[0].selectionsAfter.length>0}}var De=Ee(0),Oe=Ee(0),D=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&l.fromJSON(n.changes),[],n.mapped&&s.fromJSON(n.mapped),n.startSelection&&t.fromJSON(n.startSelection),n.selectionsAfter.map(t.fromJSON))}static fromTransaction(t,n){let r=k;for(let e of t.startState.facet(ge)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,k)}static selection(t){return new e(void 0,k,void 0,void 0,t)}};function O(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ke(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Ae(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function je(e,t){return e.length?t.length?e.concat(t):e:t}var k=[],Me=200;function Ne(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Me));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),O(e,e.length-1,1e9,n.setSelAfter(r)))}return[D.selection([t])]}function Pe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Fe(e,t){if(!e.length)return e;let n=e.length,r=k;for(;n;){let i=Ie(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[D.selection(r)]:k}function Ie(e,t,n){let r=je(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):k,n);if(!e.changes)return D.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new D(i,c.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Le=/^(input\.type|delete)($|\.)/,A=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Le.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,ke(s.changes,t.changes))||r==`input.type.compose`)?O(o,o.length-1,i.minDepth,new D(t.changes.compose(s.changes),je(c.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,k)):O(o,o.length,i.minDepth,t),new e(o,k,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:k;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Ae(a[a.length-1],t)?this:new e(Ne(this.done,t),this.undone,n,r)}addMapping(t){return new e(Fe(this.done,t),Fe(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:C.of({side:e,rest:Pe(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?k:r.slice(0,r.length-1);return i.mapped&&(n=Fe(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:C.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};A.empty=new A(k,k);var Re=[{key:`Mod-z`,run:be,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:E,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:E,preventDefault:!0},{key:`Mod-u`,run:xe,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Se,preventDefault:!0}];function j(e,n){return t.create(e.ranges.map(n),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function N({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection,!0)&&(t(M(e,r)),!0)}function P(e,n){return t.cursor(n?e.to:e.from)}function F(e,t){return N(e,n=>n.empty?e.moveByChar(n,t):P(n,t))}function I(e){return e.textDirectionAt(e.state.selection.main.head)==p.LTR}var L=e=>F(e,!I(e)),ze=e=>F(e,I(e)),Be=e=>F(e,!0),Ve=e=>F(e,!1);function He(n,r,i){let a=r.head,o=n.doc.lineAt(a);return a=a==(i?o.to:o.from)?i?Math.min(n.doc.length,o.to+1):Math.max(0,o.from-1):o.from+e(o.text,a-o.from,i),t.cursor(a,i?-1:1)}function Ue(e,t){return N(e,n=>n.empty?He(e.state,n,t):P(n,t))}var We=e=>Ue(e,!0),Ge=e=>Ue(e,!1);function R(e,t){return N(e,n=>n.empty?e.moveByGroup(n,t):P(n,t))}var Ke=e=>R(e,!I(e)),qe=e=>R(e,I(e)),Je=e=>R(e,!0),Ye=e=>R(e,!1);function Xe(e,t,n){let r=e.state.charCategorizer(t),i=r(n),o=i!=a.Space;return e=>{let t=r(e);return t==a.Space?(o=!1,!0):o&&t==i}}var Ze=e=>N(e,t=>t.empty?e.moveByChar(t,!0,n=>Xe(e,t.head,n)):P(t,!0)),Qe=typeof Intl<`u`&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:`word`}):null;function $e(e,n,r){let i=e.state.charCategorizer(n.from),o=a.Space,s=n.from,c=0,l=!1,u=!1,d=!1,f=t=>{if(l)return!1;s+=r?t.length:-t.length;let n=i(t),f;if(n==a.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(n=-1),o==a.Space&&(o=n),o!=n)return!1;if(o==a.Word){if(t.toLowerCase()==t){if(!r&&u)return!1;d=!0}else if(d){if(r)return!1;l=!0}else{if(u&&r&&i(f=e.state.sliceDoc(s,s+1))==a.Word&&f.toLowerCase()==f)return!1;u=!0}}return c++,!0},p=e.moveByChar(n,r,e=>(f(e),f));if(Qe&&o==a.Word&&p.from==n.from+c*(r?1:-1)){let i=Math.min(n.head,p.head),a=Math.max(n.head,p.head),o=e.state.sliceDoc(i,a);if(o.length>1&&/[\u4E00-\uffff]/.test(o)){let e=Array.from(Qe.segment(o));if(e.length>1)return r?t.cursor(n.head+e[1].index,-1):t.cursor(p.head+e[e.length-1].index,1)}}return p}function et(e,t){return N(e,n=>n.empty?$e(e,n,t):P(n,t))}var tt=e=>et(e,!0),nt=e=>et(e,!1);function rt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,n,r){let i=_(e).resolveInner(n.head),a=r?ee.closedBy:ee.openedBy;for(let t=n.head;;){let n=r?i.childAfter(t):i.childBefore(t);if(!n)break;rt(e,n,a)?i=n:t=r?n.to:n.from}let o=i.type.prop(a),s,c;return c=o&&(s=r?g(e,i.from,1):g(e,i.to,-1))&&s.matched?r?s.end.to:s.end.from:r?i.to:i.from,t.cursor(c,r?-1:1)}var it=e=>N(e,t=>z(e.state,t,!I(e))),at=e=>N(e,t=>z(e.state,t,I(e)));function ot(e,t){return N(e,n=>{if(!n.empty)return P(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var B=e=>ot(e,!1),V=e=>ot(e,!0);function st(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ct(e,t){let n=st(e),{state:r}=e,i=j(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):P(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(M(r,i),{effects:a}),!0}var H=e=>ct(e,!1),U=e=>ct(e,!0);function W(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.cursor(i.from+r))}return a}var lt=e=>N(e,t=>W(e,t,!0)),ut=e=>N(e,t=>W(e,t,!1)),dt=e=>N(e,t=>W(e,t,!I(e))),ft=e=>N(e,t=>W(e,t,I(e))),pt=e=>N(e,t=>e.moveToLineBoundary(t,!1,!1)),mt=e=>N(e,t=>e.moveToLineBoundary(t,!0,!1));function ht(e,n,r){let i=!1,a=j(e.selection,n=>{let a=g(e,n.head,-1)||g(e,n.head,1)||n.head>0&&g(e,n.head-1,1)||n.head<e.doc.length&&g(e,n.head+1,-1);if(!a||!a.end)return n;i=!0;let o=a.start.from==n.head?a.end.to:a.end.from;return r?t.range(n.anchor,o):t.cursor(o)});return i?(n(M(e,a)),!0):!1}var gt=({state:e,dispatch:t})=>ht(e,t,!1),_t=({state:e,dispatch:t})=>ht(e,t,!0);function G(e,n,r){let i=j(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.range(e.head,e.anchor));let i=r(e);return t.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(M(e.state,i)),!0)}function K(e,t){return G(e,t,n=>e.moveByChar(n,t))}var q=e=>K(e,!I(e)),vt=e=>K(e,I(e)),yt=e=>K(e,!0),bt=e=>K(e,!1),xt=e=>G(e,!0,t=>He(e.state,t,!0)),St=e=>G(e,!1,t=>He(e.state,t,!1));function J(e,t){return G(e,t,n=>e.moveByGroup(n,t))}var Ct=e=>J(e,!I(e)),wt=e=>J(e,I(e)),Tt=e=>J(e,!0),Et=e=>J(e,!1),Dt=e=>G(e,!0,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)));function Ot(e,t){return G(e,t,n=>$e(e,n,t))}var kt=e=>Ot(e,!0),At=e=>Ot(e,!1),jt=e=>{let t=!I(e);return G(e,t,n=>z(e.state,n,t))},Mt=e=>{let t=I(e);return G(e,t,n=>z(e.state,n,t))};function Nt(e,t){return G(e,t,n=>e.moveVertically(n,t))}var Pt=e=>Nt(e,!1),Ft=e=>Nt(e,!0);function It(e,t){return G(e,t,n=>e.moveVertically(n,t,st(e).height))}var Lt=e=>It(e,!1),Rt=e=>It(e,!0),zt=e=>G(e,!0,t=>W(e,t,!0)),Bt=e=>G(e,!1,t=>W(e,t,!1)),Vt=e=>{let t=!I(e);return G(e,t,n=>W(e,n,t))},Ht=e=>{let t=I(e);return G(e,t,n=>W(e,n,t))},Ut=e=>G(e,!1,n=>t.cursor(e.lineBlockAt(n.head).from)),Wt=e=>G(e,!0,n=>t.cursor(e.lineBlockAt(n.head).to)),Gt=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),Kt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),Jt=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Yt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Xt=({state:e,dispatch:n})=>{let r=Q(e).map(({from:n,to:r})=>t.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.create(r),userEvent:`select`})),!0},Zt=({state:e,dispatch:n})=>{let r=j(e.selection,n=>{let r=_(e),i=r.resolveStack(n.from,1);if(n.empty){let e=r.resolveStack(n.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:r}=e;if((r.from<n.from&&r.to>=n.to||r.to>n.to&&r.from<=n.from)&&e.next)return t.undirectionalRange(r.from,r.to)}return n});return!r.eq(e.selection)&&(n(M(e,r)),!0)};function Qt(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(M(r,t.create(a,a.length-1))),!0)}var $t=e=>Qt(e,!1),en=e=>Qt(e,!0),tn=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.create([r.main]):r.main.empty||(i=t.create([t.cursor(r.main.head)])),i?(n(M(e,i)),!0):!1};function Y(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=X(e,t,!1)):t>a&&(r=`delete.forward`,t=X(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=X(e,a,!1),o=X(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?m.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function X(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var nn=(t,r,i)=>Y(t,a=>{let o=a.from,{state:s}=t,c=s.doc.lineAt(o),l,u;if(i&&!r&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,o-c.from))){if(l[l.length-1]==` `)return o-1;let e=n(l,s.tabSize)%ne(s)||ne(s);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)o--;u=o}else u=e(c.text,o-c.from,r,r)+c.from,u==o&&c.number!=(r?s.doc.lines:1)?u+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from))&&(u=e(c.text,u-c.from,!1,!1)+c.from);return u}),Z=e=>nn(e,!1,!0),rn=e=>nn(e,!1,!1),an=e=>nn(e,!0,!1),on=(t,n)=>Y(t,r=>{let i=r.head,{state:a}=t,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let t=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=e(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(t!=null&&u!=t)break;(l!=` `||i!=r.head)&&(t=u),i=c}return i}),sn=e=>on(e,!1),cn=e=>on(e,!0),ln=e=>Y(e,t=>e.moveByChar(t,!0,n=>Xe(e,t.head,n)).head),un=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dn=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),fn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),pn=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r=``,i=e.doc.iter();;){if(i.next(),i.lineBreak||i.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),i.done)break;r=``}else r=i.value;t+=i.value.length}return n.length?(t(e.update({changes:n,userEvent:`delete`})),!0):!1},hn=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:i.of([``,``])},range:t.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},gn=({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,a=n.doc.lineAt(i),o=i==a.from?i-1:e(a.text,i-a.from,!1)+a.from,s=i==a.to?i+1:e(a.text,i-a.from,!0)+a.from;return{changes:{from:o,to:s,insert:n.doc.slice(i,s).append(n.doc.slice(o,i))},range:t.cursor(s)}});return!i.changes.empty&&(r(n.update(i,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function _n(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of Q(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var vn=({state:e,dispatch:t})=>_n(e,t,!1),yn=({state:e,dispatch:t})=>_n(e,t,!0);function bn(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var xn=({state:e,dispatch:t})=>bn(e,t,!1),Sn=({state:e,dispatch:t})=>bn(e,t,!0),Cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=j(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0},wn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:`input`})),!0),Tn=({state:e,dispatch:n})=>(n(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:t.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:`input`})),!0);function En(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(ee.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Dn=kn(!1),On=kn(!0);function kn(e){return({state:r,dispatch:a})=>{if(r.readOnly)return!1;let o=r.changeByRange(a=>{let{from:o,to:s}=a,c=r.doc.lineAt(o),l=!e&&o==s&&En(r,o);e&&(o=s=(s<=c.to?c:r.doc.lineAt(s)).to);let u=new te(r,{simulateBreak:o,simulateDoubleBreak:!!l}),d=re(u,o);for(d??=n(/^\s*/.exec(r.doc.lineAt(o).text)[0],r.tabSize);s<c.to&&/\s/.test(c.text[s-c.from]);)s++;l?{from:o,to:s}=l:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let f=[``,h(r,d)];return l&&f.push(h(r,u.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:i.of(f)},range:t.cursor(o+1+f[1].length)}});return a(r.update(o,{scrollIntoView:!0,userEvent:`input`})),!0}}function An(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var jn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new te(e,{overrideIndentation:e=>n[e]??-1}),i=An(e,(t,i,a)=>{let o=re(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=h(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},$=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ie)})}),{userEvent:`input.indent`})),!0),Mn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(An(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let a=n(i,e.tabSize),o=0,s=h(e,Math.max(0,a-ne(e)));for(;o<i.length&&o<s.length&&i.charCodeAt(o)==s.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Nn=e=>(e.setTabFocusMode(),!0),Pn=e=>(e.setTabFocusMode(2e3),!0),Fn=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?$({state:e,dispatch:t}):(t(e.update(e.replaceSelection(` `),{scrollIntoView:!0,userEvent:`input`})),!0),In=[{key:`Ctrl-b`,run:L,shift:q,preventDefault:!0},{key:`Ctrl-f`,run:ze,shift:vt},{key:`Ctrl-p`,run:B,shift:Pt},{key:`Ctrl-n`,run:V,shift:Ft},{key:`Ctrl-a`,run:pt,shift:Ut},{key:`Ctrl-e`,run:mt,shift:Wt},{key:`Ctrl-d`,run:an},{key:`Ctrl-h`,run:Z},{key:`Ctrl-k`,run:un},{key:`Ctrl-Alt-h`,run:sn},{key:`Ctrl-o`,run:hn},{key:`Ctrl-t`,run:gn},{key:`Ctrl-v`,run:U}],Ln=[{key:`ArrowLeft`,run:L,shift:q,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ke,shift:Ct,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dt,shift:Vt,preventDefault:!0},{key:`ArrowRight`,run:ze,shift:vt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qe,shift:wt,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ft,shift:Ht,preventDefault:!0},{key:`ArrowUp`,run:B,shift:Pt,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Gt,shift:qt},{mac:`Ctrl-ArrowUp`,run:H,shift:Lt},{key:`ArrowDown`,run:V,shift:Ft,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Kt,shift:Jt},{mac:`Ctrl-ArrowDown`,run:U,shift:Rt},{key:`PageUp`,run:H,shift:Lt},{key:`PageDown`,run:U,shift:Rt},{key:`Home`,run:ut,shift:Bt,preventDefault:!0},{key:`Mod-Home`,run:Gt,shift:qt},{key:`End`,run:lt,shift:zt,preventDefault:!0},{key:`Mod-End`,run:Kt,shift:Jt},{key:`Enter`,run:Dn,shift:Dn},{key:`Mod-a`,run:Yt},{key:`Backspace`,run:Z,shift:Z,preventDefault:!0},{key:`Delete`,run:an,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:sn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:cn,preventDefault:!0},{mac:`Mod-Backspace`,run:fn,preventDefault:!0},{mac:`Mod-Delete`,run:pn,preventDefault:!0}].concat(In.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Rn=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:it,shift:jt},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:at,shift:Mt},{key:`Alt-ArrowUp`,run:vn},{key:`Shift-Alt-ArrowUp`,run:xn},{key:`Alt-ArrowDown`,run:yn},{key:`Shift-Alt-ArrowDown`,run:Sn},{key:`Mod-Alt-ArrowUp`,run:$t},{key:`Mod-Alt-ArrowDown`,run:en},{key:`Escape`,run:tn},{key:`Mod-Enter`,run:On},{key:`Alt-l`,mac:`Ctrl-l`,run:Xt},{key:`Mod-i`,run:Zt,preventDefault:!0},{key:`Mod-[`,run:Mn},{key:`Mod-]`,run:$},{key:`Mod-Alt-\\`,run:jn},{key:`Shift-Mod-k`,run:Cn},{key:`Shift-Mod-\\`,run:gt},{key:`Mod-/`,run:ae},{key:`Alt-A`,mac:`Ctrl-A`,run:le},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Nn}].concat(Ln),zn={key:`Tab`,run:$,shift:Mn};export{$t as addCursorAbove,en as addCursorBelow,ue as blockComment,de as blockUncomment,Oe as canRedoSelection,De as canUndoSelection,Sn as copyLineDown,xn as copyLineUp,Ve as cursorCharBackward,Ge as cursorCharBackwardLogical,Be as cursorCharForward,We as cursorCharForwardLogical,L as cursorCharLeft,ze as cursorCharRight,Kt as cursorDocEnd,Gt as cursorDocStart,Ye as cursorGroupBackward,Je as cursorGroupForward,Ze as cursorGroupForwardWin,Ke as cursorGroupLeft,qe as cursorGroupRight,ut as cursorLineBoundaryBackward,lt as cursorLineBoundaryForward,dt as cursorLineBoundaryLeft,ft as cursorLineBoundaryRight,V as cursorLineDown,mt as cursorLineEnd,pt as cursorLineStart,B as cursorLineUp,gt as cursorMatchingBracket,U as cursorPageDown,H as cursorPageUp,nt as cursorSubwordBackward,tt as cursorSubwordForward,it as cursorSyntaxLeft,at as cursorSyntaxRight,Rn as defaultKeymap,Z as deleteCharBackward,rn as deleteCharBackwardStrict,an as deleteCharForward,sn as deleteGroupBackward,cn as deleteGroupForward,ln as deleteGroupForwardWin,Cn as deleteLine,fn as deleteLineBoundaryBackward,pn as deleteLineBoundaryForward,un as deleteToLineEnd,dn as deleteToLineStart,mn as deleteTrailingWhitespace,In as emacsStyleKeymap,ve as history,ye as historyField,Re as historyKeymap,Mn as indentLess,$ as indentMore,jn as indentSelection,zn as indentWithTab,On as insertBlankLine,wn as insertNewline,Dn as insertNewlineAndIndent,Tn as insertNewlineKeepIndent,Fn as insertTab,ge as invertedEffects,he as isolateHistory,se as lineComment,ce as lineUncomment,yn as moveLineDown,vn as moveLineUp,E as redo,Te as redoDepth,Se as redoSelection,Yt as selectAll,bt as selectCharBackward,St as selectCharBackwardLogical,yt as selectCharForward,xt as selectCharForwardLogical,q as selectCharLeft,vt as selectCharRight,Jt as selectDocEnd,qt as selectDocStart,Et as selectGroupBackward,Tt as selectGroupForward,Dt as selectGroupForwardWin,Ct as selectGroupLeft,wt as selectGroupRight,Xt as selectLine,Bt as selectLineBoundaryBackward,zt as selectLineBoundaryForward,Vt as selectLineBoundaryLeft,Ht as selectLineBoundaryRight,Ft as selectLineDown,Wt as selectLineEnd,Ut as selectLineStart,Pt as selectLineUp,_t as selectMatchingBracket,Rt as selectPageDown,Lt as selectPageUp,Zt as selectParentSyntax,At as selectSubwordBackward,kt as selectSubwordForward,jt as selectSyntaxLeft,Mt as selectSyntaxRight,tn as simplifySelection,hn as splitLine,Ln as standardKeymap,Pn as temporarilySetTabFocusMode,le as toggleBlockComment,fe as toggleBlockCommentByLine,ae as toggleComment,oe as toggleLineComment,Nn as toggleTabFocusMode,gn as transposeChars,be as undo,we as undoDepth,xe as undoSelection};
@@ -1 +1 @@
1
- import{a as e,c as t,f as n,g as r,h as i,l as a,m as o,p as s,s as c,t as l}from"./dist-BQK5OciP.js";import{d as u,o as d,r as f,t as p}from"./dist-R_rLoe1G.js";import{indentUnit as m,syntaxTree as h}from"./dist-rXWbM1pb.js";var g=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=h(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(x(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function _(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function v(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=_(t)+_(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function y(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:v(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function b(e,t){return n=>{for(let t=h(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}function x(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var S=l.define();typeof navigator==`object`&&navigator.platform;var C=f.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),w=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},T=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.TrackDel),i=n.mapPos(this.to,1,t.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},E=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(m);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new T(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new w(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},D=p.widget({widget:new class extends d{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),O=p.mark({class:`cm-snippetField`}),k=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=p.set(e.map(e=>(e.from==e.to?D:O).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},A=s.define({map(e,t){return e&&e.map(t)}}),j=s.define(),M=o.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(A))return n.value;if(n.is(j)&&e)return new k(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.decorations.from(e,e=>e?e.deco:p.none)});function N(t,n){return e.create(t.filter(e=>e.field==n).map(t=>e.range(t.from,t.to)))}function P(e){let t=E.parse(e);return(e,n,a,o)=>{let{text:c,ranges:l}=t.instantiate(e.state,a),{main:u}=e.state.selection,d={changes:{from:a,to:o==u.from?u.to:o,insert:i.of(c)},scrollIntoView:!0,annotations:n?[S.of(n),r.userEvent.of(`input.complete`)]:void 0};if(l.length&&(d.selection=N(l,0)),l.some(e=>e.field>0)){let t=new k(l,0),n=d.effects=[A.of(t)];e.state.field(M,!1)===void 0&&n.push(s.appendConfig.of([M,R,B,C]))}e.dispatch(e.state.update(d))}}function F(e){return({state:t,dispatch:n})=>{let r=t.field(M,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:N(r.ranges,i),effects:A.of(a?null:new k(r.ranges,i)),scrollIntoView:!0})),!0}}var I=[{key:`Tab`,run:F(1),shift:F(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(M,!1)?(t(e.update({effects:A.of(null)})),!0):!1}],L=c.define({combine(e){return e.length?e[0]:I}}),R=a.highest(u.compute([L],e=>e.facet(L)));function z(e,t){return{...t,apply:P(e)}}var B=f.domEventHandlers({mousedown(e,t){let n=t.state.field(M,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:N(n.ranges,i.field),effects:A.of(n.ranges.some(e=>e.field>i.field)?new k(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V=new class extends n{};V.startSide=1,V.endSide=-1,typeof navigator==`object`&&navigator.userAgent;export{z as i,y as n,b as r,g as t};
1
+ import{a as e,c as t,f as n,g as r,h as i,l as a,m as o,p as s,s as c,t as l}from"./dist-DWHnCS4H.js";import{d as u,o as d,r as f,t as p}from"./dist-DjepRcJQ.js";import{indentUnit as m,syntaxTree as h}from"./dist-CrIX2hon.js";var g=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=h(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(x(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function _(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function v(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=_(t)+_(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function y(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:v(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function b(e,t){return n=>{for(let t=h(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}function x(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var S=l.define();typeof navigator==`object`&&navigator.platform;var C=f.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),w=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},T=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.TrackDel),i=n.mapPos(this.to,1,t.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},E=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(m);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new T(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new w(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},D=p.widget({widget:new class extends d{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),O=p.mark({class:`cm-snippetField`}),k=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=p.set(e.map(e=>(e.from==e.to?D:O).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},A=s.define({map(e,t){return e&&e.map(t)}}),j=s.define(),M=o.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(A))return n.value;if(n.is(j)&&e)return new k(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.decorations.from(e,e=>e?e.deco:p.none)});function N(t,n){return e.create(t.filter(e=>e.field==n).map(t=>e.range(t.from,t.to)))}function P(e){let t=E.parse(e);return(e,n,a,o)=>{let{text:c,ranges:l}=t.instantiate(e.state,a),{main:u}=e.state.selection,d={changes:{from:a,to:o==u.from?u.to:o,insert:i.of(c)},scrollIntoView:!0,annotations:n?[S.of(n),r.userEvent.of(`input.complete`)]:void 0};if(l.length&&(d.selection=N(l,0)),l.some(e=>e.field>0)){let t=new k(l,0),n=d.effects=[A.of(t)];e.state.field(M,!1)===void 0&&n.push(s.appendConfig.of([M,R,B,C]))}e.dispatch(e.state.update(d))}}function F(e){return({state:t,dispatch:n})=>{let r=t.field(M,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:N(r.ranges,i),effects:A.of(a?null:new k(r.ranges,i)),scrollIntoView:!0})),!0}}var I=[{key:`Tab`,run:F(1),shift:F(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(M,!1)?(t(e.update({effects:A.of(null)})),!0):!1}],L=c.define({combine(e){return e.length?e[0]:I}}),R=a.highest(u.compute([L],e=>e.facet(L)));function z(e,t){return{...t,apply:P(e)}}var B=f.domEventHandlers({mousedown(e,t){let n=t.state.field(M,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:N(n.ranges,i.field),effects:A.of(n.ranges.some(e=>e.field>i.field)?new k(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V=new class extends n{};V.startSide=1,V.endSide=-1,typeof navigator==`object`&&navigator.userAgent;export{z as i,y as n,b as r,g as t};