texlite 0.7.0 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{BinaryModule-Aj1vLnwf-wCY0vy1F.js → BinaryModule-Aj1vLnwf-_qIOaefD.js} +1 -1
- package/dist/client/assets/GitDialog-BmRzMv-C.js +3 -0
- package/dist/client/assets/{HistoryDialog-qZKt59En.js → HistoryDialog-V0IkSDtJ.js} +1 -1
- package/dist/client/assets/LatexEditor-CokkLLxi.js +59 -0
- package/dist/client/assets/PdfPreview-Cs1WYPsC.js +1 -0
- package/dist/client/assets/{ProjectNavigationDialogs-CcHy9xt5.js → ProjectNavigationDialogs-BVQb4qdD.js} +1 -1
- package/dist/client/assets/{SystemMetricsDialog-BSiZRWs4.js → SystemMetricsDialog-DBrendnp.js} +1 -1
- package/dist/client/assets/binary-BQKEW09b.js +1 -0
- package/dist/client/assets/index-BS1IMOaB.js +62 -0
- package/dist/client/assets/index-Lw53KTaT.css +1 -0
- package/dist/client/assets/{index-BM28jYXo.js → index-QyVe7I1s.js} +1 -1
- package/dist/client/assets/minus-yEV4SLvG.js +1 -0
- package/dist/client/assets/{spellCheck-Cs5UpEXV.js → spellCheck-OZGa6ljx.js} +3 -3
- package/dist/client/index.html +2 -2
- package/dist/server/app.js +315 -2
- package/dist/server/citationLibrary.js +174 -0
- package/dist/server/db.js +37 -0
- package/package.json +2 -1
- package/dist/client/assets/GitDialog-BNzmjKSK.js +0 -3
- package/dist/client/assets/LatexEditor-CpK2QB28.js +0 -59
- package/dist/client/assets/PdfPreview-Deo1bzQ7.js +0 -1
- package/dist/client/assets/binary-DEDGh9yV.js +0 -1
- package/dist/client/assets/index-DJzyhcDQ.js +0 -17
- package/dist/client/assets/index-DdrajKQB.css +0 -1
- package/dist/client/assets/plus-BmrCa7ds.js +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import{u as ai,r as X,j as Pe}from"./react-CsO_xvbl.js";import{s as zr,E as se,V as ut,D as te,a as Pt,R as si,P as Qr,S as yt,b as be,f as li,M as qr,m as Er,i as ci,c as ui,d as fi,e as hi,g as di,h as pi,j as Rr,k as Jr,l as Ct,n as gi,o as vi,p as mi,q as yi,r as Ci,t as ki,u as wi,v as Si,w as xi,x as bi,y as Ge,F as Wt,A as Ut,z as Mi,W as Yr,B as Li,C as Or,G as Tr,H as Nt,I as Ai,J as Ei,K as Ri,L as Oi,N as Ti,O as Ii,Q as Ni,T as Bi,U as Pi,X as Di,Y as _i,Z as Ki,_ as Fi,$ as $i,a0 as Hi,a1 as Vi,a2 as ji,a3 as Wi,a4 as Ui,a5 as zt,a6 as zi,a7 as Qi,a8 as qi,a9 as Ji,aa as xe,ab as Yi,ac as Zi}from"./editor-DMLs-XWi.js";import{r as Ir,c as ct,U as Zr,a as Dt,b as _t,d as Nr,m as Xi,e as Gi,f as Bt,t as vt,g as mt,h as eo}from"./index-DJzyhcDQ.js";function to(s){var i=s.Pos;function l(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),o=n.charCodeAt(t.ch);55296<=o&&o<=55551&&(r.ch+=1)}return{start:t,end:r}}var u=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"gc",type:"operator",operator:"toggleComment",isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],d=Object.create(null),v=u.length,w=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"put",shortName:"pu"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],S=Yt("");function x(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),s.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Sr),ge(e),s.on(e.getInputField(),"paste",E(e))}function N(e){e.setOption("disableInput",!1),e.off("cursorActivity",Sr),s.off(e.getInputField(),"paste",E(e)),e.state.vim=null,st&&clearTimeout(st)}function E(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(ie(e.getCursor(),0,1)),ze.enterInsertMode(e,{},t))}),t.onPasteFn}var L=/[\d]/,P=[s.isWordChar,function(e){return e&&!s.isWordChar(e)&&!/\s/.test(e)}],D=[function(e){return/\S/.test(e)}],K=["<",">"],W=["-",'"',".",":","_","/","+"],F=/^\w$/,q=/^[A-Z]$/;try{q=new RegExp("^[\\p{Lu}]$","u")}catch{}function re(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function z(e){return/^[a-z]$/.test(e)}function le(e){return"()[]{}".indexOf(e)!=-1}function ce(e){return L.test(e)}function Ce(e){return q.test(e)}function ae(e){return/^\s*$/.test(e)}function _e(e){return".?!".indexOf(e)!=-1}function Je(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var Me={};function Ke(e,t,r,n,o){if(t===void 0&&!o)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),Me[e]={type:r,defaultValue:t,callback:o},n)for(var a=0;a<n.length;a++)Me[n[a]]=Me[e];t&&Ve(e,t)}function Ve(e,t,r,n){var o=Me[e];n=n||{};var a=n.scope;if(!o)return new Error("Unknown option: "+e);if(o.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}o.callback?(a!=="local"&&o.callback(t,void 0),a!=="global"&&r&&o.callback(t,r)):(a!=="local"&&(o.value=o.type=="boolean"?!!t:t),a!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function pe(e,t,r){var n=Me[e];r=r||{};var o=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){let a=t&&n.callback(void 0,t);return o!=="global"&&a!==void 0?a:o!=="local"?n.callback():void 0}else return(o!=="global"&&t&&t.state.vim.options[e]||o!=="local"&&n||{}).value}Ke("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let r=t.getOption("mode");return r=="null"?"":r}else{let r=e==""?"null":e;t.setOption("mode",r)}}),Ke("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("textwidth");return r}else{var n=Math.round(e);n>1&&t.setOption("textwidth",n)}});var je=function(){var e=100,t=-1,r=0,n=0,o=new Array(e);function a(h,p,g){var y=t%e,C=o[y];function k(b){var M=++t%e,I=o[M];I&&I.clear(),o[M]=h.setBookmark(b)}if(C){var m=C.find();m&&!Le(m,p)&&k(p)}else k(p);k(g),r=t,n=t-e+1,n<0&&(n=0)}function c(h,p){t+=p,t>r?t=r:t<n&&(t=n);var g=o[(e+t)%e];if(g&&!g.find()){var y=p>0?1:-1,C,k=h.getCursor();do if(t+=y,g=o[(e+t)%e],g&&(C=g.find())&&!Le(k,C))break;while(t<r&&t>n)}return g}function f(h,p){var g=t,y=c(h,p);return t=g,y&&y.find()}return{cachedCursor:void 0,add:a,find:f,move:c}},ft=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class tt{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ft()}exitMacroRecordMode(){var t=A.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,r){var n=A.registerController.getRegister(r);if(n){if(n.clear(),this.latestRegister=r,t.openDialog){var o=Re("span",{class:"cm-vim-message"},"recording @"+r);this.onRecordingDone=t.openDialog(o,function(){},{bottom:!0})}this.isRecording=!0}}}function ge(e){return e.state.vim||(e.state.vim={inputState:new Zt,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new i(0,0),head:new i(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var A;function rt(){A={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:je(),macroModeState:new tt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new vn({}),searchHistoryController:new Xt,exCommandHistoryController:new Xt};for(var e in Me){var t=Me[e];t.value=t.defaultValue}}class B{constructor(t,r){this.keyName=t,this.key=r.key,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.shiftKey=r.shiftKey}}var Z,R={enterVimMode:x,leaveVimMode:N,buildKeyMap:function(){},getRegisterController:function(){return A.registerController},resetVimGlobalState_:rt,getVimGlobalState_:function(){return A},maybeInitVimState_:ge,suppressErrorLogging:!1,InsertModeKey:B,map:function(e,t,r){ke.map(e,t,r)},unmap:function(e,t){return ke.unmap(e,t)},noremap:function(e,t,r){ke.map(e,t,r,!0)},mapclear:function(e){var t=u.length,r=v,n=u.slice(0,t-r);if(u=u.slice(t-r),e)for(var o=n.length-1;o>=0;o--){var a=n[o];if(e!==a.context)if(a.context)this._mapCommand(a);else{var c=["normal","insert","visual"];for(var f in c)if(c[f]!==e){var h=Object.assign({},a);h.context=c[f],this._mapCommand(h)}}}},langmap:Jt,vimKeyFromEvent:ot,setOption:Ve,getOption:pe,defineOption:Ke,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');kr[e]=r,ke.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:oi,findKey:function(e,t,r){var n=ge(e),o=e;function a(){var g=A.macroModeState;if(g.isRecording){if(t=="q")return g.exitMacroRecordMode(),ue(o),!0;r!="mapping"&&ri(g,t)}}function c(){if(t=="<Esc>"){if(n.visualMode)Ne(o);else if(n.insertMode)He(o);else return;return ue(o),!0}}function f(){if(c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join(""),y=t.length==1,C=Ue.matchCommand(g,u,n.inputState,"insert"),k=n.inputState.changeQueue;if(C.type=="none")return ue(o),!1;if(C.type=="partial"){if(C.expectLiteralNext&&(n.expectLiteralNext=!0),Z&&window.clearTimeout(Z),Z=y&&window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer.length&&ue(o)},pe("insertModeEscKeysTimeout")),y){var m=o.listSelections();(!k||k.removed.length!=m.length)&&(k=n.inputState.changeQueue=new pn),k.inserted+=t;for(var b=0;b<m.length;b++){var M=ye(m[b].anchor,m[b].head),I=$e(m[b].anchor,m[b].head),O=o.getRange(M,o.state.overwrite?ie(I,0,1):I);k.removed[b]=(k.removed[b]||"")+O}}return!y}else C.type=="full"&&(n.inputState.keyBuffer.length=0);if(n.expectLiteralNext=!1,Z&&window.clearTimeout(Z),C.command&&k){for(var m=o.listSelections(),b=0;b<m.length;b++){var T=m[b].head;o.replaceRange(k.removed[b]||"",ie(T,0,-k.inserted.length),T,"+input")}A.macroModeState.lastInsertModeChanges.changes.pop()}return C.command||ue(o),C.command}function h(){if(a()||c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(g))return!0;var y=/^(\d*)(.*)$/.exec(g);if(!y)return ue(o),!1;var C=n.visualMode?"visual":"normal",k=y[2]||y[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==k&&(k=n.inputState.operatorShortcut);var m=Ue.matchCommand(k,u,n.inputState,C);return m.type=="none"?(ue(o),!1):m.type=="partial"?(m.expectLiteralNext&&(n.expectLiteralNext=!0),!0):m.type=="clear"?(ue(o),!0):(n.expectLiteralNext=!1,n.inputState.keyBuffer.length=0,y=/^(\d*)(.*)$/.exec(g),y&&y[1]&&y[1]!="0"&&n.inputState.pushRepeatDigit(y[1]),m.command)}var p=n.insertMode?f():h();if(p===!1)return!n.insertMode&&(t.length===1||s.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(p===!0)return function(){return!0};if(p)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof p!="object")return;p.type=="keyToKey"?We(o,p.toKeys,p):Ue.processCommand(o,n,p)}catch(g){throw o.state.vim=void 0,ge(o),R.suppressErrorLogging||console.log(g),g}return!0})}},handleEx:function(e,t){ke.processCommand(e,t)},defineMotion:mn,defineAction:Cn,defineOperator:yn,mapCommand:ei,_mapCommand:Rt,defineRegister:gn,exitVisualMode:Ne,exitInsertMode:He},J=[],Y=!1,Q;function nt(e){if(!Q)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),r=t.split("-");if(t=r.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
|
|
2
|
-
`;else if(Ye[t]){var n=Q.value||"",o={key:Ye[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};Q.onKeyDown&&Q.onKeyDown(o,Q.value,c),Q&&Q.onKeyUp&&Q.onKeyUp(o,Q.value,c);return}}if(e==`
|
|
3
|
-
`){var a=Q;Q=null,a.onClose&&a.onClose(a.value)}else Q.value=(Q.value||"")+e;function c(f){Q&&(typeof f=="string"?Q.value=f:Q=null)}}function We(e,t,r){var n=Y;if(r){if(J.indexOf(r)!=-1)return;J.push(r),Y=r.noremap!=!1}try{for(var o=ge(e),a=/<(?:[CSMA]-)*\w+>|./gi,c;c=a.exec(t);){var f=c[0],h=o.insertMode;if(Q){nt(f);continue}var p=R.handleKey(e,f,"mapping");if(!p&&h&&o.insertMode){if(f[0]=="<"){var g=f.toLowerCase().slice(1,-1),y=g.split("-");if(g=y.pop()||"",g=="lt")f="<";else if(g=="space")f=" ";else if(g=="cr")f=`
|
|
4
|
-
`;else if(Ye.hasOwnProperty(g)){f=Ye[g],Lr(e,f);continue}else f=f[0],a.lastIndex=c.index+1}e.replaceSelection(f)}}}finally{if(J.pop(),Y=J.length?n:!1,!J.length&&Q){var C=Q;Q=null,pt(e,C)}}}var it={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},ht={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},Ye={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(it)).forEach(function(e){Ye[(it[e]||"").toLowerCase()]=Ye[e.toLowerCase()]=e});function ot(e,t){var r=e.key;if(!ht[r]){r.length>1&&r[0]=="n"&&(r=r.replace("Numpad","")),r=it[r]||r;var n="";if(e.ctrlKey&&(n+="C-"),e.altKey&&(n+="A-"),e.metaKey&&(n+="M-"),s.isMac&&n=="A-"&&r.length==1&&(n=n.slice(2)),(n||r.length>1)&&e.shiftKey&&(n+="S-"),t&&!t.expectLiteralNext&&r.length==1){if(S.keymap&&r in S.keymap)(S.remapCtrl!=!1||!n)&&(r=S.keymap[r]);else if(r.charCodeAt(0)>128&&!d[r]){var o=e.code?.slice(-1)||"";e.shiftKey||(o=o.toLowerCase()),o&&(r=o,!n&&e.altKey&&(n="A-"))}}return n+=r,n.length>1&&(n="<"+n+">"),n}}function Jt(e,t){S.string!==e&&(S=Yt(e)),S.remapCtrl=t}function Yt(e){let t={};if(!e)return{keymap:t,string:""};function r(n){return n.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(n=>{if(!n)return;const o=n.split(/((?:[^\\;]|\\.)+);/);if(o.length==3){const a=r(o[1]),c=r(o[2]);if(a.length!==c.length)return;for(let f=0;f<a.length;++f)t[a[f]]=c[f]}else if(o.length==1){const a=r(n);if(a.length%2!==0)return;for(let c=0;c<a.length;c+=2)t[a[c]]=a[c+1]}}),{keymap:t,string:e}}Ke("langmap",void 0,"string",["lmap"],function(e,t){if(e===void 0)return S.string;Jt(e)});class Zt{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(t){this.operator?this.motionRepeat=this.motionRepeat.concat(t):this.prefixRepeat=this.prefixRepeat.concat(t)}getRepeat(){var t=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(t=1,this.prefixRepeat.length>0&&(t*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(t*=parseInt(this.motionRepeat.join(""),10))),t}}function ue(e,t){e.state.vim.inputState=new Zt,e.state.vim.expectLiteralNext=!1,s.signal(e,"vim-command-done",t)}function pn(){this.removed=[],this.inserted=""}class Te{constructor(t,r,n){this.clear(),this.keyBuffer=[t||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!r,this.blockwise=!!n}setText(t,r,n){this.keyBuffer=[t||""],this.linewise=!!r,this.blockwise=!!n}pushText(t,r){r&&(this.linewise||this.keyBuffer.push(`
|
|
5
|
-
`),this.linewise=!0),this.keyBuffer.push(t)}pushInsertModeChanges(t){this.insertModeChanges.push(ft(t))}pushSearchQuery(t){this.searchQueries.push(t)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join("")}}function gn(e,t){var r=A.registerController.registers;if(!e||e.length!=1)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,W.push(e)}class vn{constructor(t){this.registers=t,this.unnamedRegister=t['"']=new Te,t["."]=new Te,t[":"]=new Te,t["/"]=new Te,t["+"]=new Te}pushText(t,r,n,o,a){if(t!=="_"){o&&n.charAt(n.length-1)!==`
|
|
6
|
-
`&&(n+=`
|
|
7
|
-
`);var c=this.isValidRegister(t)?this.getRegister(t):null;if(!c||!t){switch(r){case"yank":this.registers[0]=new Te(n,o,a);break;case"delete":case"change":n.indexOf(`
|
|
8
|
-
`)==-1?this.registers["-"]=new Te(n,o):(this.shiftNumericRegisters_(),this.registers[1]=new Te(n,o));break}this.unnamedRegister.setText(n,o,a);return}var f=Ce(t);f?c.pushText(n,o):c.setText(n,o,a),t==="+"&&navigator.clipboard.writeText(n),this.unnamedRegister.setText(c.toString(),o)}}getRegister(t){return this.isValidRegister(t)?(t=t.toLowerCase(),this.registers[t]||(this.registers[t]=new Te),this.registers[t]):this.unnamedRegister}isValidRegister(t){return t&&(Je(t,W)||F.test(t))}shiftNumericRegisters_(){for(var t=9;t>=2;t--)this.registers[t]=this.getRegister(""+(t-1))}}class Xt{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(t,r){var n=this.historyBuffer,o=r?-1:1;this.initialPrefix===null&&(this.initialPrefix=t);for(var a=this.iterator+o;r?a>=0:a<n.length;a+=o)for(var c=n[a],f=0;f<=c.length;f++)if(this.initialPrefix==c.substring(0,f))return this.iterator=a,c;if(a>=n.length)return this.iterator=n.length,this.initialPrefix;if(a<0)return t}pushInput(t){var r=this.historyBuffer.indexOf(t);r>-1&&this.historyBuffer.splice(r,1),t.length&&this.historyBuffer.push(t)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var Ue={matchCommand:function(e,t,r,n){var o=kn(e,t,n,r),a=o.full[0];if(!a)return o.partial.length?{type:"partial",expectLiteralNext:o.partial.length==1&&o.partial[0].keys.slice(-11)=="<character>"}:{type:"none"};if(a.keys.slice(-11)=="<character>"||a.keys.slice(-10)=="<register>"){var c=Sn(e);if(!c||c.length>1)return{type:"clear"};r.selectedCharacter=c}return{type:"full",command:a}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r);break}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=dt(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator)if(n.operator==r.operator){n.motion="expandToLine",n.motionArgs={linewise:!0,repeat:1},this.evalInput(e,t);return}else ue(e);n.operator=r.operator,n.operatorArgs=dt(r.operatorArgs),r.keys.length>1&&(n.operatorShortcut=r.keys),r.exitVisualBlock&&(t.visualBlock=!1,Ze(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=dt(r.operatorMotionArgs);o&&n&&o.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,o=n.getRepeat(),a=!!o,c=dt(r.actionArgs)||{repeat:1};n.selectedCharacter&&(c.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),c.repeat=o||1,c.repeatIsExplicit=a,c.registerName=n.registerName,ue(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),ze[r.action](e,c,t)},processSearch:function(e,t,r){if(!e.getSearchCursor)return;var n=r.searchArgs.forward,o=r.searchArgs.wholeWordOnly;Ee(e).setReversed(!n);var a=n?"/":"?",c=Ee(e).getQuery(),f=e.getScrollInfo(),h="";function p(O,T,_){A.searchHistoryController.pushInput(O),A.searchHistoryController.reset();try{at(e,O,T,_)}catch{U(e,"Invalid regex: "+O),ue(e);return}Ue.processMotion(e,t,{keys:"",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function g(O){e.scrollTo(f.left,f.top),p(O,!0,!0);var T=A.macroModeState;T.isRecording&&ii(T,O)}function y(){return pe("pcre")?"(JavaScript regexp: set pcre)":"(Vim regexp: set nopcre)"}function C(O,T,_){var H=ot(O),oe,ee;H=="<Up>"||H=="<Down>"?(oe=H=="<Up>",ee=O.target?O.target.selectionEnd:0,T=A.searchHistoryController.nextMatch(T,oe)||"",_(T),ee&&O.target&&(O.target.selectionEnd=O.target.selectionStart=Math.min(ee,O.target.value.length))):H&&H!="<Left>"&&H!="<Right>"&&A.searchHistoryController.reset(),h=T,k()}function k(){var O;try{O=at(e,h,!0,!0)}catch{}O?e.scrollIntoView(yr(e,!n,O),30):(Xe(e),e.scrollTo(f.left,f.top))}function m(O,T,_){var H=ot(O);H=="<Esc>"||H=="<C-c>"||H=="<C-[>"||H=="<BS>"&&T==""?(A.searchHistoryController.pushInput(T),A.searchHistoryController.reset(),at(e,c?.source||""),Xe(e),e.scrollTo(f.left,f.top),s.e_stop(O),ue(e),_(),e.focus()):H=="<Up>"||H=="<Down>"?s.e_stop(O):H=="<C-u>"&&(s.e_stop(O),_(""))}switch(r.searchArgs.querySrc){case"prompt":var b=A.macroModeState;if(b.isPlaying){let T=b.replaySearchQueries.shift();p(T||"",!0,!1)}else pt(e,{onClose:g,prefix:a,desc:Re("span",{$cursor:"pointer",onmousedown:function(T){T.preventDefault(),Ve("pcre",!pe("pcre")),this.textContent=y(),k()}},y()),onKeyUp:C,onKeyDown:m});break;case"wordUnderCursor":var M=Mt(e,{noSymbol:!0}),I=!0;if(M||(M=Mt(e,{noSymbol:!1}),I=!1),!M){U(e,"No word under cursor"),ue(e);return}let O=e.getLine(M.start.line).substring(M.start.ch,M.end.ch);I&&o?O="\\b"+O+"\\b":O=xn(O),A.jumpList.cachedCursor=e.getCursor(),e.setCursor(M.start),p(O,!0,!1);break}},processEx:function(e,t,r){function n(h){A.exCommandHistoryController.pushInput(h),A.exCommandHistoryController.reset(),ke.processCommand(e,h),e.state.vim&&ue(e),Xe(e)}function o(h,p,g){var y=ot(h),C,k;(y=="<Esc>"||y=="<C-c>"||y=="<C-[>"||y=="<BS>"&&p=="")&&(A.exCommandHistoryController.pushInput(p),A.exCommandHistoryController.reset(),s.e_stop(h),ue(e),Xe(e),g(),e.focus()),y=="<Up>"||y=="<Down>"?(s.e_stop(h),C=y=="<Up>",k=h.target?h.target.selectionEnd:0,p=A.exCommandHistoryController.nextMatch(p,C)||"",g(p),k&&h.target&&(h.target.selectionEnd=h.target.selectionStart=Math.min(k,h.target.value.length))):y=="<C-u>"?(s.e_stop(h),g("")):y&&y!="<Left>"&&y!="<Right>"&&A.exCommandHistoryController.reset()}function a(h,p){var g=new s.StringStream(p),y={};try{if(ke.parseInput_(e,g,y),y.commandName!="s"){Xe(e);return}var C=ke.matchCommand_(y.commandName);if(!C||(ke.parseCommandArgs_(g,y,C),!y.argString))return;var k=mr(y.argString.slice(1),!0,!0);k&&At(e,k)}catch{}}if(r.type=="keyToEx")ke.processCommand(e,r.exArgs.input);else{var c={onClose:n,onKeyDown:o,onKeyUp:a,prefix:":"};if(t.visualMode)c.value="'<,'>",c.selectValueOnOpen=!1;else{var f=t.inputState.getRepeat();f>1&&(c.value=".,.+"+(f-1),c.selectValueOnOpen=!1)}pt(e,c)}},evalInput:function(e,t){var r=t.inputState,n=r.motion,o=r.motionArgs||{repeat:1},a=r.operator,c=r.operatorArgs||{},f=r.registerName,h=t.sel,p=G(t.visualMode?me(e,h.head):e.getCursor("head")),g=G(t.visualMode?me(e,h.anchor):e.getCursor("anchor")),y=G(p),C=G(g),k,m,b;if(a&&this.recordLastEdit(t,r),r.repeatOverride!==void 0?b=r.repeatOverride:b=r.getRepeat(),b>0&&o.explicitRepeat?o.repeatIsExplicit=!0:(o.noRepeat||!o.explicitRepeat&&b===0)&&(b=1,o.repeatIsExplicit=!1),r.selectedCharacter&&(o.selectedCharacter=c.selectedCharacter=r.selectedCharacter),o.repeat=b,ue(e),n){var M=Ie[n](e,p,o,t,r);if(t.lastMotion=Ie[n],!M)return;if(o.toJumplist){var I=A.jumpList,O=I.cachedCursor;O?(or(e,O,M),delete I.cachedCursor):or(e,p,M)}M instanceof Array?(m=M[0],k=M[1]):k=M,k||(k=G(p)),t.visualMode?(t.visualBlock&&k.ch===1/0||(k=me(e,k,y)),m&&(m=me(e,m)),m=m||C,h.anchor=m,h.head=k,Ze(e),Fe(e,t,"<",ne(m,k)?m:k),Fe(e,t,">",ne(m,k)?k:m)):a||(k=me(e,k,y),e.setCursor(k.line,k.ch))}if(a){if(c.lastSel){m=C;var T=c.lastSel,_=Math.abs(T.head.line-T.anchor.line),H=Math.abs(T.head.ch-T.anchor.ch);T.visualLine?k=new i(C.line+_,C.ch):T.visualBlock?k=new i(C.line+_,C.ch+H):T.head.line==T.anchor.line?k=new i(C.line,C.ch+H):k=new i(C.line+_,C.ch),t.visualMode=!0,t.visualLine=T.visualLine,t.visualBlock=T.visualBlock,h=t.sel={anchor:m,head:k},Ze(e)}else t.visualMode&&(c.lastSel={anchor:G(h.anchor),head:G(h.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var oe,ee,fe,j,$;if(t.visualMode){oe=ye(h.head,h.anchor),ee=$e(h.head,h.anchor),fe=t.visualLine||c.linewise,j=t.visualBlock?"block":fe?"line":"char";var we=l(e,oe,ee);if($=bt(e,{anchor:we.start,head:we.end},j),fe){var he=$.ranges;if(j=="block")for(var de=0;de<he.length;de++)he[de].head.ch=ve(e,he[de].head.line);else j=="line"&&(he[0].head=new i(he[0].head.line+1,0))}}else{if(oe=G(m||C),ee=G(k||y),ne(ee,oe)){var Qe=oe;oe=ee,ee=Qe}fe=o.linewise||c.linewise,fe?On(e,oe,ee):o.forward&&Rn(e,oe,ee),j="char";var Tt=!o.inclusive||fe,we=l(e,oe,ee);$=bt(e,{anchor:we.start,head:we.end},j,Tt)}e.setSelections($.ranges,$.primary),t.lastMotion=null,c.repeat=b,c.registerName=f,c.linewise=fe;var It=St[a](e,c,$.ranges,C,k);t.visualMode&&Ne(e,It!=null),It&&e.setCursor(It)}},recordLastEdit:function(e,t,r){var n=A.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1,n.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},Ie={moveToTopLine:function(e,t,r){var n=Et(e).top+r.repeat-1;return new i(n,Be(e.getLine(n)))},moveToMiddleLine:function(e){var t=Et(e),r=Math.floor((t.top+t.bottom)*.5);return new i(r,Be(e.getLine(r)))},moveToBottomLine:function(e,t,r){var n=Et(e).bottom-r.repeat+1;return new i(n,Be(e.getLine(n)))},expandToLine:function(e,t,r){var n=t;return new i(n.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Ee(e),o=n.getQuery();if(o){var a=!r.forward;a=n.isReversed()?!a:a,At(e,o);var c=yr(e,a,o,r.repeat);return c||U(e,"No match found "+o+(pe("pcre")?" (set nopcre to use Vim regexps)":"")),c}},findAndSelectNextInclusive:function(e,t,r,n,o){var a=Ee(e),c=a.getQuery();if(c){var f=!r.forward;f=a.isReversed()?!f:f;var h=qn(e,f,c,r.repeat,n);if(h){if(o.operator)return h;var p=h[0],g=new i(h[1].line,h[1].ch-1);if(n.visualMode){(n.visualLine||n.visualBlock)&&(n.visualLine=!1,n.visualBlock=!1,s.signal(e,"vim-mode-change",{mode:"visual",subMode:""}));var y=n.sel.anchor;if(y)return a.isReversed()?r.forward?[y,p]:[y,g]:r.forward?[y,g]:[y,p]}else n.visualMode=!0,n.visualLine=!1,n.visualBlock=!1,s.signal(e,"vim-mode-change",{mode:"visual",subMode:""});return f?[g,p]:[p,g]}}},goToMark:function(e,t,r,n){var o=gt(e,n,r.selectedCharacter||"");return o?r.linewise?{line:o.line,ch:Be(e.getLine(o.line))}:o:null},moveToOtherHighlightedEnd:function(e,t,r,n){var o=n.sel;return n.visualBlock&&r.sameLine?[me(e,new i(o.anchor.line,o.head.ch)),me(e,new i(o.head.line,o.anchor.ch))]:[o.head,o.anchor]},jumpToMark:function(e,t,r,n){for(var o=t,a=0;a<r.repeat;a++){var c=o;for(var f in n.marks)if(z(f)){var h=n.marks[f].find(),p=r.forward?ne(h,c):ne(c,h);if(!p&&!(r.linewise&&h.line==c.line)){var g=Le(c,o),y=r.forward?tr(c,h,o):tr(o,h,c);(g||y)&&(o=h)}}}return r.linewise&&(o=new i(o.line,Be(e.getLine(o.line)))),o},moveByCharacters:function(e,t,r){var n=t,o=r.repeat,a=r.forward?n.ch+o:n.ch-o;return new i(n.line,a)},moveByLines:function(e,t,r,n){var o=t,a=o.ch;switch(n.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=n.lastHPos;break;default:n.lastHPos=a}var c=r.repeat+(r.repeatOffset||0),f=r.forward?o.line+c:o.line-c,h=e.firstLine(),p=e.lastLine(),g=e.findPosV(o,r.forward?c:-c,"line",n.lastHSPos),y=r.forward?g.line>f:g.line<f;return y&&(f=g.line,a=g.ch),f<h&&o.line==h?this.moveToStartOfLine(e,t,r,n):f>p&&o.line==p?cr(e,t,r,n,!0):(r.toFirstChar&&(a=Be(e.getLine(f)),n.lastHPos=a),n.lastHSPos=e.charCoords(new i(f,a),"div").left,new i(f,a))},moveByDisplayLines:function(e,t,r,n){var o=t;switch(n.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:n.lastHSPos=e.charCoords(o,"div").left}for(var a=Math.round(r.repeat),c=0;c<a;c++){var f=e.findPosV(o,r.forward?1:-1,"line",n.lastHSPos);if(f.hitSide)break;o=f}return o!=t&&(n.lastHPos=o.ch),o},moveByPage:function(e,t,r){var n=t,o=r.repeat;return e.findPosV(n,r.forward?o:-o,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return ur(e,t,r.repeat,n).start},moveBySentence:function(e,t,r){var n=r.forward?1:-1;return _n(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),a=null,c=r.repeat;c||(c=o.clientHeight/(2*e.defaultTextHeight()));var f=e.charCoords(t,"local");if(r.repeat=c,a=Ie.moveByDisplayLines(e,t,r,n),!a)return null;var h=e.charCoords(a,"local");return e.scrollTo(null,o.top+h.top-f.top),a},moveByWords:function(e,t,r){return Bn(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,o=Lt(e,n,r.forward,r.selectedCharacter,t),a=r.forward?-1:1;return ar(a,r),o?(o.ch+=a,o):null},moveToCharacter:function(e,t,r){var n=r.repeat;return ar(0,r),Lt(e,n,r.forward,r.selectedCharacter,t)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return r.selectedCharacter&&Nn(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var o=r.repeat;return n.lastHPos=o-1,n.lastHSPos=e.charCoords(t,"div").left,Pn(e,o)},moveToEol:function(e,t,r,n){return cr(e,t,r,n,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return new i(r.line,Be(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){for(var r=t,n=r.line,o=r.ch,a=e.getLine(n),c;o<a.length;o++)if(c=a.charAt(o),c&&le(c)){var f=e.getTokenTypeAt(new i(n,o+1));if(f!=="string"&&f!=="comment")break}if(o<a.length){var h=c==="<"||c===">"?/[(){}[\]<>]/:/[(){}[\]]/,p=e.findMatchingBracket(new i(n,o),{bracketRegex:h});return p.to}else return r},moveToStartOfLine:function(e,t){return new i(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var n=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(n=r.repeat-e.getOption("firstLineNumber")),new i(n,Be(e.getLine(n)))},moveToStartOfDisplayLine:function(e){return e.execCommand("goLineLeft"),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand("goLineRight");var t=e.getCursor();return t.sticky=="before"&&t.ch--,t},textObjectManipulation:function(e,t,r,n){var o={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},a={"'":!0,'"':!0,"`":!0},c=r.selectedCharacter||"";c=="b"?c="(":c=="B"&&(c="{");var f=!r.textObjectInner,h,p;if(o[c]){if(p=!0,h=hr(e,t,c,f),!h){var g=e.getSearchCursor(new RegExp("\\"+c,"g"),t);g.find()&&(h=hr(e,g.from(),c,f))}}else if(a[c])p=!0,h=Kn(e,t,c,f);else if(c==="W"||c==="w")for(var y=r.repeat||1;y-- >0;){var C=Mt(e,{inclusive:f,innerWord:!f,bigWord:c==="W",noSymbol:c==="W",multiline:!0},h&&h.end);C&&(h||(h=C),h.end=C.end)}else if(c==="p")if(h=ur(e,t,r.repeat,0,f),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var k=n.inputState.operatorArgs;k&&(k.linewise=!0),h.end.line--}else if(c==="t")h=Tn(e,t,f);else if(c==="s"){var m=e.getLine(t.line);t.ch>0&&_e(m[t.ch])&&(t.ch-=1);var b=fr(e,t,r.repeat,1,f),M=fr(e,t,r.repeat,-1,f);ae(e.getLine(M.line)[M.ch])&&ae(e.getLine(b.line)[b.ch-1])&&(M={line:M.line,ch:M.ch+1}),h={start:M,end:b}}return h?e.state.vim.visualMode?An(e,h.start,h.end,p):[h.start,h.end]:null},repeatLastCharacterSearch:function(e,t,r){var n=A.lastCharacterSearch,o=r.repeat,a=r.forward===n.forward,c=(n.increment?1:0)*(a?-1:1);r.inclusive=!!a;var f=Lt(e,o,a,n.selectedCharacter,ie(t,0,-c));return f?(f.ch+=c,f):t}};function mn(e,t){Ie[e]=t}function Gt(e,t){for(var r=[],n=0;n<t;n++)r.push(e);return r}var St={change:function(e,t,r){var n,o,a=e.state.vim,c=r[0].anchor,f=r[0].head;if(a.visualMode)if(t.fullLine)f.ch=Number.MAX_VALUE,f.line--,e.setSelection(c,f),o=e.getSelection(),e.replaceSelection(""),n=c;else{o=e.getSelection();var g=Gt("",r.length);e.replaceSelections(g),n=ye(r[0].head,r[0].anchor)}else{o=e.getRange(c,f);var h=a.lastEditInputState;if(h?.motion=="moveByWords"&&!ae(o)){var p=/\s+$/.exec(o);p&&h.motionArgs&&h.motionArgs.forward&&(f=ie(f,0,-p[0].length),o=o.slice(0,-p[0].length))}t.linewise&&(c=new i(c.line,Be(e.getLine(c.line))),f.line>c.line&&(f=new i(f.line-1,Number.MAX_VALUE))),e.replaceRange("",c,f),n=c}A.registerController.pushText(t.registerName,"change",o,t.linewise,r.length>1),ze.enterInsertMode(e,{head:n},e.state.vim)},delete:function(e,t,r){var n,o,a=e.state.vim;if(a.visualBlock){o=e.getSelection();var h=Gt("",r.length);e.replaceSelections(h),n=ye(r[0].head,r[0].anchor)}else{var c=r[0].anchor,f=r[0].head;t.linewise&&f.line!=e.firstLine()&&c.line==e.lastLine()&&c.line==f.line-1&&(c.line==e.firstLine()?c.ch=0:c=new i(c.line-1,ve(e,c.line-1))),o=e.getRange(c,f),e.replaceRange("",c,f),n=c,t.linewise&&(n=Ie.moveToFirstNonWhiteSpaceCharacter(e,c))}return A.registerController.pushText(t.registerName,"delete",o,t.linewise,a.visualBlock),me(e,n)},indent:function(e,t,r){var n=e.state.vim,o=n.visualMode&&t.repeat||1;if(n.visualBlock){for(var a=e.getOption("tabSize"),c=e.getOption("indentWithTabs")?" ":" ".repeat(a),f,h=r.length-1;h>=0;h--)if(f=ye(r[h].anchor,r[h].head),t.indentRight)e.replaceRange(c.repeat(o),f,f);else{for(var p=e.getLine(f.line),g=0,y=0;y<o;y++){var C=p[f.ch+g];if(C==" ")g++;else if(C==" "){g++;for(var k=1;k<c.length&&(C=p[f.ch+g],C===" ");k++)g++}else break}e.replaceRange("",f,ie(f,0,g))}return f}else if(e.indentMore)for(var y=0;y<o;y++)t.indentRight?e.indentMore():e.indentLess();else{var m=r[0].anchor.line,b=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line;t.linewise&&b--;for(var h=m;h<=b;h++)for(var y=0;y<o;y++)e.indentLine(h,t.indentRight)}return Ie.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},indentAuto:function(e,t,r){return e.execCommand("indentAuto"),Ie.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},hardWrap:function(e,t,r,n){if(e.hardWrap){var o=r[0].anchor.line,a=r[0].head.line;t.linewise&&a--;var c=e.hardWrap({from:o,to:a});return c>o&&t.linewise&&c--,t.keepCursor?n:new i(c,0)}},toggleComment:function(e,t,r,n,o){return e.execCommand("toggleLineComment"),o},changeCase:function(e,t,r,n,o){for(var a=e.getSelections(),c=[],f=t.toLower,h=0;h<a.length;h++){var p=a[h],g="";if(f===!0)g=p.toLowerCase();else if(f===!1)g=p.toUpperCase();else for(var y=0;y<p.length;y++){var C=p.charAt(y);g+=Ce(C)?C.toLowerCase():C.toUpperCase()}c.push(g)}return e.replaceSelections(c),t.shouldMoveCursor?o:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?Ie.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:ye(r[0].anchor,r[0].head)},yank:function(e,t,r,n){var o=e.state.vim,a=e.getSelection(),c=o.visualMode?ye(o.sel.anchor,o.sel.head,r[0].head,r[0].anchor):n;A.registerController.pushText(t.registerName,"yank",a,t.linewise,o.visualBlock);var f=Math.abs(e.getCursor("end").line-e.getCursor("start").line)||1;return U(e,f+" lines yanked"+(t.registerName?' into "'+t.registerName:""),!1,1500),c},rot13:function(e,t,r,n,o){for(var a=e.getSelections(),c=[],f=0;f<a.length;f++){const h=a[f].split("").map(p=>{const g=p.charCodeAt(0);return g>=65&&g<=90?String.fromCharCode(65+(g-65+13)%26):g>=97&&g<=122?String.fromCharCode(97+(g-97+13)%26):p}).join("");c.push(h)}return e.replaceSelections(c),t.shouldMoveCursor?o:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?Ie.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:ye(r[0].anchor,r[0].head)}};function yn(e,t){St[e]=t}var ze={jumpListWalk:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,o=t.forward,a=A.jumpList,c=a.move(e,o?n:-n),f=c?c.find():void 0;f=f||e.getCursor(),e.setCursor(f)}},scroll:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,o=e.defaultTextHeight(),a=e.getScrollInfo().top,c=o*n,f=t.forward?a+c:a-c,h=G(e.getCursor()),p=e.charCoords(h,"local");if(t.forward)f>p.top?(h.line+=(f-p.top)/o,h.line=Math.ceil(h.line),e.setCursor(h),p=e.charCoords(h,"local"),e.scrollTo(null,p.top)):e.scrollTo(null,f);else{var g=f+e.getScrollInfo().clientHeight;g<p.bottom?(h.line-=(p.bottom-g)/o,h.line=Math.floor(h.line),e.setCursor(h),p=e.charCoords(h,"local"),e.scrollTo(null,p.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,f)}}},scrollToCursor:function(e,t){var r=e.getCursor().line,n=e.charCoords(new i(r,0),"local"),o=e.getScrollInfo().clientHeight,a=n.top;switch(t.position){case"center":a=n.bottom-o/2;break;case"bottom":var c=new i(r,e.getLine(r).length-1),f=e.charCoords(c,"local"),h=f.bottom-a;a=a-o+h;break}e.scrollTo(null,a)},replayMacro:function(e,t,r){var n=t.selectedCharacter||"",o=t.repeat||1,a=A.macroModeState;for(n=="@"?n=a.latestRegister||"":a.latestRegister=n;o--;)ti(e,r,a,n)},enterMacroRecordMode:function(e,t){var r=A.macroModeState,n=t.selectedCharacter;A.registerController.isValidRegister(n)&&r.enterMacroRecordMode(e,n)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),s.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),s.signal(e,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(e,t,r){if(!e.getOption("readOnly")){r.insertMode=!0,r.insertModeRepeat=t&&t.repeat||1;var n=t?t.insertAt:null,o=r.sel,a=t.head||e.getCursor("head"),c=e.listSelections().length;if(n=="eol")a=new i(a.line,ve(e,a.line));else if(n=="bol")a=new i(a.line,0);else if(n=="charAfter"){var f=l(e,a,ie(a,0,1));a=f.end}else if(n=="firstNonBlank"){var f=l(e,a,Ie.moveToFirstNonWhiteSpaceCharacter(e,a));a=f.end}else if(n=="startOfSelectedArea"){if(!r.visualMode)return;r.visualBlock?(a=new i(Math.min(o.head.line,o.anchor.line),Math.min(o.head.ch,o.anchor.ch)),c=Math.abs(o.head.line-o.anchor.line)+1):o.head.line<o.anchor.line?a=o.head:a=new i(o.anchor.line,0)}else if(n=="endOfSelectedArea"){if(!r.visualMode)return;r.visualBlock?(a=new i(Math.min(o.head.line,o.anchor.line),Math.max(o.head.ch,o.anchor.ch)+1),c=Math.abs(o.head.line-o.anchor.line)+1):o.head.line>=o.anchor.line?a=ie(o.head,0,1):a=new i(o.anchor.line,0)}else if(n=="inplace"){if(r.visualMode)return}else n=="lastEdit"&&(a=Cr(e)||a);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),s.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),s.signal(e,"vim-mode-change",{mode:"insert"})),A.macroModeState.isPlaying||(e.on("change",wr),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=e.setBookmark(a,{insertLeft:!0}),s.on(e.getInputField(),"keydown",br)),r.visualMode&&Ne(e),nr(e,a,c)}},toggleVisualMode:function(e,t,r){var n=t.repeat,o=e.getCursor(),a;if(r.visualMode)r.visualLine!=!!t.linewise||r.visualBlock!=!!t.blockwise?(r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,s.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Ze(e)):Ne(e);else{r.visualMode=!0,r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,a=me(e,new i(o.line,o.ch+n-1));var c=l(e,o,a);r.sel={anchor:c.start,head:c.end},s.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Ze(e),Fe(e,r,"<",ye(o,a)),Fe(e,r,">",$e(o,a))}},reselectLastSelection:function(e,t,r){var n=r.lastSelection;if(r.visualMode&&ir(e,r),n){var o=n.anchorMark.find(),a=n.headMark.find();if(!o||!a)return;r.sel={anchor:o,head:a},r.visualMode=!0,r.visualLine=n.visualLine,r.visualBlock=n.visualBlock,Ze(e),Fe(e,r,"<",ye(o,a)),Fe(e,r,">",$e(o,a)),s.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var n,o;if(r.visualMode){if(n=e.getCursor("anchor"),o=e.getCursor("head"),ne(o,n)){var a=o;o=n,n=a}o.ch=ve(e,o.line)-1}else{var c=Math.max(t.repeat,2);n=e.getCursor(),o=me(e,new i(n.line+c-1,1/0))}for(var f=0,h=n.line;h<o.line;h++){f=ve(e,n.line);var p="",g=0;if(!t.keepSpaces){var y=e.getLine(n.line+1);g=y.search(/\S/),g==-1?g=y.length:p=" "}e.replaceRange(p,new i(n.line,f),new i(n.line+1,g))}var C=me(e,new i(n.line,f));r.visualMode&&Ne(e,!1),e.setCursor(C)},newLineAndEnterInsertMode:function(e,t,r){r.insertMode=!0;var n=G(e.getCursor());if(n.line===e.firstLine()&&!t.after)e.replaceRange(`
|
|
9
|
-
`,new i(e.firstLine(),0)),e.setCursor(e.firstLine(),0);else{n.line=t.after?n.line:n.line-1,n.ch=ve(e,n.line),e.setCursor(n);var o=s.commands.newlineAndIndentContinueComment||s.commands.newlineAndIndent;o(e)}this.enterInsertMode(e,{repeat:t.repeat},r)},paste:function(e,t,r){var n=A.registerController.getRegister(t.registerName);if(t.registerName==="+")navigator.clipboard.readText().then(a=>{this.continuePaste(e,t,r,a,n)});else{var o=n.toString();this.continuePaste(e,t,r,o,n)}},continuePaste:function(e,t,r,n,o){var a=G(e.getCursor());if(n){if(t.matchIndent){var c=e.getOption("tabSize"),f=function(he){var de=he.split(" ").length-1,Qe=he.split(" ").length-1;return de*c+Qe*1},h=e.getLine(e.getCursor().line),p=f(h.match(/^\s*/)[0]),g=n.replace(/\n$/,""),y=n!==g,C=f(n.match(/^\s*/)[0]),n=g.replace(/^\s*/gm,function(he){var de=p+(f(he)-C);if(de<0)return"";if(e.getOption("indentWithTabs")){var Qe=Math.floor(de/c);return Array(Qe+1).join(" ")}else return Array(de+1).join(" ")});n+=y?`
|
|
10
|
-
`:""}t.repeat>1&&(n=Array(t.repeat+1).join(n));var k=t.linewise==null?o.linewise:t.linewise,m=o.blockwise,b=m?n.split(`
|
|
11
|
-
`):void 0;if(b){k&&b.pop();for(var M=0;M<b.length;M++)b[M]=b[M]==""?" ":b[M];a.ch+=t.after?1:0,a.ch=Math.min(ve(e,a.line),a.ch)}else k?r.visualMode?n=r.visualLine?n.slice(0,-1):`
|
|
12
|
-
`+n.slice(0,n.length-1)+`
|
|
13
|
-
`:t.after?(n=`
|
|
14
|
-
`+n.slice(0,n.length-1),a.ch=ve(e,a.line)):a.ch=0:a.ch+=t.after?1:0;var I;if(r.visualMode){r.lastPastedText=n;var O,T=Ln(e),_=T[0],H=T[1],oe=e.getSelection(),ee=e.listSelections(),fe=new Array(ee.length).join("1").split("1");r.lastSelection&&(O=r.lastSelection.headMark.find()),A.registerController.unnamedRegister.setText(oe),m?(e.replaceSelections(fe),H=new i(_.line+n.length-1,_.ch),e.setCursor(_),rr(e,H),e.replaceSelections(n),I=_):r.visualBlock?(e.replaceSelections(fe),e.setCursor(_),e.replaceRange(n,_,_),I=_):(e.replaceRange(n,_,H),I=e.posFromIndex(e.indexFromPos(_)+n.length-1)),O&&(r.lastSelection.headMark=e.setBookmark(O)),k&&(I.ch=0)}else if(m&&b){e.setCursor(a);for(var M=0;M<b.length;M++){var j=a.line+M;j>e.lastLine()&&e.replaceRange(`
|
|
15
|
-
`,new i(j,0));var $=ve(e,j);$<a.ch&&bn(e,j,a.ch)}e.setCursor(a),rr(e,new i(a.line+b.length-1,a.ch)),e.replaceSelections(b),I=a}else if(e.replaceRange(n,a),k){var j=t.after?a.line+1:a.line;I=new i(j,Be(e.getLine(j)))}else I=G(a),/\n/.test(n)||(I.ch+=n.length-(t.after?1:0));r.visualMode&&Ne(e,!1),e.setCursor(I)}},undo:function(e,t){e.operation(function(){er(e,s.commands.undo,t.repeat)(),e.setCursor(me(e,e.getCursor("start")))})},redo:function(e,t){er(e,s.commands.redo,t.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},insertRegister:function(e,t,r){var n=t.selectedCharacter,o=A.registerController.getRegister(n),a=o&&o.toString();a&&e.replaceSelection(a)},oneNormalCommand:function(e,t,r){He(e,!0),r.insertModeReturn=!0,s.on(e,"vim-command-done",function n(){r.visualMode||(r.insertModeReturn&&(r.insertModeReturn=!1,r.insertMode||ze.enterInsertMode(e,{},r)),s.off(e,"vim-command-done",n))})},setMark:function(e,t,r){var n=t.selectedCharacter;n&&Fe(e,r,n,e.getCursor())},replace:function(e,t,r){var n=t.selectedCharacter||"",o=e.getCursor(),a,c,f=e.listSelections();if(r.visualMode)o=e.getCursor("start"),c=e.getCursor("end");else{var h=e.getLine(o.line);a=o.ch+t.repeat,a>h.length&&(a=h.length),c=new i(o.line,a)}var p=l(e,o,c);if(o=p.start,c=p.end,n==`
|
|
16
|
-
`)r.visualMode||e.replaceRange("",o,c),(s.commands.newlineAndIndentContinueComment||s.commands.newlineAndIndent)(e);else{var g=e.getRange(o,c);if(g=g.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n),g=g.replace(/[^\n]/g,n),r.visualBlock){var y=new Array(e.getOption("tabSize")+1).join(" ");g=e.getSelection(),g=g.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n);var C=g.replace(/\t/g,y).replace(/[^\n]/g,n).split(`
|
|
17
|
-
`);e.replaceSelections(C)}else e.replaceRange(g,o,c);r.visualMode?(o=ne(f[0].anchor,f[0].head)?f[0].anchor:f[0].head,e.setCursor(o),Ne(e,!1)):e.setCursor(ie(c,0,-1))}},incrementNumberToken:function(e,t){for(var r=e.getCursor(),n=e.getLine(r.line),o=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,a,c,f,h;(a=o.exec(n))!==null&&(c=a.index,f=c+a[0].length,!(r.ch<f)););if(!(!t.backtrack&&f<=r.ch)){if(a){var p=a[2]||a[4],g=a[3]||a[5],y=t.increase?1:-1,C={"0b":2,0:8,"":10,"0x":16}[p.toLowerCase()],k=parseInt(a[1]+g,C)+y*t.repeat;h=k.toString(C);var m=p?new Array(g.length-h.length+1+a[1].length).join("0"):"";h.charAt(0)==="-"?h="-"+p+m+h.substr(1):h=p+m+h;var b=new i(r.line,c),M=new i(r.line,f);e.replaceRange(h,b,M)}else return;e.setCursor(new i(r.line,c+h.length-1))}},repeatLastEdit:function(e,t,r){var n=r.lastEditInputState;if(n){var o=t.repeat;o&&t.repeatIsExplicit?n.repeatOverride=o:o=n.repeatOverride||o,Mr(e,r,o,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:function(e,t){He(e)}};function Cn(e,t){ze[e]=t}function me(e,t,r){var n=e.state.vim,o=n.insertMode||n.visualMode,a=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),c=e.getLine(a),f=c.length-1+ +!!o,h=Math.min(Math.max(0,t.ch),f),p=c.charCodeAt(h);if(56320<=p&&p<=57343){var g=1;r&&r.line==a&&r.ch>h&&(g=-1),h+=g,h>f&&(h-=2)}return new i(a,h)}function dt(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}function ie(e,t,r){return typeof t=="object"&&(r=t.ch,t=t.line),new i(e.line+t,e.ch+r)}function kn(e,t,r,n){n.operator&&(r="operatorPending");for(var o,a=[],c=[],f=Y?t.length-v:0,h=f;h<t.length;h++){var p=t[h];r=="insert"&&p.context!="insert"||p.context&&p.context!=r||n.operator&&p.type=="action"||!(o=wn(e,p.keys))||(o=="partial"&&a.push(p),o=="full"&&c.push(p))}return{partial:a,full:c}}function wn(e,t){const r=t.slice(-11)=="<character>",n=t.slice(-10)=="<register>";if(r||n){var o=t.length-(r?11:10),a=e.slice(0,o),c=t.slice(0,o);return a==c&&e.length>o?"full":c.indexOf(a)==0?"partial":!1}else return e==t?"full":t.indexOf(e)==0?"partial":!1}function Sn(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"<CR>":case"<S-CR>":r=`
|
|
18
|
-
`;break;case"<Space>":case"<S-Space>":r=" ";break;default:r="";break}return r}function er(e,t,r){return function(){for(var n=0;n<r;n++)t(e)}}function G(e){return new i(e.line,e.ch)}function Le(e,t){return e.ch==t.ch&&e.line==t.line}function ne(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function ye(e,t){return arguments.length>2&&(t=ye.apply(void 0,Array.prototype.slice.call(arguments,1))),ne(e,t)?e:t}function $e(e,t){return arguments.length>2&&(t=$e.apply(void 0,Array.prototype.slice.call(arguments,1))),ne(e,t)?t:e}function tr(e,t,r){var n=ne(e,t),o=ne(t,r);return n&&o}function ve(e,t){return e.getLine(t).length}function xt(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function xn(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function bn(e,t,r){var n=ve(e,t),o=new Array(r-n+1).join(" ");e.setCursor(new i(t,n)),e.replaceRange(o,e.getCursor())}function rr(e,t){var r=[],n=e.listSelections(),o=G(e.clipPos(t)),a=!Le(t,o),c=e.getCursor("head"),f=Mn(n,c),h=Le(n[f].head,n[f].anchor),p=n.length-1,g=p-f>f?p:0,y=n[g].anchor,C=Math.min(y.line,o.line),k=Math.max(y.line,o.line),m=y.ch,b=o.ch,M=n[g].head.ch-m,I=b-m;M>0&&I<=0?(m++,a||b--):M<0&&I>=0?(m--,h||b++):M<0&&I==-1&&(m--,b++);for(var O=C;O<=k;O++){var T={anchor:new i(O,m),head:new i(O,b)};r.push(T)}return e.setSelections(r),t.ch=b,y.ch=m,y}function nr(e,t,r){for(var n=[],o=0;o<r;o++){var a=ie(t,o,0);n.push({anchor:a,head:a})}e.setSelections(n,0)}function Mn(e,t,r){for(var n=0;n<e.length;n++){var o=Le(e[n].anchor,t),a=Le(e[n].head,t);if(o||a)return n}return-1}function Ln(e,t){var r=e.listSelections(),n=r[0],o=r[r.length-1],a=ne(n.anchor,n.head)?n.anchor:n.head,c=ne(o.anchor,o.head)?o.head:o.anchor;return[a,c]}function ir(e,t){var r=t.sel.anchor,n=t.sel.head;t.lastPastedText&&(n=e.posFromIndex(e.indexFromPos(r)+t.lastPastedText.length),t.lastPastedText=void 0),t.lastSelection={anchorMark:e.setBookmark(r),headMark:e.setBookmark(n),anchor:G(r),head:G(n),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function An(e,t,r,n){var o=e.state.vim.sel,a=n?t:o.head,c=n?t:o.anchor,f;return ne(r,t)&&(f=r,r=t,t=f),ne(a,c)?(a=ye(t,a),c=$e(c,r)):(c=ye(t,c),a=$e(a,r),a=ie(a,0,-1),a.ch==-1&&a.line!=e.firstLine()&&(a=new i(a.line-1,ve(e,a.line-1)))),[c,a]}function Ze(e,t,r){var n=e.state.vim;t=t||n.sel,r||(r=n.visualLine?"line":n.visualBlock?"block":"char");var o=bt(e,t,r);e.setSelections(o.ranges,o.primary)}function bt(e,t,r,n){var o=G(t.head),a=G(t.anchor);if(r=="char"){var c=!n&&!ne(t.head,t.anchor)?1:0,f=ne(t.head,t.anchor)?1:0;return o=ie(t.head,0,c),a=ie(t.anchor,0,f),{ranges:[{anchor:a,head:o}],primary:0}}else if(r=="line"){if(ne(t.head,t.anchor))o.ch=0,a.ch=ve(e,a.line);else{a.ch=0;var h=e.lastLine();o.line>h&&(o.line=h),o.ch=ve(e,o.line)}return{ranges:[{anchor:a,head:o}],primary:0}}else if(r=="block"){var p=Math.min(a.line,o.line),g=a.ch,y=Math.max(a.line,o.line),C=o.ch;g<C?C+=1:g+=1;for(var k=y-p+1,m=o.line==p?0:k-1,b=[],M=0;M<k;M++)b.push({anchor:new i(p+M,g),head:new i(p+M,C)});return{ranges:b,primary:m}}throw"never happens"}function En(e){var t=e.getCursor("head");return e.getSelection().length==1&&(t=ye(t,e.getCursor("anchor"))),t}function Ne(e,t){var r=e.state.vim;t!==!1&&e.setCursor(me(e,r.sel.head)),ir(e,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,r.insertMode||s.signal(e,"vim-mode-change",{mode:"normal"})}function Rn(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var o=n.split(`
|
|
19
|
-
`);o.pop();for(var a=o.pop();o.length>0&&a&&ae(a);a=o.pop())r.line--,r.ch=0;a?(r.line--,r.ch=ve(e,r.line)):r.ch=0}}function On(e,t,r){t.ch=0,r.ch=0,r.line++}function Be(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function Mt(e,{inclusive:t,innerWord:r,bigWord:n,noSymbol:o,multiline:a},c){var f=c||En(e),h=e.getLine(f.line),p=h,g=f.line,y=g,C=f.ch,k,m=o?P[0]:D[0];if(r&&/\s/.test(h.charAt(C)))m=function(_){return/\s/.test(_)};else{for(;!m(h.charAt(C));)if(C++,C>=h.length){if(!a)return null;C--,k=lr(e,f,!0,n,!0);break}n?m=D[0]:(m=P[0],m(h.charAt(C))||(m=P[1]))}for(var b=C,M=C;m(h.charAt(M))&&M>=0;)M--;if(M++,k)b=k.to,y=k.line,p=e.getLine(y),!p&&b==0&&b++;else for(;m(h.charAt(b))&&b<h.length;)b++;if(t){var I=b,O=f.ch<=M&&/\s/.test(h.charAt(f.ch));if(!O)for(;/\s/.test(p.charAt(b))&&b<p.length;)b++;if(I==b||O){for(var T=M;/\s/.test(h.charAt(M-1))&&M>0;)M--;!M&&!O&&(M=T)}}return{start:new i(g,M),end:new i(y,b)}}function Tn(e,t,r){var n=t;if(!s.findMatchingTag||!s.findEnclosingTag)return{start:n,end:n};var o=s.findMatchingTag(e,t)||s.findEnclosingTag(e,t);return!o||!o.open||!o.close?{start:n,end:n}:r?{start:o.open.from,end:o.close.to}:{start:o.open.to,end:o.close.from}}function or(e,t,r){Le(t,r)||A.jumpList.add(e,t,r)}function ar(e,t){A.lastCharacterSearch.increment=e,A.lastCharacterSearch.forward=t.forward,A.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var In={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},sr={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh==="*"&&e.nextCh==="/";return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb==="m"?"{":"}",e.reverseSymb=e.symb==="{"?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh==="#"){var t=e.lineText.match(/^#(\w+)/)?.[1];if(t==="endif"){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t==="if"){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t==="else"&&e.depth===0)return!0}return!1}}};function Nn(e,t,r,n){var o=G(e.getCursor()),a=r?1:-1,c=r?e.lineCount():-1,f=o.ch,h=o.line,p=e.getLine(h),g={lineText:p,nextCh:p.charAt(f),lastCh:null,index:f,symb:n,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[n],forward:r,depth:0,curMoveThrough:!1},y=In[n];if(!y)return o;var C=sr[y].init,k=sr[y].isComplete;for(C&&C(g);h!==c&&t;){if(g.index+=a,g.nextCh=g.lineText.charAt(g.index),!g.nextCh){if(h+=a,g.lineText=e.getLine(h)||"",a>0)g.index=0;else{var m=g.lineText.length;g.index=m>0?m-1:0}g.nextCh=g.lineText.charAt(g.index)}k(g)&&(o.line=h,o.ch=g.index,t--)}return g.nextCh||g.curMoveThrough?new i(h,g.index):o}function lr(e,t,r,n,o){var a=t.line,c=t.ch,f=e.getLine(a),h=r?1:-1,p=n?D:P;if(o&&f==""){if(a+=h,f=e.getLine(a),!re(e,a))return null;c=r?0:f.length}for(;;){if(o&&f=="")return{from:0,to:0,line:a};for(var g=h>0?f.length:-1,y=g,C=g;c!=g;){for(var k=!1,m=0;m<p.length&&!k;++m)if(p[m](f.charAt(c))){for(y=c;c!=g&&p[m](f.charAt(c));)c+=h;if(C=c,k=y!=C,y==t.ch&&a==t.line&&C==y+h)continue;return{from:Math.min(y,C+1),to:Math.max(y,C),line:a}}k||(c+=h)}if(a+=h,!re(e,a))return null;f=e.getLine(a),c=h>0?0:f.length}}function Bn(e,t,r,n,o,a){var c=G(t),f=[];(n&&!o||!n&&o)&&r++;for(var h=!(n&&o),p=0;p<r;p++){var g=lr(e,t,n,a,h);if(!g){var y=ve(e,e.lastLine());f.push(n?{line:e.lastLine(),from:y,to:y}:{line:0,from:0,to:0});break}f.push(g),t=new i(g.line,n?g.to-1:g.from)}var C=f.length!=r,k=f[0],m=f.pop();return n&&!o?(!C&&(k.from!=c.ch||k.line!=c.line)&&(m=f.pop()),m&&new i(m.line,m.from)):n&&o?m&&new i(m.line,m.to-1):!n&&o?(!C&&(k.to!=c.ch||k.line!=c.line)&&(m=f.pop()),m&&new i(m.line,m.to)):m&&new i(m.line,m.from)}function cr(e,t,r,n,o){var a=t,c=new i(a.line+r.repeat-1,1/0),f=e.clipPos(c);return f.ch--,o||(n.lastHPos=1/0,n.lastHSPos=e.charCoords(f,"div").left),c}function Lt(e,t,r,n,o){if(n){for(var a=o||e.getCursor(),c=a.ch,f,h=0;h<t;h++){var p=e.getLine(a.line);if(f=Dn(c,p,n,r),f==-1)return;c=f}if(f!=null)return new i(e.getCursor().line,f)}}function Pn(e,t){var r=e.getCursor().line;return me(e,new i(r,t-1))}function Fe(e,t,r,n){!Je(r,K)&&!F.test(r)||(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function Dn(e,t,r,n,o){var a;return n?a=t.indexOf(r,e+1):a=t.lastIndexOf(r,e-1),a}function ur(e,t,r,n,o){var a=t.line,c=e.firstLine(),f=e.lastLine(),h,p,g=a;function y(M){return!e.getLine(M)}function C(M,I,O){return O?y(M)!=y(M+I):!y(M)&&y(M+I)}if(n){for(;c<=g&&g<=f&&r>0;)C(g,n)&&r--,g+=n;return{start:new i(g,0),end:t}}var k=e.state.vim;if(k.visualLine&&C(a,1,!0)){var m=k.sel.anchor;C(m.line,-1,!0)&&(!o||m.line!=a)&&(a+=1)}var b=y(a);for(g=a;g<=f&&r;g++)C(g,1,!0)&&(!o||y(g)!=b)&&r--;for(p=new i(g,0),g>f&&!b?b=!0:o=!1,g=a;g>c&&!((!o||y(g)==b||g==a)&&C(g,-1,!0));g--);return h=new i(g,0),{start:h,end:p}}function fr(e,t,r,n,o){function a(p){p.line!==null&&(p.pos+p.dir<0||p.pos+p.dir>=p.line.length?p.line=null:p.pos+=p.dir)}function c(p,g,y,C){var k=p.getLine(g),m={line:k,ln:g,pos:y,dir:C};if(m.line==="")return{ln:m.ln,pos:m.pos};var b=m.pos;for(a(m);m.line!==null;){if(b=m.pos,_e(m.line[m.pos]))if(o){for(a(m);m.line!==null&&ae(m.line[m.pos]);)b=m.pos,a(m);return{ln:m.ln,pos:b+1}}else return{ln:m.ln,pos:m.pos+1};a(m)}return{ln:m.ln,pos:b+1}}function f(p,g,y,C){var k=p.getLine(g),m={line:k,ln:g,pos:y,dir:C};if(m.line==="")return{ln:m.ln,pos:m.pos};var b=m.pos;for(a(m);m.line!==null;){if(!ae(m.line[m.pos])&&!_e(m.line[m.pos]))b=m.pos;else if(_e(m.line[m.pos]))return o?ae(m.line[m.pos+1])?{ln:m.ln,pos:m.pos+1}:{ln:m.ln,pos:b}:{ln:m.ln,pos:b};a(m)}return m.line=k,o&&ae(m.line[m.pos])?{ln:m.ln,pos:m.pos}:{ln:m.ln,pos:b}}for(var h={ln:t.line,pos:t.ch};r>0;)n<0?h=f(e,h.ln,h.pos,n):h=c(e,h.ln,h.pos,n),r--;return new i(h.ln,h.pos)}function _n(e,t,r,n){function o(h,p){if(p.line!==null)if(p.pos+p.dir<0||p.pos+p.dir>=p.line.length){if(p.ln+=p.dir,!re(h,p.ln)){p.line=null;return}p.line=h.getLine(p.ln),p.pos=p.dir>0?0:p.line.length-1}else p.pos+=p.dir}function a(h,p,g,y){var M=h.getLine(p),C=M==="",k={line:M,ln:p,pos:g,dir:y},m={ln:k.ln,pos:k.pos},b=k.line==="";for(o(h,k);k.line!==null;){if(m.ln=k.ln,m.pos=k.pos,k.line===""&&!b)return{ln:k.ln,pos:k.pos};if(C&&k.line!==""&&!ae(k.line[k.pos]))return{ln:k.ln,pos:k.pos};_e(k.line[k.pos])&&!C&&(k.pos===k.line.length-1||ae(k.line[k.pos+1]))&&(C=!0),o(h,k)}var M=h.getLine(m.ln);m.pos=0;for(var I=M.length-1;I>=0;--I)if(!ae(M[I])){m.pos=I;break}return m}function c(h,p,g,y){var M=h.getLine(p),C={line:M,ln:p,pos:g,dir:y},k=C.ln,m=null,b=C.line==="";for(o(h,C);C.line!==null;){if(C.line===""&&!b)return m!==null?{ln:k,pos:m}:{ln:C.ln,pos:C.pos};if(_e(C.line[C.pos])&&m!==null&&!(C.ln===k&&C.pos+1===m))return{ln:k,pos:m};C.line!==""&&!ae(C.line[C.pos])&&(b=!1,k=C.ln,m=C.pos),o(h,C)}var M=h.getLine(k);m=0;for(var I=0;I<M.length;++I)if(!ae(M[I])){m=I;break}return{ln:k,pos:m}}for(var f={ln:t.line,pos:t.ch};r>0;)n<0?f=c(e,f.ln,f.pos,n):f=a(e,f.ln,f.pos,n),r--;return new i(f.ln,f.pos)}function hr(e,t,r,n){var o=t,a={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],f=e.getLine(o.line).charAt(o.ch),h=f===c?1:0,p=e.scanForBracket(new i(o.line,o.ch+h),-1,void 0,{bracketRegex:a}),g=e.scanForBracket(new i(o.line,o.ch+h),1,void 0,{bracketRegex:a});if(!p||!g)return null;var y=p.pos,C=g.pos;if(y.line==C.line&&y.ch>C.ch||y.line>C.line){var k=y;y=C,C=k}return n?C.ch+=1:y.ch+=1,{start:y,end:C}}function Kn(e,t,r,n){var o=G(t),a=e.getLine(o.line),c=a.split(""),f,h,p,g,y=c.indexOf(r);if(o.ch<y)o.ch=y;else if(y<o.ch&&c[o.ch]==r){var C=/string/.test(e.getTokenTypeAt(ie(t,0,1))),k=/string/.test(e.getTokenTypeAt(t)),m=C&&!k;m||(h=o.ch,--o.ch)}if(c[o.ch]==r&&!h)f=o.ch+1;else for(p=o.ch;p>-1&&!f;p--)c[p]==r&&(f=p+1);if(f&&!h)for(p=f,g=c.length;p<g&&!h;p++)c[p]==r&&(h=p);return!f||!h?{start:o,end:o}:(n&&(--f,++h),{start:new i(o.line,f),end:new i(o.line,h)})}Ke("pcre",!0,"boolean");class Fn{constructor(){this.highlightTimeout}getQuery(){return A.query}setQuery(t){A.query=t}getOverlay(){return this.searchOverlay}setOverlay(t){this.searchOverlay=t}isReversed(){return A.isReversed}setReversed(t){A.isReversed=t}getScrollbarAnnotate(){return this.annotate}setScrollbarAnnotate(t){this.annotate=t}}function Ee(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Fn)}function $n(e){return dr(e,"/")}function Hn(e){return pr(e,"/")}function dr(e,t){var r=pr(e,t)||[];if(!r.length)return[];var n=[];if(r[0]===0){for(var o=0;o<r.length;o++)typeof r[o]=="number"&&n.push(e.substring(r[o]+1,r[o+1]));return n}}function pr(e,t){t||(t="/");for(var r=!1,n=[],o=0;o<e.length;o++){var a=e.charAt(o);!r&&a==t&&n.push(o),r=!r&&a=="\\"}return n}function Vn(e){var t={V:"|(){+?*.[$^",M:"|(){+?*.[",m:"|(){+?",v:"<>"},r={">":"(?<=[\\w])(?=[^\\w]|$)","<":"(?<=[^\\w]|^)(?=[\\w])"},n=t.m,o=e.replace(/\\.|[\[|(){+*?.$^<>]/g,function(c){if(c[0]==="\\"){var f=c[1];return f==="}"||n.indexOf(f)!=-1?f:f in t?(n=t[f],""):f in r?r[f]:c}else return n.indexOf(c)!=-1?r[c]||"\\"+c:c}),a=o.indexOf("\\zs");return a!=-1&&(o="(?<="+o.slice(0,a)+")"+o.slice(a+3)),a=o.indexOf("\\ze"),a!=-1&&(o=o.slice(0,a)+"(?="+o.slice(a+3)+")"),o}var gr={"\\n":`
|
|
20
|
-
`,"\\r":"\r","\\t":" "};function jn(e){for(var t=!1,r=[],n=-1;n<e.length;n++){var o=e.charAt(n)||"",a=e.charAt(n+1)||"";gr[o+a]?(r.push(gr[o+a]),n++):t?(r.push(o),t=!1):o==="\\"?(t=!0,ce(a)||a==="$"?r.push("$"):a!=="/"&&a!=="\\"&&r.push("\\")):(o==="$"&&r.push("$"),r.push(o),a==="/"&&r.push("\\"))}return r.join("")}var vr={"\\/":"/","\\\\":"\\","\\n":`
|
|
21
|
-
`,"\\r":"\r","\\t":" ","\\&":"&"};function Wn(e){for(var t=new s.StringStream(e),r=[];!t.eol();){for(;t.peek()&&t.peek()!="\\";)r.push(t.next());var n=!1;for(var o in vr)if(t.match(o,!0)){n=!0,r.push(vr[o]);break}n||r.push(t.next())}return r.join("")}function mr(e,t,r){var n=A.registerController.getRegister("/");n.setText(e);var o=Hn(e),a,c;if(!o.length)a=e;else{a=e.substring(0,o[0]);var f=e.substring(o[0]);c=f.indexOf("i")!=-1}if(!a)return null;pe("pcre")||(a=Vn(a)),r&&(t=/^[^A-Z]*$/.test(a));var h=new RegExp(a,t||c?"im":"m");return h}function Re(e){typeof e=="string"&&(e=document.createElement(e));for(var t=1;t<arguments.length;t++){var r=arguments[t];if(r)if(typeof r!="object"&&(r=document.createTextNode(r)),r.nodeType)e.appendChild(r);else for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(n[0]==="$"?e.style[n.slice(1)]=r[n]:typeof r[n]=="function"?e[n]=r[n]:e.setAttribute(n,r[n]))}return e}function U(e,t,r,n){var o=Re("div",{$color:"red",$whiteSpace:"pre",class:"cm-vim-message"},t);e.openNotification?r?(o=Re("div",{},o,Re("div",{},"Press ENTER or type command to continue")),e.state.closeVimNotification&&e.state.closeVimNotification(),e.state.closeVimNotification=e.openNotification(o,{bottom:!0,duration:0})):e.openNotification(o,{bottom:!0,duration:n||15e3}):n||alert(o.innerText)}function Un(e,t){return Re("div",{$display:"flex",$flex:1},Re("span",{$fontFamily:"monospace",$whiteSpace:"pre",$flex:1,$display:"flex"},e,Re("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false",$flex:1})),t&&Re("span",{$color:"#888"},t))}function pt(e,t){if(J.length){t.value||(t.value=""),Q=t;return}var r=Un(t.prefix,t.desc);if(e.openDialog)e.openDialog(r,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var n="";typeof t.prefix!="string"&&t.prefix&&(n+=t.prefix.textContent),t.desc&&(n+=" "+t.desc),t.onClose?.(prompt(n,""))}}function zn(e,t){return e instanceof RegExp&&t instanceof RegExp?e.flags==t.flags&&e.source==t.source:!1}function at(e,t,r,n){if(t){var o=Ee(e),a=mr(t,!!r,!!n);if(a)return At(e,a),zn(a,o.getQuery())||o.setQuery(a),a}}function Qn(e){if(e.source.charAt(0)=="^")var t=!0;return{token:function(r){if(t&&!r.sol()){r.skipToEnd();return}var n=r.match(e,!1);if(n)return n[0].length==0?(r.next(),"searching"):!r.sol()&&(r.backUp(1),!e.exec(r.next()+n[0]))?(r.next(),null):(r.match(e),"searching");for(;!r.eol()&&(r.next(),!r.match(e,!1)););},query:e}}var st=0;function At(e,t){clearTimeout(st);var r=Ee(e);r.highlightTimeout=st,st=setTimeout(function(){if(e.state.vim){var n=Ee(e);n.highlightTimeout=void 0;var o=n.getOverlay();(!o||t!=o.query)&&(o&&e.removeOverlay(o),o=Qn(t),e.addOverlay(o),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(o))}},50)}function yr(e,t,r,n){return e.operation(function(){n===void 0&&(n=1);for(var o=e.getCursor(),a=e.getSearchCursor(r,o),c=0;c<n;c++){var f=a.find(t);if(c==0&&f&&Le(a.from(),o)){var h=t?a.from():a.to();f=a.find(t),f&&!f[0]&&Le(a.from(),h)&&e.getLine(h.line).length==h.ch&&(f=a.find(t))}if(!f&&(a=e.getSearchCursor(r,t?new i(e.lastLine()):new i(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function qn(e,t,r,n,o){return e.operation(function(){n===void 0&&(n=1);var a=e.getCursor(),c=e.getSearchCursor(r,a),f=c.find(!t);!o.visualMode&&f&&Le(c.from(),a)&&c.find(!t);for(var h=0;h<n;h++)if(f=c.find(t),!f&&(c=e.getSearchCursor(r,t?new i(e.lastLine()):new i(e.firstLine(),0)),!c.find(t)))return;var p=c.from(),g=c.to();return p&&g&&[p,g]})}function Xe(e){var t=Ee(e);t.highlightTimeout&&(clearTimeout(t.highlightTimeout),t.highlightTimeout=void 0),e.removeOverlay(Ee(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function Jn(e,t,r){return typeof e!="number"&&(e=e.line),t instanceof Array?Je(e,t):typeof r=="number"?e>=t&&e<=r:e==t}function Et(e){var t=e.getScrollInfo(),r=6,n=10,o=e.coordsChar({left:0,top:r+t.top},"local"),a=t.clientHeight-n+t.top,c=e.coordsChar({left:0,top:a},"local");return{top:o.line,bottom:c.line}}function gt(e,t,r){if(r=="'"||r=="`")return A.jumpList.find(e,-1)||new i(0,0);if(r==".")return Cr(e);var n=t.marks[r];return n&&n.find()}function Cr(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,r=t.length;r--;)if(t[r].changes)return G(t[r].changes[0].to)}class Yn{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(t,r,n){var o=this;t.operation(function(){t.curOp&&(t.curOp.isVimOp=!0),o._processCommand(t,r,n)})}_processCommand(t,r,n){var o=t.state.vim,a=A.registerController.getRegister(":"),c=a.toString(),f=new s.StringStream(r);a.setText(r);var h=n||{};h.input=r;try{this.parseInput_(t,f,h)}catch(y){U(t,y+"");return}o.visualMode&&Ne(t);var p,g;if(!h.commandName)h.line!==void 0&&(g="move");else if(p=this.matchCommand_(h.commandName),p){if(g=p.name,p.excludeFromCommandHistory&&a.setText(c),this.parseCommandArgs_(f,h,p),p.type=="exToKey"){We(t,p.toKeys||"",p);return}else if(p.type=="exToEx"){this.processCommand(t,p.toInput||"");return}}if(!g){U(t,'Not an editor command ":'+r+'"');return}try{kr[g](t,h),(!p||!p.possiblyAsync)&&h.callback&&h.callback()}catch(y){throw U(t,y+""),y}}parseInput_(t,r,n){if(r.eatWhile(":"),r.eat("%"))n.line=t.firstLine(),n.lineEnd=t.lastLine();else if(r.eat("*")){var o=t.state.vim.lastSelection,a=o?.anchorMark.find()?.line||0,c=o?.headMark.find()?.line||0;n.line=Math.max(a,c),n.lineEnd=Math.min(a,c)}else n.line=this.parseLineSpec_(t,r),n.line!==void 0&&r.eat(",")&&(n.lineEnd=this.parseLineSpec_(t,r));n.line==null?t.state.vim.visualMode?(n.selectionLine=gt(t,t.state.vim,"<")?.line,n.selectionLineEnd=gt(t,t.state.vim,">")?.line):n.selectionLine=t.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd),r.eatSpace();var f=r.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return f?n.commandName=f[1]:n.commandName=(r.match(/.*/)||[""])[0],n}parseLineSpec_(t,r){var n=r.match(/^([\d]+)/);if(n)return this.parseLineSpecOffset_(t,r,parseInt(n[1],10)-1);switch(r.next()){case".":return this.parseLineSpecOffset_(t,r,t.getCursor().line);case"$":return this.parseLineSpecOffset_(t,r,t.lastLine());case"'":var o=r.next()||"",a=gt(t,t.state.vim,o);if(!a)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,r,a.line);case"-":case"+":case"/":case"?":return r.backUp(1),this.parseLineSpecOffset_(t,r,t.getCursor().line);default:r.backUp(1);return}}parseLineSpecOffset_(t,r,n){for(;;){var o=r.match(/^([\/\?]|\\[\?\/])|([+-]?)(\d*)/);if(!o||!o[0])break;if(o[1]){var a="",c=!o[1].endsWith("?");if(o[1].length==1){var f=r.match(c?/^([^\/\\]|\\\/)*/:/^([^\/\?]|\\\?)*/);r.match(c?/^\/?/:/^\??/),a=f&&f[0]}a||(a=A.registerController.getRegister("/")?.toString()||"");var h=new RegExp(a),p=t.getSearchCursor(h,new i(n+(c?1:0),0));c?p.findNext():p.findPrevious();var g=p.from();if(!g)throw new Error("Pattern not found"+h);n=g.line}else{var y=parseInt(o[2]+(o[3]||"1"),10);n+=y}}return n}parseCommandArgs_(t,r,n){if(!t.eol()){r.argString=t.match(/.*/)?.[0];var o=n.argDelimiter||/\s+/,a=xt(r.argString||"").split(o);a.length&&a[0]&&(r.args=a)}}matchCommand_(t){for(var r=t.length;r>0;r--){var n=t.substring(0,r);if(this.commandMap_[n]){var o=this.commandMap_[n];if(o.name.indexOf(t)===0)return o}}}buildCommandMap_(){this.commandMap_={};for(var t=0;t<w.length;t++){var r=w[t],n=r.shortName||r.name;this.commandMap_[n]=r}}map(t,r,n,o){if(t!=":"&&t.charAt(0)==":"){if(n)throw Error("Mode not supported for ex mappings");var a=t.substring(1);r!=":"&&r.charAt(0)==":"?this.commandMap_[a]={name:a,type:"exToEx",toInput:r.substring(1),user:!0}:this.commandMap_[a]={name:a,type:"exToKey",toKeys:r,user:!0}}else{var c={keys:t,type:"keyToKey",toKeys:r,noremap:!!o};n&&(c.context=n),Rt(c)}}unmap(t,r){if(t!=":"&&t.charAt(0)==":"){if(r)throw Error("Mode not supported for ex mappings");var n=t.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return delete this.commandMap_[n],!0}else for(var o=t,a=0;a<u.length;a++)if(o==u[a].keys&&u[a].context===r)return u.splice(a,1),Gn(o),!0}}var kr={colorscheme:function(e,t){if(!t.args||t.args.length<1){U(e,e.getOption("theme"));return}e.setOption("theme",t.args[0])},map:function(e,t,r,n){var o=t.args;if(!o||o.length<2){e&&U(e,"Invalid mapping: "+t.input);return}ke.map(o[0],o[1],r,n)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},omap:function(e,t){this.map(e,t,"operatorPending")},noremap:function(e,t){this.map(e,t,void 0,!0)},inoremap:function(e,t){this.map(e,t,"insert",!0)},nnoremap:function(e,t){this.map(e,t,"normal",!0)},vnoremap:function(e,t){this.map(e,t,"visual",!0)},onoremap:function(e,t){this.map(e,t,"operatorPending",!0)},unmap:function(e,t,r){var n=t.args;(!n||n.length<1||!ke.unmap(n[0],r))&&e&&U(e,"No such mapping: "+t.input)},mapclear:function(e,t){R.mapclear()},imapclear:function(e,t){R.mapclear("insert")},nmapclear:function(e,t){R.mapclear("normal")},vmapclear:function(e,t){R.mapclear("visual")},omapclear:function(e,t){R.mapclear("operatorPending")},move:function(e,t){Ue.processCommand(e,e.state.vim,{keys:"",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var r=t.args,n=t.setCfg||{};if(!r||r.length<1){e&&U(e,"Invalid mapping: "+t.input);return}var o=r[0].split("="),a=o.shift()||"",c=o.length>0?o.join("="):void 0,f=!1,h=!1;if(a.charAt(a.length-1)=="?"){if(c)throw Error("Trailing characters: "+t.argString);a=a.substring(0,a.length-1),f=!0}else a.charAt(a.length-1)=="!"&&(a=a.substring(0,a.length-1),h=!0);c===void 0&&a.substring(0,2)=="no"&&(a=a.substring(2),c=!1);var p=Me[a]&&Me[a].type=="boolean";if(p&&(h?c=!pe(a,e,n):c==null&&(c=!0)),!p&&c===void 0||f){var g=pe(a,e,n);g instanceof Error?U(e,g.message):g===!0||g===!1?U(e," "+(g?"":"no")+a):U(e," "+a+"="+g)}else{var y=Ve(a,c,e,n);y instanceof Error&&U(e,y.message)}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var r=t.args,n=A.registerController.registers,o=`----------Registers----------
|
|
22
|
-
|
|
23
|
-
`;if(r)for(var f=r.join(""),h=0;h<f.length;h++){var a=f.charAt(h);if(A.registerController.isValidRegister(a)){var p=n[a]||new Te;o+='"'+a+" "+p.toString()+`
|
|
24
|
-
`}}else for(var a in n){var c=n[a].toString();c.length&&(o+='"'+a+" "+c+`
|
|
25
|
-
`)}U(e,o,!0)},marks:function(e,t){var r=t.args,n=e.state.vim.marks,o=`-----------Marks-----------
|
|
26
|
-
mark line col
|
|
27
|
-
|
|
28
|
-
`;if(r)for(var f=r.join(""),h=0;h<f.length;h++){var a=f.charAt(h),c=n[a]&&n[a].find();c&&(o+=a+" "+c.line+" "+c.ch+`
|
|
29
|
-
`)}else for(var a in n){var c=n[a]&&n[a].find();c&&(o+=a+" "+c.line+" "+c.ch+`
|
|
30
|
-
`)}U(e,o,!0)},sort:function(e,t){var r,n,o,a,c,f;function h(){if(t.argString){var j=new s.StringStream(t.argString);if(j.eat("!")&&(r=!0),j.eol())return;if(!j.eatSpace())return"Invalid arguments";var $=j.match(/([dinuoxr]+)?\s*(\/.+\/)?\s*/);if(!$||!j.eol())return"Invalid arguments";if($[1]){f=$[1].indexOf("r")!=-1,n=$[1].indexOf("i")!=-1,o=$[1].indexOf("u")!=-1;var we=$[1].indexOf("d")!=-1||$[1].indexOf("n")!=-1,he=$[1].indexOf("x")!=-1,de=$[1].indexOf("o")!=-1;if(Number(we)+Number(he)+Number(de)>1)return"Invalid arguments";a=we&&"decimal"||he&&"hex"||de&&"octal"}$[2]&&(c=new RegExp($[2].substr(1,$[2].length-2),n?"i":""))}}var p=h();if(p){U(e,p+": "+t.argString);return}var g=t.line||e.firstLine(),y=t.lineEnd||t.line||e.lastLine();if(g==y)return;var C=new i(g,0),k=new i(y,ve(e,y)),m=e.getRange(C,k).split(`
|
|
31
|
-
`),b=a=="decimal"?/(-?)([\d]+)/:a=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:a=="octal"?/([0-7]+)/:null,M=a=="decimal"?10:a=="hex"?16:a=="octal"?8:void 0,I=[],O=[];if(a||c)for(var T=0;T<m.length;T++){var _=c?m[T].match(c):null;_&&_.index!=null&&!f&&(_[0]=m[T].slice(_.index+_[0].length)),_&&_[0]!=""?I.push(_):b&&b.exec(m[T])?I.push(m[T]):O.push(m[T])}else O=m;function H(j,$){if(r){var we;we=j,j=$,$=we}n&&(j=j.toLowerCase(),$=$.toLowerCase());var he=b&&b.exec(j),de=b&&b.exec($);if(!he||!de)return j<$?-1:1;var Qe=parseInt((he[1]+he[2]).toLowerCase(),M),Tt=parseInt((de[1]+de[2]).toLowerCase(),M);return Qe-Tt}function oe(j,$){if(r){var we;we=j,j=$,$=we}return n&&(j[0]=j[0].toLowerCase(),$[0]=$[0].toLowerCase()),j[0]<$[0]?-1:1}if(I.sort(c?oe:H),c)for(var T=0;T<I.length;T++)I[T]=I[T].input;else a||O.sort(H);if(m=r?I.concat(O):O.concat(I),o){var ee=m,fe;m=[];for(var T=0;T<ee.length;T++)ee[T]!=fe&&m.push(ee[T]),fe=ee[T]}e.replaceRange(m.join(`
|
|
32
|
-
`),C,k)},vglobal:function(e,t){this.global(e,t)},normal:function(e,t){var r=!1,n=t.argString;if(n&&n[0]=="!"&&(n=n.slice(1),r=!0),n=n.trimStart(),!n){U(e,"Argument is required.");return}var o=t.line;if(typeof o=="number")for(var a=isNaN(t.lineEnd)?o:t.lineEnd,c=o;c<=a;c++)e.setCursor(c,0),We(e,t.argString.trimStart(),{noremap:r}),e.state.vim.insertMode&&He(e,!0);else We(e,t.argString.trimStart(),{noremap:r}),e.state.vim.insertMode&&He(e,!0)},global:function(e,t){var r=t.argString;if(!r){U(e,"Regular Expression missing from global");return}var n=t.commandName[0]==="v";r[0]==="!"&&t.commandName[0]==="g"&&(n=!0,r=r.slice(1));var o=t.line!==void 0?t.line:e.firstLine(),a=t.lineEnd||t.line||e.lastLine(),c=$n(r),f=r,h="";if(c&&c.length&&(f=c[0],h=c.slice(1,c.length).join("/")),f)try{at(e,f,!0,!0)}catch{U(e,"Invalid regex: "+f);return}for(var p=Ee(e).getQuery(),g=[],y=o;y<=a;y++){var C=e.getLine(y),k=p.test(C);k!==n&&g.push(h?e.getLineHandle(y):C)}if(!h){U(e,g.join(`
|
|
33
|
-
`));return}var m=0,b=function(){if(m<g.length){var M=g[m++],I=e.getLineNumber(M);if(I==null){b();return}var O=I+1+h;ke.processCommand(e,O,{callback:b})}else e.releaseLineHandles&&e.releaseLineHandles()};b()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var r=t.argString,n=r?dr(r,r[0]):[],o="",a="",c,f,h,p=!1,g=!1;if(n&&n.length)o=n[0],pe("pcre")&&o!==""&&(o=new RegExp(o).source),a=n[1],a!==void 0&&(pe("pcre")?a=Wn(a.replace(/([^\\])&/g,"$1$$&")):a=jn(a),A.lastSubstituteReplacePart=a),c=n[2]?n[2].split(" "):[];else if(r&&r.length){U(e,"Substitutions should be of the form :s/pattern/replace/");return}if(c&&(f=c[0],h=parseInt(c[1]),f&&(f.indexOf("c")!=-1&&(p=!0),f.indexOf("g")!=-1&&(g=!0),pe("pcre")?o=o+"/"+f:o=o.replace(/\//g,"\\/")+"/"+f)),o)try{at(e,o,!0,!0)}catch{U(e,"Invalid regex: "+o);return}if(a=a||A.lastSubstituteReplacePart,a===void 0){U(e,"No previous substitute regular expression");return}var y=Ee(e),C=y.getQuery(),k=t.line!==void 0?t.line:e.getCursor().line,m=t.lineEnd||k;k==e.firstLine()&&m==e.lastLine()&&(m=1/0),h&&(k=m,m=k+h-1);var b=me(e,new i(k,0)),M=e.getSearchCursor(C,b);Zn(e,p,g,k,m,M,C,a,t.callback)},startinsert:function(e,t){We(e,t.argString=="!"?"A":"i",{})},redo:s.commands.redo,undo:s.commands.undo,write:function(e){s.commands.save?s.commands.save(e):e.save&&e.save()},nohlsearch:function(e){Xe(e)},yank:function(e,t){var r=t.selectionLine,n=isNaN(t.selectionLineEnd)?r:t.selectionLineEnd;if(n<r){var o=n;n=r,r=o}var a=e.getRange(new i(r,0),new i(n+1,0)),c=t.args&&t.args[0]?t.args[0]:"0";A.registerController.pushText(c,"yank",a,!0,!1),U(e,n+1-r+" lines yanked"+(c?' into "'+c:""),!1,1500)},put:function(e,t,r){var n={after:!0,isEdit:!0,matchIndent:!!r,repeat:1,lineWise:!0,registerName:""},o=t.args||[];o[0]=="!"&&(n.after=!1,o.shift()),o[0]&&(n.registerName=o[0]);var a=t.selectionLine;a!=null&&e.setCursor(new i(a,0)),ze.paste(e,n,e.state.vim)},iput:function(e,t){this.put(e,t,!0)},delete:function(e,t){var r=t.selectionLine,n=isNaN(t.selectionLineEnd)?r:t.selectionLineEnd;St.delete(e,{linewise:!0},[{anchor:new i(r,0),head:new i(n+1,0)}])},join:function(e,t){var r=t.selectionLine,n=isNaN(t.selectionLineEnd)?r:t.selectionLineEnd;e.setCursor(new i(r,0)),ze.joinLines(e,{repeat:n-r},e.state.vim)},delmarks:function(e,t){if(!t.argString||!xt(t.argString)){U(e,"Argument required");return}for(var r=e.state.vim,n=new s.StringStream(xt(t.argString));!n.eol();){n.eatSpace();var o=n.pos;if(!n.match(/[a-zA-Z]/,!1)){U(e,"Invalid argument: "+t.argString.substring(o));return}var a=n.next();if(n.match("-",!0)){if(!n.match(/[a-zA-Z]/,!1)){U(e,"Invalid argument: "+t.argString.substring(o));return}var c=a,f=n.next();if(c&&f&&z(c)==z(f)){var h=c.charCodeAt(0),p=f.charCodeAt(0);if(h>=p){U(e,"Invalid argument: "+t.argString.substring(o));return}for(var g=0;g<=p-h;g++){var y=String.fromCharCode(h+g);delete r.marks[y]}}else{U(e,"Invalid argument: "+c+"-");return}}else a&&delete r.marks[a]}}},ke=new Yn;R.defineEx("version","ve",e=>{U(e,"Codemirror-vim version: <DEV>")});function Zn(e,t,r,n,o,a,c,f,h){e.state.vim.exMode=!0;var p=!1,g=0,y,C,k;function m(){e.operation(function(){for(;!p;)b(),I();O()})}function b(){var _="",H=a.match||a.pos&&a.pos.match;if(H)_=f.replace(/\$(\d{1,3}|[$&])/g,function(fe,j){if(j=="$")return"$";if(j=="&")return H[0];for(var $=j;parseInt($)>=H.length&&$.length>0;)$=$.slice(0,$.length-1);return $?H[$]+j.slice($.length,j.length):fe});else{var oe=e.getRange(a.from(),a.to());_=oe.replace(c,f)}var ee=a.to().line;a.replace(_),C=a.to().line,o+=C-ee,k=C<ee}function M(){var _=y&&G(a.to()),H=a.findNext();return H&&!H[0]&&_&&Le(a.from(),_)&&(H=a.findNext()),H&&g++,H}function I(){for(;M()&&Jn(a.from(),n,o);)if(!(!r&&a.from().line==C&&!k)){e.scrollIntoView(a.from(),30),e.setSelection(a.from(),a.to()),y=a.from(),p=!1;return}p=!0}function O(_){if(_&&_(),e.focus(),y){e.setCursor(y);var H=e.state.vim;H.exMode=!1,H.lastHPos=H.lastHSPos=y.ch}h?h():p&&U(e,(g?"Found "+g+" matches":"No matches found")+" for pattern: "+c+(pe("pcre")?" (set nopcre to use Vim regexps)":""))}function T(_,H,oe){s.e_stop(_);var ee=ot(_);switch(ee){case"y":b(),I();break;case"n":I();break;case"a":var fe=h;h=void 0,e.operation(m),h=fe;break;case"l":b();case"q":case"<Esc>":case"<C-c>":case"<C-[>":O(oe);break}return p&&O(oe),!0}if(I(),p){U(e,"No matches for "+c+(pe("pcre")?" (set nopcre to use vim regexps)":""));return}if(!t){m(),h&&h();return}pt(e,{prefix:Re("span","replace with ",Re("strong",f)," (y/n/a/q/l)"),onKeyDown:T})}function He(e,t){var r=e.state.vim,n=A.macroModeState,o=A.registerController.getRegister("."),a=n.isPlaying,c=n.lastInsertModeChanges;a||(e.off("change",wr),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,s.off(e.getInputField(),"keydown",br)),!a&&r.insertModeRepeat&&r.insertModeRepeat>1&&(Mr(e,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t||e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),o.setText(c.changes.join("")),s.signal(e,"vim-mode-change",{mode:"normal"}),n.isRecording&&ni(n)}function Rt(e){u.unshift(e),e.keys&&Xn(e.keys)}function Xn(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(t){t&&(d[t]||(d[t]=0),d[t]++)})}function Gn(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(t){d[t]&&d[t]--})}function ei(e,t,r,n,o){var a={keys:e,type:t};a[t]=r,a[t+"Args"]=n;for(var c in o)a[c]=o[c];Rt(a)}Ke("insertModeEscKeysTimeout",200,"number");function ti(e,t,r,n){var o=A.registerController.getRegister(n);if(n==":"){o.keyBuffer[0]&&ke.processCommand(e,o.keyBuffer[0]),r.isPlaying=!1;return}var a=o.keyBuffer,c=0;r.isPlaying=!0,r.replaySearchQueries=o.searchQueries.slice(0);for(var f=0;f<a.length;f++)for(var h=a[f],p,g,y=/<(?:[CSMA]-)*\w+>|./gi;p=y.exec(h);)if(g=p[0],R.handleKey(e,g,"macro"),t.insertMode){var C=o.insertModeChanges[c++].changes;A.macroModeState.lastInsertModeChanges.changes=C,Ar(e,C,1),He(e)}r.isPlaying=!1}function ri(e,t){if(!e.isPlaying){var r=e.latestRegister,n=A.registerController.getRegister(r);n&&n.pushText(t)}}function ni(e){if(!e.isPlaying){var t=e.latestRegister,r=A.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function ii(e,t){if(!e.isPlaying){var r=e.latestRegister,n=A.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function wr(e,t){var r=A.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(var o=e.state.vim;t;){if(n.expectCursorActivityForChange=!0,n.ignoreCount>1)n.ignoreCount--;else if(t.origin=="+input"||t.origin=="paste"||t.origin===void 0){var a=e.listSelections().length;a>1&&(n.ignoreCount=a);var c=t.text.join(`
|
|
34
|
-
`);if(n.maybeReset&&(n.changes=[],n.maybeReset=!1),c)if(e.state.overwrite&&!/\n/.test(c))n.changes.push([c]);else{if(c.length>1){var f=o&&o.insertEnd&&o.insertEnd.find(),h=e.getCursor();if(f&&f.line==h.line){var p=f.ch-h.ch;p>0&&p<c.length&&(n.changes.push([c,p]),c="")}}c&&n.changes.push(c)}}t=t.next}}function Sr(e){var t=e.state.vim;if(t.insertMode){var r=A.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:(n.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||xr(e,t)}function xr(e,t){var r=e.getCursor("anchor"),n=e.getCursor("head");if(t.visualMode&&!e.somethingSelected()?Ne(e,!1):!t.visualMode&&!t.insertMode&&e.somethingSelected()&&(t.visualMode=!0,t.visualLine=!1,s.signal(e,"vim-mode-change",{mode:"visual"})),t.visualMode){var o=ne(n,r)?0:-1,a=ne(n,r)?-1:0;n=ie(n,0,o),r=ie(r,0,a),t.sel={anchor:r,head:n},Fe(e,t,"<",ye(n,r)),Fe(e,t,">",$e(n,r))}else t.insertMode||(t.lastHPos=e.getCursor().ch)}function br(e){var t=A.macroModeState,r=t.lastInsertModeChanges,n=s.keyName?s.keyName(e):e.key;n&&(n.indexOf("Delete")!=-1||n.indexOf("Backspace")!=-1)&&(r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new B(n,e)))}function Mr(e,t,r,n){var o=A.macroModeState;o.isPlaying=!0;var a=t.lastEditActionCommand,c=t.inputState;function f(){a?Ue.processAction(e,t,a):Ue.evalInput(e,t)}function h(g){if(o.lastInsertModeChanges.changes.length>0){g=t.lastEditActionCommand?g:1;var y=o.lastInsertModeChanges;Ar(e,y.changes,g)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var p=0;p<r;p++)f(),h(1);else n||f(),h(r);t.inputState=c,t.insertMode&&!n&&He(e),o.isPlaying=!1}function Lr(e,t){s.lookupKey(t,"vim-insert",function(n){return typeof n=="string"?s.commands[n](e):n(e),!0})}function Ar(e,t,r){var n=e.getCursor("head"),o=A.macroModeState.lastInsertModeChanges.visualBlock;o&&(nr(e,n,o+1),r=e.listSelections().length,e.setCursor(n));for(var a=0;a<r;a++){o&&e.setCursor(ie(n,a,0));for(var c=0;c<t.length;c++){var f=t[c];if(f instanceof B)Lr(e,f.keyName);else if(typeof f=="string")e.replaceSelection(f);else{var h=e.getCursor(),p=ie(h,0,f[0].length-(f[1]||0));e.replaceRange(f[0],h,f[1]?h:p),e.setCursor(p)}}}o&&e.setCursor(ie(n,0,1))}function Ot(e){var t=new e.constructor;return Object.keys(e).forEach(function(r){if(r!="insertEnd"){var n=e[r];Array.isArray(n)?n=n.slice():n&&typeof n=="object"&&n.constructor!=Object&&(n=Ot(n)),t[r]=n}}),e.sel&&(t.sel={head:e.sel.head&&G(e.sel.head),anchor:e.sel.anchor&&G(e.sel.anchor)}),t}function oi(e,t,r){var a=ge(e),n=e,o=!1,a=R.maybeInitVimState_(n),c=a.visualBlock||a.wasInVisualBlock;if(n.state.closeVimNotification){var f=n.state.closeVimNotification;if(n.state.closeVimNotification=null,f(),t=="<CR>")return ue(n),!0}var h=n.isInMultiSelectMode();if(a.wasInVisualBlock&&!h?a.wasInVisualBlock=!1:h&&a.visualBlock&&(a.wasInVisualBlock=!0),t=="<Esc>"&&!a.insertMode&&!a.visualMode&&h&&a.status=="<Esc>")ue(n);else if(c||!h||n.inVirtualSelectionMode)o=R.handleKey(n,t,r);else{var p=Ot(a),g=a.inputState.changeQueueList||[];n.operation(function(){n.curOp&&(n.curOp.isVimOp=!0);var y=0;n.forEachSelection(function(){n.state.vim.inputState.changeQueue=g[y];var C=n.getCursor("head"),k=n.getCursor("anchor"),m=ne(C,k)?0:-1,b=ne(C,k)?-1:0;C=ie(C,0,m),k=ie(k,0,b),n.state.vim.sel.head=C,n.state.vim.sel.anchor=k,o=R.handleKey(n,t,r),n.virtualSelection&&(g[y]=n.state.vim.inputState.changeQueue,n.state.vim=Ot(p)),y++}),n.curOp?.cursorActivity&&!o&&(n.curOp.cursorActivity=!1),n.state.vim=a,a.inputState.changeQueueList=g,a.inputState.changeQueue=null},!0)}return o&&!a.visualMode&&!a.insertMode&&a.visualMode!=n.somethingSelected()&&xr(n,a),o}return rt(),R}function Se(s,i){var l=i.ch,u=i.line+1;u<1&&(u=1,l=0),u>s.lines&&(u=s.lines,l=Number.MAX_VALUE);var d=s.line(u);return Math.min(d.from+Math.max(0,l),d.to)}function Ae(s,i){let l=s.lineAt(i);return{line:l.number-1,ch:i-l.from}}class De{constructor(i,l){this.line=i,this.ch=l}}function Xr(s,i,l){if(s.addEventListener)s.addEventListener(i,l,!1);else{var u=s._handlers||(s._handlers={});u[i]=(u[i]||[]).concat(l)}}function Gr(s,i,l){if(s.removeEventListener)s.removeEventListener(i,l,!1);else{var u=s._handlers,d=u&&u[i];if(d){var v=d.indexOf(l);v>-1&&(u[i]=d.slice(0,v).concat(d.slice(v+1)))}}}function en(s,i,...l){var u,d=(u=s._handlers)===null||u===void 0?void 0:u[i];if(d)for(var v=0;v<d.length;++v)d[v](...l)}function Br(s,...i){if(s)for(var l=0;l<s.length;++l)s[l](...i)}let Kt;try{Kt=new RegExp("[\\w\\p{Alphabetic}\\p{Number}_]","u")}catch{Kt=/[\w]/}function lt(s,i){var l=s.cm6;if(!l.state.readOnly){var u="input.type.compose";if(s.curOp&&(s.curOp.lastChange||(u="input.type.compose.start")),i.annotations)try{i.annotations.some(function(d){d.value=="input"&&(d.value=u)})}catch(d){console.error(d)}else i.userEvent=u;return l.dispatch(i)}}function Pr(s,i){var l;s.curOp&&(s.curOp.$changeStart=void 0),(i?xi:bi)(s.cm6);let u=(l=s.curOp)===null||l===void 0?void 0:l.$changeStart;u!=null&&s.cm6.dispatch({selection:{anchor:u}})}var ro={Left:s=>Ge(s.cm6,{key:"Left"},"editor"),Right:s=>Ge(s.cm6,{key:"Right"},"editor"),Up:s=>Ge(s.cm6,{key:"Up"},"editor"),Down:s=>Ge(s.cm6,{key:"Down"},"editor"),Backspace:s=>Ge(s.cm6,{key:"Backspace"},"editor"),Delete:s=>Ge(s.cm6,{key:"Delete"},"editor")};class V{openDialog(i,l,u){return io(this,i,l,u)}openNotification(i,l){return no(this,i,l)}constructor(i){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=i,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(i,l){Xr(this,i,l)}off(i,l){Gr(this,i,l)}signal(i,l,u){en(this,i,l,u)}indexFromPos(i){return Se(this.cm6.state.doc,i)}posFromIndex(i){return Ae(this.cm6.state.doc,i)}foldCode(i){let l=this.cm6,u=l.state.selection.ranges,d=this.cm6.state.doc,v=Se(d,i),w=be.create([be.range(v,v)],0).ranges;l.state.selection.ranges=w,li(l),l.state.selection.ranges=u}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(i,l){typeof i=="object"&&(l=i.ch,i=i.line);var u=Se(this.cm6.state.doc,{line:i,ch:l||0});this.cm6.dispatch({selection:{anchor:u}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(i){var l=this.cm6.state.selection.main,u=i=="head"||!i?l.head:i=="anchor"?l.anchor:i=="start"?l.from:i=="end"?l.to:null;if(u==null)throw new Error("Invalid cursor type");return this.posFromIndex(u)}listSelections(){var i=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(l=>({anchor:Ae(i,l.anchor),head:Ae(i,l.head)}))}setSelections(i,l){var u=this.cm6.state.doc,d=i.map(v=>{var w=Se(u,v.head),S=Se(u,v.anchor);return w==S?be.cursor(w,1):be.range(S,w)});this.cm6.dispatch({selection:be.create(d,l)})}setSelection(i,l,u){this.setSelections([{anchor:i,head:l}],0),u&&u.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(i){var l=this.cm6.state.doc;return i<0||i>=l.lines?"":this.cm6.state.doc.line(i+1).text}getLineHandle(i){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:i,index:this.indexFromPos(new De(i,0))}}getLineNumber(i){var l=this.$lineHandleChanges;if(!l)return null;for(var u=i.index,d=0;d<l.length;d++)if(u=l[d].changes.mapPos(u,1,qr.TrackAfter),u==null)return null;var v=this.posFromIndex(u);return v.ch==0?v.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(i,l){var u=this.cm6.state.doc;return this.cm6.state.sliceDoc(Se(u,i),Se(u,l))}replaceRange(i,l,u,d){u||(u=l);var v=this.cm6.state.doc,w=Se(v,l),S=Se(v,u);lt(this,{changes:{from:w,to:S,insert:i}})}replaceSelection(i){lt(this,this.cm6.state.replaceSelection(i))}replaceSelections(i){var l=this.cm6.state.selection.ranges,u=l.map((d,v)=>({from:d.from,to:d.to,insert:i[v]||""}));lt(this,{changes:u})}getSelection(){return this.getSelections().join(`
|
|
35
|
-
`)}getSelections(){var i=this.cm6;return i.state.selection.ranges.map(l=>i.state.sliceDoc(l.from,l.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(i=>!i.empty)}getInputField(){return this.cm6.contentDOM}clipPos(i){var l=this.cm6.state.doc,u=i.ch,d=i.line+1;d<1&&(d=1,u=0),d>l.lines&&(d=l.lines,u=Number.MAX_VALUE);var v=l.line(d);return u=Math.min(Math.max(0,u),v.to-v.from),new De(d-1,u)}getValue(){return this.cm6.state.doc.toString()}setValue(i){var l=this.cm6;return l.dispatch({changes:{from:0,to:l.state.doc.length,insert:i},selection:be.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(i,l){var u=this.cm6.state,d=Se(u.doc,i),v=Er(u,d+1,-1);return v&&v.end?{to:Ae(u.doc,v.end.from)}:(v=Er(u,d,1),v&&v.end?{to:Ae(u.doc,v.end.from)}:{to:void 0})}scanForBracket(i,l,u,d){return so(this,i,l,u,d)}indentLine(i,l){l?this.indentMore():this.indentLess()}indentMore(){ci(this.cm6)}indentLess(){ui(this.cm6)}execCommand(i){if(V.commands.hasOwnProperty(i))V.commands[i](this);else if(i=="goLineLeft")fi(this.cm6);else if(i=="goLineRight"){hi(this.cm6);let l=this.cm6.state,u=l.selection.main.head;u<l.doc.length&&l.sliceDoc(u,u+1)!==`
|
|
36
|
-
`&&di(this.cm6)}else console.log(i+" is not implemented")}setBookmark(i,l){var u=l?.insertLeft?1:-1,d=this.indexFromPos(i),v=new uo(this,d,u);return v}addOverlay({query:i}){let l=new pi({regexp:!0,search:i.source,caseSensitive:!/i/.test(i.flags)});if(l.valid){l.forVim=!0,this.cm6Query=l;let u=Pt.of(l);return this.cm6.dispatch({effects:u}),l}}removeOverlay(i){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let l=Pt.of(this.cm6Query);this.cm6.dispatch({effects:l})}getSearchCursor(i,l){var u=this,d=null,v=null,w=!1;l.ch==null&&(l.ch=Number.MAX_VALUE);var S=Se(u.cm6.state.doc,l),x=i.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(D,K){return K||"\\"+D});function N(D,K=0,W=D.length){return new vi(D,x,{ignoreCase:i.ignoreCase},K,W)}function E(D){var K=u.cm6.state.doc;if(D>K.length)return null;let W=N(K,D).next();return W.done?null:W.value}var L=1e4;function P(D,K){var W=u.cm6.state.doc;for(let F=1;;F++){let q=Math.max(D,K-F*L),re=N(W,q,K),z=null;for(;!re.next().done;)z=re.value;if(z&&(q==D||z.from>q+10))return z;if(q==D)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(D){var K=u.cm6.state.doc;if(D){let W=d?w?d.to-1:d.from:S;d=P(0,W)}else{let W=d?w?d.to+1:d.to:S;d=E(W)}return v=d&&{from:Ae(K,d.from),to:Ae(K,d.to),match:d.match},w=d?d.from==d.to:!1,d&&d.match},from:function(){return v?.from},to:function(){return v?.to},replace:function(D){d&&(lt(u,{changes:{from:d.from,to:d.to,insert:D}}),d.to=d.from+D.length,v&&(v.to=Ae(u.cm6.state.doc,d.to)))},get match(){return v&&v.match}}}findPosV(i,l,u,d){let{cm6:v}=this;const w=v.state.doc;let S=u=="page"?v.dom.clientHeight:0;const x=Se(w,i);let N=be.cursor(x,1,void 0,d),E=Math.round(Math.abs(l));for(let P=0;P<E;P++)u=="page"?N=v.moveVertically(N,l>0,S):u=="line"&&(N=v.moveVertically(N,l>0));let L=Ae(w,N.head);return(l<0&&N.head==0&&d!=0&&i.line==0&&i.ch!=0||l>0&&N.head==w.length&&L.ch!=d&&i.line==L.line)&&(L.hitSide=!0),L}charCoords(i,l){var u=this.cm6.contentDOM.getBoundingClientRect(),d=Se(this.cm6.state.doc,i),v=this.cm6.coordsAtPos(d),w=-u.top;return{left:(v?.left||0)-u.left,top:(v?.top||0)+w,bottom:(v?.bottom||0)+w}}coordsChar(i,l){var u=this.cm6.contentDOM.getBoundingClientRect(),d=this.cm6.posAtCoords({x:i.left+u.left,y:i.top+u.top})||0;return Ae(this.cm6.state.doc,d)}getScrollInfo(){var i=this.cm6.scrollDOM;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight,width:i.scrollWidth,clientHeight:i.clientHeight,clientWidth:i.clientWidth}}scrollTo(i,l){i!=null&&(this.cm6.scrollDOM.scrollLeft=i),l!=null&&(this.cm6.scrollDOM.scrollTop=l)}scrollIntoView(i,l){if(i){var u=this.indexFromPos(i);this.cm6.dispatch({effects:se.scrollIntoView(u)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(i,l){this.cm6.dom.style.width=i+4+"px",this.cm6.dom.style.height=l+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(i){this.$lineHandleChanges&&this.$lineHandleChanges.push(i);for(let u in this.marks)this.marks[u].update(i.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(u=>u.map(i.changes)));var l=this.curOp=this.curOp||{};i.changes.iterChanges((u,d,v,w,S)=>{(l.$changeStart==null||l.$changeStart>v)&&(l.$changeStart=v),this.$lastChangeEndOffset=w;var x={text:S.toJSON()};l.lastChange?l.lastChange.next=l.lastChange=x:l.lastChange=l.change=x},!0),l.changeHandlers||(l.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var i=this.curOp=this.curOp||{};i.cursorActivityHandlers||(i.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(i,l){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var u=i()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return u}onBeforeEndOperation(){var i=this.curOp,l=!1;i&&(i.change&&Br(i.changeHandlers,this,i.change),i&&i.cursorActivity&&(Br(i.cursorActivityHandlers,this,null),i.isVimOp&&(l=!0)),this.curOp=null),l&&this.scrollIntoView()}moveH(i,l){if(l=="char"){var u=this.getCursor();this.setCursor(u.line,u.ch+i)}}setOption(i,l){switch(i){case"keyMap":this.state.keyMap=l;break;case"textwidth":this.state.textwidth=l;break}}getOption(i){switch(i){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readOnly":return this.cm6.state.readOnly;case"indentWithTabs":return this.cm6.state.facet(Rr)==" ";case"indentUnit":return this.cm6.state.facet(Rr).length||2;case"textwidth":return this.state.textwidth;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(i){this.state.overwrite=i}getTokenTypeAt(i){var l,u=this.indexFromPos(i),d=Jr(this.cm6.state,u),v=d?.resolve(u),w=((l=v?.type)===null||l===void 0?void 0:l.name)||"";return/comment/i.test(w)?"comment":/string/i.test(w)?"string":""}overWriteSelection(i){var l=this.cm6.state.doc,u=this.cm6.state.selection,d=u.ranges.map(v=>{if(v.empty){var w=v.to<l.length?l.sliceString(v.from,v.to+1):"";if(w&&!/\n/.test(w))return be.range(v.from,v.to+1)}return v});this.cm6.dispatch({selection:be.create(d,u.mainIndex)}),this.replaceSelection(i)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(i){var l=this.cm6.state.selection;this.virtualSelection=be.create(l.ranges,l.mainIndex);for(var u=0;u<this.virtualSelection.ranges.length;u++){var d=this.virtualSelection.ranges[u];d&&(this.cm6.dispatch({selection:be.create([d])}),i(),this.virtualSelection.ranges[u]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(i){return fo(this,i)}}V.isMac=typeof navigator<"u"&&/Mac/.test(navigator.platform);V.Pos=De;V.StringStream=yi;V.commands={toggleLineComment:function(s){Si(s.cm6)},cursorCharLeft:function(s){wi(s.cm6)},redo:function(s){Pr(s,!1)},undo:function(s){Pr(s,!0)},newlineAndIndent:function(s){ki({state:s.cm6.state,dispatch:i=>lt(s,i)})},indentAuto:function(s){Ci(s.cm6)},newlineAndIndentContinueComment:void 0,save:void 0};V.isWordChar=function(s){return Kt.test(s)};V.keys=ro;V.addClass=function(s,i){};V.rmClass=function(s,i){};V.e_preventDefault=function(s){s.preventDefault()};V.e_stop=function(s){var i,l;(i=s?.stopPropagation)===null||i===void 0||i.call(s),(l=s?.preventDefault)===null||l===void 0||l.call(s)};V.lookupKey=function(i,l,u){var d=V.keys[i];!d&&/^Arrow/.test(i)&&(d=V.keys[i.slice(5)]),d&&u(d)};V.on=Xr;V.off=Gr;V.signal=en;V.findMatchingTag=lo;V.findEnclosingTag=co;V.keyName=void 0;function tn(s,i,l){var u=document.createElement("div");return u.appendChild(i),u}function rn(s,i){s.state.currentNotificationClose&&s.state.currentNotificationClose(),s.state.currentNotificationClose=i}function no(s,i,l){rn(s,S);var u=tn(s,i,l&&l.bottom),d=!1,v,w=l&&typeof l.duration<"u"?l.duration:5e3;function S(){d||(d=!0,clearTimeout(v),u.remove(),on(s,u))}return u.onclick=function(x){x.preventDefault(),S()},nn(s,u),w&&(v=setTimeout(S,w)),S}function nn(s,i){var l=s.state.dialog;s.state.dialog=i,i.style.flex="1",i&&l!==i&&(l&&l.contains(document.activeElement)&&s.focus(),l&&l.parentElement?l.parentElement.replaceChild(i,l):l&&l.remove(),V.signal(s,"dialog"))}function on(s,i){s.state.dialog==i&&(s.state.dialog=null,V.signal(s,"dialog"))}function io(s,i,l,u){u||(u={}),rn(s,void 0);var d=tn(s,i,u.bottom),v=!1;nn(s,d);function w(x){if(typeof x=="string")S.value=x;else{if(v)return;v=!0,on(s,d),s.state.dialog||s.focus(),u.onClose&&u.onClose(d)}}var S=d.getElementsByTagName("input")[0];return S&&(u.value&&(S.value=u.value,u.selectValueOnOpen!==!1&&S.select()),u.onInput&&V.on(S,"input",function(x){u.onInput(x,S.value,w)}),u.onKeyUp&&V.on(S,"keyup",function(x){u.onKeyUp(x,S.value,w)}),V.on(S,"keydown",function(x){u&&u.onKeyDown&&u.onKeyDown(x,S.value,w)||(x.keyCode==13&&l&&l(S.value),(x.keyCode==27||u.closeOnEnter!==!1&&x.keyCode==13)&&(S.blur(),V.e_stop(x),w()))}),u.closeOnBlur!==!1&&V.on(S,"blur",function(){setTimeout(function(){document.activeElement!==S&&w()})}),S.focus()),w}var oo={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function ao(s){return s&&s.bracketRegex||/[(){}[\]]/}function so(s,i,l,u,d){for(var v=d&&d.maxScanLineLength||1e4,w=d&&d.maxScanLines||1e3,S=[],x=ao(d),N=l>0?Math.min(i.line+w,s.lastLine()+1):Math.max(s.firstLine()-1,i.line-w),E=i.line;E!=N;E+=l){var L=s.getLine(E);if(L){var P=l>0?0:L.length-1,D=l>0?L.length:-1;if(!(L.length>v))for(E==i.line&&(P=i.ch-(l<0?1:0));P!=D;P+=l){var K=L.charAt(P);if(x.test(K)){var W=oo[K];if(W&&W.charAt(1)==">"==l>0)S.push(K);else if(S.length)S.pop();else return{pos:new De(E,P),ch:K}}}}}return E-l==(l>0?s.lastLine():s.firstLine())?!1:null}function lo(s,i){return null}function co(s,i){var l,u,d=s.cm6.state,v=s.indexFromPos(i);if(v<d.doc.length){var w=d.sliceDoc(v,v+1);w=="<"&&v++}for(var S=Jr(d,v),x=S?.resolve(v)||null;x;){if(((l=x.firstChild)===null||l===void 0?void 0:l.type.name)=="OpenTag"&&((u=x.lastChild)===null||u===void 0?void 0:u.type.name)=="CloseTag")return{open:Dr(d.doc,x.firstChild),close:Dr(d.doc,x.lastChild)};x=x.parent}}function Dr(s,i){return{from:Ae(s,i.from),to:Ae(s,i.to)}}class uo{constructor(i,l,u){this.cm=i,this.id=i.$mid++,this.offset=l,this.assoc=u,i.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(i){this.offset!=null&&(this.offset=i.mapPos(this.offset,this.assoc,qr.TrackDel))}}function fo(s,i){for(var l,u=i.column||s.getOption("textwidth")||80,d=i.allowMerge!=!1,v=Math.min(i.from,i.to),w=Math.max(i.from,i.to);v<=w;){var S=s.getLine(v);if(S.length>u){var x=K(S,u,5);if(x){var N=(l=/^\s*/.exec(S))===null||l===void 0?void 0:l[0];s.replaceRange(`
|
|
37
|
-
`+N,new De(v,x.start),new De(v,x.end))}w++}else if(d&&/\S/.test(S)&&v!=w){var E=s.getLine(v+1);if(E&&/\S/.test(E)){var L=S.replace(/\s+$/,""),P=E.replace(/^\s+/,""),D=L+" "+P,x=K(D,u,5);x&&x.start>L.length||D.length<u?(s.replaceRange(" ",new De(v,L.length),new De(v+1,E.length-P.length)),v--,w--):L.length<S.length&&s.replaceRange("",new De(v,L.length),new De(v,S.length))}}v++}return v;function K(W,F,q){if(!(W.length<F)){var re=W.slice(0,F),z=W.slice(F),le=/^(?:(\s+)|(\S+)(\s+))/.exec(z),ce=/(?:(\s+)|(\s+)(\S+))$/.exec(re),Ce=0,ae=0;if(ce&&!ce[2]&&(Ce=F-ce[1].length,ae=F),le&&!le[2]&&(Ce||(Ce=F),ae=F+le[1].length),Ce)return{start:Ce,end:ae};if(ce&&ce[2]&&ce.index>q)return{start:ce.index,end:ce.index+ce[2].length};if(le&&le[2])return Ce=F+le[2].length,{start:Ce,end:Ce+le[3].length}}}}let Ft=gi||(function(){let s={cursorBlinkRate:1200};return function(){return s}})();class ho{constructor(i,l,u,d,v,w,S,x,N,E){this.left=i,this.top=l,this.height=u,this.fontFamily=d,this.fontSize=v,this.fontWeight=w,this.color=S,this.className=x,this.letter=N,this.partial=E}draw(){let i=document.createElement("div");return i.className=this.className,this.adjust(i),i}adjust(i){i.style.left=this.left+"px",i.style.top=this.top+"px",i.style.height=this.height+"px",i.style.lineHeight=this.height+"px",i.style.fontFamily=this.fontFamily,i.style.fontSize=this.fontSize,i.style.fontWeight=this.fontWeight,i.style.color=this.partial?"transparent":this.color,i.className=this.className,i.textContent=this.letter}eq(i){return this.left==i.left&&this.top==i.top&&this.height==i.height&&this.fontFamily==i.fontFamily&&this.fontSize==i.fontSize&&this.fontWeight==i.fontWeight&&this.color==i.color&&this.className==i.className&&this.letter==i.letter}}class po{constructor(i,l){this.view=i,this.rangePieces=[],this.cursors=[],this.cm=l,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=i.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer cm-vimCursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),i.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let l=Ft(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=l+"ms"}update(i){(i.selectionSet||i.geometryChanged||i.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),go(i)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:i}=this.view,l=[];for(let u of i.selection.ranges){let d=u==i.selection.main,v=Co(this.cm,this.view,u,d);v&&l.push(v)}return{cursors:l}}drawSel({cursors:i}){if(i.length!=this.cursors.length||i.some((l,u)=>!l.eq(this.cursors[u]))){let l=this.cursorLayer.children;if(l.length!==i.length){this.cursorLayer.textContent="";for(const u of i)this.cursorLayer.appendChild(u.draw())}else i.forEach((u,d)=>u.adjust(l[d]));this.cursors=i}}destroy(){this.cursorLayer.remove()}}function go(s){return Ft(s.startState)!=Ft(s.state)}const vo={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},mo=Qr.highest(se.theme(vo));function yo(s){let i=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==mi.LTR?i.left:i.right-s.scrollDOM.clientWidth)-s.scrollDOM.scrollLeft*s.scaleX,top:i.top-s.scrollDOM.scrollTop*s.scaleY}}function Co(s,i,l,u){var d,v,w,S;let x=l.head,N=!1,E=1,L=s.state.vim;if(L&&(!L.insertMode||s.state.overwrite)){if(N=!0,L.visualBlock&&!u)return null;l.anchor<l.head&&(x<i.state.doc.length&&i.state.sliceDoc(x,x+1))!=`
|
|
38
|
-
`&&x--,s.state.overwrite?E=.2:L.status&&(E=.5)}if(N){let D=x<i.state.doc.length&&i.state.sliceDoc(x,x+1);D&&/[\uDC00-\uDFFF]/.test(D)&&x>1&&(x--,D=i.state.sliceDoc(x,x+1));let K=i.coordsAtPos(x,1);if(!K)return null;let W=yo(i),F=i.domAtPos(x),q=F?F.node:i.contentDOM;for(q instanceof Text&&F.offset>=q.data.length&&!((d=q.parentElement)===null||d===void 0)&&d.nextSibling&&(q=(v=q.parentElement)===null||v===void 0?void 0:v.nextSibling,F={node:q,offset:0});F&&F.node instanceof HTMLElement;)q=F.node,F={node:F.node.childNodes[F.offset],offset:0};if(!(q instanceof HTMLElement)){if(!q.parentNode)return null;q=q.parentNode}let re=getComputedStyle(q),z=K.left,le=(S=(w=i).coordsForChar)===null||S===void 0?void 0:S.call(w,x);if(le&&(z=le.left),!D||D==`
|
|
39
|
-
`||D=="\r")D=" ";else if(D==" "){D=" ";var P=i.coordsAtPos(x+1,-1);P&&(z=P.left-(P.left-K.left)/parseInt(re.tabSize))}else/[\uD800-\uDBFF]/.test(D)&&x<i.state.doc.length-1&&(D+=i.state.sliceDoc(x+1,x+2));let ce=K.bottom-K.top;return new ho((z-W.left)/i.scaleX,(K.top-W.top+ce*(1-E))/i.scaleY,ce*E/i.scaleY,re.fontFamily,re.fontSize,re.fontWeight,re.color,u?"cm-fat-cursor cm-cursor-primary":"cm-fat-cursor cm-cursor-secondary",D,E!=1)}else return null}var ko=typeof navigator<"u"&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent);const Oe=to(V),wo=250,So=se.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:"none"},".cm-vim-panel":{padding:"0px 10px",fontFamily:"monospace",minHeight:"1.3em",display:"flex"},".cm-vim-panel input":{border:"none",outline:"none",backgroundColor:"inherit"},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"}}),xo=ut.fromClass(class{constructor(s){this.status="",this.query=null,this.decorations=te.none,this.waitForCopy=!1,this.lastKeydown="",this.useNextTextInput=!1,this.compositionText="",this.view=s;const i=this.cm=new V(s);Oe.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new po(s,i),this.updateClass(),this.cm.on("vim-command-done",()=>{i.state.vim&&(i.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",l=>{i.state.vim&&(i.state.vim.mode=l.mode,l.subMode&&(i.state.vim.mode+=l.subMode==="linewise"?" line":" block"),i.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():s.dispatch({effects:an.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.spacer=document.createElement("span"),this.spacer.style.flex="1",this.statusButton=document.createElement("span"),this.statusButton.onclick=l=>{Oe.handleKey(this.cm,"<Esc>","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(s){var i;if((s.viewportChanged||s.docChanged)&&this.query&&this.highlight(this.query),s.docChanged&&this.cm.onChange(s),s.selectionSet&&this.cm.onSelectionChange(),s.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),s.transactions){for(let l of s.transactions)for(let u of l.effects)if(u.is(Pt))if(!((i=u.value)===null||i===void 0?void 0:i.forVim))this.highlight(null);else{let v=u.value.create();this.highlight(v)}}this.blockCursor.update(s)}updateClass(){const s=this.cm.state;!s.vim||s.vim.insertMode&&!s.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let s=this.cm.state.statusbar,i=this.cm.state.vim;if(!s||!i)return;let l=this.cm.state.dialog;if(l)l.parentElement!=s&&(s.textContent="",s.appendChild(l));else{s.textContent="";var u=(i.mode||"normal").toUpperCase();i.insertModeReturn&&(u+="(C-O)"),this.statusButton.textContent=`--${u}--`,s.appendChild(this.statusButton),s.appendChild(this.spacer)}this.dom.textContent=i.status,s.appendChild(this.dom)}destroy(){Oe.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(s){if(this.query=s,!s)return this.decorations=te.none;let{view:i}=this,l=new si;for(let u=0,d=i.visibleRanges,v=d.length;u<v;u++){let{from:w,to:S}=d[u];for(;u<v-1&&S>d[u+1].from-2*wo;)S=d[++u].to;s.highlight(i.state,w,S,(x,N)=>{l.add(x,N,Mo)})}return this.decorations=l.finish()}handleKey(s,i){const l=this.cm;let u=l.state.vim;if(!u)return;const d=Oe.vimKeyFromEvent(s,u);if(V.signal(this.cm,"inputEvent",{type:"handleKey",key:d}),!d)return;if(d=="<Esc>"&&!u.insertMode&&!u.visualMode&&this.query){const S=u.searchState_;S&&(l.removeOverlay(S.getOverlay()),S.setOverlay(null))}if(d==="<C-c>"&&!V.isMac&&l.somethingSelected())return this.waitForCopy=!0,!0;u.status=(u.status||"")+d;let w=Oe.multiSelectHandleKey(l,d,"user");return u=Oe.maybeInitVimState_(l),!w&&u.insertMode&&l.state.overwrite&&(s.key&&s.key.length==1&&!/\n/.test(s.key)?(w=!0,l.overWriteSelection(s.key)):s.key=="Backspace"&&(w=!0,V.commands.cursorCharLeft(l))),w&&(V.signal(this.cm,"vim-keypress",d),s.preventDefault(),s.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!w}},{eventHandlers:{copy:function(s,i){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var l=this.cm,u=l.state.vim;u&&(u.insertMode?l.setSelection(l.getCursor(),l.getCursor()):l.operation(()=>{l.curOp&&(l.curOp.isVimOp=!0),Oe.handleKey(l,"<Esc>","user")}))}))},compositionstart:function(s,i){this.useNextTextInput=!0,V.signal(this.cm,"inputEvent",s)},compositionupdate:function(s,i){V.signal(this.cm,"inputEvent",s)},compositionend:function(s,i){V.signal(this.cm,"inputEvent",s)},keypress:function(s,i){V.signal(this.cm,"inputEvent",s),this.lastKeydown=="Dead"&&this.handleKey(s,i)},keydown:function(s,i){V.signal(this.cm,"inputEvent",s),this.lastKeydown=s.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(s,i))}},provide:()=>[se.inputHandler.of((s,i,l,u)=>{var d,v,w=sn(s);if(!w)return!1;var S=(d=w.state)===null||d===void 0?void 0:d.vim,x=w.state.vimPlugin;if(S&&!S.insertMode&&!(!((v=w.curOp)===null||v===void 0)&&v.isVimOp)){if(u==="\0\0")return!0;if(V.signal(w,"inputEvent",{type:"text",text:u,from:i,to:l}),u.length==1&&x.useNextTextInput){if(S.expectLiteralNext&&s.composing)return x.compositionText=u,!1;if(x.compositionText){var N=x.compositionText;x.compositionText="";var E=s.state.selection.main.head,L=s.state.sliceDoc(E-N.length,E);if(N===L){var P=w.getCursor();w.replaceRange("",w.posFromIndex(E-N.length),P)}}return x.handleKey({key:u,preventDefault:()=>{},stopPropagation:()=>{}}),bo(s),!0}}return!1})],decorations:s=>s.decorations});function bo(s){var i=s.scrollDOM.parentElement;if(i){if(ko){s.contentDOM.textContent="\0\0",s.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var l=s.scrollDOM.nextSibling,u=window.getSelection(),d=u&&{anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset};s.scrollDOM.remove(),i.insertBefore(s.scrollDOM,l);try{d&&u&&(u.setPosition(d.anchorNode,d.anchorOffset),d.focusNode&&u.extend(d.focusNode,d.focusOffset))}catch(v){console.error(v)}s.focus(),s.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const Mo=te.mark({class:"cm-searchMatch"}),an=Ct.define(),Lo=yt.define({create:()=>!1,update(s,i){for(let l of i.effects)l.is(an)&&(s=l.value);return s},provide:s=>zr.from(s,i=>i?Ao:null)});function Ao(s){let i=document.createElement("div");i.className="cm-vim-panel";let l=s.cm;return l.state.dialog&&i.appendChild(l.state.dialog),{top:!1,dom:i}}function Eo(s){let i=document.createElement("div");i.className="cm-vim-panel";let l=s.cm;return l.state.statusbar=i,l.state.vimPlugin.updateStatus(),{dom:i}}function _r(s={}){return[So,xo,mo,s.status?zr.of(Eo):Lo]}function sn(s){return s.cm||null}class Qt{constructor(i,l){this.yanchor=i,this.yhead=l}toJSON(){return{yanchor:Ir(this.yanchor),yhead:Ir(this.yhead)}}static fromJSON(i){return new Qt(ct(i.yanchor),ct(i.yhead))}}class Ro{constructor(i,l){this.ytext=i,this.awareness=l,this.undoManager=new Zr(i)}toYPos(i,l=0){return Dt(this.ytext,i,l)}fromYPos(i){const l=_t(ct(i),this.ytext.doc);if(l==null||l.type!==this.ytext)throw new Error("[y-codemirror] The position you want to retrieve was created by a different document");return{pos:l.index,assoc:l.assoc}}toYRange(i){const l=i.assoc,u=this.toYPos(i.anchor,l),d=this.toYPos(i.head,l);return new Qt(u,d)}fromYRange(i){const l=this.fromYPos(i.yanchor),u=this.fromYPos(i.yhead);return l.pos===u.pos?be.cursor(u.pos,u.assoc):be.range(l.pos,u.pos)}}const kt=Wt.define({combine(s){return s[s.length-1]}}),$t=Ut.define();class Oo{constructor(i){this.view=i,this.conf=i.state.facet(kt),this._observer=(l,u)=>{if(u.origin!==this.conf){const d=l.delta,v=[];let w=0;for(let S=0;S<d.length;S++){const x=d[S];x.insert!=null?v.push({from:w,to:w,insert:x.insert}):x.delete!=null?(v.push({from:w,to:w+x.delete,insert:""}),w+=x.delete):w+=x.retain}i.dispatch({changes:v,annotations:[$t.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(i){if(!i.docChanged||i.transactions.length>0&&i.transactions[0].annotation($t)===this.conf)return;const l=this.conf.ytext;l.doc.transact(()=>{let u=0;i.changes.iterChanges((d,v,w,S,x)=>{const N=x.sliceString(0,x.length,`
|
|
40
|
-
`);d!==v&&l.delete(d+u,v-d),N.length>0&&l.insert(d+u,N),u+=N.length-(v-d)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}}const To=ut.fromClass(Oo),Io=se.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:"0px 2px 0px 4px"},".cm-ySelectionCaret":{position:"relative",borderLeft:"1px solid black",borderRight:"1px solid black",marginLeft:"-1px",marginRight:"-1px",boxSizing:"border-box",display:"inline"},".cm-ySelectionCaretDot":{borderRadius:"50%",position:"absolute",width:".4em",height:".4em",top:"-.2em",left:"-.2em",backgroundColor:"inherit",transition:"transform .3s ease-in-out",boxSizing:"border-box"},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:"bottom center",transform:"scale(0)"},".cm-ySelectionInfo":{position:"absolute",top:"-1.05em",left:"-1px",fontSize:".75em",fontFamily:"serif",fontStyle:"normal",fontWeight:"normal",lineHeight:"normal",userSelect:"none",color:"white",paddingLeft:"2px",paddingRight:"2px",zIndex:101,transition:"opacity .3s ease-in-out",backgroundColor:"inherit",opacity:0,transitionDelay:"0s",whiteSpace:"nowrap"},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:"0s"}}),No=Ut.define();class Bo extends Yr{constructor(i,l){super(),this.color=i,this.name=l}toDOM(){return Bt("span",[mt("class","cm-ySelectionCaret"),mt("style",`background-color: ${this.color}; border-color: ${this.color}`)],[vt(""),Bt("div",[mt("class","cm-ySelectionCaretDot")]),vt(""),Bt("div",[mt("class","cm-ySelectionInfo")],[vt(this.name)]),vt("")])}eq(i){return i.color===this.color}compare(i){return i.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}}class Po{constructor(i){this.conf=i.state.facet(kt),this._listener=({added:l,updated:u,removed:d},v,w)=>{l.concat(u).concat(d).findIndex(x=>x!==this.conf.awareness.doc.clientID)>=0&&i.dispatch({annotations:[No.of([])]})},this._awareness=this.conf.awareness,this._awareness.on("change",this._listener),this.decorations=Mi.of([])}destroy(){this._awareness.off("change",this._listener)}update(i){const l=this.conf.ytext,u=l.doc,d=this.conf.awareness,v=[],w=this.conf.awareness.getLocalState();if(w!=null){const S=i.view.hasFocus&&i.view.dom.ownerDocument.hasFocus(),x=S?i.state.selection.main:null,N=w.cursor==null?null:ct(w.cursor.anchor),E=w.cursor==null?null:ct(w.cursor.head);if(x!=null){const L=Dt(l,x.anchor),P=Dt(l,x.head);(w.cursor==null||!Nr(N,L)||!Nr(E,P))&&d.setLocalStateField("cursor",{anchor:L,head:P})}else w.cursor!=null&&S&&d.setLocalStateField("cursor",null)}d.getStates().forEach((S,x)=>{if(x===d.doc.clientID)return;const N=S.cursor;if(N==null||N.anchor==null||N.head==null)return;const E=_t(N.anchor,u),L=_t(N.head,u);if(E==null||L==null||E.type!==l||L.type!==l)return;const{color:P="#30bced",name:D="Anonymous"}=S.user||{},K=S.user&&S.user.colorLight||P+"33",W=Xi(E.index,L.index),F=Gi(E.index,L.index),q=i.view.state.doc.lineAt(W),re=i.view.state.doc.lineAt(F);if(q.number===re.number)v.push({from:W,to:F,value:te.mark({attributes:{style:`background-color: ${K}`},class:"cm-ySelection"})});else{v.push({from:W,to:q.from+q.length,value:te.mark({attributes:{style:`background-color: ${K}`},class:"cm-ySelection"})}),v.push({from:re.from,to:F,value:te.mark({attributes:{style:`background-color: ${K}`},class:"cm-ySelection"})});for(let z=q.number+1;z<re.number;z++){const le=i.view.state.doc.line(z).from;v.push({from:le,to:le,value:te.line({attributes:{style:`background-color: ${K}`,class:"cm-yLineSelection"}})})}}v.push({from:L.index,to:L.index,value:te.widget({side:L.index-E.index>0?-1:1,block:!1,widget:new Bo(P,D)})})}),this.decorations=te.set(v,!0)}}const Do=ut.fromClass(Po,{decorations:s=>s.decorations}),_o=()=>{let s=!0;return(i,l)=>{if(s){s=!1;try{i()}finally{s=!0}}else l!==void 0&&l()}};class Ko{constructor(i){this.undoManager=i}addTrackedOrigin(i){this.undoManager.addTrackedOrigin(i)}removeTrackedOrigin(i){this.undoManager.removeTrackedOrigin(i)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}}const wt=Wt.define({combine(s){return s[s.length-1]}});class Fo{constructor(i){this.view=i,this.conf=i.state.facet(wt),this._undoManager=this.conf.undoManager,this.syncConf=i.state.facet(kt),this._beforeChangeSelection=null,this._mux=_o(),this._onStackItemAdded=({stackItem:l,changedParentTypes:u})=>{u.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!l.meta.has(this)&&l.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:l})=>{const u=l.meta.get(this);if(u){const d=this.syncConf.fromYRange(u);i.dispatch(i.state.update({selection:d,effects:[se.scrollIntoView(d)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on("stack-item-added",this._onStackItemAdded),this._undoManager.on("stack-item-popped",this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(i){i.selectionSet&&(i.transactions.length===0||i.transactions[0].annotation($t)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off("stack-item-added",this._onStackItemAdded),this._undoManager.off("stack-item-popped",this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}}const $o=ut.fromClass(Fo),ln=({state:s,dispatch:i})=>s.facet(wt).undo()||!0,Ht=({state:s,dispatch:i})=>s.facet(wt).redo()||!0,Ho=[{key:"Mod-z",run:ln,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ht,preventDefault:!0},{key:"Mod-Shift-z",run:Ht,preventDefault:!0}],Vo=(s,i,{undoManager:l=new Zr(s)}={})=>{const u=new Ro(s,i),d=[kt.of(u),To];return i&&d.push(Io,Do),l!==!1&&d.push(wt.of(new Ko(l)),$o,se.domEventHandlers({beforeinput(v,w){return v.inputType==="historyUndo"?ln(w):v.inputType==="historyRedo"?Ht(w):!1}})),d};function jo(s,i){if(!i.valid||!i.search)return 0;let l=0;const u=i.getCursor(s);for(;!u.next().done;)l+=1;return l}function Wo(s){return JSON.stringify([s.search,s.caseSensitive,s.literal,s.regexp,s.wholeWord])}const Uo=new Set(["(",")","[","]","{","}"]),zo={...Or,token(s,i){const l=s.pos,u=Or.token(s,i),d=s.string.slice(l,s.pos);return Uo.has(d)?"bracket":u}},Qo=Li.define(zo);function cn(s){let i=0;for(const l of s){if(l==="\\"){i+=1;continue}if(l==="%"&&i%2===0)return!0;i=0}return!1}function qo(s){const i=".+?^$()[]{}|\\";return[...s].map(l=>i.includes(l)?"\\"+l:l).join("")}function un(s,i,l){const u=s.slice(0,i)+l+s.slice(i),d=i+l.length,v=u.lastIndexOf(`
|
|
41
|
-
`,Math.max(0,d-1))+1,w=u.indexOf(`
|
|
42
|
-
`,d);return{nextSource:u,cursor:d,prefix:u.slice(v,d),suffix:u.slice(d,w<0?u.length:w)}}function fn(s){const i=s.prefix.match(/^([ \t]*)\\begin\s*\{\s*([A-Za-z][A-Za-z0-9*:_-]*)\s*\}\s*$/);if(!i||s.suffix.trim()||cn(s.prefix))return null;const l=i[2],u=qo(l);if(new RegExp("^[ \\t]*\\n[ \\t]*\\\\end\\s*\\{\\s*"+u+"\\s*\\}").test(s.nextSource.slice(s.cursor)))return null;const v=i[1]+" ";return{insert:`
|
|
43
|
-
`+v+`
|
|
44
|
-
`+i[1]+"\\end{"+l+"}",cursorOffset:1+v.length,kind:"environment"}}function hn(s){if(s.suffix.trim()||cn(s.prefix))return null;const i=s.prefix.match(/^(.*\\left\s*)(\\[{}]|[()[\]|.])\s*$/);if(!i)return null;const u={"(":"\\right)",")":"\\right(","[":"\\right]","]":"\\right[","|":"\\right|",".":"\\right.","\\{":"\\right\\}","\\}":"\\right\\{"}[i[2]];return u?{insert:u,cursorOffset:0,kind:"delimiter"}:null}function Jo(s,i,l,u){if(i!==l||!u)return null;const d=un(s,i,u);return fn(d)??hn(d)}function Yo(s,i){if(i<0||i>s.length)return null;const l=un(s,i,"");return fn(l)??hn(l)}const Vt=Ct.define(),Kr=Ut.define(),Zo={undo:()=>!1,redo:()=>!1},qt=Wt.define({combine:s=>s.at(-1)??Zo});Oe.defineAction("texliteUndo",s=>{s.cm6.state.facet(qt).undo()||s.execCommand("undo")});Oe.defineAction("texliteRedo",s=>{s.cm6.state.facet(qt).redo()||s.execCommand("redo")});Oe.mapCommand("u","action","texliteUndo",{},{context:"normal"});Oe.mapCommand("<C-r>","action","texliteRedo",{},{context:"normal"});const Xo=yt.define({create:()=>te.none,update(s,i){let l=s.map(i.changes);for(const u of i.effects)u.is(Vt)&&(l=va(u.value,i.state.doc.length));return l},provide:s=>se.decorations.from(s)}),dn=Ct.define(),Go=yt.define({create:()=>te.none,update(s,i){let l=s.map(i.changes);i.docChanged&&(l=te.none);for(const u of i.effects)u.is(dn)&&(l=ga(u.value,i.state.doc.length));return l},provide:s=>se.decorations.from(s)}),jt=Ct.define(),ea=te.mark({class:"cm-spell-error-active"}),ta=yt.define({create:()=>te.none,update(s,i){let l=s.map(i.changes);i.docChanged&&(l=te.none);for(const u of i.effects){if(!u.is(jt))continue;const d=u.value;l=d&&d.to>d.from?te.set([ea.range(d.from,d.to)]):te.none}return l},provide:s=>se.decorations.from(s)}),ra=["\\noindent","\\indent","\\par","\\leavevmode","\\newline","\\linebreak","\\nolinebreak","\\pagebreak","\\nopagebreak","\\newpage","\\clearpage","\\cleardoublepage","\\smallskip","\\medskip","\\bigskip","\\smallbreak","\\medbreak","\\bigbreak","\\hfill","\\hfil","\\vfill","\\vfil","\\thinspace","\\negthinspace","\\quad","\\qquad","\\enspace","\\enskip","\\,","\\:","\\;","\\!","\\centering","\\raggedright","\\raggedleft","\\raggedbottom","\\flushbottom","\\maketitle","\\tableofcontents","\\listoffigures","\\listoftables","\\appendix","\\bfseries","\\mdseries","\\rmfamily","\\sffamily","\\ttfamily","\\upshape","\\itshape","\\slshape","\\scshape","\\normalfont","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge","\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle","\\limits","\\nolimits","\\sum","\\prod","\\coprod","\\int","\\iint","\\iiint","\\oint","\\bigcap","\\bigcup","\\bigvee","\\bigwedge","\\lim","\\limsup","\\liminf","\\sin","\\cos","\\tan","\\cot","\\log","\\ln","\\exp","\\max","\\min","\\sup","\\inf","\\det","\\dim","\\gcd","\\ker","\\Pr","\\ldots","\\cdots","\\vdots","\\ddots","\\dotsb","\\dotsc","\\dotsm","\\dotso","\\alpha","\\beta","\\gamma","\\delta","\\epsilon","\\varepsilon","\\theta","\\vartheta","\\lambda","\\mu","\\pi","\\varpi","\\rho","\\sigma","\\tau","\\phi","\\varphi","\\omega","\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega","\\pm","\\mp","\\times","\\div","\\cdot","\\leq","\\geq","\\neq","\\approx","\\equiv","\\sim","\\simeq","\\propto","\\in","\\notin","\\subset","\\subseteq","\\supset","\\supseteq","\\cup","\\cap","\\emptyset","\\varnothing","\\forall","\\exists","\\nexists","\\infty","\\partial","\\nabla","\\angle","\\parallel","\\perp","\\mid","\\LaTeX","\\TeX","\\today","\\protect","\\nocite","\\footnotemark","\\hrule","\\verb","\\verb*"];function na(){return[...ra.map(s=>({label:s,type:"keyword"})),xe("\\section{${title}}",{label:"\\section"}),xe("\\subsection{${title}}",{label:"\\subsection"}),xe("\\textbf{${text}}",{label:"\\textbf"}),xe("\\emph{${text}}",{label:"\\emph"}),xe("\\cite{${key}}",{label:"\\cite"}),xe("\\ref{${label}}",{label:"\\ref"}),xe("\\label{${label}}",{label:"\\label"}),xe("\\includegraphics[width=${0.8}\\textwidth]{${file}}",{label:"\\includegraphics"}),xe(`\\begin{itemize}
|
|
45
|
-
\\item \${item}
|
|
46
|
-
\\end{itemize}`,{label:"\\begin{itemize}"}),xe(`\\begin{enumerate}
|
|
47
|
-
\\item \${item}
|
|
48
|
-
\\end{enumerate}`,{label:"\\begin{enumerate}"}),xe(`\\begin{equation}
|
|
49
|
-
\${equation}
|
|
50
|
-
\\end{equation}`,{label:"\\begin{equation}"}),xe(`\\begin{figure}[htbp]
|
|
51
|
-
\\centering
|
|
52
|
-
\${content}
|
|
53
|
-
\\caption{\${caption}}
|
|
54
|
-
\\label{fig:\${label}}
|
|
55
|
-
\\end{figure}`,{label:"\\begin{figure}"})]}function ia(s){const i=[],l=[],u=[],d=[],v=[],w=[],S=s.split(`
|
|
56
|
-
`).map(L=>L.replace(/(^|[^\\])%.*$/,"$1")).join(`
|
|
57
|
-
`),x=(L,P)=>{if(P<=0)return;const D=K=>`\${${K}}`;return L+Array.from({length:P},(K,W)=>`{${D(W+1)}}`).join("")},N=L=>[...L.matchAll(/[moOrRdDsStvb]/g)].length,E=(L,P,D,K,W)=>{P&&!L.some(F=>F.label===P)&&L.push({label:P,detail:D,kind:K,source:"Current file",...W?{apply:W}:{}})};for(const L of S.matchAll(/\\(?:newcommand|renewcommand|providecommand|DeclareRobustCommand)\s*\*?\s*(?:\{\s*)?\\([A-Za-z@][A-Za-z@0-9:_]*)\s*(?:\})?\s*(?:\[(\d+)\])?/g)){const P=Number.parseInt(L[2]??"0",10);E(i,`\\${L[1]}`,"Project command","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\(?:NewDocumentCommand|RenewDocumentCommand|ProvideDocumentCommand|DeclareDocumentCommand|DeclareExpandableDocumentCommand|RenewExpandableDocumentCommand|ProvideExpandableDocumentCommand)\s*\{\s*\\([A-Za-z@][A-Za-z@0-9:_]*)\s*\}\s*\{([^}]*)\}/g)){const P=N(L[2]);E(i,`\\${L[1]}`,"Project command","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\(?:def|gdef|edef|xdef)\s*\\([A-Za-z@][A-Za-z@0-9:_]*)((?:\s*#\d+)*)/g)){const P=[...(L[2]??"").matchAll(/#\d+/g)].length;E(i,`\\${L[1]}`,"Project macro","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\DeclarePairedDelimiter\s*\{?\\([A-Za-z@][A-Za-z@0-9:_]*)\}?/g))E(i,`\\${L[1]}`,"Project math delimiter","function");for(const L of S.matchAll(/\\cs_(?:new|set|gset|provide|generate)(?:_protected)?\:[A-Za-z]+\s+\\([A-Za-z@][A-Za-z@0-9:_]*)/g))E(i,`\\${L[1]}`,"Expl3 project command","function");for(const L of S.matchAll(/\\(?:newenvironment|renewenvironment|NewDocumentEnvironment|RenewDocumentEnvironment|DeclareDocumentEnvironment)\s*\*?\s*\{([^}]+)\}/g))E(l,L[1].trim(),"Project environment","keyword");for(const L of S.matchAll(/\\(?:label|hypertarget)\s*\{([^}]+)\}/g))E(u,L[1].trim(),"Label","constant");for(const L of S.matchAll(/\\(?:usepackage|RequirePackage)\s*(?:\[[^]]*\])?\s*\{([^}]+)\}/g))for(const P of L[1].split(","))E(v,P.trim(),"Package","text");for(const L of S.matchAll(/\\(?:input|include|subfile)\s*(?:\{([^}]+)\}|\s+([^\s%]+))/g))E(w,(L[1]??L[2]??"").trim(),"Project file","text");for(const L of S.matchAll(/\\(?:cite|citep|citet|parencite|textcite|autocite|footcite)(?:\w*)?\s*(?:\[[^]]*\])?\s*\{([^}]+)\}/g))for(const P of L[1].split(","))E(d,P.trim(),"Citation key","constant");return{commands:i,environments:l,labels:u,citations:d,packages:v,files:w}}const Fr=new WeakMap;function oa(s){const i=s.state.doc,l=Fr.get(i);if(l)return l;const u=ia(s.state.doc.toString());return Fr.set(i,u),u}const $r={"Project command":"projectCommand","Project macro":"projectMacro","Expl3 project command":"expl3Command","Project math operator":"mathOperator","Project math delimiter":"mathDelimiter","Project environment":"projectEnvironment","Project file":"projectFile",Package:"package","Document class":"documentClass","Current file":"currentFile",Project:"project",LaTeX:"latex"};function aa(s,i,l=!0){const u=$r[s.detail],d=s.source?$r[s.source]:void 0,v=s.detail.match(/^Project command \((\d+) arguments?\)$/),w=s.source==="LaTeX"?"":v?i("completions.projectCommandArgs",{count:Number(v[1])}):u?i(`completions.${u}`):s.source==="LaTeX"?i("completions.standard"):s.detail,S=s.source==="LaTeX"?"":d?i(`completions.${d}`):s.source,x=S&&w?`${w} · ${S}`:w||S||void 0,N={label:s.label,type:s.kind,...x?{detail:x}:{},...s.info?{info:s.info}:{}};return l&&s.apply?xe(s.apply,N):N}function qe(s,...i){const l=[],u=new Set;for(const d of i)for(const v of d){const w="kind"in v?aa(v,s):v;u.has(w.label)||(u.add(w.label),l.push(w))}return l}function Hr(s){return s.map(({detail:i,...l})=>l)}function Vr(s){return s.map(({apply:i,...l})=>l)}function et(s,i){const u=s.state.sliceDoc(0,s.pos).match(i);return!u||u.index===void 0?null:{from:s.pos-u[1].length,query:u[1]}}function sa(s){const l=s.state.sliceDoc(0,s.pos).match(/\\(begin|end)\{([^{}]*)$/);return!l||l.index===void 0?null:{from:s.pos-l[2].length,query:l[2],command:l[1]}}function la(s){const i=s.state.doc.lineAt(s.pos);let l=0;for(let u=0;u<s.pos-i.from;u+=1){const d=i.text[u];if(d==="\\"){l+=1;continue}if(d==="%"&&l%2===0)return!0;l=0}return!1}function ca(s){return{...s,apply(i,l,u,d){const w=i.state.doc.lineAt(u).text.match(/^\s*/)?.[0]??"",S=l.label,x=S+`}
|
|
58
|
-
`+w+`
|
|
59
|
-
`+w+"\\end{"+S+"}",N=u+S.length+1+1+w.length+1,E=i.state.sliceDoc(d,d+1)==="}"?1:0;i.dispatch({changes:{from:u,to:d+E,insert:x},selection:{anchor:N},annotations:[Yi.of(l),zt.userEvent.of("input.complete")]})}}}function ua(s,i,l,u,d){const v=Jo(s.state.doc.toString(),i,l,u);if(!v)return!1;s.dispatch(d());const w=i+u.length;return s.dispatch({changes:{from:w,insert:v.insert},selection:{anchor:w+v.cursorOffset},annotations:zt.userEvent.of("input.complete")}),!0}function fa(s,i,l){if(la(s))return null;const u=oa(s),d=s.matchBefore(/\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/);if(d||s.explicit)return{from:d?.from??s.pos,options:Hr(qe(i,u.commands,l?.commands??[],na())),validFor:/^\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/};const v=sa(s);if(v){const L=qe(i,Vr(u.environments),Vr(l?.environments??[]));return{from:v.from,options:Hr(v.command==="begin"?L.map(ca):L),validFor:/^[A-Za-z0-9*:_-]*$/}}const w=et(s,/\\(?:ref|pageref|autoref|nameref|cref|Cref|eqref|vref)\s*(?:\[[^]]*\])?\{([^{}]*)$/)??et(s,/\\hyperref\[([^\[\]]*)$/);if(w)return{from:w.from,options:qe(i,u.labels,l?.labels??[]),validFor:/^[^{}]*$/};const S=et(s,/\\(?:cite|citep|citet|parencite|textcite|autocite|footcite)(?:\w*)?(?:\[[^]]*\])?\{([^{}]*)$/);if(S)return{from:S.from,options:qe(i,u.citations,l?.citations??[]),validFor:/^[^{}]*$/};const x=et(s,/\\(?:input|include|subfile|includegraphics|bibliography|addbibresource)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(x)return{from:x.from,options:qe(i,u.files,l?.files??[]),validFor:/^[^{}]*$/};const N=et(s,/\\(?:usepackage|RequirePackage)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(N)return{from:N.from,options:qe(i,u.packages,l?.packages??[]),validFor:/^[^{}]*$/};const E=et(s,/\\documentclass\s*(?:\[[^]]*\])?\{([^{}]*)$/);return E?{from:E.from,options:qe(i,l?.files??[]),validFor:/^[^{}]*$/}:null}const ha=Qi.of((s,i)=>{const l=s.doc.lineAt(i),u=l.text.match(/\\begin\{([^}]+)\}/);if(u){let v=1;for(let w=l.number+1;w<=s.doc.lines;w+=1){const S=s.doc.line(w),x=u[1].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(v+=(S.text.match(new RegExp(`\\\\begin\\{${x}\\}`,"g"))??[]).length,v-=(S.text.match(new RegExp(`\\\\end\\{${x}\\}`,"g"))??[]).length,v===0&&S.from>l.to)return{from:l.to,to:S.from}}}const d=l.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(d){const v={part:0,chapter:0,section:1,subsection:2,subsubsection:3},w=v[d[1]];for(let S=l.number+1;S<=s.doc.lines;S+=1){const x=s.doc.line(S),N=x.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(N&&v[N[1]]<=w)return{from:l.to,to:Math.max(l.to,x.from-1)}}if(l.to<s.doc.length)return{from:l.to,to:s.doc.length}}return null});function ka({value:s,readOnly:i,comments:l,focusComment:u,preferences:d,completionIndex:v,jumpTo:w,searchRequest:S,spellCheckIssues:x,spellCheckJump:N,collaboration:E,onChange:L,onSelection:P,onCommentClick:D,onSpellCheckReplace:K,onCursor:W}){const{t:F,i18n:q}=ai(),re=X.useRef(null),z=X.useRef(null),le=X.useRef(L),ce=X.useRef(P),Ce=X.useRef(D),ae=X.useRef(K),_e=X.useRef(W),Je=X.useRef(x),Me=X.useRef(S),Ke=X.useRef(v),Ve=X.useRef(new Tr),pe=X.useRef(new Tr),je=X.useRef(null),[ft,tt]=X.useState(d.vimMode?"NORMAL":""),[ge,A]=X.useState(null);le.current=L,ce.current=P,Ce.current=D,ae.current=K,_e.current=W,Je.current=x,Ke.current=v;const rt=(B,Z)=>{if(je.current?.(),je.current=null,!Z){tt("");return}const R=sn(B);if(!R){tt("NORMAL");return}const J=()=>{const Y=R.state.vim?.mode??(R.state.vim?.insertMode?"insert":"normal");tt(Y.toUpperCase())};J(),R.on("vim-mode-change",J),je.current=()=>R.off("vim-mode-change",J)};return X.useEffect(()=>{if(!re.current)return;const B=E&&!i?E.undoManager??null:null,Z=Nt.create({doc:E?.text.toString()??s,extensions:[Ai(),Ei(),...E?[]:[Ri()],Oi(),Ti(),Ii(),Qo,Ni(Ji),Bi(),Qr.high(se.inputHandler.of(ua)),Pi(),Di(),ha,Xo,Go,ta,_i({top:!1}),pa(F),Nt.phrases.of(da(F)),Ki({override:[R=>fa(R,F,Ke.current)],activateOnTyping:!0}),...B?[qt.of({undo:()=>B.undo()!==null,redo:()=>B.redo()!==null})]:[],pe.current.of(d.vimMode?_r():[]),Fi.of([...$i,...Hi,...Vi,...ji,...E&&!i?Ho:[],...Wi,...E?[]:Ui]),...E?[Vo(E.text,E.awareness,{undoManager:B??!1})]:[],Nt.readOnly.of(i),Ve.current.of(jr(d)),se.domEventHandlers({click(R){const J=R.target.closest("[data-comment-id]");return J?.dataset.commentId&&Ce.current(J.dataset.commentId),!1},contextmenu(R){const J=R.target.closest("[data-spell-error]");if(!J)return!1;const Y=Number(J.dataset.spellFrom),Q=Number(J.dataset.spellTo),nt=Je.current.find(ht=>ht.from===Y&&ht.to===Q);if(!nt)return!1;R.preventDefault();const We=250,it=Math.min(300,100+nt.suggestions.length*34);return A({issue:nt,left:Math.max(8,Math.min(R.clientX,window.innerWidth-We-8)),top:Math.max(8,Math.min(R.clientY,window.innerHeight-it-8))}),!0},blur(R,J){const Y=J.state.selection.main;return ce.current(J.state.sliceDoc(Y.from,Y.to),Y.from,Y.to),E?.awareness.setLocalStateField("cursor",null),!1}}),se.updateListener.of(R=>{const J=R.transactions.some(Y=>Y.annotation(Kr));if(R.docChanged&&!J&&le.current(R.state.doc.toString()),R.docChanged&&A(null),R.selectionSet&&!R.docChanged&&R.transactions.some(Y=>Y.isUserEvent("input"))){const Y=R.state.selection.main.head,Q=Yo(R.state.doc.toString(),Y);Q&&R.view.dispatch({changes:{from:Y,insert:Q.insert},selection:{anchor:Y+Q.cursorOffset},annotations:zt.userEvent.of("input.complete")})}if(R.selectionSet||R.docChanged){const Y=R.state.selection.main;ce.current(R.state.sliceDoc(Y.from,Y.to),Y.from,Y.to);const Q=R.state.doc.lineAt(Y.head);_e.current(Q.number,Y.head-Q.from+1)}})]});return z.current=new se({state:Z,parent:re.current}),rt(z.current,d.vimMode),z.current.dispatch({effects:Vt.of(Wr(l))}),()=>{je.current?.(),je.current=null,z.current?.destroy(),z.current=null}},[i,q.resolvedLanguage,E?.text]),X.useEffect(()=>{const B=z.current;B&&(B.dispatch({effects:[Ve.current.reconfigure(jr(d)),pe.current.reconfigure(d.vimMode?_r():[])]}),rt(B,d.vimMode))},[d]),X.useEffect(()=>{const B=z.current;if(!B)return;const Z=B.state.doc.toString(),R=x.filter(J=>J.from>=0&&J.to<=Z.length&&J.to>J.from);B.dispatch({effects:[dn.of(R),jt.of(null)]})},[x]),X.useEffect(()=>{A(null)},[x]),X.useEffect(()=>{if(!ge)return;const B=R=>{R.target instanceof Element&&R.target.closest(".spell-suggestions-menu")||A(null)},Z=R=>{R.key==="Escape"&&A(null)};return document.addEventListener("mousedown",B,!0),document.addEventListener("keydown",Z,!0),()=>{document.removeEventListener("mousedown",B,!0),document.removeEventListener("keydown",Z,!0)}},[ge]),X.useEffect(()=>{const B=z.current;E||!B||B.state.doc.toString()===s||B.dispatch({changes:{from:0,to:B.state.doc.length,insert:s},annotations:Kr.of(!0)})},[s,E]),X.useEffect(()=>{z.current?.dispatch({effects:Vt.of(Wr(l))})},[l]),X.useEffect(()=>{const B=z.current;if(!B||!u||u.orphaned)return;const Z=Math.min(u.startOffset,B.state.doc.length),R=Math.min(Math.max(Z,u.endOffset),B.state.doc.length);B.dispatch({selection:{anchor:Z,head:R},effects:se.scrollIntoView(Z,{y:"center"})}),B.focus()},[u]),X.useEffect(()=>{const B=z.current;if(!B||!w)return;const Z=Math.max(1,Math.min(B.state.doc.lines,w.line)),R=B.state.doc.line(Z),J=Math.min(R.to,R.from+Math.max(0,w.column-1));B.dispatch({selection:{anchor:R.from,head:R.to},effects:se.scrollIntoView(J,{y:"center",yMargin:60})}),B.focus()},[w?.nonce]),X.useEffect(()=>{const B=z.current;if(!B||!N)return;const Z=Math.max(0,Math.min(N.from,B.state.doc.length)),R=Math.max(Z,Math.min(N.to,B.state.doc.length));B.dispatch({selection:{anchor:Z},effects:[jt.of({from:Z,to:R}),se.scrollIntoView(Z,{y:"center",yMargin:60})]}),B.focus()},[N?.nonce]),X.useEffect(()=>{const B=z.current;!B||S===0||S===Me.current||(Me.current=S,zi(B))},[S]),Pe.jsxs("div",{className:"editor-shell",style:{fontFamily:eo(d.font),fontSize:`${d.fontSize}px`,lineHeight:d.lineHeight},children:[Pe.jsx("div",{className:"editor-host",ref:re}),ge&&Pe.jsxs("div",{className:"spell-suggestions-menu",role:"menu","aria-label":F("editor.writingSuggestions"),onMouseDown:B=>B.stopPropagation(),children:[Pe.jsx("div",{className:"spell-suggestions-title",children:F("editor.writingSuggestions")}),ge.issue.message&&Pe.jsx("div",{className:"spell-suggestions-message",children:ge.issue.message}),ge.issue.suggestions.map((B,Z)=>Pe.jsx("button",{type:"button",role:"menuitem",disabled:i,title:i?F("editor.spellCheckReadOnly"):F("editor.replaceWith",{word:B||F("editor.removeText")}),onClick:()=>{ae.current(ge.issue,B),A(null)},children:B||F("editor.removeText")},`${B}-${Z}`)),ge.issue.suggestions.length===0&&Pe.jsx("span",{className:"spell-suggestions-empty",children:F("editor.noWritingSuggestions")}),i&&ge.issue.suggestions.length>0&&Pe.jsx("span",{className:"spell-suggestions-readonly",children:F("editor.spellCheckReadOnly")})]}),d.vimMode&&Pe.jsx("div",{className:"vim-editor-status",role:"status","aria-live":"polite",children:Pe.jsxs("span",{children:["--",ft||"NORMAL","--"]})})]})}function da(s){return{Find:s("editor.search.find"),Replace:s("editor.search.replace"),next:s("editor.search.next"),previous:s("editor.search.previous"),all:s("editor.search.all"),"match case":s("editor.search.matchCase"),regexp:s("editor.search.regexp"),"by word":s("editor.search.wholeWord"),replace:s("editor.search.replaceNext"),"replace all":s("editor.search.replaceAll"),close:s("common.close"),"current match":s("editor.search.currentMatch"),"on line":s("editor.search.onLine"),"replaced match on line $":s("editor.search.replacedMatchOnLine"),"replaced $ matches":s("editor.search.replacedMatches"),"Go to line":s("editor.search.goToLine"),go:s("editor.search.go")}}function pa(s){return ut.fromClass(class{constructor(i){this.view=i,this.document=i.state.doc,this.schedule()}view;frame=null;document;signature="";count=0;update(){this.schedule()}destroy(){this.frame!==null&&cancelAnimationFrame(this.frame)}schedule(){this.frame!==null&&cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>{this.frame=null,this.render()})}render(){if(!qi(this.view.state))return;const i=this.view.dom.querySelector(".cm-panel.cm-search");if(!i)return;let l=i.querySelector(".cm-search-count");if(!l){l=document.createElement("span"),l.className="cm-search-count",l.setAttribute("role","status"),l.setAttribute("aria-live","polite");const v=i.querySelector("[name=close]");i.insertBefore(l,v)}const u=Zi(this.view.state),d=Wo(u);(this.document!==this.view.state.doc||this.signature!==d)&&(this.document=this.view.state.doc,this.signature=d,this.count=jo(this.view.state,u)),l.textContent=u.search?u.valid?this.count===0?s("editor.search.noMatches"):s("editor.search.matchCount",{count:this.count}):s("editor.search.invalidQuery"):""}})}function jr(s){return[se.contentAttributes.of({spellcheck:"false",autocorrect:"off",autocapitalize:"off",autocomplete:"off",lang:"en-US"}),se.theme({"&":{fontSize:`${s.fontSize}px`},".cm-scroller":{fontFamily:"inherit",lineHeight:"inherit"},".cm-content":{fontFamily:"inherit",fontSize:"inherit"},".cm-gutters":{fontFamily:"inherit",fontSize:"inherit"}}),s.lineWrapping?se.lineWrapping:[]]}function ga(s,i){const l=s.map(u=>({from:Math.max(0,Math.min(i,u.from)),to:Math.max(0,Math.min(i,u.to)),word:u.word,kind:u.kind,message:u.message})).filter(u=>u.to>u.from).sort((u,d)=>u.from-d.from||u.to-d.to);return te.set(l.map(u=>te.mark({class:u.kind==="spelling"?"cm-spell-error":"cm-grammar-warning",attributes:{title:u.message||u.word,"data-spell-error":"true","data-spell-kind":u.kind,"data-spell-from":String(u.from),"data-spell-to":String(u.to)}}).range(u.from,u.to)),!0)}function Wr(s){return s.map(i=>({id:i.id,from:i.startOffset,to:i.endOffset,resolved:i.resolved,orphaned:i.orphaned}))}function va(s,i){const l=s.filter(u=>!u.orphaned).flatMap(u=>{const d=Math.max(0,Math.min(i,u.from)),v=Math.max(d,Math.min(i,u.to)),w=`cm-source-comment${u.resolved?" cm-source-comment-resolved":""}`;return d===v?[te.widget({widget:new Ur(u.id,w),side:1}).range(d)]:[te.mark({class:w}).range(d,v),te.widget({widget:new Ur(u.id,w),side:1}).range(v)]});return te.set(l,!0)}class Ur extends Yr{constructor(i,l){super(),this.id=i,this.className=l}id;className;toDOM(){const i=document.createElement("span");return i.className=`${this.className} cm-comment-pin`,i.dataset.commentId=this.id,i.textContent="●",i}}export{ka as LatexEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Z,r as i,j as n}from"./react-CsO_xvbl.js";import{g as O,P as U,w as Y,G as F}from"./pdf-DPnwNQHb.js";import{M as X,P as H,a as q}from"./plus-BmrCa7ds.js";import{L as T}from"./index-DJzyhcDQ.js";F.workerSrc=Y;const G=new U;function re({url:y,target:u,compiling:N=!1,onViewportLocation:S,onDoubleClickLocation:h}){const{t}=Z(),p=i.useRef(null),[f,L]=i.useState(null),[v,x]=i.useState(0),[o,m]=i.useState(100),[R,M]=i.useState(""),z=i.useRef(new Map),j=i.useCallback((e,r)=>{r?z.current.set(e,r):z.current.delete(e)},[]),E=async e=>{if(!f||e==null)return;let r=e;if(typeof e=="string"&&(r=await f.getDestination(e).catch(()=>null)),!Array.isArray(r)||r.length===0)return;const d=r[0];let l=null;if(typeof d=="number"&&Number.isInteger(d))l=d;else if(d!=null)try{l=await f.getPageIndex(d)}catch{return}l==null||l<0||l>=f.numPages||z.current.get(l+1)?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},w=()=>{const e=p.current;if(!e)return;const r=e.getBoundingClientRect(),d=r.left+r.width/2,l=r.top+r.height/2,D=[...e.querySelectorAll(".pdf-page")],s=D.find(P=>{const C=P.getBoundingClientRect();return l>=C.top&&l<=C.bottom})??D.reduce((P,C)=>{if(!P)return C;const $=Math.abs(C.getBoundingClientRect().top-l),B=Math.abs(P.getBoundingClientRect().top-l);return $<B?C:P},null);if(!s)return;const a=s.getBoundingClientRect(),c=Number(s.dataset.scale)||1,k=Number(s.dataset.page),W=Math.max(0,Math.min(a.width,d-a.left))/c,I=Math.max(0,Math.min(a.height,l-a.top))/c;k&&S(k,W,I)};i.useEffect(()=>{const e=p.current;if(!e)return;const r=()=>x(e.clientWidth);r();const d=new ResizeObserver(r);return d.observe(e),()=>d.disconnect()},[]),i.useEffect(()=>{let e=!1;L(null),M("");const r=O({url:y,worker:G});return r.promise.then(d=>{e||L(d)}).catch(()=>{e||M(t("editor.pdfLoadFailed"))}),()=>{e=!0,r.destroy()}},[y]),i.useEffect(()=>{o>100||!p.current||(p.current.scrollLeft=0)},[o,v,f]);const g=e=>m(r=>Math.min(200,Math.max(50,r+e))),A=()=>{p.current&&(p.current.scrollLeft=0),m(100)},b=e=>{!e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY,w())};return n.jsxs("div",{className:"pdf-viewer",children:[n.jsxs("div",{className:"pdf-toolbar",role:"toolbar","aria-label":t("editor.pdfZoomControls"),children:[n.jsx("button",{disabled:o<=50,title:t("editor.pdfZoomOut"),"aria-label":t("editor.pdfZoomOut"),onClick:()=>g(-10),children:n.jsx(X,{size:14})}),n.jsxs("span",{className:"pdf-zoom-value","aria-live":"polite",children:[o,"%"]}),n.jsx("button",{disabled:o>=200,title:t("editor.pdfZoomIn"),"aria-label":t("editor.pdfZoomIn"),onClick:()=>g(10),children:n.jsx(H,{size:14})}),n.jsxs("button",{className:"pdf-fit-width",title:t("editor.pdfFitWidth"),onClick:A,children:[n.jsx(q,{size:13}),t("editor.pdfFitWidth")]})]}),N&&n.jsxs("div",{className:"pdf-compiling-overlay",role:"status","aria-live":"polite",children:[n.jsx(T,{className:"spin",size:20}),n.jsx("span",{children:t("editor.compiling")})]}),n.jsx("div",{className:"pdf-document",ref:p,onScroll:w,onWheel:b,children:n.jsxs("div",{className:"pdf-pages",style:{width:`${Math.max(1,v-28)*Math.max(1,o/100)}px`},children:[!f&&!R&&n.jsxs("div",{className:"pdf-loading",role:"status","aria-live":"polite",children:[n.jsx(T,{className:"spin",size:24}),n.jsx("span",{children:t("editor.loadingPdf")})]}),R&&n.jsx("div",{className:"preview-empty",children:n.jsx("strong",{children:R})}),f&&v>0&&Array.from({length:f.numPages},(e,r)=>n.jsx(_,{document:f,pageNumber:r+1,availableWidth:v-28,zoom:o/100,target:u?.page===r+1?u:null,onReady:w,onPageElement:j,onInternalLink:E,onDoubleClickLocation:h},r+1))]})})]})}function _({document:y,pageNumber:u,availableWidth:N,zoom:S,target:h,onReady:t,onPageElement:p,onInternalLink:f,onDoubleClickLocation:L}){const v=i.useRef(null),x=i.useRef(null),o=i.useRef(null),[m,R]=i.useState(1),[M,z]=i.useState({width:0,height:0}),[j,E]=i.useState(u===1),[w,g]=i.useState(!1),[A,b]=i.useState(null),[e,r]=i.useState([]);i.useEffect(()=>{const s=v.current;if(!s||j)return;if(!("IntersectionObserver"in window)){E(!0);return}const a=new IntersectionObserver(c=>{c.some(k=>k.isIntersecting)&&(E(!0),a.disconnect())},{rootMargin:"900px 0px"});return a.observe(s),()=>a.disconnect()},[j]),i.useEffect(()=>{h&&E(!0)},[h?.nonce]),i.useEffect(()=>{if(!j)return;let s=!1,a=null;return g(!1),b(null),r([]),y.getPage(u).then(c=>{if(s)return;const k=c.getViewport({scale:1}),W=N/k.width,I=Math.min(3.3,Math.max(.175,W*S)),P=c.getViewport({scale:I});if(R(I),z({width:P.width,height:P.height}),b(P),c.getAnnotations({intent:"display"}).then(B=>{s||r(B)}).catch(()=>{s||r([])}),!x.current)return;const C=Math.max(1,window.devicePixelRatio||1),$=c.getViewport({scale:I*C});return x.current.width=Math.floor($.width),x.current.height=Math.floor($.height),a=c.render({canvas:x.current,viewport:$}),a.promise.then(()=>{s||(g(!0),window.requestAnimationFrame(t))})}).catch(()=>{}),()=>{s=!0,a?.cancel()}},[y,u,N,S,j]),i.useEffect(()=>{!h||!o.current||o.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},[h?.nonce,m]);const d=s=>{if(!L||!w||s.target instanceof HTMLElement&&s.target.closest("a"))return;const a=x.current;if(!a)return;const c=a.getBoundingClientRect();if(s.clientX<c.left||s.clientX>c.right||s.clientY<c.top||s.clientY>c.bottom)return;const k=m||1,W=Math.max(0,Math.min(c.width,s.clientX-c.left))/k,I=Math.max(0,Math.min(c.height,s.clientY-c.top))/k;L(u,W,I)},l=Math.max(1,N*S),D=l*(792/612);return n.jsxs("figure",{ref:s=>{v.current=s,p(u,s)},onDoubleClick:d,className:`pdf-page${w?" rendered":" loading"}`,"data-page":u,"data-scale":m,style:{width:`${M.width||l}px`,minHeight:`${M.height||D}px`},children:[n.jsx("canvas",{ref:x,style:{width:`${M.width||l}px`,height:`${M.height||D}px`}}),w&&A&&n.jsx(K,{annotations:e,viewport:A,onInternalLink:f}),h&&n.jsx("span",{ref:o,className:"pdf-sync-marker",style:{left:h.x*m,top:h.y*m}}),n.jsx("figcaption",{children:u})]})}function K({annotations:y,viewport:u,onInternalLink:N}){const{t:S}=Z(),h=S("editor.pdfLink");return n.jsx("div",{className:"pdf-annotation-layer","aria-label":S("editor.pdfLinks"),children:y.filter(t=>t.subtype==="Link"&&Array.isArray(t.rect)&&t.rect.length>=4).map((t,p)=>{const[f,L]=u.convertToViewportPoint(t.rect[0],t.rect[1]),[v,x]=u.convertToViewportPoint(t.rect[2],t.rect[3]),o=[f,L,v,x],m=Math.min(o[0],o[2]),R=Math.min(o[1],o[3]),M=Math.abs(o[2]-o[0]),z=Math.abs(o[3]-o[1]),j=typeof t.title=="string"?t.title.trim():"",E=typeof t.unsafeUrl=="string"?t.unsafeUrl.trim():"",w=typeof t.url=="string"?t.url.trim():"",g=V(w)?w:V(E)?E:"",A=t.dest;if(!g&&A==null)return null;const b=!!g;return n.jsx("a",{className:"pdf-annotation-link",href:g||"#",target:b?"_blank":void 0,rel:b?"noreferrer":void 0,title:j||(b?g:h),"aria-label":j||(b?g:h),style:{left:m,top:R,width:M,height:z},onClick:b?void 0:e=>{e.preventDefault(),N(A)}},`${p}-${m}-${R}`)})})}function V(y){return/^(?:https?|mailto|ftp):/i.test(y)}export{re as PdfPreview};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as r}from"./BinaryModule-Aj1vLnwf-wCY0vy1F.js";import"./index-DJzyhcDQ.js";import"./react-CsO_xvbl.js";const a=""+new URL("/assets/harper_wasm_bg-LWXDb7Ll.wasm",import.meta.url).href,o=r.create(a,"full");export{o as binary};
|