diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js index 80b384a3e..56e60fb8b 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var r=/[\w$]+/;e.registerHelper("hint","anyword",function(t,o){for(var i=o&&o.word||r,n=o&&o.range||500,f=t.getCursor(),s=t.getLine(f.line),a=f.ch,c=a;c&&i.test(s.charAt(c-1));)--c;for(var l=c!=a&&s.slice(c,a),d=o&&o.list||[],u={},p=new RegExp(i.source,"g"),g=-1;g<=1;g+=2)for(var h=f.line,m=Math.min(Math.max(h+g*n,t.firstLine()),t.lastLine())+g;h!=m;h+=g)for(var y,b=t.getLine(h);y=p.exec(b);)h==f.line&&y[0]===l||l&&0!=y[0].lastIndexOf(l,0)||Object.prototype.hasOwnProperty.call(u,y[0])||(u[y[0]]=!0,d.push(y[0]));return{list:d,from:e.Pos(f.line,c),to:e.Pos(f.line,a)}})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(y){"use strict";var b=/[\w$]+/;y.registerHelper("hint","anyword",function(e,r){for(var t=r&&r.word||b,o=r&&r.range||500,i=e.getCursor(),n=e.getLine(i.line),f=i.ch,s=f;s&&t.test(n.charAt(s-1));)--s;for(var a=s!=f&&n.slice(s,f),c=r&&r.list||[],l={},d=new RegExp(t.source,"g"),u=-1;u<=1;u+=2)for(var p=i.line,g=Math.min(Math.max(p+u*o,e.firstLine()),e.lastLine())+u;p!=g;p+=u)for(var h,m=e.getLine(p);h=d.exec(m);)p==i.line&&h[0]===a||a&&0!=h[0].lastIndexOf(a,0)||Object.prototype.hasOwnProperty.call(l,h[0])||(l[h[0]]=!0,c.push(h[0]));return{list:c,from:y.Pos(i.line,s),to:y.Pos(i.line,f)}})}); diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js index fadd84612..692c52819 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],e):e(CodeMirror)}(function(e){"use strict";var r={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};e.registerHelper("hint","css",function(t){var o=t.getCursor(),s=t.getTokenAt(o),i=e.innerMode(t.getMode(),s.state);if("css"==i.mode.name){if("keyword"==s.type&&0=="!important".indexOf(s.string))return{list:["!important"],from:e.Pos(o.line,s.start),to:e.Pos(o.line,s.end)};var n=s.start,a=o.ch,d=s.string.slice(0,a-n);/[^\w$_-]/.test(d)&&(d="",n=a=o.ch);var c=e.resolveMode("text/css"),f=[],l=i.state.state;return"pseudo"==l||"variable-3"==s.type?p(r):"block"==l||"maybeprop"==l?p(c.propertyKeywords):"prop"==l||"parens"==l||"at"==l||"params"==l?(p(c.valueKeywords),p(c.colorKeywords)):"media"!=l&&"media_parens"!=l||(p(c.mediaTypes),p(c.mediaFeatures)),f.length?{list:f,from:e.Pos(o.line,n),to:e.Pos(o.line,a)}:void 0}function p(e){for(var r in e)d&&0!=r.lastIndexOf(d,0)||f.push(r)}})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],e):e(CodeMirror)}(function(f){"use strict";var p={active:1,after:1,before:1,checked:1,default:1,disabled:1,empty:1,enabled:1,"first-child":1,"first-letter":1,"first-line":1,"first-of-type":1,focus:1,hover:1,"in-range":1,indeterminate:1,invalid:1,lang:1,"last-child":1,"last-of-type":1,link:1,not:1,"nth-child":1,"nth-last-child":1,"nth-last-of-type":1,"nth-of-type":1,"only-of-type":1,"only-child":1,optional:1,"out-of-range":1,placeholder:1,"read-only":1,"read-write":1,required:1,root:1,selection:1,target:1,valid:1,visited:1};f.registerHelper("hint","css",function(e){var t=e.getCursor(),r=e.getTokenAt(t),o=f.innerMode(e.getMode(),r.state);if("css"==o.mode.name){if("keyword"==r.type&&0=="!important".indexOf(r.string))return{list:["!important"],from:f.Pos(t.line,r.start),to:f.Pos(t.line,r.end)};var i=r.start,s=t.ch,n=r.string.slice(0,s-i);/[^\w$_-]/.test(n)&&(n="",i=s=t.ch);var a=f.resolveMode("text/css"),d=[],l=o.state.state;return"pseudo"==l||"variable-3"==r.type?c(p):"block"==l||"maybeprop"==l?c(a.propertyKeywords):"prop"==l||"parens"==l||"at"==l||"params"==l?(c(a.valueKeywords),c(a.colorKeywords)):"media"!=l&&"media_parens"!=l||(c(a.mediaTypes),c(a.mediaFeatures)),d.length?{list:d,from:f.Pos(t.line,i),to:f.Pos(t.line,s)}:void 0}function c(e){for(var t in e)n&&0!=t.lastIndexOf(n,0)||d.push(t)}})}); diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js index e3215229a..036fd0fba 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(l){"object"==typeof exports&&"object"==typeof module?l(require("../../lib/codemirror"),require("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],l):l(CodeMirror)}(function(l){"use strict";var t="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),e=["_blank","_self","_top","_parent"],a=["ascii","utf-8","utf-16","latin1","latin1"],n=["get","post","put","delete"],r=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],o=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],s={attrs:{}},u={a:{attrs:{href:null,ping:null,type:null,media:o,target:e,hreflang:t}},abbr:s,acronym:s,address:s,applet:s,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:o,hreflang:t,type:null,shape:["default","rect","circle","poly"]}},article:s,aside:s,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:s,base:{attrs:{href:null,target:e}},basefont:s,bdi:s,bdo:s,big:s,blockquote:{attrs:{cite:null}},body:s,br:s,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:r,formmethod:n,formnovalidate:["","novalidate"],formtarget:e,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:s,center:s,cite:s,code:s,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:s,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:s,dir:s,div:s,dl:s,dt:s,em:s,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:s,figure:s,font:s,footer:s,form:{attrs:{action:null,name:null,"accept-charset":a,autocomplete:["on","off"],enctype:r,method:n,novalidate:["","novalidate"],target:e}},frame:s,frameset:s,h1:s,h2:s,h3:s,h4:s,h5:s,h6:s,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:s,hgroup:s,hr:s,html:{attrs:{manifest:null},children:["head","body"]},i:s,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:r,formmethod:n,formnovalidate:["","novalidate"],formtarget:e,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:s,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:s,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:t,media:o,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:s,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:a,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:s,noframes:s,noscript:s,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:s,param:{attrs:{name:null,value:null}},pre:s,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:s,rt:s,ruby:s,s:s,samp:s,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:a}},section:s,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:s,source:{attrs:{src:null,type:null,media:null}},span:s,strike:s,strong:s,style:{attrs:{type:["text/css"],media:o,scoped:null}},sub:s,summary:s,sup:s,table:s,tbody:s,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:s,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:s,time:{attrs:{datetime:null}},title:s,tr:s,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:t}},tt:s,u:s,ul:s,var:s,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:s},i={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],class:null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};function d(l){for(var t in i)i.hasOwnProperty(t)&&(l.attrs[t]=i[t])}for(var c in d(s),u)u.hasOwnProperty(c)&&u[c]!=s&&d(u[c]);l.htmlSchema=u,l.registerHelper("hint","html",function(t,e){var a={schemaInfo:u};if(e)for(var n in e)a[n]=e[n];return l.hint.xml(t,a)})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(l){"object"==typeof exports&&"object"==typeof module?l(require("../../lib/codemirror"),require("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],l):l(CodeMirror)}(function(n){"use strict";var l="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),t=["_blank","_self","_top","_parent"],e=["ascii","utf-8","utf-16","latin1","latin1"],a=["get","post","put","delete"],r=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],o=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],s={attrs:{}},u={a:{attrs:{href:null,ping:null,type:null,media:o,target:t,hreflang:l}},abbr:s,acronym:s,address:s,applet:s,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:o,hreflang:l,type:null,shape:["default","rect","circle","poly"]}},article:s,aside:s,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:s,base:{attrs:{href:null,target:t}},basefont:s,bdi:s,bdo:s,big:s,blockquote:{attrs:{cite:null}},body:s,br:s,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:r,formmethod:a,formnovalidate:["","novalidate"],formtarget:t,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:s,center:s,cite:s,code:s,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:s,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:s,dir:s,div:s,dl:s,dt:s,em:s,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:s,figure:s,font:s,footer:s,form:{attrs:{action:null,name:null,"accept-charset":e,autocomplete:["on","off"],enctype:r,method:a,novalidate:["","novalidate"],target:t}},frame:s,frameset:s,h1:s,h2:s,h3:s,h4:s,h5:s,h6:s,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:s,hgroup:s,hr:s,html:{attrs:{manifest:null},children:["head","body"]},i:s,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:r,formmethod:a,formnovalidate:["","novalidate"],formtarget:t,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:s,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:s,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:l,media:o,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:s,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:e,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:s,noframes:s,noscript:s,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:s,param:{attrs:{name:null,value:null}},pre:s,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:s,rt:s,ruby:s,s:s,samp:s,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:e}},section:s,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:s,source:{attrs:{src:null,type:null,media:null}},span:s,strike:s,strong:s,style:{attrs:{type:["text/css"],media:o,scoped:null}},sub:s,summary:s,sup:s,table:s,tbody:s,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:s,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:s,time:{attrs:{datetime:null}},title:s,tr:s,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:l}},tt:s,u:s,ul:s,var:s,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:s},i={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],class:null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],autocorrect:["true","false"],autocapitalize:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};function d(l){for(var t in i)i.hasOwnProperty(t)&&(l.attrs[t]=i[t])}for(var c in d(s),u)u.hasOwnProperty(c)&&u[c]!=s&&d(u[c]);n.htmlSchema=u,n.registerHelper("hint","html",function(l,t){var e={schemaInfo:u};if(t)for(var a in t)e[a]=t[a];return n.hint.xml(l,e)})}); diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js index 0e8cc6a6c..f1504e76b 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){var e=t.Pos;function r(t,e){for(var r=0,n=t.length;rc.ch&&(p.end=c.ch,p.string=p.string.slice(0,c.ch-p.start)):p={start:c.ch,end:c.ch,string:"",state:p.state,type:"."==p.string?"property":null};for(var d=p;"property"==d.type;){if("."!=(d=l(n,e(c.line,d.start))).string)return;if(d=l(n,e(c.line,d.start)),!g)var g=[];g.push(d)}return{list:function(t,e,n,i){var l=[],f=t.string,c=i&&i.globalScope||window;function p(t){0!=t.lastIndexOf(f,0)||function(t,e){if(!Array.prototype.indexOf){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1}return-1!=t.indexOf(e)}(l,t)||l.push(t)}function u(t){"string"==typeof t?r(o,p):t instanceof Array?r(s,p):t instanceof Function&&r(a,p),function(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}(t,p)}if(e&&e.length){var d,g=e.pop();for(g.type&&0===g.type.indexOf("variable")?(i&&i.additionalContext&&(d=i.additionalContext[g.string]),i&&!1===i.useGlobalScope||(d=d||c[g.string])):"string"==g.type?d="":"atom"==g.type?d=1:"function"==g.type&&(null==c.jQuery||"$"!=g.string&&"jQuery"!=g.string||"function"!=typeof c.jQuery?null!=c._&&"_"==g.string&&"function"==typeof c._&&(d=c._()):d=c.jQuery());null!=d&&e.length;)d=d[e.pop().string];null!=d&&u(d)}else{for(var y=t.state.localVars;y;y=y.next)p(y.name);for(var y=t.state.globalVars;y;y=y.next)p(y.name);i&&!1===i.useGlobalScope||u(c),r(n,p)}return l}(p,g,i,f),from:e(c.line,p.start),to:e(c.line,p.end)}}}}function i(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}t.registerHelper("hint","javascript",function(t,e){return n(t,l,function(t,e){return t.getTokenAt(e)},e)}),t.registerHelper("hint","coffeescript",function(t,e){return n(t,f,i,e)});var o="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),s="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),a="prototype apply call bind".split(" "),l="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),f="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}); +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(f){var c=f.Pos;function g(t,e){for(var r=0,n=t.length;ri.ch&&(o.end=i.ch,o.string=o.string.slice(0,i.ch-o.start)):o={start:i.ch,end:i.ch,string:"",state:o.state,type:"."==o.string?"property":null};for(var a=o;"property"==a.type;){if("."!=(a=r(t,c(i.line,a.start))).string)return;a=r(t,c(i.line,a.start));var l=l||[];l.push(a)}return{list:function(t,e,r,n){var i=[],o=t.string,s=n&&n.globalScope||window;function a(t){0!=t.lastIndexOf(o,0)||function(t,e){if(Array.prototype.indexOf)return-1!=t.indexOf(e);for(var r=t.length;r--;)if(t[r]===e)return 1}(i,t)||i.push(t)}function l(t){"string"==typeof t?g(y,a):t instanceof Array?g(h,a):t instanceof Function&&g(v,a),function(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}(t,a)}if(e&&e.length){var f,c=e.pop();for(c.type&&0===c.type.indexOf("variable")?(n&&n.additionalContext&&(f=n.additionalContext[c.string]),n&&!1===n.useGlobalScope||(f=f||s[c.string])):"string"==c.type?f="":"atom"==c.type?f=1:"function"==c.type&&(null==s.jQuery||"$"!=c.string&&"jQuery"!=c.string||"function"!=typeof s.jQuery?null!=s._&&"_"==c.string&&"function"==typeof s._&&(f=s._()):f=s.jQuery());null!=f&&e.length;)f=f[e.pop().string];null!=f&&l(f)}else{for(var p=t.state.localVars;p;p=p.next)a(p.name);for(var u=t.state.context;u;u=u.prev)for(p=u.vars;p;p=p.next)a(p.name);for(p=t.state.globalVars;p;p=p.next)a(p.name);if(n&&null!=n.additionalContext)for(var d in n.additionalContext)a(d);n&&!1===n.useGlobalScope||l(s),g(r,a)}return i}(o,l,e,n),from:c(i.line,o.start),to:c(i.line,o.end)}}}}function n(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}f.registerHelper("hint","javascript",function(t,e){return r(t,i,function(t,e){return t.getTokenAt(e)},e)}),f.registerHelper("hint","coffeescript",function(t,e){return r(t,o,n,e)});var y="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),h="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),v="prototype apply call bind".split(" "),i="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),o="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}); diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.css b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.css index 91d74dfc9..5617ccca2 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.css +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.css @@ -1,6 +1,6 @@ .CodeMirror-hints { position: absolute; - z-index: 999; + z-index: 10; overflow: hidden; list-style: none; diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js index 8c58de461..7981e7b4a 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var i="CodeMirror-hint",e="CodeMirror-hint-active";function n(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(i){i=function(t,i,e){var n=t.options.hintOptions,o={};for(var s in a)o[s]=a[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);o.hint.resolve&&(o.hint=o.hint.resolve(t,i));return o}(this,this.getCursor("start"),i);var e=this.listSelections();if(!(e.length>1)){if(this.somethingSelected()){if(!i.hint.supportsSelection)return;for(var o=0;ol.clientHeight+1,x=h.getScrollInfo();if(C>0){var A=k.bottom-k.top;if(m.top-(m.bottom-k.top)-A>0)l.style.top=(v=m.top-A)+"px",y=!1;else if(A>H){l.style.height=H-5+"px",l.style.top=(v=m.bottom-k.top)+"px";var S=h.getCursor();o.from.ch!=S.ch&&(m=h.cursorCoords(S),l.style.left=(g=m.left)+"px",k=l.getBoundingClientRect())}}var T,M=k.right-w;if(M>0&&(k.right-k.left>w&&(l.style.width=w-5+"px",M-=k.right-k.left-w),l.style.left=(g=m.left-M)+"px"),b)for(var N=l.firstChild;N;N=N.nextSibling)N.style.paddingRight=h.display.nativeBarWidth+"px";(h.addKeyMap(this.keyMap=function(t,i){var e={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(1-i.menuSize(),!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},n=t.options.customKeys,o=n?{}:e;function s(t,n){var s;s="string"!=typeof n?function(t){return n(t,i)}:e.hasOwnProperty(n)?e[n]:n,o[t]=s}if(n)for(var c in n)n.hasOwnProperty(c)&&s(c,n[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&s(c,r[c]);return o}(n,{moveFocus:function(t,i){s.changeActive(s.selectedHint+t,i)},setFocus:function(t){s.changeActive(t)},menuSize:function(){return s.screenAmount()},length:a.length,close:function(){n.close()},pick:function(){s.pick()},data:o})),n.options.closeOnUnfocus)&&(h.on("blur",this.onBlur=function(){T=setTimeout(function(){n.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(T)}));return h.on("scroll",this.onScroll=function(){var t=h.getScrollInfo(),i=h.getWrapperElement().getBoundingClientRect(),e=v+x.top-t.top,o=e-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(y||(o+=l.offsetHeight),o<=i.top||o>=i.bottom)return n.close();l.style.top=e+"px",l.style.left=g+x.left-t.left+"px"}),t.on(l,"dblclick",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),s.pick())}),t.on(l,"click",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),n.options.completeOnSingleClick&&s.pick())}),t.on(l,"mousedown",function(){setTimeout(function(){h.focus()},20)}),t.signal(o,"select",a[this.selectedHint],l.childNodes[this.selectedHint]),!0}function l(t,i,e,n){if(t.async)t(i,n,e);else{var o=t(i,e);o&&o.then?o.then(n):n(o)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(i,e){var n=i.list[e];n.hint?n.hint(this.cm,i,n):this.cm.replaceRange(c(n),n.from||i.from,n.to||i.to,"complete"),t.signal(i,"pick",n),this.close()},cursorActivity:function(){this.debounce&&(s(this.debounce),this.debounce=0);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?i=n?this.data.list.length-1:0:i<0&&(i=n?0:this.data.list.length-1),this.selectedHint!=i){var o=this.hints.childNodes[this.selectedHint];o.className=o.className.replace(" "+e,""),(o=this.hints.childNodes[this.selectedHint=i]).className+=" "+e,o.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",{resolve:function(i,e){var n,o=i.getHelpers(e,"hint");if(o.length){var s=function(t,i,e){var n=function(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n0?i(t):o(s+1)})}(0)};return s.async=!0,s.supportsSelection=!0,s}return(n=i.getHelper(i.getCursor(),"hintWords"))?function(i){return t.hint.fromList(i,{words:n})}:t.hint.anyword?function(i,e){return t.hint.anyword(i,e)}:function(){}}}),t.registerHelper("hint","fromList",function(i,e){var n,o=i.getCursor(),s=i.getTokenAt(o),c=t.Pos(o.line,s.start),r=o;s.start,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)}); +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(W){"use strict";var I="CodeMirror-hint-active";function o(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}W.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},W.defineExtension("showHint",function(t){t=function(t,i,e){var n=t.options.hintOptions,o={};for(var s in l)o[s]=l[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);o.hint.resolve&&(o.hint=o.hint.resolve(t,i));return o}(this,this.getCursor("start"),t);var i=this.listSelections();if(!(1l.clientHeight+1,F=s.getScrollInfo();0k&&(l.style.width=k-5+"px",O-=S.right-S.left-k),l.style.left=(y=v.left-O-C)+"px"),N)for(var P=l.firstChild;P;P=P.nextSibling)P.style.paddingRight=s.display.nativeBarWidth+"px";return s.addKeyMap(this.keyMap=function(t,n){var o={Up:function(){n.moveFocus(-1)},Down:function(){n.moveFocus(1)},PageUp:function(){n.moveFocus(1-n.menuSize(),!0)},PageDown:function(){n.moveFocus(n.menuSize()-1,!0)},Home:function(){n.setFocus(0)},End:function(){n.setFocus(n.length-1)},Enter:n.pick,Tab:n.pick,Esc:n.close};/Mac/.test(navigator.platform)&&(o["Ctrl-P"]=function(){n.moveFocus(-1)},o["Ctrl-N"]=function(){n.moveFocus(1)});var i=t.options.customKeys,s=i?{}:o;function e(t,i){var e="string"!=typeof i?function(t){return i(t,n)}:o.hasOwnProperty(i)?o[i]:i;s[t]=e}if(i)for(var c in i)i.hasOwnProperty(c)&&e(c,i[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&e(c,r[c]);return s}(o,{moveFocus:function(t,i){e.changeActive(e.selectedHint+t,i)},setFocus:function(t){e.changeActive(t)},menuSize:function(){return e.screenAmount()},length:n.length,close:function(){o.close()},pick:function(){e.pick()},data:t})),o.options.closeOnUnfocus&&(s.on("blur",this.onBlur=function(){E=setTimeout(function(){o.close()},100)}),s.on("focus",this.onFocus=function(){clearTimeout(E)})),s.on("scroll",this.onScroll=function(){var t=s.getScrollInfo(),i=s.getWrapperElement().getBoundingClientRect(),e=w+F.top-t.top,n=e-(r.pageYOffset||(c.documentElement||c.body).scrollTop);if(H||(n+=l.offsetHeight),n<=i.top||n>=i.bottom)return o.close();l.style.top=e+"px",l.style.left=y+F.left-t.left+"px"}),W.on(l,"dblclick",function(t){var i=K(l,t.target||t.srcElement);i&&null!=i.hintId&&(e.changeActive(i.hintId),e.pick())}),W.on(l,"click",function(t){var i=K(l,t.target||t.srcElement);i&&null!=i.hintId&&(e.changeActive(i.hintId),o.options.completeOnSingleClick&&e.pick())}),W.on(l,"mousedown",function(){setTimeout(function(){s.focus()},20)}),this.scrollToActive(),W.signal(t,"select",n[this.selectedHint],l.childNodes[this.selectedHint]),!0}function r(t,i,e,n){var o;t.async?t(i,n,e):(o=t(i,e))&&o.then?o.then(n):n(o)}o.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&W.signal(this.data,"close"),this.widget&&this.widget.close(),W.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,i){var e=t.list[i],n=this;this.cm.operation(function(){e.hint?e.hint(n.cm,t,e):n.cm.replaceRange(B(e),e.from||t.from,e.to||t.to,"complete"),W.signal(t,"pick",e),n.cm.scrollIntoView()}),this.close()},cursorActivity:function(){this.debounce&&(c(this.debounce),this.debounce=0);var t=this.startPos;this.data&&(t=this.data.from);var i,e=this.cm.getCursor(),n=this.cm.getLine(e.line);e.line!=this.startPos.line||n.length-e.ch!=this.startLen-this.startPos.ch||e.ch=this.data.list.length?t=i?this.data.list.length-1:0:t<0&&(t=i?0:this.data.list.length-1),this.selectedHint!=t&&((e=this.hints.childNodes[this.selectedHint])&&(e.className=e.className.replace(" "+I,"")),(e=this.hints.childNodes[this.selectedHint=t]).className+=" "+I,this.scrollToActive(),W.signal(this.data,"select",this.data.list[this.selectedHint],e))},scrollToActive:function(){var t=this.completion.options.scrollMargin||0,i=this.hints.childNodes[Math.max(0,this.selectedHint-t)],e=this.hints.childNodes[Math.min(this.data.list.length-1,this.selectedHint+t)],n=this.hints.firstChild;i.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=e.offsetTop+e.offsetHeight-this.hints.clientHeight+n.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},W.registerHelper("hint","auto",{resolve:function(t,i){var e,c=t.getHelpers(i,"hint");if(c.length){var n=function(t,n,o){var s=function(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};W.defineOption("hintOptions",null)}); diff --git a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js index 4b8190141..8db3fbaf2 100644 --- a/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js +++ b/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var e=t.Pos;t.registerHelper("hint","xml",function(r,s){var n=s&&s.schemaInfo,a=s&&s.quoteChar||'"';if(n){var i=r.getCursor(),o=r.getTokenAt(i);o.end>i.ch&&(o.end=i.ch,o.string=o.string.slice(0,i.ch-o.start));var l=t.innerMode(r.getMode(),o.state);if("xml"==l.mode.name){var f,g,c=[],h=!1,p=/\btag\b/.test(o.type)&&!/>$/.test(o.string),u=p&&/^\w/.test(o.string);if(u){var d=r.getLine(i.line).slice(Math.max(0,o.start-2),o.start),m=/<\/$/.test(d)?"close":/<$/.test(d)?"open":null;m&&(g=o.start-("close"==m?2:1))}else p&&"<"==o.string?m="open":p&&"")}else{var w=(y=n[l.state.tagName])&&y.attrs,I=n["!attrs"];if(!w&&!I)return;if(w){if(I){var P={};for(var A in I)I.hasOwnProperty(A)&&(P[A]=I[A]);for(var A in w)w.hasOwnProperty(A)&&(P[A]=w[A]);w=P}}else w=I;if("string"==o.type||"="==o.string){var M,N=(d=r.getRange(e(i.line,Math.max(0,i.ch-60)),e(i.line,"string"==o.type?o.start:o.end))).match(/([^\s\u00a0=<>\"\']+)=$/);if(!N||!w.hasOwnProperty(N[1])||!(M=w[N[1]]))return;if("function"==typeof M&&(M=M.call(this,r)),"string"==o.type){f=o.string;var $=0;/['"]/.test(o.string.charAt(0))&&(a=o.string.charAt(0),f=o.string.slice(1),$++);var C=o.string.length;/['"]/.test(o.string.charAt(C-1))&&(a=o.string.charAt(C-1),f=o.string.substr($,C-2)),h=!0}for(O=0;Oi.ch&&(o.end=i.ch,o.string=o.string.slice(0,i.ch-o.start)),(p=H.innerMode(t.getMode(),o.state)).mode.xmlCurrentTag){var a,l,g,c=[],f=!1,h=/\btag\b/.test(o.type)&&!/>$/.test(o.string),u=h&&/^\w/.test(o.string);u?(M=t.getLine(i.line).slice(Math.max(0,o.start-2),o.start),(g=/<\/$/.test(M)?"close":/<$/.test(M)?"open":null)&&(l=o.start-("close"==g?2:1))):h&&"<"==o.string?g="open":h&&"")}else{var b=(v=d&&r[d.name])&&v.attrs,O=r["!attrs"];if(!b&&!O)return;if(b){if(O){var w={};for(var A in O)O.hasOwnProperty(A)&&(w[A]=O[A]);for(var A in b)b.hasOwnProperty(A)&&(w[A]=b[A]);b=w}}else b=O;if("string"==o.type||"="==o.string){var M,P,$,I,T,j=(M=t.getRange(R(i.line,Math.max(0,i.ch-60)),R(i.line,"string"==o.type?o.start:o.end))).match(/([^\s\u00a0=<>\"\']+)=$/);if(!j||!b.hasOwnProperty(j[1])||!(P=b[j[1]]))return;"function"==typeof P&&(P=P.call(this,t)),"string"==o.type&&(a=o.string,$=0,/['"]/.test(o.string.charAt(0))&&(n=o.string.charAt(0),a=o.string.slice(1),$++),I=o.string.length,/['"]/.test(o.string.charAt(I-1))&&(n=o.string.charAt(I-1),a=o.string.substr($,I-2)),!$||(T=t.getLine(i.line)).length>o.end&&T.charAt(o.end)==n&&o.end++,f=!0);var q=function(t){if(t)for(var e=0;e=0;c--){var h=o[c].head;t.replaceRange("",r(h.line,h.ch-1),r(h.line,h.ch+1),"+delete")}},Enter:function(t){var r=s(t),i=r&&n(r,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var a=t.listSelections(),o=0;o1&&f.indexOf(i)>=0&&t.getRange(r(m.line,m.ch-2),m)==i+i){if(m.ch>2&&/\bstring/.test(t.getTokenTypeAt(r(m.line,m.ch-2))))return e.Pass;p="addFour"}else if(h){var C=0==m.ch?" ":t.getRange(r(m.line,m.ch-1),m);if(e.isWordChar(b)||C==i||e.isWordChar(C))return e.Pass;p="both"}else{if(!u||!(t.getLine(m.line).length==m.ch||(x=b,P=o,void 0,k=P.lastIndexOf(x),k>-1&&k%2==1)||/\s/.test(b)))return e.Pass;p="both"}else p=!h||(S=m,void 0,O=(y=t).getTokenAt(r(S.line,S.ch+1)),!/\bstring/.test(O.type)||O.start!=S.ch||0!=S.ch&&/\bstring/.test(y.getTokenTypeAt(S)))?f.indexOf(i)>=0&&t.getRange(m,r(m.line,m.ch+3))==i+i+i?"skipThree":"skip":"both";if(c){if(c!=p)return e.Pass}else c=p}var x,P,k;var y,S,O;var R=l%2?o.charAt(l-1):i,A=l%2?i:o.charAt(l+1);t.operation(function(){if("skip"==c)t.execCommand("goCharRight");else if("skipThree"==c)for(var n=0;n<3;n++)t.execCommand("goCharRight");else if("surround"==c){for(var i=t.getSelections(),n=0;n0,{anchor:new r(a.anchor.line,a.anchor.ch+(o?-1:1)),head:new r(a.head.line,a.head.ch+(o?1:-1))});t.setSelections(i)}else"both"==c?(t.replaceSelection(R+A,null),t.triggerElectric(R+A),t.execCommand("goCharLeft")):"addFour"==c&&(t.replaceSelection(R+R+R+R,"before"),t.execCommand("goCharRight"));var a,o})}(i,t)}}function s(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var n=e.getRange(r(t.line,t.ch-1),r(t.line,t.ch+1));return 2==n.length?n:null}a(t.pairs+"`")}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(C){var r={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},x=C.Pos;function P(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:r[t]}C.defineOption("autoCloseBrackets",!1,function(e,t,r){r&&r!=C.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(n(P(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=k(e);if(!t||e.getOption("disableInput"))return C.Pass;for(var r=P(t,"pairs"),n=e.listSelections(),i=0;i",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function i(t,e,i){var c=t.getLineHandle(e.line),o=e.ch-1,l=i&&i.afterCursor;null==l&&(l=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var h=!l&&o>=0&&r[c.text.charAt(o)]||r[c.text.charAt(++o)];if(!h)return null;var s=">"==h.charAt(1)?1:-1;if(i&&i.strict&&s>0!=(o==e.ch))return null;var u=t.getTokenTypeAt(n(e.line,o+1)),f=a(t,n(e.line,o+(s>0?1:0)),s,u||null,i);return null==f?null:{from:n(e.line,o),to:f&&f.pos,match:f&&f.ch==h.charAt(0),forward:s>0}}function a(t,e,i,a,c){for(var o=c&&c.maxScanLineLength||1e4,l=c&&c.maxScanLines||1e3,h=[],s=c&&c.bracketRegex?c.bracketRegex:/[(){}[\]]/,u=i>0?Math.min(e.line+l,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-l),f=e.line;f!=u;f+=i){var m=t.getLine(f);if(m){var g=i>0?0:m.length-1,d=i>0?m.length:-1;if(!(m.length>o))for(f==e.line&&(g=e.ch-(i<0?1:0));g!=d;g+=i){var k=m.charAt(g);if(s.test(k)&&(void 0===a||t.getTokenTypeAt(n(f,g+1))==a))if(">"==r[k].charAt(1)==i>0)h.push(k);else{if(!h.length)return{pos:n(f,g),ch:k};h.pop()}}}}return f-i!=(i>0?t.lastLine():t.firstLine())&&null}function c(t,r,a){for(var c=t.state.matchBrackets.maxHighlightLineLength||1e3,o=[],l=t.listSelections(),h=0;h",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function v(t){return t&&t.bracketRegex||/[(){}[\]]/}function u(t,e,n){var r=t.getLineHandle(e.line),i=e.ch-1,c=n&&n.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var a=v(n),o=!c&&0<=i&&a.test(r.text.charAt(i))&&p[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&p[r.text.charAt(++i)];if(!o)return null;var l=">"==o.charAt(1)?1:-1;if(n&&n.strict&&0c))for(h==e.line&&(f=e.ch-(n<0?1:0));f!=m;f+=n){var g=u.charAt(f);if(l.test(g)&&(void 0===r||t.getTokenTypeAt(k(h,f+1))==r)){var d=p[g];if(d&&">"==d.charAt(1)==0'"]=function(o){return function(o){if(o.getOption("disableInput"))return e.Pass;for(var i=o.listSelections(),s=[],l=o.getOption("autoCloseTags"),d=0;dc.ch&&(v=v.slice(0,v.length-f.end+c.ch));var b=v.toLowerCase();if(!v||"string"==f.type&&(f.end!=c.ch||!/[\"\']/.test(f.string.charAt(f.string.length-1))||1==f.string.length)||"tag"==f.type&&"closeTag"==u.type||f.string.indexOf("/")==f.string.length-1||h&&a(h,b)>-1||r(o,v,c,u,!0))return e.Pass;var y=p&&a(p,b)>-1;s[d]={indent:y,text:">"+(y?"\n\n":"")+"",newPos:y?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var x="object"==typeof l&&l.dontIndentOnAutoClose,d=i.length-1;d>=0;d--){var P=s[d];o.replaceRange(P.text,i[d].head,i[d].anchor,"+insert");var T=o.listSelections().slice(0);T[d]={head:P.newPos,anchor:P.newPos},o.setSelections(T),!x&&P.indent&&(o.indentLine(P.newPos.line,null,!0),o.indentLine(P.newPos.line+1,null,!0))}}(o)}),i.addKeyMap(d)}});var t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function o(t,n){for(var o=t.listSelections(),a=[],i=n?"/":""!=t.getLine(f.line).charAt(g.end)&&(c+=">"),a[d]=c}if(t.replaceSelections(a),o=t.listSelections(),!l)for(d=0;d'"]=function(e){if(e.getOption("disableInput"))return y.Pass;for(var t=e.listSelections(),n=[],o=e.getOption("autoCloseTags"),r=0;ra.ch&&(c=c.slice(0,c.length-i.end+a.ch));var m=c.toLowerCase();if(!c||"string"==i.type&&(i.end!=a.ch||!/[\"\']/.test(i.string.charAt(i.string.length-1))||1==i.string.length)||"tag"==i.type&&d.close||i.string.indexOf("/")==a.ch-i.start-1||g&&-1",newPos:y.Pos(a.line,a.ch+2)}:(h=u&&-1"+(h?"\n\n":"")+"",newPos:h?y.Pos(a.line+1,0):y.Pos(a.line,a.ch+1)})}for(var C="object"==typeof o&&o.dontIndentOnAutoClose,r=t.length-1;0<=r;r--){var b=n[r];e.replaceRange(b.text,t[r].head,t[r].anchor,"+insert");var v=e.listSelections().slice(0);v[r]={head:b.newPos,anchor:b.newPos},e.setSelections(v),!C&&b.indent&&(e.indentLine(b.newPos.line,null,!0),e.indentLine(b.newPos.line+1,null,!0))}}),e.addKeyMap(o))});var x=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function r(e,t){for(var n=e.listSelections(),o=[],r=t?"/":""!=e.getLine(s.line).charAt(d.end)&&(g+=">"),o[l]=g}if(e.replaceSelections(o),n=e.listSelections(),!i)for(l=0;l=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(o(e))continue;return}if(f(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n+1}}function a(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(l(e))continue;return}if(f(e,n+1)){r.lastIndex=n,e.ch=n;var t=r.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function s(e){for(;;){r.lastIndex=e.ch;var n=r.exec(e.text);if(!n){if(o(e))continue;return}if(f(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}function h(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(l(e))continue;return}if(f(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n}}function F(e,t){for(var i=[];;){var r,u=s(e),f=e.line,o=e.ch-(u?u[0].length:0);if(!u||!(r=c(e)))return;if("selfClose"!=r)if(u[1]){for(var l=i.length-1;l>=0;--l)if(i[l]==u[2]){i.length=l;break}if(l<0&&(!t||t==u[2]))return{tag:u[2],from:n(f,o),to:n(e.line,e.ch)}}else i.push(u[2])}}function x(e,t){for(var i=[];;){var r=h(e);if(!r)return;if("selfClose"!=r){var u=e.line,f=e.ch,o=a(e);if(!o)return;if(o[1])i.push(o[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==o[2]){i.length=l;break}if(l<0&&(!t||t==o[2]))return{tag:o[2],from:n(e.line,e.ch),to:n(u,f)}}}else a(e)}}e.registerHelper("fold","xml",function(e,i){for(var r=new u(e,i.line,0);;){var f=s(r);if(!f||r.line!=i.line)return;var o=c(r);if(!o)return;if(!f[1]&&"selfClose"!=o){var l=n(r.line,r.ch),a=F(r,f[2]);return a&&t(a.from,l)>0?{from:l,to:a.from}:null}}}),e.findMatchingTag=function(e,i,r){var f=new u(e,i.line,i.ch,r);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var o=c(f),l=o&&n(f.line,f.ch),s=o&&a(f);if(o&&s&&!(t(f,i)>0)){var h={from:n(f.line,f.ch),to:l,tag:s[2]};return"selfClose"==o?{open:h,close:null,at:"open"}:s[1]?{open:x(f,s[2]),close:h,at:"close"}:{open:h,close:F(f=new u(e,l.line,l.ch,r),s[2]),at:"open"}}}},e.findEnclosingTag=function(e,n,t,i){for(var r=new u(e,n.line,n.ch,t);;){var f=x(r,i);if(!f)break;var o=F(new u(e,n.line,n.ch,t),f.tag);if(o)return{open:f,close:o}}},e.scanForClosingTag=function(e,n,t,i){return F(new u(e,n.line,n.ch,i?{from:0,to:i}:null),t)}}); +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var l=e.Pos;function c(e,n){return e.line-n.line||e.ch-n.ch}var n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("<(/?)(["+n+"][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function a(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?Math.max(i.from,e.firstLine()):e.firstLine(),this.max=i?Math.min(i.to-1,e.lastLine()):e.lastLine()}function s(e,n){var t=e.cm.getTokenTypeAt(l(e.line,n));return t&&/\btag\b/.test(t)}function r(e){return!(e.line>=e.max)&&(e.ch=0,e.text=e.cm.getLine(++e.line),1)}function h(e){return!(e.line<=e.min)&&(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,1)}function F(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(r(e))continue;return}if(s(e,n+1)){var t=e.text.lastIndexOf("/",n),i=-1",e.ch-1):-1;if(-1==n){if(h(e))continue;return}if(s(e,n+1)){var t=e.text.lastIndexOf("/",n),i=-1")||-1!=i.text.indexOf("<")){var r=F(i),u=r&&l(i.line,i.ch),f=r&&x(i);if(r&&f&&!(050&&r.shift()}function i(t){return r[r.length-(t?Math.min(t,1):1)]||""}var l=null;function a(t,e,i,a,c){null==c&&(c=t.getRange(e,i)),"grow"==a&&l&&l.cm==t&&n(e,l.pos)&&t.isClean(l.gen)?function(t){if(!r.length)return o(t);r[r.length-1]+=t}(c):!1!==a&&o(c),t.replaceRange("",e,i,"+delete"),l="grow"==a?{cm:t,pos:e,gen:t.changeGeneration()}:null}function c(t,e,n){return t.findPosH(e,n,"char",!0)}function u(t,e,n){return t.findPosH(e,n,"word",!0)}function f(t,e,n){return t.findPosV(e,n,"line",t.doc.sel.goalColumn)}function s(t,e,n){return t.findPosV(e,n,"page",t.doc.sel.goalColumn)}function g(t,n,r){for(var o=n.line,i=t.getLine(o),l=/\S/.test(r<0?i.slice(0,n.ch):i.slice(n.ch)),a=t.firstLine(),c=t.lastLine();;){if((o+=r)c)return t.clipPos(e(o-r,r<0?0:null));if(i=t.getLine(o),/\S/.test(i))l=!0;else if(l)return e(o,0)}}function C(t,n,r){for(var o=n.line,i=n.ch,l=t.getLine(n.line),a=!1;;){var c=l.charAt(i+(r<0?-1:0));if(c){if(a&&/[!?.]/.test(c))return e(o,i+(r>0?1:0));a||(a=/\w/.test(c)),i+=r}else{if(o==(r<0?t.firstLine():t.lastLine()))return e(o,i);if(l=t.getLine(o+r),!/\S/.test(l))return e(o,i);o+=r,i=r<0?l.length:0}}}function d(t,r,o){var i;if(t.findMatchingBracket&&(i=t.findMatchingBracket(r,{strict:!0}))&&i.match&&(i.forward?1:-1)==o)return o>0?e(i.to.line,i.to.ch+1):i.to;for(var l=!0;;l=!1){var a=t.getTokenAt(r),c=e(r.line,o<0?a.start:a.end);if(!(l&&o>0&&a.end==r.ch)&&/\w/.test(a.string))return c;var u=t.findPosH(c,o,"char");if(n(c,u))return r;r=u}}function p(t,e){var n=t.state.emacsPrefix;return n?(L(t),"-"==n?-1:Number(n)):e?null:1}function h(t){var e="string"==typeof t?function(e){e.execCommand(t)}:t;return function(t){var n=p(t);e(t);for(var r=1;r1&&"+input"==e.origin){for(var r=e.text.join("\n"),o="",i=1;i1&&r.pop(),i()),"around","paste")},"Ctrl-Space":k,"Ctrl-Shift-2":k,"Ctrl-F":m(c,1),"Ctrl-B":m(c,-1),Right:m(c,1),Left:m(c,-1),"Ctrl-D":function(t){A(t,c,1,!1)},Delete:function(t){S(t,!1)||A(t,c,1,!1)},"Ctrl-H":function(t){A(t,c,-1,!1)},Backspace:function(t){S(t,!1)||A(t,c,-1,!1)},"Alt-F":m(u,1),"Alt-B":m(u,-1),"Alt-D":function(t){A(t,u,1,"grow")},"Alt-Backspace":function(t){A(t,u,-1,"grow")},"Ctrl-N":m(f,1),"Ctrl-P":m(f,-1),Down:m(f,1),Up:m(f,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":m(s,-1),"Ctrl-V":m(s,1),PageUp:m(s,-1),PageDown:m(s,1),"Ctrl-Up":m(g,-1),"Ctrl-Down":m(g,1),"Alt-A":m(C,-1),"Alt-E":m(C,1),"Alt-K":function(t){A(t,C,1,"grow")},"Ctrl-Alt-K":function(t){A(t,d,1,"grow")},"Ctrl-Alt-Backspace":function(t){A(t,d,-1,"grow")},"Ctrl-Alt-F":m(d,1),"Ctrl-Alt-B":m(d,-1),"Shift-Ctrl-Alt-2":function(t){var e=t.getCursor();t.setSelection(v(t,e,d,1),e)},"Ctrl-Alt-T":function(t){var e=d(t,t.getCursor(),-1),n=d(t,e,1),r=d(t,n,1),o=d(t,r,-1);t.replaceRange(t.getRange(o,r)+t.getRange(n,o)+t.getRange(e,n),e,r)},"Ctrl-Alt-U":h(function(t){for(var n=t.getCursor(),r=n.line,o=n.ch,i=[];r>=t.firstLine();){for(var l=t.getLine(r),a=null==o?l.length:o;a>0;)if(")"==(o=l.charAt(--a)))i.push("(");else if("]"==o)i.push("[");else if("}"==o)i.push("{");else if(/[\(\{\[]/.test(o)&&(!i.length||i.pop()!=o))return t.extendSelection(e(r,a));--r,o=null}}),"Alt-Space":function(t){for(var n=t.getCursor(),r=n.ch,o=n.ch,i=t.getLine(n.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;o0)return t.setCursor(o-1);n="Goto line",r=function(e){var n;e&&!isNaN(n=Number(e))&&n==(0|n)&&n>0&&t.setCursor(n-1)},(e=t).openDialog?e.openDialog(n+': ',r,{bottom:!0}):r(prompt(n,""))},"Ctrl-X Tab":function(t){t.indentSelection(p(t,!0)||t.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(t){t.setSelection(t.getCursor("head"),t.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":h("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(t){a(t,t.getCursor(),C(t,t.getCursor(),1),"grow")},"Ctrl-X H":"selectAll","Ctrl-Q Tab":h("insertTab"),"Ctrl-U":function(t){t.state.emacsPrefixMap=!0,t.addKeyMap(D),t.on("keyHandled",y),t.on("inputRead",y)}}),D={"Ctrl-G":L};function E(t){D[t]=function(e){P(e,t)},X["Ctrl-"+t]=function(e){P(e,t)},w["Ctrl-"+t]=!0}for(var H=0;H<10;++H)E(String(H));E("-")}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var c=t.Pos;function u(t,e){return t.line==e.line&&t.ch==e.ch}var i=[];function l(t){i.push(t),50=t.firstLine();){for(var i=t.getLine(n),l=null==r?i.length:r;0',r,{bottom:!0}):r(prompt(e,""))},"Ctrl-X Tab":function(t){t.indentSelection(p(t,!0)||t.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(t){t.setSelection(t.getCursor("head"),t.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":h("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(t){f(t,t.getCursor(),C(t,t.getCursor(),1),"grow")},"Ctrl-X H":"selectAll","Ctrl-Q Tab":h("insertTab"),"Ctrl-U":function(t){t.state.emacsPrefixMap=!0,t.addKeyMap(D),t.on("keyHandled",y),t.on("inputRead",y)},fallthrough:"default"}),D={"Ctrl-G":L};function E(e){D[e]=function(t){P(t,e)},X["Ctrl-"+e]=function(t){P(t,e)},w["Ctrl-"+e]=!0}for(var H=0;H<10;++H)E(String(H));E("-")}); diff --git a/plugins/tiddlywiki/codemirror-keymap-sublime-text/files/addons/comment/comment.js b/plugins/tiddlywiki/codemirror-keymap-sublime-text/files/addons/comment/comment.js index 57775035f..4e29a8cff 100644 --- a/plugins/tiddlywiki/codemirror-keymap-sublime-text/files/addons/comment/comment.js +++ b/plugins/tiddlywiki/codemirror-keymap-sublime-text/files/addons/comment/comment.js @@ -1,4 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE - -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var y={},E=/[^\s\u00a0]/,M=e.Pos;function s(e){var n=e.search(E);return-1==n?0:n}function S(e,n){var t=e.getMode();return!1!==t.useInnerComments&&t.innerMode?e.getModeAt(n):t}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e=e||y;for(var n=this,t=1/0,i=this.listSelections(),l=null,o=i.length-1;0<=o;o--){var r=i[o].from(),m=i[o].to();r.line>=t||(m.line>=t&&(m=M(t,0)),t=r.line,null==l?l=n.uncomment(r,m,e)?"un":(n.lineComment(r,m,e),"line"):"un"==l?n.uncomment(r,m,e):n.lineComment(r,m,e))}}),e.defineExtension("lineComment",function(o,e,r){r=r||y;var n,t,m,a,c,g,f=this,i=S(f,o),l=f.getLine(o.line);null!=l&&(n=o,t=l,!/\bstring\b/.test(f.getTokenTypeAt(M(n.line,0)))||/^[\'\"\`]/.test(t))&&((m=r.lineComment||i.lineComment)?(a=Math.min(0!=e.ch||e.line==o.line?e.line+1:e.line,f.lastLine()+1),c=null==r.padding?" ":r.padding,g=r.commentBlankLines||o.line==e.line,f.operation(function(){if(r.indent){for(var e=null,n=o.line;nt.length)&&(e=t)}for(n=o.line;nr||a.operation(function(){if(0!=o.fullLines){var e=E.test(a.getLine(r));a.replaceRange(m+f,M(r)),a.replaceRange(g+m,M(i.line,0));var n=o.blockCommentLead||c.blockCommentLead;if(null!=n)for(var t=i.line+1;t<=r;++t)t==r&&!e||a.replaceRange(n+m,M(t,0))}else a.replaceRange(f,l),a.replaceRange(g,i)})):(o.lineComment||c.lineComment)&&0!=o.fullLines&&a.lineComment(i,l,o)}),e.defineExtension("uncomment",function(e,n,t){t=t||y;var l,o=this,i=S(o,e),r=Math.min(0!=n.ch||n.line==e.line?n.line:n.line-1,o.lastLine()),m=Math.min(e.line,r),a=t.lineComment||i.lineComment,c=[],g=null==t.padding?" ":t.padding;e:if(a){for(var f=m;f<=r;++f){var s=o.getLine(f),d=s.indexOf(a);if(-1=t||(m.line>=t&&(m=E(t,0)),t=r.line,null==l?l=n.uncomment(r,m,e)?"un":(n.lineComment(r,m,e),"line"):"un"==l?n.uncomment(r,m,e):n.lineComment(r,m,e))}}),e.defineExtension("lineComment",function(o,e,r){r=r||S;var n,t,m,a,c,g,s=this,i=M(s,o),l=s.getLine(o.line);null!=l&&(n=o,t=l,!/\bstring\b/.test(s.getTokenTypeAt(E(n.line,0)))||/^[\'\"\`]/.test(t))&&((m=r.lineComment||i.lineComment)?(a=Math.min(0!=e.ch||e.line==o.line?e.line+1:e.line,s.lastLine()+1),c=null==r.padding?" ":r.padding,g=r.commentBlankLines||o.line==e.line,s.operation(function(){if(r.indent){for(var e=null,n=o.line;nt.length)&&(e=t)}for(n=o.line;na||g.operation(function(){if(0!=m.fullLines){var e=y.test(g.getLine(a));g.replaceRange(c+d,E(a)),g.replaceRange(f+c,E(o.line,0));var n=m.blockCommentLead||s.blockCommentLead;if(null!=n)for(var t=o.line+1;t<=a;++t)t==a&&!e||g.replaceRange(n+c,E(t,0))}else{var i=0==u(g.getCursor("to"),r),l=!g.somethingSelected();g.replaceRange(d,r),i&&g.setSelection(l?r:g.getCursor("from"),r),g.replaceRange(f,o)}})):(m.lineComment||s.lineComment)&&0!=m.fullLines&&g.lineComment(o,r,m)}),e.defineExtension("uncomment",function(e,n,t){t=t||S;var l,o=this,i=M(o,e),r=Math.min(0!=n.ch||n.line==e.line?n.line:n.line-1,o.lastLine()),m=Math.min(e.line,r),a=t.lineComment||i.lineComment,c=[],g=null==t.padding?" ":t.padding;e:if(a){for(var s=m;s<=r;++s){var f=o.getLine(s),d=f.indexOf(a);if(-10&&r.ch>=i.length)return t.clipPos(n(r.line+1,0));for(var l,a="start",s=r.ch,c=o<0?0:i.length,f=0;s!=c;s+=o,f++){var u=i.charAt(o<0?s-1:s),d="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==d&&u.toUpperCase()==u&&(d="W"),"start"==a)"o"!=d&&(a="in",l=d);else if("in"==a&&l!=d){if("w"==l&&"W"==d&&o<0&&s--,"W"==l&&"w"==d&&o>0){l="w";continue}break}}return n(r.line,s)}(t.doc,o.head,r):r<0?o.from():o.to()})}function o(t,r){if(t.isReadOnly())return e.Pass;t.operation(function(){for(var e=t.listSelections().length,o=[],i=-1,l=0;l=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},t.scrollLineDown=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},t.splitSelectionByLine=function(e){for(var t=e.listSelections(),r=[],o=0;oi.line&&a==l.line&&0==l.ch||r.push({anchor:a==i.line?i:n(a,0),head:a==l.line?l:n(a)});e.setSelections(r,0)},t.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},t.selectLine=function(e){for(var t=e.listSelections(),r=[],o=0;o=0;a--){var c=r[o[a]];if(!(s&&e.cmpPos(c.head,s)>0)){var f=i(t,c.head);s=f.from,t.replaceRange(n(f.word),f.from,f.to)}}})}function u(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var o=i(t,n);if(!o.word)return;n=o.from,r=o.to}return{from:n,to:r,query:t.getRange(n,r),word:o}}function d(e,t){var r=u(e);if(r){var o=r.query,i=e.getSearchCursor(o,t?r.to:r.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(o,t?n(e.firstLine(),0):e.clipPos(n(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):r.word&&e.setSelection(r.from,r.to))}}t.selectScope=function(e){s(e)||e.execCommand("selectAll")},t.selectBetweenBrackets=function(t){if(!s(t))return e.Pass},t.goToBracket=function(t){t.extendSelectionsBy(function(r){var o=t.scanForBracket(r.head,1);if(o&&0!=e.cmpPos(o.pos,r.head))return o.pos;var i=t.scanForBracket(r.head,-1);return i&&n(i.pos.line,i.pos.ch+1)||r.head})},t.swapLineUp=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),o=[],i=t.firstLine()-1,l=[],a=0;ai?o.push(c,f):o.length&&(o[o.length-1]=f),i=f}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+a,n(t.lastLine()),null,"+swapLine"):t.replaceRange(a+"\n",n(i,0),null,"+swapLine")}t.setSelections(l),t.scrollIntoView()})},t.swapLineDown=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),o=[],i=t.lastLine()+1,l=r.length-1;l>=0;l--){var a=r[l],s=a.to().line+1,c=a.from().line;0!=a.to().ch||a.empty()||s--,s=0;e-=2){var r=o[e],i=o[e+1],l=t.getLine(r);r==t.lastLine()?t.replaceRange("",n(r-1),n(r),"+swapLine"):t.replaceRange("",n(r,0),n(r+1,0),"+swapLine"),t.replaceRange(l+"\n",n(i,0),null,"+swapLine")}t.scrollIntoView()})},t.toggleCommentIndented=function(e){e.toggleComment({indent:!0})},t.joinLines=function(e){for(var t=e.listSelections(),r=[],o=0;o=0;i--){var l=r[i].head,a=t.getRange({line:l.line,ch:0},l),s=e.countColumn(a,null,t.getOption("tabSize")),c=t.findPosH(l,-1,"char",!1);if(a&&!/\S/.test(a)&&s%o==0){var f=new n(l.line,e.findColumn(a,s-o,o));f.ch!=l.ch&&(c=f)}t.replaceRange("",c,l,"+delete")}})},t.delLineRight=function(e){e.operation(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange("",t[r].anchor,n(t[r].to().line),"+delete");e.scrollIntoView()})},t.upcaseAtCursor=function(e){f(e,function(e){return e.toUpperCase()})},t.downcaseAtCursor=function(e){f(e,function(e){return e.toLowerCase()})},t.setSublimeMark=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},t.selectToSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},t.deleteToSublimeMark=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),o=n;if(e.cmpPos(r,o)>0){var i=o;o=r,r=i}t.state.sublimeKilled=t.getRange(r,o),t.replaceRange("",r,o)}},t.swapWithSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},t.sublimeYank=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},t.showInCenter=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},t.findUnder=function(e){d(e,!0)},t.findUnderPrevious=function(e){d(e,!1)},t.findAllUnder=function(e){var t=u(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],o=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&o++;e.setSelections(r,o)}};var m=e.keyMap;m.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F9:"sortLines","Cmd-F9":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},e.normalizeKeyMap(m.macSublime),m.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Ctrl-F9":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},e.normalizeKeyMap(m.pcSublime);var h=m.default==m.macDefault;m.sublime=h?m.macSublime:m.pcSublime}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(u){"use strict";var r=u.commands,d=u.Pos;function t(t,n){t.extendSelectionsBy(function(e){return t.display.shift||t.doc.extend||e.empty()?function(e,t,n){if(n<0&&0==t.ch)return e.clipPos(d(t.line-1));var r=e.getLine(t.line);if(0=r.length)return e.clipPos(d(t.line+1,0));for(var o,i="start",l=t.ch,a=l,s=n<0?0:r.length;a!=s;a+=n,0){var c=r.charAt(n<0?a-1:a),f="_"!=c&&u.isWordChar(c)?"w":"o";if("w"==f&&c.toUpperCase()==c&&(f="W"),"start"==i)"o"!=f?(i="in",o=f):l=a+n;else if("in"==i&&o!=f){if("w"==o&&"W"==f&&n<0&&a--,"W"==o&&"w"==f&&0=t&&e.execCommand("goLineUp")),e.scrollTo(null,n.top-e.defaultTextHeight())},r.scrollLineDown=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top,"local")+1,e.getCursor().line<=t&&e.execCommand("goLineDown")),e.scrollTo(null,n.top+e.defaultTextHeight())},r.splitSelectionByLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.line&&l==i.line&&0==i.ch||n.push({anchor:l==o.line?o:d(l,0),head:l==i.line?i:d(l)});e.setSelections(n,0)},r.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},r.selectLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.lastLine()?o.replaceRange("\n"+r,d(o.lastLine()),null,"+swapLine"):o.replaceRange(r+"\n",d(n,0),null,"+swapLine")}o.setSelections(l),o.scrollIntoView()})},r.swapLineDown=function(o){if(o.isReadOnly())return u.Pass;for(var e=o.listSelections(),i=[],t=o.lastLine()+1,n=e.length-1;0<=n;n--){var r=e[n],l=r.to().line+1,a=r.from().line;0!=r.to().ch||r.empty()||l--,l",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",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:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",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:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",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:"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",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",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:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",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:"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:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{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:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",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:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},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:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",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",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!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:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{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",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",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"}],r=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],n=e.Pos;e.Vim=function(){function o(t,r){var n;this==e.keyMap.vim&&(e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&(function(e){var t=e.state.fatCursorMarks;if(t)for(var r=0;r")}(t);if(!n)return!1;var o=e.Vim.findKey(r,n);return"function"==typeof o&&e.signal(r,"vim-keypress",n),o}}e.defineOption("vimMode",!1,function(t,r,n){r&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!r&&n!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")});var c={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},u={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function h(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(G(e.getCursor(),0,1)),Q.enterInsertMode(e,{},t))}),t.onPasteFn}var p=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],d=[function(e){return/\S/.test(e)}];function m(e,t){for(var r=[],n=e;n"]),C=[].concat(g,v,y,["-",'"',".",":","/"]);function w(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function M(e){return/^[a-z]$/.test(e)}function x(e){return/^[A-Z]$/.test(e)}function S(e){return/^\s*$/.test(e)}function A(e){return-1!=".?!".indexOf(e)}function b(e,t){for(var r=0;rr?t=r:t0?1:-1,u=i.getCursor();do{if((s=o[(e+(t+=c))%e])&&(l=s.find())&&!te(u,l))break}while(tn)}return s}}},K=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function N(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=K()}function P(e){return e.state.vim||(e.state.vim={inputState:new _,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function j(){for(var e in O={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:I(),macroModeState:new N,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new V({}),searchHistoryController:new D,exCommandHistoryController:new D},L){var t=L[e];t.value=t.defaultValue}}N.prototype={exitMacroRecordMode:function(){var e=O.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=O.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var H={buildKeyMap:function(){},getRegisterController:function(){return O.registerController},resetVimGlobalState_:j,getVimGlobalState_:function(){return O},maybeInitVimState_:P,suppressErrorLogging:!1,InsertModeKey:ze,map:function(e,t,r){Ve.map(e,t,r)},unmap:function(e,t){Ve.unmap(e,t)},setOption:R,getOption:E,defineOption:T,defineEx:function(e,t,r){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;We[e]=r,Ve.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if("function"==typeof n)return n()},findKey:function(r,n,o){var i,a=P(r);function s(){var e=O.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),F(r),!0;"mapping"!=o&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=O.registerController.getRegister(r);n&&n.pushText(t)}}(e,n)}}function l(){if(""==n)return F(r),a.visualMode?fe(r):a.insertMode&&De(r),!0}return!1===(i=a.insertMode?function(){if(l())return!0;for(var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n,o=1==n.length,i=U.matchCommand(e,t,a.inputState,"insert");e.length>1&&"full"!=i.type;){e=a.inputState.keyBuffer=e.slice(1);var s=U.matchCommand(e,t,a.inputState,"insert");"none"!=s.type&&(i=s)}if("none"==i.type)return F(r),!1;if("partial"==i.type)return B&&window.clearTimeout(B),B=window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer&&F(r)},E("insertModeEscKeysTimeout")),!o;if(B&&window.clearTimeout(B),o){for(var c=r.listSelections(),u=0;u|<\w+>|./.exec(t),n=o[0],t=t.substring(o.index+n.length),e.Vim.handleKey(r,n,"mapping")}(i.toKeys):U.processCommand(r,a,i)}catch(t){throw r.state.vim=void 0,P(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Ve.processCommand(e,t)},defineMotion:function(e,t){J[e]=t},defineAction:function(e,t){Q[e]=t},defineOperator:function(e,t){q[e]=t},mapCommand:function(e,t,r,n,o){var i={keys:e,type:t};for(var a in i[t]=r,i[t+"Args"]=n,o)i[a]=o[a];Ue(i)},_mapCommand:Ue,defineRegister:function(e,t){var r=O.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,C.push(e)},exitVisualMode:fe,exitInsertMode:De};function _(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function F(t,r){t.state.vim.inputState=new _,e.signal(t,"vim-command-done",r)}function W(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function V(e){this.registers=e,this.unnamedRegister=e['"']=new W,e["."]=new W,e[":"]=new W,e["/"]=new W}function D(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}_.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},_.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},W.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(K(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},V.prototype={pushText:function(e,t,r,n,o){n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var i=this.isValidRegister(e)?this.getRegister(e):null;if(i)x(e)?i.pushText(r,n):i.setText(r,n,o),this.unnamedRegister.setText(i.toString(),n);else{switch(t){case"yank":this.registers[0]=new W(r,n,o);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new W(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new W(r,n))}this.unnamedRegister.setText(r,n,o)}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new W),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&b(e,C)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},D.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var o=this.iterator+n;t?o>=0:o=r.length?(this.iterator=r.length,this.initialPrefix):o<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var U={matchCommand:function(e,t,r,n){var o,i=function(e,t,r,n){for(var o,i=[],a=[],s=0;s"==o.keys.slice(-11)){var l=function(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"":r="\n";break;case"":r=" ";break;default:r=""}return r}(e);if(!l)return{type:"none"};r.selectedCharacter=l}return{type:"full",command:o}},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)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=Z(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);F(e)}n.operator=r.operator,n.operatorArgs=Z(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=Z(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(),i=!!o,a=Z(r.actionArgs)||{};n.selectedCharacter&&(a.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),a.repeat=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,F(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),Q[r.action](e,a,t)},processSearch:function(t,r,n){if(t.getSearchCursor){var o=n.searchArgs.forward,i=n.searchArgs.wholeWordOnly;Ae(t).setReversed(!o);var a=o?"/":"?",s=Ae(t).getQuery(),l=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var c=O.macroModeState;c.isPlaying?f(p=c.replaySearchQueries.shift(),!0,!1):Ie(t,{onClose:function(e){t.scrollTo(l.left,l.top),f(e,!0,!0);var r=O.macroModeState;r.isRecording&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=O.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}(r,e)},prefix:a,desc:Be,onKeyUp:function(r,n,i){var a,s,c,u=e.keyName(r);"Up"==u||"Down"==u?(a="Up"==u,s=r.target?r.target.selectionEnd:0,i(n=O.searchHistoryController.nextMatch(n,a)||""),s&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(s,r.target.value.length))):"Left"!=u&&"Right"!=u&&"Ctrl"!=u&&"Alt"!=u&&"Shift"!=u&&O.searchHistoryController.reset();try{c=Ke(t,n,!0,!0)}catch(r){}c?t.scrollIntoView(Pe(t,!o,c),30):(je(t),t.scrollTo(l.left,l.top))},onKeyDown:function(r,n,o){var i=e.keyName(r);"Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==n?(O.searchHistoryController.pushInput(n),O.searchHistoryController.reset(),Ke(t,s),je(t),t.scrollTo(l.left,l.top),e.e_stop(r),F(t),o(),t.focus()):"Up"==i||"Down"==i?e.e_stop(r):"Ctrl-U"==i&&(e.e_stop(r),o(""))}});break;case"wordUnderCursor":var u=me(t,!1,0,!1,!0),h=!0;if(u||(u=me(t,!1,0,!1,!1),h=!1),!u)return;var p=t.getLine(u.start.line).substring(u.start.ch,u.end.ch);p=h&&i?"\\b"+p+"\\b":p.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),O.jumpList.cachedCursor=t.getCursor(),t.setCursor(u.start),f(p,!0,!1)}}function f(e,o,i){O.searchHistoryController.pushInput(e),O.searchHistoryController.reset();try{Ke(t,e,o,i)}catch(r){return Oe(t,"Invalid regex: "+e),void F(t)}U.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}},processEx:function(t,r,n){function o(e){O.exCommandHistoryController.pushInput(e),O.exCommandHistoryController.reset(),Ve.processCommand(t,e)}function i(r,n,o){var i,a,s=e.keyName(r);("Esc"==s||"Ctrl-C"==s||"Ctrl-["==s||"Backspace"==s&&""==n)&&(O.exCommandHistoryController.pushInput(n),O.exCommandHistoryController.reset(),e.e_stop(r),F(t),o(),t.focus()),"Up"==s||"Down"==s?(e.e_stop(r),i="Up"==s,a=r.target?r.target.selectionEnd:0,o(n=O.exCommandHistoryController.nextMatch(n,i)||""),a&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(a,r.target.value.length))):"Ctrl-U"==s?(e.e_stop(r),o("")):"Left"!=s&&"Right"!=s&&"Ctrl"!=s&&"Alt"!=s&&"Shift"!=s&&O.exCommandHistoryController.reset()}"keyToEx"==n.type?Ve.processCommand(t,n.exArgs.input):r.visualMode?Ie(t,{onClose:o,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):Ie(t,{onClose:o,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r,o,i,a,s=t.inputState,l=s.motion,c=s.motionArgs||{},u=s.operator,h=s.operatorArgs||{},p=s.registerName,f=t.sel,d=ee(t.visualMode?z(e,f.head):e.getCursor("head")),m=ee(t.visualMode?z(e,f.anchor):e.getCursor("anchor")),g=ee(d),v=ee(m);if(u&&this.recordLastEdit(t,s),(i=void 0!==s.repeatOverride?s.repeatOverride:s.getRepeat())>0&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===i)&&(i=1,c.repeatIsExplicit=!1),s.selectedCharacter&&(c.selectedCharacter=h.selectedCharacter=s.selectedCharacter),c.repeat=i,F(e),l){var y=J[l](e,d,c,t);if(t.lastMotion=J[l],!y)return;if(c.toJumplist){var k=O.jumpList,C=k.cachedCursor;C?(ge(e,C,y),delete k.cachedCursor):ge(e,d,y)}y instanceof Array?(o=y[0],r=y[1]):r=y,r||(r=ee(d)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=z(e,r,t.visualBlock)),o&&(o=z(e,o,!0)),o=o||v,f.anchor=o,f.head=r,he(e),Me(e,t,"<",re(o,r)?o:r),Me(e,t,">",re(o,r)?r:o)):u||(r=z(e,r),e.setCursor(r.line,r.ch))}if(u){if(h.lastSel){o=v;var w=h.lastSel,M=Math.abs(w.head.line-w.anchor.line),x=Math.abs(w.head.ch-w.anchor.ch);r=w.visualLine?n(v.line+M,v.ch):w.visualBlock?n(v.line+M,v.ch+x):w.head.line==w.anchor.line?n(v.line,v.ch+x):n(v.line+M,v.ch),t.visualMode=!0,t.visualLine=w.visualLine,t.visualBlock=w.visualBlock,f=t.sel={anchor:o,head:r},he(e)}else t.visualMode&&(h.lastSel={anchor:ee(f.anchor),head:ee(f.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var A,b,L,T,R;if(t.visualMode){if(A=ne(f.head,f.anchor),b=oe(f.head,f.anchor),L=t.visualLine||h.linewise,R=pe(e,{anchor:A,head:b},T=t.visualBlock?"block":L?"line":"char"),L){var E=R.ranges;if("block"==T)for(var B=0;B0&&i&&S(i);i=o.pop())r.line--,r.ch=0;i?(r.line--,r.ch=ae(e,r.line)):r.ch=0}}(e,A,b),R=pe(e,{anchor:A,head:b},T="char",!c.inclusive||L)}e.setSelections(R.ranges,R.primary),t.lastMotion=null,h.repeat=i,h.registerName=p,h.linewise=L;var K=q[u](e,h,R.ranges,v,r);t.visualMode&&fe(e,null!=K),K&&e.setCursor(K)}},recordLastEdit:function(e,t,r){var n=O.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1)}},J={moveToTopLine:function(e,t,r){var o=He(e).top+r.repeat-1;return n(o,de(e.getLine(o)))},moveToMiddleLine:function(e){var t=He(e),r=Math.floor(.5*(t.top+t.bottom));return n(r,de(e.getLine(r)))},moveToBottomLine:function(e,t,r){var o=He(e).bottom-r.repeat+1;return n(o,de(e.getLine(o)))},expandToLine:function(e,t,r){return n(t.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Ae(e),o=n.getQuery();if(o){var i=!r.forward;return i=n.isReversed()?!i:i,Ne(e,o),Pe(e,i,o,r.repeat)}},goToMark:function(e,t,r,n){var o=_e(e,n,r.selectedCharacter);return o?r.linewise?{line:o.line,ch:de(e.getLine(o.line))}:o:null},moveToOtherHighlightedEnd:function(e,t,r,o){if(o.visualBlock&&r.sameLine){var i=o.sel;return[z(e,n(i.anchor.line,i.head.ch)),z(e,n(i.head.line,i.anchor.ch))]}return[o.sel.head,o.sel.anchor]},jumpToMark:function(e,t,r,o){for(var i=t,a=0;au&&i.line==u?this.moveToEol(e,t,r,o):(r.toFirstChar&&(a=de(e.getLine(l)),o.lastHPos=a),o.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,o){var i=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(i,"div").left}var a=r.repeat;if((l=e.findPosV(i,r.forward?a:-a,"line",o.lastHSPos)).hitSide)if(r.forward)var s={top:e.charCoords(l,"div").top+8,left:o.lastHSPos},l=e.coordsChar(s,"div");else{var c=e.charCoords(n(e.firstLine(),0),"div");c.left=o.lastHSPos,l=e.coordsChar(c,"div")}return o.lastHPos=l.ch,l},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 xe(e,t,r.repeat,n)},moveBySentence:function(e,t,r){var o=r.forward?1:-1;return function(e,t,r,o){function i(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!w(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}function a(e,t,r,n){var o=e.getLine(t),a=""===o,s={line:o,ln:t,pos:r,dir:n},l={ln:s.ln,pos:s.pos},c=""===s.line;for(i(e,s);null!==s.line;){if(l.ln=s.ln,l.pos=s.pos,""===s.line&&!c)return{ln:s.ln,pos:s.pos};if(a&&""!==s.line&&!S(s.line[s.pos]))return{ln:s.ln,pos:s.pos};!A(s.line[s.pos])||a||s.pos!==s.line.length-1&&!S(s.line[s.pos+1])||(a=!0),i(e,s)}var o=e.getLine(l.ln);l.pos=0;for(var u=o.length-1;u>=0;--u)if(!S(o[u])){l.pos=u;break}return l}function s(e,t,r,n){var o=e.getLine(t),a={line:o,ln:t,pos:r,dir:n},s={ln:a.ln,pos:null},l=""===a.line;for(i(e,a);null!==a.line;){if(""===a.line&&!l)return null!==s.pos?s:{ln:a.ln,pos:a.pos};if(A(a.line[a.pos])&&null!==s.pos&&(a.ln!==s.ln||a.pos+1!==s.pos))return s;""===a.line||S(a.line[a.pos])||(l=!1,s={ln:a.ln,pos:a.pos}),i(e,a)}var o=e.getLine(s.ln);s.pos=0;for(var c=0;c0;)l=o<0?s(e,l.ln,l.pos,o):a(e,l.ln,l.pos,o),r--;return n(l.ln,l.pos)}(e,t,r.repeat,o)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),i=null,a=r.repeat;a||(a=o.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");if(r.repeat=a,!(i=J.moveByDisplayLines(e,t,r,n)))return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-s.top),i},moveByWords:function(e,t,r){return function(e,t,r,o,i,a){var s=ee(t),l=[];(o&&!i||!o&&i)&&r++;for(var c=!(o&&i),u=0;u0)h.index=0;else{var m=h.lineText.length;h.index=m>0?m-1:0}h.nextCh=h.lineText.charAt(h.index)}d(h)&&(i.line=c,i.ch=h.index,t--)}return h.nextCh||h.curMoveThrough?n(c,h.index):i}(e,r.repeat,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,o){var i,a,s,l=r.repeat;return o.lastHPos=l-1,o.lastHSPos=e.charCoords(t,"div").left,a=l,s=(i=e).getCursor().line,z(i,n(s,a-1))},moveToEol:function(e,t,r,o){var i=t;o.lastHPos=1/0;var a=n(i.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,o.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return n(r.line,de(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){for(var r,o=t,i=o.line,a=o.ch,s=e.getLine(i);aa.ch||i.line>a.line){var h=i;i=a,a=h}return o?a.ch+=1:i.ch+=1,{start:i,end:a}}(e,t,i,d);else if({"'":!0,'"':!0}[i])a=function(e,t,r,o){var i,a,s,l,c=ee(t),u=e.getLine(c.line).split(""),h=u.indexOf(r);if(c.ch-1&&!i;s--)u[s]==r&&(i=s+1);else i=c.ch+1;if(i&&!a)for(s=i,l=u.length;st.lastLine()&&r.linewise&&!d?t.replaceRange("",f,u):t.replaceRange("",c,u),r.linewise&&(d||(t.setCursor(f),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),i=c}O.registerController.pushText(r.registerName,"change",a,r.linewise,o.length>1),Q.enterInsertMode(t,{head:i},t.state.vim)},delete:function(e,t,r){var o,i,a=e.state.vim;if(a.visualBlock){i=e.getSelection();var s=$("",r.length);e.replaceSelections(s),o=r[0].anchor}else{var l=r[0].anchor,c=r[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=n(l.line-1,ae(e,l.line-1))),i=e.getRange(l,c),e.replaceRange("",l,c),o=l,t.linewise&&(o=J.moveToFirstNonWhiteSpaceCharacter(e,l))}return O.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),z(e,o,a.insertMode)},indent:function(e,t,r){var n=e.state.vim,o=r[0].anchor.line,i=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&i--;for(var s=o;s<=i;s++)for(var l=0;lc.top?(l.line+=(s-c.top)/o,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u=a.anchor.line?G(a.head,0,1):n(a.anchor.line,0);else if("inplace"==i&&o.visualMode)return;t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),O.macroModeState.isPlaying||(t.on("change",$e),e.on(t.getInputField(),"keydown",Ze)),o.visualMode&&fe(t),ce(t,s,l)}},toggleVisualMode:function(t,r,o){var i,a=r.repeat,s=t.getCursor();o.visualMode?o.visualLine^r.linewise||o.visualBlock^r.blockwise?(o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),he(t)):fe(t):(o.visualMode=!0,o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,i=z(t,n(s.line,s.ch+a-1),!0),o.sel={anchor:s,head:i},e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),he(t),Me(t,o,"<",ne(s,i)),Me(t,o,">",oe(s,i)))},reselectLastSelection:function(t,r,n){var o=n.lastSelection;if(n.visualMode&&ue(t,n),o){var i=o.anchorMark.find(),a=o.headMark.find();if(!i||!a)return;n.sel={anchor:i,head:a},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,he(t),Me(t,n,"<",ne(i,a)),Me(t,n,">",oe(i,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var o,i;if(r.visualMode){if(o=e.getCursor("anchor"),re(i=e.getCursor("head"),o)){var a=i;i=o,o=a}i.ch=ae(e,i.line)-1}else{var s=Math.max(t.repeat,2);o=e.getCursor(),i=z(e,n(o.line+s-1,1/0))}for(var l=0,c=o.line;c1&&(y=Array(t.repeat+1).join(y));var k,C,w,M,x,S,A,b,L,T,R=u.linewise,E=u.blockwise;if(R)r.visualMode?y=r.visualLine?y.slice(0,-1):"\n"+y.slice(0,y.length-1)+"\n":t.after?(y="\n"+y.slice(0,y.length-1),c.ch=ae(e,c.line)):c.ch=0;else{if(E){y=y.split("\n");for(var B=0;Be.lastLine()&&e.replaceRange("\n",n(F,0)),ae(e,F)u.length&&(i=u.length),a=n(l.line,i)}if("\n"==s)o.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var h=t.getRange(l,a);if(h=h.replace(/[^\n]/g,s),o.visualBlock){var p=new Array(t.getOption("tabSize")+1).join(" ");h=(h=t.getSelection()).replace(/\t/g,p).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(h)}else t.replaceRange(h,l,a);o.visualMode?(l=re(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),fe(t,!1)):t.setCursor(G(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,o,i,a,s=e.getCursor(),l=e.getLine(s.line),c=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=c.exec(l))&&(i=(o=r.index)+r[0].length,!(s.ch"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function Y(e,t,r){return function(){for(var n=0;n2&&(t=ne.apply(void 0,Array.prototype.slice.call(arguments,1))),re(e,t)?e:t}function oe(e,t){return arguments.length>2&&(t=oe.apply(void 0,Array.prototype.slice.call(arguments,1))),re(e,t)?t:e}function ie(e,t,r){var n=re(e,t),o=re(t,r);return n&&o}function ae(e,t){return e.getLine(t).length}function se(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function le(e,t){var r=[],o=e.listSelections(),i=ee(e.clipPos(t)),a=!te(t,i),s=function(e,t,r){for(var n=0;ns?c:0,h=o[u].anchor,p=Math.min(h.line,i.line),f=Math.max(h.line,i.line),d=h.ch,m=i.ch,g=o[u].head.ch-d,v=m-d;g>0&&v<=0?(d++,a||m--):g<0&&v>=0?(d--,l||m++):g<0&&-1==v&&(d--,m++);for(var y=p;y<=f;y++){var k={anchor:new n(y,d),head:new n(y,m)};r.push(k)}return e.setSelections(r),t.ch=m,h.ch=d,h}function ce(e,t,r){for(var n=[],o=0;oc&&(i.line=c),i.ch=ae(e,i.line)}return{ranges:[{anchor:a,head:i}],primary:0}}if("block"==r){for(var u=Math.min(a.line,i.line),h=Math.min(a.ch,i.ch),p=Math.max(a.line,i.line),f=Math.max(a.ch,i.ch)+1,d=p-u+1,m=i.line==u?0:d-1,g=[],v=0;v=c.length)return null;o?h=d[0]:(h=f[0])(c.charAt(u))||(h=f[1]);for(var p=u,m=u;h(c.charAt(p))&&p=0;)m--;if(m++,t){for(var g=p;/\s/.test(c.charAt(p))&&p0;)m--;m||(m=v)}}return{start:n(l.line,m),end:n(l.line,p)}}function ge(e,t,r){te(t,r)||O.jumpList.add(e,t,r)}function ve(e,t){O.lastCharacterSearch.increment=e,O.lastCharacterSearch.forward=t.forward,O.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var ye={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},ke={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 0===e.index&&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="m"===e.symb?"{":"}",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("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};function Ce(e,t,r,n,o){var i=t.line,a=t.ch,s=e.getLine(i),l=r?1:-1,c=n?d:f;if(o&&""==s){if(i+=l,s=e.getLine(i),!w(e,i))return null;a=r?0:s.length}for(;;){if(o&&""==s)return{from:0,to:0,line:i};for(var u=l>0?s.length:-1,h=u,p=u;a!=u;){for(var m=!1,g=0;g0?0:s.length}}function we(e,t,r,o){for(var i,a=e.getCursor(),s=a.ch,l=0;l0;)p(u,o)&&r--,u+=o;return new n(u,0)}var f=e.state.vim;if(f.visualLine&&p(s,1,!0)){var d=f.sel.anchor;p(d.line,-1,!0)&&(i&&d.line==s||(s+=1))}var m=h(s);for(u=s;u<=c&&r;u++)p(u,1,!0)&&(i&&h(u)==m||r--);for(a=new n(u,0),u>c&&!m?m=!0:i=!1,u=s;u>l&&(i&&h(u)!=m&&u!=s||!p(u,-1,!0));u--);return{start:new n(u,0),end:a}}function Se(){}function Ae(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function be(e,t){var r=Le(e,t)||[];if(!r.length)return[];var n=[];if(0===r[0]){for(var o=0;o'+t+"",{bottom:!0,duration:5e3}):alert(t)}var Be="(Javascript regexp)";function Ie(e,t){var r,n,o,i,a,s,l,c,u=(t.prefix||"")+" "+(t.desc||""),h=(r=t.prefix,n=t.desc,o=''+(r||"")+'',n&&(o+=' '+n+""),o);i=e,a=h,s=u,l=t.onClose,c=t,i.openDialog?i.openDialog(a,l,{bottom:!0,value:c.value,onKeyDown:c.onKeyDown,onKeyUp:c.onKeyUp,selectValueOnOpen:!1}):l(prompt(s,""))}function Ke(e,t,r,n){if(t){var o=Ae(e),i=Ee(t,!!r,!!n);if(i)return Ne(e,i),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e
";if(r){r=r.join("");for(var i=0;i")}else for(var a in n){var s=n[a].toString();s.length&&(o+='"'+a+" "+s+"
")}Oe(e,o)},sort:function(t,r){var o,i,a,s,l,c=function(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(o=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!n&&!t.eol())return"Invalid arguments";if(n[1]){i=-1!=n[1].indexOf("i"),a=-1!=n[1].indexOf("u");var c=-1!=n[1].indexOf("d")||-1!=n[1].indexOf("n")&&1,u=-1!=n[1].indexOf("x")&&1,h=-1!=n[1].indexOf("o")&&1;if(c+u+h>1)return"Invalid arguments";s=(c?"decimal":u&&"hex")||h&&"octal"}n[2]&&(l=new RegExp(n[2].substr(1,n[2].length-2),i?"i":""))}}();if(c)Oe(t,c+": "+r.argString);else{var u=r.line||t.firstLine(),h=r.lineEnd||r.line||t.lastLine();if(u!=h){var p=n(u,0),f=n(h,ae(t,h)),d=t.getRange(p,f).split("\n"),m=l||("decimal"==s?/(-?)([\d]+)/:"hex"==s?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==s?/([0-7]+)/:null),g="decimal"==s?10:"hex"==s?16:"octal"==s?8:null,v=[],y=[];if(s||l)for(var k=0;k");if(n){var p=0,f=function(){if(p=r&&e<=s:e==r);)if(n||!h||a.from().line!=h.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),h=a.from(),void(u=!1);var e,r,s;u=!0}function m(e){if(e&&e(),t.focus(),h){t.setCursor(h);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=h.ch}c&&c()}if(d(),!u)return r?void Ie(t,{prefix:"replace with "+l+" (y/n/a/q/l)",onKeyDown:function(r,n,o){switch(e.e_stop(r),e.keyName(r)){case"Y":f(),d();break;case"N":d();break;case"A":var i=c;c=void 0,t.operation(p),c=i;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":m(o)}return u&&m(o),!0}}):(p(),void(c&&c()));Oe(t,"No matches for "+s.source)}(t,h,f,m,g,y,d,u,r.callback)}else Oe(t,"No previous substitute regular expression")},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){je(e)},yank:function(e){var t=ee(e.getCursor()).line,r=e.getLine(t);O.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(t,r){if(r.argString&&se(r.argString))for(var n=t.state.vim,o=new e.StringStream(se(r.argString));!o.eol();){o.eatSpace();var i=o.pos;if(!o.match(/[a-zA-Z]/,!1))return void Oe(t,"Invalid argument: "+r.argString.substring(i));var a=o.next();if(o.match("-",!0)){if(!o.match(/[a-zA-Z]/,!1))return void Oe(t,"Invalid argument: "+r.argString.substring(i));var s=a,l=o.next();if(!(M(s)&&M(l)||x(s)&&x(l)))return void Oe(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Oe(t,"Invalid argument: "+r.argString.substring(i));for(var h=0;h<=u-c;h++){var p=String.fromCharCode(c+h);delete n.marks[p]}}else delete n.marks[a]}else Oe(t,"Argument required")}},Ve=new Fe;function De(t){var r=t.state.vim,n=O.macroModeState,o=O.registerController.getRegister("."),i=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!i){for(var l=a.inVisualBlock&&r.lastSelection?r.lastSelection.visualBlock.height:1,c=a.changes,u=(s=[],0);u1&&(Ge(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&function(e){if(!e.isPlaying){var t=e.latestRegister,r=O.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}(n)}function Ue(e){t.unshift(e)}function Je(t,r,n,o){var i=O.registerController.getRegister(o);if(":"==o)return i.keyBuffer[0]&&Ve.processCommand(t,i.keyBuffer[0]),void(n.isPlaying=!1);var a=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l|<\w+>|./.exec(h))[0],h=h.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var p=i.insertModeChanges[s++].changes;O.macroModeState.lastInsertModeChanges.changes=p,Xe(t,p,1),De(t)}n.isPlaying=!1}function $e(e,t){var r=O.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=t.text.join("\n");n.maybeReset&&(n.changes=[],n.maybeReset=!1),e.state.overwrite&&!/\n/.test(o)?n.changes.push([o]):n.changes.push(o)}t=t.next}}function qe(t){var r=t.state.vim;if(r.insertMode){var n=O.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else t.curOp.isVimOp||function(t,r){var n=t.getCursor("anchor"),o=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?fe(t,!1):r.visualMode||r.insertMode||!t.somethingSelected()||(r.visualMode=!0,r.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"})),r.visualMode){var i=re(o,n)?0:-1,a=re(o,n)?-1:0;o=G(o,0,i),n=G(n,0,a),r.sel={anchor:n,head:o},Me(t,r,"<",ne(o,n)),Me(t,r,">",oe(o,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}(t,r);r.visualMode&&Qe(t)}function Qe(e){var t=e.state.vim,r=z(e,ee(t.sel.head)),n=G(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function ze(e){this.keyName=e}function Ze(t){var r=O.macroModeState.lastInsertModeChanges,n=e.keyName(t);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||e.lookupKey(n,"vim-insert",function(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new ze(n)),!0}))}function Ge(e,t,r,n){var o=O.macroModeState;o.isPlaying=!0;var i=!!t.lastEditActionCommand,a=t.inputState;function s(){i?U.processAction(e,t,t.lastEditActionCommand):U.evalInput(e,t)}function l(r){if(o.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=o.lastInsertModeChanges;Xe(e,n.changes,r)}}if(t.inputState=t.lastEditInputState,i&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",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:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",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:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",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:"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",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",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:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",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:"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:"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:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",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:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",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",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",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:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{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",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",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"}],Ye=Ge.length,et=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{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:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],tt=Ze.Pos;Ze.Vim=function(){function e(e,t){var r,n;this==Ze.keyMap.vim&&(Ze.rmClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&(a(r=e),r.off("cursorActivity",i),r.state.fatCursorMarks=null,e.getInputField().style.caretColor="")),t&&t.attach==o||((n=e).setOption("disableInput",!1),n.off("cursorActivity",Ue),Ze.off(n.getInputField(),"paste",c(n)),n.state.vim=null)}function o(e,t){var r,n;this==Ze.keyMap.vim&&(Ze.addClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&((r=e).state.fatCursorMarks=[],i(r),r.on("cursorActivity",i),e.getInputField().style.caretColor="transparent")),t&&t.attach==o||((n=e).setOption("disableInput",!0),n.setOption("showCursorWhenSelecting",!1),Ze.signal(n,"vim-mode-change",{mode:"normal"}),n.on("cursorActivity",Ue),E(n),Ze.on(n.getInputField(),"paste",c(n)))}function i(e){if(e.state.fatCursorMarks){a(e);for(var t=e.listSelections(),r=[],n=0;n"}(e);if(!r)return!1;var n=Ze.Vim.findKey(t,r);return"function"==typeof n&&Ze.signal(t,"vim-keypress",r),n}}Ze.defineOption("vimMode",!1,function(e,t,r){t&&"vim"!=e.getOption("keyMap")?e.setOption("keyMap","vim"):!t&&r!=Ze.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});var s={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},l={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function c(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(q(e.getCursor(),0,1)),U.enterInsertMode(e,{},t))}),t.onPasteFn}var u=/[\d]/,m=[Ze.isWordChar,function(e){return e&&!Ze.isWordChar(e)&&!/\s/.test(e)}],g=[function(e){return/\S/.test(e)}];function r(e,t){for(var r=[],n=e;n"]),d=[].concat(n,h,p,["-",'"',".",":","_","/"]);function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function k(e){return/^[A-Z]$/.test(e)}function B(e){return/^\s*$/.test(e)}function C(e){return-1!=".?!".indexOf(e)}function w(e,t){for(var r=0;r"==l&&(P(s),c.visualMode?le(s):c.insertMode&&We(s),1)}return!1===(e=(c.insertMode?function(){if(u())return!0;for(var e=c.inputState.keyBuffer=c.inputState.keyBuffer+l,t=1==l.length,r=F.matchCommand(e,Ge,c.inputState,"insert");1|<\w+>|./.exec(e),l=t[0],e=e.substring(t.index+l.length),Ze.Vim.handleKey(s,l,"mapping")}(e.toKeys):F.processCommand(s,c,e)}catch(e){throw s.state.vim=void 0,E(s),Ze.Vim.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){Fe.processCommand(e,t)},defineMotion:function(e,t){W[e]=t},defineAction:function(e,t){U[e]=t},defineOperator:function(e,t){D[e]=t},mapCommand:function(e,t,r,n,o){var i={keys:e,type:t};for(var a in i[t]=r,i[t+"Args"]=n,o)i[a]=o[a];Ve(i)},_mapCommand:Ve,defineRegister:function(e,t){var r=K.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,d.push(e)},exitVisualMode:le,exitInsertMode:We};function N(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function P(e,t){e.state.vim.inputState=new N,Ze.signal(e,"vim-command-done",t)}function _(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function j(e){this.registers=e,this.unnamedRegister=e['"']=new _,e["."]=new _,e[":"]=new _,e["/"]=new _}function H(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}N.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},N.prototype.getRepeat=function(){var e=0;return(0=r.length?(this.iterator=r.length,this.initialPrefix):o<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);-1"!=t.slice(-11))return e==t?"full":0==t.indexOf(e)&&"partial";var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)&&"partial"}}(e,l.keys))||("partial"==o&&i.push(l),"full"==o&&a.push(l))}return{partial:i.length&&i,full:a.length&&a}}(e,t,n,r);if(!o.full&&!o.partial)return{type:"none"};if(!o.full&&o.partial)return{type:"partial"};for(var i=0;i"==s.keys.slice(-11)){var l=function(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(1":r="\n";break;case"":r=" ";break;default:r=""}return r}(e);if(!l)return{type:"none"};r.selectedCharacter=l}return{type:"full",command:s}},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)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=$(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);P(e)}n.operator=r.operator,n.operatorArgs=$(r.operatorArgs),r.exitVisualBlock&&(t.visualBlock=!1,ae(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=$(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(),i=!!o,a=$(r.actionArgs)||{};n.selectedCharacter&&(a.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),a.repeat=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,P(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),U[r.action](e,a,t)},processSearch:function(s,n,o){if(s.getSearchCursor){var l=o.searchArgs.forward,e=o.searchArgs.wholeWordOnly;Ce(s).setReversed(!l);var t=l?"/":"?",i=Ce(s).getQuery(),c=s.getScrollInfo();switch(o.searchArgs.querySrc){case"prompt":var r=K.macroModeState;r.isPlaying?p(h=r.replaySearchQueries.shift(),!0,!1):Re(s,{onClose:function(e){s.scrollTo(c.left,c.top),p(e,!0,!0);var t=K.macroModeState;t.isRecording&&function(e,t){if(e.isPlaying)return;var r=e.latestRegister,n=K.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}(t,e)},prefix:t,desc:Te,onKeyUp:function(e,t,r){var n,o,i,a=Ze.keyName(e);"Up"==a||"Down"==a?(n="Up"==a,o=e.target?e.target.selectionEnd:0,r(t=K.searchHistoryController.nextMatch(t,n)||""),o&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(o,e.target.value.length))):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&K.searchHistoryController.reset();try{i=Ee(s,t,!0,!0)}catch(e){}i?s.scrollIntoView(Ie(s,!l,i),30):(Ke(s),s.scrollTo(c.left,c.top))},onKeyDown:function(e,t,r){var n=Ze.keyName(e);"Esc"==n||"Ctrl-C"==n||"Ctrl-["==n||"Backspace"==n&&""==t?(K.searchHistoryController.pushInput(t),K.searchHistoryController.reset(),Ee(s,i),Ke(s),s.scrollTo(c.left,c.top),Ze.e_stop(e),P(s),r(),s.focus()):"Up"==n||"Down"==n?Ze.e_stop(e):"Ctrl-U"==n&&(Ze.e_stop(e),r(""))}});break;case"wordUnderCursor":var a=ue(s,!1,0,!1,!0),u=!0;if(a||(a=ue(s,!1,0,!1,!1),u=!1),!a)return;var h=s.getLine(a.start.line).substring(a.start.ch,a.end.ch);h=u&&e?"\\b"+h+"\\b":h.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),K.jumpList.cachedCursor=s.getCursor(),s.setCursor(a.start),p(h,!0,!1)}}function p(t,e,r){K.searchHistoryController.pushInput(t),K.searchHistoryController.reset();try{Ee(s,t,e,r)}catch(e){return Le(s,"Invalid regex: "+t),void P(s)}F.processMotion(s,n,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:o.searchArgs.toJumplist}})}},processEx:function(a,e,t){function r(e){K.exCommandHistoryController.pushInput(e),K.exCommandHistoryController.reset(),Fe.processCommand(a,e)}function n(e,t,r){var n,o,i=Ze.keyName(e);("Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==t)&&(K.exCommandHistoryController.pushInput(t),K.exCommandHistoryController.reset(),Ze.e_stop(e),P(a),r(),a.focus()),"Up"==i||"Down"==i?(Ze.e_stop(e),n="Up"==i,o=e.target?e.target.selectionEnd:0,r(t=K.exCommandHistoryController.nextMatch(t,n)||""),o&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(o,e.target.value.length))):"Ctrl-U"==i?(Ze.e_stop(e),r("")):"Left"!=i&&"Right"!=i&&"Ctrl"!=i&&"Alt"!=i&&"Shift"!=i&&K.exCommandHistoryController.reset()}"keyToEx"==t.type?Fe.processCommand(a,t.exArgs.input):e.visualMode?Re(a,{onClose:r,prefix:":",value:"'<,'>",onKeyDown:n,selectValueOnOpen:!1}):Re(a,{onClose:r,prefix:":",onKeyDown:n})},evalInput:function(e,t){var r,n,o,i,a,s,l,c,u,h,p,f,d=t.inputState,m=d.motion,g=d.motionArgs||{},v=d.operator,y=d.operatorArgs||{},k=d.registerName,C=t.sel,w=z(t.visualMode?J(e,C.head):e.getCursor("head")),x=z(t.visualMode?J(e,C.anchor):e.getCursor("anchor")),M=z(w),S=z(x);if(v&&this.recordLastEdit(t,d),0<(n=void 0!==d.repeatOverride?d.repeatOverride:d.getRepeat())&&g.explicitRepeat?g.repeatIsExplicit=!0:(g.noRepeat||!g.explicitRepeat&&0===n)&&(n=1,g.repeatIsExplicit=!1),d.selectedCharacter&&(g.selectedCharacter=y.selectedCharacter=d.selectedCharacter),g.repeat=n,P(e),m){var A,b,L=W[m](e,w,g,t,d);if(t.lastMotion=W[m],!L)return;g.toJumplist&&((b=(A=K.jumpList).cachedCursor)?(he(e,b,L),delete A.cachedCursor):he(e,w,L)),s=(s=L instanceof Array?(r=L[0],L[1]):L)||z(w),t.visualMode?(t.visualBlock&&s.ch===1/0||(s=J(e,s)),r=(r=r&&J(e,r))||S,C.anchor=r,C.head=s,ae(e),ve(e,t,"<",Z(r,s)?r:s),ve(e,t,">",Z(r,s)?s:r)):v||(s=J(e,s),e.setCursor(s.line,s.ch))}if(v){if(y.lastSel?(r=S,o=y.lastSel,i=Math.abs(o.head.line-o.anchor.line),a=Math.abs(o.head.ch-o.anchor.ch),s=o.visualLine?tt(S.line+i,S.ch):o.visualBlock?tt(S.line+i,S.ch+a):o.head.line==o.anchor.line?tt(S.line,S.ch+a):tt(S.line+i,S.ch),t.visualMode=!0,t.visualLine=o.visualLine,t.visualBlock=o.visualBlock,C=t.sel={anchor:r,head:s},ae(e)):t.visualMode&&(y.lastSel={anchor:z(C.anchor),head:z(C.head),visualBlock:t.visualBlock,visualLine:t.visualLine}),t.visualMode){if(h=G(C.head,C.anchor),p=Y(C.head,C.anchor),l=t.visualLine||y.linewise,E=se(e,{anchor:h,head:p},c=t.visualBlock?"block":l?"line":"char"),l){var T=E.ranges;if("block"==c)for(var R=0;Rs:u.line=t.line.length){if(t.ln+=t.dir,!v(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=0"===i?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(tt(o,i),{bracketRegex:l}).to}return n},moveToStartOfLine:function(e,t){return tt(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")),tt(n,ce(e.getLine(n)))},textObjectManipulation:function(e,t,r,n){var o=r.selectedCharacter;"b"==o?o="(":"B"==o&&(o="{");var i=!r.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[o])s=function(e,t,r,n){var o,i,a=t,s={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],l={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],c=e.getLine(a.line).charAt(a.ch)===l?1:0;if(o=e.scanForBracket(tt(a.line,a.ch+c),-1,void 0,{bracketRegex:s}),i=e.scanForBracket(tt(a.line,a.ch+c),1,void 0,{bracketRegex:s}),!o||!i)return{start:a,end:a};{var u;o=o.pos,i=i.pos,(o.line==i.line&&o.ch>i.ch||o.line>i.line)&&(u=o,o=i,i=u)}n?i.ch+=1:o.ch+=1;return{start:o,end:i}}(e,t,o,i);else if({"'":!0,'"':!0,"`":!0}[o])s=function(e,t,r,n){var o,i,a,s,l=z(t),c=e.getLine(l.line).split(""),u=c.indexOf(r);l.che.lastLine()&&t.linewise&&!l?e.replaceRange("",s,h):e.replaceRange("",u,h),t.linewise&&(l||(e.setCursor(s),Ze.commands.newlineAndIndent(e)),u.ch=Number.MAX_VALUE),u);K.registerController.pushText(t.registerName,"change",n,t.linewise,1c.top?(l.line+=(s-c.top)/o,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s):(u=s+e.getScrollInfo().clientHeight)|<\w+>|./.exec(h),l=s[0],h=h.substring(s.index+l.length),Ze.Vim.handleKey(e,l,"macro"),t.insertMode&&(u=o.insertModeChanges[a++].changes,K.macroModeState.lastInsertModeChanges.changes=u,Xe(e,u,1),We(e))}r.isPlaying=!1}(e,r,i,n)},enterMacroRecordMode:function(e,t){var r=K.macroModeState,n=t.selectedCharacter;K.registerController.isValidRegister(n)&&r.enterMacroRecordMode(e,n)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ze.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ze.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,i=t.head||e.getCursor("head"),a=e.listSelections().length;if("eol"==n)i=tt(i.line,te(e,i.line));else if("bol"==n)i=tt(i.line,0);else if("charAfter"==n)i=q(i,0,1);else if("firstNonBlank"==n)i=W.moveToFirstNonWhiteSpaceCharacter(e,i);else if("startOfSelectedArea"==n){if(!r.visualMode)return;r.visualBlock?(i=tt(Math.min(o.head.line,o.anchor.line),Math.min(o.head.ch,o.anchor.ch)),a=Math.abs(o.head.line-o.anchor.line)+1):i=o.head.line=o.anchor.line?q(o.head,0,1):tt(o.anchor.line,0)}else if("inplace"==n){if(r.visualMode)return}else"lastEdit"==n&&(i=_e(e)||i);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ze.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ze.signal(e,"vim-mode-change",{mode:"insert"})),K.macroModeState.isPlaying||(e.on("change",De),Ze.on(e.getInputField(),"keydown",Qe)),r.visualMode&&le(e),oe(e,i,a)}},toggleVisualMode:function(e,t,r){var n,o=t.repeat,i=e.getCursor();r.visualMode?r.visualLine^t.linewise||r.visualBlock^t.blockwise?(r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,Ze.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),ae(e)):le(e):(r.visualMode=!0,r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,n=J(e,tt(i.line,i.ch+o-1)),r.sel={anchor:i,head:n},Ze.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),ae(e),ve(e,r,"<",G(i,n)),ve(e,r,">",Y(i,n)))},reselectLastSelection:function(e,t,r){var n=r.lastSelection;if(r.visualMode&&ie(e,r),n){var o=n.anchorMark.find(),i=n.headMark.find();if(!o||!i)return;r.sel={anchor:o,head:i},r.visualMode=!0,r.visualLine=n.visualLine,r.visualBlock=n.visualBlock,ae(e),ve(e,r,"<",G(o,i)),ve(e,r,">",Y(o,i)),Ze.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var n,o,i;r.visualMode?(o=e.getCursor("anchor"),Z(n=e.getCursor("head"),o)&&(l=n,n=o,o=l),n.ch=te(e,n.line)-1):(i=Math.max(t.repeat,2),o=e.getCursor(),n=J(e,tt(o.line+i-1,1/0)));for(var a=0,s=o.line;sn.lastLine()&&n.replaceRange("\n",tt(I,0)),te(n,I)n.length&&(o=n.length),tt(l.line,o));"\n"==s?(r.visualMode||e.replaceRange("",l,u),(Ze.commands.newlineAndIndentContinueComment||Ze.commands.newlineAndIndent)(e)):(a=(a=e.getRange(l,u)).replace(/[^\n]/g,s),r.visualBlock?(i=new Array(e.getOption("tabSize")+1).join(" "),a=(a=e.getSelection()).replace(/\t/g,i).replace(/[^\n]/g,s).split("\n"),e.replaceSelections(a)):e.replaceRange(a,l,u),r.visualMode?(l=Z(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,e.setCursor(l),le(e,!1)):e.setCursor(q(u,0,-1)))},incrementNumberToken:function(e,t){for(var r,n,o,i,a,s,l,c,u,h,p,f=e.getCursor(),d=e.getLine(f.line),m=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=m.exec(d))&&(o=(n=r.index)+r[0].length,!(f.cho&&(i.line=o),i.ch=te(e,i.line)),{ranges:[{anchor:a,head:i}],primary:0};if("block"==r){for(var c=Math.min(a.line,i.line),u=Math.min(a.ch,i.ch),h=Math.max(a.line,i.line),p=Math.max(a.ch,i.ch)+1,f=h-c+1,d=i.line==c?0:f-1,m=[],g=0;g=l.length)return null;n?u=g[0]:(u=m[0])(l.charAt(c))||(u=m[1]);for(var h=c,p=c;u(l.charAt(h))&&h'+t+"",{bottom:!0,duration:5e3}):alert(t)}var Te="(Javascript regexp)";function Re(e,t){var r,n,o,i,a,s,l,c,u=(t.prefix||"")+" "+(t.desc||""),h=(r=t.prefix,n=t.desc,o=''+(r||"")+'',n&&(o+=' '+n+""),o);i=e,a=h,s=u,l=t.onClose,c=t,i.openDialog?i.openDialog(a,l,{bottom:!0,value:c.value,onKeyDown:c.onKeyDown,onKeyUp:c.onKeyUp,selectValueOnOpen:!1}):l(prompt(s,""))}function Ee(e,t,r,n){if(t){var o=Ce(e),i=be(t,!!r,!!n);if(i)return Be(e,i),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n@~])/);return r.commandName=n?n[1]:t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),o=Pe(e,e.state.vim,n);if(!o)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,o.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var r,n=e.match(/^([+-])?(\d+)/);return n&&(r=parseInt(n[2],10),"-"==n[1]?t-=r:t+=r),t},parseCommandArgs_:function(e,t,r){var n,o;e.eol()||(t.argString=e.match(/.*/)[0],n=r.argDelimiter||/\s+/,(o=re(t.argString).split(n)).length&&o[0]&&(t.args=o))},matchCommand_:function(e){for(var t=e.length;0
";if(r)for(var r=r.join(""),i=0;i")}else for(var a in n){var s=n[a].toString();s.length&&(o+='"'+a+" "+s+"
")}Le(e,o)},sort:function(e,i){var a,s,l,c,u;var t=function(){if(i.argString){var e=new Ze.StringStream(i.argString);if(e.eat("!")&&(a=!0),e.eol())return;if(!e.eatSpace())return"Invalid arguments";var t=e.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!t&&!e.eol())return"Invalid arguments";if(t[1]){s=-1!=t[1].indexOf("i"),l=-1!=t[1].indexOf("u");var r=-1!=t[1].indexOf("d")||-1!=t[1].indexOf("n")&&1,n=-1!=t[1].indexOf("x")&&1,o=-1!=t[1].indexOf("o")&&1;if(1")}n?(l=0,(c=function(){var e;l"+r+" (y/n/a/q/l)",onKeyDown:function(e,t,r){switch(Ze.e_stop(e),Ze.keyName(e)){case"Y":p(),f();break;case"N":f();break;case"A":var n=l;l=void 0,o.operation(h),l=n;break;case"L":p();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":d(r)}return c&&d(r),!0}})}(t,d,m,s,l,u,a,f,e.callback)):Le(t,"No previous substitute regular expression")},redo:Ze.commands.redo,undo:Ze.commands.undo,write:function(e){Ze.commands.save?Ze.commands.save(e):e.save&&e.save()},nohlsearch:function(e){Ke(e)},yank:function(e){var t=z(e.getCursor()).line,r=e.getLine(t);K.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(e,t){if(t.argString&&re(t.argString))for(var r=e.state.vim,n=new Ze.StringStream(re(t.argString));!n.eol();){n.eatSpace();var o=n.pos;if(!n.match(/[a-zA-Z]/,!1))return void Le(e,"Invalid argument: "+t.argString.substring(o));var i=n.next();if(n.match("-",!0)){if(!n.match(/[a-zA-Z]/,!1))return void Le(e,"Invalid argument: "+t.argString.substring(o));var a=i,s=n.next();if(!(y(a)&&y(s)||k(a)&&k(s)))return void Le(e,"Invalid argument: "+a+"-");var l=a.charCodeAt(0),c=s.charCodeAt(0);if(c<=l)return void Le(e,"Invalid argument: "+t.argString.substring(o));for(var u=0;u<=c-l;u++){var h=String.fromCharCode(l+u);delete r.marks[h]}}else delete r.marks[i]}else Le(e,"Argument required")}},Fe=new je;function We(e){var t=e.state.vim,r=K.macroModeState,n=K.registerController.getRegister("."),o=r.isPlaying,i=r.lastInsertModeChanges;o||(e.off("change",De),Ze.off(e.getInputField(),"keydown",Qe)),!o&&1",Y(n,r))):t.insertMode||(t.lastHPos=e.getCursor().ch)}}(e,t);t.visualMode&&Je(e)}function Je(e){var t,r="cm-animate-fat-cursor",n=e.state.vim,o=J(e,z(n.sel.head)),i=q(o,0,1);$e(n),o.ch==e.getLine(o.line).length?((t=document.createElement("span")).textContent=" ",t.className=r,n.fakeCursorBookmark=e.setBookmark(o,{widget:t})):n.fakeCursor=e.markText(o,i,{className:r})}function $e(e){e.fakeCursor&&(e.fakeCursor.clear(),e.fakeCursor=null),e.fakeCursorBookmark&&(e.fakeCursorBookmark.clear(),e.fakeCursorBookmark=null)}function qe(e){this.keyName=e}function Qe(e){var t=K.macroModeState.lastInsertModeChanges,r=Ze.keyName(e);r&&(-1==r.indexOf("Delete")&&-1==r.indexOf("Backspace")||Ze.lookupKey(r,"vim-insert",function(){return t.maybeReset&&(t.changes=[],t.maybeReset=!1),t.changes.push(new qe(r)),!0}))}function ze(r,n,e,t){var o=K.macroModeState;o.isPlaying=!0;var i=!!n.lastEditActionCommand,a=n.inputState;function s(){i?F.processAction(r,n,n.lastEditActionCommand):F.evalInput(r,n)}function l(e){var t;00;i--)r.context=r.context.prev;return K(e,t,r)}function B(e){var t=e.current().toLowerCase();a=f.hasOwnProperty(t)?"atom":b.hasOwnProperty(t)?"keyword":"variable"}var T={top:function(e,t,r){if("{"==e)return q(r,t,"block");if("}"==e&&r.context.prev)return P(r);if(k&&/@component/i.test(e))return q(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return q(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return q(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return q(r,t,"at");if("hash"==e)a="builtin";else if("word"==e)a="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return q(r,t,"interpolation");if(":"==e)return"pseudo";if(y&&"("==e)return q(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"==e){var o=t.current().toLowerCase();return u.hasOwnProperty(o)?(a="property","maybeprop"):m.hasOwnProperty(o)?(a="string-2","maybeprop"):y?(a=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(a+=" error","maybeprop")}return"meta"==e?"block":y||"hash"!=e&&"qualifier"!=e?T.top(e,t,r):(a="error","block")},maybeprop:function(e,t,r){return":"==e?q(r,t,"prop"):K(e,t,r)},prop:function(e,t,r){if(";"==e)return P(r);if("{"==e&&y)return q(r,t,"propBlock");if("}"==e||"{"==e)return C(e,t,r);if("("==e)return q(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)B(t);else if("interpolation"==e)return q(r,t,"interpolation")}else a+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?P(r):"word"==e?(a="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?C(e,t,r):")"==e?P(r):"("==e?q(r,t,"parens"):"interpolation"==e?q(r,t,"interpolation"):("word"==e&&B(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(a="variable-3",r.context.type):K(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&s.hasOwnProperty(t.current())?(a="tag",r.context.type):T.atBlock(e,t,r)},atBlock:function(e,t,r){if("("==e)return q(r,t,"atBlock_parens");if("}"==e||";"==e)return C(e,t,r);if("{"==e)return P(r)&&q(r,t,y?"block":"top");if("interpolation"==e)return q(r,t,"interpolation");if("word"==e){var o=t.current().toLowerCase();a="only"==o||"not"==o||"and"==o||"or"==o?"keyword":c.hasOwnProperty(o)?"attribute":d.hasOwnProperty(o)?"property":p.hasOwnProperty(o)?"keyword":u.hasOwnProperty(o)?"property":m.hasOwnProperty(o)?"string-2":f.hasOwnProperty(o)?"atom":b.hasOwnProperty(o)?"keyword":"error"}return r.context.type},atComponentBlock:function(e,t,r){return"}"==e?C(e,t,r):"{"==e?P(r)&&q(r,t,y?"block":"top",!1):("word"==e&&(a="error"),r.context.type)},atBlock_parens:function(e,t,r){return")"==e?P(r):"{"==e||"}"==e?C(e,t,r,2):T.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,r){return"{"==e?q(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(a="variable","restricted_atBlock_before"):K(e,t,r)},restricted_atBlock:function(e,t,r){return"}"==e?(r.stateArg=null,P(r)):"word"==e?(a="@font-face"==r.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!g.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,r){return"word"==e?(a="variable","keyframes"):"{"==e?q(r,t,"top"):K(e,t,r)},at:function(e,t,r){return";"==e?P(r):"{"==e||"}"==e?C(e,t,r):("word"==e?a="tag":"hash"==e&&(a="builtin"),"at")},interpolation:function(e,t,r){return"}"==e?P(r):"{"==e||";"==e?C(e,t,r):("word"==e?a="variable":"variable"!=e&&"("!=e&&")"!=e&&(a="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:o?"block":"top",stateArg:null,context:new j(o?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||function(e,t){var r=e.next();if(l[r]){var o=l[r](e,t);if(!1!==o)return o}return"@"==r?(e.eatWhile(/[\w\\\-]/),v("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?v(null,"compare"):'"'==r||"'"==r?(t.tokenize=x(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),v("atom","hash")):"!"==r?(e.match(/^\s*\w*/),v("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),v("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?v(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?v("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?v(null,r):("u"==r||"U"==r)&&e.match(/rl(-prefix)?\(/i)||("d"==r||"D"==r)&&e.match("omain(",!0,!0)||("r"==r||"R"==r)&&e.match("egexp(",!0,!0)?(e.backUp(1),t.tokenize=z,v("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),v("property","word")):v(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),v("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?v("variable-2","variable-definition"):v("variable-2","variable")):e.match(/^\w+-/)?v("meta","meta"):void 0})(e,t);return r&&"object"==typeof r&&(i=r[1],r=r[0]),a=r,"comment"!=i&&(t.state=T[t.state](i,e,t)),a},indent:function(e,t){var r=e.context,o=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=o&&")"!=o||(r=r.prev),r.prev&&("}"!=o||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=o||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=o||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-n)):i=(r=r.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:w,fold:"brace"}});var r=["domain","regexp","url","url-prefix"],o=t(r),i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(i),n=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=t(n),s=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],c=t(s),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],p=t(d),u=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],m=t(u),h=t(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),g=t(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],f=t(b),y=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=t(y),k=r.concat(i).concat(n).concat(s).concat(d).concat(u).concat(b).concat(y);function v(e,t){for(var r,o=!1;null!=(r=e.next());){if(o&&"/"==r){t.tokenize=null;break}o="*"==r}return["comment","comment"]}e.registerHelper("hintWords","css",k),e.defineMIME("text/css",{documentTypes:o,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:p,nonStandardPropertyKeywords:m,fontProperties:h,counterDescriptors:g,colorKeywords:f,valueKeywords:w,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=v,v(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:p,nonStandardPropertyKeywords:m,colorKeywords:f,valueKeywords:w,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=v,v(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:p,nonStandardPropertyKeywords:m,colorKeywords:f,valueKeywords:w,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=v,v(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:o,mediaTypes:a,mediaFeatures:l,propertyKeywords:p,nonStandardPropertyKeywords:m,fontProperties:h,counterDescriptors:g,colorKeywords:f,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=v,v(e,t))}},name:"css",helperType:"gss"})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(T){"use strict";function e(e){for(var t={},r=0;r*\/]/.test(r)?(a="select-op",null):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?a="qualifier":/[:;{}\[\]\(\)]/.test(r)?v(null,r):e.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(e.current().toLowerCase())&&(t.tokenize=z),a="variable","variable callee"):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),a="word","property"):a=null:/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),a="unit","number"):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),a=e.match(/^\s*:/,!1)?"variable-definition":"variable","variable-2"):e.match(/^\w+-/)?a="meta":void 0})(e,t);return r&&"object"==typeof r&&(a=r[1],r=r[0]),i=r,"comment"!=a&&(t.state=_[t.state](a,e,t)),i},indent:function(e,t){var r=e.context,o=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=o&&")"!=o||(r=r.prev),r.prev&&("}"!=o||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=o||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=o||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-n)):i=(r=r.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:k,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],r=e(t),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(o),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme"],n=e(a),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],s=e(l),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],c=e(d),p=["border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],u=e(p),m=e(["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),b=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),g=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],h=e(g),f=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],k=e(f),y=t.concat(o).concat(a).concat(l).concat(d).concat(p).concat(g).concat(f);function w(e,t){for(var r,o=!1;null!=(r=e.next());){if(o&&"/"==r){t.tokenize=null;break}o="*"==r}return["comment","comment"]}T.registerHelper("hintWords","css",y),T.defineMIME("text/css",{documentTypes:r,mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:c,nonStandardPropertyKeywords:u,fontProperties:m,counterDescriptors:b,colorKeywords:h,valueKeywords:k,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css"}),T.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:c,nonStandardPropertyKeywords:u,colorKeywords:h,valueKeywords:k,fontProperties:m,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),T.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:c,nonStandardPropertyKeywords:u,colorKeywords:h,valueKeywords:k,fontProperties:m,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),T.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:i,mediaFeatures:n,propertyKeywords:c,nonStandardPropertyKeywords:u,fontProperties:m,counterDescriptors:b,colorKeywords:h,valueKeywords:k,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css",helperType:"gss"})}); diff --git a/plugins/tiddlywiki/codemirror-mode-htmlembedded/files/addon/mode/multiplex.js b/plugins/tiddlywiki/codemirror-mode-htmlembedded/files/addon/mode/multiplex.js index 24cd9fc5d..8a1257c83 100755 --- a/plugins/tiddlywiki/codemirror-mode-htmlembedded/files/addon/mode/multiplex.js +++ b/plugins/tiddlywiki/codemirror-mode-htmlembedded/files/addon/mode/multiplex.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(n){var i=Array.prototype.slice.call(arguments,1);function t(e,n,i,t){if("string"==typeof n){var r=e.indexOf(n,i);return t&&r>-1?r+n.length:r}var o=n.exec(i?e.slice(i):e);return o?o.index+i+(t?o[0].length:0):-1}return{startState:function(){return{outer:e.startState(n),innerActive:null,inner:null}},copyState:function(i){return{outer:e.copyState(n,i.outer),innerActive:i.innerActive,inner:i.innerActive&&e.copyState(i.innerActive.mode,i.inner)}},token:function(r,o){if(o.innerActive){var c=o.innerActive;a=r.string;if(!c.close&&r.sol())return o.innerActive=o.inner=null,this.token(r,o);if((v=c.close?t(a,c.close,r.pos,c.parseDelimiters):-1)==r.pos&&!c.parseDelimiters)return r.match(c.close),o.innerActive=o.inner=null,c.delimStyle&&c.delimStyle+" "+c.delimStyle+"-close";v>-1&&(r.string=a.slice(0,v));var l=c.mode.token(r,o.inner);return v>-1&&(r.string=a),v==r.pos&&c.parseDelimiters&&(o.innerActive=o.inner=null),c.innerStyle&&(l=l?l+" "+c.innerStyle:c.innerStyle),l}for(var s=1/0,a=r.string,u=0;u";return e.multiplexingMode(e.getMode(i,"htmlmixed"),{open:t.openComment||"<%--",close:d,delimStyle:"comment",mode:{token:function(e){return e.skipTo(d)||e.skipToEnd(),"comment"}}},{open:t.open||t.scriptStartRegex||"<%",close:t.close||t.scriptEndRegex||"%>",mode:e.getMode(i,t.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(d){"use strict";d.defineMode("htmlembedded",function(e,i){var t=i.closeComment||"--%>";return d.multiplexingMode(d.getMode(e,"htmlmixed"),{open:i.openComment||"<%--",close:t,delimStyle:"comment",mode:{token:function(e){return e.skipTo(t)||e.skipToEnd(),"comment"}}},{open:i.open||i.scriptStartRegex||"<%",close:i.close||i.scriptEndRegex||"%>",mode:d.getMode(e,i.scriptingModeSpec)})},"htmlmixed"),d.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),d.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),d.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),d.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}); diff --git a/plugins/tiddlywiki/codemirror-mode-htmlmixed/files/mode/htmlmixed/htmlmixed.js b/plugins/tiddlywiki/codemirror-mode-htmlmixed/files/mode/htmlmixed/htmlmixed.js index 5fb1173b0..6dd163e3f 100755 --- a/plugins/tiddlywiki/codemirror-mode-htmlmixed/files/mode/htmlmixed/htmlmixed.js +++ b/plugins/tiddlywiki/codemirror-mode-htmlmixed/files/mode/htmlmixed/htmlmixed.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],t):t(CodeMirror)}(function(t){"use strict";var e={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var a={};function n(t,e){var n,l=t.match(a[n=e]||(a[n]=new RegExp("\\s+"+n+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return l?/^\s*(.*?)\s*$/.exec(l[2])[1]:""}function l(t,e){return new RegExp((e?"^":"")+"","i")}function r(t,e){for(var a in t)for(var n=e[a]||(e[a]=[]),l=t[a],r=l.length-1;r>=0;r--)n.unshift(l[r])}t.defineMode("htmlmixed",function(a,o){var c=t.getMode(a,{name:"xml",htmlMode:!0,multilineTagIndentFactor:o.multilineTagIndentFactor,multilineTagIndentPastTag:o.multilineTagIndentPastTag}),i={},s=o&&o.tags,u=o&&o.scriptTypes;if(r(e,i),s&&r(s,i),u)for(var m=u.length-1;m>=0;m--)i.script.unshift(["type",u[m].matches,u[m].mode]);function d(e,r){var o,s=c.token(e,r.htmlState),u=/\btag\b/.test(s);if(u&&!/[<>\s\/]/.test(e.current())&&(o=r.htmlState.tagName&&r.htmlState.tagName.toLowerCase())&&i.hasOwnProperty(o))r.inTag=o+" ";else if(r.inTag&&u&&/>$/.test(e.current())){var m=/^([\S]+) (.*)/.exec(r.inTag);r.inTag=null;var p=">"==e.current()&&function(t,e){for(var a=0;a-1?a.backUp(r.length-o):r.match(/<\/?$/)&&(a.backUp(r.length),a.match(n,!1)||a.match(r)),l);var a,n,l,r,o},r.localMode=f,r.localState=t.startState(f,c.indent(r.htmlState,""))}else r.inTag&&(r.inTag+=e.current(),e.eol()&&(r.inTag+=" "));return s}return{startState:function(){return{token:d,inTag:null,localMode:null,localState:null,htmlState:t.startState(c)}},copyState:function(e){var a;return e.localState&&(a=t.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:a,htmlState:t.copyState(c,e.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(e,a,n){return!e.localMode||/^\s*<\//.test(a)?c.indent(e.htmlState,a):e.localMode.indent?e.localMode.indent(e.localState,a,n):t.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||c}}}},"xml","javascript","css"),t.defineMIME("text/html","htmlmixed")}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],t):t(CodeMirror)}(function(p){"use strict";var l={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var o={};function f(t,e){var a,n=t.match(o[a=e]||(o[a]=new RegExp("\\s+"+a+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function h(t,e){return new RegExp((e?"^":"")+"","i")}function r(t,e){for(var a in t)for(var n=e[a]||(e[a]=[]),l=t[a],o=l.length-1;0<=o;o--)n.unshift(l[o])}p.defineMode("htmlmixed",function(u,t){var m=p.getMode(u,{name:"xml",htmlMode:!0,multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag,allowMissingTagName:t.allowMissingTagName}),d={},e=t&&t.tags,a=t&&t.scriptTypes;if(r(l,d),e&&r(e,d),a)for(var n=a.length-1;0<=n;n--)d.script.unshift(["type",a[n].matches,a[n].mode]);function g(t,e){var a,n,l,o,i,c,r=m.token(t,e.htmlState),s=/\btag\b/.test(r);return s&&!/[<>\s\/]/.test(t.current())&&(a=e.htmlState.tagName&&e.htmlState.tagName.toLowerCase())&&d.hasOwnProperty(a)?e.inTag=a+" ":e.inTag&&s&&/>$/.test(t.current())?(n=/^([\S]+) (.*)/.exec(e.inTag),e.inTag=null,l=">"==t.current()&&function(t,e){for(var a=0;a!?|~^@]/,p=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function m(e,t,r){return n=e,a=r,t}function k(e,t){var r,n=e.next();if('"'==n||"'"==n)return t.tokenize=(r=n,function(e,t){var n,a=!1;if(c&&"@"==e.peek()&&e.match(p))return t.tokenize=k,m("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=r||a);)a=!a&&"\\"==n;return a||(t.tokenize=k),m("string","string")}),t.tokenize(e,t);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return m("number","number");if("."==n&&e.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return m(n);if("="==n&&e.eat(">"))return m("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),m("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),m("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),m("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),m("number","number");if("/"==n)return e.eat("*")?(t.tokenize=v,v(e,t)):e.eat("/")?(e.skipToEnd(),m("comment","comment")):He(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),m("regexp","string-2")):(e.eat("="),m("operator","operator",e.current()));if("`"==n)return t.tokenize=y,y(e,t);if("#"==n)return e.skipToEnd(),m("error","error");if(d.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),m("operator","operator",e.current());if(f.test(n)){e.eatWhile(f);var a=e.current();if("."!=t.lastType){if(l.propertyIsEnumerable(a)){var i=l[a];return m(i.type,i.style,a)}if("async"==a&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",a)}return m("variable","variable",a)}}function v(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=k;break}n="*"==r}return m("comment","comment")}function y(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=k;break}n=!n&&"\\"==r}return m("quasi","string-2",e.current())}var b="([{}])";function w(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(s){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var a=0,i=!1,o=r-1;o>=0;--o){var c=e.string.charAt(o),u=b.indexOf(c);if(u>=0&&u<3){if(!a){++o;break}if(0==--a){"("==c&&(i=!0);break}}else if(u>=3&&u<6)++a;else if(f.test(c))i=!0;else{if(/["'\/]/.test(c))return;if(i&&!a){++o;break}}}i&&!a&&(t.fatArrowAt=o)}}var x={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function h(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function g(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var j={state:null,column:null,marked:null,cc:null};function M(){for(var e=arguments.length-1;e>=0;e--)j.cc.push(arguments[e])}function V(){return M.apply(null,arguments),!0}function A(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=j.state;if(j.marked="def",n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function E(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}var z={name:"this",next:{name:"arguments"}};function I(){j.state.context={prev:j.state.context,vars:j.state.localVars},j.state.localVars=z}function T(){j.state.localVars=j.state.context.vars,j.state.context=j.state.context.prev}function $(e,t){var r=function(){var r=j.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var a=r.lexical;a&&")"==a.type&&a.align;a=a.prev)n=a.indented;r.lexical=new h(n,j.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function C(){var e=j.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function q(e){return function t(r){return r==e?V():";"==e?M():V(t)}}function O(e,t){return"var"==e?V($("vardef",t.length),pe,q(";"),C):"keyword a"==e?V($("form"),W,O,C):"keyword b"==e?V($("form"),O,C):"keyword d"==e?j.stream.match(/^\s*$/,!1)?V():V($("stat"),U,q(";"),C):"debugger"==e?V(q(";")):"{"==e?V($("}"),te,C):";"==e?V():"if"==e?("else"==j.state.lexical.info&&j.state.cc[j.state.cc.length-1]==C&&j.state.cc.pop()(),V($("form"),W,O,C,be)):"function"==e?V(Me):"for"==e?V($("form"),we,O,C):"class"==e||s&&"interface"==t?(j.marked="keyword",V($("form"),Ee,C)):"variable"==e?s&&"declare"==t?(j.marked="keyword",V(O)):s&&("module"==t||"enum"==t||"type"==t)&&j.stream.match(/^\s*\w/,!1)?(j.marked="keyword","enum"==t?V(Ue):"type"==t?V(ie,q("operator"),ie,q(";")):V($("form"),me,q("{"),$("}"),te,C,C)):s&&"namespace"==t?(j.marked="keyword",V($("form"),P,te,C)):s&&"abstract"==t?(j.marked="keyword",V(O)):V($("stat"),Q):"switch"==e?V($("form"),W,q("{"),$("}","switch"),te,C,C):"case"==e?V(P,q(":")):"default"==e?V(q(":")):"catch"==e?V($("form"),I,q("("),Ve,q(")"),O,C,T):"export"==e?V($("stat"),$e,C):"import"==e?V($("stat"),qe,C):"async"==e?V(O):"@"==t?V(P,O):M($("stat"),P,q(";"),C)}function P(e,t){return N(e,t,!1)}function S(e,t){return N(e,t,!0)}function W(e){return"("!=e?M():V($(")"),P,q(")"),C)}function N(e,t,r){if(j.state.fatArrowAt==j.stream.start){var n=r?J:G;if("("==e)return V(I,$(")"),_(Ve,")"),C,q("=>"),n,T);if("variable"==e)return M(I,me,q("=>"),n,T)}var a,i=r?H:B;return x.hasOwnProperty(e)?V(i):"function"==e?V(Me,i):"class"==e||s&&"interface"==t?(j.marked="keyword",V($("form"),Ae,C)):"keyword c"==e||"async"==e?V(r?S:P):"("==e?V($(")"),U,q(")"),C,i):"operator"==e||"spread"==e?V(r?S:P):"["==e?V($("]"),Ne,C,i):"{"==e?ee(X,"}",null,i):"quasi"==e?M(D,i):"new"==e?V((a=r,function(e){return"."==e?V(a?L:K):"variable"==e&&s?V(fe,a?H:B):M(a?S:P)})):"import"==e?V(P):V()}function U(e){return e.match(/[;\}\)\],]/)?M():M(P)}function B(e,t){return","==e?V(P):H(e,t,!1)}function H(e,t,r){var n=0==r?B:H,a=0==r?P:S;return"=>"==e?V(I,r?J:G,T):"operator"==e?/\+\+|--/.test(t)||s&&"!"==t?V(n):s&&"<"==t&&j.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?V($(">"),_(ie,">"),C,n):"?"==t?V(P,q(":"),a):V(a):"quasi"==e?M(D,n):";"!=e?"("==e?ee(S,")","call",n):"."==e?V(R,n):"["==e?V($("]"),U,q("]"),C,n):s&&"as"==t?(j.marked="keyword",V(ie,n)):"regexp"==e?(j.state.lastType=j.marked="operator",j.stream.backUp(j.stream.pos-j.stream.start-1),V(a)):void 0:void 0}function D(e,t){return"quasi"!=e?M():"${"!=t.slice(t.length-2)?V(D):V(P,F)}function F(e){if("}"==e)return j.marked="string-2",j.state.tokenize=y,V(D)}function G(e){return w(j.stream,j.state),M("{"==e?O:P)}function J(e){return w(j.stream,j.state),M("{"==e?O:S)}function K(e,t){if("target"==t)return j.marked="keyword",V(B)}function L(e,t){if("target"==t)return j.marked="keyword",V(H)}function Q(e){return":"==e?V(C,O):M(B,q(";"),C)}function R(e){if("variable"==e)return j.marked="property",V()}function X(e,t){if("async"==e)return j.marked="property",V(X);if("variable"==e||"keyword"==j.style){return j.marked="property","get"==t||"set"==t?V(Y):(s&&j.state.fatArrowAt==j.stream.start&&(r=j.stream.match(/^\s*:\s*/,!1))&&(j.state.fatArrowAt=j.stream.pos+r[0].length),V(Z));var r}else{if("number"==e||"string"==e)return j.marked=c?"property":j.style+" property",V(Z);if("jsonld-keyword"==e)return V(Z);if(s&&E(t))return j.marked="keyword",V(X);if("["==e)return V(P,re,q("]"),Z);if("spread"==e)return V(S,Z);if("*"==t)return j.marked="keyword",V(X);if(":"==e)return M(Z)}}function Y(e){return"variable"!=e?M(Z):(j.marked="property",V(Me))}function Z(e){return":"==e?V(S):"("==e?M(Me):void 0}function _(e,t,r){function n(a,i){if(r?r.indexOf(a)>-1:","==a){var o=j.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),V(function(r,n){return r==t||n==t?M():M(e)},n)}return a==t||i==t?V():V(q(t))}return function(r,a){return r==t||a==t?V():M(e,n)}}function ee(e,t,r){for(var n=3;n"),ie):void 0}function oe(e){if("=>"==e)return V(ie)}function ce(e,t){return"variable"==e||"keyword"==j.style?(j.marked="property",V(ce)):"?"==t?V(ce):":"==e?V(ie):"["==e?V(P,re,q("]"),ce):void 0}function ue(e,t){return"variable"==e&&j.stream.match(/^\s*[?:]/,!1)||"?"==t?V(ue):":"==e?V(ie):M(ie)}function se(e,t){return"<"==t?V($(">"),_(ie,">"),C,se):"|"==t||"."==e||"&"==t?V(ie):"["==e?V(q("]"),se):"extends"==t||"implements"==t?(j.marked="keyword",V(ie)):void 0}function fe(e,t){if("<"==t)return V($(">"),_(ie,">"),C,se)}function le(){return M(ie,de)}function de(e,t){if("="==t)return V(ie)}function pe(e,t){return"enum"==t?(j.marked="keyword",V(Ue)):M(me,re,ve,ye)}function me(e,t){return s&&E(t)?(j.marked="keyword",V(me)):"variable"==e?(A(t),V()):"spread"==e?V(me):"["==e?ee(me,"]"):"{"==e?ee(ke,"}"):void 0}function ke(e,t){return"variable"!=e||j.stream.match(/^\s*:/,!1)?("variable"==e&&(j.marked="property"),"spread"==e?V(me):"}"==e?M():V(q(":"),me,ve)):(A(t),V(ve))}function ve(e,t){if("="==t)return V(S)}function ye(e){if(","==e)return V(pe)}function be(e,t){if("keyword b"==e&&"else"==t)return V($("form","else"),O,C)}function we(e,t){return"await"==t?V(we):"("==e?V($(")"),xe,q(")"),C):void 0}function xe(e){return"var"==e?V(pe,q(";"),ge):";"==e?V(ge):"variable"==e?V(he):M(P,q(";"),ge)}function he(e,t){return"in"==t||"of"==t?(j.marked="keyword",V(P)):V(B,ge)}function ge(e,t){return";"==e?V(je):"in"==t||"of"==t?(j.marked="keyword",V(P)):M(P,q(";"),je)}function je(e){")"!=e&&V(P)}function Me(e,t){return"*"==t?(j.marked="keyword",V(Me)):"variable"==e?(A(t),V(Me)):"("==e?V(I,$(")"),_(Ve,")"),C,ne,O,T):s&&"<"==t?V($(">"),_(le,">"),C,Me):void 0}function Ve(e,t){return"@"==t&&V(P,Ve),"spread"==e?V(Ve):s&&E(t)?(j.marked="keyword",V(Ve)):M(me,re,ve)}function Ae(e,t){return"variable"==e?Ee(e,t):ze(e,t)}function Ee(e,t){if("variable"==e)return A(t),V(ze)}function ze(e,t){return"<"==t?V($(">"),_(le,">"),C,ze):"extends"==t||"implements"==t||s&&","==e?("implements"==t&&(j.marked="keyword"),V(s?ie:P,ze)):"{"==e?V($("}"),Ie,C):void 0}function Ie(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||s&&E(t))&&j.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(j.marked="keyword",V(Ie)):"variable"==e||"keyword"==j.style?(j.marked="property",V(s?Te:Me,Ie)):"["==e?V(P,re,q("]"),s?Te:Me,Ie):"*"==t?(j.marked="keyword",V(Ie)):";"==e?V(Ie):"}"==e?V():"@"==t?V(P,Ie):void 0}function Te(e,t){return"?"==t?V(Te):":"==e?V(ie,ve):"="==t?V(S):M(Me)}function $e(e,t){return"*"==t?(j.marked="keyword",V(We,q(";"))):"default"==t?(j.marked="keyword",V(P,q(";"))):"{"==e?V(_(Ce,"}"),We,q(";")):M(O)}function Ce(e,t){return"as"==t?(j.marked="keyword",V(q("variable"))):"variable"==e?M(S,Ce):void 0}function qe(e){return"string"==e?V():"("==e?M(P):M(Oe,Pe,We)}function Oe(e,t){return"{"==e?ee(Oe,"}"):("variable"==e&&A(t),"*"==t&&(j.marked="keyword"),V(Se))}function Pe(e){if(","==e)return V(Oe,Pe)}function Se(e,t){if("as"==t)return j.marked="keyword",V(Oe)}function We(e,t){if("from"==t)return j.marked="keyword",V(P)}function Ne(e){return"]"==e?V():M(_(S,"]"))}function Ue(){return M($("form"),me,q("{"),$("}"),_(Be,"}"),C,C)}function Be(){return M(me,ve)}function He(e,t,r){return t.tokenize==k&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return C.lex=!0,{startState:function(e){var t={tokenize:k,lastType:"sof",cc:[],lexical:new h((e||0)-i,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),w(e,t)),t.tokenize!=v&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=a&&"--"!=a?n:"incdec",function(e,t,r,n,a){var i=e.cc;for(j.state=e,j.stream=a,j.marked=null,j.cc=i,j.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((i.length?i.pop():u?P:O)(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return j.marked?j.marked:"variable"==r&&g(e,n)?"variable-2":t}}(t,r,n,a,e))},indent:function(t,n){if(t.tokenize==v)return e.Pass;if(t.tokenize!=k)return 0;var a,c=n&&n.charAt(0),u=t.lexical;if(!/^\s*else\b/.test(n))for(var s=t.cc.length-1;s>=0;--s){var f=t.cc[s];if(f==C)u=u.prev;else if(f!=be)break}for(;("stat"==u.type||"form"==u.type)&&("}"==c||(a=t.cc[t.cc.length-1])&&(a==B||a==H)&&!/^[,\.=+\-*:?[\(]/.test(n));)u=u.prev;o&&")"==u.type&&"stat"==u.prev.type&&(u=u.prev);var l,p,m=u.type,y=c==m;return"vardef"==m?u.indented+("operator"==t.lastType||","==t.lastType?u.info+1:0):"form"==m&&"{"==c?u.indented:"form"==m?u.indented+i:"stat"==m?u.indented+(p=n,"operator"==(l=t).lastType||","==l.lastType||d.test(p.charAt(0))||/[,.]/.test(p.charAt(0))?o||i:0):"switch"!=u.info||y||0==r.doubleIndentSwitch?u.align?u.column+(y?0:1):u.indented+(y?0:i):u.indented+(/^(?:case|default)\b/.test(n)?i:2*i)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:u?null:"/*",blockCommentEnd:u?null:"*/",blockCommentContinue:u?null:" * ",lineComment:u?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:u?"json":"javascript",jsonldMode:c,jsonMode:u,expressionAllowed:He,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=P&&t!=S||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}); +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(tt){"use strict";tt.defineMode("javascript",function(e,l){var t,r,n,a,i,o,d=e.indentUnit,p=l.statementIndent,c=l.jsonld,s=l.json||c,u=l.typescript,f=l.wordCharacters||/[\w$\xa1-\uffff]/,m=(t=v("keyword a"),r=v("keyword b"),n=v("keyword c"),a=v("keyword d"),i=v("operator"),{if:v("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:a,break:a,continue:a,new:v("new"),delete:n,void:n,throw:n,debugger:v("debugger"),var:v("var"),const:v("var"),let:v("var"),function:v("function"),catch:v("catch"),for:v("for"),switch:v("switch"),case:v("case"),default:v("default"),in:i,typeof:i,instanceof:i,true:o={type:"atom",style:"atom"},false:o,null:o,undefined:o,NaN:o,Infinity:o,this:v("this"),class:v("class"),super:v("atom"),yield:n,export:v("export"),import:v("import"),extends:n,await:n});function v(e){return{type:e,style:"keyword"}}var k,y,w=/[+\-*&%=<>!?|~^@]/,b=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function x(e,t,r){return k=e,y=r,t}function h(e,t){var a,r=e.next();if('"'==r||"'"==r)return t.tokenize=(a=r,function(e,t){var r,n=!1;if(c&&"@"==e.peek()&&e.match(b))return t.tokenize=h,x("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=a||n);)n=!n&&"\\"==r;return n||(t.tokenize=h),x("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return x("number","number");if("."==r&&e.match(".."))return x("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return x(r);if("="==r&&e.eat(">"))return x("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return x("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),x("number","number");if("/"==r)return e.eat("*")?(t.tokenize=g)(e,t):e.eat("/")?(e.skipToEnd(),x("comment","comment")):et(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),x("regexp","string-2")):(e.eat("="),x("operator","operator",e.current()));if("`"==r)return(t.tokenize=j)(e,t);if("#"==r&&"!"==e.peek())return e.skipToEnd(),x("meta","meta");if("#"==r&&e.eatWhile(f))return x("variable","property");if("<"==r&&e.match("!--")||"-"==r&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),x("comment","comment");if(w.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-|&?]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),"?"==r&&e.eat(".")?x("."):x("operator","operator",e.current());if(f.test(r)){e.eatWhile(f);var n=e.current();if("."!=t.lastType){if(m.propertyIsEnumerable(n)){var i=m[n];return x(i.type,i.style,n)}if("async"==n&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return x("async","keyword",n)}return x("variable","variable",n)}}function g(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=h;break}n="*"==r}return x("comment","comment")}function j(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=h;break}n=!n&&"\\"==r}return x("quasi","string-2",e.current())}var M="([{}])";function A(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r,n=e.string.indexOf("=>",e.start);if(!(n<0)){!u||(r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n)))&&(n=r.index);for(var a=0,i=!1,o=n-1;0<=o;--o){var c=e.string.charAt(o),s=M.indexOf(c);if(0<=s&&s<3){if(!a){++o;break}if(0==--a){"("==c&&(i=!0);break}}else if(3<=s&&s<6)++a;else if(f.test(c))i=!0;else if(/["'\/`]/.test(c))for(;;--o){if(0==o)return;if(e.string.charAt(o-1)==c&&"\\"!=e.string.charAt(o-2)){o--;break}}else if(i&&!a){++o;break}}i&&!a&&(t.fatArrowAt=o)}}var V={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function E(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function z(e,t,r,n,a){var i=e.cc;for(I.state=e,I.stream=a,I.marked=null,I.cc=i,I.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((i.length?i.pop():s?J:D)(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return I.marked?I.marked:"variable"==r&&function(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return 1;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return 1}(e,n)?"variable-2":t}}}var I={state:null,column:null,marked:null,cc:null};function T(){for(var e=arguments.length-1;0<=e;e--)I.cc.push(arguments[e])}function $(){return T.apply(null,arguments),!0}function C(e,t){for(var r=t;r;r=r.next)if(r.name==e)return 1}function _(e){var t=I.state;if(I.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,r){{if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new q(n,r.vars,!0):null}return C(t,r.vars)?r:new q(r.prev,new S(t,r.vars),!1)}return null}}(e,t.context);if(null!=r)return void(t.context=r)}else if(!C(e,t.localVars))return void(t.localVars=new S(e,t.localVars));l.globalVars&&!C(e,t.globalVars)&&(t.globalVars=new S(e,t.globalVars))}function O(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function q(e,t,r){this.prev=e,this.vars=t,this.block=r}function S(e,t){this.name=e,this.next=t}var P=new S("this",new S("arguments",null));function N(){I.state.context=new q(I.state.context,I.state.localVars,!1),I.state.localVars=P}function U(){I.state.context=new q(I.state.context,I.state.localVars,!0),I.state.localVars=null}function W(){I.state.localVars=I.state.context.vars,I.state.context=I.state.context.prev}function B(n,a){function e(){var e=I.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var r=e.lexical;r&&")"==r.type&&r.align;r=r.prev)t=r.indented;e.lexical=new E(t,I.stream.column(),n,null,e.lexical,a)}return e.lex=!0,e}function F(){var e=I.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(r){return function e(t){return t==r?$():";"==r||"}"==t||")"==t||"]"==t?T():$(e)}}function D(e,t){return"var"==e?$(B("vardef",t),Ae,H(";"),F):"keyword a"==e?$(B("form"),L,D,F):"keyword b"==e?$(B("form"),D,F):"keyword d"==e?I.stream.match(/^\s*$/,!1)?$():$(B("stat"),R,H(";"),F):"debugger"==e?$(H(";")):"{"==e?$(B("}"),U,de,F,W):";"==e?$():"if"==e?("else"==I.state.lexical.info&&I.state.cc[I.state.cc.length-1]==F&&I.state.cc.pop()(),$(B("form"),L,D,F,$e)):"function"==e?$(qe):"for"==e?$(B("form"),Ce,D,F):"class"==e||u&&"interface"==t?(I.marked="keyword",$(B("form","class"==e?e:t),We,F)):"variable"==e?u&&"declare"==t?(I.marked="keyword",$(D)):u&&("module"==t||"enum"==t||"type"==t)&&I.stream.match(/^\s*\w/,!1)?(I.marked="keyword","enum"==t?$(Ye):"type"==t?$(Pe,H("operator"),ye,H(";")):$(B("form"),Ve,H("{"),B("}"),de,F,F)):u&&"namespace"==t?(I.marked="keyword",$(B("form"),J,D,F)):u&&"abstract"==t?(I.marked="keyword",$(D)):$(B("stat"),ie):"switch"==e?$(B("form"),L,H("{"),B("}","switch"),U,de,F,F,W):"case"==e?$(J,H(":")):"default"==e?$(H(":")):"catch"==e?$(B("form"),N,G,D,F,W):"export"==e?$(B("stat"),De,F):"import"==e?$(B("stat"),Je,F):"async"==e?$(D):"@"==t?$(J,D):T(B("stat"),J,H(";"),F)}function G(e){if("("==e)return $(Ne,H(")"))}function J(e,t){return Q(e,t,!1)}function K(e,t){return Q(e,t,!0)}function L(e){return"("!=e?T():$(B(")"),R,H(")"),F)}function Q(e,t,r){if(I.state.fatArrowAt==I.stream.start){var n=r?re:te;if("("==e)return $(N,B(")"),fe(Ne,")"),F,H("=>"),n,W);if("variable"==e)return T(N,Ve,H("=>"),n,W)}var a,i=r?Y:X;return V.hasOwnProperty(e)?$(i):"function"==e?$(qe,i):"class"==e||u&&"interface"==t?(I.marked="keyword",$(B("form"),Ue,F)):"keyword c"==e||"async"==e?$(r?K:J):"("==e?$(B(")"),R,H(")"),F,i):"operator"==e||"spread"==e?$(r?K:J):"["==e?$(B("]"),Xe,F,i):"{"==e?le(ce,"}",null,i):"quasi"==e?T(Z,i):"new"==e?$((a=r,function(e){return"."==e?$(a?ae:ne):"variable"==e&&u?$(ge,a?Y:X):T(a?K:J)})):"import"==e?$(J):$()}function R(e){return e.match(/[;\}\)\],]/)?T():T(J)}function X(e,t){return","==e?$(R):Y(e,t,!1)}function Y(e,t,r){var n=0==r?X:Y,a=0==r?J:K;return"=>"==e?$(N,r?re:te,W):"operator"==e?/\+\+|--/.test(t)||u&&"!"==t?$(n):u&&"<"==t&&I.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?$(B(">"),fe(ye,">"),F,n):"?"==t?$(J,H(":"),a):$(a):"quasi"==e?T(Z,n):";"!=e?"("==e?le(K,")","call",n):"."==e?$(oe,n):"["==e?$(B("]"),R,H("]"),F,n):u&&"as"==t?(I.marked="keyword",$(ye,n)):"regexp"==e?(I.state.lastType=I.marked="operator",I.stream.backUp(I.stream.pos-I.stream.start-1),$(a)):void 0:void 0}function Z(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?$(Z):$(J,ee)}function ee(e){if("}"==e)return I.marked="string-2",I.state.tokenize=j,$(Z)}function te(e){return A(I.stream,I.state),T("{"==e?D:J)}function re(e){return A(I.stream,I.state),T("{"==e?D:K)}function ne(e,t){if("target"==t)return I.marked="keyword",$(X)}function ae(e,t){if("target"==t)return I.marked="keyword",$(Y)}function ie(e){return":"==e?$(F,D):T(X,H(";"),F)}function oe(e){if("variable"==e)return I.marked="property",$()}function ce(e,t){if("async"==e)return I.marked="property",$(ce);if("variable"==e||"keyword"==I.style){return(I.marked="property","get"==t||"set"==t)?$(se):(u&&I.state.fatArrowAt==I.stream.start&&(r=I.stream.match(/^\s*:\s*/,!1))&&(I.state.fatArrowAt=I.stream.pos+r[0].length),$(ue));var r}else{if("number"==e||"string"==e)return I.marked=c?"property":I.style+" property",$(ue);if("jsonld-keyword"==e)return $(ue);if(u&&O(t))return I.marked="keyword",$(ce);if("["==e)return $(J,pe,H("]"),ue);if("spread"==e)return $(K,ue);if("*"==t)return I.marked="keyword",$(ce);if(":"==e)return T(ue)}}function se(e){return"variable"!=e?T(ue):(I.marked="property",$(qe))}function ue(e){return":"==e?$(K):"("==e?T(qe):void 0}function fe(n,a,i){function o(e,t){if(i?-1"),ye):void 0}function we(e){if("=>"==e)return $(ye)}function be(e,t){return"variable"==e||"keyword"==I.style?(I.marked="property",$(be)):"?"==t||"number"==e||"string"==e?$(be):":"==e?$(ye):"["==e?$(H("variable"),me,H("]"),be):"("==e?T(Se,be):void 0}function xe(e,t){return"variable"==e&&I.stream.match(/^\s*[?:]/,!1)||"?"==t?$(xe):":"==e?$(ye):"spread"==e?$(xe):T(ye)}function he(e,t){return"<"==t?$(B(">"),fe(ye,">"),F,he):"|"==t||"."==e||"&"==t?$(ye):"["==e?$(ye,H("]"),he):"extends"==t||"implements"==t?(I.marked="keyword",$(ye)):"?"==t?$(ye,H(":"),ye):void 0}function ge(e,t){if("<"==t)return $(B(">"),fe(ye,">"),F,he)}function je(){return T(ye,Me)}function Me(e,t){if("="==t)return $(ye)}function Ae(e,t){return"enum"==t?(I.marked="keyword",$(Ye)):T(Ve,pe,Ie,Te)}function Ve(e,t){return u&&O(t)?(I.marked="keyword",$(Ve)):"variable"==e?(_(t),$()):"spread"==e?$(Ve):"["==e?le(ze,"]"):"{"==e?le(Ee,"}"):void 0}function Ee(e,t){return"variable"!=e||I.stream.match(/^\s*:/,!1)?("variable"==e&&(I.marked="property"),"spread"==e?$(Ve):"}"==e?T():"["==e?$(J,H("]"),H(":"),Ee):$(H(":"),Ve,Ie)):(_(t),$(Ie))}function ze(){return T(Ve,Ie)}function Ie(e,t){if("="==t)return $(K)}function Te(e){if(","==e)return $(Ae)}function $e(e,t){if("keyword b"==e&&"else"==t)return $(B("form","else"),D,F)}function Ce(e,t){return"await"==t?$(Ce):"("==e?$(B(")"),_e,F):void 0}function _e(e){return"var"==e?$(Ae,Oe):("variable"==e?$:T)(Oe)}function Oe(e,t){return")"==e?$():";"==e?$(Oe):"in"==t||"of"==t?(I.marked="keyword",$(J,Oe)):T(J,Oe)}function qe(e,t){return"*"==t?(I.marked="keyword",$(qe)):"variable"==e?(_(t),$(qe)):"("==e?$(N,B(")"),fe(Ne,")"),F,ve,D,W):u&&"<"==t?$(B(">"),fe(je,">"),F,qe):void 0}function Se(e,t){return"*"==t?(I.marked="keyword",$(Se)):"variable"==e?(_(t),$(Se)):"("==e?$(N,B(")"),fe(Ne,")"),F,ve,W):u&&"<"==t?$(B(">"),fe(je,">"),F,Se):void 0}function Pe(e,t){return"keyword"==e||"variable"==e?(I.marked="type",$(Pe)):"<"==t?$(B(">"),fe(je,">"),F):void 0}function Ne(e,t){return"@"==t&&$(J,Ne),"spread"==e?$(Ne):u&&O(t)?(I.marked="keyword",$(Ne)):u&&"this"==e?$(pe,Ie):T(Ve,pe,Ie)}function Ue(e,t){return("variable"==e?We:Be)(e,t)}function We(e,t){if("variable"==e)return _(t),$(Be)}function Be(e,t){return"<"==t?$(B(">"),fe(je,">"),F,Be):"extends"==t||"implements"==t||u&&","==e?("implements"==t&&(I.marked="keyword"),$(u?ye:J,Be)):"{"==e?$(B("}"),Fe,F):void 0}function Fe(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||u&&O(t))&&I.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(I.marked="keyword",$(Fe)):"variable"==e||"keyword"==I.style?(I.marked="property",$(He,Fe)):"number"==e||"string"==e?$(He,Fe):"["==e?$(J,pe,H("]"),He,Fe):"*"==t?(I.marked="keyword",$(Fe)):u&&"("==e?T(Se,Fe):";"==e||","==e?$(Fe):"}"==e?$():"@"==t?$(J,Fe):void 0}function He(e,t){if("?"==t)return $(He);if(":"==e)return $(ye,Ie);if("="==t)return $(K);var r=I.state.lexical.prev;return T(r&&"interface"==r.info?Se:qe)}function De(e,t){return"*"==t?(I.marked="keyword",$(Re,H(";"))):"default"==t?(I.marked="keyword",$(J,H(";"))):"{"==e?$(fe(Ge,"}"),Re,H(";")):T(D)}function Ge(e,t){return"as"==t?(I.marked="keyword",$(H("variable"))):"variable"==e?T(K,Ge):void 0}function Je(e){return"string"==e?$():"("==e?T(J):T(Ke,Le,Re)}function Ke(e,t){return"{"==e?le(Ke,"}"):("variable"==e&&_(t),"*"==t&&(I.marked="keyword"),$(Qe))}function Le(e){if(","==e)return $(Ke,Le)}function Qe(e,t){if("as"==t)return I.marked="keyword",$(Ke)}function Re(e,t){if("from"==t)return I.marked="keyword",$(J)}function Xe(e){return"]"==e?$():T(fe(K,"]"))}function Ye(){return T(B("form"),Ve,H("{"),B("}"),fe(Ze,"}"),F,F)}function Ze(){return T(Ve,Ie)}function et(e,t,r){return t.tokenize==h&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return F.lex=W.lex=!0,{startState:function(e){var t={tokenize:h,lastType:"sof",cc:[],lexical:new E((e||0)-d,0,"block",!1),localVars:l.localVars,context:l.localVars&&new q(null,null,!1),indented:e||0};return l.globalVars&&"object"==typeof l.globalVars&&(t.globalVars=l.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),A(e,t)),t.tokenize!=g&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==k?r:(t.lastType="operator"!=k||"++"!=y&&"--"!=y?k:"incdec",z(t,r,k,y,e))},indent:function(e,t){if(e.tokenize==g||e.tokenize==j)return tt.Pass;if(e.tokenize!=h)return 0;var r,n=t&&t.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(t))for(var i=e.cc.length-1;0<=i;--i){var o=e.cc[i];if(o==F)a=a.prev;else if(o!=$e)break}for(;("stat"==a.type||"form"==a.type)&&("}"==n||(r=e.cc[e.cc.length-1])&&(r==X||r==Y)&&!/^[,\.=+\-*:?[\(]/.test(t));)a=a.prev;p&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c,s,u=a.type,f=n==u;return"vardef"==u?a.indented+("operator"==e.lastType||","==e.lastType?a.info.length+1:0):"form"==u&&"{"==n?a.indented:"form"==u?a.indented+d:"stat"==u?a.indented+(s=t,"operator"==(c=e).lastType||","==c.lastType||w.test(s.charAt(0))||/[,.]/.test(s.charAt(0))?p||d:0):"switch"!=a.info||f||0==l.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:d):a.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:c,jsonMode:s,expressionAllowed:et,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=J&&t!=K||e.cc.pop()}}}),tt.registerHelper("wordChars","javascript",/[\w$]/),tt.defineMIME("text/javascript","javascript"),tt.defineMIME("text/ecmascript","javascript"),tt.defineMIME("application/javascript","javascript"),tt.defineMIME("application/x-javascript","javascript"),tt.defineMIME("application/ecmascript","javascript"),tt.defineMIME("application/json",{name:"javascript",json:!0}),tt.defineMIME("application/x-json",{name:"javascript",json:!0}),tt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),tt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),tt.defineMIME("application/typescript",{name:"javascript",typescript:!0})}); diff --git a/plugins/tiddlywiki/codemirror-mode-markdown/files/mode/markdown/markdown.js b/plugins/tiddlywiki/codemirror-mode-markdown/files/mode/markdown/markdown.js index 93d1b593f..f3ca8f029 100755 --- a/plugins/tiddlywiki/codemirror-mode-markdown/files/mode/markdown/markdown.js +++ b/plugins/tiddlywiki/codemirror-mode-markdown/files/mode/markdown/markdown.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../tw-meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("markdown",function(e,i){var n=t.getMode(e,"text/html"),r="null"==n.name;void 0===i.highlightFormatting&&(i.highlightFormatting=!1),void 0===i.maxBlockquoteDepth&&(i.maxBlockquoteDepth=0),void 0===i.taskLists&&(i.taskLists=!1),void 0===i.strikethrough&&(i.strikethrough=!1),void 0===i.emoji&&(i.emoji=!1),void 0===i.fencedCodeBlockHighlighting&&(i.fencedCodeBlockHighlighting=!0),void 0===i.xml&&(i.xml=!0),void 0===i.tokenTypeOverrides&&(i.tokenTypeOverrides={});var a={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var l in a)a.hasOwnProperty(l)&&i.tokenTypeOverrides[l]&&(a[l]=i.tokenTypeOverrides[l]);var o=/^([*\-_])(?:\s*\1){2,}\s*$/,h=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,s=i.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,m=/^ *(?:\={1,}|-{1,})\s*$/,u=/^[^#!\[\]*_\\<>` "'(~:]+/,f=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,d=/[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/;function k(t,e,i){return e.f=e.inline=i,i(t,e)}function p(t,e,i){return e.f=e.block=i,i(t,e)}function x(t){return t.linkTitle=!1,t.linkHref=!1,t.linkText=!1,t.em=!1,t.strong=!1,t.strikethrough=!1,t.quote=0,t.indentedCode=!1,t.f==S&&(t.f=M,t.block=v),t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.prevLine=t.thisLine,t.thisLine={stream:null},null}function v(n,r){var l,u=n.column()===r.indentation,d=!(l=r.prevLine.stream)||!/\S/.test(l.string),p=r.indentedCode,x=r.prevLine.hr,v=!1!==r.list,S=(r.listStack[r.listStack.length-1]||0)+3;r.indentedCode=!1;var q=r.indentation;if(null===r.indentationDiff&&(r.indentationDiff=r.indentation,v)){for(r.em=!1,r.strong=!1,r.code=!1,r.strikethrough=!1,r.list=null;q=4&&(p||r.prevLine.fencedCodeEnd||r.prevLine.header||d))return n.skipToEnd(),r.indentedCode=!0,a.code;if(n.eatSpace())return null;if(u&&r.indentation<=S&&(b=n.match(s))&&b[1].length<=6)return r.quote=0,r.header=b[1].length,r.thisLine.header=!0,i.highlightFormatting&&(r.formatting="header"),r.f=r.inline,T(r);if(r.indentation<=S&&n.eat(">"))return r.quote=u?1:r.quote+1,i.highlightFormatting&&(r.formatting="quote"),n.eatSpace(),T(r);if(!F&&!r.setext&&u&&r.indentation<=S&&(b=n.match(h))){var E=b[1]?"ol":"ul";return r.indentation=q+n.current().length,r.list=!0,r.quote=0,r.listStack.push(r.indentation),i.taskLists&&n.match(g,!1)&&(r.taskList=!0),r.f=r.inline,i.highlightFormatting&&(r.formatting=["list","list-"+E]),T(r)}return u&&r.indentation<=S&&(b=n.match(f,!0))?(r.quote=0,r.fencedEndRE=new RegExp(b[1]+"+ *$"),r.localMode=i.fencedCodeBlockHighlighting&&function(i){if(t.findModeByName){var n=t.findModeByName(i);n&&(i=n.mime||n.mimes[0])}var r=t.getMode(e,i);return"null"==r.name?null:r}(b[2]),r.localMode&&(r.localState=t.startState(r.localMode)),r.f=r.block=L,i.highlightFormatting&&(r.formatting="code-block"),r.code=-1,T(r)):r.setext||!(M&&v||r.quote||!1!==r.list||r.code||F||c.test(n.string))&&(b=n.lookAhead(1))&&(b=b.match(m))?(r.setext?(r.header=r.setext,r.setext=0,n.skipToEnd(),i.highlightFormatting&&(r.formatting="header")):(r.header="="==b[0].charAt(0)?1:2,r.setext=r.header),r.thisLine.header=!0,r.f=r.inline,T(r)):F?(n.skipToEnd(),r.hr=!0,r.thisLine.hr=!0,a.hr):"["===n.peek()?k(n,r,w):k(n,r,r.inline)}function S(e,i){var a=n.token(e,i.htmlState);if(!r){var l=t.innerMode(n,i.htmlState);("xml"==l.mode.name&&null===l.state.tagStart&&!l.state.context&&l.state.tokenize.isInText||i.md_inside&&e.current().indexOf(">")>-1)&&(i.f=M,i.block=v,i.htmlState=null)}return a}function L(t,e){var n,r=e.listStack[e.listStack.length-1]||0,l=e.indentation=t.quote?e.push(a.formatting+"-"+t.formatting[n]+"-"+t.quote):e.push("error"))}if(t.taskOpen)return e.push("meta"),e.length?e.join(" "):null;if(t.taskClosed)return e.push("property"),e.length?e.join(" "):null;if(t.linkHref?e.push(a.linkHref,"url"):(t.strong&&e.push(a.strong),t.em&&e.push(a.em),t.strikethrough&&e.push(a.strikethrough),t.emoji&&e.push(a.emoji),t.linkText&&e.push(a.linkText),t.code&&e.push(a.code),t.image&&e.push(a.image),t.imageAltText&&e.push(a.imageAltText,"link"),t.imageMarker&&e.push(a.imageMarker)),t.header&&e.push(a.header,a.header+"-"+t.header),t.quote&&(e.push(a.quote),!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=t.quote?e.push(a.quote+"-"+t.quote):e.push(a.quote+"-"+i.maxBlockquoteDepth)),!1!==t.list){var r=(t.listStack.length-1)%3;r?1===r?e.push(a.list2):e.push(a.list3):e.push(a.list1)}return t.trailingSpaceNewLine?e.push("trailing-space-new-line"):t.trailingSpace&&e.push("trailing-space-"+(t.trailingSpace%2?"a":"b")),e.length?e.join(" "):null}function q(t,e){if(t.match(u,!0))return T(e)}function M(e,r){var l=r.text(e,r);if(void 0!==l)return l;if(r.list)return r.list=null,T(r);if(r.taskList)return" "===e.match(g,!0)[1]?r.taskOpen=!0:r.taskClosed=!0,i.highlightFormatting&&(r.formatting="task"),r.taskList=!1,T(r);if(r.taskOpen=!1,r.taskClosed=!1,r.header&&e.match(/^#+$/,!0))return i.highlightFormatting&&(r.formatting="header"),T(r);var o=e.next();if(r.linkTitle){r.linkTitle=!1;var h=o;"("===o&&(h=")");var s="^\\s*(?:[^"+(h=(h+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+h;if(e.match(new RegExp(s),!0))return a.linkHref}if("`"===o){var m=r.formatting;i.highlightFormatting&&(r.formatting="code"),e.eatWhile("`");var u=e.current().length;if(0!=r.code||r.quote&&1!=u){if(u==r.code){var f=T(r);return r.code=0,f}return r.formatting=m,T(r)}return r.code=u,T(r)}if(r.code)return T(r);if("\\"===o&&(e.next(),i.highlightFormatting)){var c=T(r),k=a.formatting+"-escape";return c?c+" "+k:k}if("!"===o&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,i.highlightFormatting&&(r.formatting="image"),T(r);if("["===o&&r.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return r.imageMarker=!1,r.imageAltText=!0,i.highlightFormatting&&(r.formatting="image"),T(r);if("]"===o&&r.imageAltText){i.highlightFormatting&&(r.formatting="image");var c=T(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=b,c}if("["===o&&!r.image)return r.linkText=!0,i.highlightFormatting&&(r.formatting="link"),T(r);if("]"===o&&r.linkText){i.highlightFormatting&&(r.formatting="link");var c=T(r);return r.linkText=!1,r.inline=r.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?b:M,c}if("<"===o&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return r.f=r.inline=F,i.highlightFormatting&&(r.formatting="link"),(c=T(r))?c+=" ":c="",c+a.linkInline;if("<"===o&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return r.f=r.inline=F,i.highlightFormatting&&(r.formatting="link"),(c=T(r))?c+=" ":c="",c+a.linkEmail;if(i.xml&&"<"===o&&e.match(/^(!--|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*>)/i,!1)){var x=e.string.indexOf(">",e.pos);if(-1!=x){var v=e.string.substring(e.start,x);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(v)&&(r.md_inside=!0)}return e.backUp(1),r.htmlState=t.startState(n),p(e,r,S)}if(i.xml&&"<"===o&&e.match(/^\/\w*?>/))return r.md_inside=!1,"tag";if("*"===o||"_"===o){for(var L=1,q=1==e.pos?" ":e.string.charAt(e.pos-2);L<3&&e.eat(o);)L++;var E=e.peek()||" ",w=!/\s/.test(E)&&(!d.test(E)||/\s/.test(q)||d.test(q)),j=!/\s/.test(q)&&(!d.test(q)||/\s/.test(E)||d.test(E)),y=null,C=null;if(L%2&&(r.em||!w||"*"!==o&&j&&!d.test(q)?r.em!=o||!j||"*"!==o&&w&&!d.test(E)||(y=!1):y=!0),L>1&&(r.strong||!w||"*"!==o&&j&&!d.test(q)?r.strong!=o||!j||"*"!==o&&w&&!d.test(E)||(C=!1):C=!0),null!=C||null!=y){i.highlightFormatting&&(r.formatting=null==y?"strong":null==C?"em":"strong em"),!0===y&&(r.em=o),!0===C&&(r.strong=o);f=T(r);return!1===y&&(r.em=!1),!1===C&&(r.strong=!1),f}}else if(" "===o&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return T(r);e.backUp(1)}if(i.strikethrough)if("~"===o&&e.eatWhile(o)){if(r.strikethrough){i.highlightFormatting&&(r.formatting="strikethrough");f=T(r);return r.strikethrough=!1,f}if(e.match(/^[^\s]/,!1))return r.strikethrough=!0,i.highlightFormatting&&(r.formatting="strikethrough"),T(r)}else if(" "===o&&e.match(/^~~/,!0)){if(" "===e.peek())return T(r);e.backUp(2)}if(i.emoji&&":"===o&&e.match(/^[a-z_\d+-]+:/)){r.emoji=!0,i.highlightFormatting&&(r.formatting="emoji");var H=T(r);return r.emoji=!1,H}return" "===o&&(e.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),T(r)}function F(t,e){if(">"===t.next()){e.f=e.inline=M,i.highlightFormatting&&(e.formatting="link");var n=T(e);return n?n+=" ":n="",n+a.linkInline}return t.match(/^[^>]+/,!0),a.linkInline}function b(t,e){if(t.eatSpace())return null;var n,r=t.next();return"("===r||"["===r?(e.f=e.inline=(n="("===r?")":"]",function(t,e){var r=t.next();if(r===n){e.f=e.inline=M,i.highlightFormatting&&(e.formatting="link-string");var a=T(e);return e.linkHref=!1,a}return t.match(E[n]),e.linkHref=!0,T(e)}),i.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,T(e)):"error"}var E={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function w(t,e){return t.match(/^([^\]\\]|\\.)*\]:/,!1)?(e.f=j,t.next(),i.highlightFormatting&&(e.formatting="link"),e.linkText=!0,T(e)):k(t,e,M)}function j(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=y,i.highlightFormatting&&(e.formatting="link");var n=T(e);return e.linkText=!1,n}return t.match(/^([^\]\\]|\\.)+/,!0),a.linkText}function y(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=M,a.linkHref+" url")}var C={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:M,text:q,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&t.copyState(n,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?t.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(t,e){if(e.formatting=!1,t!=e.thisLine.stream){if(e.header=0,e.hr=!1,t.match(/^\s*$/,!0))return x(e),null;if(e.prevLine=e.thisLine,e.thisLine={stream:t},e.taskList=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,!e.localState&&(e.f=e.block,e.f!=S)){var i=t.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(e.indentation=i,e.indentationDiff=null,i>0)return null}}return e.f(t,e)},innerMode:function(t){return t.block==S?{state:t.htmlState,mode:n}:t.localState?{state:t.localState,mode:t.localMode}:{state:t,mode:C}},indent:function(e,i,r){return e.block==S&&n.indent?n.indent(e.htmlState,i,r):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,i,r):t.Pass},blankLine:x,getType:T,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return C},"xml"),t.defineMIME("text/markdown","markdown"),t.defineMIME("text/x-markdown","markdown")}); +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../tw-meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../tw-meta"],t):t(CodeMirror)}(function(j){"use strict";j.defineMode("markdown",function(c,x){var A=j.getMode(c,"text/html"),u="null"==A.name;void 0===x.highlightFormatting&&(x.highlightFormatting=!1),void 0===x.maxBlockquoteDepth&&(x.maxBlockquoteDepth=0),void 0===x.taskLists&&(x.taskLists=!1),void 0===x.strikethrough&&(x.strikethrough=!1),void 0===x.emoji&&(x.emoji=!1),void 0===x.fencedCodeBlockHighlighting&&(x.fencedCodeBlockHighlighting=!0),void 0===x.fencedCodeBlockDefaultMode&&(x.fencedCodeBlockDefaultMode="text/plain"),void 0===x.xml&&(x.xml=!0),void 0===x.tokenTypeOverrides&&(x.tokenTypeOverrides={});var C={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var t in C)C.hasOwnProperty(t)&&x.tokenTypeOverrides[t]&&(C[t]=x.tokenTypeOverrides[t]);var f=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,S=/^\[(x| )\](?=\s)/i,F=x.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,i=/^[^#!\[\]*_\\<>` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,v=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function B(t,e,i){return(e.f=e.inline=i)(t,e)}function L(t,e,i){return(e.f=e.block=i)(t,e)}function n(t){var e,i;return t.linkTitle=!1,t.linkHref=!1,t.linkText=!1,t.em=!1,t.strong=!1,t.strikethrough=!1,t.quote=0,t.indentedCode=!1,t.f==T&&((i=u)||(i="xml"==(e=j.innerMode(A,t.htmlState)).mode.name&&null===e.state.tagStart&&!e.state.context&&e.state.tokenize.isInText),i&&(t.f=b,t.block=a,t.htmlState=null)),t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.prevLine=t.thisLine,t.thisLine={stream:null},null}function a(t,e){var i,n=t.column()===e.indentation,u=!(i=e.prevLine.stream)||!/\S/.test(i.string),r=e.indentedCode,a=e.prevLine.hr,o=!1!==e.list,l=(e.listStack[e.listStack.length-1]||0)+3;e.indentedCode=!1;var h=e.indentation;if(null===e.indentationDiff&&(e.indentationDiff=e.indentation,o)){for(e.list=null;h"))return e.quote=n?1:e.quote+1,x.highlightFormatting&&(e.formatting="quote"),t.eatSpace(),q(e);if(!g&&!e.setext&&n&&e.indentation<=l&&(m=t.match(k))){var d=m[1]?"ol":"ul";return e.indentation=h+t.current().length,e.list=!0,e.quote=0,e.listStack.push(e.indentation),e.em=!1,e.strong=!1,e.code=!1,e.strikethrough=!1,x.taskLists&&t.match(S,!1)&&(e.taskList=!0),e.f=e.inline,x.highlightFormatting&&(e.formatting=["list","list-"+d]),q(e)}return n&&e.indentation<=l&&(m=t.match(p,!0))?(e.quote=0,e.fencedEndRE=new RegExp(m[1]+"+ *$"),e.localMode=x.fencedCodeBlockHighlighting&&function(t){var e;!j.findModeByName||(e=j.findModeByName(t))&&(t=e.mime||e.mimes[0]);var i=j.getMode(c,t);return"null"==i.name?null:i}(m[2]||x.fencedCodeBlockDefaultMode),e.localMode&&(e.localState=j.startState(e.localMode)),e.f=e.block=M,x.highlightFormatting&&(e.formatting="code-block"),e.code=-1,q(e)):e.setext||!(s&&o||e.quote||!1!==e.list||e.code||g||E.test(t.string))&&(m=t.lookAhead(1))&&(m=m.match(D))?(e.setext?(e.header=e.setext,e.setext=0,t.skipToEnd(),x.highlightFormatting&&(e.formatting="header")):(e.header="="==m[0].charAt(0)?1:2,e.setext=e.header),e.thisLine.header=!0,e.f=e.inline,q(e)):g?(t.skipToEnd(),e.hr=!0,e.thisLine.hr=!0,C.hr):"["===t.peek()?B(t,e,H):B(t,e,e.inline)}function T(t,e){var i,n=A.token(t,e.htmlState);return u||("xml"==(i=j.innerMode(A,e.htmlState)).mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||e.md_inside&&-1"))&&(e.f=b,e.block=a,e.htmlState=null),n}function M(t,e){var i,n=e.listStack[e.listStack.length-1]||0,u=e.indentation=t.quote?i.push(C.formatting+"-"+t.formatting[n]+"-"+t.quote):i.push("error"))}return t.taskOpen?i.push("meta"):t.taskClosed?i.push("property"):(t.linkHref?i.push(C.linkHref,"url"):(t.strong&&i.push(C.strong),t.em&&i.push(C.em),t.strikethrough&&i.push(C.strikethrough),t.emoji&&i.push(C.emoji),t.linkText&&i.push(C.linkText),t.code&&i.push(C.code),t.image&&i.push(C.image),t.imageAltText&&i.push(C.imageAltText,"link"),t.imageMarker&&i.push(C.imageMarker)),t.header&&i.push(C.header,C.header+"-"+t.header),t.quote&&(i.push(C.quote),!x.maxBlockquoteDepth||x.maxBlockquoteDepth>=t.quote?i.push(C.quote+"-"+t.quote):i.push(C.quote+"-"+x.maxBlockquoteDepth)),!1!==t.list&&((e=(t.listStack.length-1)%3)?1==e?i.push(C.list2):i.push(C.list3):i.push(C.list1)),t.trailingSpaceNewLine?i.push("trailing-space-new-line"):t.trailingSpace&&i.push("trailing-space-"+(t.trailingSpace%2?"a":"b"))),i.length?i.join(" "):null}function e(t,e){if(t.match(i,!0))return q(e)}function b(t,e){var i=e.text(t,e);if(void 0!==i)return i;if(e.list)return e.list=null,q(e);if(e.taskList)return" "===t.match(S,!0)[1]?e.taskOpen=!0:e.taskClosed=!0,x.highlightFormatting&&(e.formatting="task"),e.taskList=!1,q(e);if(e.taskOpen=!1,e.taskClosed=!1,e.header&&t.match(/^#+$/,!0))return x.highlightFormatting&&(e.formatting="header"),q(e);var n=t.next();if(e.linkTitle){e.linkTitle=!1;var u="("===n?")":n,r="^\\s*(?:[^"+(u=(u+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(r),!0))return C.linkHref}if("`"===n){var a=e.formatting;x.highlightFormatting&&(e.formatting="code"),t.eatWhile("`");var o=t.current().length;if(0!=e.code||e.quote&&1!=o){if(o!=e.code)return e.formatting=a,q(e);var l=q(e);return e.code=0,l}return e.code=o,q(e)}if(e.code)return q(e);if("\\"===n&&(t.next(),x.highlightFormatting)){var h=q(e),s=C.formatting+"-escape";return h?h+" "+s:s}if("!"===n&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return e.imageMarker=!0,e.image=!0,x.highlightFormatting&&(e.formatting="image"),q(e);if("["===n&&e.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return e.imageMarker=!1,e.imageAltText=!0,x.highlightFormatting&&(e.formatting="image"),q(e);if("]"===n&&e.imageAltText){x.highlightFormatting&&(e.formatting="image");var h=q(e);return e.imageAltText=!1,e.image=!1,e.inline=e.f=y,h}if("["===n&&!e.image)return e.linkText&&t.match(/^.*?\]/)||(e.linkText=!0,x.highlightFormatting&&(e.formatting="link")),q(e);if("]"===n&&e.linkText){x.highlightFormatting&&(e.formatting="link");var h=q(e);return e.linkText=!1,e.inline=e.f=t.match(/\(.*?\)| ?\[.*?\]/,!1)?y:b,h}if("<"===n&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return e.f=e.inline=w,x.highlightFormatting&&(e.formatting="link"),(h=q(e))?h+=" ":h="",h+C.linkInline;if("<"===n&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return e.f=e.inline=w,x.highlightFormatting&&(e.formatting="link"),(h=q(e))?h+=" ":h="",h+C.linkEmail;if(x.xml&&"<"===n&&t.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var g,m=t.string.indexOf(">",t.pos);return-1!=m&&(g=t.string.substring(t.start,m),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(g)&&(e.md_inside=!0)),t.backUp(1),e.htmlState=j.startState(A),L(t,e,T)}if(x.xml&&"<"===n&&t.match(/^\/\w*?>/))return e.md_inside=!1,"tag";if("*"===n||"_"===n){for(var d=1,c=1==t.pos?" ":t.string.charAt(t.pos-2);d<3&&t.eat(n);)d++;var f=t.peek()||" ",k=!/\s/.test(f)&&(!v.test(f)||/\s/.test(c)||v.test(c)),F=!/\s/.test(c)&&(!v.test(c)||/\s/.test(f)||v.test(f)),D=null,p=null;if(d%2&&(e.em||!k||"*"!==n&&F&&!v.test(c)?e.em!=n||!F||"*"!==n&&k&&!v.test(f)||(D=!1):D=!0),1"!==t.next())return t.match(/^[^>]+/,!0),C.linkInline;e.f=e.inline=b,x.highlightFormatting&&(e.formatting="link");var i=q(e);return i?i+=" ":i="",i+C.linkInline}function y(t,e){if(t.eatSpace())return null;var n,i=t.next();return"("===i||"["===i?(e.f=e.inline=(n="("===i?")":"]",function(t,e){if(t.next()!==n)return t.match(r[n]),e.linkHref=!0,q(e);e.f=e.inline=b,x.highlightFormatting&&(e.formatting="link-string");var i=q(e);return e.linkHref=!1,i}),x.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,q(e)):"error"}var r={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function H(t,e){return t.match(/^([^\]\\]|\\.)*\]:/,!1)?(e.f=o,t.next(),x.highlightFormatting&&(e.formatting="link"),e.linkText=!0,q(e)):B(t,e,b)}function o(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=l,x.highlightFormatting&&(e.formatting="link");var i=q(e);return e.linkText=!1,i}return t.match(/^([^\]\\]|\\.)+/,!0),C.linkText}function l(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=b,C.linkHref+" url")}var h={startState:function(){return{f:a,prevLine:{stream:null},thisLine:{stream:null},block:a,htmlState:null,indentation:0,inline:b,text:e,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&j.copyState(A,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?j.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkText:t.linkText,linkTitle:t.linkTitle,linkHref:t.linkHref,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.fencedEndRE}},token:function(t,e){if(e.formatting=!1,t!=e.thisLine.stream){if(e.header=0,e.hr=!1,t.match(/^\s*$/,!0))return n(e),null;if(e.prevLine=e.thisLine,e.thisLine={stream:t},e.taskList=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,!e.localState&&(e.f=e.block,e.f!=T)){var i=t.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(e.indentation=i,e.indentationDiff=null,0")):null:t.match("--")?n(m("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(function t(e){return function(n,r){for(var o;null!=(o=n.next());){if("<"==o)return r.tokenize=t(e+1),r.tokenize(n,r);if(">"==o){if(1==e){r.tokenize=s;break}return r.tokenize=t(e-1),r.tokenize(n,r)}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=m("meta","?>"),"meta"):(a=t.eat("/")?"closeTag":"openTag",e.tokenize=f,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function f(t,e){var n,r,o=t.next();if(">"==o||"/"==o&&t.eat(">"))return e.tokenize=s,a=">"==o?"endTag":"selfcloseTag","tag bracket";if("="==o)return a="equals",null;if("<"==o){e.tokenize=s,e.state=h,e.tagName=e.tagStart=null;var i=e.tokenize(t,e);return i?i+" tag error":"tag error"}return/[\'\"]/.test(o)?(e.tokenize=(n=o,(r=function(t,e){for(;!t.eol();)if(t.next()==n){e.tokenize=f;break}return"string"}).isInAttribute=!0,r),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=s;break}n.next()}return t}}function g(t){t.context&&(t.context=t.context.prev)}function p(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return;g(t)}}function h(t,e,n){return"openTag"==t?(n.tagStart=e.column(),x):"closeTag"==t?b:h}function x(t,e,n){return"word"==t?(n.tagName=e.current(),i="tag",v):u.allowMissingTagName&&"endTag"==t?(i="tag bracket",v(t,e,n)):(i="error",x)}function b(t,e,n){if("word"==t){var r=e.current();return n.context&&n.context.tagName!=r&&u.implicitlyClosed.hasOwnProperty(n.context.tagName)&&g(n),n.context&&n.context.tagName==r||!1===u.matchClosing?(i="tag",k):(i="tag error",w)}return u.allowMissingTagName&&"endTag"==t?(i="tag bracket",k(t,e,n)):(i="error",w)}function k(t,e,n){return"endTag"!=t?(i="error",k):(g(n),h)}function w(t,e,n){return i="error",k(t,0,n)}function v(t,e,n){if("word"==t)return i="attribute",T;if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,o=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||u.autoSelfClosers.hasOwnProperty(r)?p(n,r):(p(n,r),n.context=new function(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}(n,r,o==n.indented)),h}return i="error",v}function T(t,e,n){return"equals"==t?y:(u.allowMissing||(i="error"),v(t,0,n))}function y(t,e,n){return"string"==t?N:"word"==t&&u.allowUnquoted?(i="string",v):(i="error",v(t,0,n))}function N(t,e,n){return"string"==t?N:v(t,0,n)}return s.isInText=!0,{startState:function(t){var e={tokenize:s,state:h,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;a=null;var n=e.tokenize(t,e);return(n||a)&&"comment"!=n&&(i=null,e.state=e.state(a||n,t,e),i&&(n="error"==i?n+" error":i)),n},indent:function(e,n,r){var o=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+l;if(o&&o.noIndent)return t.Pass;if(e.tokenize!=f&&e.tokenize!=s)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==u.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+l*(u.multilineTagIndentFactor||1);if(u.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:u.htmlMode?"html":"xml",helperType:u.htmlMode?"html":"xml",skipAttribute:function(t){t.state==y&&(t.state=v)}}}),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(N){"use strict";var y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},z={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};N.defineMode("xml",function(t,e){var i,a,l=t.indentUnit,u={},n=e.htmlMode?y:z;for(var r in n)u[r]=n[r];for(var r in e)u[r]=e[r];function c(e,n){function t(t){return(n.tokenize=t)(e,n)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?t(s("atom","]]>")):null:e.match("--")?t(s("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),t(function r(o){return function(t,e){for(var n;null!=(n=t.next());){if("<"==n)return e.tokenize=r(o+1),e.tokenize(t,e);if(">"==n){if(1!=o)return e.tokenize=r(o-1),e.tokenize(t,e);e.tokenize=c;break}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),n.tokenize=s("meta","?>"),"meta"):(i=e.eat("/")?"closeTag":"openTag",n.tokenize=d,"tag bracket");if("&"!=r)return e.eatWhile(/[^&<]/),null;var o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";");return o?"atom":"error"}function d(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=c,i=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return i="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(e.tokenize=(r=n,a.isInAttribute=!0,a),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");e.tokenize=c,e.state=g,e.tagName=e.tagStart=null;var r,o=e.tokenize(t,e);return o?o+" tag error":"tag error";function a(t,e){for(;!t.eol();)if(t.next()==r){e.tokenize=d;break}return"string"}}function s(n,r){return function(t,e){for(;!t.eol();){if(t.match(r)){e.tokenize=c;break}t.next()}return n}}function f(t,e,n){this.prev=t.context,this.tagName=e||"",this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function o(t){t.context&&(t.context=t.context.prev)}function m(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return;o(t)}}function g(t,e,n){return"openTag"==t?(n.tagStart=e.column(),p):"closeTag"==t?h:g}function p(t,e,n){return"word"==t?(n.tagName=e.current(),a="tag",k):u.allowMissingTagName&&"endTag"==t?(a="tag bracket",k(t,0,n)):(a="error",p)}function h(t,e,n){if("word"!=t)return u.allowMissingTagName&&"endTag"==t?(a="tag bracket",x(t,0,n)):(a="error",b);var r=e.current();return n.context&&n.context.tagName!=r&&u.implicitlyClosed.hasOwnProperty(n.context.tagName)&&o(n),n.context&&n.context.tagName==r||!1===u.matchClosing?(a="tag",x):(a="tag error",b)}function x(t,e,n){return"endTag"!=t?(a="error",x):(o(n),g)}function b(t,e,n){return a="error",x(t,0,n)}function k(t,e,n){if("word"==t)return a="attribute",v;if("endTag"!=t&&"selfcloseTag"!=t)return a="error",k;var r=n.tagName,o=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||u.autoSelfClosers.hasOwnProperty(r)?m(n,r):(m(n,r),n.context=new f(n,r,o==n.indented)),g}function v(t,e,n){return"equals"==t?w:(u.allowMissing||(a="error"),k(t,0,n))}function w(t,e,n){return"string"==t?T:"word"==t&&u.allowUnquoted?(a="string",k):(a="error",k(t,0,n))}function T(t,e,n){return"string"==t?T:k(t,0,n)}return c.isInText=!0,{startState:function(t){var e={tokenize:c,state:g,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;i=null;var n=e.tokenize(t,e);return(n||i)&&"comment"!=n&&(a=null,e.state=e.state(i||n,t,e),a&&(n="error"==a?n+" error":a)),n},indent:function(t,e,n){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+l;if(r&&r.noIndent)return N.Pass;if(t.tokenize!=d&&t.tokenize!=c)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==u.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+l*(u.multilineTagIndentFactor||1);if(u.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:u.htmlMode?"html":"xml",helperType:u.htmlMode?"html":"xml",skipAttribute:function(t){t.state==w&&(t.state=k)},xmlCurrentTag:function(t){return t.tagName?{name:t.tagName,close:"closeTag"==t.type}:null},xmlCurrentContext:function(t){for(var e=[],n=t.context;n;n=n.prev)e.push(n.tagName);return e.reverse()}}}),N.defineMIME("text/xml","xml"),N.defineMIME("application/xml","xml"),N.mimeModes.hasOwnProperty("text/html")||N.defineMIME("text/html",{name:"xml",htmlMode:!0})}); diff --git a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/jump-to-line.js b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/jump-to-line.js index 5c0e2d945..c4285a645 100644 --- a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/jump-to-line.js +++ b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/jump-to-line.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function o(e,o){var r=Number(o);return/^[-+]/.test(o)?e.getCursor().line+r:r-1}e.commands.jumpToLine=function(e){var r,i,t,s,n,l=e.getCursor();r=e,i='Jump to line: (Use line:column or scroll% syntax)',t="Jump to line:",s=l.line+1+":"+l.ch,n=function(r){var i;if(r)if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(r))e.setCursor(o(e,i[1]),Number(i[2]));else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(r)){var t=Math.round(e.lineCount()*Number(i[1])/100);/^[-+]/.test(i[1])&&(t=l.line+t+1),e.setCursor(t-1,l.ch)}else(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(r))&&e.setCursor(o(e,i[1]),l.ch)},r.openDialog?r.openDialog(i,n,{value:s,selectValueOnOpen:!0}):n(prompt(t,s))},e.keyMap.default["Alt-G"]="jumpToLine"}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function u(e,o){var r=Number(o);return/^[-+]/.test(o)?e.getCursor().line+r:r-1}e.commands.jumpToLine=function(t){var e,o,r,s,i,n,l=t.getCursor();o=(n=e=t).phrase("Jump to line:")+' '+n.phrase("(Use line:column or scroll% syntax)")+"",r=t.phrase("Jump to line:"),s=l.line+1+":"+l.ch,i=function(e){var o,r;e&&((o=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(e))?t.setCursor(u(t,o[1]),Number(o[2])):(o=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(e))?(r=Math.round(t.lineCount()*Number(o[1])/100),/^[-+]/.test(o[1])&&(r=l.line+r+1),t.setCursor(r-1,l.ch)):(o=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(e))&&t.setCursor(u(t,o[1]),l.ch))},e.openDialog?e.openDialog(o,i,{value:s,selectValueOnOpen:!0}):i(prompt(r,s))},e.keyMap.default["Alt-G"]="jumpToLine"}); diff --git a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/search.js b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/search.js index f61ca05e5..7efd7994a 100644 --- a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/search.js +++ b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/search.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function o(e){return e.state.search||(e.state.search=new function(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null})}function n(e){return"string"==typeof e&&e==e.toLowerCase()}function r(e,o,r){return e.getSearchCursor(o,r,{caseFold:n(o),multiline:!0})}function t(e,o,n,r,t){e.openDialog?e.openDialog(o,t,{value:r,selectValueOnOpen:!0}):t(prompt(n,r))}function i(e){return e.replace(/\\(.)/g,function(e,o){return"n"==o?"\n":"r"==o?"\r":o})}function a(e){var o=e.match(/^\/(.*)\/([a-z]*)$/);if(o)try{e=new RegExp(o[1],-1==o[2].indexOf("i")?"":"i")}catch(e){}else e=i(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}var s='Search: (Use /re/ syntax for regexp search)';function c(e,o,r){var t,i;o.queryText=r,o.query=a(r),e.removeOverlay(o.overlay,n(o.query)),o.overlay=(t=o.query,i=n(o.query),"string"==typeof t?t=new RegExp(t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i?"gi":"g"):t.global||(t=new RegExp(t.source,t.ignoreCase?"gi":"g")),{token:function(e){t.lastIndex=e.pos;var o=t.exec(e.string);if(o&&o.index==e.pos)return e.pos+=o[0].length||1,"searching";o?e.pos=o.index:e.skipToEnd()}}),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,n(o.query)))}function l(n,r,i,a){var l=o(n);if(l.query)return u(n,r);var p,d,y,m,g,h=n.getSelection()||l.lastQuery;if(h instanceof RegExp&&"x^"==h.source&&(h=null),i&&n.openDialog){var v=null,x=function(o,r){e.e_stop(r),o&&(o!=l.queryText&&(c(n,l,o),l.posFrom=l.posTo=n.getCursor()),v&&(v.style.opacity=1),u(n,r.shiftKey,function(e,o){var r;o.line<3&&document.querySelector&&(r=n.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>n.cursorCoords(o,"window").top&&((v=r).style.opacity=.4)}))};d=s,y=h,m=x,g=function(r,t){var i=e.keyName(r),a=n.getOption("extraKeys"),s=a&&a[i]||e.keyMap[n.getOption("keyMap")][i];"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(r),c(n,o(n),t),n.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(r),x(t,r))},(p=n).openDialog(d,m,{value:y,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){f(p)},onKeyDown:g}),a&&h&&(c(n,l,h),u(n,r))}else t(n,s,"Search for:",h,function(e){e&&!l.query&&n.operation(function(){c(n,l,e),l.posFrom=l.posTo=n.getCursor(),u(n,r)})})}function u(n,t,i){n.operation(function(){var a=o(n),s=r(n,a.query,t?a.posFrom:a.posTo);(s.find(t)||(s=r(n,a.query,t?e.Pos(n.lastLine()):e.Pos(n.firstLine(),0))).find(t))&&(n.setSelection(s.from(),s.to()),n.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function f(e){e.operation(function(){var n=o(e);n.lastQuery=n.query,n.query&&(n.query=n.queryText=null,e.removeOverlay(n.overlay),n.annotate&&(n.annotate.clear(),n.annotate=null))})}var p=' (Use /re/ syntax for regexp search)',d='With: ',y='Replace? ';function m(e,o,n){e.operation(function(){for(var t=r(e,o);t.findNext();)if("string"!=typeof o){var i=e.getRange(t.from(),t.to()).match(o);t.replace(n.replace(/\$(\d)/g,function(e,o){return i[o]}))}else t.replace(n)})}function g(e,n){if(!e.getOption("readOnly")){var s=e.getSelection()||o(e).lastQuery,c=''+(n?"Replace all:":"Replace:")+"";t(e,c+p,c,s,function(o){o&&(o=a(o),t(e,d,"Replace with:","",function(t){if(t=i(t),n)m(e,o,t);else{f(e);var a=r(e,o,e.getCursor("from")),s=function(){var n,i,l,u,f,p=a.from();!(n=a.findNext())&&(a=r(e,o),!(n=a.findNext())||p&&a.from().line==p.line&&a.from().ch==p.ch)||(e.setSelection(a.from(),a.to()),e.scrollIntoView({from:a.from(),to:a.to()}),l=y,u="Replace?",f=[function(){c(n)},s,function(){m(e,o,t)}],(i=e).openConfirm?i.openConfirm(l,f):confirm(u)&&f[0]())},c=function(e){a.replace("string"==typeof o?t:t.replace(/\$(\d)/g,function(o,n){return e[n]})),s()};s()}}))})}}e.commands.find=function(e){f(e),l(e)},e.commands.findPersistent=function(e){f(e),l(e,!1,!0)},e.commands.findPersistentNext=function(e){l(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){l(e,!0,!0,!0)},e.commands.findNext=l,e.commands.findPrev=function(e){l(e,!0)},e.commands.clearSearch=f,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(d){"use strict";function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function y(e){return e.state.search||(e.state.search=new n)}function a(e){return"string"==typeof e&&e==e.toLowerCase()}function m(e,n,o){return e.getSearchCursor(n,o,{caseFold:a(n),multiline:!0})}function h(e,n,o,r,t){e.openDialog?e.openDialog(n,t,{value:r,selectValueOnOpen:!0}):t(prompt(o,r))}function r(e){return e.replace(/\\([nrt\\])/g,function(e,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"==n?"\\":e})}function s(e){var n=e.match(/^\/(.*)\/([a-z]*)$/);if(n)try{e=new RegExp(n[1],-1==n[2].indexOf("i")?"":"i")}catch(e){}else e=r(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function g(e,n,o){var r,t;n.queryText=o,n.query=s(o),e.removeOverlay(n.overlay,a(n.query)),n.overlay=(r=n.query,t=a(n.query),"string"==typeof r?r=new RegExp(r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):r.global||(r=new RegExp(r.source,r.ignoreCase?"gi":"g")),{token:function(e){r.lastIndex=e.pos;var n=r.exec(e.string);if(n&&n.index==e.pos)return e.pos+=n[0].length||1,"searching";n?e.pos=n.index:e.skipToEnd()}}),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,a(n.query)))}function o(a,n,e,o){var r=y(a);if(r.query)return x(a,n);var t,s,i,c,l,u,p,f=a.getSelection()||r.lastQuery;f instanceof RegExp&&"x^"==f.source&&(f=null),e&&a.openDialog?(t=null,s=function(e,n){d.e_stop(n),e&&(e!=r.queryText&&(g(a,r,e),r.posFrom=r.posTo=a.getCursor()),t&&(t.style.opacity=1),x(a,n.shiftKey,function(e,n){var o;n.line<3&&document.querySelector&&(o=a.display.wrapper.querySelector(".CodeMirror-dialog"))&&o.getBoundingClientRect().bottom-4>a.cursorCoords(n,"window").top&&((t=o).style.opacity=.4)}))},c=C(i=a),l=f,u=s,p=function(e,n){var o=d.keyName(e),r=a.getOption("extraKeys"),t=r&&r[o]||d.keyMap[a.getOption("keyMap")][o];"findNext"==t||"findPrev"==t||"findPersistentNext"==t||"findPersistentPrev"==t?(d.e_stop(e),g(a,y(a),n),a.execCommand(t)):"find"!=t&&"findPersistent"!=t||(d.e_stop(e),s(n,e))},i.openDialog(c,u,{value:l,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){v(i)},onKeyDown:p}),o&&f&&(g(a,r,f),x(a,n))):h(a,C(a),"Search for:",f,function(e){e&&!r.query&&a.operation(function(){g(a,r,e),r.posFrom=r.posTo=a.getCursor(),x(a,n)})})}function x(o,r,t){o.operation(function(){var e=y(o),n=m(o,e.query,r?e.posFrom:e.posTo);(n.find(r)||(n=m(o,e.query,r?d.Pos(o.lastLine()):d.Pos(o.firstLine(),0))).find(r))&&(o.setSelection(n.from(),n.to()),o.scrollIntoView({from:n.from(),to:n.to()},20),e.posFrom=n.from(),e.posTo=n.to(),t&&t(n.from(),n.to()))})}function v(n){n.operation(function(){var e=y(n);e.lastQuery=e.query,e.query&&(e.query=e.queryText=null,n.removeOverlay(e.overlay),e.annotate&&(e.annotate.clear(),e.annotate=null))})}function C(e){return''+e.phrase("Search:")+' '+e.phrase("(Use /re/ syntax for regexp search)")+""}function q(n,r,t){n.operation(function(){for(var o,e=m(n,r);e.findNext();){"string"!=typeof r?(o=n.getRange(e.from(),e.to()).match(r),e.replace(t.replace(/\$(\d)/g,function(e,n){return o[n]}))):e.replace(t)}})}function t(f,e){var n,o;f.getOption("readOnly")||(n=f.getSelection()||y(f).lastQuery,o=''+(e?f.phrase("Replace all:"):f.phrase("Replace:"))+"",h(f,o+(' '+f.phrase("(Use /re/ syntax for regexp search)")+""),o,n,function(p){p&&(p=s(p),h(f,''+f.phrase("With:")+' ',f.phrase("Replace with:"),"",function(i){var c,l,u;i=r(i),e?q(f,p,i):(v(f),c=m(f,p,f.getCursor("from")),l=function(){var e,n,o,r,t,a,s=c.from();!(e=c.findNext())&&(c=m(f,p),!(e=c.findNext())||s&&c.from().line==s.line&&c.from().ch==s.ch)||(f.setSelection(c.from(),c.to()),f.scrollIntoView({from:c.from(),to:c.to()}),o=''+(a=n=f).phrase("Replace?")+" ",r=f.phrase("Replace?"),t=[function(){u(e)},l,function(){q(f,p,i)}],n.openConfirm?n.openConfirm(o,t):confirm(r)&&t[0]())},u=function(o){c.replace("string"==typeof p?i:i.replace(/\$(\d)/g,function(e,n){return o[n]})),l()},l())}))}))}d.commands.find=function(e){v(e),o(e)},d.commands.findPersistent=function(e){v(e),o(e,!1,!0)},d.commands.findPersistentNext=function(e){o(e,!1,!0,!0)},d.commands.findPersistentPrev=function(e){o(e,!0,!0,!0)},d.commands.findNext=o,d.commands.findPrev=function(e){o(e,!0)},d.commands.clearSearch=v,d.commands.replace=t,d.commands.replaceAll=function(e){t(e,!0)}}); diff --git a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/searchcursor.js b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/searchcursor.js index c10445711..a2f62a0f7 100755 --- a/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/searchcursor.js +++ b/plugins/tiddlywiki/codemirror-search-replace/files/addon/search/searchcursor.js @@ -1,3 +1,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var e,n,r=t.Pos;function i(t,e){for(var n,r,i=null!=(r=(n=t).flags)?r:(n.ignoreCase?"i":"")+(n.global?"g":"")+(n.multiline?"m":""),o=i,l=0;l>1,h=r(t.slice(0,l)).length;if(h==n)return l;h>n?o=l:i=l+1}}function s(t,s,c,f){var u;this.atOccurrence=!1,this.doc=t,c=c?t.clipPos(c):r(0,0),this.pos={from:c,to:c},"object"==typeof f?u=f.caseFold:(u=f,f=null),"string"==typeof s?(null==u&&(u=!1),this.matches=function(i,o){return(i?function(t,i,o,l){if(!i.length)return null;var s=l?e:n,c=s(i).split(/\r|\n\r?/);t:for(var f=o.line,u=o.ch,a=t.firstLine()-1+c.length;f>=a;f--,u=-1){var g=t.getLine(f);u>-1&&(g=g.slice(0,u));var m=s(g);if(1==c.length){var d=m.lastIndexOf(c[0]);if(-1==d)continue t;return{from:r(f,h(g,m,d,s)),to:r(f,h(g,m,d+c[0].length,s))}}var v=c[c.length-1];if(m.slice(0,v.length)==v){var p=1;for(o=f-c.length+1;p=s;o--,h=-1){var c=t.getLine(o);h>-1&&(c=c.slice(0,h));var f=l(c,e);if(f)return{from:r(o,f.index),to:r(o,f.index+f[0].length),match:f}}}:o)(t,s,n)}:this.matches=function(e,n){return(e?function(t,e,n){e=i(e,"gm");for(var o,h=1,s=n.line,c=t.firstLine();s>=c;){for(var f=0;fc);f++){var u=t.getLine(s++);l=null==l?u:l+"\n"+u}h*=2,e.lastIndex=n.ch;var a=e.exec(l);if(a){var g=l.slice(0,a.index).split("\n"),m=a[0].split("\n"),d=n.line+g.length-1,v=g[g.length-1].length;return{from:r(d,v),to:r(d+m.length-1,1==m.length?v+m[0].length:m[m.length-1].length),match:a}}}})(t,s,n)})}String.prototype.normalize?(e=function(t){return t.normalize("NFD").toLowerCase()},n=function(t){return t.normalize("NFD")}):(e=function(t){return t.toLowerCase()},n=function(t){return t}),s.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){for(var n=this.matches(e,this.doc.clipPos(e?this.pos.from:this.pos.to));n&&0==t.cmpPos(n.from,n.to);)e?n.from.ch?n.from=r(n.from.line,n.from.ch-1):n=n.from.line==this.doc.firstLine()?null:this.matches(e,this.doc.clipPos(r(n.from.line-1))):n.to.ch0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}); \ No newline at end of file +// Distributed under an MIT license: https://codemirror.net/LICENSE +!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(i){"use strict";var p,x,L=i.Pos;function d(t,e){for(var n,r,i=null!=(r=(n=t).flags)?r:(n.ignoreCase?"i":"")+(n.global?"g":"")+(n.multiline?"m":""),o=i,l=0;lt.length-n)break;(!r||l>r.index+r[0].length)&&(r=o),i=o.index+1}return r}function O(t,e,n){e=d(e,"g");for(var r=n.line,i=n.ch,o=t.firstLine();o<=r;r--,i=-1){var l=t.getLine(r),h=C(l,e,i<0?0:l.length-i);if(h)return{from:L(r,h.index),to:L(r,h.index+h[0].length),match:h}}}function b(t,e,n,r){if(t.length==e.length)return n;for(var i=0,o=n+Math.max(0,t.length-e.length);;){if(i==o)return i;var l=i+o>>1,h=r(t.slice(0,l)).length;if(h==n)return l;nspan::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none} +.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,0.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3,.cm-s-default .cm-type{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line > span::selection,.CodeMirror-line > span > span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line > span::-moz-selection,.CodeMirror-line > span > span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none} diff --git a/plugins/tiddlywiki/codemirror/files/codemirror.js b/plugins/tiddlywiki/codemirror/files/codemirror.js index 801840569..231e8a0da 100755 --- a/plugins/tiddlywiki/codemirror/files/codemirror.js +++ b/plugins/tiddlywiki/codemirror/files/codemirror.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),u=a&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,a=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=r||l&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var r=e.className,n=L(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function O(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null};function B(e,t){for(var r=0;r=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var Y=[""];function _(e){for(;Y.length<=e;)Y.push(q(Y)+" ");return Y[e]}function q(e){return e[e.length-1]}function $(e,t){for(var r=[],n=0;n"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t=e.first&&to?ge(o,se(e,o).text.length):(r=t,n=se(e,t.line).text.length,null==(i=r.ch)||i>n?ge(r.line,n):i<0?ge(r.line,0):r)}function Se(e,t){for(var r=[],n=0;n=t:o.to>t);(n||(n=[])).push(new Te(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from0&&s)for(var b=0;b=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.to,r)>=0:ve(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.from,n)<=0:ve(u.from,n)<0)))return!0}}}function Be(e){for(var t;t=ze(e);)e=t.find(-1,!0).line;return e}function Ge(e,t){var r=se(e,t),n=Be(r);return r==n?t:he(n)}function Ue(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!Ve(e,n))return t;for(;r=Ie(n);)n=r.find(1,!0).line;return he(n)+1}function Ve(e,t){var r=ke&&t.markedSpans;if(r)for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var _e=null;function qe(e,t,r){var n;_e=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:_e=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:_e=i)}return null!=n?n:_e}var $e=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,u){var c="ltr"==u?"L":"R";if(0==a.length||"ltr"==u&&!r.test(a))return!1;for(var h,f=a.length,d=[],p=0;p-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function rt(e,t){var r=et(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function lt(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function at(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ut(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ct(e){st(e),at(e)}function ht(e){return e.target||e.srcElement}function ft(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var dt,pt,gt=function(){if(l&&s<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function vt(e){if(null==dt){var t=O("span","​");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=dt?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function mt(e){if(null!=pt)return pt;var t=N(e,document.createTextNode("AخA")),r=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(pt=n.right-r.right<3)}var yt,bt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},wt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},xt="oncopy"in(yt=O("div"))||(yt.setAttribute("oncopy","return;"),"function"==typeof yt.oncopy),Ct=null;var St={},Lt={};function kt(e){if("string"==typeof e&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&"string"==typeof e.name&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Tt(e,t){t=kt(t);var r=St[t.name];if(!r)return Tt(e,"text/plain");var n=r(e,t);if(Mt.hasOwnProperty(t.name)){var i=Mt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Mt={};function Nt(e,t){z(t,Mt.hasOwnProperty(e)?Mt[e]:Mt[e]={})}function Ot(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function At(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Dt(e,t,r){return!e.startState||e.startState(t,r)}var Wt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Wt.prototype.eol=function(){return this.pos>=this.string.length},Wt.prototype.sol=function(){return this.pos==this.lineStart},Wt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Wt.prototype.next=function(){if(this.post},Wt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Wt.prototype.skipToEnd=function(){this.pos=this.string.length},Wt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Wt.prototype.backUp=function(e){this.pos-=e},Wt.prototype.column=function(){return this.lastColumnPos0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Wt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Wt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Wt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Wt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Ht=function(e,t){this.state=e,this.lookAhead=t},Ft=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Pt(e,t,r,n){var i=[e.state.modeGen],o={};Kt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,u=0;r.state=!0,Kt(e,t.text,s.mode,r,function(e,t){for(var r=a;ue&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;re.options.maxHighlightLength&&Ot(e.doc.mode,n.state),o=Pt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Ft(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=se(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof Ht?u.lookAhead:0)<=o.modeFrontier))return s;var c=I(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}(e,t,r),l=o>n.first&&se(n,o-1).stateAfter,s=l?Ft.fromSaved(n,l,o):new Ft(n,Dt(n.mode),o);return n.iter(o,t,function(r){It(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&nt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Ft.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ft.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ft.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ft.fromSaved=function(e,t,r){return t instanceof Ht?new Ft(e,Ot(e.mode,t.state),r,t.lookAhead):new Ft(e,Ot(e.mode,t),r)},Ft.prototype.save=function(e){var t=!1!==e?Ot(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ht(t,this.maxLookAhead):t};var Gt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ut(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=se(l,(t=Ce(l,t)).line),u=zt(e,t.line,r),c=new Wt(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pose.options.maxHighlightLength?(s=!1,l&&It(e,t,n,h.pos),h.pos=t.length,a=null):a=Vt(Bt(r,h,n.state,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u1&&!/ /.test(e))return e;for(var r=t,n="",i=0;iu&&h.from<=u);f++);if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function Jt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function er(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=h=s="",f=null,m=1/0;for(var y=[],b=void 0,w=0;wp||C.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!h&&(h=C.title),C.collapsed&&(!f||Pe(f.marker,C)<0)&&(f=x)):x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S=d)break;for(var k=Math.min(d,m);;){if(v){var T=p+v.length;if(!f){var M=T>k?v.slice(0,k-p):v;t.addToken(t,M,l?l+a:a,c,p+M.length==m?u:"",h,s)}if(T>=k){v=v.slice(k-p),p=k;break}p=T,c=""}v=i.slice(o,o=r[g++]),l=_t(r[g++],t.cm.options)}}else for(var N=1;Nr)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Tr(e,t,r,n){return Or(e,Nr(e,t),r,n)}function Mr(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&t2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Wr(t.map,r,n),a=o.node,u=o.start,c=o.end,h=o.collapse;if(3==a.nodeType){for(var f=0;f<4;f++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;u>0&&(h=n="right"),i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Qr(e.display),top:p.top,bottom:p.bottom}:Dr}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;bt)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u=0&&(r=e[i]).left==r.right;i--);return r}function Fr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var h=qe(s,a,u),f=_e,d=c(a,h,"before"==u);return null!=f&&(d.other=c(a,f,"before"!=u)),d}function Kr(e,t){var r=0;t=Ce(e.doc,t),e.options.lineWrapping||(r=Qr(e.display)*t.ch);var n=se(e.doc,t.line),i=je(n)+br(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function jr(e,t,r,n,i){var o=ge(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function Xr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return jr(n.first,0,null,!0,-1);var i=fe(n,r),o=n.first+n.size-1;if(i>o)return jr(n.first+n.size-1,se(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=se(n,i);;){var s=$r(e,l,i,t,r),a=Ie(l),u=a&&a.find(0,!0);if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=he(l=u.to.line)}}function Yr(e,t,r,n){n-=Rr(t);var i=t.text.length,o=le(function(t){return Or(e,r,t-1).bottom<=n},i,0);return{begin:o,end:i=le(function(t){return Or(e,r,t).top>n},o,i)}}function _r(e,t,r,n){return r||(r=Nr(e,t)),Yr(e,t,r,Br(e,t,Or(e,r,n),"line").top)}function qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function $r(e,t,r,n,i){i-=je(t);var o=Nr(e,t),l=Rr(t),s=0,a=t.text.length,u=!0,c=Ze(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Yr(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f=u||d.to<=a)){var p=1!=d.level,g=Or(e,n,p?Math.min(u,d.to)-1:Math.max(a,d.from)).right,v=gv)&&(c=d,h=v)}}c||(c=i[i.length-1]);c.fromu&&(c={from:c.from,to:u,level:c.level});return c}:function(e,t,r,n,i,o,l){var s=le(function(s){var a=i[s],u=1!=a.level;return qr(Vr(e,ge(r,u?a.to:a.from,u?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=Vr(e,ge(r,u?a.from:a.to,u?"after":"before"),"line",t,n);qr(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a})(e,t,r,o,c,n,i);s=(u=1!=h.level)?h.from:h.to-1,a=u?h.to:h.from-1}var f,d,p=null,g=null,v=le(function(t){var r=Or(e,o,t);return r.top+=l,r.bottom+=l,!!qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},s,a),m=!1;if(g){var y=n-g.left=w.bottom}return jr(r,v=oe(t.text,v,1),d,m,n-f)}function Zr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ar){Ar=O("pre");for(var t=0;t<49;++t)Ar.appendChild(document.createTextNode("x")),Ar.appendChild(O("br"));Ar.appendChild(document.createTextNode("x"))}N(e.measure,Ar);var r=Ar.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function Qr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t]);N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Jr(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:en(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function en(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function tn(e){var t=Zr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Qr(e.display)-3);return function(i){if(Ve(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n=e.display.viewTo||s.to().linet||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?w:b)&&C,L=(u?b:w)&&x?s:(v?m:y).left,k=S?a:(v?y:m).right;c(L,m.top,k-L,m.bottom)}else{var T,M,N,O;v?(T=u&&b&&x?s:m.left,M=u?a:p(e,i,"before"),N=u?s:p(t,i,"after"),O=u&&w&&C?a:y.right):(T=u?p(e,i,"before"):s,M=!u&&b&&x?a:m.right,N=!u&&w&&C?s:y.left,O=u?p(t,i,"after"):a),c(T,m.top,M-T,m.bottom),m.bottom0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function fn(e){e.state.focused||(e.display.input.focus(),pn(e))}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function pn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(rt(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(rt(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function vn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||c<-.005)&&(ce(i.line,o),mn(i.line),i.rest))for(var h=0;h=l&&(o=fe(t,je(se(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function bn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=en(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;lo&&(t.bottom=t.top+o);var s=e.doc.height+wr(r),a=t.tops-n;if(t.topi+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),d=t.right-t.left>f;return d&&(t.right=t.left+f),t.left<10?l.scrollLeft=0:t.leftf+h-3&&(l.scrollLeft=t.right+(d?0:10)-f),l}function Cn(e,t){null!=t&&(kn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){kn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ln(e,t,r){null==t&&null==r||kn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function kn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Tn(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Tn(e,t,r,n){var i=xn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Ln(e,i.scrollLeft,i.scrollTop)}function Mn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ii(e,{top:t}),Nn(e,t,!0),r&&ii(e),Jn(e,100))}function Nn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function On(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,bn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function An(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+wr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Dn=function(e,t,r){this.cm=r;var n=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Je(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Dn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Dn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Dn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Dn.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Dn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)})},Dn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Wn=function(){};function Hn(e,t){t||(t=An(e));var r=e.display.barWidth,n=e.display.barHeight;Fn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&vn(e),Fn(e,An(e)),r=e.display.barWidth,n=e.display.barHeight}function Fn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Wn.prototype.update=function(){return{bottom:0,right:0}},Wn.prototype.setScrollLeft=function(){},Wn.prototype.setScrollTop=function(){},Wn.prototype.clear=function(){};var Pn={native:Dn,null:Wn};function En(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Pn[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?On(e,t):Mn(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var zn=0;function In(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++zn},t=e.curOp,nr?nr.ops.push(t):t.ownsGroup=nr={ops:[t],delayedCallbacks:[]}}function Rn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r=i.viewTo)||i.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new ti(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Gn(e){var t=e.cm,r=t.display;e.updatedDisplay&&vn(t),e.barMeasure=An(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Tr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Sr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Un(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-br(e.display))+"px;\n height: "+(t.bottom-t.top+Cr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?ge(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Vr(e,t),a=r&&r!=t?Vr(e,r):s,u=xn(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(Mn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(On(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}(t,Ce(n,e.scrollToPos.from),Ce(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;lt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)ke&&Ge(e.doc,t)i.viewFrom?$n(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)$n(e);else if(t<=i.viewFrom){var o=Zn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):$n(e)}else if(r>=i.viewTo){var l=Zn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):$n(e)}else{var s=Zn(e,t,t,-1),a=Zn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(rr(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):$n(e)}var u=i.externalMeasured;u&&(r=i.lineN&&t=n.viewTo)){var o=n.view[on(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,r)&&l.push(r)}}}function $n(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Zn(e,t,r,n){var i,o=on(e,t),l=e.display.view;if(!ke||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Ge(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Qn(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo)){var r=+new Date+e.options.workTime,n=zt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Ot(t.mode,n.state):null,a=Pt(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&fr)return Jn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Kn(e,function(){for(var t=0;t=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Qn(e))return!1;wn(e)&&($n(e),t.dims=Jr(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroml&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),ke&&(o=Ge(e.doc,o),l=Ue(e.doc,l));var s,u,c,h,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;u=o,c=l,0==(h=(s=e).display).view.length||u>=h.viewTo||c<=h.viewFrom?(h.view=rr(s,u,c),h.viewFrom=u):(h.viewFrom>u?h.view=rr(s,u,h.viewFrom).concat(h.view):h.viewFromc&&(h.view=h.view.slice(0,on(s,c)))),h.viewTo=c,r.viewOffset=je(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=Qn(e);if(!f&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var p=function(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return d>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,h=0;h-1&&(d=!1),sr(e,f,c,r)),d&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(pe(e.options,c)))),l=f.node.nextSibling}else{var p=(m=c,b=r,void 0,w=ur(g=e,v=f),v.text=v.node=w.pre,w.bgClass&&(v.bgClass=w.bgClass),w.textClass&&(v.textClass=w.textClass),hr(g,v),fr(g,v,m,b),pr(g,v,b),v.node);o.insertBefore(p,l)}c+=f.size}var g,v,m,b,w;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),d>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=W()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(p),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Jn(e,400)),r.updateLineNumbers=null,!0}function ni(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Sr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+wr(e.display)-Lr(e),r.top)}),t.visible=yn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ri(e,t);n=!1){vn(e);var i=An(e);ln(e),Hn(e,i),li(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ii(e,t){var r=new ti(e,t);if(ri(e,r)){vn(e),ni(e,r);var n=An(e);ln(e),Hn(e,n),li(e,n),r.finish()}}function oi(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function li(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Cr(e)+"px"}function si(e){var t=e.display.gutters,r=e.options.gutters;M(t);for(var n=0;n-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ti.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ti.prototype.finish=function(){for(var e=0;es.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&a)e:for(var f=t.target,d=l.view;f!=s;f=f.parentNode)for(var p=0;p=0&&ve(e,n.to())<=0)return r}return-1};var gi=function(e,t){this.anchor=e,this.head=t};function vi(e,t){var r=e[t];e.sort(function(e,t){return ve(e.from(),t.from())}),t=B(e,r);for(var n=1;n=0){var l=we(o.from(),i.from()),s=be(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new gi(a?s:l,a?l:s))}}return new pi(e,t)}function mi(e,t){return new pi([new gi(e,t||e)],0)}function yi(e){return e.text?ge(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function bi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return yi(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=yi(t).ch-t.to.ch),ge(r,n)}function wi(e,t){for(var r=[],n=0;n1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}or(e,"change",e,t)}function Ti(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;la-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(s=i,o=i.lastOp==n?(Di(s.done),q(s.done)):s.done.length&&!q(s.done).ranges?q(s.done):s.done.length>1&&!s.done[s.done.length-2].ranges?(s.done.pop(),q(s.done)):void 0))l=q(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=yi(t):o.changes.push(Ai(e,t));else{var u=q(i.done);for(u&&u.ranges||Fi(e.sel,i.done),o={changes:[Ai(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||rt(e,"historyAdded")}function Hi(e,t,r,n){var i,o,l,s,a,u=e.history,c=n&&n.origin;r==u.lastSelOp||c&&u.lastSelOrigin==c&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==c||(i=e,o=c,l=q(u.done),s=t,"*"==(a=o.charAt(0))||"+"==a&&l.ranges.length==s.ranges.length&&l.somethingSelected()==s.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=t:Fi(t,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=c,u.lastSelOp=r,n&&!1!==n.clearRedo&&Di(u.undone)}function Fi(e,t){var r=q(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Pi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Ei(e){if(!e)return null;for(var t,r=0;r-1&&(q(s)[h]=u[h],delete u[h])}}}return n}function Ri(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ve(t,i)<0;o!=ve(r,i)<0?(i=t,t=r):o!=ve(t,r)<0&&(t=r)}return new gi(i,t)}return new gi(r||t,t)}function Bi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),ji(e,new pi([Ri(e.sel.primary(),t,r,i)],0),n)}function Gi(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(i&&(rt(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var u=a.find(n<0?1:-1),c=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(u=Qi(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=ve(u,r))&&(n<0?c<0:c>0))return $i(e,u,t,n,i)}var h=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(h=Qi(e,h,n,h.line==t.line?o:null)),h?$i(e,h,t,n,i):null}}return t}function Zi(e,t,r,n,i){var o=n||1,l=$i(e,t,r,o,i)||!i&&$i(e,t,r,o,!0)||$i(e,t,r,-o,i)||!i&&$i(e,t,r,-o,!0);return l||(e.cantEdit=!0,ge(e.first,0))}function Qi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?Ce(e,ge(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line0)){var c=[a,1],h=ve(u.from,s.from),f=ve(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ro(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ro(e,t)}}function ro(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ve(t.from,t.to)){var r=wi(e,t);Wi(e,t,r,e.cm?e.cm.curOp.id:NaN),oo(e,t,r,Oe(e,t));var n=[];Ti(e,function(e,r){r||-1!=B(n,e.history)||(uo(e.history,t),n.push(e.history)),oo(e,t,null,Oe(e,t))})}}function no(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u=0;--d){var p=f(d);if(p)return p.v}}}}function io(e,t){if(0!=t&&(e.first+=t,e.sel=new pi($(e.sel.ranges,function(e){return new gi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){_n(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:ge(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ae(e,t.from,t.to),r||(r=wi(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=he(Be(se(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0}));n.sel.contains(t.from,t.to)>-1&&it(e);ki(n,t,r,tn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=Xe(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var i=se(e,n).stateAfter;if(i&&(!(i instanceof Ht)||n+i.lookAhead1||!(this.children[0]instanceof ho))){var s=[];this.collapse(s),this.children=[new ho(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var l=i.lines.length%25+25,s=l;s10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Re(e,t.line,t,r,o)||t.line!=r.line&&Re(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ke=!0}o.addToHistory&&Wi(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,function(e){var n,i;u&&o.collapsed&&!u.options.lineWrapping&&Be(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&ce(e,0),n=e,i=new Te(o,a==t.line?t.ch:null,a==r.line?r.ch:null),n.markedSpans=n.markedSpans?n.markedSpans.concat([i]):[i],i.marker.attachLine(n),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Ve(e,t)&&ce(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Le=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++vo,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)_n(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)qn(u,c,"text");o.atomic&&_i(u.doc),or(u,"markerAdded",u,o)}return o}mo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&In(t),ot(this,"clear")){var n=this.find();n&&or(this,"clear",n.from,n.to)}for(var i=null,o=null,l=0;lt.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=h,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&_n(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&_i(t.doc)),t&&or(t,"markerCleared",t,this,i,o),r&&Rn(t),this.parent&&this.parent.clear()}},mo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;a--)to(this,n[a]);s?Ki(this,s):this.cm&&Sn(this.cm)}),undo:Yn(function(){no(this,"undo")}),redo:Yn(function(){no(this,"redo")}),undoSelection:Yn(function(){no(this,"undo",!0)}),redoSelection:Yn(function(){no(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=Ce(this,e),t=Ce(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=o,++r}),Ce(this,ge(r,t))},indexFromPos:function(e){var t=(e=Ce(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),Xi(t.doc,mi(r,r)),h)for(var f=0;f=0;t--)lo(e.doc,"",n[t].from,n[t].to,"+delete");Sn(e)})}function Ko(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function jo(e,t,r){var n=Ko(e,t.ch,r);return null==n?null:new ge(t.line,n,r<0?"after":"before")}function Xo(e,t,r,n,i){if(e){var o=Ze(r,t.doc.direction);if(o){var l,s=i<0?q(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=Nr(t,r);l=i<0?r.text.length-1:0;var c=Or(t,u,l).top;l=le(function(e){return Or(t,u,e).top==c},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Ko(r,l,1))}else l=i<0?s.to:s.from;return new ge(n,l,a)}}return new ge(n,i<0?r.text.length:0,i<0?"before":"after")}Po.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Po.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Po.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Po.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Po.default=y?Po.macDefault:Po.pcDefault;var Yo={selectAll:Ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Vo(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=se(e.doc,i.line-1).text;l&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ge(i.line-1,l.length-1),i,"+transpose"))}r.push(new gi(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Kn(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n-1&&(ve((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(ve(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,u=jn(e,function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(i.wrapper.ownerDocument,"mouseup",u),tt(i.wrapper.ownerDocument,"mousemove",c),tt(i.scroller,"dragstart",h),tt(i.scroller,"drop",u),o||(st(t),n.addNew||Bi(e.doc,r,null,null,n.extend),a||l&&9==s?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};a&&(i.scroller.draggable=!0);e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop();Je(i.wrapper.ownerDocument,"mouseup",u),Je(i.wrapper.ownerDocument,"mousemove",c),Je(i.scroller,"dragstart",h),Je(i.scroller,"drop",u),dn(e),setTimeout(function(){return i.input.focus()},20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;st(t);var l,s,a=o.sel,u=a.ranges;n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?u[s]:new gi(r,r)):(l=o.sel.primary(),s=o.sel.primIndex);if("rectangle"==n.unit)n.addNew||(l=new gi(r,r)),r=nn(e,t,!0,!0),s=-1;else{var c=ul(e,r,n.unit);l=n.extend?Ri(l,c.anchor,c.head,n.extend):c}n.addNew?-1==s?(s=u.length,ji(o,vi(u.concat([l]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==n.unit&&!n.extend?(ji(o,vi(u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):Ui(o,s,l,K):(s=0,ji(o,new pi([l],0),K),a=o.sel);var h=r;function f(t){if(0!=ve(h,t))if(h=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=I(se(o,r.line).text,r.ch,u),f=I(se(o,t.line).text,t.ch,u),d=Math.min(c,f),p=Math.max(c,f),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var m=se(o,g).text,y=X(m,d,u);d==p?i.push(new gi(ge(g,y),ge(g,y))):m.length>y&&i.push(new gi(ge(g,y),ge(g,X(m,p,u))))}i.length||i.push(new gi(r,r)),ji(o,vi(a.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=l,x=ul(e,t,n.unit),C=w.anchor;ve(x.anchor,C)>0?(b=x.head,C=we(w.from(),x.anchor)):(b=x.anchor,C=be(w.to(),x.head));var S=a.ranges.slice(0);S[s]=function(e,t){var r=t.anchor,n=t.head,i=se(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Ze(i);if(!o)return t;var l=qe(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,u=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)a=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=qe(o,n.ch,n.sticky),h=c-l||(n.ch-r.ch)*(1==s.level?-1:1);a=c==u-1||c==u?h<0:h>0}var f=o[u+(a?-1:0)],d=a==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new gi(new ge(r.line,p,g),n)}(e,new gi(Ce(o,C),b)),ji(o,vi(S,s),K)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,st(t),i.input.focus(),tt(i.wrapper.ownerDocument,"mousemove",v),tt(i.wrapper.ownerDocument,"mouseup",m),o.history.lastSelOrigin=null}var v=jn(e,function(t){ft(t)?function t(r){var l=++p;var s=nn(e,r,!0,"rectangle"==n.unit);if(!s)return;if(0!=ve(s,h)){e.curOp.focus=W(),f(s);var a=yn(i,o);(s.line>=a.to||s.lined.bottom?20:0;u&&setTimeout(jn(e,function(){p==l&&(i.scroller.scrollTop+=u,t(r))}),50)}}(t):g(t)}),m=jn(e,g);e.state.selectingText=m,Je(i.wrapper.ownerDocument,"mousemove",v),Je(i.wrapper.ownerDocument,"mouseup",m)}(e,n,t,o)}(t,u,h,e):ht(e)==r.scroller&&st(e):2==c?(u&&Bi(t.doc,u),setTimeout(function(){return r.input.focus()},20)):3==c&&(S?fl(t,e):dn(t)))}}function ul(e,t,r){if("char"==r)return new gi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new gi(ge(t.line,0),Ce(e.doc,ge(t.line+1,0)));var n=r(e,t);return new gi(n.from,n.to)}function cl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&st(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!ot(e,r))return ut(t);o-=s.top-l.viewOffset;for(var a=0;a=i)return rt(e,r,e,fe(e.doc,o),e.options.gutters[a],t),ut(t)}}function hl(e,t){return cl(e,t,"gutterClick",!0)}function fl(e,t){yr(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return cl(e,t,"gutterContextMenu",!1)}(e,t)||nt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function dl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Er(e)}sl.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var pl={toString:function(){return"CodeMirror.Init"}},gl={},vl={};function ml(e){si(e),_n(e),bn(e)}function yl(e,t,r){if(!t!=!(r&&r!=pl)){var n=e.display.dragFunctions,i=t?Je:tt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function bl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Ye(e)),rn(e),_n(e),Er(e),setTimeout(function(){return Hn(e)},100)}function wl(e,t){var n=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?z(t):{},z(gl,t,!1),ai(t);var i=t.value;"string"==typeof i&&(i=new So(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new wl.inputStyles[t.inputStyle](this),u=this.display=new function(e,t,n){var i=this;this.input=n,i.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=A("div",null,"CodeMirror-code"),i.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=O("div",null,"CodeMirror-cursors"),i.measure=O("div",null,"CodeMirror-measure"),i.lineMeasure=O("div",null,"CodeMirror-measure"),i.lineSpace=A("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=A("div",[i.lineSpace],"CodeMirror-lines");i.mover=O("div",[o],null,"position: relative"),i.sizer=O("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=O("div",null,null,"position: absolute; height: "+G+"px; width: 1px;"),i.gutters=O("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=O("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=O("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),l&&s<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),a||r&&m||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,n.init(i)}(e,i,o);for(var c in u.wrapper.CodeMirror=this,si(this),dl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),En(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!m&&u.input.focus(),l&&s<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",jn(e,al)),Je(t.scroller,"dblclick",l&&s<11?jn(e,function(t){if(!nt(e,t)){var r=nn(e,t);if(r&&!hl(e,t)&&!yr(e.display,t)){st(t);var n=e.findWordAt(r);Bi(e.doc,n.anchor,n.head)}}}):function(t){return nt(e,t)||st(t)});S||Je(t.scroller,"contextmenu",function(t){return fl(e,t)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Je(t.scroller,"touchstart",function(i){if(!nt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!hl(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!yr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var l,s=e.coordsChar(t.activeTouch,"page");l=!n.prev||o(n,n.prev)?new gi(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new gi(ge(s.line,0),Ce(e.doc,ge(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),st(r)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Mn(e,t.scroller.scrollTop),On(e,t.scroller.scrollLeft,!0),rt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return di(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return di(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){nt(e,t)||ct(t)},over:function(t){nt(e,t)||(!function(e,t){var r=nn(e,t);if(r){var n=document.createDocumentFragment();an(e,r,n),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),ct(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Lo<100))ct(t);else if(!nt(e,t)&&!yr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=O("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),h&&r.parentNode.removeChild(r)}}(e,t)},drop:jn(e,ko),leave:function(t){nt(e,t)||To(e)}};var a=t.input.getField();Je(a,"keyup",function(t){return nl.call(e,t)}),Je(a,"keydown",jn(e,rl)),Je(a,"keypress",jn(e,il)),Je(a,"focus",function(t){return pn(e,t)}),Je(a,"blur",function(t){return gn(e,t)})}(this),Oo(),In(this),this.curOp.forceUpdate=!0,Mi(this,i),t.autofocus&&!m||this.hasFocus()?setTimeout(E(pn,this),20):gn(this),vl)vl.hasOwnProperty(c)&&vl[c](n,t[c],pl);wn(this),t.finishInit&&t.finishInit(this);for(var d=0;d150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?I(se(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f1)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){u=[];for(var c=0;c=0;h--){var f=n.ranges[h],d=f.from(),p=f.to();f.empty()&&(r&&r>0?d=ge(d.line,d.ch-r):e.state.overwrite&&!s?p=ge(p.line,Math.min(se(o,p.line).text.length,p.ch+q(a).length)):Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(d=p=ge(d.line,0))),l=e.curOp.updateInput;var g={from:d,to:p,text:u?u[h%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};to(e.doc,g),or(e,"inputRead",e,g)}t&&!s&&Ml(e,t),Sn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Tl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return kl(t,r,0,null,"paste")}),!0}function Ml(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s-1){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&or(e,"electricInput",e,i.head.line)}}}function Nl(e){for(var t=[],r=[],n=0;n=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=qe(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from=l.from&&f>=c.begin)){var d=h?"before":"after";return new ge(r.line,f,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new ge(r.line,a(e,1),"before"):new ge(r.line,e,"after")};e>=0&&e0==(1!=l.level),u=s?n.begin:a(n.end,-1);if(l.from<=u&&u0?c.end:a(c.begin,-1);return null==v||n>0&&v==t.text.length||!(g=p(n>0?0:i.length-1,n,u(v)))?null:g}(e.cm,s,t,r):jo(s,t,r))){if(n||(l=t.line+r)=e.first+e.size||(t=new ge(l,t.ch,t.sticky),!(s=se(e,l))))return!1;t=Xo(i,e.cm,s,t.line,r)}else t=o;return!0}if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var u=null,c="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(r<0)||a(!f);f=!1){var d=s.text.charAt(t.ch)||"\n",p=te(d,h)?"w":c&&"\n"==d?"n":!c||/\s/.test(d)?null:"p";if(!c||f||p||(p="s"),u&&u!=p){r<0&&(r=1,a(),t.sticky="after");break}if(p&&(u=p),r>0&&!a(!f))break}var g=Zi(e,t,o,l,!0);return me(o,g)&&(g.hitSide=!0),g}function Wl(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*Zr(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=Xr(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var Hl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fl(e,t){var r=Mr(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),i=kr(r,n,t.line),o=Ze(n,e.doc.direction),l="left";o&&(l=qe(o,t.ch)%2?"right":"left");var s=Wr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Pl(e,t){return t&&(e.bad=!0),e}function El(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Pl(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Fl(t,i)||{node:a[0].measure.map[2],offset:0},c=o.linen.firstLine()&&(l=ge(l.line-1,se(n.doc,l.line-1).length)),s.ch==se(n.doc,s.line).text.length&&s.linei.viewTo-1)return!1;l.line==i.viewFrom||0==(e=on(n,l.line))?(t=he(i.view[0].line),r=i.view[0].node):(t=he(i.view[e].line),r=i.view[e-1].node.nextSibling);var a,u,c=on(n,s.line);if(c==i.view.length-1?(a=i.viewTo-1,u=i.lineDiv.lastChild):(a=he(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;for(var h=n.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator();function a(){l&&(o+=s,l=!1)}function u(e){e&&(a(),o+=e)}function c(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void u(r||t.textContent.replace(/\u200b/g,""));var o,h=t.getAttribute("cm-marker");if(h){var f=e.findMarks(ge(n,0),ge(i+1,0),(g=+h,function(e){return e.id==g}));return void(f.length&&(o=f[0].find(0))&&u(ae(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p)$/i.test(t.nodeName);d&&a();for(var p=0;p1&&f.length>1;)if(q(h)==q(f))h.pop(),f.pop(),a--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}for(var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);dl.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=ge(t,d),C=ge(a,f.length?q(f).length-p:0);return h.length>1||h[0]||ve(x,C)?(lo(n.doc,h,x,C,"+input"),!0):void 0},Hl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Hl.prototype.reset=function(){this.forceCompositionEnd()},Hl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Hl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Hl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return _n(e.cm)})},Hl.prototype.setUneditable=function(e){e.contentEditable="false"},Hl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||jn(this.cm,kl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Hl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Hl.prototype.onContextMenu=function(){},Hl.prototype.resetPosition=function(){},Hl.prototype.needsContentAttribute=!0;var Il,Rl,Bl,Gl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Gl.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!nt(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Nl(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,V):(r.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(n.state.cutIncoming=!0)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),Je(i,"input",function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Je(i,"paste",function(e){nt(n,e)||Tl(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Je(i,"cut",o),Je(i,"copy",o),Je(e.scroller,"paste",function(t){yr(e,t)||nt(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Je(e.lineSpace,"selectstart",function(t){yr(e,t)||st(t)}),Je(i,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Je(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Gl.prototype.createField=function(e){this.wrapper=Al(),this.textarea=this.wrapper.firstChild},Gl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=sn(e);if(e.options.moveInputWithCursor){var i=Vr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},Gl.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Gl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&P(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},Gl.prototype.getField=function(){return this.textarea},Gl.prototype.supportsTouch=function(){return!1},Gl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||W()!=this.textarea))try{this.textarea.focus()}catch(e){}},Gl.prototype.blur=function(){this.textarea.blur()},Gl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Gl.prototype.receivedFocus=function(){this.slowPoll()},Gl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Gl.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},Gl.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,u=Math.min(n.length,i.length);a1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Gl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Gl.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},Gl.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea,o=nn(r,e),u=n.scroller.scrollTop;if(o&&!h){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&jn(r,ji)(r.doc,mi(o),V);var c=i.style.cssText,f=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var d,p=t.wrapper.getBoundingClientRect();if(i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",a&&(d=window.scrollY),n.input.focus(),a&&window.scrollTo(null,d),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&v(),S){ct(e);var g=function(){tt(window,"mouseup",g),setTimeout(m,20)};Je(window,"mouseup",g)}else setTimeout(m,50)}function v(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function m(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=c,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart){(!l||l&&s<9)&&v();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?jn(r,Ji)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},Gl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Gl.prototype.setUneditable=function(){},Gl.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=pl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=pl,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),r("indentUnit",2,Ci,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){Si(e),Er(e),_n(e)},!0),r("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(ge(n,o))}n++});for(var i=r.length-1;i>=0;i--)lo(e.doc,t,r[i],ge(r[i].line,r[i].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=pl&&e.refresh()}),r("specialCharPlaceholder",$t,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){dl(e),ml(e)},!0),r("keyMap","default",function(e,t,r){var n=Uo(t),i=r!=pl&&Uo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,bl,!0),r("gutters",[],function(e){ai(e.options),ml(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?en(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return Hn(e)},!0),r("scrollbarStyle","native",function(e){En(e),Hn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e){ai(e.options),ml(e)},!0),r("firstLineNumber",1,ml,!0),r("lineNumberFormatter",function(e){return e},ml,!0),r("showCursorWhenSelecting",!1,ln,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,yl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ln,!0),r("singleCursorHeightPerLine",!0,ln,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Si,!0),r("addModeClass",!1,Si,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,Si,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(wl),Rl=(Il=wl).optionHandlers,Bl=Il.helpers={},Il.prototype={constructor:Il,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,Rl.hasOwnProperty(e)&&jn(this,Rl[e])(this,t,n),rt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Uo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rn&&(Cl(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Sn(t));else{var l=o.from(),s=o.to(),a=Math.max(n,l.line);n=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=a;u0&&Ui(t.doc,i,new gi(l,c[i].to()),V)}}}),getTokenAt:function(e,t){return Ut(this,e,t)},getLineTokens:function(e,t){return Ut(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=Ce(this.doc,e);var t,r=Et(this,se(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]o&&(e=o,i=!0),n=se(this.doc,e)}else n=e;return Br(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-je(n):0)},defaultTextHeight:function(){return Zr(this.display)},defaultCharWidth:function(){return Qr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=Vr(this,Ce(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var h=Math.max(a.wrapper.clientHeight,this.doc.height),f=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(u=e.bottom),c+t.offsetWidth>f&&(c=f-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=xn(o,l)).scrollTop&&Mn(o,s.scrollTop),null!=s.scrollLeft&&On(o,s.scrollLeft))},triggerOnKeyDown:Xn(rl),triggerOnKeyPress:Xn(il),triggerOnKeyUp:nl,triggerOnMouseDown:Xn(al),execCommand:function(e){if(Yo.hasOwnProperty(e))return Yo[e].call(null,this)},triggerElectric:Xn(function(e){Ml(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=Ce(this.doc,e),l=0;l0&&l(t.charAt(r-1));)--r;for(;n.5)&&rn(this),rt(this,"refresh",this)}),swapDoc:Xn(function(e){var t=this.doc;return t.cm=null,Mi(this,e),Er(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,or(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},lt(Il),Il.registerHelper=function(e,t,r){Bl.hasOwnProperty(e)||(Bl[e]=Il[e]={_global:[]}),Bl[e][t]=r},Il.registerGlobalHelper=function(e,t,r,n){Il.registerHelper(e,t,n),Bl[e]._global.push({pred:r,val:n})};var Ul,Vl="iter insert remove copy getEditor constructor".split(" ");for(var Kl in So.prototype)So.prototype.hasOwnProperty(Kl)&&B(Vl,Kl)<0&&(wl.prototype[Kl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Kl]));return lt(So),wl.inputStyles={textarea:Gl,contenteditable:Hl},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}.apply(this,arguments)},wl.defineMIME=function(e,t){Lt[e]=t},wl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),wl.defineMIME("text/plain","null"),wl.defineExtension=function(e,t){wl.prototype[e]=t},wl.defineDocExtension=function(e,t){So.prototype[e]=t},wl.fromTextArea=function(e,t){if((t=t?z(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=W();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(Je(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=wl(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},(Ul=wl).off=tt,Ul.on=Je,Ul.wheelEventPixels=fi,Ul.Doc=So,Ul.splitLines=bt,Ul.countColumn=I,Ul.findColumn=X,Ul.isWordChar=ee,Ul.Pass=U,Ul.signal=rt,Ul.Line=jt,Ul.changeEnd=yi,Ul.scrollbarModel=Pn,Ul.Pos=ge,Ul.cmpPos=ve,Ul.modes=St,Ul.mimeModes=Lt,Ul.resolveMode=kt,Ul.getMode=Tt,Ul.modeExtensions=Mt,Ul.extendMode=Nt,Ul.copyState=Ot,Ul.startState=Dt,Ul.innerMode=At,Ul.commands=Yo,Ul.keyMap=Po,Ul.keyName=Go,Ul.isModifierKey=Ro,Ul.lookupKey=Io,Ul.normalizeKeyMap=zo,Ul.StringStream=Wt,Ul.SharedTextMarker=bo,Ul.TextMarker=mo,Ul.LineWidget=po,Ul.e_preventDefault=st,Ul.e_stopPropagation=at,Ul.e_stop=ct,Ul.addClass=H,Ul.contains=D,Ul.rmClass=T,Ul.keyNames=Do,wl.version="5.37.1",wl}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,g=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=n||r||i,C=x&&(n?document.documentMode||6:+(i||r)[1]),v=!i&&/WebKit\//.test(e),o=v&&/Qt\/\d+\.\d+/.test(e),l=!i&&/Chrome\//.test(e),m=/Opera\//.test(e),c=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),u=/PhantomJS/.test(e),a=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),h=/Android/.test(e),d=a||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=a||/Mac/.test(t),f=/\bCrOS\b/.test(e),p=/win/i.test(t),b=m&&e.match(/Version\/(\d*\.\d*)/);(b=b&&Number(b[1]))&&15<=b&&(v=!(m=!1));var w=y&&(o||m&&(null==b||b<12.11)),S=g||x&&9<=C;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var n,r=e.className,i=L(t).exec(r);i&&(n=r.slice(i.index+i[0].length),e.className=r.slice(0,i.index)+(n?i[1]+n:""))};function M(e){for(var t=e.childNodes.length;0t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:se=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:se=i)}return null!=r?r:se}var ue,ce,he,de,fe,pe,ge,me=(ue="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",ce="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",he=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,de=/[stwN]/,fe=/[LRr]/,pe=/[Lb1n]/,ge=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!he.test(e))return!1;for(var r,i=e.length,o=[],l=0;l=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&to?lt(o,Qe(e,o).text.length):(r=Qe(e,(n=t).line).text.length,null==(i=n.ch)||r=this.string.length},Ze.prototype.sol=function(){return this.pos==this.lineStart},Ze.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ze.prototype.next=function(){if(this.post},Ze.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ze.prototype.skipToEnd=function(){this.pos=this.string.length},Ze.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1e.options.maxHighlightLength&&_e(e.doc.mode,r.state),o=vt(e,t,r),i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))),t.styles}function bt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new mt(t,!0,r);var o=function(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;lt.first&&Qe(t,o-1).stateAfter,s=l?mt.fromSaved(t,l,o):new mt(t,qe(t.mode),o);return t.iter(o,r,function(e){wt(n,e.text,s);var t=s.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&tt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}mt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},mt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++,0e.options.maxHighlightLength?(s=!1,l&&wt(e,t,r,c.pos),c.pos=t.length,null):kt(Ct(n,c,r.state,h),o);if(!h||(d=h[0].name)&&(f="m-"+(f?d+" "+f:d)),!s||u!=f){for(;a=t:l.to>t),(r=r||[]).push(new At(s,l.from,o?null:l.to)))}return r}(n,i,l),a=function(e,t,n){var r;if(e)for(var i=0;i=t:l.to>t))&&(l.from!=t||"bookmark"!=s.type||n&&!l.marker.insertLeft)||(o=null==l.from||(s.inclusiveLeft?l.from<=t:l.frome.lastLine())return t;var n,r=Qe(e,t);if(!jt(e,r))return t;for(;n=Bt(r);)r=n.find(1,!0).line;return nt(r)+1}function jt(e,t){var n=Nt&&t.markedSpans;if(n)for(var r=void 0,i=0;in.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var $t=function(e,t,n){this.text=e,Ft(this,t),this.height=n?n(this):1};$t.prototype.lineNo=function(){return nt(this)},Me($t);var qt={},Zt={};function Qt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Zt:qt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Jt(e,t){var n=A("span",null,null,v?"padding-right: .1px":null),r={pre:A("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i,o=0;o<=(t.rest?t.rest.length:0);o++){var l=o?t.rest[o-1]:t.line,s=void 0;r.pos=0,r.addToken=tn,function(e){if(null!=Pe)return Pe;var t=N(e,document.createTextNode("AخA")),n=k(t,0,1).getBoundingClientRect(),r=k(t,1,2).getBoundingClientRect();return M(e),n&&n.left!=n.right&&(Pe=r.right-n.right<3)}(e.display.measure)&&(s=ye(l,e.doc.direction))&&(r.addToken=function(h,d){return function(e,t,n,r,i,o,l){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var u=void 0,c=0;cs&&u.from<=s);c++);if(u.to>=a)return h(e,t,n,r,i,o,l);h(e,t.slice(0,u.to-s),n,r,null,o,l),r=null,t=t.slice(u.to-s),s=u.to}}}(r.addToken,s)),r.map=[],function(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var l=1;lg||S.collapsed&&C.to==g&&C.from==g)){if(null!=C.to&&C.to!=g&&y>C.to&&(y=C.to,c=""),S.className&&(u+=" "+S.className),S.css&&(a=(a?a+";":"")+S.css),S.startStyle&&C.from==g&&(h+=" "+S.startStyle),S.endStyle&&C.to==y&&(w=w||[]).push(S.endStyle,C.to),S.title&&((f=f||{}).title=S.title),S.attributes)for(var L in S.attributes)(f=f||{})[L]=S.attributes[L];S.collapsed&&(!d||It(d.marker,S)<0)&&(d=C)}else C.from>g&&y>C.from&&(y=C.from)}if(w)for(var k=0;kn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Mn(e,t,n,r){return On(e,An(e,t),n,r)}function Nn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(i=(o=a-s)-1,a<=t&&(l="right")),null!=i){if(r=e[u+2],s==a&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],l="left";if("right"==n&&i==a-s)for(;u=o.text.length?(t=o.text.length,n="before"):t<=0&&(t=0,n="after"),!u)return a("before"==n?t-1:t,"before"==n);function c(e,t,n){return a(n?e-1:e,1==u[t].level!=n)}var h=ae(u,t,n),d=se,f=c(t,h,"before"==n);return null!=d&&(f.other=c(t,d,"before"!=n)),f}function Kn(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=Zn(e.display)*t.ch);var r=Qe(e.doc,t.line),i=Xt(r)+wn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function jn(e,t,n,r,i){var o=lt(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Xn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return jn(r.first,0,null,-1,-1);var i=rt(r,n),o=r.first+r.size-1;if(o=u||m.to<=a||(f=1!=m.level,p=On(e,r,f?Math.min(u,m.to)-1:Math.max(a,m.from)).right,g=pu&&(c={from:c.from,to:u,level:c.level});return c}:function(r,i,o,l,s,a,u){var e=le(function(e){var t=s[e],n=1!=t.level;return $n(Vn(r,lt(o,n?t.to:t.from,n?"before":"after"),"line",i,l),a,u,!0)},0,s.length-1),t=s[e];{var n,c;0u&&(t=s[e-1]))}return t})(n,e,t,o,c,r,i),u=1!=h.level,s=u?h.from:h.to-1,a=u?h.to:h.from-1)}var d,f,p=null,g=null,m=le(function(e){var t=On(n,o,e);return t.top+=l,t.bottom+=l,$n(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(p=e,g=t),1)},s,a),v=!1;{var y,b,w;g?(y=r-g.left=w.bottom?1:0)}return m=oe(e.text,m,1),jn(t,m,f,v,r-d)}(e,l,i,t,n),a=function(e,t){var n,r=Nt&&e.markedSpans;if(r)for(var i=0;it)&&(!n||It(n,o.marker)<0)&&(n=o.marker)}return n}(l,s.ch+(0r},o,i)}}function _n(e,t,n,r){return Yn(e,t,n=n||An(e,t),Bn(e,t,On(e,n,r),"line").top)}function $n(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function qn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Dn){Dn=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Dn.appendChild(document.createTextNode("x")),Dn.appendChild(O("br"));Dn.appendChild(document.createTextNode("x"))}N(e.measure,Dn);var n=Dn.offsetHeight/50;return 3=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;rt)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo?Nt&&Vt(e.doc,t)a.viewFrom?lr(e):(a.viewFrom+=r,a.viewTo+=r):t<=a.viewFrom&&n>=a.viewTo?lr(e):t<=a.viewFrom?(i=sr(e,n,n+r,1))?(a.view=a.view.slice(i.index),a.viewFrom=i.lineN,a.viewTo+=r):lr(e):n>=a.viewTo?(o=sr(e,t,t,-1))?(a.view=a.view.slice(0,o.index),a.viewTo=o.lineN):lr(e):(l=sr(e,t,t,-1),s=sr(e,n,n+r,1),l&&s?(a.view=a.view.slice(0,l.index).concat(on(e,l.lineN,s.lineN)).concat(a.view.slice(s.index)),a.viewTo+=r):lr(e));var u=a.externalMeasured;u&&(n=l.lineN&&t=o.viewTo||(null==(r=o.view[rr(e,t)]).node||-1==B(i=r.changes||(r.changes=[]),n)&&i.push(n))}function lr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function sr(e,t,n,r){var i,o=rr(e,t),l=e.display.view;if(!Nt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,a=0;a=e.display.viewTo||n.to().linet||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(k,y||0,null==b?C:b,function(e,t,n,r){var i,o,l,s,a,u,c,h="ltr"==n,d=S(e,h?"left":"right"),f=S(t-1,h?"right":"left"),p=null==y&&0==e,g=null==b&&t==C,m=0==r,v=!k||r==k.length-1;f.top-d.top<=3?(i=(N?g:p)&&v,o=(N?p:g)&&m?T:(h?d:f).left,l=i?M:(h?f:d).right,A(o,d.top,l-o,d.bottom)):(c=h?(s=N&&p&&m?T:d.left,a=N?M:L(e,n,"before"),u=N?T:L(t,n,"after"),N&&g&&v?M:f.right):(s=N?L(e,n,"before"):T,a=!N&&p&&m?M:d.right,u=!N&&g&&v?T:f.left,N?L(t,n,"after"):M),A(s,d.top,a-s,d.bottom),d.bottome.display.sizerWidth&&((c=Math.ceil(u/Zn(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=c,e.display.maxLine=l.line,e.display.maxLineChanged=!0))}}}function br(e){if(e.widgets)for(var t=0;t=a&&(s=rt(t,Xt(Qe(t,i))-e.wrapper.clientHeight),a=i)),{from:s,to:Math.max(a,s+1)}}function xr(e,t){var n=e.display,r=qn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=kn(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s,a=e.doc.height+xn(n),u=t.topa-r;t.topi+o&&((s=Math.min(t.top,(c?a:t.bottom)-o))!=i&&(l.scrollTop=s));var h=e.options.fixedGutter?0:n.gutters.offsetWidth,d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-h,f=Ln(e)-n.gutters.offsetWidth,p=t.right-t.left>f;return p&&(t.right=t.left+f),t.left<10?l.scrollLeft=0:t.leftf+d-3&&(l.scrollLeft=t.right+(p?0:10)-f),l}function Cr(e,t){null!=t&&(kr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sr(e){kr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Lr(e,t,n){null==t&&null==n||kr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function kr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Tr(e,Kn(e,t.from),Kn(e,t.to),t.margin))}function Tr(e,t,n,r){var i=xr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Lr(e,i.scrollLeft,i.scrollTop)}function Mr(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||$r(e,{top:t}),Nr(e,t,!0),g&&$r(e),Kr(e,100))}function Nr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ar(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Qr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Or(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+xn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function Dr(e,t,n){this.cm=n;var r=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&C<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}Dr.prototype.update=function(e){var t,n,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,o=e.nativeBarWidth;return i?(this.vert.style.display="block",this.vert.style.bottom=r?o+"px":"0",t=e.viewHeight-(r?o:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),r?(this.horiz.style.display="block",this.horiz.style.right=i?o+"px":"0",this.horiz.style.left=e.barLeft+"px",n=e.viewWidth-e.barLeft-(i?o:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+n)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Xr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(t[n]);for(var r=0;r(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||u||(o=O("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-wn(e.display))+"px;\n height: "+(t.bottom-t.top+Sn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)))}(t,i))}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s=a.display.viewTo||(u=+new Date+a.options.workTime,c=bt(a,d.highlightFrontier),h=[],d.iter(c.line,Math.min(d.first+d.size,a.display.viewTo+500),function(e){if(c.line>=a.display.viewFrom){var t=e.styles,n=e.text.length>a.options.maxHighlightLength?_e(d.mode,c.state):null,r=vt(a,e,c,!0);n&&(c.state=n),e.styles=r.styles;var i=e.styleClasses,o=r.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),s=0;!l&&su)return Kr(a,a.options.workDelay),!0}),d.highlightFrontier=c.line,d.modeFrontier=Math.max(d.modeFrontier,c.line),h.length&&Br(a,function(){for(var e=0;e=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==ar(e))return!1;Jr(e)&&(lr(e),t.dims=Qn(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),Nt&&(o=Vt(e.doc,o),l=Kt(e.doc,l));var s,a,u,c,h=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;a=o,u=l,0==(c=(s=e).display).view.length||a>=c.viewTo||u<=c.viewFrom?(c.view=on(s,a,u),c.viewFrom=a):(c.viewFrom>a?c.view=on(s,a,c.viewFrom).concat(c.view):c.viewFromu&&(c.view=c.view.slice(0,rr(s,u)))),c.viewTo=u,n.viewOffset=Xt(Qe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=ar(e);if(!h&&0==d&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var f,p,g,m=function(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var n,r={activeElt:t};return!window.getSelection||(n=window.getSelection()).anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset),r}(e);return 4=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Yr(e,t))break;yr(e);var i=Or(e);ur(e),Hr(e,i),Zr(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function $r(e,t){var n,r=new Xr(e,t);Yr(e,r)&&(yr(e),_r(e,r),n=Or(e),ur(e),Hr(e,n),Zr(e,n),r.finish())}function qr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Zr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sn(e)+"px"}function Qr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Jn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;lu.clientWidth,h=u.scrollHeight>u.clientHeight;if(l&&c||s&&h){if(s&&y&&v)e:for(var d=t.target,f=a.view;d!=u;d=d.parentNode)for(var p=0;pa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==r?(Ti(s.done),$(s.done)):s.done.length&&!$(s.done).ranges?$(s.done):1i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Se(e,"historyAdded")}function Ni(e,t,n,r){var i,o,l,s,a,u=e.history,c=r&&r.origin;n==u.lastSelOp||c&&u.lastSelOrigin==c&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==c||(i=e,o=c,l=$(u.done),s=t,"*"==(a=o.charAt(0))||"+"==a&&l.ranges.length==s.ranges.length&&l.somethingSelected()==s.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=t:Ai(t,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=c,u.lastSelOp=n,r&&!1!==r.clearRedo&&Ti(u.undone)}function Ai(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Oi(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Di(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i=t.ch:s.to>t.ch))){if(i&&(Se(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(n){var h=a.find(r<0?1:-1),d=void 0;if((r<0?c:u)&&(h=Yi(e,h,-r,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(d=st(h,n))&&(r<0?d<0:0e.first?ft(e,lt(t.line-1)):null:0e.lastLine()||(t.from.lineo&&(t={from:t.from,to:lt(o,Qe(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Je(e,t.from,t.to),n=n||gi(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=nt(Ut(Qe(r,o.line))),r.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiert.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=c,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&ir(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Vi(t.doc)),t&&un(t,"markerCleared",t,this,r,i),n&&zr(t),this.parent&&this.parent.clear()}},ho.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,l){i=ft(this,i),o=ft(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n=r.to||null==r.from&&a!=i.line||null!=r.from&&a==o.line&&r.from>=o.ch||l&&!l(r.marker)||s.push(r.marker.parent||r.marker)}++a}),s},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;nt&&(t=e.from),null!=e.to&&e.toe.text.length?null:r}function zo(e,t,n){var r=Ro(e,t.ch,n);return null==r?null:new lt(t.line,r,n<0?"after":"before")}function Bo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ye(n,t.doc.direction);if(o){var l,s,a,u=i<0?$(o):o[0],c=i<0==(1==u.level)?"after":"before";return 0=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var r=ae(a,s.ch,s.sticky),i=a[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0s.ch:i.from=i.from&&d>=c.begin)){var f=h?"before":"after";return new lt(s.line,d,f)}}function p(e,t,n){for(var r=function(e,t){return t?new lt(s.line,u(e,1),"before"):new lt(s.line,e,"after")};0<=e&&el.doc.first&&((n=Qe(l.doc,e.line-1).text)&&(e=new lt(e.line,1),l.replaceRange(t.charAt(0)+l.doc.lineSeparator()+n.charAt(n.length-1),lt(e.line-1,n.length-1),e,"+transpose")))),i.push(new ci(e,e)))}l.setSelections(i)})},newlineAndIndent:function(r){return Br(r,function(){for(var e=r.listSelections(),t=e.length-1;0<=t;t--)r.replaceRange(r.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=r.listSelections();for(var n=0;nc&&t.push(new ci(lt(s,c),lt(s,X(u,l,n))))}t.length||t.push(new ci(v,v)),Bi(b,hi(m,C.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),m.scrollIntoView(e)}else{var h,d=w,f=il(m,e,y.unit),p=d.anchor,p=0=n.to||o.linea.bottom?20:0)&&setTimeout(Gr(m,function(){u==i&&(l.scroller.scrollTop+=r,e(t))}),50))}:r)(e)}),o=Gr(m,r);m.state.selectingText=o,we(l.wrapper.ownerDocument,"mousemove",i),we(l.wrapper.ownerDocument,"mouseup",o)})(e,r,t,o)}(s,t,r,e):We(e)==a.scroller&&Ne(e):2==n?(t&&Pi(s.doc,t),setTimeout(function(){return a.input.focus()},20)):3==n&&(S?s.display.input.onContextMenu(e):gr(s)))))}function il(e,t,n){if("char"==n)return new ci(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new ci(lt(t.line,0),ft(e.doc,lt(t.line+1,0)));var r=n(e,t);return new ci(r.from,r.to)}function ol(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ne(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!Te(e,n))return Oe(t);o-=s.top-l.viewOffset;for(var a=0;a=i)return Se(e,n,e,rt(e.doc,o),e.display.gutterSpecs[a].className,t),Oe(t)}}function ll(e,t){return ol(e,t,"gutterClick",!0)}function sl(e,t){var n,r;bn(e.display,t)||(r=t,Te(n=e,"gutterContextMenu")&&ol(n,r,"gutterContextMenu",!1))||Le(e,t,"contextmenu")||S||e.display.input.onContextMenu(t)}function al(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),En(e)}nl.prototype.compare=function(e,t,n){return this.time+400>e&&0==st(t,this.pos)&&n==this.button};var ul={toString:function(){return"CodeMirror.Init"}},cl={},hl={};function dl(e,t,n){var r,i;!t!=!(n&&n!=ul)&&(r=e.display.dragFunctions,(i=t?we:Ce)(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop))}function fl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),_t(e)),tr(e),ir(e),En(e),setTimeout(function(){return Hr(e)},100)}function pl(e,t){var n=this;if(!(this instanceof pl))return new pl(e,t);this.options=t=t?I(t):{},I(cl,t,!1);var r=t.value;"string"==typeof r?r=new vo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new pl.inputStyles[t.inputStyle](this),o=this.display=new ri(e,r,i,t);for(var l in al(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Er(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new z,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),x&&C<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(i){var o=i.display;we(o.scroller,"mousedown",Gr(i,rl)),we(o.scroller,"dblclick",x&&C<11?Gr(i,function(e){var t,n;Le(i,e)||(!(t=nr(i,e))||ll(i,e)||bn(i.display,e)||(Ne(e),n=i.findWordAt(t),Pi(i.doc,n.anchor,n.head)))}):function(e){return Le(i,e)||Ne(e)});we(o.scroller,"contextmenu",function(e){return sl(i,e)}),we(o.input.getField(),"contextmenu",function(e){o.scroller.contains(e.target)||sl(i,e)});var n,r={end:0};function l(){o.activeTouch&&(n=setTimeout(function(){return o.activeTouch=null},1e3),(r=o.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return 1;var n=t.left-e.left,r=t.top-e.top;return 400o.first?R(Qe(o,t-1).text,null,l):0:"add"==n?u=a+e.options.indentUnit:"subtract"==n?u=a-e.options.indentUnit:"number"==typeof n&&(u=a+n),u=Math.max(0,u);var h="",d=0;if(e.options.indentWithTabs)for(var f=Math.floor(u/l);f;--f)d+=l,h+="\t";if(dl,a=Re(t),u=null;if(s&&1l?"cut":"+input")};qi(e.doc,m),un(e,"inputRead",e,m)}t&&!s&&xl(e,t),Sr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function wl(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Br(t,function(){return bl(t,n,0,null,"paste")}),1)}function xl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;0<=r;r--){var i=n.ranges[r];if(!(100=i.first+i.size||(o=new lt(r,o.ch,o.sticky),!(u=Qe(i,r))))return;o=Bo(a,i.cm,u,o.line,c)}else o=n;return 1}if("char"==s||"codepoint"==s)n();else if("column"==s)n(!0);else if("word"==s||"group"==s)for(var r=null,h="group"==s,d=i.cm&&i.cm.getHelper(o,"wordChars"),f=!0;!(l<0)||n(!f);f=!1){var p=u.text.charAt(o.ch)||"\n",g=te(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),r&&r!=g){l<0&&(l=1,n(),o.sticky="after");break}if(g&&(r=g),0=a.height){s.hitSide=!0;break}l+=5*n}return s}function Ml(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Nl(e,t){var n=Nn(e,t.line);if(!n||n.hidden)return null;var r=Qe(e.doc,t.line),i=Tn(n,r,t.line),o=ye(r,e.doc.direction),l="left";o&&(l=ae(o,t.ch)%2?"right":"left");var s=Hn(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Al(e,t){return t&&(e.bad=!0),e}function Ol(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Al(e.clipPos(lt(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||i.line=t.display.viewFrom&&Nl(t,r)||{node:u[0].measure.map[2],offset:0},h=i.liner.firstLine()&&(l=lt(l.line-1,Qe(r.doc,l.line-1).length)),s.ch==Qe(r.doc,s.line).text.length&&s.linei.viewTo-1)return!1;n=l.line==i.viewFrom||0==(e=rr(r,l.line))?(t=nt(i.view[0].line),i.view[0].node):(t=nt(i.view[e].line),i.view[e-1].node.nextSibling);var a,u=rr(r,s.line),c=u==i.view.length-1?(a=i.viewTo-1,i.lineDiv.lastChild):(a=nt(i.view[u+1].line)-1,i.view[u+1].node.previousSibling);if(!n)return!1;for(var h=r.doc.splitLines(function(u,e,t,c,h){var n="",d=!1,f=u.doc.lineSeparator(),p=!1;function g(){d&&(n+=f,p&&(n+=f),d=p=!1)}function m(e){e&&(g(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void m(n);var r,i=t.getAttribute("cm-marker");if(i){var o=u.findMarks(lt(c,0),lt(h+1,0),(a=+i,function(e){return e.id==a}));return void(o.length&&(r=o[0].find(0))&&m(Je(u.doc,r.from,r.to).join(f)))}if("false"==t.getAttribute("contenteditable"))return;var l=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;l&&g();for(var s=0;sl.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)f--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var x=lt(t,f),C=lt(a,d.length?$(d).length-p:0);return 1n&&(ml(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Sr(this));else{for(var o=i.from(),l=i.to(),s=Math.max(n,o.line),n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1,a=s;a>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]o)&&e.top>t.offsetHeight?h=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(h=e.bottom),d+t.offsetWidth>l&&(d=l-t.offsetWidth)),t.style.top=h+"px",t.style.left=t.style.right="","right"==i?(d=c.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?d=0:"middle"==i&&(d=(c.sizer.clientWidth-t.offsetWidth)/2),t.style.left=d+"px"),n&&(s=this,a={left:d,top:h,right:d+t.offsetWidth,bottom:h+t.offsetHeight},null!=(u=xr(s,a)).scrollTop&&Mr(s,u.scrollTop),null!=u.scrollLeft&&Ar(s,u.scrollLeft))},triggerOnKeyDown:Ur(Zo),triggerOnKeyPress:Ur(Jo),triggerOnKeyUp:Qo,triggerOnMouseDown:Ur(rl),execCommand:function(e){if(Uo.hasOwnProperty(e))return Uo[e].call(null,this)},triggerElectric:Ur(function(e){xl(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=ft(this.doc,e),l=0;l