From 37498dbc66cab6b5eb74b52f5c37db12f99b39e0 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sun, 13 Jul 2025 03:06:10 +0100 Subject: [PATCH 01/13] WIP --- CHANGELOG.md | 13 + README.md | 1 + bin/build.js | 12 +- composer.json | 9 +- dist/laravel-filament-json-field.js | 4 +- package-lock.json | 230 ++++++++++-------- resources/js/laravel-filament-json-field.js | 2 +- .../forms/components/json-input.blade.php | 25 +- .../infolists/components/json-entry.blade.php | 137 +++++------ src/FilamentJsonFieldServiceProvider.php | 3 +- src/Forms/Components/JsonInput.php | 14 +- src/Infolists/Components/JsonEntry.php | 5 + 12 files changed, 254 insertions(+), 201 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63861eb..51b094c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ # Changelog All notable changes to `filament-json-field` will be documented in this file. + +## [13.0.0] - 2024-12-XX + +### Added +- Support for Filament 4.x + +### Changed +- Updated dependencies to support Filament 4.x +- Updated Blade components to use new Filament 4 syntax +- Updated service provider to use Filament 4 asset registration + +### Removed +- Support for Filament 3.x (use v12.0.0 for Filament 3.x compatibility) diff --git a/README.md b/README.md index 64e52f1..785549c 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Filament Json Field is a Filament wrapper for Codemirror. | Package | PHP | Laravel | Filament Infolists | Filament Support | Filament Tables | |-----------|------------------|---------------|--------------------|------------------|-----------------| +| v13.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^4.0 | ^4.0 | ^4.0 | | v12.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^3.3 | ^3.3 | ^3.3 | | v2.0 | ^8.1 | ^11.0 | ^3.2 | ^3.2 | ^3.2 | | v1.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | diff --git a/bin/build.js b/bin/build.js index 9571b8a..24d8806 100644 --- a/bin/build.js +++ b/bin/build.js @@ -1,6 +1,7 @@ import * as esbuild from 'esbuild'; -esbuild.build({ +// Build JavaScript +await esbuild.build({ entryPoints: ['./resources/js/laravel-filament-json-field.js'], outfile: './dist/laravel-filament-json-field.js', bundle: true, @@ -10,3 +11,12 @@ esbuild.build({ target: ['es2020'], minify: true, }); + +// Build CSS (if needed in the future) +// await esbuild.build({ +// entryPoints: ['./resources/css/laravel-filament-json-field.css'], +// outfile: './dist/laravel-filament-json-field.css', +// bundle: true, +// platform: 'browser', +// minify: true, +// }); diff --git a/composer.json b/composer.json index d1a48b5..aa4d059 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "codebar-ag/laravel-filament-json-field", - "description": "This is my package laravel-filament-json-field", + "description": "A Laravel Filament JSON Field integration with CodeMirror support", "keywords": [ "CodebarAg", "laravel", @@ -22,9 +22,10 @@ ], "require": { "php": "8.2.*|8.3.*|8.4.*", - "filament/infolists": "^3.3", - "filament/support": "^3.3", - "filament/tables": "^3.3", + "filament/forms": "^4.0", + "filament/infolists": "^4.0", + "filament/support": "^4.0", + "filament/tables": "^4.0", "illuminate/contracts": "^12.0", "livewire/livewire": "^3.6", "spatie/laravel-package-tools": "^1.19" diff --git a/dist/laravel-filament-json-field.js b/dist/laravel-filament-json-field.js index 9c93500..47f7069 100644 --- a/dist/laravel-filament-json-field.js +++ b/dist/laravel-filament-json-field.js @@ -21,7 +21,7 @@ b`.split(/\n/).length!=3?function(e){for(var i=0,s=[],o=e.length;i<=o;){var f=e. `)>-1?s.value=e.prevInput="":e.prevInput=f,e.composing&&(e.composing.range.clear(),e.composing.range=i.markText(e.composing.start,i.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$e.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$e.prototype.onKeyPress=function(){d&&c>=9&&(this.hasSelection=null),this.fastPoll()},$e.prototype.onContextMenu=function(e){var i=this,s=i.cm,o=s.display,f=i.textarea;i.contextMenuPending&&i.contextMenuPending();var h=dn(s,e),p=o.scroller.scrollTop;if(!h||k)return;var v=s.options.resetSelectionOnContextMenu;v&&s.doc.sel.contains(h)==-1&&dt(s,St)(s.doc,Ui(h),lr);var y=f.style.cssText,b=i.wrapper.style.cssText,O=i.wrapper.offsetParent.getBoundingClientRect();i.wrapper.style.cssText="position: static",f.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-O.top-5)+"px; left: "+(e.clientX-O.left-5)+`px; z-index: 1000; background: `+(d?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var H;g&&(H=f.ownerDocument.defaultView.scrollY),o.input.focus(),g&&f.ownerDocument.defaultView.scrollTo(null,H),o.input.reset(),s.somethingSelected()||(f.value=i.prevInput=" "),i.contextMenuPending=P,o.selForContextMenu=s.doc.sel,clearTimeout(o.detectingSelectAll);function F(){if(f.selectionStart!=null){var _=s.somethingSelected(),q="\u200B"+(_?f.value:"");f.value="\u21DA",f.value=q,i.prevInput=_?"":"\u200B",f.selectionStart=1,f.selectionEnd=q.length,o.selForContextMenu=s.doc.sel}}function P(){if(i.contextMenuPending==P&&(i.contextMenuPending=!1,i.wrapper.style.cssText=b,f.style.cssText=y,d&&c<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=p),f.selectionStart!=null)){(!d||d&&c<9)&&F();var _=0,q=function(){o.selForContextMenu==s.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&i.prevInput=="\u200B"?dt(s,Dd)(s):_++<10?o.detectingSelectAll=setTimeout(q,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(q,200)}}if(d&&c>=9&&F(),we){Fi(e);var R=function(){wt(window,"mouseup",R),setTimeout(P,20)};ae(window,"mouseup",R)}else setTimeout(P,50)},$e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},$e.prototype.setUneditable=function(){},$e.prototype.needsContentAttribute=!1;function Ym(e,i){if(i=i?ye(i):{},i.value=e.value,!i.tabindex&&e.tabIndex&&(i.tabindex=e.tabIndex),!i.placeholder&&e.placeholder&&(i.placeholder=e.placeholder),i.autofocus==null){var s=ze(ft(e));i.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function o(){e.value=v.getValue()}var f;if(e.form&&(ae(e.form,"submit",o),!i.leaveSubmitMethodAlone)){var h=e.form;f=h.submit;try{var p=h.submit=function(){o(),h.submit=f,h.submit(),h.submit=p}}catch{}}i.finishInit=function(y){y.save=o,y.getTextArea=function(){return e},y.toTextArea=function(){y.toTextArea=isNaN,o(),e.parentNode.removeChild(y.getWrapperElement()),e.style.display="",e.form&&(wt(e.form,"submit",o),!i.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var v=Ge(function(y){return e.parentNode.insertBefore(y,e.nextSibling)},i);return v}function Zm(e){e.off=wt,e.on=ae,e.wheelEventPixels=rm,e.Doc=Bt,e.splitLines=cr,e.countColumn=Oe,e.findColumn=Xr,e.isWordChar=eo,e.Pass=Ni,e.signal=je,e.Line=Jn,e.changeEnd=_i,e.scrollbarModel=od,e.Pos=I,e.cmpPos=Q,e.modes=Kn,e.mimeModes=Ar,e.resolveMode=Xn,e.getMode=jn,e.modeExtensions=Bi,e.extendMode=qn,e.copyState=qr,e.startState=Yn,e.innerMode=io,e.commands=Ao,e.keyMap=vi,e.keyName=jd,e.isModifierKey=Kd,e.lookupKey=fl,e.normalizeKeyMap=km,e.StringStream=Ye,e.SharedTextMarker=Lo,e.TextMarker=Xi,e.LineWidget=ko,e.e_preventDefault=Ct,e.e_stopPropagation=Un,e.e_stop=Fi,e.addClass=Ee,e.contains=_e,e.rmClass=ke,e.keyNames=ji}zm(Ge),Km(Ge);var Jm="iter insert remove copy getEditor constructor".split(" ");for(var Zs in Bt.prototype)Bt.prototype.hasOwnProperty(Zs)&&ve(Jm,Zs)<0&&(Ge.prototype[Zs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Bt.prototype[Zs]));return Lr(Bt),Ge.inputStyles={textarea:$e,contenteditable:Ne},Ge.defineMode=function(e){!Ge.defaults.mode&&e!="null"&&(Ge.defaults.mode=e),Or.apply(this,arguments)},Ge.defineMIME=fn,Ge.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ge.defineMIME("text/plain","null"),Ge.defineExtension=function(e,i){Ge.prototype[e]=i},Ge.defineDocExtension=function(e,i){Bt.prototype[e]=i},Ge.fromTextArea=Ym,Zm(Ge),Ge.version="5.65.16",Ge})});var cg=Ut((hg,dg)=>{(function(t){typeof hg=="object"&&typeof dg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(r,n){var l=r.indentUnit,a=n.statementIndent,u=n.jsonld,d=n.json||u,c=n.trackScope!==!1,g=n.typescript,m=n.wordCharacters||/[\w$\xa1-\uffff]/,x=function(){function w(ut){return{type:ut,style:"keyword"}}var N=w("keyword a"),G=w("keyword b"),j=w("keyword c"),I=w("keyword d"),Q=w("operator"),Te={type:"atom",style:"atom"};return{if:w("if"),while:N,with:N,else:G,do:G,try:G,finally:G,return:I,break:I,continue:I,new:w("new"),delete:j,void:j,throw:j,debugger:w("debugger"),var:w("var"),const:w("var"),let:w("var"),function:w("function"),catch:w("catch"),for:w("for"),switch:w("switch"),case:w("case"),default:w("default"),in:Q,typeof:Q,instanceof:Q,true:Te,false:Te,null:Te,undefined:Te,NaN:Te,Infinity:Te,this:w("this"),class:w("class"),super:w("atom"),yield:j,export:w("export"),import:w("import"),extends:j,await:j}}(),S=/[+\-*&%=<>!?|~^@]/,k=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function A(w){for(var N=!1,G,j=!1;(G=w.next())!=null;){if(!N){if(G=="/"&&!j)return;G=="["?j=!0:j&&G=="]"&&(j=!1)}N=!N&&G=="\\"}}var T,L;function C(w,N,G){return T=w,L=G,N}function M(w,N){var G=w.next();if(G=='"'||G=="'")return N.tokenize=D(G),N.tokenize(w,N);if(G=="."&&w.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return C("number","number");if(G=="."&&w.match(".."))return C("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(G))return C(G);if(G=="="&&w.eat(">"))return C("=>","operator");if(G=="0"&&w.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return C("number","number");if(/\d/.test(G))return w.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),C("number","number");if(G=="/")return w.eat("*")?(N.tokenize=E,E(w,N)):w.eat("/")?(w.skipToEnd(),C("comment","comment")):sr(w,N,1)?(A(w),w.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),C("regexp","string-2")):(w.eat("="),C("operator","operator",w.current()));if(G=="`")return N.tokenize=B,B(w,N);if(G=="#"&&w.peek()=="!")return w.skipToEnd(),C("meta","meta");if(G=="#"&&w.eatWhile(m))return C("variable","property");if(G=="<"&&w.match("!--")||G=="-"&&w.match("->")&&!/\S/.test(w.string.slice(0,w.start)))return w.skipToEnd(),C("comment","comment");if(S.test(G))return(G!=">"||!N.lexical||N.lexical.type!=">")&&(w.eat("=")?(G=="!"||G=="=")&&w.eat("="):/[<>*+\-|&?]/.test(G)&&(w.eat(G),G==">"&&w.eat(G))),G=="?"&&w.eat(".")?C("."):C("operator","operator",w.current());if(m.test(G)){w.eatWhile(m);var j=w.current();if(N.lastType!="."){if(x.propertyIsEnumerable(j)){var I=x[j];return C(I.type,I.style,j)}if(j=="async"&&w.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return C("async","keyword",j)}return C("variable","variable",j)}}function D(w){return function(N,G){var j=!1,I;if(u&&N.peek()=="@"&&N.match(k))return G.tokenize=M,C("jsonld-keyword","meta");for(;(I=N.next())!=null&&!(I==w&&!j);)j=!j&&I=="\\";return j||(G.tokenize=M),C("string","string")}}function E(w,N){for(var G=!1,j;j=w.next();){if(j=="/"&&G){N.tokenize=M;break}G=j=="*"}return C("comment","comment")}function B(w,N){for(var G=!1,j;(j=w.next())!=null;){if(!G&&(j=="`"||j=="$"&&w.eat("{"))){N.tokenize=M;break}G=!G&&j=="\\"}return C("quasi","string-2",w.current())}var K="([{}])";function X(w,N){N.fatArrowAt&&(N.fatArrowAt=null);var G=w.string.indexOf("=>",w.start);if(!(G<0)){if(g){var j=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(w.string.slice(w.start,G));j&&(G=j.index)}for(var I=0,Q=!1,Te=G-1;Te>=0;--Te){var ut=w.string.charAt(Te),Et=K.indexOf(ut);if(Et>=0&&Et<3){if(!I){++Te;break}if(--I==0){ut=="("&&(Q=!0);break}}else if(Et>=3&&Et<6)++I;else if(m.test(ut))Q=!0;else if(/["'\/`]/.test(ut))for(;;--Te){if(Te==0)return;var Zn=w.string.charAt(Te-1);if(Zn==ut&&w.string.charAt(Te-2)!="\\"){Te--;break}}else if(Q&&!I){++Te;break}}Q&&!I&&(N.fatArrowAt=Te)}}var ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function we(w,N,G,j,I,Q){this.indented=w,this.column=N,this.type=G,this.prev=I,this.info=Q,j!=null&&(this.align=j)}function he(w,N){if(!c)return!1;for(var G=w.localVars;G;G=G.next)if(G.name==N)return!0;for(var j=w.context;j;j=j.prev)for(var G=j.vars;G;G=G.next)if(G.name==N)return!0}function ke(w,N,G,j,I){var Q=w.cc;for(z.state=w,z.stream=I,z.marked=null,z.cc=Q,z.style=N,w.lexical.hasOwnProperty("align")||(w.lexical.align=!0);;){var Te=Q.length?Q.pop():d?ve:Oe;if(Te(G,j)){for(;Q.length&&Q[Q.length-1].lex;)Q.pop()();return z.marked?z.marked:G=="variable"&&he(w,j)?"variable-2":N}}}var z={state:null,column:null,marked:null,cc:null};function Y(){for(var w=arguments.length-1;w>=0;w--)z.cc.push(arguments[w])}function W(){return Y.apply(null,arguments),!0}function De(w,N){for(var G=N;G;G=G.next)if(G.name==w)return!0;return!1}function Qe(w){var N=z.state;if(z.marked="def",!!c){if(N.context){if(N.lexical.info=="var"&&N.context&&N.context.block){var G=_e(w,N.context);if(G!=null){N.context=G;return}}else if(!De(w,N.localVars)){N.localVars=new Be(w,N.localVars);return}}n.globalVars&&!De(w,N.globalVars)&&(N.globalVars=new Be(w,N.globalVars))}}function _e(w,N){if(N)if(N.block){var G=_e(w,N.prev);return G?G==N.prev?N:new Ee(G,N.vars,!0):null}else return De(w,N.vars)?N:new Ee(N.prev,new Be(w,N.vars),!1);else return null}function ze(w){return w=="public"||w=="private"||w=="protected"||w=="abstract"||w=="readonly"}function Ee(w,N,G){this.prev=w,this.vars=N,this.block=G}function Be(w,N){this.name=w,this.next=N}var nr=new Be("this",new Be("arguments",null));function tt(){z.state.context=new Ee(z.state.context,z.state.localVars,!1),z.state.localVars=nr}function bt(){z.state.context=new Ee(z.state.context,z.state.localVars,!0),z.state.localVars=null}tt.lex=bt.lex=!0;function ft(){z.state.localVars=z.state.context.vars,z.state.context=z.state.context.prev}ft.lex=!0;function pe(w,N){var G=function(){var j=z.state,I=j.indented;if(j.lexical.type=="stat")I=j.lexical.indented;else for(var Q=j.lexical;Q&&Q.type==")"&&Q.align;Q=Q.prev)I=Q.indented;j.lexical=new we(I,z.stream.column(),w,null,j.lexical,N)};return G.lex=!0,G}function ue(){var w=z.state;w.lexical.prev&&(w.lexical.type==")"&&(w.indented=w.lexical.indented),w.lexical=w.lexical.prev)}ue.lex=!0;function ye(w){function N(G){return G==w?W():w==";"||G=="}"||G==")"||G=="]"?Y():W(N)}return N}function Oe(w,N){return w=="var"?W(pe("vardef",N),Un,ye(";"),ue):w=="keyword a"?W(pe("form"),Ni,Oe,ue):w=="keyword b"?W(pe("form"),Oe,ue):w=="keyword d"?z.stream.match(/^\s*$/,!1)?W():W(pe("stat"),Kr,ye(";"),ue):w=="debugger"?W(ye(";")):w=="{"?W(pe("}"),bt,jr,ue,ft):w==";"?W():w=="if"?(z.state.lexical.info=="else"&&z.state.cc[z.state.cc.length-1]==ue&&z.state.cc.pop()(),W(pe("form"),Ni,Oe,ue,_n)):w=="function"?W(cr):w=="for"?W(pe("form"),bt,ys,Oe,ft,ue):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form",w=="class"?w:N),Kn,ue)):w=="variable"?g&&N=="declare"?(z.marked="keyword",W(Oe)):g&&(N=="module"||N=="enum"||N=="type")&&z.stream.match(/^\s*\w/,!1)?(z.marked="keyword",N=="enum"?W(ie):N=="type"?W(xs,ye("operator"),Ce,ye(";")):W(pe("form"),Ft,ye("{"),pe("}"),jr,ue,ue)):g&&N=="namespace"?(z.marked="keyword",W(pe("form"),ve,Oe,ue)):g&&N=="abstract"?(z.marked="keyword",W(Oe)):W(pe("stat"),hf):w=="switch"?W(pe("form"),Ni,ye("{"),pe("}","switch"),bt,jr,ue,ue,ft):w=="case"?W(ve,ye(":")):w=="default"?W(ye(":")):w=="catch"?W(pe("form"),tt,_r,Oe,ue,ft):w=="export"?W(pe("stat"),Xn,ue):w=="import"?W(pe("stat"),Bi,ue):w=="async"?W(Oe):N=="@"?W(ve,Oe):Y(pe("stat"),ve,ye(";"),ue)}function _r(w){if(w=="(")return W(Mr,ye(")"))}function ve(w,N){return lr(w,N,!1)}function Ot(w,N){return lr(w,N,!0)}function Ni(w){return w!="("?Y():W(pe(")"),Kr,ye(")"),ue)}function lr(w,N,G){if(z.state.fatArrowAt==z.stream.start){var j=G?sn:Le;if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,ye("=>"),j,ft);if(w=="variable")return Y(tt,Ft,ye("=>"),j,ft)}var I=G?Xr:or;return ee.hasOwnProperty(w)?W(I):w=="function"?W(cr,I):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form"),pf,ue)):w=="keyword c"||w=="async"?W(G?Ot:ve):w=="("?W(pe(")"),Kr,ye(")"),ue,I):w=="operator"||w=="spread"?W(G?Ot:ve):w=="["?W(pe("]"),Ye,ue,I):w=="{"?Hi(ai,"}",null,I):w=="quasi"?Y(si,I):w=="new"?W(uf(G)):W()}function Kr(w){return w.match(/[;\}\)\],]/)?Y():Y(ve)}function or(w,N){return w==","?W(Kr):Xr(w,N,!1)}function Xr(w,N,G){var j=G==!1?or:Xr,I=G==!1?ve:Ot;if(w=="=>")return W(tt,G?sn:Le,ft);if(w=="operator")return/\+\+|--/.test(N)||g&&N=="!"?W(j):g&&N=="<"&&z.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?W(pe(">"),rt(Ce,">"),ue,j):N=="?"?W(ve,ye(":"),I):W(I);if(w=="quasi")return Y(si,j);if(w!=";"){if(w=="(")return Hi(Ot,")","call",j);if(w==".")return W(eo,j);if(w=="[")return W(pe("]"),Kr,ye("]"),ue,j);if(g&&N=="as")return z.marked="keyword",W(Ce,j);if(w=="regexp")return z.state.lastType=z.marked="operator",z.stream.backUp(z.stream.pos-z.stream.start-1),W(I)}}function si(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(si):W(Kr,Vl)}function Vl(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(si)}function Le(w){return X(z.stream,z.state),Y(w=="{"?Oe:ve)}function sn(w){return X(z.stream,z.state),Y(w=="{"?Oe:Ot)}function uf(w){return function(N){return N=="."?W(w?gs:ps):N=="variable"&&g?W(Zt,w?Xr:or):Y(w?Ot:ve)}}function ps(w,N){if(N=="target")return z.marked="keyword",W(or)}function gs(w,N){if(N=="target")return z.marked="keyword",W(Xr)}function hf(w){return w==":"?W(ue,Oe):Y(or,ye(";"),ue)}function eo(w){if(w=="variable")return z.marked="property",W()}function ai(w,N){if(w=="async")return z.marked="property",W(ai);if(w=="variable"||z.style=="keyword"){if(z.marked="property",N=="get"||N=="set")return W(vs);var G;return g&&z.state.fatArrowAt==z.stream.start&&(G=z.stream.match(/^\s*:\s*/,!1))&&(z.state.fatArrowAt=z.stream.pos+G[0].length),W(fi)}else{if(w=="number"||w=="string")return z.marked=u?"property":z.style+" property",W(fi);if(w=="jsonld-keyword")return W(fi);if(g&&ze(N))return z.marked="keyword",W(ai);if(w=="[")return W(ve,Wi,ye("]"),fi);if(w=="spread")return W(Ot,fi);if(N=="*")return z.marked="keyword",W(ai);if(w==":")return Y(fi)}}function vs(w){return w!="variable"?Y(fi):(z.marked="property",W(cr))}function fi(w){if(w==":")return W(Ot);if(w=="(")return Y(cr)}function rt(w,N,G){function j(I,Q){if(G?G.indexOf(I)>-1:I==","){var Te=z.state.lexical;return Te.info=="call"&&(Te.pos=(Te.pos||0)+1),W(function(ut,Et){return ut==N||Et==N?Y():Y(w)},j)}return I==N||Q==N?W():G&&G.indexOf(";")>-1?Y(w):W(ye(N))}return function(I,Q){return I==N||Q==N?W():Y(w,j)}}function Hi(w,N,G){for(var j=3;j"),Ce);if(w=="quasi")return Y(wt,dr)}function ms(w){if(w=="=>")return W(Ce)}function ae(w){return w.match(/[\}\)\]]/)?W():w==","||w==";"?W(ae):Y(ui,ae)}function ui(w,N){if(w=="variable"||z.style=="keyword")return z.marked="property",W(ui);if(N=="?"||w=="number"||w=="string")return W(ui);if(w==":")return W(Ce);if(w=="[")return W(ye("variable"),an,ye("]"),ui);if(w=="(")return Y(Ii,ui);if(!w.match(/[;\}\)\],]/))return W()}function wt(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(wt):W(Ce,je)}function je(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(wt)}function qe(w,N){return w=="variable"&&z.stream.match(/^\s*[?:]/,!1)||N=="?"?W(qe):w==":"?W(Ce):w=="spread"?W(qe):Y(Ce)}function dr(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr);if(N=="|"||w=="."||N=="&")return W(Ce);if(w=="[")return W(Ce,ye("]"),dr);if(N=="extends"||N=="implements")return z.marked="keyword",W(Ce);if(N=="?")return W(Ce,ye(":"),Ce)}function Zt(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr)}function Lr(){return Y(Ce,Ct)}function Ct(w,N){if(N=="=")return W(Ce)}function Un(w,N){return N=="enum"?(z.marked="keyword",W(ie)):Y(Ft,Wi,Tr,cf)}function Ft(w,N){if(g&&ze(N))return z.marked="keyword",W(Ft);if(w=="variable")return Qe(N),W();if(w=="spread")return W(Ft);if(w=="[")return Hi(to,"]");if(w=="{")return Hi(Fi,"}")}function Fi(w,N){return w=="variable"&&!z.stream.match(/^\s*:/,!1)?(Qe(N),W(Tr)):(w=="variable"&&(z.marked="property"),w=="spread"?W(Ft):w=="}"?Y():w=="["?W(ve,ye("]"),ye(":"),Fi):W(ye(":"),Ft,Tr))}function to(){return Y(Ft,Tr)}function Tr(w,N){if(N=="=")return W(Ot)}function cf(w){if(w==",")return W(Un)}function _n(w,N){if(w=="keyword b"&&N=="else")return W(pe("form","else"),Oe,ue)}function ys(w,N){if(N=="await")return W(ys);if(w=="(")return W(pe(")"),ro,ue)}function ro(w){return w=="var"?W(Un,Ei):w=="variable"?W(Ei):Y(Ei)}function Ei(w,N){return w==")"?W():w==";"?W(Ei):N=="in"||N=="of"?(z.marked="keyword",W(ve,Ei)):Y(ve,Ei)}function cr(w,N){if(N=="*")return z.marked="keyword",W(cr);if(w=="variable")return Qe(N),W(cr);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,Oe,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,cr)}function Ii(w,N){if(N=="*")return z.marked="keyword",W(Ii);if(w=="variable")return Qe(N),W(Ii);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,Ii)}function xs(w,N){if(w=="keyword"||w=="variable")return z.marked="type",W(xs);if(N=="<")return W(pe(">"),rt(Lr,">"),ue)}function Mr(w,N){return N=="@"&&W(ve,Mr),w=="spread"?W(Mr):g&&ze(N)?(z.marked="keyword",W(Mr)):g&&w=="this"?W(Wi,Tr):Y(Ft,Wi,Tr)}function pf(w,N){return w=="variable"?Kn(w,N):Ar(w,N)}function Kn(w,N){if(w=="variable")return Qe(N),W(Ar)}function Ar(w,N){if(N=="<")return W(pe(">"),rt(Lr,">"),ue,Ar);if(N=="extends"||N=="implements"||g&&w==",")return N=="implements"&&(z.marked="keyword"),W(g?Ce:ve,Ar);if(w=="{")return W(pe("}"),Or,ue)}function Or(w,N){if(w=="async"||w=="variable"&&(N=="static"||N=="get"||N=="set"||g&&ze(N))&&z.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return z.marked="keyword",W(Or);if(w=="variable"||z.style=="keyword")return z.marked="property",W(fn,Or);if(w=="number"||w=="string")return W(fn,Or);if(w=="[")return W(ve,Wi,ye("]"),fn,Or);if(N=="*")return z.marked="keyword",W(Or);if(g&&w=="(")return Y(Ii,Or);if(w==";"||w==",")return W(Or);if(w=="}")return W();if(N=="@")return W(ve,Or)}function fn(w,N){if(N=="!"||N=="?")return W(fn);if(w==":")return W(Ce,Tr);if(N=="=")return W(Ot);var G=z.state.lexical.prev,j=G&&G.info=="interface";return Y(j?Ii:cr)}function Xn(w,N){return N=="*"?(z.marked="keyword",W(Yn,ye(";"))):N=="default"?(z.marked="keyword",W(ve,ye(";"))):w=="{"?W(rt(jn,"}"),Yn,ye(";")):Y(Oe)}function jn(w,N){if(N=="as")return z.marked="keyword",W(ye("variable"));if(w=="variable")return Y(Ot,jn)}function Bi(w){return w=="string"?W():w=="("?Y(ve):w=="."?Y(or):Y(qn,qr,Yn)}function qn(w,N){return w=="{"?Hi(qn,"}"):(w=="variable"&&Qe(N),N=="*"&&(z.marked="keyword"),W(io))}function qr(w){if(w==",")return W(qn,qr)}function io(w,N){if(N=="as")return z.marked="keyword",W(qn)}function Yn(w,N){if(N=="from")return z.marked="keyword",W(ve)}function Ye(w){return w=="]"?W():Y(rt(Ot,"]"))}function ie(){return Y(pe("form"),Ft,ye("{"),pe("}"),rt(hi,"}"),ue,ue)}function hi(){return Y(Ft,Tr)}function no(w,N){return w.lastType=="operator"||w.lastType==","||S.test(N.charAt(0))||/[,.]/.test(N.charAt(0))}function sr(w,N,G){return N.tokenize==M&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(N.lastType)||N.lastType=="quasi"&&/\{\s*$/.test(w.string.slice(0,w.pos-(G||0)))}return{startState:function(w){var N={tokenize:M,lastType:"sof",cc:[],lexical:new we((w||0)-l,0,"block",!1),localVars:n.localVars,context:n.localVars&&new Ee(null,null,!1),indented:w||0};return n.globalVars&&typeof n.globalVars=="object"&&(N.globalVars=n.globalVars),N},token:function(w,N){if(w.sol()&&(N.lexical.hasOwnProperty("align")||(N.lexical.align=!1),N.indented=w.indentation(),X(w,N)),N.tokenize!=E&&w.eatSpace())return null;var G=N.tokenize(w,N);return T=="comment"?G:(N.lastType=T=="operator"&&(L=="++"||L=="--")?"incdec":T,ke(N,G,T,L,w))},indent:function(w,N){if(w.tokenize==E||w.tokenize==B)return t.Pass;if(w.tokenize!=M)return 0;var G=N&&N.charAt(0),j=w.lexical,I;if(!/^\s*else\b/.test(N))for(var Q=w.cc.length-1;Q>=0;--Q){var Te=w.cc[Q];if(Te==ue)j=j.prev;else if(Te!=_n&&Te!=ft)break}for(;(j.type=="stat"||j.type=="form")&&(G=="}"||(I=w.cc[w.cc.length-1])&&(I==or||I==Xr)&&!/^[,\.=+\-*:?[\(]/.test(N));)j=j.prev;a&&j.type==")"&&j.prev.type=="stat"&&(j=j.prev);var ut=j.type,Et=G==ut;return ut=="vardef"?j.indented+(w.lastType=="operator"||w.lastType==","?j.info.length+1:0):ut=="form"&&G=="{"?j.indented:ut=="form"?j.indented+l:ut=="stat"?j.indented+(no(w,N)?a||l:0):j.info=="switch"&&!Et&&n.doubleIndentSwitch!=!1?j.indented+(/^(?:case|default)\b/.test(N)?l:2*l):j.align?j.column+(Et?0:1):j.indented+(Et?0:l)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:d?null:"/*",blockCommentEnd:d?null:"*/",blockCommentContinue:d?null:" * ",lineComment:d?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:d?"json":"javascript",jsonldMode:u,jsonMode:d,expressionAllowed:sr,skipExpression:function(w){ke(w,"atom","atom","true",new t.StringStream("",2,null))}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var vg=Ut((pg,gg)=>{(function(t){typeof pg=="object"&&typeof gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},n=t.Pos;t.defineOption("autoCloseBrackets",!1,function(L,C,M){M&&M!=t.Init&&(L.removeKeyMap(a),L.state.closeBrackets=null),C&&(u(l(C,"pairs")),L.state.closeBrackets=C,L.addKeyMap(a))});function l(L,C){return C=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[C]!=null?L[C]:r[C]}var a={Backspace:g,Enter:m};function u(L){for(var C=0;C=0;E--){var K=D[E].head;L.replaceRange("",n(K.line,K.ch-1),n(K.line,K.ch+1),"+delete")}}function m(L){var C=c(L),M=C&&l(C,"explode");if(!M||L.getOption("disableInput"))return t.Pass;for(var D=L.listSelections(),E=0;E0&&i.prevInput=="\u200B"?dt(s,Dd)(s):_++<10?o.detectingSelectAll=setTimeout(q,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(q,200)}}if(d&&c>=9&&F(),we){Fi(e);var R=function(){wt(window,"mouseup",R),setTimeout(P,20)};ae(window,"mouseup",R)}else setTimeout(P,50)},$e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},$e.prototype.setUneditable=function(){},$e.prototype.needsContentAttribute=!1;function Ym(e,i){if(i=i?ye(i):{},i.value=e.value,!i.tabindex&&e.tabIndex&&(i.tabindex=e.tabIndex),!i.placeholder&&e.placeholder&&(i.placeholder=e.placeholder),i.autofocus==null){var s=ze(ft(e));i.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function o(){e.value=v.getValue()}var f;if(e.form&&(ae(e.form,"submit",o),!i.leaveSubmitMethodAlone)){var h=e.form;f=h.submit;try{var p=h.submit=function(){o(),h.submit=f,h.submit(),h.submit=p}}catch{}}i.finishInit=function(y){y.save=o,y.getTextArea=function(){return e},y.toTextArea=function(){y.toTextArea=isNaN,o(),e.parentNode.removeChild(y.getWrapperElement()),e.style.display="",e.form&&(wt(e.form,"submit",o),!i.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var v=Ge(function(y){return e.parentNode.insertBefore(y,e.nextSibling)},i);return v}function Zm(e){e.off=wt,e.on=ae,e.wheelEventPixels=rm,e.Doc=Bt,e.splitLines=cr,e.countColumn=Oe,e.findColumn=Xr,e.isWordChar=eo,e.Pass=Ni,e.signal=je,e.Line=Jn,e.changeEnd=_i,e.scrollbarModel=od,e.Pos=I,e.cmpPos=Q,e.modes=Kn,e.mimeModes=Ar,e.resolveMode=Xn,e.getMode=jn,e.modeExtensions=Bi,e.extendMode=qn,e.copyState=qr,e.startState=Yn,e.innerMode=io,e.commands=Ao,e.keyMap=vi,e.keyName=jd,e.isModifierKey=Kd,e.lookupKey=fl,e.normalizeKeyMap=km,e.StringStream=Ye,e.SharedTextMarker=Lo,e.TextMarker=Xi,e.LineWidget=ko,e.e_preventDefault=Ct,e.e_stopPropagation=Un,e.e_stop=Fi,e.addClass=Ee,e.contains=_e,e.rmClass=ke,e.keyNames=ji}zm(Ge),Km(Ge);var Jm="iter insert remove copy getEditor constructor".split(" ");for(var Zs in Bt.prototype)Bt.prototype.hasOwnProperty(Zs)&&ve(Jm,Zs)<0&&(Ge.prototype[Zs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Bt.prototype[Zs]));return Lr(Bt),Ge.inputStyles={textarea:$e,contenteditable:Ne},Ge.defineMode=function(e){!Ge.defaults.mode&&e!="null"&&(Ge.defaults.mode=e),Or.apply(this,arguments)},Ge.defineMIME=fn,Ge.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ge.defineMIME("text/plain","null"),Ge.defineExtension=function(e,i){Ge.prototype[e]=i},Ge.defineDocExtension=function(e,i){Bt.prototype[e]=i},Ge.fromTextArea=Ym,Zm(Ge),Ge.version="5.65.19",Ge})});var cg=Ut((hg,dg)=>{(function(t){typeof hg=="object"&&typeof dg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(r,n){var l=r.indentUnit,a=n.statementIndent,u=n.jsonld,d=n.json||u,c=n.trackScope!==!1,g=n.typescript,m=n.wordCharacters||/[\w$\xa1-\uffff]/,x=function(){function w(ut){return{type:ut,style:"keyword"}}var N=w("keyword a"),G=w("keyword b"),j=w("keyword c"),I=w("keyword d"),Q=w("operator"),Te={type:"atom",style:"atom"};return{if:w("if"),while:N,with:N,else:G,do:G,try:G,finally:G,return:I,break:I,continue:I,new:w("new"),delete:j,void:j,throw:j,debugger:w("debugger"),var:w("var"),const:w("var"),let:w("var"),function:w("function"),catch:w("catch"),for:w("for"),switch:w("switch"),case:w("case"),default:w("default"),in:Q,typeof:Q,instanceof:Q,true:Te,false:Te,null:Te,undefined:Te,NaN:Te,Infinity:Te,this:w("this"),class:w("class"),super:w("atom"),yield:j,export:w("export"),import:w("import"),extends:j,await:j}}(),S=/[+\-*&%=<>!?|~^@]/,k=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function A(w){for(var N=!1,G,j=!1;(G=w.next())!=null;){if(!N){if(G=="/"&&!j)return;G=="["?j=!0:j&&G=="]"&&(j=!1)}N=!N&&G=="\\"}}var T,L;function C(w,N,G){return T=w,L=G,N}function M(w,N){var G=w.next();if(G=='"'||G=="'")return N.tokenize=D(G),N.tokenize(w,N);if(G=="."&&w.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return C("number","number");if(G=="."&&w.match(".."))return C("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(G))return C(G);if(G=="="&&w.eat(">"))return C("=>","operator");if(G=="0"&&w.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return C("number","number");if(/\d/.test(G))return w.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),C("number","number");if(G=="/")return w.eat("*")?(N.tokenize=E,E(w,N)):w.eat("/")?(w.skipToEnd(),C("comment","comment")):sr(w,N,1)?(A(w),w.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),C("regexp","string-2")):(w.eat("="),C("operator","operator",w.current()));if(G=="`")return N.tokenize=B,B(w,N);if(G=="#"&&w.peek()=="!")return w.skipToEnd(),C("meta","meta");if(G=="#"&&w.eatWhile(m))return C("variable","property");if(G=="<"&&w.match("!--")||G=="-"&&w.match("->")&&!/\S/.test(w.string.slice(0,w.start)))return w.skipToEnd(),C("comment","comment");if(S.test(G))return(G!=">"||!N.lexical||N.lexical.type!=">")&&(w.eat("=")?(G=="!"||G=="=")&&w.eat("="):/[<>*+\-|&?]/.test(G)&&(w.eat(G),G==">"&&w.eat(G))),G=="?"&&w.eat(".")?C("."):C("operator","operator",w.current());if(m.test(G)){w.eatWhile(m);var j=w.current();if(N.lastType!="."){if(x.propertyIsEnumerable(j)){var I=x[j];return C(I.type,I.style,j)}if(j=="async"&&w.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return C("async","keyword",j)}return C("variable","variable",j)}}function D(w){return function(N,G){var j=!1,I;if(u&&N.peek()=="@"&&N.match(k))return G.tokenize=M,C("jsonld-keyword","meta");for(;(I=N.next())!=null&&!(I==w&&!j);)j=!j&&I=="\\";return j||(G.tokenize=M),C("string","string")}}function E(w,N){for(var G=!1,j;j=w.next();){if(j=="/"&&G){N.tokenize=M;break}G=j=="*"}return C("comment","comment")}function B(w,N){for(var G=!1,j;(j=w.next())!=null;){if(!G&&(j=="`"||j=="$"&&w.eat("{"))){N.tokenize=M;break}G=!G&&j=="\\"}return C("quasi","string-2",w.current())}var K="([{}])";function X(w,N){N.fatArrowAt&&(N.fatArrowAt=null);var G=w.string.indexOf("=>",w.start);if(!(G<0)){if(g){var j=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(w.string.slice(w.start,G));j&&(G=j.index)}for(var I=0,Q=!1,Te=G-1;Te>=0;--Te){var ut=w.string.charAt(Te),Et=K.indexOf(ut);if(Et>=0&&Et<3){if(!I){++Te;break}if(--I==0){ut=="("&&(Q=!0);break}}else if(Et>=3&&Et<6)++I;else if(m.test(ut))Q=!0;else if(/["'\/`]/.test(ut))for(;;--Te){if(Te==0)return;var Zn=w.string.charAt(Te-1);if(Zn==ut&&w.string.charAt(Te-2)!="\\"){Te--;break}}else if(Q&&!I){++Te;break}}Q&&!I&&(N.fatArrowAt=Te)}}var ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function we(w,N,G,j,I,Q){this.indented=w,this.column=N,this.type=G,this.prev=I,this.info=Q,j!=null&&(this.align=j)}function he(w,N){if(!c)return!1;for(var G=w.localVars;G;G=G.next)if(G.name==N)return!0;for(var j=w.context;j;j=j.prev)for(var G=j.vars;G;G=G.next)if(G.name==N)return!0}function ke(w,N,G,j,I){var Q=w.cc;for(z.state=w,z.stream=I,z.marked=null,z.cc=Q,z.style=N,w.lexical.hasOwnProperty("align")||(w.lexical.align=!0);;){var Te=Q.length?Q.pop():d?ve:Oe;if(Te(G,j)){for(;Q.length&&Q[Q.length-1].lex;)Q.pop()();return z.marked?z.marked:G=="variable"&&he(w,j)?"variable-2":N}}}var z={state:null,column:null,marked:null,cc:null};function Y(){for(var w=arguments.length-1;w>=0;w--)z.cc.push(arguments[w])}function W(){return Y.apply(null,arguments),!0}function De(w,N){for(var G=N;G;G=G.next)if(G.name==w)return!0;return!1}function Qe(w){var N=z.state;if(z.marked="def",!!c){if(N.context){if(N.lexical.info=="var"&&N.context&&N.context.block){var G=_e(w,N.context);if(G!=null){N.context=G;return}}else if(!De(w,N.localVars)){N.localVars=new Be(w,N.localVars);return}}n.globalVars&&!De(w,N.globalVars)&&(N.globalVars=new Be(w,N.globalVars))}}function _e(w,N){if(N)if(N.block){var G=_e(w,N.prev);return G?G==N.prev?N:new Ee(G,N.vars,!0):null}else return De(w,N.vars)?N:new Ee(N.prev,new Be(w,N.vars),!1);else return null}function ze(w){return w=="public"||w=="private"||w=="protected"||w=="abstract"||w=="readonly"}function Ee(w,N,G){this.prev=w,this.vars=N,this.block=G}function Be(w,N){this.name=w,this.next=N}var nr=new Be("this",new Be("arguments",null));function tt(){z.state.context=new Ee(z.state.context,z.state.localVars,!1),z.state.localVars=nr}function bt(){z.state.context=new Ee(z.state.context,z.state.localVars,!0),z.state.localVars=null}tt.lex=bt.lex=!0;function ft(){z.state.localVars=z.state.context.vars,z.state.context=z.state.context.prev}ft.lex=!0;function pe(w,N){var G=function(){var j=z.state,I=j.indented;if(j.lexical.type=="stat")I=j.lexical.indented;else for(var Q=j.lexical;Q&&Q.type==")"&&Q.align;Q=Q.prev)I=Q.indented;j.lexical=new we(I,z.stream.column(),w,null,j.lexical,N)};return G.lex=!0,G}function ue(){var w=z.state;w.lexical.prev&&(w.lexical.type==")"&&(w.indented=w.lexical.indented),w.lexical=w.lexical.prev)}ue.lex=!0;function ye(w){function N(G){return G==w?W():w==";"||G=="}"||G==")"||G=="]"?Y():W(N)}return N}function Oe(w,N){return w=="var"?W(pe("vardef",N),Un,ye(";"),ue):w=="keyword a"?W(pe("form"),Ni,Oe,ue):w=="keyword b"?W(pe("form"),Oe,ue):w=="keyword d"?z.stream.match(/^\s*$/,!1)?W():W(pe("stat"),Kr,ye(";"),ue):w=="debugger"?W(ye(";")):w=="{"?W(pe("}"),bt,jr,ue,ft):w==";"?W():w=="if"?(z.state.lexical.info=="else"&&z.state.cc[z.state.cc.length-1]==ue&&z.state.cc.pop()(),W(pe("form"),Ni,Oe,ue,_n)):w=="function"?W(cr):w=="for"?W(pe("form"),bt,ys,Oe,ft,ue):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form",w=="class"?w:N),Kn,ue)):w=="variable"?g&&N=="declare"?(z.marked="keyword",W(Oe)):g&&(N=="module"||N=="enum"||N=="type")&&z.stream.match(/^\s*\w/,!1)?(z.marked="keyword",N=="enum"?W(ie):N=="type"?W(xs,ye("operator"),Ce,ye(";")):W(pe("form"),Ft,ye("{"),pe("}"),jr,ue,ue)):g&&N=="namespace"?(z.marked="keyword",W(pe("form"),ve,Oe,ue)):g&&N=="abstract"?(z.marked="keyword",W(Oe)):W(pe("stat"),hf):w=="switch"?W(pe("form"),Ni,ye("{"),pe("}","switch"),bt,jr,ue,ue,ft):w=="case"?W(ve,ye(":")):w=="default"?W(ye(":")):w=="catch"?W(pe("form"),tt,_r,Oe,ue,ft):w=="export"?W(pe("stat"),Xn,ue):w=="import"?W(pe("stat"),Bi,ue):w=="async"?W(Oe):N=="@"?W(ve,Oe):Y(pe("stat"),ve,ye(";"),ue)}function _r(w){if(w=="(")return W(Mr,ye(")"))}function ve(w,N){return lr(w,N,!1)}function Ot(w,N){return lr(w,N,!0)}function Ni(w){return w!="("?Y():W(pe(")"),Kr,ye(")"),ue)}function lr(w,N,G){if(z.state.fatArrowAt==z.stream.start){var j=G?sn:Le;if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,ye("=>"),j,ft);if(w=="variable")return Y(tt,Ft,ye("=>"),j,ft)}var I=G?Xr:or;return ee.hasOwnProperty(w)?W(I):w=="function"?W(cr,I):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form"),pf,ue)):w=="keyword c"||w=="async"?W(G?Ot:ve):w=="("?W(pe(")"),Kr,ye(")"),ue,I):w=="operator"||w=="spread"?W(G?Ot:ve):w=="["?W(pe("]"),Ye,ue,I):w=="{"?Hi(ai,"}",null,I):w=="quasi"?Y(si,I):w=="new"?W(uf(G)):W()}function Kr(w){return w.match(/[;\}\)\],]/)?Y():Y(ve)}function or(w,N){return w==","?W(Kr):Xr(w,N,!1)}function Xr(w,N,G){var j=G==!1?or:Xr,I=G==!1?ve:Ot;if(w=="=>")return W(tt,G?sn:Le,ft);if(w=="operator")return/\+\+|--/.test(N)||g&&N=="!"?W(j):g&&N=="<"&&z.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?W(pe(">"),rt(Ce,">"),ue,j):N=="?"?W(ve,ye(":"),I):W(I);if(w=="quasi")return Y(si,j);if(w!=";"){if(w=="(")return Hi(Ot,")","call",j);if(w==".")return W(eo,j);if(w=="[")return W(pe("]"),Kr,ye("]"),ue,j);if(g&&N=="as")return z.marked="keyword",W(Ce,j);if(w=="regexp")return z.state.lastType=z.marked="operator",z.stream.backUp(z.stream.pos-z.stream.start-1),W(I)}}function si(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(si):W(Kr,Vl)}function Vl(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(si)}function Le(w){return X(z.stream,z.state),Y(w=="{"?Oe:ve)}function sn(w){return X(z.stream,z.state),Y(w=="{"?Oe:Ot)}function uf(w){return function(N){return N=="."?W(w?gs:ps):N=="variable"&&g?W(Zt,w?Xr:or):Y(w?Ot:ve)}}function ps(w,N){if(N=="target")return z.marked="keyword",W(or)}function gs(w,N){if(N=="target")return z.marked="keyword",W(Xr)}function hf(w){return w==":"?W(ue,Oe):Y(or,ye(";"),ue)}function eo(w){if(w=="variable")return z.marked="property",W()}function ai(w,N){if(w=="async")return z.marked="property",W(ai);if(w=="variable"||z.style=="keyword"){if(z.marked="property",N=="get"||N=="set")return W(vs);var G;return g&&z.state.fatArrowAt==z.stream.start&&(G=z.stream.match(/^\s*:\s*/,!1))&&(z.state.fatArrowAt=z.stream.pos+G[0].length),W(fi)}else{if(w=="number"||w=="string")return z.marked=u?"property":z.style+" property",W(fi);if(w=="jsonld-keyword")return W(fi);if(g&&ze(N))return z.marked="keyword",W(ai);if(w=="[")return W(ve,Wi,ye("]"),fi);if(w=="spread")return W(Ot,fi);if(N=="*")return z.marked="keyword",W(ai);if(w==":")return Y(fi)}}function vs(w){return w!="variable"?Y(fi):(z.marked="property",W(cr))}function fi(w){if(w==":")return W(Ot);if(w=="(")return Y(cr)}function rt(w,N,G){function j(I,Q){if(G?G.indexOf(I)>-1:I==","){var Te=z.state.lexical;return Te.info=="call"&&(Te.pos=(Te.pos||0)+1),W(function(ut,Et){return ut==N||Et==N?Y():Y(w)},j)}return I==N||Q==N?W():G&&G.indexOf(";")>-1?Y(w):W(ye(N))}return function(I,Q){return I==N||Q==N?W():Y(w,j)}}function Hi(w,N,G){for(var j=3;j"),Ce);if(w=="quasi")return Y(wt,dr)}function ms(w){if(w=="=>")return W(Ce)}function ae(w){return w.match(/[\}\)\]]/)?W():w==","||w==";"?W(ae):Y(ui,ae)}function ui(w,N){if(w=="variable"||z.style=="keyword")return z.marked="property",W(ui);if(N=="?"||w=="number"||w=="string")return W(ui);if(w==":")return W(Ce);if(w=="[")return W(ye("variable"),an,ye("]"),ui);if(w=="(")return Y(Ii,ui);if(!w.match(/[;\}\)\],]/))return W()}function wt(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(wt):W(Ce,je)}function je(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(wt)}function qe(w,N){return w=="variable"&&z.stream.match(/^\s*[?:]/,!1)||N=="?"?W(qe):w==":"?W(Ce):w=="spread"?W(qe):Y(Ce)}function dr(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr);if(N=="|"||w=="."||N=="&")return W(Ce);if(w=="[")return W(Ce,ye("]"),dr);if(N=="extends"||N=="implements")return z.marked="keyword",W(Ce);if(N=="?")return W(Ce,ye(":"),Ce)}function Zt(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr)}function Lr(){return Y(Ce,Ct)}function Ct(w,N){if(N=="=")return W(Ce)}function Un(w,N){return N=="enum"?(z.marked="keyword",W(ie)):Y(Ft,Wi,Tr,cf)}function Ft(w,N){if(g&&ze(N))return z.marked="keyword",W(Ft);if(w=="variable")return Qe(N),W();if(w=="spread")return W(Ft);if(w=="[")return Hi(to,"]");if(w=="{")return Hi(Fi,"}")}function Fi(w,N){return w=="variable"&&!z.stream.match(/^\s*:/,!1)?(Qe(N),W(Tr)):(w=="variable"&&(z.marked="property"),w=="spread"?W(Ft):w=="}"?Y():w=="["?W(ve,ye("]"),ye(":"),Fi):W(ye(":"),Ft,Tr))}function to(){return Y(Ft,Tr)}function Tr(w,N){if(N=="=")return W(Ot)}function cf(w){if(w==",")return W(Un)}function _n(w,N){if(w=="keyword b"&&N=="else")return W(pe("form","else"),Oe,ue)}function ys(w,N){if(N=="await")return W(ys);if(w=="(")return W(pe(")"),ro,ue)}function ro(w){return w=="var"?W(Un,Ei):w=="variable"?W(Ei):Y(Ei)}function Ei(w,N){return w==")"?W():w==";"?W(Ei):N=="in"||N=="of"?(z.marked="keyword",W(ve,Ei)):Y(ve,Ei)}function cr(w,N){if(N=="*")return z.marked="keyword",W(cr);if(w=="variable")return Qe(N),W(cr);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,Oe,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,cr)}function Ii(w,N){if(N=="*")return z.marked="keyword",W(Ii);if(w=="variable")return Qe(N),W(Ii);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,Ii)}function xs(w,N){if(w=="keyword"||w=="variable")return z.marked="type",W(xs);if(N=="<")return W(pe(">"),rt(Lr,">"),ue)}function Mr(w,N){return N=="@"&&W(ve,Mr),w=="spread"?W(Mr):g&&ze(N)?(z.marked="keyword",W(Mr)):g&&w=="this"?W(Wi,Tr):Y(Ft,Wi,Tr)}function pf(w,N){return w=="variable"?Kn(w,N):Ar(w,N)}function Kn(w,N){if(w=="variable")return Qe(N),W(Ar)}function Ar(w,N){if(N=="<")return W(pe(">"),rt(Lr,">"),ue,Ar);if(N=="extends"||N=="implements"||g&&w==",")return N=="implements"&&(z.marked="keyword"),W(g?Ce:ve,Ar);if(w=="{")return W(pe("}"),Or,ue)}function Or(w,N){if(w=="async"||w=="variable"&&(N=="static"||N=="get"||N=="set"||g&&ze(N))&&z.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return z.marked="keyword",W(Or);if(w=="variable"||z.style=="keyword")return z.marked="property",W(fn,Or);if(w=="number"||w=="string")return W(fn,Or);if(w=="[")return W(ve,Wi,ye("]"),fn,Or);if(N=="*")return z.marked="keyword",W(Or);if(g&&w=="(")return Y(Ii,Or);if(w==";"||w==",")return W(Or);if(w=="}")return W();if(N=="@")return W(ve,Or)}function fn(w,N){if(N=="!"||N=="?")return W(fn);if(w==":")return W(Ce,Tr);if(N=="=")return W(Ot);var G=z.state.lexical.prev,j=G&&G.info=="interface";return Y(j?Ii:cr)}function Xn(w,N){return N=="*"?(z.marked="keyword",W(Yn,ye(";"))):N=="default"?(z.marked="keyword",W(ve,ye(";"))):w=="{"?W(rt(jn,"}"),Yn,ye(";")):Y(Oe)}function jn(w,N){if(N=="as")return z.marked="keyword",W(ye("variable"));if(w=="variable")return Y(Ot,jn)}function Bi(w){return w=="string"?W():w=="("?Y(ve):w=="."?Y(or):Y(qn,qr,Yn)}function qn(w,N){return w=="{"?Hi(qn,"}"):(w=="variable"&&Qe(N),N=="*"&&(z.marked="keyword"),W(io))}function qr(w){if(w==",")return W(qn,qr)}function io(w,N){if(N=="as")return z.marked="keyword",W(qn)}function Yn(w,N){if(N=="from")return z.marked="keyword",W(ve)}function Ye(w){return w=="]"?W():Y(rt(Ot,"]"))}function ie(){return Y(pe("form"),Ft,ye("{"),pe("}"),rt(hi,"}"),ue,ue)}function hi(){return Y(Ft,Tr)}function no(w,N){return w.lastType=="operator"||w.lastType==","||S.test(N.charAt(0))||/[,.]/.test(N.charAt(0))}function sr(w,N,G){return N.tokenize==M&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(N.lastType)||N.lastType=="quasi"&&/\{\s*$/.test(w.string.slice(0,w.pos-(G||0)))}return{startState:function(w){var N={tokenize:M,lastType:"sof",cc:[],lexical:new we((w||0)-l,0,"block",!1),localVars:n.localVars,context:n.localVars&&new Ee(null,null,!1),indented:w||0};return n.globalVars&&typeof n.globalVars=="object"&&(N.globalVars=n.globalVars),N},token:function(w,N){if(w.sol()&&(N.lexical.hasOwnProperty("align")||(N.lexical.align=!1),N.indented=w.indentation(),X(w,N)),N.tokenize!=E&&w.eatSpace())return null;var G=N.tokenize(w,N);return T=="comment"?G:(N.lastType=T=="operator"&&(L=="++"||L=="--")?"incdec":T,ke(N,G,T,L,w))},indent:function(w,N){if(w.tokenize==E||w.tokenize==B)return t.Pass;if(w.tokenize!=M)return 0;var G=N&&N.charAt(0),j=w.lexical,I;if(!/^\s*else\b/.test(N))for(var Q=w.cc.length-1;Q>=0;--Q){var Te=w.cc[Q];if(Te==ue)j=j.prev;else if(Te!=_n&&Te!=ft)break}for(;(j.type=="stat"||j.type=="form")&&(G=="}"||(I=w.cc[w.cc.length-1])&&(I==or||I==Xr)&&!/^[,\.=+\-*:?[\(]/.test(N));)j=j.prev;a&&j.type==")"&&j.prev.type=="stat"&&(j=j.prev);var ut=j.type,Et=G==ut;return ut=="vardef"?j.indented+(w.lastType=="operator"||w.lastType==","?j.info.length+1:0):ut=="form"&&G=="{"?j.indented:ut=="form"?j.indented+l:ut=="stat"?j.indented+(no(w,N)?a||l:0):j.info=="switch"&&!Et&&n.doubleIndentSwitch!=!1?j.indented+(/^(?:case|default)\b/.test(N)?l:2*l):j.align?j.column+(Et?0:1):j.indented+(Et?0:l)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:d?null:"/*",blockCommentEnd:d?null:"*/",blockCommentContinue:d?null:" * ",lineComment:d?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:d?"json":"javascript",jsonldMode:u,jsonMode:d,expressionAllowed:sr,skipExpression:function(w){ke(w,"atom","atom","true",new t.StringStream("",2,null))}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var vg=Ut((pg,gg)=>{(function(t){typeof pg=="object"&&typeof gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},n=t.Pos;t.defineOption("autoCloseBrackets",!1,function(L,C,M){M&&M!=t.Init&&(L.removeKeyMap(a),L.state.closeBrackets=null),C&&(u(l(C,"pairs")),L.state.closeBrackets=C,L.addKeyMap(a))});function l(L,C){return C=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[C]!=null?L[C]:r[C]}var a={Backspace:g,Enter:m};function u(L){for(var C=0;C=0;E--){var K=D[E].head;L.replaceRange("",n(K.line,K.ch-1),n(K.line,K.ch+1),"+delete")}}function m(L){var C=c(L),M=C&&l(C,"explode");if(!M||L.getOption("disableInput"))return t.Pass;for(var D=L.listSelections(),E=0;E0?{line:K.head.line,ch:K.head.ch+C}:{line:K.head.line-1};M.push({anchor:X,head:X})}L.setSelections(M,E)}function S(L){var C=t.cmpPos(L.anchor,L.head)>0;return{anchor:new n(L.anchor.line,L.anchor.ch+(C?-1:1)),head:new n(L.head.line,L.head.ch+(C?1:-1))}}function k(L,C){var M=c(L);if(!M||L.getOption("disableInput"))return t.Pass;var D=l(M,"pairs"),E=D.indexOf(C);if(E==-1)return t.Pass;for(var B=l(M,"closeBefore"),K=l(M,"triples"),X=D.charAt(E+1)==C,ee=L.listSelections(),we=E%2==0,he,ke=0;ke=0&&L.getRange(Y,n(Y.line,Y.ch+3))==C+C+C?W="skipThree":W="skip";else if(X&&Y.ch>1&&K.indexOf(C)>=0&&L.getRange(n(Y.line,Y.ch-2),Y)==C+C){if(Y.ch>2&&/\bstring/.test(L.getTokenTypeAt(n(Y.line,Y.ch-2))))return t.Pass;W="addFour"}else if(X){var Qe=Y.ch==0?" ":L.getRange(n(Y.line,Y.ch-1),Y);if(!t.isWordChar(De)&&Qe!=C&&!t.isWordChar(Qe))W="both";else return t.Pass}else if(we&&(De.length===0||/\s/.test(De)||B.indexOf(De)>-1))W="both";else return t.Pass;if(!he)he=W;else if(he!=W)return t.Pass}var _e=E%2?D.charAt(E-1):C,ze=E%2?C:D.charAt(E+1);L.operation(function(){if(he=="skip")x(L,1);else if(he=="skipThree")x(L,3);else if(he=="surround"){for(var Ee=L.getSelections(),Be=0;Be{(function(t){typeof mg=="object"&&typeof yg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=t.Pos;function n(C,M){return C.line-M.line||C.ch-M.ch}var l="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",a=l+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",u=new RegExp("<(/?)(["+l+"]["+a+"]*)","g");function d(C,M,D,E){this.line=M,this.ch=D,this.cm=C,this.text=C.getLine(M),this.min=E?Math.max(E.from,C.firstLine()):C.firstLine(),this.max=E?Math.min(E.to-1,C.lastLine()):C.lastLine()}function c(C,M){var D=C.cm.getTokenTypeAt(r(C.line,M));return D&&/\btag\b/.test(D)}function g(C){if(!(C.line>=C.max))return C.ch=0,C.text=C.cm.getLine(++C.line),!0}function m(C){if(!(C.line<=C.min))return C.text=C.cm.getLine(--C.line),C.ch=C.text.length,!0}function x(C){for(;;){var M=C.text.indexOf(">",C.ch);if(M==-1){if(g(C))continue;return}if(!c(C,M+1)){C.ch=M+1;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function S(C){for(;;){var M=C.ch?C.text.lastIndexOf("<",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}u.lastIndex=M,C.ch=M;var D=u.exec(C.text);if(D&&D.index==M)return D}}function k(C){for(;;){u.lastIndex=C.ch;var M=u.exec(C.text);if(!M){if(g(C))continue;return}if(!c(C,M.index+1)){C.ch=M.index+1;continue}return C.ch=M.index+M[0].length,M}}function A(C){for(;;){var M=C.ch?C.text.lastIndexOf(">",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function T(C,M){for(var D=[];;){var E=k(C),B,K=C.line,X=C.ch-(E?E[0].length:0);if(!E||!(B=x(C)))return;if(B!="selfClose")if(E[1]){for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==E[2]){D.length=ee;break}if(ee<0&&(!M||M==E[2]))return{tag:E[2],from:r(K,X),to:r(C.line,C.ch)}}else D.push(E[2])}}function L(C,M){for(var D=[];;){var E=A(C);if(!E)return;if(E=="selfClose"){S(C);continue}var B=C.line,K=C.ch,X=S(C);if(!X)return;if(X[1])D.push(X[2]);else{for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==X[2]){D.length=ee;break}if(ee<0&&(!M||M==X[2]))return{tag:X[2],from:r(C.line,C.ch),to:r(B,K)}}}}t.registerHelper("fold","xml",function(C,M){for(var D=new d(C,M.line,0);;){var E=k(D);if(!E||D.line!=M.line)return;var B=x(D);if(!B)return;if(!E[1]&&B!="selfClose"){var K=r(D.line,D.ch),X=T(D,E[2]);return X&&n(X.from,K)>0?{from:K,to:X.from}:null}}}),t.findMatchingTag=function(C,M,D){var E=new d(C,M.line,M.ch,D);if(!(E.text.indexOf(">")==-1&&E.text.indexOf("<")==-1)){var B=x(E),K=B&&r(E.line,E.ch),X=B&&S(E);if(!(!B||!X||n(E,M)>0)){var ee={from:r(E.line,E.ch),to:K,tag:X[2]};return B=="selfClose"?{open:ee,close:null,at:"open"}:X[1]?{open:L(E,X[2]),close:ee,at:"close"}:(E=new d(C,K.line,K.ch,D),{open:ee,close:T(E,X[2]),at:"open"})}}},t.findEnclosingTag=function(C,M,D,E){for(var B=new d(C,M.line,M.ch,D);;){var K=L(B,E);if(!K)break;var X=new d(C,M.line,M.ch,D),ee=T(X,K.tag);if(ee)return{open:K,close:ee}}},t.scanForClosingTag=function(C,M,D,E){var B=new d(C,M.line,M.ch,E?{from:0,to:E}:null);return T(B,D)}})});var wg=Ut((xg,bg)=>{(function(t){typeof xg=="object"&&typeof bg=="object"?t(Ht(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],t):t(CodeMirror)})(function(t){t.defineOption("autoCloseTags",!1,function(g,m,x){if(x!=t.Init&&x&&g.removeKeyMap("autoCloseTags"),!!m){var S={name:"autoCloseTags"};(typeof m!="object"||m.whenClosing!==!1)&&(S["'/'"]=function(k){return u(k)}),(typeof m!="object"||m.whenOpening!==!1)&&(S["'>'"]=function(k){return l(k)}),g.addKeyMap(S)}});var r=["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 l(g){if(g.getOption("disableInput"))return t.Pass;for(var m=g.listSelections(),x=[],S=g.getOption("autoCloseTags"),k=0;kA.ch&&(D=D.slice(0,D.length-T.end+A.ch));var X=D.toLowerCase();if(!D||T.type=="string"&&(T.end!=A.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&M.close||T.string.indexOf("/")==A.ch-T.start-1||B&&d(B,X)>-1||c(g,L.mode.xmlCurrentContext&&L.mode.xmlCurrentContext(C)||[],D,A,!0))return t.Pass;var ee=typeof S=="object"&&S.emptyTags;if(ee&&d(ee,D)>-1){x[k]={text:"/>",newPos:t.Pos(A.line,A.ch+2)};continue}var we=K&&d(K,X)>-1;x[k]={indent:we,text:">"+(we?` `:"")+"",newPos:we?t.Pos(A.line+1,0):t.Pos(A.line,A.ch+1)}}for(var he=typeof S=="object"&&S.dontIndentOnAutoClose,k=m.length-1;k>=0;k--){var ke=x[k];g.replaceRange(ke.text,m[k].head,m[k].anchor,"+insert");var z=g.listSelections().slice(0);z[k]={head:ke.newPos,anchor:ke.newPos},g.setSelections(z),!he&&ke.indent&&(g.indentLine(ke.newPos.line,null,!0),g.indentLine(ke.newPos.line+1,null,!0))}}function a(g,m){for(var x=g.listSelections(),S=[],k=m?"/":""&&(B+=">"),S[L]=B}if(g.replaceSelections(S),x=g.listSelections(),!T)for(var L=0;L=0&&m[C]==x;C--)++L;S=T.to;for(var C=1;C{(function(t){typeof Cg=="object"&&typeof Sg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,l=/[*+-]\s/;t.commands.newlineAndIndentContinueMarkdownList=function(u){if(u.getOption("disableInput"))return t.Pass;for(var d=u.listSelections(),c=[],g=0;g\s*$/.test(T),D=!/>\s*$/.test(T);(M||D)&&u.replaceRange("",{line:m.line,ch:0},{line:m.line,ch:m.ch+1}),c[g]=` @@ -49,4 +49,4 @@ b`.split(/\n/).length!=3?t=>{let r=0,n=[],l=t.length;for(;r<=l;){let a=t.indexOf `)>-1?n.value=this.prevInput="":this.prevInput=a,this.composing&&(this.composing.range.clear(),this.composing.range=r.markText(this.composing.start,r.getCursor("to"),{className:"CodeMirror-composing"}))}),!0}ensurePolled(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)}onKeyPress(){de&&Se>=9&&(this.hasSelection=null),this.fastPoll()}onContextMenu(r){let n=this,l=n.cm,a=l.display,u=n.textarea;n.contextMenuPending&&n.contextMenuPending();let d=Gr(l,r),c=a.scroller.scrollTop;if(!d||Wt)return;l.options.resetSelectionOnContextMenu&&l.doc.sel.contains(d)==-1&&Ie(l,et)(l.doc,hr(d),Lt);let m=u.style.cssText,x=n.wrapper.style.cssText,S=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",u.style.cssText=`position: absolute; width: 30px; height: 30px; top: ${r.clientY-S.top-5}px; left: ${r.clientX-S.left-5}px; z-index: 1000; background: ${de?"rgba(255, 255, 255, .05)":"transparent"}; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;let k;Ue&&(k=u.ownerDocument.defaultView.scrollY),a.input.focus(),Ue&&u.ownerDocument.defaultView.scrollTo(null,k),a.input.reset(),l.somethingSelected()||(u.value=n.prevInput=" "),n.contextMenuPending=T,a.selForContextMenu=l.doc.sel,clearTimeout(a.detectingSelectAll);function A(){if(u.selectionStart!=null){let L=l.somethingSelected(),C="\u200B"+(L?u.value:"");u.value="\u21DA",u.value=C,n.prevInput=L?"":"\u200B",u.selectionStart=1,u.selectionEnd=C.length,a.selForContextMenu=l.doc.sel}}function T(){if(n.contextMenuPending==T&&(n.contextMenuPending=!1,n.wrapper.style.cssText=x,u.style.cssText=m,de&&Se<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=c),u.selectionStart!=null)){(!de||de&&Se<9)&&A();let L=0,C=()=>{a.selForContextMenu==l.doc.sel&&u.selectionStart==0&&u.selectionEnd>0&&n.prevInput=="\u200B"?Ie(l,ja)(l):L++<10?a.detectingSelectAll=setTimeout(C,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(C,200)}}if(de&&Se>=9&&A(),Wo){wi(r);let L=()=>{yt(window,"mouseup",L),setTimeout(T,20)};ne(window,"mouseup",L)}else setTimeout(T,50)}readOnlyChanged(r){r||this.reset(),this.textarea.disabled=r=="nocursor",this.textarea.readOnly=!!r}setUneditable(){}};$l.prototype.needsContentAttribute=!1;function fg(t,r){if(r=r?Er(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),r.autofocus==null){let u=st(Fr(t));r.autofocus=u==t||t.getAttribute("autofocus")!=null&&u==document.body}function n(){t.value=a.getValue()}let l;if(t.form&&(ne(t.form,"submit",n),!r.leaveSubmitMethodAlone)){let u=t.form;l=u.submit;try{let d=u.submit=()=>{n(),u.submit=l,u.submit(),u.submit=d}}catch{}}r.finishInit=u=>{u.save=n,u.getTextArea=()=>t,u.toTextArea=()=>{u.toTextArea=isNaN,n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(yt(t.form,"submit",n),!r.leaveSubmitMethodAlone&&typeof t.form.submit=="function"&&(t.form.submit=l))}},t.style.display="none";let a=Fe(u=>t.parentNode.insertBefore(u,t.nextSibling),r);return a}function ug(t){t.off=yt,t.on=ne,t.wheelEventPixels=bp,t.Doc=ni,t.splitLines=bl,t.countColumn=mt,t.findColumn=Fo,t.isWordChar=ea,t.Pass=Ji,t.signal=Ae,t.Line=ei,t.changeEnd=wr,t.scrollbarModel=qu,t.Pos=U,t.cmpPos=se,t.modes=fa,t.mimeModes=Tn,t.resolveMode=Io,t.getMode=Bo,t.modeExtensions=Mn,t.extendMode=Hc,t.copyState=Vr,t.startState=ua,t.innerMode=Ro,t.commands=Di,t.keyMap=oi,t.keyName=Ya,t.isModifierKey=qa,t.lookupKey=ln,t.normalizeKeyMap=Qp,t.StringStream=wl,t.SharedTextMarker=jl,t.TextMarker=Xl,t.LineWidget=Kl,t.e_preventDefault=Ve,t.e_stopPropagation=du,t.e_stop=wi,t.addClass=er,t.contains=vr,t.rmClass=Vt,t.keyNames=li}lg(Fe);sg(Fe);var by="iter insert remove copy getEditor constructor".split(" ");for(let t in ni.prototype)ni.prototype.hasOwnProperty(t)&&He(by,t)<0&&(Fe.prototype[t]=function(r){return function(){return r.apply(this.doc,arguments)}}(ni.prototype[t]));Ir(ni);Fe.inputStyles={textarea:$l,contenteditable:Ql};Fe.defineMode=function(t){!Fe.defaults.mode&&t!="null"&&(Fe.defaults.mode=t),Dc.apply(this,arguments)};Fe.defineMIME=Nc;Fe.defineMode("null",()=>({token:t=>t.skipToEnd()}));Fe.defineMIME("text/plain","null");Fe.defineExtension=(t,r)=>{Fe.prototype[t]=r};Fe.defineDocExtension=(t,r)=>{ni.prototype[t]=r};Fe.fromTextArea=fg;ug(Fe);Fe.version="5.65.16";var KT=_t(cg(),1),XT=_t(vg(),1),jT=_t(wg(),1),qT=_t(kg(),1),YT=_t(Mg(),1),ZT=_t(Dg(),1),JT=_t(Wg(),1),QT=_t(Eg(),1),$T=_t(Rg(),1),VT=_t(dh(),1),eM=_t(Kg(),1),tM=_t(qg(),1),rM=_t(Jg(),1),iM=_t(ff(),1);window.CodeMirror=Qg.default;})(); + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;let k;Ue&&(k=u.ownerDocument.defaultView.scrollY),a.input.focus(),Ue&&u.ownerDocument.defaultView.scrollTo(null,k),a.input.reset(),l.somethingSelected()||(u.value=n.prevInput=" "),n.contextMenuPending=T,a.selForContextMenu=l.doc.sel,clearTimeout(a.detectingSelectAll);function A(){if(u.selectionStart!=null){let L=l.somethingSelected(),C="\u200B"+(L?u.value:"");u.value="\u21DA",u.value=C,n.prevInput=L?"":"\u200B",u.selectionStart=1,u.selectionEnd=C.length,a.selForContextMenu=l.doc.sel}}function T(){if(n.contextMenuPending==T&&(n.contextMenuPending=!1,n.wrapper.style.cssText=x,u.style.cssText=m,de&&Se<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=c),u.selectionStart!=null)){(!de||de&&Se<9)&&A();let L=0,C=()=>{a.selForContextMenu==l.doc.sel&&u.selectionStart==0&&u.selectionEnd>0&&n.prevInput=="\u200B"?Ie(l,ja)(l):L++<10?a.detectingSelectAll=setTimeout(C,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(C,200)}}if(de&&Se>=9&&A(),Wo){wi(r);let L=()=>{yt(window,"mouseup",L),setTimeout(T,20)};ne(window,"mouseup",L)}else setTimeout(T,50)}readOnlyChanged(r){r||this.reset(),this.textarea.disabled=r=="nocursor",this.textarea.readOnly=!!r}setUneditable(){}};$l.prototype.needsContentAttribute=!1;function fg(t,r){if(r=r?Er(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),r.autofocus==null){let u=st(Fr(t));r.autofocus=u==t||t.getAttribute("autofocus")!=null&&u==document.body}function n(){t.value=a.getValue()}let l;if(t.form&&(ne(t.form,"submit",n),!r.leaveSubmitMethodAlone)){let u=t.form;l=u.submit;try{let d=u.submit=()=>{n(),u.submit=l,u.submit(),u.submit=d}}catch{}}r.finishInit=u=>{u.save=n,u.getTextArea=()=>t,u.toTextArea=()=>{u.toTextArea=isNaN,n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(yt(t.form,"submit",n),!r.leaveSubmitMethodAlone&&typeof t.form.submit=="function"&&(t.form.submit=l))}},t.style.display="none";let a=Fe(u=>t.parentNode.insertBefore(u,t.nextSibling),r);return a}function ug(t){t.off=yt,t.on=ne,t.wheelEventPixels=bp,t.Doc=ni,t.splitLines=bl,t.countColumn=mt,t.findColumn=Fo,t.isWordChar=ea,t.Pass=Ji,t.signal=Ae,t.Line=ei,t.changeEnd=wr,t.scrollbarModel=qu,t.Pos=U,t.cmpPos=se,t.modes=fa,t.mimeModes=Tn,t.resolveMode=Io,t.getMode=Bo,t.modeExtensions=Mn,t.extendMode=Hc,t.copyState=Vr,t.startState=ua,t.innerMode=Ro,t.commands=Di,t.keyMap=oi,t.keyName=Ya,t.isModifierKey=qa,t.lookupKey=ln,t.normalizeKeyMap=Qp,t.StringStream=wl,t.SharedTextMarker=jl,t.TextMarker=Xl,t.LineWidget=Kl,t.e_preventDefault=Ve,t.e_stopPropagation=du,t.e_stop=wi,t.addClass=er,t.contains=vr,t.rmClass=Vt,t.keyNames=li}lg(Fe);sg(Fe);var by="iter insert remove copy getEditor constructor".split(" ");for(let t in ni.prototype)ni.prototype.hasOwnProperty(t)&&He(by,t)<0&&(Fe.prototype[t]=function(r){return function(){return r.apply(this.doc,arguments)}}(ni.prototype[t]));Ir(ni);Fe.inputStyles={textarea:$l,contenteditable:Ql};Fe.defineMode=function(t){!Fe.defaults.mode&&t!="null"&&(Fe.defaults.mode=t),Dc.apply(this,arguments)};Fe.defineMIME=Nc;Fe.defineMode("null",()=>({token:t=>t.skipToEnd()}));Fe.defineMIME("text/plain","null");Fe.defineExtension=(t,r)=>{Fe.prototype[t]=r};Fe.defineDocExtension=(t,r)=>{ni.prototype[t]=r};Fe.fromTextArea=fg;ug(Fe);Fe.version="5.65.19";var KT=_t(cg(),1),XT=_t(vg(),1),jT=_t(wg(),1),qT=_t(kg(),1),YT=_t(Mg(),1),ZT=_t(Dg(),1),JT=_t(Wg(),1),QT=_t(Eg(),1),$T=_t(Rg(),1),VT=_t(dh(),1),eM=_t(Kg(),1),tM=_t(qg(),1),rM=_t(Jg(),1),iM=_t(ff(),1);window.CodeMirror=Qg.default;})(); diff --git a/package-lock.json b/package-lock.json index eefe4c2..8fe6602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.0.tgz", - "integrity": "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.6.tgz", + "integrity": "sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw==", "cpu": [ "ppc64" ], @@ -30,9 +30,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.0.tgz", - "integrity": "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.6.tgz", + "integrity": "sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg==", "cpu": [ "arm" ], @@ -46,9 +46,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.0.tgz", - "integrity": "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.6.tgz", + "integrity": "sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA==", "cpu": [ "arm64" ], @@ -62,9 +62,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.0.tgz", - "integrity": "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.6.tgz", + "integrity": "sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A==", "cpu": [ "x64" ], @@ -78,9 +78,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz", - "integrity": "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.6.tgz", + "integrity": "sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA==", "cpu": [ "arm64" ], @@ -94,9 +94,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.0.tgz", - "integrity": "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.6.tgz", + "integrity": "sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg==", "cpu": [ "x64" ], @@ -110,9 +110,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.0.tgz", - "integrity": "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.6.tgz", + "integrity": "sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg==", "cpu": [ "arm64" ], @@ -126,9 +126,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.0.tgz", - "integrity": "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.6.tgz", + "integrity": "sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ==", "cpu": [ "x64" ], @@ -142,9 +142,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.0.tgz", - "integrity": "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.6.tgz", + "integrity": "sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw==", "cpu": [ "arm" ], @@ -158,9 +158,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", - "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.6.tgz", + "integrity": "sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ==", "cpu": [ "arm64" ], @@ -174,9 +174,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.0.tgz", - "integrity": "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.6.tgz", + "integrity": "sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw==", "cpu": [ "ia32" ], @@ -190,9 +190,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.0.tgz", - "integrity": "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.6.tgz", + "integrity": "sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg==", "cpu": [ "loong64" ], @@ -206,9 +206,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.0.tgz", - "integrity": "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.6.tgz", + "integrity": "sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw==", "cpu": [ "mips64el" ], @@ -222,9 +222,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.0.tgz", - "integrity": "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.6.tgz", + "integrity": "sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw==", "cpu": [ "ppc64" ], @@ -238,9 +238,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.0.tgz", - "integrity": "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.6.tgz", + "integrity": "sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w==", "cpu": [ "riscv64" ], @@ -254,9 +254,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.0.tgz", - "integrity": "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.6.tgz", + "integrity": "sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw==", "cpu": [ "s390x" ], @@ -270,9 +270,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.0.tgz", - "integrity": "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.6.tgz", + "integrity": "sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig==", "cpu": [ "x64" ], @@ -286,9 +286,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.0.tgz", - "integrity": "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.6.tgz", + "integrity": "sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q==", "cpu": [ "arm64" ], @@ -302,9 +302,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.0.tgz", - "integrity": "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.6.tgz", + "integrity": "sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g==", "cpu": [ "x64" ], @@ -318,9 +318,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.0.tgz", - "integrity": "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.6.tgz", + "integrity": "sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg==", "cpu": [ "arm64" ], @@ -334,9 +334,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.0.tgz", - "integrity": "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.6.tgz", + "integrity": "sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw==", "cpu": [ "x64" ], @@ -349,10 +349,26 @@ "node": ">=18" } }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.6.tgz", + "integrity": "sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.0.tgz", - "integrity": "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.6.tgz", + "integrity": "sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA==", "cpu": [ "x64" ], @@ -366,9 +382,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.0.tgz", - "integrity": "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.6.tgz", + "integrity": "sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q==", "cpu": [ "arm64" ], @@ -382,9 +398,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.0.tgz", - "integrity": "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.6.tgz", + "integrity": "sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ==", "cpu": [ "ia32" ], @@ -398,9 +414,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.0.tgz", - "integrity": "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.6.tgz", + "integrity": "sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA==", "cpu": [ "x64" ], @@ -414,14 +430,15 @@ } }, "node_modules/codemirror": { - "version": "5.65.16", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.65.16.tgz", - "integrity": "sha512-br21LjYmSlVL0vFCPWPfhzUCT34FM/pAdK7rRIZwa0rrtrIdotvP4Oh4GUHsu2E3IrQMCfRkL/fN3ytMNxVQvg==" + "version": "5.65.19", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.65.19.tgz", + "integrity": "sha512-+aFkvqhaAVr1gferNMuN8vkTSrWIFvzlMV9I2KBLCWS2WpZ2+UAkZjlMZmEuT+gcXTi6RrGQCkWq1/bDtGqhIA==", + "license": "MIT" }, "node_modules/esbuild": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", - "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.6.tgz", + "integrity": "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -431,31 +448,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.0", - "@esbuild/android-arm": "0.25.0", - "@esbuild/android-arm64": "0.25.0", - "@esbuild/android-x64": "0.25.0", - "@esbuild/darwin-arm64": "0.25.0", - "@esbuild/darwin-x64": "0.25.0", - "@esbuild/freebsd-arm64": "0.25.0", - "@esbuild/freebsd-x64": "0.25.0", - "@esbuild/linux-arm": "0.25.0", - "@esbuild/linux-arm64": "0.25.0", - "@esbuild/linux-ia32": "0.25.0", - "@esbuild/linux-loong64": "0.25.0", - "@esbuild/linux-mips64el": "0.25.0", - "@esbuild/linux-ppc64": "0.25.0", - "@esbuild/linux-riscv64": "0.25.0", - "@esbuild/linux-s390x": "0.25.0", - "@esbuild/linux-x64": "0.25.0", - "@esbuild/netbsd-arm64": "0.25.0", - "@esbuild/netbsd-x64": "0.25.0", - "@esbuild/openbsd-arm64": "0.25.0", - "@esbuild/openbsd-x64": "0.25.0", - "@esbuild/sunos-x64": "0.25.0", - "@esbuild/win32-arm64": "0.25.0", - "@esbuild/win32-ia32": "0.25.0", - "@esbuild/win32-x64": "0.25.0" + "@esbuild/aix-ppc64": "0.25.6", + "@esbuild/android-arm": "0.25.6", + "@esbuild/android-arm64": "0.25.6", + "@esbuild/android-x64": "0.25.6", + "@esbuild/darwin-arm64": "0.25.6", + "@esbuild/darwin-x64": "0.25.6", + "@esbuild/freebsd-arm64": "0.25.6", + "@esbuild/freebsd-x64": "0.25.6", + "@esbuild/linux-arm": "0.25.6", + "@esbuild/linux-arm64": "0.25.6", + "@esbuild/linux-ia32": "0.25.6", + "@esbuild/linux-loong64": "0.25.6", + "@esbuild/linux-mips64el": "0.25.6", + "@esbuild/linux-ppc64": "0.25.6", + "@esbuild/linux-riscv64": "0.25.6", + "@esbuild/linux-s390x": "0.25.6", + "@esbuild/linux-x64": "0.25.6", + "@esbuild/netbsd-arm64": "0.25.6", + "@esbuild/netbsd-x64": "0.25.6", + "@esbuild/openbsd-arm64": "0.25.6", + "@esbuild/openbsd-x64": "0.25.6", + "@esbuild/openharmony-arm64": "0.25.6", + "@esbuild/sunos-x64": "0.25.6", + "@esbuild/win32-arm64": "0.25.6", + "@esbuild/win32-ia32": "0.25.6", + "@esbuild/win32-x64": "0.25.6" } } } diff --git a/resources/js/laravel-filament-json-field.js b/resources/js/laravel-filament-json-field.js index 8863a00..d245da7 100644 --- a/resources/js/laravel-filament-json-field.js +++ b/resources/js/laravel-filament-json-field.js @@ -25,4 +25,4 @@ import "codemirror/addon/fold/foldgutter.css"; // Dark Mode import "codemirror/theme/darcula.css"; -window.CodeMirror = CodeMirror; +window.CodeMirror = CodeMirror; \ No newline at end of file diff --git a/resources/views/forms/components/json-input.blade.php b/resources/views/forms/components/json-input.blade.php index 0ca60af..4e9b90e 100644 --- a/resources/views/forms/components/json-input.blade.php +++ b/resources/views/forms/components/json-input.blade.php @@ -1,7 +1,6 @@
-
+ \ No newline at end of file diff --git a/resources/views/infolists/components/json-entry.blade.php b/resources/views/infolists/components/json-entry.blade.php index 8bede30..56f2054 100644 --- a/resources/views/infolists/components/json-entry.blade.php +++ b/resources/views/infolists/components/json-entry.blade.php @@ -1,74 +1,71 @@ - +
-
{ - var count = undefined; - - // Get open / close token - var startToken = '{', endToken = '}'; - var prevLine = {{ str_replace('.', '', $getId()) }}.getLine(from.line); - if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) { - startToken = '[', endToken = ']'; - } - - // Get json content - var internal = {{ str_replace('.', '', $getId()) }}.getRange(from, to); - var toParse = startToken + internal + endToken; - - // Get key count - try { - var parsed = JSON.parse(toParse); - count = Object.keys(parsed).length; - } catch(e) { } - - return count ? `\u21A4${count}\u21A6` : '\u2194'; - } - } + x-data="{ + editor: null, + init() { + this.$nextTick(() => { + this.initializeEditor(); }); - - {{ str_replace('.', '', $getId()) }}.setSize(null, '100%'); - {{ str_replace('.', '', $getId()) }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); - - @php - if($getHasFoldedCode()) { - echo str_replace('.', '', $getId()) . ".foldCode(CodeMirror.Pos(0, 0));"; - } - @endphp - - setTimeout(function() { - {{ str_replace('.', '', $getId()) }}.refresh(); - }, 1); - " - > -
-
+ }, + initializeEditor() { + if (typeof window.CodeMirror === 'undefined') { + setTimeout(() => this.initializeEditor(), 100); + return; + } + + try { + this.editor = window.CodeMirror(this.$refs.cm, { + value: {{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}', + mode: 'application/json', + readOnly: true, + lineNumbers: {{ json_encode($getHasLineNumbers()) }}, + lineWrapping: {{ json_encode($getHasLineWrapping()) }}, + autoCloseBrackets: {{ json_encode($getHasAutoCloseBrackets()) }}, + viewportMargin: Infinity, + theme: '{{ $getHasDarkTheme() ? 'darcula' : 'default' }}', + foldGutter: {{ json_encode($getHasFoldingCode()) }}, + @php + if($getHasFoldingCode()) { + echo "gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],"; + echo "foldOptions: {"; + echo " widget: (from, to) => {"; + echo " let count;"; + echo " let startToken = '{', endToken = '}';"; + echo " let prevLine = this.editor.getLine(from.line);"; + echo " if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) {"; + echo " startToken = '[', endToken = ']';"; + echo " }"; + echo " let internal = this.editor.getRange(from, to);"; + echo " let toParse = startToken + internal + endToken;"; + echo " try {"; + echo " let parsed = JSON.parse(toParse);"; + echo " count = Object.keys(parsed).length;"; + echo " } catch (e) {}"; + echo " return count ? `\\u21A4${count}\\u21A6` : '\\u2194';"; + echo " }"; + echo "},"; + echo "extraKeys: {"; + echo " 'Ctrl-Q': function(cm) { cm.foldCode(cm.getCursor()); }"; + echo "},"; + } + @endphp + }); + + this.editor.setSize('100%', '100%'); + + } catch (error) { + console.error('CodeMirror initialization failed:', error); + } + } + }" + wire:ignore + > +
diff --git a/src/FilamentJsonFieldServiceProvider.php b/src/FilamentJsonFieldServiceProvider.php index 23fbeeb..147a842 100644 --- a/src/FilamentJsonFieldServiceProvider.php +++ b/src/FilamentJsonFieldServiceProvider.php @@ -17,10 +17,9 @@ public function configurePackage(Package $package): void ->hasViews(); } - public function packageBooted() + public function packageBooted(): void { FilamentAsset::register([ - Css::make('laravel-filament-json-field', __DIR__.'/../dist/laravel-filament-json-field.css'), Js::make('laravel-filament-json-field', __DIR__.'/../dist/laravel-filament-json-field.js'), ], 'laravel-filament-json-field'); } diff --git a/src/Forms/Components/JsonInput.php b/src/Forms/Components/JsonInput.php index ff59f2e..cf941fa 100644 --- a/src/Forms/Components/JsonInput.php +++ b/src/Forms/Components/JsonInput.php @@ -7,12 +7,12 @@ use CodebarAg\FilamentJsonField\Concerns\HasFoldingCode; use CodebarAg\FilamentJsonField\Concerns\HasLineNumbers; use CodebarAg\FilamentJsonField\Concerns\HasLineWrapping; -use Filament\Forms\Components\Concerns; +use Filament\Forms\Components\Concerns\CanBeReadOnly; use Filament\Forms\Components\Field; class JsonInput extends Field { - use Concerns\CanBeReadOnly; + use CanBeReadOnly; use HasAutoCloseBrackets; use HasDarkTheme; use HasFoldingCode; @@ -21,6 +21,11 @@ class JsonInput extends Field protected string $view = 'filament-json-field::forms.components.json-input'; + public static function getAssetPackageName(): ?string + { + return 'laravel-filament-json-field'; + } + public function setUp(): void { parent::setUp(); @@ -31,4 +36,9 @@ public function setUp(): void 'array' => __('The :attribute must be valid JSON.'), ]); } + + public function getStatePath(bool $isAbsolute = true): ?string + { + return parent::getStatePath($isAbsolute); + } } diff --git a/src/Infolists/Components/JsonEntry.php b/src/Infolists/Components/JsonEntry.php index 85cfff8..5975f0f 100644 --- a/src/Infolists/Components/JsonEntry.php +++ b/src/Infolists/Components/JsonEntry.php @@ -18,4 +18,9 @@ class JsonEntry extends Entry use HasLineWrapping; protected string $view = 'filament-json-field::infolists.components.json-entry'; + + public static function getAssetPackageName(): ?string + { + return 'laravel-filament-json-field'; + } } From 6d6793f20101ed8e8f8a0c9857fb3ce6e40bc174 Mon Sep 17 00:00:00 2001 From: RhysLees <43909932+RhysLees@users.noreply.github.com> Date: Sun, 13 Jul 2025 02:06:28 +0000 Subject: [PATCH 02/13] Fix styling --- src/FilamentJsonFieldServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FilamentJsonFieldServiceProvider.php b/src/FilamentJsonFieldServiceProvider.php index 147a842..c615e31 100644 --- a/src/FilamentJsonFieldServiceProvider.php +++ b/src/FilamentJsonFieldServiceProvider.php @@ -2,7 +2,6 @@ namespace CodebarAg\FilamentJsonField; -use Filament\Support\Assets\Css; use Filament\Support\Assets\Js; use Filament\Support\Facades\FilamentAsset; use Spatie\LaravelPackageTools\Package; From f77e485955ccd6af533bd5e39aaf439ec1e66e18 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sun, 13 Jul 2025 03:11:25 +0100 Subject: [PATCH 03/13] wip --- .../views/livewire/test-component.blade.php | 4 + .../test-infolist-component.blade.php | 4 + tests/JsonEntryFieldTest.php | 302 ++++++++++++++--- tests/JsonInputFieldTest.php | 304 +++++++++++++++--- 4 files changed, 520 insertions(+), 94 deletions(-) create mode 100644 resources/views/livewire/test-component.blade.php create mode 100644 resources/views/livewire/test-infolist-component.blade.php diff --git a/resources/views/livewire/test-component.blade.php b/resources/views/livewire/test-component.blade.php new file mode 100644 index 0000000..b0fbf2e --- /dev/null +++ b/resources/views/livewire/test-component.blade.php @@ -0,0 +1,4 @@ + +
+ {{ $this->form }} +
diff --git a/resources/views/livewire/test-infolist-component.blade.php b/resources/views/livewire/test-infolist-component.blade.php new file mode 100644 index 0000000..b0e74c0 --- /dev/null +++ b/resources/views/livewire/test-infolist-component.blade.php @@ -0,0 +1,4 @@ + +
+ {{ $this->infolist }} +
diff --git a/tests/JsonEntryFieldTest.php b/tests/JsonEntryFieldTest.php index 8eaeaaa..96ef9ce 100644 --- a/tests/JsonEntryFieldTest.php +++ b/tests/JsonEntryFieldTest.php @@ -1,75 +1,283 @@ getHasFoldingCode())->toBe(true); + public array $data = [ + 'json_field' => ['key' => 'value', 'nested' => ['test' => 'data']] + ]; - $field->foldingCode(false); - expect($field->getHasFoldingCode())->toBe(false); + public function mount(): void + { + $this->infolist->fill($this->data); + } - $field->foldingCode(true); - expect($field->getHasFoldingCode())->toBe(true); -}); + public function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + JsonEntry::make('json_field') + ->label('JSON Field'), + ]) + ->state($this->data); + } -it('can have folded code ', function () { - $field = JsonEntry::make('json'); + public function render() + { + return view('livewire.test-infolist-component'); + } +} - expect($field->getHasFoldedCode())->toBe(false); +// Create a simple test view for infolists +if (!file_exists(__DIR__ . '/../resources/views/livewire/')) { + mkdir(__DIR__ . '/../resources/views/livewire/', 0755, true); +} - $field->foldedCode(false); - expect($field->getHasFoldedCode())->toBe(false); +file_put_contents(__DIR__ . '/../resources/views/livewire/test-infolist-component.blade.php', ' +
+ {{ $this->infolist }} +
+'); - $field->foldedCode(true); - expect($field->getHasFoldedCode())->toBe(true); -}); +describe('JsonEntry Component', function () { + it('can be instantiated', function () { + $entry = JsonEntry::make('json_field'); + + expect($entry)->toBeInstanceOf(JsonEntry::class); + expect($entry->getName())->toBe('json_field'); + }); -it('can have auto closing brackets code ', function () { - $field = JsonEntry::make('json'); + it('has correct default values', function () { + $entry = JsonEntry::make('json_field'); + + expect($entry->getHasLineNumbers())->toBe(true); + expect($entry->getHasLineWrapping())->toBe(true); + expect($entry->getHasAutoCloseBrackets())->toBe(true); + expect($entry->getHasFoldingCode())->toBe(true); + expect($entry->getHasDarkTheme())->toBe(false); + expect($entry->getHasFoldedCode())->toBe(false); + }); - expect($field->getHasAutoCloseBrackets())->toBe(true); + it('can configure folding code', function () { + $entry = JsonEntry::make('json'); - $field->autoCloseBrackets(false); - expect($field->getHasAutoCloseBrackets())->toBe(false); + expect($entry->getHasFoldingCode())->toBe(true); - $field->autoCloseBrackets(true); - expect($field->getHasAutoCloseBrackets())->toBe(true); -}); + $entry->foldingCode(false); + expect($entry->getHasFoldingCode())->toBe(false); -it('can have line numbers code ', function () { - $field = JsonEntry::make('json'); + $entry->foldingCode(true); + expect($entry->getHasFoldingCode())->toBe(true); + }); - expect($field->getHasLineNumbers())->toBe(true); + it('can configure folded code', function () { + $entry = JsonEntry::make('json'); - $field->lineNumbers(false); - expect($field->getHasLineNumbers())->toBe(false); + expect($entry->getHasFoldedCode())->toBe(false); - $field->lineNumbers(true); - expect($field->getHasLineNumbers())->toBe(true); -}); + $entry->foldedCode(false); + expect($entry->getHasFoldedCode())->toBe(false); -it('can have line wrapping code ', function () { - $field = JsonEntry::make('json'); + $entry->foldedCode(true); + expect($entry->getHasFoldedCode())->toBe(true); + }); - expect($field->getHasLineWrapping())->toBe(true); + it('can configure auto closing brackets', function () { + $entry = JsonEntry::make('json'); - $field->lineWrapping(false); - expect($field->getHasLineWrapping())->toBe(false); + expect($entry->getHasAutoCloseBrackets())->toBe(true); - $field->lineWrapping(true); - expect($field->getHasLineWrapping())->toBe(true); -}); + $entry->autoCloseBrackets(false); + expect($entry->getHasAutoCloseBrackets())->toBe(false); + + $entry->autoCloseBrackets(true); + expect($entry->getHasAutoCloseBrackets())->toBe(true); + }); + + it('can configure line numbers', function () { + $entry = JsonEntry::make('json'); + + expect($entry->getHasLineNumbers())->toBe(true); + + $entry->lineNumbers(false); + expect($entry->getHasLineNumbers())->toBe(false); + + $entry->lineNumbers(true); + expect($entry->getHasLineNumbers())->toBe(true); + }); + + it('can configure line wrapping', function () { + $entry = JsonEntry::make('json'); + + expect($entry->getHasLineWrapping())->toBe(true); + + $entry->lineWrapping(false); + expect($entry->getHasLineWrapping())->toBe(false); + + $entry->lineWrapping(true); + expect($entry->getHasLineWrapping())->toBe(true); + }); + + it('can configure dark theme', function () { + $entry = JsonEntry::make('json'); + + expect($entry->getHasDarkTheme())->toBe(false); + + $entry->darkTheme(false); + expect($entry->getHasDarkTheme())->toBe(false); + + $entry->darkTheme(true); + expect($entry->getHasDarkTheme())->toBe(true); + }); + + it('can be configured with all features', function () { + $entry = JsonEntry::make('json_field') + ->darkTheme(true) + ->lineNumbers(true) + ->lineWrapping(true) + ->autoCloseBrackets(true) + ->foldingCode(true) + ->foldedCode(true); + + expect($entry->getHasDarkTheme())->toBe(true); + expect($entry->getHasLineNumbers())->toBe(true); + expect($entry->getHasLineWrapping())->toBe(true); + expect($entry->getHasAutoCloseBrackets())->toBe(true); + expect($entry->getHasFoldingCode())->toBe(true); + expect($entry->getHasFoldedCode())->toBe(true); + }); + + it('can have a label', function () { + $entry = JsonEntry::make('json_field')->label('JSON Data'); + + expect($entry->getLabel())->toBe('JSON Data'); + }); + + it('can have a name', function () { + $entry = JsonEntry::make('json_field')->name('custom_name'); + + expect($entry->getName())->toBe('custom_name'); + }); + + it('can have an ID', function () { + $entry = JsonEntry::make('json_field')->id('custom_id'); + + expect($entry->getId())->toBe('custom_id'); + }); + + it('can be hidden', function () { + $entry = JsonEntry::make('json_field')->hidden(); + + expect($entry->isHidden())->toBe(true); + }); + + it('can be visible', function () { + $entry = JsonEntry::make('json_field')->visible(); + + expect($entry->isHidden())->toBe(false); + }); + + it('can have a hint', function () { + $entry = JsonEntry::make('json_field')->hint('JSON data display'); + + expect($entry->getHint())->toBe('JSON data display'); + }); + + it('can be configured with fluent interface', function () { + $entry = JsonEntry::make('json_field') + ->label('JSON Data') + ->hint('JSON data display') + ->darkTheme(true) + ->lineNumbers(true) + ->lineWrapping(true) + ->autoCloseBrackets(true) + ->foldingCode(true) + ->foldedCode(true); + + expect($entry->getLabel())->toBe('JSON Data'); + expect($entry->getHint())->toBe('JSON data display'); + expect($entry->getHasDarkTheme())->toBe(true); + expect($entry->getHasLineNumbers())->toBe(true); + expect($entry->getHasLineWrapping())->toBe(true); + expect($entry->getHasAutoCloseBrackets())->toBe(true); + expect($entry->getHasFoldingCode())->toBe(true); + expect($entry->getHasFoldedCode())->toBe(true); + }); + + it('can format JSON data correctly', function () { + $entry = JsonEntry::make('json_field'); + + $testData = ['key' => 'value', 'nested' => ['test' => 'data']]; + $entry->state($testData); + + expect($entry->getState())->toBe($testData); + }); -it('can have code ', function () { - $field = JsonEntry::make('json'); + it('can handle null values', function () { + $entry = JsonEntry::make('json_field'); + + $entry->state(null); + + expect($entry->getState())->toBeNull(); + }); - expect($field->getHasDarkTheme())->toBe(false); + it('can handle complex nested JSON', function () { + $entry = JsonEntry::make('json_field'); + + $complexData = [ + 'users' => [ + [ + 'id' => 1, + 'name' => 'John Doe', + 'email' => 'john@example.com', + 'settings' => [ + 'theme' => 'dark', + 'notifications' => true, + 'preferences' => [ + 'language' => 'en', + 'timezone' => 'UTC' + ] + ] + ], + [ + 'id' => 2, + 'name' => 'Jane Smith', + 'email' => 'jane@example.com', + 'settings' => [ + 'theme' => 'light', + 'notifications' => false + ] + ] + ], + 'metadata' => [ + 'total_users' => 2, + 'created_at' => '2024-01-01T00:00:00Z', + 'tags' => ['important', 'urgent', 'feature'] + ] + ]; + + $entry->state($complexData); + + expect($entry->getState())->toBe($complexData); + }); - $field->darkTheme(false); - expect($field->getHasDarkTheme())->toBe(false); + it('has correct view path', function () { + $entry = JsonEntry::make('json_field'); + + expect($entry->getView())->toBe('filament-json-field::infolists.components.json-entry'); + }); - $field->darkTheme(true); - expect($field->getHasDarkTheme())->toBe(true); + it('can have extra attributes', function () { + $entry = JsonEntry::make('json_field')->extraAttributes(['data-test' => 'value']); + + expect($entry->getExtraAttributes())->toBe(['data-test' => 'value']); + }); }); diff --git a/tests/JsonInputFieldTest.php b/tests/JsonInputFieldTest.php index c4a9d15..89f7b84 100644 --- a/tests/JsonInputFieldTest.php +++ b/tests/JsonInputFieldTest.php @@ -1,75 +1,285 @@ getHasFoldingCode())->toBe(true); + public ?array $data = []; - $field->foldingCode(false); - expect($field->getHasFoldingCode())->toBe(false); + public function mount(): void + { + $this->form->fill(); + } - $field->foldingCode(true); - expect($field->getHasFoldingCode())->toBe(true); -}); + public function form(Form $form): Form + { + return $form + ->schema([ + JsonInput::make('json_field') + ->label('JSON Field') + ->required(), + ]) + ->statePath('data'); + } -it('can have folded code ', function () { - $field = JsonInput::make('json'); + public function render() + { + return view('livewire.test-component'); + } +} - expect($field->getHasFoldedCode())->toBe(false); +// Create a simple test view +if (!file_exists(__DIR__ . '/../resources/views/livewire/')) { + mkdir(__DIR__ . '/../resources/views/livewire/', 0755, true); +} - $field->foldedCode(false); - expect($field->getHasFoldedCode())->toBe(false); +file_put_contents(__DIR__ . '/../resources/views/livewire/test-component.blade.php', ' +
+ {{ $this->form }} +
+'); - $field->foldedCode(true); - expect($field->getHasFoldedCode())->toBe(true); -}); +describe('JsonInput Component', function () { + it('can be instantiated', function () { + $field = JsonInput::make('json_field'); + + expect($field)->toBeInstanceOf(JsonInput::class); + expect($field->getName())->toBe('json_field'); + }); -it('can have auto closing brackets code ', function () { - $field = JsonInput::make('json'); + it('has correct default values', function () { + $field = JsonInput::make('json_field'); + + expect($field->getHasLineNumbers())->toBe(true); + expect($field->getHasLineWrapping())->toBe(true); + expect($field->getHasAutoCloseBrackets())->toBe(true); + expect($field->getHasFoldingCode())->toBe(true); + expect($field->getHasDarkTheme())->toBe(false); + expect($field->getHasFoldedCode())->toBe(false); + }); - expect($field->getHasAutoCloseBrackets())->toBe(true); + it('can configure folding code', function () { + $field = JsonInput::make('json'); - $field->autoCloseBrackets(false); - expect($field->getHasAutoCloseBrackets())->toBe(false); + expect($field->getHasFoldingCode())->toBe(true); - $field->autoCloseBrackets(true); - expect($field->getHasAutoCloseBrackets())->toBe(true); -}); + $field->foldingCode(false); + expect($field->getHasFoldingCode())->toBe(false); -it('can have line numbers code ', function () { - $field = JsonInput::make('json'); + $field->foldingCode(true); + expect($field->getHasFoldingCode())->toBe(true); + }); - expect($field->getHasLineNumbers())->toBe(true); + it('can configure folded code', function () { + $field = JsonInput::make('json'); - $field->lineNumbers(false); - expect($field->getHasLineNumbers())->toBe(false); + expect($field->getHasFoldedCode())->toBe(false); - $field->lineNumbers(true); - expect($field->getHasLineNumbers())->toBe(true); -}); + $field->foldedCode(false); + expect($field->getHasFoldedCode())->toBe(false); -it('can have line wrapping code ', function () { - $field = JsonInput::make('json'); + $field->foldedCode(true); + expect($field->getHasFoldedCode())->toBe(true); + }); - expect($field->getHasLineWrapping())->toBe(true); + it('can configure auto closing brackets', function () { + $field = JsonInput::make('json'); - $field->lineWrapping(false); - expect($field->getHasLineWrapping())->toBe(false); + expect($field->getHasAutoCloseBrackets())->toBe(true); - $field->lineWrapping(true); - expect($field->getHasLineWrapping())->toBe(true); -}); + $field->autoCloseBrackets(false); + expect($field->getHasAutoCloseBrackets())->toBe(false); + + $field->autoCloseBrackets(true); + expect($field->getHasAutoCloseBrackets())->toBe(true); + }); + + it('can configure line numbers', function () { + $field = JsonInput::make('json'); + + expect($field->getHasLineNumbers())->toBe(true); + + $field->lineNumbers(false); + expect($field->getHasLineNumbers())->toBe(false); + + $field->lineNumbers(true); + expect($field->getHasLineNumbers())->toBe(true); + }); + + it('can configure line wrapping', function () { + $field = JsonInput::make('json'); + + expect($field->getHasLineWrapping())->toBe(true); + + $field->lineWrapping(false); + expect($field->getHasLineWrapping())->toBe(false); + + $field->lineWrapping(true); + expect($field->getHasLineWrapping())->toBe(true); + }); + + it('can configure dark theme', function () { + $field = JsonInput::make('json'); + + expect($field->getHasDarkTheme())->toBe(false); + + $field->darkTheme(false); + expect($field->getHasDarkTheme())->toBe(false); + + $field->darkTheme(true); + expect($field->getHasDarkTheme())->toBe(true); + }); + + it('has correct validation rules', function () { + $field = JsonInput::make('json_field'); + + $rules = $field->getValidationRules(); + + expect($rules)->toContain('array'); + }); + + it('has correct validation messages', function () { + $field = JsonInput::make('json_field'); + + $messages = $field->getValidationMessages(); + + expect($messages)->toHaveKey('array'); + expect($messages['array'])->toBe('The :attribute must be valid JSON.'); + }); + + it('can be configured with all features', function () { + $field = JsonInput::make('json_field') + ->darkTheme(true) + ->lineNumbers(true) + ->lineWrapping(true) + ->autoCloseBrackets(true) + ->foldingCode(true) + ->foldedCode(true); + + expect($field->getHasDarkTheme())->toBe(true); + expect($field->getHasLineNumbers())->toBe(true); + expect($field->getHasLineWrapping())->toBe(true); + expect($field->getHasAutoCloseBrackets())->toBe(true); + expect($field->getHasFoldingCode())->toBe(true); + expect($field->getHasFoldedCode())->toBe(true); + }); + + it('can be made required', function () { + $field = JsonInput::make('json_field')->required(); + + $rules = $field->getValidationRules(); + + expect($rules)->toContain('required'); + }); + + it('can have custom validation rules', function () { + $field = JsonInput::make('json_field') + ->rules(['array', 'min:1']); + + $rules = $field->getValidationRules(); + + expect($rules)->toContain('array'); + expect($rules)->toContain('min:1'); + }); + + it('can have custom validation messages', function () { + $field = JsonInput::make('json_field') + ->validationMessages([ + 'array' => 'Custom array message', + 'required' => 'Custom required message', + ]); + + $messages = $field->getValidationMessages(); + + expect($messages['array'])->toBe('Custom array message'); + expect($messages['required'])->toBe('Custom required message'); + }); + + it('can be made read-only', function () { + $field = JsonInput::make('json_field')->readOnly(); + + expect($field->isReadOnly())->toBe(true); + }); + + it('can be disabled', function () { + $field = JsonInput::make('json_field')->disabled(); + + expect($field->isDisabled())->toBe(true); + }); + + it('can have a label', function () { + $field = JsonInput::make('json_field')->label('JSON Data'); + + expect($field->getLabel())->toBe('JSON Data'); + }); + + it('can have a name', function () { + $field = JsonInput::make('json_field')->name('custom_name'); + + expect($field->getName())->toBe('custom_name'); + }); + + it('can have an ID', function () { + $field = JsonInput::make('json_field')->id('custom_id'); + + expect($field->getId())->toBe('custom_id'); + }); + + it('can be hidden', function () { + $field = JsonInput::make('json_field')->hidden(); + + expect($field->isHidden())->toBe(true); + }); + + it('can be visible', function () { + $field = JsonInput::make('json_field')->visible(); + + expect($field->isHidden())->toBe(false); + }); -it('can have code ', function () { - $field = JsonInput::make('json'); + it('can have a hint', function () { + $field = JsonInput::make('json_field')->hint('Enter valid JSON'); + + expect($field->getHint())->toBe('Enter valid JSON'); + }); - expect($field->getHasDarkTheme())->toBe(false); + it('can be configured with fluent interface', function () { + $field = JsonInput::make('json_field') + ->label('JSON Data') + ->hint('Enter valid JSON') + ->required() + ->darkTheme(true) + ->lineNumbers(true) + ->lineWrapping(true) + ->autoCloseBrackets(true) + ->foldingCode(true) + ->foldedCode(true); + + expect($field->getLabel())->toBe('JSON Data'); + expect($field->getHint())->toBe('Enter valid JSON'); + expect($field->isRequired())->toBe(true); + expect($field->getHasDarkTheme())->toBe(true); + expect($field->getHasLineNumbers())->toBe(true); + expect($field->getHasLineWrapping())->toBe(true); + expect($field->getHasAutoCloseBrackets())->toBe(true); + expect($field->getHasFoldingCode())->toBe(true); + expect($field->getHasFoldedCode())->toBe(true); + }); - $field->darkTheme(false); - expect($field->getHasDarkTheme())->toBe(false); + it('has correct view path', function () { + $field = JsonInput::make('json_field'); + + expect($field->getView())->toBe('filament-json-field::forms.components.json-input'); + }); - $field->darkTheme(true); - expect($field->getHasDarkTheme())->toBe(true); + it('has correct asset package name', function () { + expect(JsonInput::getAssetPackageName())->toBe('laravel-filament-json-field'); + }); }); From 4fbe4d2694ba1b0f8c27cef1a869fc3f596cbbbd Mon Sep 17 00:00:00 2001 From: RhysLees <43909932+RhysLees@users.noreply.github.com> Date: Sun, 13 Jul 2025 02:12:09 +0000 Subject: [PATCH 04/13] Fix styling --- tests/JsonEntryFieldTest.php | 65 ++++++++++++++++++------------------ tests/JsonInputFieldTest.php | 55 +++++++++++++++--------------- 2 files changed, 59 insertions(+), 61 deletions(-) diff --git a/tests/JsonEntryFieldTest.php b/tests/JsonEntryFieldTest.php index 96ef9ce..7340a0c 100644 --- a/tests/JsonEntryFieldTest.php +++ b/tests/JsonEntryFieldTest.php @@ -1,10 +1,9 @@ ['key' => 'value', 'nested' => ['test' => 'data']] + 'json_field' => ['key' => 'value', 'nested' => ['test' => 'data']], ]; public function mount(): void @@ -37,11 +36,11 @@ public function render() } // Create a simple test view for infolists -if (!file_exists(__DIR__ . '/../resources/views/livewire/')) { - mkdir(__DIR__ . '/../resources/views/livewire/', 0755, true); +if (! file_exists(__DIR__.'/../resources/views/livewire/')) { + mkdir(__DIR__.'/../resources/views/livewire/', 0755, true); } -file_put_contents(__DIR__ . '/../resources/views/livewire/test-infolist-component.blade.php', ' +file_put_contents(__DIR__.'/../resources/views/livewire/test-infolist-component.blade.php', '
{{ $this->infolist }}
@@ -50,14 +49,14 @@ public function render() describe('JsonEntry Component', function () { it('can be instantiated', function () { $entry = JsonEntry::make('json_field'); - + expect($entry)->toBeInstanceOf(JsonEntry::class); expect($entry->getName())->toBe('json_field'); }); it('has correct default values', function () { $entry = JsonEntry::make('json_field'); - + expect($entry->getHasLineNumbers())->toBe(true); expect($entry->getHasLineWrapping())->toBe(true); expect($entry->getHasAutoCloseBrackets())->toBe(true); @@ -146,7 +145,7 @@ public function render() ->autoCloseBrackets(true) ->foldingCode(true) ->foldedCode(true); - + expect($entry->getHasDarkTheme())->toBe(true); expect($entry->getHasLineNumbers())->toBe(true); expect($entry->getHasLineWrapping())->toBe(true); @@ -157,37 +156,37 @@ public function render() it('can have a label', function () { $entry = JsonEntry::make('json_field')->label('JSON Data'); - + expect($entry->getLabel())->toBe('JSON Data'); }); it('can have a name', function () { $entry = JsonEntry::make('json_field')->name('custom_name'); - + expect($entry->getName())->toBe('custom_name'); }); it('can have an ID', function () { $entry = JsonEntry::make('json_field')->id('custom_id'); - + expect($entry->getId())->toBe('custom_id'); }); it('can be hidden', function () { $entry = JsonEntry::make('json_field')->hidden(); - + expect($entry->isHidden())->toBe(true); }); it('can be visible', function () { $entry = JsonEntry::make('json_field')->visible(); - + expect($entry->isHidden())->toBe(false); }); it('can have a hint', function () { $entry = JsonEntry::make('json_field')->hint('JSON data display'); - + expect($entry->getHint())->toBe('JSON data display'); }); @@ -201,7 +200,7 @@ public function render() ->autoCloseBrackets(true) ->foldingCode(true) ->foldedCode(true); - + expect($entry->getLabel())->toBe('JSON Data'); expect($entry->getHint())->toBe('JSON data display'); expect($entry->getHasDarkTheme())->toBe(true); @@ -214,24 +213,24 @@ public function render() it('can format JSON data correctly', function () { $entry = JsonEntry::make('json_field'); - + $testData = ['key' => 'value', 'nested' => ['test' => 'data']]; $entry->state($testData); - + expect($entry->getState())->toBe($testData); }); it('can handle null values', function () { $entry = JsonEntry::make('json_field'); - + $entry->state(null); - + expect($entry->getState())->toBeNull(); }); it('can handle complex nested JSON', function () { $entry = JsonEntry::make('json_field'); - + $complexData = [ 'users' => [ [ @@ -243,9 +242,9 @@ public function render() 'notifications' => true, 'preferences' => [ 'language' => 'en', - 'timezone' => 'UTC' - ] - ] + 'timezone' => 'UTC', + ], + ], ], [ 'id' => 2, @@ -253,31 +252,31 @@ public function render() 'email' => 'jane@example.com', 'settings' => [ 'theme' => 'light', - 'notifications' => false - ] - ] + 'notifications' => false, + ], + ], ], 'metadata' => [ 'total_users' => 2, 'created_at' => '2024-01-01T00:00:00Z', - 'tags' => ['important', 'urgent', 'feature'] - ] + 'tags' => ['important', 'urgent', 'feature'], + ], ]; - + $entry->state($complexData); - + expect($entry->getState())->toBe($complexData); }); it('has correct view path', function () { $entry = JsonEntry::make('json_field'); - + expect($entry->getView())->toBe('filament-json-field::infolists.components.json-entry'); }); it('can have extra attributes', function () { $entry = JsonEntry::make('json_field')->extraAttributes(['data-test' => 'value']); - + expect($entry->getExtraAttributes())->toBe(['data-test' => 'value']); }); }); diff --git a/tests/JsonInputFieldTest.php b/tests/JsonInputFieldTest.php index 89f7b84..c4a5c6a 100644 --- a/tests/JsonInputFieldTest.php +++ b/tests/JsonInputFieldTest.php @@ -1,10 +1,9 @@ {{ $this->form }} @@ -49,14 +48,14 @@ public function render() describe('JsonInput Component', function () { it('can be instantiated', function () { $field = JsonInput::make('json_field'); - + expect($field)->toBeInstanceOf(JsonInput::class); expect($field->getName())->toBe('json_field'); }); it('has correct default values', function () { $field = JsonInput::make('json_field'); - + expect($field->getHasLineNumbers())->toBe(true); expect($field->getHasLineWrapping())->toBe(true); expect($field->getHasAutoCloseBrackets())->toBe(true); @@ -139,17 +138,17 @@ public function render() it('has correct validation rules', function () { $field = JsonInput::make('json_field'); - + $rules = $field->getValidationRules(); - + expect($rules)->toContain('array'); }); it('has correct validation messages', function () { $field = JsonInput::make('json_field'); - + $messages = $field->getValidationMessages(); - + expect($messages)->toHaveKey('array'); expect($messages['array'])->toBe('The :attribute must be valid JSON.'); }); @@ -162,7 +161,7 @@ public function render() ->autoCloseBrackets(true) ->foldingCode(true) ->foldedCode(true); - + expect($field->getHasDarkTheme())->toBe(true); expect($field->getHasLineNumbers())->toBe(true); expect($field->getHasLineWrapping())->toBe(true); @@ -173,18 +172,18 @@ public function render() it('can be made required', function () { $field = JsonInput::make('json_field')->required(); - + $rules = $field->getValidationRules(); - + expect($rules)->toContain('required'); }); it('can have custom validation rules', function () { $field = JsonInput::make('json_field') ->rules(['array', 'min:1']); - + $rules = $field->getValidationRules(); - + expect($rules)->toContain('array'); expect($rules)->toContain('min:1'); }); @@ -195,58 +194,58 @@ public function render() 'array' => 'Custom array message', 'required' => 'Custom required message', ]); - + $messages = $field->getValidationMessages(); - + expect($messages['array'])->toBe('Custom array message'); expect($messages['required'])->toBe('Custom required message'); }); it('can be made read-only', function () { $field = JsonInput::make('json_field')->readOnly(); - + expect($field->isReadOnly())->toBe(true); }); it('can be disabled', function () { $field = JsonInput::make('json_field')->disabled(); - + expect($field->isDisabled())->toBe(true); }); it('can have a label', function () { $field = JsonInput::make('json_field')->label('JSON Data'); - + expect($field->getLabel())->toBe('JSON Data'); }); it('can have a name', function () { $field = JsonInput::make('json_field')->name('custom_name'); - + expect($field->getName())->toBe('custom_name'); }); it('can have an ID', function () { $field = JsonInput::make('json_field')->id('custom_id'); - + expect($field->getId())->toBe('custom_id'); }); it('can be hidden', function () { $field = JsonInput::make('json_field')->hidden(); - + expect($field->isHidden())->toBe(true); }); it('can be visible', function () { $field = JsonInput::make('json_field')->visible(); - + expect($field->isHidden())->toBe(false); }); it('can have a hint', function () { $field = JsonInput::make('json_field')->hint('Enter valid JSON'); - + expect($field->getHint())->toBe('Enter valid JSON'); }); @@ -261,7 +260,7 @@ public function render() ->autoCloseBrackets(true) ->foldingCode(true) ->foldedCode(true); - + expect($field->getLabel())->toBe('JSON Data'); expect($field->getHint())->toBe('Enter valid JSON'); expect($field->isRequired())->toBe(true); @@ -275,7 +274,7 @@ public function render() it('has correct view path', function () { $field = JsonInput::make('json_field'); - + expect($field->getView())->toBe('filament-json-field::forms.components.json-input'); }); From 400e45fb90a3e9c598672d1fd1a20709e65f0d7d Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Mon, 14 Jul 2025 23:49:52 +0100 Subject: [PATCH 05/13] WIP --- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- src/Forms/Components/JsonInput.php | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b259caf..7e1daf7 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -9,4 +9,4 @@ body: label: Question or Feature? description: Enter a Question or Feature Request validations: - required: true + required: true \ No newline at end of file diff --git a/src/Forms/Components/JsonInput.php b/src/Forms/Components/JsonInput.php index cf941fa..c36107d 100644 --- a/src/Forms/Components/JsonInput.php +++ b/src/Forms/Components/JsonInput.php @@ -36,9 +36,4 @@ public function setUp(): void 'array' => __('The :attribute must be valid JSON.'), ]); } - - public function getStatePath(bool $isAbsolute = true): ?string - { - return parent::getStatePath($isAbsolute); - } } From 0a22b4f0951f66a85118d06e29916a774940020e Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Tue, 15 Jul 2025 03:03:02 +0100 Subject: [PATCH 06/13] WIP --- dist/laravel-filament-json-field.css | 2 +- dist/laravel-filament-json-field.js | 77 +++++++------------ resources/css/laravel-filament-json-field.css | 53 +++++++++++++ resources/js/laravel-filament-json-field.js | 18 +++-- .../forms/components/json-input.blade.php | 4 +- src/FilamentJsonFieldServiceProvider.php | 2 + src/Forms/Components/JsonInput.php | 15 ++++ 7 files changed, 113 insertions(+), 58 deletions(-) create mode 100644 resources/css/laravel-filament-json-field.css diff --git a/dist/laravel-filament-json-field.css b/dist/laravel-filament-json-field.css index 6c05c0b..c8a1684 100644 --- a/dist/laravel-filament-json-field.css +++ b/dist/laravel-filament-json-field.css @@ -1 +1 @@ -.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25be"}.CodeMirror-foldgutter-folded:after{content:"\25b8"}.cm-s-darcula{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-darcula.CodeMirror{background:#2b2b2b;color:#a9b7c6}.cm-s-darcula span.cm-meta{color:#bbb529}.cm-s-darcula span.cm-number{color:#6897bb}.cm-s-darcula span.cm-keyword{color:#cc7832;line-height:1em;font-weight:700}.cm-s-darcula span.cm-def{color:#a9b7c6;font-style:italic}.cm-s-darcula span.cm-variable,.cm-s-darcula span.cm-variable-2{color:#a9b7c6}.cm-s-darcula span.cm-variable-3{color:#9876aa}.cm-s-darcula span.cm-type{color:#abc;font-weight:700}.cm-s-darcula span.cm-property{color:#ffc66d}.cm-s-darcula span.cm-operator{color:#a9b7c6}.cm-s-darcula span.cm-string,.cm-s-darcula span.cm-string-2{color:#6a8759}.cm-s-darcula span.cm-comment{color:#61a151;font-style:italic}.cm-s-darcula span.cm-link,.cm-s-darcula span.cm-atom{color:#cc7832}.cm-s-darcula span.cm-error{color:#bc3f3c}.cm-s-darcula span.cm-tag{color:#629755;font-weight:700;font-style:italic;text-decoration:underline}.cm-s-darcula span.cm-attribute{color:#6897bb}.cm-s-darcula span.cm-qualifier{color:#6a8759}.cm-s-darcula span.cm-bracket{color:#a9b7c6}.cm-s-darcula span.cm-builtin,.cm-s-darcula span.cm-special{color:#ff9e59}.cm-s-darcula span.cm-matchhighlight{color:#fff;background-color:#325930b3;font-weight:400}.cm-s-darcula span.cm-searching{color:#fff;background-color:#3d733bb3;font-weight:400}.cm-s-darcula .CodeMirror-cursor{border-left:1px solid #A9B7C6}.cm-s-darcula .CodeMirror-activeline-background{background:#323232}.cm-s-darcula .CodeMirror-gutters{background:#313335;border-right:1px solid #313335}.cm-s-darcula .CodeMirror-guttermarker{color:#ffee80}.cm-s-darcula .CodeMirror-guttermarker-subtle{color:#d0d0d0}.cm-s-darcula .CodeMirrir-linenumber{color:#606366}.cm-s-darcula .CodeMirror-matchingbracket{background-color:#3b514d;color:#ffef28!important;font-weight:700}.cm-s-darcula div.CodeMirror-selected{background:#214283}.CodeMirror-hints.darcula{font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#9c9e9e;background-color:#3b3e3f!important}.CodeMirror-hints.darcula .CodeMirror-hint-active{background-color:#494d4e!important;color:#9c9e9e!important} +.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 black;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 .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-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;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.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,.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,.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:#ff96004d}.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;z-index:0}.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;inset: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,.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:#ff06}.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-foldgutter{width:20px}.CodeMirror-foldgutter-folded,.CodeMirror-foldgutter-open{cursor:pointer;color:#666;font-size:12px;text-align:center;line-height:1.2}.CodeMirror-foldgutter-folded:hover,.CodeMirror-foldgutter-open:hover{color:#999}.cm-s-material .CodeMirror-foldgutter-folded,.cm-s-material .CodeMirror-foldgutter-open{color:#89ddff}.cm-s-material .CodeMirror-foldgutter-folded:hover,.cm-s-material .CodeMirror-foldgutter-open:hover{color:#ffcb8b}.cm-s-dracula .CodeMirror-foldgutter-folded,.cm-s-dracula .CodeMirror-foldgutter-open{color:#ff79c6}.cm-s-dracula .CodeMirror-foldgutter-folded:hover,.cm-s-dracula .CodeMirror-foldgutter-open:hover{color:#50fa7b}.cm-s-monokai .CodeMirror-foldgutter-folded,.cm-s-monokai .CodeMirror-foldgutter-open{color:#f8f8f2}.cm-s-monokai .CodeMirror-foldgutter-folded:hover,.cm-s-monokai .CodeMirror-foldgutter-open:hover{color:#fd971f}.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25be"}.CodeMirror-foldgutter-folded:after{content:"\25b8"}.cm-s-material.CodeMirror{background-color:#263238;color:#eff}.cm-s-material .CodeMirror-gutters{background:#263238;color:#546e7a;border:none}.cm-s-material .CodeMirror-guttermarker,.cm-s-material .CodeMirror-guttermarker-subtle,.cm-s-material .CodeMirror-linenumber{color:#546e7a}.cm-s-material .CodeMirror-cursor{border-left:1px solid #FFCC00}.cm-s-material.cm-fat-cursor .CodeMirror-cursor,.cm-s-material .cm-animate-fat-cursor{background-color:#5d6d5c80!important}.cm-s-material div.CodeMirror-selected,.cm-s-material.CodeMirror-focused div.CodeMirror-selected{background:#80cbc433}.cm-s-material .CodeMirror-line::selection,.cm-s-material .CodeMirror-line>span::selection,.cm-s-material .CodeMirror-line>span>span::selection{background:#80cbc433}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line>span::-moz-selection,.cm-s-material .CodeMirror-line>span>span::-moz-selection{background:#80cbc433}.cm-s-material .CodeMirror-activeline-background{background:#00000080}.cm-s-material .cm-keyword{color:#c792ea}.cm-s-material .cm-operator{color:#89ddff}.cm-s-material .cm-variable-2{color:#eff}.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#f07178}.cm-s-material .cm-builtin{color:#ffcb6b}.cm-s-material .cm-atom{color:#f78c6c}.cm-s-material .cm-number{color:#ff5370}.cm-s-material .cm-def{color:#82aaff}.cm-s-material .cm-string{color:#c3e88d}.cm-s-material .cm-string-2{color:#f07178}.cm-s-material .cm-comment{color:#546e7a}.cm-s-material .cm-variable{color:#f07178}.cm-s-material .cm-tag{color:#ff5370}.cm-s-material .cm-meta{color:#ffcb6b}.cm-s-material .cm-attribute,.cm-s-material .cm-property{color:#c792ea}.cm-s-material .cm-qualifier,.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#decb6b}.cm-s-material .cm-error{color:#fff;background-color:#ff5370}.cm-s-material .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-yeti.CodeMirror{background-color:#eceae8!important;color:#d1c9c0!important;border:none}.cm-s-yeti .CodeMirror-gutters{color:#adaba6;background-color:#e5e1db;border:none}.cm-s-yeti .CodeMirror-cursor{border-left:solid thin #d1c9c0}.cm-s-yeti .CodeMirror-linenumber{color:#adaba6}.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::selection,.cm-s-yeti .CodeMirror-line>span::selection,.cm-s-yeti .CodeMirror-line>span>span::selection{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::-moz-selection,.cm-s-yeti .CodeMirror-line>span::-moz-selection,.cm-s-yeti .CodeMirror-line>span>span::-moz-selection{background:#dcd8d2}.cm-s-yeti span.cm-comment{color:#d4c8be}.cm-s-yeti span.cm-string,.cm-s-yeti span.cm-string-2{color:#96c0d8}.cm-s-yeti span.cm-number{color:#a074c4}.cm-s-yeti span.cm-variable{color:#55b5db}.cm-s-yeti span.cm-variable-2{color:#a074c4}.cm-s-yeti span.cm-def{color:#55b5db}.cm-s-yeti span.cm-operator,.cm-s-yeti span.cm-keyword{color:#9fb96e}.cm-s-yeti span.cm-atom{color:#a074c4}.cm-s-yeti span.cm-meta,.cm-s-yeti span.cm-tag{color:#96c0d8}.cm-s-yeti span.cm-attribute{color:#9fb96e}.cm-s-yeti span.cm-qualifier{color:#96c0d8}.cm-s-yeti span.cm-property,.cm-s-yeti span.cm-builtin{color:#a074c4}.cm-s-yeti span.cm-variable-3,.cm-s-yeti span.cm-type{color:#96c0d8}.cm-s-yeti .CodeMirror-activeline-background{background:#e7e4e0}.cm-s-yeti .CodeMirror-matchingbracket{text-decoration:underline} diff --git a/dist/laravel-filament-json-field.js b/dist/laravel-filament-json-field.js index 47f7069..01e9e7e 100644 --- a/dist/laravel-filament-json-field.js +++ b/dist/laravel-filament-json-field.js @@ -1,52 +1,29 @@ -(()=>{var Qm=Object.create;var dc=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var Vm=Object.getOwnPropertyNames;var e0=Object.getPrototypeOf,t0=Object.prototype.hasOwnProperty;var Ut=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var r0=(t,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Vm(r))!t0.call(t,a)&&a!==n&&dc(t,a,{get:()=>r[a],enumerable:!(l=$m(r,a))||l.enumerable});return t};var _t=(t,r,n)=>(n=t!=null?Qm(e0(t)):{},r0(r||!t||!t.__esModule?dc(n,"default",{value:t,enumerable:!0}):n,t));var Ht=Ut((au,fu)=>{(function(t,r){typeof au=="object"&&typeof fu<"u"?fu.exports=r():typeof define=="function"&&define.amd?define(r):(t=t||self,t.CodeMirror=r())})(au,function(){"use strict";var t=navigator.userAgent,r=navigator.platform,n=/gecko\/\d/i.test(t),l=/MSIE \d/.test(t),a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),u=/Edge\/(\d+)/.exec(t),d=l||a||u,c=d&&(l?document.documentMode||6:+(u||a)[1]),g=!u&&/WebKit\//.test(t),m=g&&/Qt\/\d+\.\d+/.test(t),x=!u&&/Chrome\/(\d+)/.exec(t),S=x&&+x[1],k=/Opera\//.test(t),A=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),L=/PhantomJS/.test(t),C=A&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),M=/Android/.test(t),D=C||M||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),E=C||/Mac/.test(r),B=/\bCrOS\b/.test(t),K=/win/i.test(r),X=k&&t.match(/Version\/(\d*\.\d*)/);X&&(X=Number(X[1])),X&&X>=15&&(k=!1,g=!0);var ee=E&&(m||k&&(X==null||X<12.11)),we=n||d&&c>=9;function he(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ke=function(e,i){var s=e.className,o=he(i).exec(s);if(o){var f=s.slice(o.index+o[0].length);e.className=s.slice(0,o.index)+(f?o[1]+f:"")}};function z(e){for(var i=e.childNodes.length;i>0;--i)e.removeChild(e.firstChild);return e}function Y(e,i){return z(e).appendChild(i)}function W(e,i,s,o){var f=document.createElement(e);if(s&&(f.className=s),o&&(f.style.cssText=o),typeof i=="string")f.appendChild(document.createTextNode(i));else if(i)for(var h=0;h=i)return p+(i-h);p+=v-h,p+=s-p%s,h=v+1}}var _r=function(){this.id=null,this.f=null,this.time=0,this.handler=ue(this.onTimeout,this)};_r.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},_r.prototype.set=function(e,i){this.f=i;var s=+new Date+e;(!this.id||s=i)return o+Math.min(p,i-f);if(f+=h-o,f+=s-f%s,o=h+1,f>=i)return o}}var si=[""];function Vl(e){for(;si.length<=e;)si.push(Le(si)+" ");return si[e]}function Le(e){return e[e.length-1]}function sn(e,i){for(var s=[],o=0;o"\x80"&&(e.toUpperCase()!=e.toLowerCase()||hf.test(e))}function ai(e,i){return i?i.source.indexOf("\\w")>-1&&eo(e)?!0:i.test(e):eo(e)}function vs(e){for(var i in e)if(e.hasOwnProperty(i)&&e[i])return!1;return!0}var fi=/[\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 rt(e){return e.charCodeAt(0)>=768&&fi.test(e)}function Hi(e,i,s){for(;(s<0?i>0:is?-1:1;;){if(i==s)return i;var f=(i+s)/2,h=o<0?Math.ceil(f):Math.floor(f);if(h==i)return e(h)?i:s;e(h)?s=h:i=h+o}}function Wi(e,i,s,o){if(!e)return o(i,s,"ltr",0);for(var f=!1,h=0;hi||i==s&&p.to==i)&&(o(Math.max(p.from,i),Math.min(p.to,s),p.level==1?"rtl":"ltr",h),f=!0)}f||o(i,s,"ltr")}var an=null;function Pi(e,i,s){var o;an=null;for(var f=0;fi)return f;h.to==i&&(h.from!=h.to&&s=="before"?o=f:an=f),h.from==i&&(h.from!=h.to&&s!="before"?o=f:an=f)}return o??an}var df=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function s(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?i.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,h=/[LRr]/,p=/[Lb1n]/,v=/[1n]/;function y(b,O,H){this.level=b,this.from=O,this.to=H}return function(b,O){var H=O=="ltr"?"L":"R";if(b.length==0||O=="ltr"&&!o.test(b))return!1;for(var F=b.length,P=[],R=0;R-1&&(o[i]=f.slice(0,h).concat(f.slice(h+1)))}}}function je(e,i){var s=ui(e,i);if(s.length)for(var o=Array.prototype.slice.call(arguments,2),f=0;f0}function Lr(e){e.prototype.on=function(i,s){ae(this,i,s)},e.prototype.off=function(i,s){wt(this,i,s)}}function Ct(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Un(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ft(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Fi(e){Ct(e),Un(e)}function to(e){return e.target||e.srcElement}function Tr(e){var i=e.which;return i==null&&(e.button&1?i=1:e.button&2?i=3:e.button&4&&(i=2)),E&&e.ctrlKey&&i==1&&(i=3),i}var cf=function(){if(d&&c<9)return!1;var e=W("div");return"draggable"in e||"dragDrop"in e}(),_n;function ys(e){if(_n==null){var i=W("span","\u200B");Y(e,W("span",[i,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(_n=i.offsetWidth<=1&&i.offsetHeight>2&&!(d&&c<8))}var s=_n?W("span","\u200B"):W("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return s.setAttribute("cm-text",""),s}var ro;function Ei(e){if(ro!=null)return ro;var i=Y(e,document.createTextNode("A\u062EA")),s=Qe(i,0,1).getBoundingClientRect(),o=Qe(i,1,2).getBoundingClientRect();return z(e),!s||s.left==s.right?!1:ro=o.right-s.right<3}var cr=` +(()=>{var iu=Object.create;var gl=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var lu=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var at=(g,_)=>()=>(_||g((_={exports:{}}).exports,_),_.exports);var fu=(g,_,P,Q)=>{if(_&&typeof _=="object"||typeof _=="function")for(let W of au(_))!su.call(g,W)&&W!==P&&gl(g,W,{get:()=>_[W],enumerable:!(Q=ou(_,W))||Q.enumerable});return g};var lt=(g,_,P)=>(P=g!=null?iu(lu(g)):{},fu(_||!g||!g.__esModule?gl(P,"default",{value:g,enumerable:!0}):P,g));var Ve=at((po,vo)=>{(function(g,_){typeof po=="object"&&typeof vo<"u"?vo.exports=_():typeof define=="function"&&define.amd?define(_):(g=g||self,g.CodeMirror=_())})(po,function(){"use strict";var g=navigator.userAgent,_=navigator.platform,P=/gecko\/\d/i.test(g),Q=/MSIE \d/.test(g),W=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(g),T=/Edge\/(\d+)/.exec(g),k=Q||W||T,N=k&&(Q?document.documentMode||6:+(T||W)[1]),w=!T&&/WebKit\//.test(g),R=w&&/Qt\/\d+\.\d+/.test(g),L=!T&&/Chrome\/(\d+)/.exec(g),I=L&&+L[1],H=/Opera\//.test(g),j=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(g),y=/PhantomJS/.test(g),p=j&&(/Mobile\/\w+/.test(g)||navigator.maxTouchPoints>2),x=/Android/.test(g),A=p||x||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(g),E=p||/Mac/.test(_),X=/\bCrOS\b/.test(g),V=/win/i.test(_),J=H&&g.match(/Version\/(\d*\.\d*)/);J&&(J=Number(J[1])),J&&J>=15&&(H=!1,w=!0);var ae=E&&(R||H&&(J==null||J<12.11)),be=P||k&&N>=9;function pe(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var we=function(e,t){var n=e.className,r=pe(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function D(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return D(e).appendChild(t)}function v(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var At=function(){this.id=null,this.f=null,this.time=0,this.handler=ne(this.onTimeout,this)};At.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},At.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var It=[""];function Vr(e){for(;It.length<=e;)It.push(ce(It)+" ");return It[e]}function ce(e){return e[e.length-1]}function hr(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||gi.test(e))}function Bt(e,t){return t?t.source.indexOf("\\w")>-1&&$r(e)?!0:t.test(e):$r(e)}function Hn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var zt=/[\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 Oe(e){return e.charCodeAt(0)>=768&&zt.test(e)}function Zt(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function Jt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var dr=null;function Qt(e,t,n){var r;dr=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:dr=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:dr=i)}return r??dr}var yi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(f){return f<=247?e.charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?t.charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":f==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(f,c,d){this.level=f,this.from=c,this.to=d}return function(f,c){var d=c=="ltr"?"L":"R";if(f.length==0||c=="ltr"&&!r.test(f))return!1;for(var b=f.length,m=[],M=0;M-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function ke(e,t){var n=Rt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function bt(e){e.prototype.on=function(t,n){te(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function qe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Lr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function $e(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){qe(e),Lr(e)}function en(e){return e.target||e.srcElement}function xt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),E&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(k&&N<9)return!1;var e=v("div");return"draggable"in e||"dragDrop"in e}(),Tr;function Wn(e){if(Tr==null){var t=v("span","\u200B");Y(e,v("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Tr=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&N<8))}var n=Tr?v("span","\u200B"):v("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var tn;function $t(e){if(tn!=null)return tn;var t=Y(e,document.createTextNode("A\u062EA")),n=_e(t,0,1).getBoundingClientRect(),r=_e(t,1,2).getBoundingClientRect();return D(e),!n||n.left==n.right?!1:tn=r.right-n.right<3}var yt=` -b`.split(/\n/).length!=3?function(e){for(var i=0,s=[],o=e.length;i<=o;){var f=e.indexOf(` -`,i);f==-1&&(f=e.length);var h=e.slice(i,e.charAt(f-1)=="\r"?f-1:f),p=h.indexOf("\r");p!=-1?(s.push(h.slice(0,p)),i+=p+1):(s.push(h),i=f+1)}return s}:function(e){return e.split(/\r\n?|\n/)},Ii=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var i;try{i=e.ownerDocument.selection.createRange()}catch{}return!i||i.parentElement()!=e?!1:i.compareEndPoints("StartToEnd",i)!=0},xs=function(){var e=W("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mr=null;function pf(e){if(Mr!=null)return Mr;var i=Y(e,W("span","x")),s=i.getBoundingClientRect(),o=Qe(i,0,1).getBoundingClientRect();return Mr=Math.abs(s.left-o.left)>1}var Kn={},Ar={};function Or(e,i){arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2)),Kn[e]=i}function fn(e,i){Ar[e]=i}function Xn(e){if(typeof e=="string"&&Ar.hasOwnProperty(e))e=Ar[e];else if(e&&typeof e.name=="string"&&Ar.hasOwnProperty(e.name)){var i=Ar[e.name];typeof i=="string"&&(i={name:i}),e=gs(i,e),e.name=i.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function jn(e,i){i=Xn(i);var s=Kn[i.name];if(!s)return jn(e,"text/plain");var o=s(e,i);if(Bi.hasOwnProperty(i.name)){var f=Bi[i.name];for(var h in f)f.hasOwnProperty(h)&&(o.hasOwnProperty(h)&&(o["_"+h]=o[h]),o[h]=f[h])}if(o.name=i.name,i.helperType&&(o.helperType=i.helperType),i.modeProps)for(var p in i.modeProps)o[p]=i.modeProps[p];return o}var Bi={};function qn(e,i){var s=Bi.hasOwnProperty(e)?Bi[e]:Bi[e]={};ye(i,s)}function qr(e,i){if(i===!0)return i;if(e.copyState)return e.copyState(i);var s={};for(var o in i){var f=i[o];f instanceof Array&&(f=f.concat([])),s[o]=f}return s}function io(e,i){for(var s;e.innerMode&&(s=e.innerMode(i),!(!s||s.mode==e));)i=s.state,e=s.mode;return s||{mode:e,state:i}}function Yn(e,i,s){return e.startState?e.startState(i,s):!0}var Ye=function(e,i,s){this.pos=this.start=0,this.string=e,this.tabSize=i||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=s};Ye.prototype.eol=function(){return this.pos>=this.string.length},Ye.prototype.sol=function(){return this.pos==this.lineStart},Ye.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ye.prototype.next=function(){if(this.posi},Ye.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ye.prototype.skipToEnd=function(){this.pos=this.string.length},Ye.prototype.skipTo=function(e){var i=this.string.indexOf(e,this.pos);if(i>-1)return this.pos=i,!0},Ye.prototype.backUp=function(e){this.pos-=e},Ye.prototype.column=function(){return this.lastColumnPos0?null:(h&&i!==!1&&(this.pos+=h[0].length),h)}},Ye.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ye.prototype.hideFirstChars=function(e,i){this.lineStart+=e;try{return i()}finally{this.lineStart-=e}},Ye.prototype.lookAhead=function(e){var i=this.lineOracle;return i&&i.lookAhead(e)},Ye.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ie(e,i){if(i-=e.first,i<0||i>=e.size)throw new Error("There is no line "+(i+e.first)+" in the document.");for(var s=e;!s.lines;)for(var o=0;;++o){var f=s.children[o],h=f.chunkSize();if(i=e.first&&is?I(s,ie(e,s).text.length):$g(i,ie(e,i.line).text.length)}function $g(e,i){var s=e.ch;return s==null||s>i?I(e.line,i):s<0?I(e.line,0):e}function ph(e,i){for(var s=[],o=0;othis.maxLookAhead&&(this.maxLookAhead=e),i},Yr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Yr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Yr.fromSaved=function(e,i,s){return i instanceof bs?new Yr(e,qr(e.mode,i.state),s,i.lookAhead):new Yr(e,qr(e.mode,i),s)},Yr.prototype.save=function(e){var i=e!==!1?qr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bs(i,this.maxLookAhead):i};function gh(e,i,s,o){var f=[e.state.modeGen],h={};wh(e,i.text,e.doc.mode,s,function(b,O){return f.push(b,O)},h,o);for(var p=s.state,v=function(b){s.baseTokens=f;var O=e.state.overlays[b],H=1,F=0;s.state=!0,wh(e,i.text,O.mode,s,function(P,R){for(var _=H;FP&&f.splice(H,1,P,f[H+1],q),H+=2,F=Math.min(P,q)}if(R)if(O.opaque)f.splice(_,H-_,P,"overlay "+R),H=_+2;else for(;_e.options.maxHighlightLength&&qr(e.doc.mode,o.state),h=gh(e,i,o);f&&(o.state=f),i.stateAfter=o.save(!f),i.styles=h.styles,h.classes?i.styleClasses=h.classes:i.styleClasses&&(i.styleClasses=null),s===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return i.styles}function lo(e,i,s){var o=e.doc,f=e.display;if(!o.mode.startState)return new Yr(o,!0,i);var h=Vg(e,i,s),p=h>o.first&&ie(o,h-1).stateAfter,v=p?Yr.fromSaved(o,p,h):new Yr(o,Yn(o.mode),h);return o.iter(h,i,function(y){gf(e,y.text,v);var b=v.line;y.stateAfter=b==i-1||b%5==0||b>=f.viewFrom&&bi.start)return h}throw new Error("Mode "+e.name+" failed to advance stream.")}var yh=function(e,i,s){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=i||null,this.state=s};function xh(e,i,s,o){var f=e.doc,h=f.mode,p;i=ce(f,i);var v=ie(f,i.line),y=lo(e,i.line,s),b=new Ye(v.text,e.options.tabSize,y),O;for(o&&(O=[]);(o||b.pose.options.maxHighlightLength?(v=!1,p&&gf(e,i,o,O.pos),O.pos=i.length,H=null):H=bh(vf(s,O,o.state,F),h),F){var P=F[0].name;P&&(H="m-"+(H?P+" "+H:P))}if(!v||b!=H){for(;yp;--v){if(v<=h.first)return h.first;var y=ie(h,v-1),b=y.stateAfter;if(b&&(!s||v+(b instanceof bs?b.lookAhead:0)<=h.modeFrontier))return v;var O=Oe(y.text,null,e.options.tabSize);(f==null||o>O)&&(f=v-1,o=O)}return f}function ev(e,i){if(e.modeFrontier=Math.min(e.modeFrontier,i),!(e.highlightFrontiers;o--){var f=ie(e,o).stateAfter;if(f&&(!(f instanceof bs)||o+f.lookAhead=i:h.to>i);(o||(o=[])).push(new ws(p,h.from,y?null:h.to))}}return o}function ov(e,i,s){var o;if(e)for(var f=0;f=i:h.to>i);if(v||h.from==i&&p.type=="bookmark"&&(!s||h.marker.insertLeft)){var y=h.from==null||(p.inclusiveLeft?h.from<=i:h.from0&&v)for(var te=0;te0)){var O=[y,1],H=Q(b.from,v.from),F=Q(b.to,v.to);(H<0||!p.inclusiveLeft&&!H)&&O.push({from:b.from,to:v.from}),(F>0||!p.inclusiveRight&&!F)&&O.push({from:v.to,to:b.to}),f.splice.apply(f,O),y+=O.length-3}}return f}function kh(e){var i=e.markedSpans;if(i){for(var s=0;si)&&(!o||yf(o,h.marker)<0)&&(o=h.marker)}return o}function Ah(e,i,s,o,f){var h=ie(e,i),p=di&&h.markedSpans;if(p)for(var v=0;v=0&&H<=0||O<=0&&H>=0)&&(O<=0&&(y.marker.inclusiveRight&&f.inclusiveLeft?Q(b.to,s)>=0:Q(b.to,s)>0)||O>=0&&(y.marker.inclusiveRight&&f.inclusiveLeft?Q(b.from,o)<=0:Q(b.from,o)<0)))return!0}}}function Dr(e){for(var i;i=Mh(e);)e=i.find(-1,!0).line;return e}function fv(e){for(var i;i=ks(e);)e=i.find(1,!0).line;return e}function uv(e){for(var i,s;i=ks(e);)e=i.find(1,!0).line,(s||(s=[])).push(e);return s}function xf(e,i){var s=ie(e,i),o=Dr(s);return s==o?i:w(o)}function Oh(e,i){if(i>e.lastLine())return i;var s=ie(e,i),o;if(!Ri(e,s))return i;for(;o=ks(s);)s=o.find(1,!0).line;return w(s)+1}function Ri(e,i){var s=di&&i.markedSpans;if(s){for(var o=void 0,f=0;fi.maxLineLength&&(i.maxLineLength=f,i.maxLine=o)})}var Jn=function(e,i,s){this.text=e,Lh(this,i),this.height=s?s(this):1};Jn.prototype.lineNo=function(){return w(this)},Lr(Jn);function hv(e,i,s,o){e.text=i,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),kh(e),Lh(e,s);var f=o?o(e):1;f!=e.height&&sr(e,f)}function dv(e){e.parent=null,kh(e)}var cv={},pv={};function Dh(e,i){if(!e||/^\s*$/.test(e))return null;var s=i.addModeClass?pv:cv;return s[e]||(s[e]=e.replace(/\S+/g,"cm-$&"))}function Nh(e,i){var s=De("span",null,null,g?"padding-right: .1px":null),o={pre:De("pre",[s],"CodeMirror-line"),content:s,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};i.measure={};for(var f=0;f<=(i.rest?i.rest.length:0);f++){var h=f?i.rest[f-1]:i.line,p=void 0;o.pos=0,o.addToken=vv,Ei(e.display.measure)&&(p=Ce(h,e.doc.direction))&&(o.addToken=yv(o.addToken,p)),o.map=[];var v=i!=e.display.externalMeasured&&w(h);xv(h,o,vh(e,h,v)),h.styleClasses&&(h.styleClasses.bgClass&&(o.bgClass=Be(h.styleClasses.bgClass,o.bgClass||"")),h.styleClasses.textClass&&(o.textClass=Be(h.styleClasses.textClass,o.textClass||""))),o.map.length==0&&o.map.push(0,0,o.content.appendChild(ys(e.display.measure))),f==0?(i.measure.map=o.map,i.measure.cache={}):((i.measure.maps||(i.measure.maps=[])).push(o.map),(i.measure.caches||(i.measure.caches=[])).push({}))}if(g){var y=o.content.lastChild;(/\bcm-tab\b/.test(y.className)||y.querySelector&&y.querySelector(".cm-tab"))&&(o.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,i.line,o.pre),o.pre.className&&(o.textClass=Be(o.pre.className,o.textClass||"")),o}function gv(e){var i=W("span","\u2022","cm-invalidchar");return i.title="\\u"+e.charCodeAt(0).toString(16),i.setAttribute("aria-label",i.title),i}function vv(e,i,s,o,f,h,p){if(i){var v=e.splitSpaces?mv(i,e.trailingSpace):i,y=e.cm.state.specialChars,b=!1,O;if(!y.test(i))e.col+=i.length,O=document.createTextNode(v),e.map.push(e.pos,e.pos+i.length,O),d&&c<9&&(b=!0),e.pos+=i.length;else{O=document.createDocumentFragment();for(var H=0;;){y.lastIndex=H;var F=y.exec(i),P=F?F.index-H:i.length-H;if(P){var R=document.createTextNode(v.slice(H,H+P));d&&c<9?O.appendChild(W("span",[R])):O.appendChild(R),e.map.push(e.pos,e.pos+P,R),e.col+=P,e.pos+=P}if(!F)break;H+=P+1;var _=void 0;if(F[0]==" "){var q=e.cm.options.tabSize,Z=q-e.col%q;_=O.appendChild(W("span",Vl(Z),"cm-tab")),_.setAttribute("role","presentation"),_.setAttribute("cm-text"," "),e.col+=Z}else F[0]=="\r"||F[0]==` -`?(_=O.appendChild(W("span",F[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),_.setAttribute("cm-text",F[0]),e.col+=1):(_=e.cm.options.specialCharPlaceholder(F[0]),_.setAttribute("cm-text",F[0]),d&&c<9?O.appendChild(W("span",[_])):O.appendChild(_),e.col+=1);e.map.push(e.pos,e.pos+1,_),e.pos++}}if(e.trailingSpace=v.charCodeAt(i.length-1)==32,s||o||f||b||h||p){var $=s||"";o&&($+=o),f&&($+=f);var J=W("span",[O],$,h);if(p)for(var te in p)p.hasOwnProperty(te)&&te!="style"&&te!="class"&&J.setAttribute(te,p[te]);return e.content.appendChild(J)}e.content.appendChild(O)}}function mv(e,i){if(e.length>1&&!/ /.test(e))return e;for(var s=i,o="",f=0;fb&&H.from<=b));F++);if(H.to>=O)return e(s,o,f,h,p,v,y);e(s,o.slice(0,H.to-b),f,h,null,v,y),h=null,o=o.slice(H.to-b),b=H.to}}}function Hh(e,i,s,o){var f=!o&&s.widgetNode;f&&e.map.push(e.pos,e.pos+i,f),!o&&e.cm.display.input.needsContentAttribute&&(f||(f=e.content.appendChild(document.createElement("span"))),f.setAttribute("cm-marker",s.id)),f&&(e.cm.display.input.setUneditable(f),e.content.appendChild(f)),e.pos+=i,e.trailingSpace=!1}function xv(e,i,s){var o=e.markedSpans,f=e.text,h=0;if(!o){for(var p=1;py||me.collapsed&&le.to==y&&le.from==y)){if(le.to!=null&&le.to!=y&&P>le.to&&(P=le.to,_=""),me.className&&(R+=" "+me.className),me.css&&(F=(F?F+";":"")+me.css),me.startStyle&&le.from==y&&(q+=" "+me.startStyle),me.endStyle&&le.to==P&&(te||(te=[])).push(me.endStyle,le.to),me.title&&(($||($={})).title=me.title),me.attributes)for(var Pe in me.attributes)($||($={}))[Pe]=me.attributes[Pe];me.collapsed&&(!Z||yf(Z.marker,me)<0)&&(Z=le)}else le.from>y&&P>le.from&&(P=le.from)}if(te)for(var pt=0;pt=v)break;for(var Qt=Math.min(v,P);;){if(O){var Rt=y+O.length;if(!Z){var it=Rt>Qt?O.slice(0,Qt-y):O;i.addToken(i,it,H?H+R:R,q,y+it.length==P?_:"",F,$)}if(Rt>=Qt){O=O.slice(Qt-y),y=Qt;break}y=Rt,q=""}O=f.slice(h,h=s[b++]),H=Dh(s[b++],i.cm.options)}}}function Wh(e,i,s){this.line=i,this.rest=uv(i),this.size=this.rest?w(Le(this.rest))-s+1:1,this.node=this.text=null,this.hidden=Ri(e,i)}function Ts(e,i,s){for(var o=[],f,h=i;h2&&h.push((y.bottom+b.top)/2-s.top)}}h.push(s.bottom-s.top)}}function zh(e,i,s){if(e.line==i)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var o=0;os)return{map:e.measure.maps[f],cache:e.measure.caches[f],before:!0}}}function Dv(e,i){i=Dr(i);var s=w(i),o=e.display.externalMeasured=new Wh(e.doc,i,s);o.lineN=s;var f=o.built=Nh(e,o);return o.text=f.pre,Y(e.display.lineMeasure,f.pre),o}function Gh(e,i,s,o){return Jr(e,$n(e,i),s,o)}function Lf(e,i){if(i>=e.display.viewFrom&&i=s.lineN&&ii)&&(h=y-v,f=h-1,i>=y&&(p="right")),f!=null){if(o=e[b+2],v==y&&s==(o.insertLeft?"left":"right")&&(p=s),s=="left"&&f==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)o=e[(b-=3)+2],p="left";if(s=="right"&&f==y-v)for(;b=0&&(s=e[f]).left==s.right;f--);return s}function Hv(e,i,s,o){var f=_h(i.map,s,o),h=f.node,p=f.start,v=f.end,y=f.collapse,b;if(h.nodeType==3){for(var O=0;O<4;O++){for(;p&&rt(i.line.text.charAt(f.coverStart+p));)--p;for(;f.coverStart+v0&&(y=o="right");var H;e.options.lineWrapping&&(H=h.getClientRects()).length>1?b=H[o=="right"?H.length-1:0]:b=h.getBoundingClientRect()}if(d&&c<9&&!p&&(!b||!b.left&&!b.right)){var F=h.parentNode.getClientRects()[0];F?b={left:F.left,right:F.left+el(e.display),top:F.top,bottom:F.bottom}:b=Uh}for(var P=b.top-i.rect.top,R=b.bottom-i.rect.top,_=(P+R)/2,q=i.view.measure.heights,Z=0;Z=o.text.length?(y=o.text.length,b="before"):y<=0&&(y=0,b="after"),!v)return p(b=="before"?y-1:y,b=="before");function O(R,_,q){var Z=v[_],$=Z.level==1;return p(q?R-1:R,$!=q)}var H=Pi(v,y,b),F=an,P=O(y,H,b=="before");return F!=null&&(P.other=O(y,F,b!="before")),P}function Zh(e,i){var s=0;i=ce(e.doc,i),e.options.lineWrapping||(s=el(e.display)*i.ch);var o=ie(e.doc,i.line),f=ci(o)+Ms(e.display);return{left:s,right:s,top:f,bottom:f+o.height}}function Mf(e,i,s,o,f){var h=I(e,i,s);return h.xRel=f,o&&(h.outside=o),h}function Af(e,i,s){var o=e.doc;if(s+=e.display.viewOffset,s<0)return Mf(o.first,0,null,-1,-1);var f=N(o,s),h=o.first+o.size-1;if(f>h)return Mf(o.first+o.size-1,ie(o,h).text.length,null,1,1);i<0&&(i=0);for(var p=ie(o,f);;){var v=Pv(e,p,f,i,s),y=av(p,v.ch+(v.xRel>0||v.outside>0?1:0));if(!y)return v;var b=y.find(1);if(b.line==f)return b;p=ie(o,f=b.line)}}function Jh(e,i,s,o){o-=Tf(i);var f=i.text.length,h=jr(function(p){return Jr(e,s,p-1).bottom<=o},f,0);return f=jr(function(p){return Jr(e,s,p).top>o},h,f),{begin:h,end:f}}function Qh(e,i,s,o){s||(s=$n(e,i));var f=As(e,i,Jr(e,s,o),"line").top;return Jh(e,i,s,f)}function Of(e,i,s,o){return e.bottom<=s?!1:e.top>s?!0:(o?e.left:e.right)>i}function Pv(e,i,s,o,f){f-=ci(i);var h=$n(e,i),p=Tf(i),v=0,y=i.text.length,b=!0,O=Ce(i,e.doc.direction);if(O){var H=(e.options.lineWrapping?Ev:Fv)(e,i,s,h,O,o,f);b=H.level!=1,v=b?H.from:H.to-1,y=b?H.to:H.from-1}var F=null,P=null,R=jr(function(fe){var le=Jr(e,h,fe);return le.top+=p,le.bottom+=p,Of(le,o,f,!1)?(le.top<=f&&le.left<=o&&(F=fe,P=le),!0):!1},v,y),_,q,Z=!1;if(P){var $=o-P.left=te.bottom?1:0}return R=Hi(i.text,R,1),Mf(s,R,q,Z,o-_)}function Fv(e,i,s,o,f,h,p){var v=jr(function(H){var F=f[H],P=F.level!=1;return Of(Nr(e,I(s,P?F.to:F.from,P?"before":"after"),"line",i,o),h,p,!0)},0,f.length-1),y=f[v];if(v>0){var b=y.level!=1,O=Nr(e,I(s,b?y.from:y.to,b?"after":"before"),"line",i,o);Of(O,h,p,!0)&&O.top>p&&(y=f[v-1])}return y}function Ev(e,i,s,o,f,h,p){var v=Jh(e,i,o,p),y=v.begin,b=v.end;/\s/.test(i.text.charAt(b-1))&&b--;for(var O=null,H=null,F=0;F=b||P.to<=y)){var R=P.level!=1,_=Jr(e,o,R?Math.min(b,P.to)-1:Math.max(y,P.from)).right,q=_q)&&(O=P,H=q)}}return O||(O=f[f.length-1]),O.fromb&&(O={from:O.from,to:b,level:O.level}),O}var hn;function Vn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hn==null){hn=W("pre",null,"CodeMirror-line-like");for(var i=0;i<49;++i)hn.appendChild(document.createTextNode("x")),hn.appendChild(W("br"));hn.appendChild(document.createTextNode("x"))}Y(e.measure,hn);var s=hn.offsetHeight/50;return s>3&&(e.cachedTextHeight=s),z(e.measure),s||1}function el(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var i=W("span","xxxxxxxxxx"),s=W("pre",[i],"CodeMirror-line-like");Y(e.measure,s);var o=i.getBoundingClientRect(),f=(o.right-o.left)/10;return f>2&&(e.cachedCharWidth=f),f||10}function Df(e){for(var i=e.display,s={},o={},f=i.gutters.clientLeft,h=i.gutters.firstChild,p=0;h;h=h.nextSibling,++p){var v=e.display.gutterSpecs[p].className;s[v]=h.offsetLeft+h.clientLeft+f,o[v]=h.clientWidth}return{fixedPos:Nf(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:s,gutterWidth:o,wrapperWidth:i.wrapper.clientWidth}}function Nf(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function $h(e){var i=Vn(e.display),s=e.options.lineWrapping,o=s&&Math.max(5,e.display.scroller.clientWidth/el(e.display)-3);return function(f){if(Ri(e.doc,f))return 0;var h=0;if(f.widgets)for(var p=0;p0&&(b=ie(e.doc,y.line).text).length==y.ch){var O=Oe(b,b.length,e.options.tabSize)-b.length;y=I(y.line,Math.max(0,Math.round((h-Rh(e.display).left)/el(e.display))-O))}return y}function cn(e,i){if(i>=e.display.viewTo||(i-=e.display.viewFrom,i<0))return null;for(var s=e.display.view,o=0;oi)&&(f.updateLineNumbers=i),e.curOp.viewChanged=!0,i>=f.viewTo)di&&xf(e.doc,i)f.viewFrom?Gi(e):(f.viewFrom+=o,f.viewTo+=o);else if(i<=f.viewFrom&&s>=f.viewTo)Gi(e);else if(i<=f.viewFrom){var h=Ds(e,s,s+o,1);h?(f.view=f.view.slice(h.index),f.viewFrom=h.lineN,f.viewTo+=o):Gi(e)}else if(s>=f.viewTo){var p=Ds(e,i,i,-1);p?(f.view=f.view.slice(0,p.index),f.viewTo=p.lineN):Gi(e)}else{var v=Ds(e,i,i,-1),y=Ds(e,s,s+o,1);v&&y?(f.view=f.view.slice(0,v.index).concat(Ts(e,v.lineN,y.lineN)).concat(f.view.slice(y.index)),f.viewTo+=o):Gi(e)}var b=f.externalMeasured;b&&(s=f.lineN&&i=o.viewTo)){var h=o.view[cn(e,i)];if(h.node!=null){var p=h.changes||(h.changes=[]);ve(p,s)==-1&&p.push(s)}}}function Gi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ds(e,i,s,o){var f=cn(e,i),h,p=e.display.view;if(!di||s==e.doc.first+e.doc.size)return{index:f,lineN:s};for(var v=e.display.viewFrom,y=0;y0){if(f==p.length-1)return null;h=v+p[f].size-i,f++}else h=v-i;i+=h,s+=h}for(;xf(e.doc,s)!=s;){if(f==(o<0?0:p.length-1))return null;s+=o*p[f-(o<0?1:0)].size,f+=o}return{index:f,lineN:s}}function Iv(e,i,s){var o=e.display,f=o.view;f.length==0||i>=o.viewTo||s<=o.viewFrom?(o.view=Ts(e,i,s),o.viewFrom=i):(o.viewFrom>i?o.view=Ts(e,i,o.viewFrom).concat(o.view):o.viewFroms&&(o.view=o.view.slice(0,cn(e,s)))),o.viewTo=s}function Vh(e){for(var i=e.display.view,s=0,o=0;o=e.display.viewTo||y.to().line0?p:e.defaultCharWidth())+"px"}if(o.other){var v=s.appendChild(W("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));v.style.display="",v.style.left=o.other.left+"px",v.style.top=o.other.top+"px",v.style.height=(o.other.bottom-o.other.top)*.85+"px"}}function Ns(e,i){return e.top-i.top||e.left-i.left}function Bv(e,i,s){var o=e.display,f=e.doc,h=document.createDocumentFragment(),p=Rh(e.display),v=p.left,y=Math.max(o.sizerWidth,un(e)-o.sizer.offsetLeft)-p.right,b=f.direction=="ltr";function O(J,te,fe,le){te<0&&(te=0),te=Math.round(te),le=Math.round(le),h.appendChild(W("div",null,"CodeMirror-selected","position: absolute; left: "+J+`px; - top: `+te+"px; width: "+(fe??y-J)+`px; - height: `+(le-te)+"px"))}function H(J,te,fe){var le=ie(f,J),me=le.text.length,Pe,pt;function Ke(it,zt){return Os(e,I(J,it),"div",le,zt)}function Qt(it,zt,xt){var lt=Qh(e,le,null,it),nt=zt=="ltr"==(xt=="after")?"left":"right",Ze=xt=="after"?lt.begin:lt.end-(/\s/.test(le.text.charAt(lt.end-1))?2:1);return Ke(Ze,nt)[nt]}var Rt=Ce(le,f.direction);return Wi(Rt,te||0,fe??me,function(it,zt,xt,lt){var nt=xt=="ltr",Ze=Ke(it,nt?"left":"right"),Gt=Ke(zt-1,nt?"right":"left"),cl=te==null&&it==0,qi=fe==null&&zt==me,kt=lt==0,Qr=!Rt||lt==Rt.length-1;if(Gt.top-Ze.top<=3){var gt=(b?cl:qi)&&kt,ou=(b?qi:cl)&&Qr,mi=gt?v:(nt?Ze:Gt).left,yn=ou?y:(nt?Gt:Ze).right;O(mi,Ze.top,yn-mi,Ze.bottom)}else{var xn,Nt,pl,su;nt?(xn=b&&cl&&kt?v:Ze.left,Nt=b?y:Qt(it,xt,"before"),pl=b?v:Qt(zt,xt,"after"),su=b&&qi&&Qr?y:Gt.right):(xn=b?Qt(it,xt,"before"):v,Nt=!b&&cl&&kt?y:Ze.right,pl=!b&&qi&&Qr?v:Gt.left,su=b?Qt(zt,xt,"after"):y),O(xn,Ze.top,Nt-xn,Ze.bottom),Ze.bottom0?i.blinker=setInterval(function(){e.hasFocus()||tl(e),i.cursorDiv.style.visibility=(s=!s)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(i.cursorDiv.style.visibility="hidden")}}function td(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ef(e))}function Ff(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&tl(e))},100)}function Ef(e,i){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,i),e.state.focused=!0,Ee(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),g&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Pf(e))}function tl(e,i){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,i),e.state.focused=!1,ke(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Hs(e){for(var i=e.display,s=i.lineDiv.offsetTop,o=Math.max(0,i.scroller.getBoundingClientRect().top),f=i.lineDiv.getBoundingClientRect().top,h=0,p=0;p.005||P<-.005)&&(fe.display.sizerWidth){var _=Math.ceil(O/el(e.display));_>e.display.maxLineLength&&(e.display.maxLineLength=_,e.display.maxLine=v.line,e.display.maxLineChanged=!0)}}}Math.abs(h)>2&&(i.scroller.scrollTop+=h)}function rd(e){if(e.widgets)for(var i=0;i=p&&(h=N(i,ci(ie(i,y))-e.wrapper.clientHeight),p=y)}return{from:h,to:Math.max(p,h+1)}}function Rv(e,i){if(!qe(e,"scrollCursorIntoView")){var s=e.display,o=s.sizer.getBoundingClientRect(),f=null,h=s.wrapper.ownerDocument;if(i.top+o.top<0?f=!0:i.bottom+o.top>(h.defaultView.innerHeight||h.documentElement.clientHeight)&&(f=!1),f!=null&&!L){var p=W("div","\u200B",null,`position: absolute; - top: `+(i.top-s.viewOffset-Ms(e.display))+`px; - height: `+(i.bottom-i.top+Zr(e)+s.barHeight)+`px; - left: `+i.left+"px; width: "+Math.max(2,i.right-i.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(f),e.display.lineSpace.removeChild(p)}}}function zv(e,i,s,o){o==null&&(o=0);var f;!e.options.lineWrapping&&i==s&&(s=i.sticky=="before"?I(i.line,i.ch+1,"before"):i,i=i.ch?I(i.line,i.sticky=="before"?i.ch-1:i.ch,"after"):i);for(var h=0;h<5;h++){var p=!1,v=Nr(e,i),y=!s||s==i?v:Nr(e,s);f={left:Math.min(v.left,y.left),top:Math.min(v.top,y.top)-o,right:Math.max(v.left,y.left),bottom:Math.max(v.bottom,y.bottom)+o};var b=If(e,f),O=e.doc.scrollTop,H=e.doc.scrollLeft;if(b.scrollTop!=null&&(po(e,b.scrollTop),Math.abs(e.doc.scrollTop-O)>1&&(p=!0)),b.scrollLeft!=null&&(pn(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-H)>1&&(p=!0)),!p)break}return f}function Gv(e,i){var s=If(e,i);s.scrollTop!=null&&po(e,s.scrollTop),s.scrollLeft!=null&&pn(e,s.scrollLeft)}function If(e,i){var s=e.display,o=Vn(e.display);i.top<0&&(i.top=0);var f=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,h=kf(e),p={};i.bottom-i.top>h&&(i.bottom=i.top+h);var v=e.doc.height+Sf(s),y=i.topv-o;if(i.topf+h){var O=Math.min(i.top,(b?v:i.bottom)-h);O!=f&&(p.scrollTop=O)}var H=e.options.fixedGutter?0:s.gutters.offsetWidth,F=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft-H,P=un(e)-s.gutters.offsetWidth,R=i.right-i.left>P;return R&&(i.right=i.left+P),i.left<10?p.scrollLeft=0:i.leftP+F-3&&(p.scrollLeft=i.right+(R?0:10)-P),p}function Bf(e,i){i!=null&&(Ps(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+i)}function rl(e){Ps(e);var i=e.getCursor();e.curOp.scrollToPos={from:i,to:i,margin:e.options.cursorScrollMargin}}function co(e,i,s){(i!=null||s!=null)&&Ps(e),i!=null&&(e.curOp.scrollLeft=i),s!=null&&(e.curOp.scrollTop=s)}function Uv(e,i){Ps(e),e.curOp.scrollToPos=i}function Ps(e){var i=e.curOp.scrollToPos;if(i){e.curOp.scrollToPos=null;var s=Zh(e,i.from),o=Zh(e,i.to);id(e,s,o,i.margin)}}function id(e,i,s,o){var f=If(e,{left:Math.min(i.left,s.left),top:Math.min(i.top,s.top)-o,right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)+o});co(e,f.scrollLeft,f.scrollTop)}function po(e,i){Math.abs(e.doc.scrollTop-i)<2||(n||zf(e,{top:i}),nd(e,i,!0),n&&zf(e),mo(e,100))}function nd(e,i,s){i=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,i)),!(e.display.scroller.scrollTop==i&&!s)&&(e.doc.scrollTop=i,e.display.scrollbars.setScrollTop(i),e.display.scroller.scrollTop!=i&&(e.display.scroller.scrollTop=i))}function pn(e,i,s,o){i=Math.max(0,Math.min(i,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((s?i==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-i)<2)&&!o)&&(e.doc.scrollLeft=i,fd(e),e.display.scroller.scrollLeft!=i&&(e.display.scroller.scrollLeft=i),e.display.scrollbars.setScrollLeft(i))}function go(e){var i=e.display,s=i.gutters.offsetWidth,o=Math.round(e.doc.height+Sf(e.display));return{clientHeight:i.scroller.clientHeight,viewHeight:i.wrapper.clientHeight,scrollWidth:i.scroller.scrollWidth,clientWidth:i.scroller.clientWidth,viewWidth:i.wrapper.clientWidth,barLeft:e.options.fixedGutter?s:0,docHeight:o,scrollHeight:o+Zr(e)+i.barHeight,nativeBarWidth:i.nativeBarWidth,gutterWidth:s}}var gn=function(e,i,s){this.cm=s;var o=this.vert=W("div",[W("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=W("div",[W("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");o.tabIndex=f.tabIndex=-1,e(o),e(f),ae(o,"scroll",function(){o.clientHeight&&i(o.scrollTop,"vertical")}),ae(f,"scroll",function(){f.clientWidth&&i(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,d&&c<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gn.prototype.update=function(e){var i=e.scrollWidth>e.clientWidth+1,s=e.scrollHeight>e.clientHeight+1,o=e.nativeBarWidth;if(s){this.vert.style.display="block",this.vert.style.bottom=i?o+"px":"0";var f=e.viewHeight-(i?o:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+f)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(i){this.horiz.style.display="block",this.horiz.style.right=s?o+"px":"0",this.horiz.style.left=e.barLeft+"px";var h=e.viewWidth-e.barLeft-(s?o:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+h)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(o==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:s?o:0,bottom:i?o:0}},gn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gn.prototype.zeroWidthHack=function(){var e=E&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new _r,this.disableVert=new _r},gn.prototype.enableZeroWidthBar=function(e,i,s){e.style.visibility="";function o(){var f=e.getBoundingClientRect(),h=s=="vert"?document.elementFromPoint(f.right-1,(f.top+f.bottom)/2):document.elementFromPoint((f.right+f.left)/2,f.bottom-1);h!=e?e.style.visibility="hidden":i.set(1e3,o)}i.set(1e3,o)},gn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vo=function(){};vo.prototype.update=function(){return{bottom:0,right:0}},vo.prototype.setScrollLeft=function(){},vo.prototype.setScrollTop=function(){},vo.prototype.clear=function(){};function il(e,i){i||(i=go(e));var s=e.display.barWidth,o=e.display.barHeight;ld(e,i);for(var f=0;f<4&&s!=e.display.barWidth||o!=e.display.barHeight;f++)s!=e.display.barWidth&&e.options.lineWrapping&&Hs(e),ld(e,go(e)),s=e.display.barWidth,o=e.display.barHeight}function ld(e,i){var s=e.display,o=s.scrollbars.update(i);s.sizer.style.paddingRight=(s.barWidth=o.right)+"px",s.sizer.style.paddingBottom=(s.barHeight=o.bottom)+"px",s.heightForcer.style.borderBottom=o.bottom+"px solid transparent",o.right&&o.bottom?(s.scrollbarFiller.style.display="block",s.scrollbarFiller.style.height=o.bottom+"px",s.scrollbarFiller.style.width=o.right+"px"):s.scrollbarFiller.style.display="",o.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(s.gutterFiller.style.display="block",s.gutterFiller.style.height=o.bottom+"px",s.gutterFiller.style.width=i.gutterWidth+"px"):s.gutterFiller.style.display=""}var od={native:gn,null:vo};function sd(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ke(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new od[e.options.scrollbarStyle](function(i){e.display.wrapper.insertBefore(i,e.display.scrollbarFiller),ae(i,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),i.setAttribute("cm-not-content","true")},function(i,s){s=="horizontal"?pn(e,i):po(e,i)},e),e.display.scrollbars.addClass&&Ee(e.display.wrapper,e.display.scrollbars.addClass)}var _v=0;function vn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++_v,markArrays:null},bv(e.curOp)}function mn(e){var i=e.curOp;i&&Cv(i,function(s){for(var o=0;o=s.viewTo)||s.maxLineChanged&&i.options.lineWrapping,e.update=e.mustUpdate&&new Fs(i,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function jv(e){e.updatedDisplay=e.mustUpdate&&Rf(e.cm,e.update)}function qv(e){var i=e.cm,s=i.display;e.updatedDisplay&&Hs(i),e.barMeasure=go(i),s.maxLineChanged&&!i.options.lineWrapping&&(e.adjustWidthTo=Gh(i,s.maxLine,s.maxLine.text.length).left+3,i.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(s.scroller.clientWidth,s.sizer.offsetLeft+e.adjustWidthTo+Zr(i)+i.display.barWidth),e.maxScrollLeft=Math.max(0,s.sizer.offsetLeft+e.adjustWidthTo-un(i))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=s.input.prepareSelection())}function Yv(e){var i=e.cm;e.adjustWidthTo!=null&&(i.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var s=+new Date+e.options.workTime,o=lo(e,i.highlightFrontier),f=[];i.iter(o.line,Math.min(i.first+i.size,e.display.viewTo+500),function(h){if(o.line>=e.display.viewFrom){var p=h.styles,v=h.text.length>e.options.maxHighlightLength?qr(i.mode,o.state):null,y=gh(e,h,o,!0);v&&(o.state=v),h.styles=y.styles;var b=h.styleClasses,O=y.classes;O?h.styleClasses=O:b&&(h.styleClasses=null);for(var H=!p||p.length!=h.styles.length||b!=O&&(!b||!O||b.bgClass!=O.bgClass||b.textClass!=O.textClass),F=0;!H&&Fs)return mo(e,e.options.workDelay),!0}),i.highlightFrontier=o.line,i.modeFrontier=Math.max(i.modeFrontier,o.line),f.length&&Jt(e,function(){for(var h=0;h=s.viewFrom&&i.visible.to<=s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo)&&s.renderedView==s.view&&Vh(e)==0)return!1;ud(e)&&(Gi(e),i.dims=Df(e));var f=o.first+o.size,h=Math.max(i.visible.from-e.options.viewportMargin,o.first),p=Math.min(f,i.visible.to+e.options.viewportMargin);s.viewFromp&&s.viewTo-p<20&&(p=Math.min(f,s.viewTo)),di&&(h=xf(e.doc,h),p=Oh(e.doc,p));var v=h!=s.viewFrom||p!=s.viewTo||s.lastWrapHeight!=i.wrapperHeight||s.lastWrapWidth!=i.wrapperWidth;Iv(e,h,p),s.viewOffset=ci(ie(e.doc,s.viewFrom)),e.display.mover.style.top=s.viewOffset+"px";var y=Vh(e);if(!v&&y==0&&!i.force&&s.renderedView==s.view&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo))return!1;var b=$v(e);return y>4&&(s.lineDiv.style.display="none"),em(e,s.updateLineNumbers,i.dims),y>4&&(s.lineDiv.style.display=""),s.renderedView=s.view,Vv(b),z(s.cursorDiv),z(s.selectionDiv),s.gutters.style.height=s.sizer.style.minHeight=0,v&&(s.lastWrapHeight=i.wrapperHeight,s.lastWrapWidth=i.wrapperWidth,mo(e,400)),s.updateLineNumbers=null,!0}function ad(e,i){for(var s=i.viewport,o=!0;;o=!1){if(!o||!e.options.lineWrapping||i.oldDisplayWidth==un(e)){if(s&&s.top!=null&&(s={top:Math.min(e.doc.height+Sf(e.display)-kf(e),s.top)}),i.visible=Ws(e.display,e.doc,s),i.visible.from>=e.display.viewFrom&&i.visible.to<=e.display.viewTo)break}else o&&(i.visible=Ws(e.display,e.doc,s));if(!Rf(e,i))break;Hs(e);var f=go(e);ho(e),il(e,f),Uf(e,f),i.force=!1}i.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(i.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function zf(e,i){var s=new Fs(e,i);if(Rf(e,s)){Hs(e),ad(e,s);var o=go(e);ho(e),il(e,o),Uf(e,o),s.finish()}}function em(e,i,s){var o=e.display,f=e.options.lineNumbers,h=o.lineDiv,p=h.firstChild;function v(R){var _=R.nextSibling;return g&&E&&e.display.currentWheelTarget==R?R.style.display="none":R.parentNode.removeChild(R),_}for(var y=o.view,b=o.viewFrom,O=0;O-1&&(P=!1),Ph(e,H,b,s)),P&&(z(H.lineNumber),H.lineNumber.appendChild(document.createTextNode(j(e.options,b)))),p=H.node.nextSibling}b+=H.size}for(;p;)p=v(p)}function Gf(e){var i=e.gutters.offsetWidth;e.sizer.style.marginLeft=i+"px",ht(e,"gutterChanged",e)}function Uf(e,i){e.display.sizer.style.minHeight=i.docHeight+"px",e.display.heightForcer.style.top=i.docHeight+"px",e.display.gutters.style.height=i.docHeight+e.display.barHeight+Zr(e)+"px"}function fd(e){var i=e.display,s=i.view;if(!(!i.alignWidgets&&(!i.gutters.firstChild||!e.options.fixedGutter))){for(var o=Nf(i)-i.scroller.scrollLeft+e.doc.scrollLeft,f=i.gutters.offsetWidth,h=o+"px",p=0;p=105&&(f.wrapper.style.clipPath="inset(0px)"),f.wrapper.setAttribute("translate","no"),d&&c<8&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),!g&&!(n&&D)&&(f.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(f.wrapper):e(f.wrapper)),f.viewFrom=f.viewTo=i.first,f.reportedViewFrom=f.reportedViewTo=i.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,f.gutterSpecs=_f(o.gutters,o.lineNumbers),hd(f),s.init(f)}var Es=0,gi=null;d?gi=-.53:n?gi=15:x?gi=-.7:A&&(gi=-1/3);function dd(e){var i=e.wheelDeltaX,s=e.wheelDeltaY;return i==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(i=e.detail),s==null&&e.detail&&e.axis==e.VERTICAL_AXIS?s=e.detail:s==null&&(s=e.wheelDelta),{x:i,y:s}}function rm(e){var i=dd(e);return i.x*=gi,i.y*=gi,i}function cd(e,i){x&&S==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var s=dd(i),o=s.x,f=s.y,h=gi;i.deltaMode===0&&(o=i.deltaX,f=i.deltaY,h=1);var p=e.display,v=p.scroller,y=v.scrollWidth>v.clientWidth,b=v.scrollHeight>v.clientHeight;if(o&&y||f&&b){if(f&&E&&g){e:for(var O=i.target,H=p.view;O!=v;O=O.parentNode)for(var F=0;F=0&&Q(e,o.to())<=0)return s}return-1};var Me=function(e,i){this.anchor=e,this.head=i};Me.prototype.from=function(){return Zn(this.anchor,this.head)},Me.prototype.to=function(){return Et(this.anchor,this.head)},Me.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Hr(e,i,s){var o=e&&e.options.selectionsMayTouch,f=i[s];i.sort(function(F,P){return Q(F.from(),P.from())}),s=ve(i,f);for(var h=1;h0:y>=0){var b=Zn(v.from(),p.from()),O=Et(v.to(),p.to()),H=v.empty()?p.from()==p.head:v.from()==v.head;h<=s&&--s,i.splice(--h,2,new Me(H?O:b,H?b:O))}}return new ar(i,s)}function Ui(e,i){return new ar([new Me(e,i||e)],0)}function _i(e){return e.text?I(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function pd(e,i){if(Q(e,i.from)<0)return e;if(Q(e,i.to)<=0)return _i(i);var s=e.line+i.text.length-(i.to.line-i.from.line)-1,o=e.ch;return e.line==i.to.line&&(o+=_i(i).ch-i.to.ch),I(s,o)}function Kf(e,i){for(var s=[],o=0;o1&&e.remove(v.line+1,R-1),e.insert(v.line+1,Z)}ht(e,"change",e,i)}function Ki(e,i,s){function o(f,h,p){if(f.linked)for(var v=0;v1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function bd(e,i,s,o){var f=e.history;f.undone.length=0;var h=+new Date,p,v;if((f.lastOp==o||f.lastOrigin==i.origin&&i.origin&&(i.origin.charAt(0)=="+"&&f.lastModTime>h-(e.cm?e.cm.options.historyEventDelay:500)||i.origin.charAt(0)=="*"))&&(p=lm(f,f.lastOp==o)))v=Le(p.changes),Q(i.from,i.to)==0&&Q(i.from,v.to)==0?v.to=_i(i):p.changes.push(qf(e,i));else{var y=Le(f.done);for((!y||!y.ranges)&&Bs(e.sel,f.done),p={changes:[qf(e,i)],generation:f.generation},f.done.push(p);f.done.length>f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift()}f.done.push(s),f.generation=++f.maxGeneration,f.lastModTime=f.lastSelTime=h,f.lastOp=f.lastSelOp=o,f.lastOrigin=f.lastSelOrigin=i.origin,v||je(e,"historyAdded")}function om(e,i,s,o){var f=i.charAt(0);return f=="*"||f=="+"&&s.ranges.length==o.ranges.length&&s.somethingSelected()==o.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function sm(e,i,s,o){var f=e.history,h=o&&o.origin;s==f.lastSelOp||h&&f.lastSelOrigin==h&&(f.lastModTime==f.lastSelTime&&f.lastOrigin==h||om(e,h,Le(f.done),i))?f.done[f.done.length-1]=i:Bs(i,f.done),f.lastSelTime=+new Date,f.lastSelOrigin=h,f.lastSelOp=s,o&&o.clearRedo!==!1&&xd(f.undone)}function Bs(e,i){var s=Le(i);s&&s.ranges&&s.equals(e)||i.push(e)}function wd(e,i,s,o){var f=i["spans_"+e.id],h=0;e.iter(Math.max(e.first,s),Math.min(e.first+e.size,o),function(p){p.markedSpans&&((f||(f=i["spans_"+e.id]={}))[h]=p.markedSpans),++h})}function am(e){if(!e)return null;for(var i,s=0;s-1&&(Le(v)[H]=b[H],delete b[H])}}return o}function Yf(e,i,s,o){if(o){var f=e.anchor;if(s){var h=Q(i,f)<0;h!=Q(s,f)<0?(f=i,i=s):h!=Q(i,s)<0&&(i=s)}return new Me(f,i)}else return new Me(s||i,i)}function Rs(e,i,s,o,f){f==null&&(f=e.cm&&(e.cm.display.shift||e.extend)),St(e,new ar([Yf(e.sel.primary(),i,s,f)],0),o)}function Sd(e,i,s){for(var o=[],f=e.cm&&(e.cm.display.shift||e.extend),h=0;h=i.ch:v.to>i.ch))){if(f&&(je(y,"beforeCursorEnter"),y.explicitlyCleared))if(h.markedSpans){--p;continue}else break;if(!y.atomic)continue;if(s){var H=y.find(o<0?1:-1),F=void 0;if((o<0?O:b)&&(H=Od(e,H,-o,H&&H.line==i.line?h:null)),H&&H.line==i.line&&(F=Q(H,s))&&(o<0?F<0:F>0))return ll(e,H,i,o,f)}var P=y.find(o<0?-1:1);return(o<0?b:O)&&(P=Od(e,P,o,P.line==i.line?h:null)),P?ll(e,P,i,o,f):null}}return i}function Gs(e,i,s,o,f){var h=o||1,p=ll(e,i,s,h,f)||!f&&ll(e,i,s,h,!0)||ll(e,i,s,-h,f)||!f&&ll(e,i,s,-h,!0);return p||(e.cantEdit=!0,I(e.first,0))}function Od(e,i,s,o){return s<0&&i.ch==0?i.line>e.first?ce(e,I(i.line-1)):null:s>0&&i.ch==(o||ie(e,i.line)).text.length?i.line=0;--f)Hd(e,{from:o[f].from,to:o[f].to,text:f?[""]:i.text,origin:i.origin});else Hd(e,i)}}function Hd(e,i){if(!(i.text.length==1&&i.text[0]==""&&Q(i.from,i.to)==0)){var s=Kf(e,i);bd(e,i,s,e.cm?e.cm.curOp.id:NaN),bo(e,i,s,mf(e,i));var o=[];Ki(e,function(f,h){!h&&ve(o,f.history)==-1&&(Ed(f.history,i),o.push(f.history)),bo(f,i,null,mf(f,i))})}}function Us(e,i,s){var o=e.cm&&e.cm.state.suppressEdits;if(!(o&&!s)){for(var f=e.history,h,p=e.sel,v=i=="undo"?f.done:f.undone,y=i=="undo"?f.undone:f.done,b=0;b=0;--P){var R=F(P);if(R)return R.v}}}}function Wd(e,i){if(i!=0&&(e.first+=i,e.sel=new ar(sn(e.sel.ranges,function(f){return new Me(I(f.anchor.line+i,f.anchor.ch),I(f.head.line+i,f.head.ch))}),e.sel.primIndex),e.cm)){It(e.cm,e.first,e.first-i,i);for(var s=e.cm.display,o=s.viewFrom;oe.lastLine())){if(i.from.lineh&&(i={from:i.from,to:I(h,ie(e,h).text.length),text:[i.text[0]],origin:i.origin}),i.removed=hi(e,i.from,i.to),s||(s=Kf(e,i)),e.cm?hm(e.cm,i,o):jf(e,i,o),zs(e,s,lr),e.cantEdit&&Gs(e,I(e.firstLine(),0))&&(e.cantEdit=!1)}}function hm(e,i,s){var o=e.doc,f=e.display,h=i.from,p=i.to,v=!1,y=h.line;e.options.lineWrapping||(y=w(Dr(ie(o,h.line))),o.iter(y,p.line+1,function(P){if(P==f.maxLine)return v=!0,!0})),o.sel.contains(i.from,i.to)>-1&&dr(e),jf(o,i,s,$h(e)),e.options.lineWrapping||(o.iter(y,h.line+i.text.length,function(P){var R=Ls(P);R>f.maxLineLength&&(f.maxLine=P,f.maxLineLength=R,f.maxLineChanged=!0,v=!1)}),v&&(e.curOp.updateMaxLine=!0)),ev(o,h.line),mo(e,400);var b=i.text.length-(p.line-h.line)-1;i.full?It(e):h.line==p.line&&i.text.length==1&&!vd(e.doc,i)?zi(e,h.line,"text"):It(e,h.line,p.line+1,b);var O=Zt(e,"changes"),H=Zt(e,"change");if(H||O){var F={from:h,to:p,text:i.text,removed:i.removed,origin:i.origin};H&&ht(e,"change",e,F),O&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(F)}e.display.selForContextMenu=null}function sl(e,i,s,o,f){var h;o||(o=s),Q(o,s)<0&&(h=[o,s],s=h[0],o=h[1]),typeof i=="string"&&(i=e.splitLines(i)),ol(e,{from:s,to:o,text:i,origin:f})}function Pd(e,i,s,o){s1||!(this.children[0]instanceof Co))){var v=[];this.collapse(v),this.children=[new Co(v)],this.children[0].parent=this}},collapse:function(e){for(var i=0;i50){for(var p=f.lines.length%25+25,v=p;v10);e.parent.maybeSpill()}},iterN:function(e,i,s){for(var o=0;oe.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=O,e.display.maxLineChanged=!0)}o!=null&&e&&this.collapsed&&It(e,o,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Md(e.doc)),e&&ht(e,"markerCleared",e,this,o,f),i&&mn(e),this.parent&&this.parent.clear()}},Xi.prototype.find=function(e,i){e==null&&this.type=="bookmark"&&(e=1);for(var s,o,f=0;f0||p==0&&h.clearWhenEmpty!==!1)return h;if(h.replacedWith&&(h.collapsed=!0,h.widgetNode=De("span",[h.replacedWith],"CodeMirror-widget"),o.handleMouseEvents||h.widgetNode.setAttribute("cm-ignore-events","true"),o.insertLeft&&(h.widgetNode.insertLeft=!0)),h.collapsed){if(Ah(e,i.line,i,s,h)||i.line!=s.line&&Ah(e,s.line,i,s,h))throw new Error("Inserting collapsed marker partially overlapping an existing one");rv()}h.addToHistory&&bd(e,{from:i,to:s,origin:"markText"},e.sel,NaN);var v=i.line,y=e.cm,b;if(e.iter(v,s.line+1,function(H){y&&h.collapsed&&!y.options.lineWrapping&&Dr(H)==y.display.maxLine&&(b=!0),h.collapsed&&v!=i.line&&sr(H,0),nv(H,new ws(h,v==i.line?i.ch:null,v==s.line?s.ch:null),e.cm&&e.cm.curOp),++v}),h.collapsed&&e.iter(i.line,s.line+1,function(H){Ri(e,H)&&sr(H,0)}),h.clearOnEnter&&ae(h,"beforeCursorEnter",function(){return h.clear()}),h.readOnly&&(tv(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),h.collapsed&&(h.id=++Bd,h.atomic=!0),y){if(b&&(y.curOp.updateMaxLine=!0),h.collapsed)It(y,i.line,s.line+1);else if(h.className||h.startStyle||h.endStyle||h.css||h.attributes||h.title)for(var O=i.line;O<=s.line;O++)zi(y,O,"text");h.atomic&&Md(y.doc),ht(y,"markerAdded",y,h)}return h}var Lo=function(e,i){this.markers=e,this.primary=i;for(var s=0;s=0;y--)ol(this,o[y]);v?Ld(this,v):this.cm&&rl(this.cm)}),undo:ct(function(){Us(this,"undo")}),redo:ct(function(){Us(this,"redo")}),undoSelection:ct(function(){Us(this,"undo",!0)}),redoSelection:ct(function(){Us(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,i=0,s=0,o=0;o=e.ch)&&i.push(f.marker.parent||f.marker)}return i},findMarks:function(e,i,s){e=ce(this,e),i=ce(this,i);var o=[],f=e.line;return this.iter(e.line,i.line+1,function(h){var p=h.markedSpans;if(p)for(var v=0;v=y.to||y.from==null&&f!=e.line||y.from!=null&&f==i.line&&y.from>=i.ch)&&(!s||s(y.marker))&&o.push(y.marker.parent||y.marker)}++f}),o},getAllMarks:function(){var e=[];return this.iter(function(i){var s=i.markedSpans;if(s)for(var o=0;oe)return i=e,!0;e-=h,++s}),ce(this,I(s,i))},indexFromPos:function(e){e=ce(this,e);var i=e.ch;if(e.linei&&(i=e.from),e.to!=null&&e.to-1){i.state.draggingText(e),setTimeout(function(){return i.display.input.focus()},20);return}try{var O=e.dataTransfer.getData("Text");if(O){var H;if(i.state.draggingText&&!i.state.draggingText.copy&&(H=i.listSelections()),zs(i.doc,Ui(s,s)),H)for(var F=0;F=0;v--)sl(e.doc,"",o[v].from,o[v].to,"+delete");rl(e)})}function Jf(e,i,s){var o=Hi(e.text,i+s,s);return o<0||o>e.text.length?null:o}function Qf(e,i,s){var o=Jf(e,i.ch,s);return o==null?null:new I(i.line,o,s<0?"after":"before")}function $f(e,i,s,o,f){if(e){i.doc.direction=="rtl"&&(f=-f);var h=Ce(s,i.doc.direction);if(h){var p=f<0?Le(h):h[0],v=f<0==(p.level==1),y=v?"after":"before",b;if(p.level>0||i.doc.direction=="rtl"){var O=$n(i,s);b=f<0?s.text.length-1:0;var H=Jr(i,O,b).top;b=jr(function(F){return Jr(i,O,F).top==H},f<0==(p.level==1)?p.from:p.to-1,b),y=="before"&&(b=Jf(s,b,1))}else b=f<0?p.to:p.from;return new I(o,b,y)}}return new I(o,f<0?s.text.length:0,f<0?"before":"after")}function Lm(e,i,s,o){var f=Ce(i,e.doc.direction);if(!f)return Qf(i,s,o);s.ch>=i.text.length?(s.ch=i.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var h=Pi(f,s.ch,s.sticky),p=f[h];if(e.doc.direction=="ltr"&&p.level%2==0&&(o>0?p.to>s.ch:p.from=p.from&&F>=O.begin)){var P=H?"before":"after";return new I(s.line,F,P)}}var R=function(Z,$,J){for(var te=function(Pe,pt){return pt?new I(s.line,v(Pe,1),"before"):new I(s.line,Pe,"after")};Z>=0&&Z0==(fe.level!=1),me=le?J.begin:v(J.end,-1);if(fe.from<=me&&me0?O.end:v(O.begin,-1);return q!=null&&!(o>0&&q==i.text.length)&&(_=R(o>0?0:f.length-1,o,b(q)),_)?_:null}var Ao={selectAll:Dd,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),lr)},killLine:function(e){return ul(e,function(i){if(i.empty()){var s=ie(e.doc,i.head.line).text.length;return i.head.ch==s&&i.head.line0)f=new I(f.line,f.ch+1),e.replaceRange(h.charAt(f.ch-1)+h.charAt(f.ch-2),I(f.line,f.ch-2),f,"+transpose");else if(f.line>e.doc.first){var p=ie(e.doc,f.line-1).text;p&&(f=new I(f.line,1),e.replaceRange(h.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),I(f.line-1,p.length-1),f,"+transpose"))}}s.push(new Me(f,f))}e.setSelections(s)})},newlineAndIndent:function(e){return Jt(e,function(){for(var i=e.listSelections(),s=i.length-1;s>=0;s--)e.replaceRange(e.doc.lineSeparator(),i[s].anchor,i[s].head,"+input");i=e.listSelections();for(var o=0;oe&&Q(i,this.pos)==0&&s==this.button};var Do,No;function Hm(e,i){var s=+new Date;return No&&No.compare(s,e,i)?(Do=No=null,"triple"):Do&&Do.compare(s,e,i)?(No=new eu(s,e,i),Do=null,"double"):(Do=new eu(s,e,i),No=null,"single")}function ec(e){var i=this,s=i.display;if(!(qe(i,e)||s.activeTouch&&s.input.supportsTouch())){if(s.input.ensurePolled(),s.shift=e.shiftKey,pi(s,e)){g||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100));return}if(!tu(i,e)){var o=dn(i,e),f=Tr(e),h=o?Hm(o,f):"single";pe(i).focus(),f==1&&i.state.selectingText&&i.state.selectingText(e),!(o&&Wm(i,f,o,h,e))&&(f==1?o?Fm(i,o,h,e):to(e)==s.scroller&&Ct(e):f==2?(o&&Rs(i.doc,o),setTimeout(function(){return s.input.focus()},20)):f==3&&(we?i.display.input.onContextMenu(e):Ff(i)))}}}function Wm(e,i,s,o,f){var h="Click";return o=="double"?h="Double"+h:o=="triple"&&(h="Triple"+h),h=(i==1?"Left":i==2?"Middle":"Right")+h,Oo(e,Xd(h,f),f,function(p){if(typeof p=="string"&&(p=Ao[p]),!p)return!1;var v=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),v=p(e,s)!=Ni}finally{e.state.suppressEdits=!1}return v})}function Pm(e,i,s){var o=e.getOption("configureMouse"),f=o?o(e,i,s):{};if(f.unit==null){var h=B?s.shiftKey&&s.metaKey:s.altKey;f.unit=h?"rectangle":i=="single"?"char":i=="double"?"word":"line"}return(f.extend==null||e.doc.extend)&&(f.extend=e.doc.extend||s.shiftKey),f.addNew==null&&(f.addNew=E?s.metaKey:s.ctrlKey),f.moveOnDrag==null&&(f.moveOnDrag=!(E?s.altKey:s.ctrlKey)),f}function Fm(e,i,s,o){d?setTimeout(ue(td,e),0):e.curOp.focus=ze(bt(e));var f=Pm(e,s,o),h=e.doc.sel,p;e.options.dragDrop&&cf&&!e.isReadOnly()&&s=="single"&&(p=h.contains(i))>-1&&(Q((p=h.ranges[p]).from(),i)<0||i.xRel>0)&&(Q(p.to(),i)>0||i.xRel<0)?Em(e,o,i,f):Im(e,o,i,f)}function Em(e,i,s,o){var f=e.display,h=!1,p=dt(e,function(b){g&&(f.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ff(e)),wt(f.wrapper.ownerDocument,"mouseup",p),wt(f.wrapper.ownerDocument,"mousemove",v),wt(f.scroller,"dragstart",y),wt(f.scroller,"drop",p),h||(Ct(b),o.addNew||Rs(e.doc,s,null,null,o.extend),g&&!A||d&&c==9?setTimeout(function(){f.wrapper.ownerDocument.body.focus({preventScroll:!0}),f.input.focus()},20):f.input.focus())}),v=function(b){h=h||Math.abs(i.clientX-b.clientX)+Math.abs(i.clientY-b.clientY)>=10},y=function(){return h=!0};g&&(f.scroller.draggable=!0),e.state.draggingText=p,p.copy=!o.moveOnDrag,ae(f.wrapper.ownerDocument,"mouseup",p),ae(f.wrapper.ownerDocument,"mousemove",v),ae(f.scroller,"dragstart",y),ae(f.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return f.input.focus()},20),f.scroller.dragDrop&&f.scroller.dragDrop()}function tc(e,i,s){if(s=="char")return new Me(i,i);if(s=="word")return e.findWordAt(i);if(s=="line")return new Me(I(i.line,0),ce(e.doc,I(i.line+1,0)));var o=s(e,i);return new Me(o.from,o.to)}function Im(e,i,s,o){d&&Ff(e);var f=e.display,h=e.doc;Ct(i);var p,v,y=h.sel,b=y.ranges;if(o.addNew&&!o.extend?(v=h.sel.contains(s),v>-1?p=b[v]:p=new Me(s,s)):(p=h.sel.primary(),v=h.sel.primIndex),o.unit=="rectangle")o.addNew||(p=new Me(s,s)),s=dn(e,i,!0,!0),v=-1;else{var O=tc(e,s,o.unit);o.extend?p=Yf(p,O.anchor,O.head,o.extend):p=O}o.addNew?v==-1?(v=b.length,St(h,Hr(e,b.concat([p]),v),{scroll:!1,origin:"*mouse"})):b.length>1&&b[v].empty()&&o.unit=="char"&&!o.extend?(St(h,Hr(e,b.slice(0,v).concat(b.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=h.sel):Zf(h,v,p,Kr):(v=0,St(h,new ar([p],0),Kr),y=h.sel);var H=s;function F(J){if(Q(H,J)!=0)if(H=J,o.unit=="rectangle"){for(var te=[],fe=e.options.tabSize,le=Oe(ie(h,s.line).text,s.ch,fe),me=Oe(ie(h,J.line).text,J.ch,fe),Pe=Math.min(le,me),pt=Math.max(le,me),Ke=Math.min(s.line,J.line),Qt=Math.min(e.lastLine(),Math.max(s.line,J.line));Ke<=Qt;Ke++){var Rt=ie(h,Ke).text,it=Xr(Rt,Pe,fe);Pe==pt?te.push(new Me(I(Ke,it),I(Ke,it))):Rt.length>it&&te.push(new Me(I(Ke,it),I(Ke,Xr(Rt,pt,fe))))}te.length||te.push(new Me(s,s)),St(h,Hr(e,y.ranges.slice(0,v).concat(te),v),{origin:"*mouse",scroll:!1}),e.scrollIntoView(J)}else{var zt=p,xt=tc(e,J,o.unit),lt=zt.anchor,nt;Q(xt.anchor,lt)>0?(nt=xt.head,lt=Zn(zt.from(),xt.anchor)):(nt=xt.anchor,lt=Et(zt.to(),xt.head));var Ze=y.ranges.slice(0);Ze[v]=Bm(e,new Me(ce(h,lt),nt)),St(h,Hr(e,Ze,v),Kr)}}var P=f.wrapper.getBoundingClientRect(),R=0;function _(J){var te=++R,fe=dn(e,J,!0,o.unit=="rectangle");if(fe)if(Q(fe,H)!=0){e.curOp.focus=ze(bt(e)),F(fe);var le=Ws(f,h);(fe.line>=le.to||fe.lineP.bottom?20:0;me&&setTimeout(dt(e,function(){R==te&&(f.scroller.scrollTop+=me,_(J))}),50)}}function q(J){e.state.selectingText=!1,R=1/0,J&&(Ct(J),f.input.focus()),wt(f.wrapper.ownerDocument,"mousemove",Z),wt(f.wrapper.ownerDocument,"mouseup",$),h.history.lastSelOrigin=null}var Z=dt(e,function(J){J.buttons===0||!Tr(J)?q(J):_(J)}),$=dt(e,q);e.state.selectingText=$,ae(f.wrapper.ownerDocument,"mousemove",Z),ae(f.wrapper.ownerDocument,"mouseup",$)}function Bm(e,i){var s=i.anchor,o=i.head,f=ie(e.doc,s.line);if(Q(s,o)==0&&s.sticky==o.sticky)return i;var h=Ce(f);if(!h)return i;var p=Pi(h,s.ch,s.sticky),v=h[p];if(v.from!=s.ch&&v.to!=s.ch)return i;var y=p+(v.from==s.ch==(v.level!=1)?0:1);if(y==0||y==h.length)return i;var b;if(o.line!=s.line)b=(o.line-s.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var O=Pi(h,o.ch,o.sticky),H=O-p||(o.ch-s.ch)*(v.level==1?-1:1);O==y-1||O==y?b=H<0:b=H>0}var F=h[y+(b?-1:0)],P=b==(F.level==1),R=P?F.from:F.to,_=P?"after":"before";return s.ch==R&&s.sticky==_?i:new Me(new I(s.line,R,_),o)}function rc(e,i,s,o){var f,h;if(i.touches)f=i.touches[0].clientX,h=i.touches[0].clientY;else try{f=i.clientX,h=i.clientY}catch{return!1}if(f>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;o&&Ct(i);var p=e.display,v=p.lineDiv.getBoundingClientRect();if(h>v.bottom||!Zt(e,s))return Ft(i);h-=v.top-p.viewOffset;for(var y=0;y=f){var O=N(e.doc,h),H=e.display.gutterSpecs[y];return je(e,s,e,O,H.className,i),Ft(i)}}}function tu(e,i){return rc(e,i,"gutterClick",!0)}function ic(e,i){pi(e.display,i)||Rm(e,i)||qe(e,i,"contextmenu")||we||e.display.input.onContextMenu(i)}function Rm(e,i){return Zt(e,"gutterContextMenu")?rc(e,i,"gutterContextMenu",!1):!1}function nc(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),uo(e)}var hl={toString:function(){return"CodeMirror.Init"}},lc={},js={};function zm(e){var i=e.optionHandlers;function s(o,f,h,p){e.defaults[o]=f,h&&(i[o]=p?function(v,y,b){b!=hl&&h(v,y,b)}:h)}e.defineOption=s,e.Init=hl,s("value","",function(o,f){return o.setValue(f)},!0),s("mode",null,function(o,f){o.doc.modeOption=f,Xf(o)},!0),s("indentUnit",2,Xf,!0),s("indentWithTabs",!1),s("smartIndent",!0),s("tabSize",4,function(o){xo(o),uo(o),It(o)},!0),s("lineSeparator",null,function(o,f){if(o.doc.lineSep=f,!!f){var h=[],p=o.doc.first;o.doc.iter(function(y){for(var b=0;;){var O=y.text.indexOf(f,b);if(O==-1)break;b=O+f.length,h.push(I(p,O))}p++});for(var v=h.length-1;v>=0;v--)sl(o.doc,f,h[v],I(h[v].line,h[v].ch+f.length))}}),s("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(o,f,h){o.state.specialChars=new RegExp(f.source+(f.test(" ")?"":"| "),"g"),h!=hl&&o.refresh()}),s("specialCharPlaceholder",gv,function(o){return o.refresh()},!0),s("electricChars",!0),s("inputStyle",D?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),s("spellcheck",!1,function(o,f){return o.getInputField().spellcheck=f},!0),s("autocorrect",!1,function(o,f){return o.getInputField().autocorrect=f},!0),s("autocapitalize",!1,function(o,f){return o.getInputField().autocapitalize=f},!0),s("rtlMoveVisually",!K),s("wholeLineUpdateBefore",!0),s("theme","default",function(o){nc(o),yo(o)},!0),s("keyMap","default",function(o,f,h){var p=Ks(f),v=h!=hl&&Ks(h);v&&v.detach&&v.detach(o,p),p.attach&&p.attach(o,v||null)}),s("extraKeys",null),s("configureMouse",null),s("lineWrapping",!1,Um,!0),s("gutters",[],function(o,f){o.display.gutterSpecs=_f(f,o.options.lineNumbers),yo(o)},!0),s("fixedGutter",!0,function(o,f){o.display.gutters.style.left=f?Nf(o.display)+"px":"0",o.refresh()},!0),s("coverGutterNextToScrollbar",!1,function(o){return il(o)},!0),s("scrollbarStyle","native",function(o){sd(o),il(o),o.display.scrollbars.setScrollTop(o.doc.scrollTop),o.display.scrollbars.setScrollLeft(o.doc.scrollLeft)},!0),s("lineNumbers",!1,function(o,f){o.display.gutterSpecs=_f(o.options.gutters,f),yo(o)},!0),s("firstLineNumber",1,yo,!0),s("lineNumberFormatter",function(o){return o},yo,!0),s("showCursorWhenSelecting",!1,ho,!0),s("resetSelectionOnContextMenu",!0),s("lineWiseCopyCut",!0),s("pasteLinesPerSelection",!0),s("selectionsMayTouch",!1),s("readOnly",!1,function(o,f){f=="nocursor"&&(tl(o),o.display.input.blur()),o.display.input.readOnlyChanged(f)}),s("screenReaderLabel",null,function(o,f){f=f===""?null:f,o.display.input.screenReaderLabelChanged(f)}),s("disableInput",!1,function(o,f){f||o.display.input.reset()},!0),s("dragDrop",!0,Gm),s("allowDropFileTypes",null),s("cursorBlinkRate",530),s("cursorScrollMargin",0),s("cursorHeight",1,ho,!0),s("singleCursorHeightPerLine",!0,ho,!0),s("workTime",100),s("workDelay",100),s("flattenSpans",!0,xo,!0),s("addModeClass",!1,xo,!0),s("pollInterval",100),s("undoDepth",200,function(o,f){return o.doc.history.undoDepth=f}),s("historyEventDelay",1250),s("viewportMargin",10,function(o){return o.refresh()},!0),s("maxHighlightLength",1e4,xo,!0),s("moveInputWithCursor",!0,function(o,f){f||o.display.input.resetPosition()}),s("tabindex",null,function(o,f){return o.display.input.getField().tabIndex=f||""}),s("autofocus",null),s("direction","ltr",function(o,f){return o.doc.setDirection(f)},!0),s("phrases",null)}function Gm(e,i,s){var o=s&&s!=hl;if(!i!=!o){var f=e.display.dragFunctions,h=i?ae:wt;h(e.display.scroller,"dragstart",f.start),h(e.display.scroller,"dragenter",f.enter),h(e.display.scroller,"dragover",f.over),h(e.display.scroller,"dragleave",f.leave),h(e.display.scroller,"drop",f.drop)}}function Um(e){e.options.lineWrapping?(Ee(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ke(e.display.wrapper,"CodeMirror-wrap"),wf(e)),Hf(e),It(e),uo(e),setTimeout(function(){return il(e)},100)}function Ge(e,i){var s=this;if(!(this instanceof Ge))return new Ge(e,i);this.options=i=i?ye(i):{},ye(lc,i,!1);var o=i.value;typeof o=="string"?o=new Bt(o,i.mode,null,i.lineSeparator,i.direction):i.mode&&(o.modeOption=i.mode),this.doc=o;var f=new Ge.inputStyles[i.inputStyle](this),h=this.display=new tm(e,o,f,i);h.wrapper.CodeMirror=this,nc(this),i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),sd(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},i.autofocus&&!D&&h.input.focus(),d&&c<11&&setTimeout(function(){return s.display.input.reset(!0)},20),_m(this),bm(),vn(this),this.curOp.forceUpdate=!0,md(this,o),i.autofocus&&!D||this.hasFocus()?setTimeout(function(){s.hasFocus()&&!s.state.focused&&Ef(s)},20):tl(this);for(var p in js)js.hasOwnProperty(p)&&js[p](this,i[p],hl);ud(this),i.finishInit&&i.finishInit(this);for(var v=0;v20*20}ae(i.scroller,"touchstart",function(y){if(!qe(e,y)&&!h(y)&&!tu(e,y)){i.input.ensurePolled(),clearTimeout(s);var b=+new Date;i.activeTouch={start:b,moved:!1,prev:b-o.end<=300?o:null},y.touches.length==1&&(i.activeTouch.left=y.touches[0].pageX,i.activeTouch.top=y.touches[0].pageY)}}),ae(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ae(i.scroller,"touchend",function(y){var b=i.activeTouch;if(b&&!pi(i,y)&&b.left!=null&&!b.moved&&new Date-b.start<300){var O=e.coordsChar(i.activeTouch,"page"),H;!b.prev||p(b,b.prev)?H=new Me(O,O):!b.prev.prev||p(b,b.prev.prev)?H=e.findWordAt(O):H=new Me(I(O.line,0),ce(e.doc,I(O.line+1,0))),e.setSelection(H.anchor,H.head),e.focus(),Ct(y)}f()}),ae(i.scroller,"touchcancel",f),ae(i.scroller,"scroll",function(){i.scroller.clientHeight&&(po(e,i.scroller.scrollTop),pn(e,i.scroller.scrollLeft,!0),je(e,"scroll",e))}),ae(i.scroller,"mousewheel",function(y){return cd(e,y)}),ae(i.scroller,"DOMMouseScroll",function(y){return cd(e,y)}),ae(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(y){qe(e,y)||Fi(y)},over:function(y){qe(e,y)||(xm(e,y),Fi(y))},start:function(y){return ym(e,y)},drop:dt(e,mm),leave:function(y){qe(e,y)||Gd(e)}};var v=i.input.getField();ae(v,"keyup",function(y){return $d.call(e,y)}),ae(v,"keydown",dt(e,Qd)),ae(v,"keypress",dt(e,Vd)),ae(v,"focus",function(y){return Ef(e,y)}),ae(v,"blur",function(y){return tl(e,y)})}var ru=[];Ge.defineInitHook=function(e){return ru.push(e)};function Ho(e,i,s,o){var f=e.doc,h;s==null&&(s="add"),s=="smart"&&(f.mode.indent?h=lo(e,i).state:s="prev");var p=e.options.tabSize,v=ie(f,i),y=Oe(v.text,null,p);v.stateAfter&&(v.stateAfter=null);var b=v.text.match(/^\s*/)[0],O;if(!o&&!/\S/.test(v.text))O=0,s="not";else if(s=="smart"&&(O=f.mode.indent(h,v.text.slice(b.length),v.text),O==Ni||O>150)){if(!o)return;s="prev"}s=="prev"?i>f.first?O=Oe(ie(f,i-1).text,null,p):O=0:s=="add"?O=y+e.options.indentUnit:s=="subtract"?O=y-e.options.indentUnit:typeof s=="number"&&(O=y+s),O=Math.max(0,O);var H="",F=0;if(e.options.indentWithTabs)for(var P=Math.floor(O/p);P;--P)F+=p,H+=" ";if(Fp,y=cr(i),b=null;if(v&&o.ranges.length>1)if(Wr&&Wr.text.join(` -`)==i){if(o.ranges.length%Wr.text.length==0){b=[];for(var O=0;O=0;F--){var P=o.ranges[F],R=P.from(),_=P.to();P.empty()&&(s&&s>0?R=I(R.line,R.ch-s):e.state.overwrite&&!v?_=I(_.line,Math.min(ie(h,_.line).text.length,_.ch+Le(y).length)):v&&Wr&&Wr.lineWise&&Wr.text.join(` -`)==y.join(` -`)&&(R=_=I(R.line,0)));var q={from:R,to:_,text:b?b[F%b.length]:y,origin:f||(v?"paste":e.state.cutIncoming>p?"cut":"+input")};ol(e.doc,q),ht(e,"inputRead",e,q)}i&&!v&&sc(e,i),rl(e),e.curOp.updateInput<2&&(e.curOp.updateInput=H),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function oc(e,i){var s=e.clipboardData&&e.clipboardData.getData("Text");if(s)return e.preventDefault(),!i.isReadOnly()&&!i.options.disableInput&&i.hasFocus()&&Jt(i,function(){return iu(i,s,0,null,"paste")}),!0}function sc(e,i){if(!(!e.options.electricChars||!e.options.smartIndent))for(var s=e.doc.sel,o=s.ranges.length-1;o>=0;o--){var f=s.ranges[o];if(!(f.head.ch>100||o&&s.ranges[o-1].head.line==f.head.line)){var h=e.getModeAt(f.head),p=!1;if(h.electricChars){for(var v=0;v-1){p=Ho(e,f.head.line,"smart");break}}else h.electricInput&&h.electricInput.test(ie(e.doc,f.head.line).text.slice(0,f.head.ch))&&(p=Ho(e,f.head.line,"smart"));p&&ht(e,"electricInput",e,f.head.line)}}}function ac(e){for(var i=[],s=[],o=0;oh&&(Ho(this,v.head.line,o,!0),h=v.head.line,p==this.doc.sel.primIndex&&rl(this));else{var y=v.from(),b=v.to(),O=Math.max(h,y.line);h=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var H=O;H0&&Zf(this.doc,p,new Me(y,F[p].to()),lr)}}}),getTokenAt:function(o,f){return xh(this,o,f)},getLineTokens:function(o,f){return xh(this,I(o),f,!0)},getTokenTypeAt:function(o){o=ce(this.doc,o);var f=vh(this,ie(this.doc,o.line)),h=0,p=(f.length-1)/2,v=o.ch,y;if(v==0)y=f[2];else for(;;){var b=h+p>>1;if((b?f[b*2-1]:0)>=v)p=b;else if(f[b*2+1]y&&(o=y,p=!0),v=ie(this.doc,o)}else v=o;return As(this,v,{top:0,left:0},f||"page",h||p).top+(p?this.doc.height-ci(v):0)},defaultTextHeight:function(){return Vn(this.display)},defaultCharWidth:function(){return el(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(o,f,h,p,v){var y=this.display;o=Nr(this,ce(this.doc,o));var b=o.bottom,O=o.left;if(f.style.position="absolute",f.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(f),y.sizer.appendChild(f),p=="over")b=o.top;else if(p=="above"||p=="near"){var H=Math.max(y.wrapper.clientHeight,this.doc.height),F=Math.max(y.sizer.clientWidth,y.lineSpace.clientWidth);(p=="above"||o.bottom+f.offsetHeight>H)&&o.top>f.offsetHeight?b=o.top-f.offsetHeight:o.bottom+f.offsetHeight<=H&&(b=o.bottom),O+f.offsetWidth>F&&(O=F-f.offsetWidth)}f.style.top=b+"px",f.style.left=f.style.right="",v=="right"?(O=y.sizer.clientWidth-f.offsetWidth,f.style.right="0px"):(v=="left"?O=0:v=="middle"&&(O=(y.sizer.clientWidth-f.offsetWidth)/2),f.style.left=O+"px"),h&&Gv(this,{left:O,top:b,right:O+f.offsetWidth,bottom:b+f.offsetHeight})},triggerOnKeyDown:Dt(Qd),triggerOnKeyPress:Dt(Vd),triggerOnKeyUp:$d,triggerOnMouseDown:Dt(ec),execCommand:function(o){if(Ao.hasOwnProperty(o))return Ao[o].call(null,this)},triggerElectric:Dt(function(o){sc(this,o)}),findPosH:function(o,f,h,p){var v=1;f<0&&(v=-1,f=-f);for(var y=ce(this.doc,o),b=0;b0&&O(h.charAt(p-1));)--p;for(;v.5||this.options.lineWrapping)&&Hf(this),je(this,"refresh",this)}),swapDoc:Dt(function(o){var f=this.doc;return f.cm=null,this.state.selectingText&&this.state.selectingText(),md(this,o),uo(this),this.display.input.reset(),co(this,o.scrollLeft,o.scrollTop),this.curOp.forceScroll=!0,ht(this,"swapDoc",this,f),f}),phrase:function(o){var f=this.options.phrases;return f&&Object.prototype.hasOwnProperty.call(f,o)?f[o]:o},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}},Lr(e),e.registerHelper=function(o,f,h){s.hasOwnProperty(o)||(s[o]=e[o]={_global:[]}),s[o][f]=h},e.registerGlobalHelper=function(o,f,h,p){e.registerHelper(o,f,p),s[o]._global.push({pred:h,val:p})}}function lu(e,i,s,o,f){var h=i,p=s,v=ie(e,i.line),y=f&&e.direction=="rtl"?-s:s;function b(){var $=i.line+y;return $=e.first+e.size?!1:(i=new I($,i.ch,i.sticky),v=ie(e,$))}function O($){var J;if(o=="codepoint"){var te=v.text.charCodeAt(i.ch+(s>0?0:-1));if(isNaN(te))J=null;else{var fe=s>0?te>=55296&&te<56320:te>=56320&&te<57343;J=new I(i.line,Math.max(0,Math.min(v.text.length,i.ch+s*(fe?2:1))),-s)}}else f?J=Lm(e.cm,v,i,s):J=Qf(v,i,s);if(J==null)if(!$&&b())i=$f(f,e.cm,v,i.line,y);else return!1;else i=J;return!0}if(o=="char"||o=="codepoint")O();else if(o=="column")O(!0);else if(o=="word"||o=="group")for(var H=null,F=o=="group",P=e.cm&&e.cm.getHelper(i,"wordChars"),R=!0;!(s<0&&!O(!R));R=!1){var _=v.text.charAt(i.ch)||` -`,q=ai(_,P)?"w":F&&_==` -`?"n":!F||/\s/.test(_)?null:"p";if(F&&!R&&!q&&(q="s"),H&&H!=q){s<0&&(s=1,O(),i.sticky="after");break}if(q&&(H=q),s>0&&!O(!R))break}var Z=Gs(e,i,h,p,!0);return Te(h,Z)&&(Z.hitSide=!0),Z}function uc(e,i,s,o){var f=e.doc,h=i.left,p;if(o=="page"){var v=Math.min(e.display.wrapper.clientHeight,pe(e).innerHeight||f(e).documentElement.clientHeight),y=Math.max(v-.5*Vn(e.display),3);p=(s>0?i.bottom:i.top)+s*y}else o=="line"&&(p=s>0?i.bottom+3:i.top-3);for(var b;b=Af(e,h,p),!!b.outside;){if(s<0?p<=0:p>=f.height){b.hitSide=!0;break}p+=s*5}return b}var Ne=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};Ne.prototype.init=function(e){var i=this,s=this,o=s.cm,f=s.div=e.lineDiv;f.contentEditable=!0,nu(f,o.options.spellcheck,o.options.autocorrect,o.options.autocapitalize);function h(v){for(var y=v.target;y;y=y.parentNode){if(y==f)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(y.className))break}return!1}ae(f,"paste",function(v){!h(v)||qe(o,v)||oc(v,o)||c<=11&&setTimeout(dt(o,function(){return i.updateFromDOM()}),20)}),ae(f,"compositionstart",function(v){i.composing={data:v.data,done:!1}}),ae(f,"compositionupdate",function(v){i.composing||(i.composing={data:v.data,done:!1})}),ae(f,"compositionend",function(v){i.composing&&(v.data!=i.composing.data&&i.readFromDOMSoon(),i.composing.done=!0)}),ae(f,"touchstart",function(){return s.forceCompositionEnd()}),ae(f,"input",function(){i.composing||i.readFromDOMSoon()});function p(v){if(!(!h(v)||qe(o,v))){if(o.somethingSelected())qs({lineWise:!1,text:o.getSelections()}),v.type=="cut"&&o.replaceSelection("",null,"cut");else if(o.options.lineWiseCopyCut){var y=ac(o);qs({lineWise:!0,text:y.text}),v.type=="cut"&&o.operation(function(){o.setSelections(y.ranges,0,lr),o.replaceSelection("",null,"cut")})}else return;if(v.clipboardData){v.clipboardData.clearData();var b=Wr.text.join(` -`);if(v.clipboardData.setData("Text",b),v.clipboardData.getData("Text")==b){v.preventDefault();return}}var O=fc(),H=O.firstChild;nu(H),o.display.lineSpace.insertBefore(O,o.display.lineSpace.firstChild),H.value=Wr.text.join(` -`);var F=ze(ft(f));nr(H),setTimeout(function(){o.display.lineSpace.removeChild(O),F.focus(),F==f&&s.showPrimarySelection()},50)}}ae(f,"copy",p),ae(f,"cut",p)},Ne.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ne.prototype.prepareSelection=function(){var e=ed(this.cm,!1);return e.focus=ze(ft(this.div))==this.div,e},Ne.prototype.showSelection=function(e,i){!e||!this.cm.display.view.length||((e.focus||i)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ne.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ne.prototype.showPrimarySelection=function(){var e=this.getSelection(),i=this.cm,s=i.doc.sel.primary(),o=s.from(),f=s.to();if(i.display.viewTo==i.display.viewFrom||o.line>=i.display.viewTo||f.line=i.display.viewFrom&&hc(i,o)||{node:v[0].measure.map[2],offset:0},b=f.linee.firstLine()&&(o=I(o.line-1,ie(e.doc,o.line-1).length)),f.ch==ie(e.doc,f.line).text.length&&f.linei.viewTo-1)return!1;var h,p,v;o.line==i.viewFrom||(h=cn(e,o.line))==0?(p=w(i.view[0].line),v=i.view[0].node):(p=w(i.view[h].line),v=i.view[h-1].node.nextSibling);var y=cn(e,f.line),b,O;if(y==i.view.length-1?(b=i.viewTo-1,O=i.lineDiv.lastChild):(b=w(i.view[y+1].line)-1,O=i.view[y+1].node.previousSibling),!v)return!1;for(var H=e.doc.splitLines(jm(e,v,O,p,b)),F=hi(e.doc,I(p,0),I(b,ie(e.doc,b).text.length));H.length>1&&F.length>1;)if(Le(H)==Le(F))H.pop(),F.pop(),b--;else if(H[0]==F[0])H.shift(),F.shift(),p++;else break;for(var P=0,R=0,_=H[0],q=F[0],Z=Math.min(_.length,q.length);Po.ch&&$.charCodeAt($.length-R-1)==J.charCodeAt(J.length-R-1);)P--,R++;H[H.length-1]=$.slice(0,$.length-R).replace(/^\u200b+/,""),H[0]=H[0].slice(P).replace(/\u200b+$/,"");var fe=I(p,P),le=I(b,F.length?Le(F).length-R:0);if(H.length>1||H[0]||Q(fe,le))return sl(e.doc,H,fe,le,"+input"),!0},Ne.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ne.prototype.reset=function(){this.forceCompositionEnd()},Ne.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ne.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Ne.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Jt(this.cm,function(){return It(e.cm)})},Ne.prototype.setUneditable=function(e){e.contentEditable="false"},Ne.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||dt(this.cm,iu)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Ne.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ne.prototype.onContextMenu=function(){},Ne.prototype.resetPosition=function(){},Ne.prototype.needsContentAttribute=!0;function hc(e,i){var s=Lf(e,i.line);if(!s||s.hidden)return null;var o=ie(e.doc,i.line),f=zh(s,o,i.line),h=Ce(o,e.doc.direction),p="left";if(h){var v=Pi(h,i.ch);p=v%2?"right":"left"}var y=_h(f.map,i.ch,p);return y.offset=y.collapse=="right"?y.end:y.start,y}function Xm(e){for(var i=e;i;i=i.parentNode)if(/CodeMirror-gutter-wrapper/.test(i.className))return!0;return!1}function dl(e,i){return i&&(e.bad=!0),e}function jm(e,i,s,o,f){var h="",p=!1,v=e.doc.lineSeparator(),y=!1;function b(P){return function(R){return R.id==P}}function O(){p&&(h+=v,y&&(h+=v),p=y=!1)}function H(P){P&&(O(),h+=P)}function F(P){if(P.nodeType==1){var R=P.getAttribute("cm-text");if(R){H(R);return}var _=P.getAttribute("cm-marker"),q;if(_){var Z=e.findMarks(I(o,0),I(f+1,0),b(+_));Z.length&&(q=Z[0].find(0))&&H(hi(e.doc,q.from,q.to).join(v));return}if(P.getAttribute("contenteditable")=="false")return;var $=/^(pre|div|p|li|table|br)$/i.test(P.nodeName);if(!/^br$/i.test(P.nodeName)&&P.textContent.length==0)return;$&&O();for(var J=0;J=9&&i.hasSelection&&(i.hasSelection=null),s.poll()}),ae(f,"paste",function(p){qe(o,p)||oc(p,o)||(o.state.pasteIncoming=+new Date,s.fastPoll())});function h(p){if(!qe(o,p)){if(o.somethingSelected())qs({lineWise:!1,text:o.getSelections()});else if(o.options.lineWiseCopyCut){var v=ac(o);qs({lineWise:!0,text:v.text}),p.type=="cut"?o.setSelections(v.ranges,null,lr):(s.prevInput="",f.value=v.text.join(` -`),nr(f))}else return;p.type=="cut"&&(o.state.cutIncoming=+new Date)}}ae(f,"cut",h),ae(f,"copy",h),ae(e.scroller,"paste",function(p){if(!(pi(e,p)||qe(o,p))){if(!f.dispatchEvent){o.state.pasteIncoming=+new Date,s.focus();return}var v=new Event("paste");v.clipboardData=p.clipboardData,f.dispatchEvent(v)}}),ae(e.lineSpace,"selectstart",function(p){pi(e,p)||Ct(p)}),ae(f,"compositionstart",function(){var p=o.getCursor("from");s.composing&&s.composing.range.clear(),s.composing={start:p,range:o.markText(p,o.getCursor("to"),{className:"CodeMirror-composing"})}}),ae(f,"compositionend",function(){s.composing&&(s.poll(),s.composing.range.clear(),s.composing=null)})},$e.prototype.createField=function(e){this.wrapper=fc(),this.textarea=this.wrapper.firstChild;var i=this.cm.options;nu(this.textarea,i.spellcheck,i.autocorrect,i.autocapitalize)},$e.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},$e.prototype.prepareSelection=function(){var e=this.cm,i=e.display,s=e.doc,o=ed(e);if(e.options.moveInputWithCursor){var f=Nr(e,s.sel.primary().head,"div"),h=i.wrapper.getBoundingClientRect(),p=i.lineDiv.getBoundingClientRect();o.teTop=Math.max(0,Math.min(i.wrapper.clientHeight-10,f.top+p.top-h.top)),o.teLeft=Math.max(0,Math.min(i.wrapper.clientWidth-10,f.left+p.left-h.left))}return o},$e.prototype.showSelection=function(e){var i=this.cm,s=i.display;Y(s.cursorDiv,e.cursors),Y(s.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$e.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var i=this.cm;if(this.resetting=!0,i.somethingSelected()){this.prevInput="";var s=i.getSelection();this.textarea.value=s,i.state.focused&&nr(this.textarea),d&&c>=9&&(this.hasSelection=s)}else e||(this.prevInput=this.textarea.value="",d&&c>=9&&(this.hasSelection=null));this.resetting=!1}},$e.prototype.getField=function(){return this.textarea},$e.prototype.supportsTouch=function(){return!1},$e.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!D||ze(ft(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},$e.prototype.blur=function(){this.textarea.blur()},$e.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$e.prototype.receivedFocus=function(){this.slowPoll()},$e.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$e.prototype.fastPoll=function(){var e=!1,i=this;i.pollingFast=!0;function s(){var o=i.poll();!o&&!e?(e=!0,i.polling.set(60,s)):(i.pollingFast=!1,i.slowPoll())}i.polling.set(20,s)},$e.prototype.poll=function(){var e=this,i=this.cm,s=this.textarea,o=this.prevInput;if(this.contextMenuPending||this.resetting||!i.state.focused||Ii(s)&&!o&&!this.composing||i.isReadOnly()||i.options.disableInput||i.state.keySeq)return!1;var f=s.value;if(f==o&&!i.somethingSelected())return!1;if(d&&c>=9&&this.hasSelection===f||E&&/[\uf700-\uf7ff]/.test(f))return i.display.input.reset(),!1;if(i.doc.sel==i.display.selForContextMenu){var h=f.charCodeAt(0);if(h==8203&&!o&&(o="\u200B"),h==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,v=Math.min(o.length,f.length);p1e3||f.indexOf(` -`)>-1?s.value=e.prevInput="":e.prevInput=f,e.composing&&(e.composing.range.clear(),e.composing.range=i.markText(e.composing.start,i.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$e.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$e.prototype.onKeyPress=function(){d&&c>=9&&(this.hasSelection=null),this.fastPoll()},$e.prototype.onContextMenu=function(e){var i=this,s=i.cm,o=s.display,f=i.textarea;i.contextMenuPending&&i.contextMenuPending();var h=dn(s,e),p=o.scroller.scrollTop;if(!h||k)return;var v=s.options.resetSelectionOnContextMenu;v&&s.doc.sel.contains(h)==-1&&dt(s,St)(s.doc,Ui(h),lr);var y=f.style.cssText,b=i.wrapper.style.cssText,O=i.wrapper.offsetParent.getBoundingClientRect();i.wrapper.style.cssText="position: static",f.style.cssText=`position: absolute; width: 30px; height: 30px; - top: `+(e.clientY-O.top-5)+"px; left: "+(e.clientX-O.left-5)+`px; - z-index: 1000; background: `+(d?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var H;g&&(H=f.ownerDocument.defaultView.scrollY),o.input.focus(),g&&f.ownerDocument.defaultView.scrollTo(null,H),o.input.reset(),s.somethingSelected()||(f.value=i.prevInput=" "),i.contextMenuPending=P,o.selForContextMenu=s.doc.sel,clearTimeout(o.detectingSelectAll);function F(){if(f.selectionStart!=null){var _=s.somethingSelected(),q="\u200B"+(_?f.value:"");f.value="\u21DA",f.value=q,i.prevInput=_?"":"\u200B",f.selectionStart=1,f.selectionEnd=q.length,o.selForContextMenu=s.doc.sel}}function P(){if(i.contextMenuPending==P&&(i.contextMenuPending=!1,i.wrapper.style.cssText=b,f.style.cssText=y,d&&c<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=p),f.selectionStart!=null)){(!d||d&&c<9)&&F();var _=0,q=function(){o.selForContextMenu==s.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&i.prevInput=="\u200B"?dt(s,Dd)(s):_++<10?o.detectingSelectAll=setTimeout(q,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(q,200)}}if(d&&c>=9&&F(),we){Fi(e);var R=function(){wt(window,"mouseup",R),setTimeout(P,20)};ae(window,"mouseup",R)}else setTimeout(P,50)},$e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},$e.prototype.setUneditable=function(){},$e.prototype.needsContentAttribute=!1;function Ym(e,i){if(i=i?ye(i):{},i.value=e.value,!i.tabindex&&e.tabIndex&&(i.tabindex=e.tabIndex),!i.placeholder&&e.placeholder&&(i.placeholder=e.placeholder),i.autofocus==null){var s=ze(ft(e));i.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function o(){e.value=v.getValue()}var f;if(e.form&&(ae(e.form,"submit",o),!i.leaveSubmitMethodAlone)){var h=e.form;f=h.submit;try{var p=h.submit=function(){o(),h.submit=f,h.submit(),h.submit=p}}catch{}}i.finishInit=function(y){y.save=o,y.getTextArea=function(){return e},y.toTextArea=function(){y.toTextArea=isNaN,o(),e.parentNode.removeChild(y.getWrapperElement()),e.style.display="",e.form&&(wt(e.form,"submit",o),!i.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var v=Ge(function(y){return e.parentNode.insertBefore(y,e.nextSibling)},i);return v}function Zm(e){e.off=wt,e.on=ae,e.wheelEventPixels=rm,e.Doc=Bt,e.splitLines=cr,e.countColumn=Oe,e.findColumn=Xr,e.isWordChar=eo,e.Pass=Ni,e.signal=je,e.Line=Jn,e.changeEnd=_i,e.scrollbarModel=od,e.Pos=I,e.cmpPos=Q,e.modes=Kn,e.mimeModes=Ar,e.resolveMode=Xn,e.getMode=jn,e.modeExtensions=Bi,e.extendMode=qn,e.copyState=qr,e.startState=Yn,e.innerMode=io,e.commands=Ao,e.keyMap=vi,e.keyName=jd,e.isModifierKey=Kd,e.lookupKey=fl,e.normalizeKeyMap=km,e.StringStream=Ye,e.SharedTextMarker=Lo,e.TextMarker=Xi,e.LineWidget=ko,e.e_preventDefault=Ct,e.e_stopPropagation=Un,e.e_stop=Fi,e.addClass=Ee,e.contains=_e,e.rmClass=ke,e.keyNames=ji}zm(Ge),Km(Ge);var Jm="iter insert remove copy getEditor constructor".split(" ");for(var Zs in Bt.prototype)Bt.prototype.hasOwnProperty(Zs)&&ve(Jm,Zs)<0&&(Ge.prototype[Zs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Bt.prototype[Zs]));return Lr(Bt),Ge.inputStyles={textarea:$e,contenteditable:Ne},Ge.defineMode=function(e){!Ge.defaults.mode&&e!="null"&&(Ge.defaults.mode=e),Or.apply(this,arguments)},Ge.defineMIME=fn,Ge.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ge.defineMIME("text/plain","null"),Ge.defineExtension=function(e,i){Ge.prototype[e]=i},Ge.defineDocExtension=function(e,i){Bt.prototype[e]=i},Ge.fromTextArea=Ym,Zm(Ge),Ge.version="5.65.19",Ge})});var cg=Ut((hg,dg)=>{(function(t){typeof hg=="object"&&typeof dg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(r,n){var l=r.indentUnit,a=n.statementIndent,u=n.jsonld,d=n.json||u,c=n.trackScope!==!1,g=n.typescript,m=n.wordCharacters||/[\w$\xa1-\uffff]/,x=function(){function w(ut){return{type:ut,style:"keyword"}}var N=w("keyword a"),G=w("keyword b"),j=w("keyword c"),I=w("keyword d"),Q=w("operator"),Te={type:"atom",style:"atom"};return{if:w("if"),while:N,with:N,else:G,do:G,try:G,finally:G,return:I,break:I,continue:I,new:w("new"),delete:j,void:j,throw:j,debugger:w("debugger"),var:w("var"),const:w("var"),let:w("var"),function:w("function"),catch:w("catch"),for:w("for"),switch:w("switch"),case:w("case"),default:w("default"),in:Q,typeof:Q,instanceof:Q,true:Te,false:Te,null:Te,undefined:Te,NaN:Te,Infinity:Te,this:w("this"),class:w("class"),super:w("atom"),yield:j,export:w("export"),import:w("import"),extends:j,await:j}}(),S=/[+\-*&%=<>!?|~^@]/,k=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function A(w){for(var N=!1,G,j=!1;(G=w.next())!=null;){if(!N){if(G=="/"&&!j)return;G=="["?j=!0:j&&G=="]"&&(j=!1)}N=!N&&G=="\\"}}var T,L;function C(w,N,G){return T=w,L=G,N}function M(w,N){var G=w.next();if(G=='"'||G=="'")return N.tokenize=D(G),N.tokenize(w,N);if(G=="."&&w.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return C("number","number");if(G=="."&&w.match(".."))return C("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(G))return C(G);if(G=="="&&w.eat(">"))return C("=>","operator");if(G=="0"&&w.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return C("number","number");if(/\d/.test(G))return w.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),C("number","number");if(G=="/")return w.eat("*")?(N.tokenize=E,E(w,N)):w.eat("/")?(w.skipToEnd(),C("comment","comment")):sr(w,N,1)?(A(w),w.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),C("regexp","string-2")):(w.eat("="),C("operator","operator",w.current()));if(G=="`")return N.tokenize=B,B(w,N);if(G=="#"&&w.peek()=="!")return w.skipToEnd(),C("meta","meta");if(G=="#"&&w.eatWhile(m))return C("variable","property");if(G=="<"&&w.match("!--")||G=="-"&&w.match("->")&&!/\S/.test(w.string.slice(0,w.start)))return w.skipToEnd(),C("comment","comment");if(S.test(G))return(G!=">"||!N.lexical||N.lexical.type!=">")&&(w.eat("=")?(G=="!"||G=="=")&&w.eat("="):/[<>*+\-|&?]/.test(G)&&(w.eat(G),G==">"&&w.eat(G))),G=="?"&&w.eat(".")?C("."):C("operator","operator",w.current());if(m.test(G)){w.eatWhile(m);var j=w.current();if(N.lastType!="."){if(x.propertyIsEnumerable(j)){var I=x[j];return C(I.type,I.style,j)}if(j=="async"&&w.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return C("async","keyword",j)}return C("variable","variable",j)}}function D(w){return function(N,G){var j=!1,I;if(u&&N.peek()=="@"&&N.match(k))return G.tokenize=M,C("jsonld-keyword","meta");for(;(I=N.next())!=null&&!(I==w&&!j);)j=!j&&I=="\\";return j||(G.tokenize=M),C("string","string")}}function E(w,N){for(var G=!1,j;j=w.next();){if(j=="/"&&G){N.tokenize=M;break}G=j=="*"}return C("comment","comment")}function B(w,N){for(var G=!1,j;(j=w.next())!=null;){if(!G&&(j=="`"||j=="$"&&w.eat("{"))){N.tokenize=M;break}G=!G&&j=="\\"}return C("quasi","string-2",w.current())}var K="([{}])";function X(w,N){N.fatArrowAt&&(N.fatArrowAt=null);var G=w.string.indexOf("=>",w.start);if(!(G<0)){if(g){var j=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(w.string.slice(w.start,G));j&&(G=j.index)}for(var I=0,Q=!1,Te=G-1;Te>=0;--Te){var ut=w.string.charAt(Te),Et=K.indexOf(ut);if(Et>=0&&Et<3){if(!I){++Te;break}if(--I==0){ut=="("&&(Q=!0);break}}else if(Et>=3&&Et<6)++I;else if(m.test(ut))Q=!0;else if(/["'\/`]/.test(ut))for(;;--Te){if(Te==0)return;var Zn=w.string.charAt(Te-1);if(Zn==ut&&w.string.charAt(Te-2)!="\\"){Te--;break}}else if(Q&&!I){++Te;break}}Q&&!I&&(N.fatArrowAt=Te)}}var ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function we(w,N,G,j,I,Q){this.indented=w,this.column=N,this.type=G,this.prev=I,this.info=Q,j!=null&&(this.align=j)}function he(w,N){if(!c)return!1;for(var G=w.localVars;G;G=G.next)if(G.name==N)return!0;for(var j=w.context;j;j=j.prev)for(var G=j.vars;G;G=G.next)if(G.name==N)return!0}function ke(w,N,G,j,I){var Q=w.cc;for(z.state=w,z.stream=I,z.marked=null,z.cc=Q,z.style=N,w.lexical.hasOwnProperty("align")||(w.lexical.align=!0);;){var Te=Q.length?Q.pop():d?ve:Oe;if(Te(G,j)){for(;Q.length&&Q[Q.length-1].lex;)Q.pop()();return z.marked?z.marked:G=="variable"&&he(w,j)?"variable-2":N}}}var z={state:null,column:null,marked:null,cc:null};function Y(){for(var w=arguments.length-1;w>=0;w--)z.cc.push(arguments[w])}function W(){return Y.apply(null,arguments),!0}function De(w,N){for(var G=N;G;G=G.next)if(G.name==w)return!0;return!1}function Qe(w){var N=z.state;if(z.marked="def",!!c){if(N.context){if(N.lexical.info=="var"&&N.context&&N.context.block){var G=_e(w,N.context);if(G!=null){N.context=G;return}}else if(!De(w,N.localVars)){N.localVars=new Be(w,N.localVars);return}}n.globalVars&&!De(w,N.globalVars)&&(N.globalVars=new Be(w,N.globalVars))}}function _e(w,N){if(N)if(N.block){var G=_e(w,N.prev);return G?G==N.prev?N:new Ee(G,N.vars,!0):null}else return De(w,N.vars)?N:new Ee(N.prev,new Be(w,N.vars),!1);else return null}function ze(w){return w=="public"||w=="private"||w=="protected"||w=="abstract"||w=="readonly"}function Ee(w,N,G){this.prev=w,this.vars=N,this.block=G}function Be(w,N){this.name=w,this.next=N}var nr=new Be("this",new Be("arguments",null));function tt(){z.state.context=new Ee(z.state.context,z.state.localVars,!1),z.state.localVars=nr}function bt(){z.state.context=new Ee(z.state.context,z.state.localVars,!0),z.state.localVars=null}tt.lex=bt.lex=!0;function ft(){z.state.localVars=z.state.context.vars,z.state.context=z.state.context.prev}ft.lex=!0;function pe(w,N){var G=function(){var j=z.state,I=j.indented;if(j.lexical.type=="stat")I=j.lexical.indented;else for(var Q=j.lexical;Q&&Q.type==")"&&Q.align;Q=Q.prev)I=Q.indented;j.lexical=new we(I,z.stream.column(),w,null,j.lexical,N)};return G.lex=!0,G}function ue(){var w=z.state;w.lexical.prev&&(w.lexical.type==")"&&(w.indented=w.lexical.indented),w.lexical=w.lexical.prev)}ue.lex=!0;function ye(w){function N(G){return G==w?W():w==";"||G=="}"||G==")"||G=="]"?Y():W(N)}return N}function Oe(w,N){return w=="var"?W(pe("vardef",N),Un,ye(";"),ue):w=="keyword a"?W(pe("form"),Ni,Oe,ue):w=="keyword b"?W(pe("form"),Oe,ue):w=="keyword d"?z.stream.match(/^\s*$/,!1)?W():W(pe("stat"),Kr,ye(";"),ue):w=="debugger"?W(ye(";")):w=="{"?W(pe("}"),bt,jr,ue,ft):w==";"?W():w=="if"?(z.state.lexical.info=="else"&&z.state.cc[z.state.cc.length-1]==ue&&z.state.cc.pop()(),W(pe("form"),Ni,Oe,ue,_n)):w=="function"?W(cr):w=="for"?W(pe("form"),bt,ys,Oe,ft,ue):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form",w=="class"?w:N),Kn,ue)):w=="variable"?g&&N=="declare"?(z.marked="keyword",W(Oe)):g&&(N=="module"||N=="enum"||N=="type")&&z.stream.match(/^\s*\w/,!1)?(z.marked="keyword",N=="enum"?W(ie):N=="type"?W(xs,ye("operator"),Ce,ye(";")):W(pe("form"),Ft,ye("{"),pe("}"),jr,ue,ue)):g&&N=="namespace"?(z.marked="keyword",W(pe("form"),ve,Oe,ue)):g&&N=="abstract"?(z.marked="keyword",W(Oe)):W(pe("stat"),hf):w=="switch"?W(pe("form"),Ni,ye("{"),pe("}","switch"),bt,jr,ue,ue,ft):w=="case"?W(ve,ye(":")):w=="default"?W(ye(":")):w=="catch"?W(pe("form"),tt,_r,Oe,ue,ft):w=="export"?W(pe("stat"),Xn,ue):w=="import"?W(pe("stat"),Bi,ue):w=="async"?W(Oe):N=="@"?W(ve,Oe):Y(pe("stat"),ve,ye(";"),ue)}function _r(w){if(w=="(")return W(Mr,ye(")"))}function ve(w,N){return lr(w,N,!1)}function Ot(w,N){return lr(w,N,!0)}function Ni(w){return w!="("?Y():W(pe(")"),Kr,ye(")"),ue)}function lr(w,N,G){if(z.state.fatArrowAt==z.stream.start){var j=G?sn:Le;if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,ye("=>"),j,ft);if(w=="variable")return Y(tt,Ft,ye("=>"),j,ft)}var I=G?Xr:or;return ee.hasOwnProperty(w)?W(I):w=="function"?W(cr,I):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form"),pf,ue)):w=="keyword c"||w=="async"?W(G?Ot:ve):w=="("?W(pe(")"),Kr,ye(")"),ue,I):w=="operator"||w=="spread"?W(G?Ot:ve):w=="["?W(pe("]"),Ye,ue,I):w=="{"?Hi(ai,"}",null,I):w=="quasi"?Y(si,I):w=="new"?W(uf(G)):W()}function Kr(w){return w.match(/[;\}\)\],]/)?Y():Y(ve)}function or(w,N){return w==","?W(Kr):Xr(w,N,!1)}function Xr(w,N,G){var j=G==!1?or:Xr,I=G==!1?ve:Ot;if(w=="=>")return W(tt,G?sn:Le,ft);if(w=="operator")return/\+\+|--/.test(N)||g&&N=="!"?W(j):g&&N=="<"&&z.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?W(pe(">"),rt(Ce,">"),ue,j):N=="?"?W(ve,ye(":"),I):W(I);if(w=="quasi")return Y(si,j);if(w!=";"){if(w=="(")return Hi(Ot,")","call",j);if(w==".")return W(eo,j);if(w=="[")return W(pe("]"),Kr,ye("]"),ue,j);if(g&&N=="as")return z.marked="keyword",W(Ce,j);if(w=="regexp")return z.state.lastType=z.marked="operator",z.stream.backUp(z.stream.pos-z.stream.start-1),W(I)}}function si(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(si):W(Kr,Vl)}function Vl(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(si)}function Le(w){return X(z.stream,z.state),Y(w=="{"?Oe:ve)}function sn(w){return X(z.stream,z.state),Y(w=="{"?Oe:Ot)}function uf(w){return function(N){return N=="."?W(w?gs:ps):N=="variable"&&g?W(Zt,w?Xr:or):Y(w?Ot:ve)}}function ps(w,N){if(N=="target")return z.marked="keyword",W(or)}function gs(w,N){if(N=="target")return z.marked="keyword",W(Xr)}function hf(w){return w==":"?W(ue,Oe):Y(or,ye(";"),ue)}function eo(w){if(w=="variable")return z.marked="property",W()}function ai(w,N){if(w=="async")return z.marked="property",W(ai);if(w=="variable"||z.style=="keyword"){if(z.marked="property",N=="get"||N=="set")return W(vs);var G;return g&&z.state.fatArrowAt==z.stream.start&&(G=z.stream.match(/^\s*:\s*/,!1))&&(z.state.fatArrowAt=z.stream.pos+G[0].length),W(fi)}else{if(w=="number"||w=="string")return z.marked=u?"property":z.style+" property",W(fi);if(w=="jsonld-keyword")return W(fi);if(g&&ze(N))return z.marked="keyword",W(ai);if(w=="[")return W(ve,Wi,ye("]"),fi);if(w=="spread")return W(Ot,fi);if(N=="*")return z.marked="keyword",W(ai);if(w==":")return Y(fi)}}function vs(w){return w!="variable"?Y(fi):(z.marked="property",W(cr))}function fi(w){if(w==":")return W(Ot);if(w=="(")return Y(cr)}function rt(w,N,G){function j(I,Q){if(G?G.indexOf(I)>-1:I==","){var Te=z.state.lexical;return Te.info=="call"&&(Te.pos=(Te.pos||0)+1),W(function(ut,Et){return ut==N||Et==N?Y():Y(w)},j)}return I==N||Q==N?W():G&&G.indexOf(";")>-1?Y(w):W(ye(N))}return function(I,Q){return I==N||Q==N?W():Y(w,j)}}function Hi(w,N,G){for(var j=3;j"),Ce);if(w=="quasi")return Y(wt,dr)}function ms(w){if(w=="=>")return W(Ce)}function ae(w){return w.match(/[\}\)\]]/)?W():w==","||w==";"?W(ae):Y(ui,ae)}function ui(w,N){if(w=="variable"||z.style=="keyword")return z.marked="property",W(ui);if(N=="?"||w=="number"||w=="string")return W(ui);if(w==":")return W(Ce);if(w=="[")return W(ye("variable"),an,ye("]"),ui);if(w=="(")return Y(Ii,ui);if(!w.match(/[;\}\)\],]/))return W()}function wt(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(wt):W(Ce,je)}function je(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(wt)}function qe(w,N){return w=="variable"&&z.stream.match(/^\s*[?:]/,!1)||N=="?"?W(qe):w==":"?W(Ce):w=="spread"?W(qe):Y(Ce)}function dr(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr);if(N=="|"||w=="."||N=="&")return W(Ce);if(w=="[")return W(Ce,ye("]"),dr);if(N=="extends"||N=="implements")return z.marked="keyword",W(Ce);if(N=="?")return W(Ce,ye(":"),Ce)}function Zt(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr)}function Lr(){return Y(Ce,Ct)}function Ct(w,N){if(N=="=")return W(Ce)}function Un(w,N){return N=="enum"?(z.marked="keyword",W(ie)):Y(Ft,Wi,Tr,cf)}function Ft(w,N){if(g&&ze(N))return z.marked="keyword",W(Ft);if(w=="variable")return Qe(N),W();if(w=="spread")return W(Ft);if(w=="[")return Hi(to,"]");if(w=="{")return Hi(Fi,"}")}function Fi(w,N){return w=="variable"&&!z.stream.match(/^\s*:/,!1)?(Qe(N),W(Tr)):(w=="variable"&&(z.marked="property"),w=="spread"?W(Ft):w=="}"?Y():w=="["?W(ve,ye("]"),ye(":"),Fi):W(ye(":"),Ft,Tr))}function to(){return Y(Ft,Tr)}function Tr(w,N){if(N=="=")return W(Ot)}function cf(w){if(w==",")return W(Un)}function _n(w,N){if(w=="keyword b"&&N=="else")return W(pe("form","else"),Oe,ue)}function ys(w,N){if(N=="await")return W(ys);if(w=="(")return W(pe(")"),ro,ue)}function ro(w){return w=="var"?W(Un,Ei):w=="variable"?W(Ei):Y(Ei)}function Ei(w,N){return w==")"?W():w==";"?W(Ei):N=="in"||N=="of"?(z.marked="keyword",W(ve,Ei)):Y(ve,Ei)}function cr(w,N){if(N=="*")return z.marked="keyword",W(cr);if(w=="variable")return Qe(N),W(cr);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,Oe,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,cr)}function Ii(w,N){if(N=="*")return z.marked="keyword",W(Ii);if(w=="variable")return Qe(N),W(Ii);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,Ii)}function xs(w,N){if(w=="keyword"||w=="variable")return z.marked="type",W(xs);if(N=="<")return W(pe(">"),rt(Lr,">"),ue)}function Mr(w,N){return N=="@"&&W(ve,Mr),w=="spread"?W(Mr):g&&ze(N)?(z.marked="keyword",W(Mr)):g&&w=="this"?W(Wi,Tr):Y(Ft,Wi,Tr)}function pf(w,N){return w=="variable"?Kn(w,N):Ar(w,N)}function Kn(w,N){if(w=="variable")return Qe(N),W(Ar)}function Ar(w,N){if(N=="<")return W(pe(">"),rt(Lr,">"),ue,Ar);if(N=="extends"||N=="implements"||g&&w==",")return N=="implements"&&(z.marked="keyword"),W(g?Ce:ve,Ar);if(w=="{")return W(pe("}"),Or,ue)}function Or(w,N){if(w=="async"||w=="variable"&&(N=="static"||N=="get"||N=="set"||g&&ze(N))&&z.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return z.marked="keyword",W(Or);if(w=="variable"||z.style=="keyword")return z.marked="property",W(fn,Or);if(w=="number"||w=="string")return W(fn,Or);if(w=="[")return W(ve,Wi,ye("]"),fn,Or);if(N=="*")return z.marked="keyword",W(Or);if(g&&w=="(")return Y(Ii,Or);if(w==";"||w==",")return W(Or);if(w=="}")return W();if(N=="@")return W(ve,Or)}function fn(w,N){if(N=="!"||N=="?")return W(fn);if(w==":")return W(Ce,Tr);if(N=="=")return W(Ot);var G=z.state.lexical.prev,j=G&&G.info=="interface";return Y(j?Ii:cr)}function Xn(w,N){return N=="*"?(z.marked="keyword",W(Yn,ye(";"))):N=="default"?(z.marked="keyword",W(ve,ye(";"))):w=="{"?W(rt(jn,"}"),Yn,ye(";")):Y(Oe)}function jn(w,N){if(N=="as")return z.marked="keyword",W(ye("variable"));if(w=="variable")return Y(Ot,jn)}function Bi(w){return w=="string"?W():w=="("?Y(ve):w=="."?Y(or):Y(qn,qr,Yn)}function qn(w,N){return w=="{"?Hi(qn,"}"):(w=="variable"&&Qe(N),N=="*"&&(z.marked="keyword"),W(io))}function qr(w){if(w==",")return W(qn,qr)}function io(w,N){if(N=="as")return z.marked="keyword",W(qn)}function Yn(w,N){if(N=="from")return z.marked="keyword",W(ve)}function Ye(w){return w=="]"?W():Y(rt(Ot,"]"))}function ie(){return Y(pe("form"),Ft,ye("{"),pe("}"),rt(hi,"}"),ue,ue)}function hi(){return Y(Ft,Tr)}function no(w,N){return w.lastType=="operator"||w.lastType==","||S.test(N.charAt(0))||/[,.]/.test(N.charAt(0))}function sr(w,N,G){return N.tokenize==M&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(N.lastType)||N.lastType=="quasi"&&/\{\s*$/.test(w.string.slice(0,w.pos-(G||0)))}return{startState:function(w){var N={tokenize:M,lastType:"sof",cc:[],lexical:new we((w||0)-l,0,"block",!1),localVars:n.localVars,context:n.localVars&&new Ee(null,null,!1),indented:w||0};return n.globalVars&&typeof n.globalVars=="object"&&(N.globalVars=n.globalVars),N},token:function(w,N){if(w.sol()&&(N.lexical.hasOwnProperty("align")||(N.lexical.align=!1),N.indented=w.indentation(),X(w,N)),N.tokenize!=E&&w.eatSpace())return null;var G=N.tokenize(w,N);return T=="comment"?G:(N.lastType=T=="operator"&&(L=="++"||L=="--")?"incdec":T,ke(N,G,T,L,w))},indent:function(w,N){if(w.tokenize==E||w.tokenize==B)return t.Pass;if(w.tokenize!=M)return 0;var G=N&&N.charAt(0),j=w.lexical,I;if(!/^\s*else\b/.test(N))for(var Q=w.cc.length-1;Q>=0;--Q){var Te=w.cc[Q];if(Te==ue)j=j.prev;else if(Te!=_n&&Te!=ft)break}for(;(j.type=="stat"||j.type=="form")&&(G=="}"||(I=w.cc[w.cc.length-1])&&(I==or||I==Xr)&&!/^[,\.=+\-*:?[\(]/.test(N));)j=j.prev;a&&j.type==")"&&j.prev.type=="stat"&&(j=j.prev);var ut=j.type,Et=G==ut;return ut=="vardef"?j.indented+(w.lastType=="operator"||w.lastType==","?j.info.length+1:0):ut=="form"&&G=="{"?j.indented:ut=="form"?j.indented+l:ut=="stat"?j.indented+(no(w,N)?a||l:0):j.info=="switch"&&!Et&&n.doubleIndentSwitch!=!1?j.indented+(/^(?:case|default)\b/.test(N)?l:2*l):j.align?j.column+(Et?0:1):j.indented+(Et?0:l)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:d?null:"/*",blockCommentEnd:d?null:"*/",blockCommentContinue:d?null:" * ",lineComment:d?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:d?"json":"javascript",jsonldMode:u,jsonMode:d,expressionAllowed:sr,skipExpression:function(w){ke(w,"atom","atom","true",new t.StringStream("",2,null))}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var vg=Ut((pg,gg)=>{(function(t){typeof pg=="object"&&typeof gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},n=t.Pos;t.defineOption("autoCloseBrackets",!1,function(L,C,M){M&&M!=t.Init&&(L.removeKeyMap(a),L.state.closeBrackets=null),C&&(u(l(C,"pairs")),L.state.closeBrackets=C,L.addKeyMap(a))});function l(L,C){return C=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[C]!=null?L[C]:r[C]}var a={Backspace:g,Enter:m};function u(L){for(var C=0;C=0;E--){var K=D[E].head;L.replaceRange("",n(K.line,K.ch-1),n(K.line,K.ch+1),"+delete")}}function m(L){var C=c(L),M=C&&l(C,"explode");if(!M||L.getOption("disableInput"))return t.Pass;for(var D=L.listSelections(),E=0;E0?{line:K.head.line,ch:K.head.ch+C}:{line:K.head.line-1};M.push({anchor:X,head:X})}L.setSelections(M,E)}function S(L){var C=t.cmpPos(L.anchor,L.head)>0;return{anchor:new n(L.anchor.line,L.anchor.ch+(C?-1:1)),head:new n(L.head.line,L.head.ch+(C?1:-1))}}function k(L,C){var M=c(L);if(!M||L.getOption("disableInput"))return t.Pass;var D=l(M,"pairs"),E=D.indexOf(C);if(E==-1)return t.Pass;for(var B=l(M,"closeBefore"),K=l(M,"triples"),X=D.charAt(E+1)==C,ee=L.listSelections(),we=E%2==0,he,ke=0;ke=0&&L.getRange(Y,n(Y.line,Y.ch+3))==C+C+C?W="skipThree":W="skip";else if(X&&Y.ch>1&&K.indexOf(C)>=0&&L.getRange(n(Y.line,Y.ch-2),Y)==C+C){if(Y.ch>2&&/\bstring/.test(L.getTokenTypeAt(n(Y.line,Y.ch-2))))return t.Pass;W="addFour"}else if(X){var Qe=Y.ch==0?" ":L.getRange(n(Y.line,Y.ch-1),Y);if(!t.isWordChar(De)&&Qe!=C&&!t.isWordChar(Qe))W="both";else return t.Pass}else if(we&&(De.length===0||/\s/.test(De)||B.indexOf(De)>-1))W="both";else return t.Pass;if(!he)he=W;else if(he!=W)return t.Pass}var _e=E%2?D.charAt(E-1):C,ze=E%2?C:D.charAt(E+1);L.operation(function(){if(he=="skip")x(L,1);else if(he=="skipThree")x(L,3);else if(he=="surround"){for(var Ee=L.getSelections(),Be=0;Be{(function(t){typeof mg=="object"&&typeof yg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=t.Pos;function n(C,M){return C.line-M.line||C.ch-M.ch}var l="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",a=l+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",u=new RegExp("<(/?)(["+l+"]["+a+"]*)","g");function d(C,M,D,E){this.line=M,this.ch=D,this.cm=C,this.text=C.getLine(M),this.min=E?Math.max(E.from,C.firstLine()):C.firstLine(),this.max=E?Math.min(E.to-1,C.lastLine()):C.lastLine()}function c(C,M){var D=C.cm.getTokenTypeAt(r(C.line,M));return D&&/\btag\b/.test(D)}function g(C){if(!(C.line>=C.max))return C.ch=0,C.text=C.cm.getLine(++C.line),!0}function m(C){if(!(C.line<=C.min))return C.text=C.cm.getLine(--C.line),C.ch=C.text.length,!0}function x(C){for(;;){var M=C.text.indexOf(">",C.ch);if(M==-1){if(g(C))continue;return}if(!c(C,M+1)){C.ch=M+1;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function S(C){for(;;){var M=C.ch?C.text.lastIndexOf("<",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}u.lastIndex=M,C.ch=M;var D=u.exec(C.text);if(D&&D.index==M)return D}}function k(C){for(;;){u.lastIndex=C.ch;var M=u.exec(C.text);if(!M){if(g(C))continue;return}if(!c(C,M.index+1)){C.ch=M.index+1;continue}return C.ch=M.index+M[0].length,M}}function A(C){for(;;){var M=C.ch?C.text.lastIndexOf(">",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function T(C,M){for(var D=[];;){var E=k(C),B,K=C.line,X=C.ch-(E?E[0].length:0);if(!E||!(B=x(C)))return;if(B!="selfClose")if(E[1]){for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==E[2]){D.length=ee;break}if(ee<0&&(!M||M==E[2]))return{tag:E[2],from:r(K,X),to:r(C.line,C.ch)}}else D.push(E[2])}}function L(C,M){for(var D=[];;){var E=A(C);if(!E)return;if(E=="selfClose"){S(C);continue}var B=C.line,K=C.ch,X=S(C);if(!X)return;if(X[1])D.push(X[2]);else{for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==X[2]){D.length=ee;break}if(ee<0&&(!M||M==X[2]))return{tag:X[2],from:r(C.line,C.ch),to:r(B,K)}}}}t.registerHelper("fold","xml",function(C,M){for(var D=new d(C,M.line,0);;){var E=k(D);if(!E||D.line!=M.line)return;var B=x(D);if(!B)return;if(!E[1]&&B!="selfClose"){var K=r(D.line,D.ch),X=T(D,E[2]);return X&&n(X.from,K)>0?{from:K,to:X.from}:null}}}),t.findMatchingTag=function(C,M,D){var E=new d(C,M.line,M.ch,D);if(!(E.text.indexOf(">")==-1&&E.text.indexOf("<")==-1)){var B=x(E),K=B&&r(E.line,E.ch),X=B&&S(E);if(!(!B||!X||n(E,M)>0)){var ee={from:r(E.line,E.ch),to:K,tag:X[2]};return B=="selfClose"?{open:ee,close:null,at:"open"}:X[1]?{open:L(E,X[2]),close:ee,at:"close"}:(E=new d(C,K.line,K.ch,D),{open:ee,close:T(E,X[2]),at:"open"})}}},t.findEnclosingTag=function(C,M,D,E){for(var B=new d(C,M.line,M.ch,D);;){var K=L(B,E);if(!K)break;var X=new d(C,M.line,M.ch,D),ee=T(X,K.tag);if(ee)return{open:K,close:ee}}},t.scanForClosingTag=function(C,M,D,E){var B=new d(C,M.line,M.ch,E?{from:0,to:E}:null);return T(B,D)}})});var wg=Ut((xg,bg)=>{(function(t){typeof xg=="object"&&typeof bg=="object"?t(Ht(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],t):t(CodeMirror)})(function(t){t.defineOption("autoCloseTags",!1,function(g,m,x){if(x!=t.Init&&x&&g.removeKeyMap("autoCloseTags"),!!m){var S={name:"autoCloseTags"};(typeof m!="object"||m.whenClosing!==!1)&&(S["'/'"]=function(k){return u(k)}),(typeof m!="object"||m.whenOpening!==!1)&&(S["'>'"]=function(k){return l(k)}),g.addKeyMap(S)}});var r=["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 l(g){if(g.getOption("disableInput"))return t.Pass;for(var m=g.listSelections(),x=[],S=g.getOption("autoCloseTags"),k=0;kA.ch&&(D=D.slice(0,D.length-T.end+A.ch));var X=D.toLowerCase();if(!D||T.type=="string"&&(T.end!=A.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&M.close||T.string.indexOf("/")==A.ch-T.start-1||B&&d(B,X)>-1||c(g,L.mode.xmlCurrentContext&&L.mode.xmlCurrentContext(C)||[],D,A,!0))return t.Pass;var ee=typeof S=="object"&&S.emptyTags;if(ee&&d(ee,D)>-1){x[k]={text:"/>",newPos:t.Pos(A.line,A.ch+2)};continue}var we=K&&d(K,X)>-1;x[k]={indent:we,text:">"+(we?` +b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` +`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},er=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},In=function(){var e=v("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),wt=null;function bi(e){if(wt!=null)return wt;var t=Y(e,v("span","x")),n=t.getBoundingClientRect(),r=_e(t,0,1).getBoundingClientRect();return wt=Math.abs(n.left-r.left)>1}var Mr={},Ct={};function kt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mr[e]=t}function pr(e,t){Ct[e]=t}function Ar(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=En(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ar("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ar("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Or(e,t){t=Ar(t);var n=Mr[t.name];if(!n)return Or(e,"text/plain");var r=n(e,t);if(tr.hasOwnProperty(t.name)){var i=tr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var tr={};function Dr(e,t){var n=tr.hasOwnProperty(e)?tr[e]:tr[e]={};fe(t,n)}function Nt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function rn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Fr(e,t,n){return e.startState?e.startState(t,n):!0}var Le=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Le.prototype.eol=function(){return this.pos>=this.string.length},Le.prototype.sol=function(){return this.pos==this.lineStart},Le.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Le.prototype.next=function(){if(this.post},Le.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Le.prototype.skipToEnd=function(){this.pos=this.string.length},Le.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Le.prototype.backUp=function(e){this.pos-=e},Le.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Le.prototype.current=function(){return this.string.slice(this.start,this.pos)},Le.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Le.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Le.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function $(e,t){if(t-=e.first,t<0||t>=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&&tn?S(n,$(e,n).text.length):is(t,$(e,t.line).text.length)}function is(e,t){var n=e.ch;return n==null||n>t?S(e.line,t):n<0?S(e.line,0):e}function mo(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Et.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}},Et.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Et.fromSaved=function(e,t,n){return t instanceof Bn?new Et(e,Nt(e.mode,t.state),n,t.lookAhead):new Et(e,Nt(e.mode,t),n)},Et.prototype.save=function(e){var t=e!==!1?Nt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Bn(t,this.maxLookAhead):t};function bo(e,t,n,r){var i=[e.state.modeGen],o={};Lo(e,t.text,e.doc.mode,n,function(f,c){return i.push(f,c)},o,r);for(var a=n.state,l=function(f){n.baseTokens=i;var c=e.state.overlays[f],d=1,b=0;n.state=!0,Lo(e,t.text,c.mode,n,function(m,M){for(var F=d;bm&&i.splice(d,1,m,i[d+1],z),d+=2,b=Math.min(m,z)}if(M)if(c.opaque)i.splice(F,d-F,m,"overlay "+M),d=F+2;else for(;Fe.options.maxHighlightLength&&Nt(e.doc.mode,r.state),o=bo(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))}return t.styles}function on(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Et(r,!0,t);var o=os(e,t,n),a=o>r.first&&$(r,o-1).stateAfter,l=a?Et.fromSaved(r,a,o):new Et(r,Fr(r.mode),o);return r.iter(o,t,function(s){xi(e,s.text,l);var f=l.line;s.stateAfter=f==t-1||f%5==0||f>=i.viewFrom&&ft.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Co=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ko(e,t,n,r){var i=e.doc,o=i.mode,a;t=ie(i,t);var l=$(i,t.line),s=on(e,t.line,n),f=new Le(l.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&xi(e,t,r,c.pos),c.pos=t.length,d=null):d=So(wi(n,c,r.state,b),o),b){var m=b[0].name;m&&(d="m-"+(d?m+" "+d:m))}if(!l||f!=d){for(;sa;--l){if(l<=o.first)return o.first;var s=$(o,l-1),f=s.stateAfter;if(f&&(!n||l+(f instanceof Bn?f.lookAhead:0)<=o.modeFrontier))return l;var c=ve(s.text,null,e.options.tabSize);(i==null||r>c)&&(i=l-1,r=c)}return i}function as(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=$(e,r).stateAfter;if(i&&(!(i instanceof Bn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new zn(a,o.from,s?null:o.to))}}return r}function hs(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var Z=0;Z0)){var c=[s,1],d=K(f.from,l.from),b=K(f.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:f.from,to:l.from}),(b>0||!a.inclusiveRight&&!b)&&c.push({from:l.to,to:f.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Ao(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||ki(r,o.marker)<0)&&(r=o.marker)}return r}function No(e,t,n,r,i){var o=$(e,t),a=Ut&&o.markedSpans;if(a)for(var l=0;l=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.to,n)>=0:K(f.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.from,r)<=0:K(f.from,r)<0)))return!0}}}function St(e){for(var t;t=Fo(e);)e=t.find(-1,!0).line;return e}function vs(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function gs(e){for(var t,n;t=Un(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Si(e,t){var n=$(e,t),r=St(n);return n==r?t:u(r)}function Eo(e,t){if(t>e.lastLine())return t;var n=$(e,t),r;if(!rr(e,n))return t;for(;r=Un(n);)n=r.find(1,!0).line;return u(n)+1}function rr(e,t){var n=Ut&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Er=function(e,t,n){this.text=e,Oo(this,t),this.height=n?n(this):1};Er.prototype.lineNo=function(){return u(this)},bt(Er);function ys(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ao(e),Oo(e,n);var i=r?r(e):1;i!=e.height&&pt(e,i)}function ms(e){e.parent=null,Ao(e)}var bs={},xs={};function Ho(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xs:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Po(e,t){var n=Ye("span",null,null,w?"padding-right: .1px":null),r={pre:Ye("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Cs,$t(e.display.measure)&&(a=ue(o,e.doc.direction))&&(r.addToken=Ss(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&u(o);Ls(o,r,xo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=He(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=He(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Wn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(w){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return ke(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=He(r.pre.className,r.textClass||"")),r}function ws(e){var t=v("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?ks(t,e.trailingSpace):t,s=e.cm.state.specialChars,f=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,c),k&&N<9&&(f=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var d=0;;){s.lastIndex=d;var b=s.exec(t),m=b?b.index-d:t.length-d;if(m){var M=document.createTextNode(l.slice(d,d+m));k&&N<9?c.appendChild(v("span",[M])):c.appendChild(M),e.map.push(e.pos,e.pos+m,M),e.col+=m,e.pos+=m}if(!b)break;d+=m+1;var F=void 0;if(b[0]==" "){var z=e.cm.options.tabSize,G=z-e.col%z;F=c.appendChild(v("span",Vr(G),"cm-tab")),F.setAttribute("role","presentation"),F.setAttribute("cm-text"," "),e.col+=G}else b[0]=="\r"||b[0]==` +`?(F=c.appendChild(v("span",b[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),F.setAttribute("cm-text",b[0]),e.col+=1):(F=e.cm.options.specialCharPlaceholder(b[0]),F.setAttribute("cm-text",b[0]),k&&N<9?c.appendChild(v("span",[F])):c.appendChild(F),e.col+=1);e.map.push(e.pos,e.pos+1,F),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||f||o||a){var q=n||"";r&&(q+=r),i&&(q+=i);var U=v("span",[c],q,o);if(a)for(var Z in a)a.hasOwnProperty(Z)&&Z!="style"&&Z!="class"&&U.setAttribute(Z,a[Z]);return e.content.appendChild(U)}e.content.appendChild(c)}}function ks(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;if&&d.from<=f));b++);if(d.to>=c)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-f),i,o,null,l,s),o=null,r=r.slice(d.to-f),f=d.to}}}function Wo(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;as||se.collapsed&&ee.to==s&&ee.from==s)){if(ee.to!=null&&ee.to!=s&&m>ee.to&&(m=ee.to,F=""),se.className&&(M+=" "+se.className),se.css&&(b=(b?b+";":"")+se.css),se.startStyle&&ee.from==s&&(z+=" "+se.startStyle),se.endStyle&&ee.to==m&&(Z||(Z=[])).push(se.endStyle,ee.to),se.title&&((q||(q={})).title=se.title),se.attributes)for(var ye in se.attributes)(q||(q={}))[ye]=se.attributes[ye];se.collapsed&&(!G||ki(G.marker,se)<0)&&(G=ee)}else ee.from>s&&m>ee.from&&(m=ee.from)}if(Z)for(var Re=0;Re=l)break;for(var ut=Math.min(l,m);;){if(c){var nt=s+c.length;if(!G){var De=nt>ut?c.slice(0,ut-s):c;t.addToken(t,De,d?d+M:M,z,s+De.length==m?F:"",b,q)}if(nt>=ut){c=c.slice(ut-s),s=ut;break}s=nt,z=""}c=i.slice(o,o=n[f++]),d=Ho(n[f++],t.cm.options)}}}function Io(e,t,n){this.line=t,this.rest=gs(t),this.size=this.rest?u(ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Kn(e,t,n){for(var r=[],i,o=t;o2&&o.push((s.bottom+f.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ko(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Ws(e,t){t=St(t);var n=u(t),r=e.display.externalMeasured=new Io(e.doc,t,n);r.lineN=n;var i=r.built=Po(e,r);return r.text=i.pre,Y(e.display.lineMeasure,i.pre),r}function qo(e,t,n,r){return Pt(e,Pr(e,t),n,r)}function Di(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[f+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;f&&e[f-2]==e[f-3]&&e[f-1].insertLeft;)r=e[(f-=3)+2],a="left";if(n=="right"&&i==s-l)for(;f=0&&(n=e[i]).left==n.right;i--);return n}function Bs(e,t,n,r){var i=jo(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,f;if(o.nodeType==3){for(var c=0;c<4;c++){for(;a&&Oe(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l0&&(s=r="right");var d;e.options.lineWrapping&&(d=o.getClientRects()).length>1?f=d[r=="right"?d.length-1:0]:f=o.getBoundingClientRect()}if(k&&N<9&&!a&&(!f||!f.left&&!f.right)){var b=o.parentNode.getClientRects()[0];b?f={left:b.left,right:b.left+Ir(e.display),top:b.top,bottom:b.bottom}:f=Xo}for(var m=f.top-t.rect.top,M=f.bottom-t.rect.top,F=(m+M)/2,z=t.view.measure.heights,G=0;G=r.text.length?(s=r.text.length,f="before"):s<=0&&(s=0,f="after"),!l)return a(f=="before"?s-1:s,f=="before");function c(M,F,z){var G=l[F],q=G.level==1;return a(z?M-1:M,q!=z)}var d=Qt(l,s,f),b=dr,m=c(s,d,f=="before");return b!=null&&(m.other=c(s,b,f!="before")),m}function $o(e,t){var n=0;t=ie(e.doc,t),e.options.lineWrapping||(n=Ir(e.display)*t.ch);var r=$(e.doc,t.line),i=_t(r)+qn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Ni(e,t,n,r,i){var o=S(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Ei(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Ni(r.first,0,null,-1,-1);var i=h(r,n),o=r.first+r.size-1;if(i>o)return Ni(r.first+r.size-1,$(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=$(r,i);;){var l=Rs(e,a,i,t,n),s=ps(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var f=s.find(1);if(f.line==i)return f;a=$(r,i=f.line)}}function ea(e,t,n,r){r-=Fi(t);var i=t.text.length,o=Ft(function(a){return Pt(e,n,a-1).bottom<=r},i,0);return i=Ft(function(a){return Pt(e,n,a).top>r},o,i),{begin:o,end:i}}function ta(e,t,n,r){n||(n=Pr(e,t));var i=Xn(e,t,Pt(e,n,r),"line").top;return ea(e,t,n,i)}function Hi(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Rs(e,t,n,r,i){i-=_t(t);var o=Pr(e,t),a=Fi(t),l=0,s=t.text.length,f=!0,c=ue(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?Us:Gs)(e,t,n,o,c,r,i);f=d.level!=1,l=f?d.from:d.to-1,s=f?d.to:d.from-1}var b=null,m=null,M=Ft(function(re){var ee=Pt(e,o,re);return ee.top+=a,ee.bottom+=a,Hi(ee,r,i,!1)?(ee.top<=i&&ee.left<=r&&(b=re,m=ee),!0):!1},l,s),F,z,G=!1;if(m){var q=r-m.left=Z.bottom?1:0}return M=Zt(t.text,M,1),Ni(n,M,z,G,r-F)}function Gs(e,t,n,r,i,o,a){var l=Ft(function(d){var b=i[d],m=b.level!=1;return Hi(Lt(e,S(n,m?b.to:b.from,m?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var f=s.level!=1,c=Lt(e,S(n,f?s.from:s.to,f?"after":"before"),"line",t,r);Hi(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function Us(e,t,n,r,i,o,a){var l=ea(e,t,r,a),s=l.begin,f=l.end;/\s/.test(t.text.charAt(f-1))&&f--;for(var c=null,d=null,b=0;b=f||m.to<=s)){var M=m.level!=1,F=Pt(e,r,M?Math.min(f,m.to)-1:Math.max(s,m.from)).right,z=Fz)&&(c=m,d=z)}}return c||(c=i[i.length-1]),c.fromf&&(c={from:c.from,to:f,level:c.level}),c}var gr;function Wr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(gr==null){gr=v("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)gr.appendChild(document.createTextNode("x")),gr.appendChild(v("br"));gr.appendChild(document.createTextNode("x"))}Y(e.measure,gr);var n=gr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),D(e.measure),n||1}function Ir(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=v("span","xxxxxxxxxx"),n=v("pre",[t],"CodeMirror-line-like");Y(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Pi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:Wi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Wi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ra(e){var t=Wr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ir(e.display)-3);return function(i){if(rr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(f=$(e.doc,s.line).text).length==s.ch){var c=ve(f,f.length,e.options.tabSize)-f.length;s=S(s.line,Math.max(0,Math.round((o-_o(e.display).left)/Ir(e.display))-c))}return s}function mr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ut&&Si(e.doc,t)i.viewFrom?ir(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ir(e);else if(t<=i.viewFrom){var o=Yn(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):ir(e)}else if(n>=i.viewTo){var a=Yn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):ir(e)}else{var l=Yn(e,t,t,-1),s=Yn(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Kn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):ir(e)}var f=i.externalMeasured;f&&(n=i.lineN&&t=r.viewTo)){var o=r.view[mr(e,t)];if(o.node!=null){var a=o.changes||(o.changes=[]);le(a,n)==-1&&a.push(n)}}}function ir(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Yn(e,t,n,r){var i=mr(e,t),o,a=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(i==a.length-1)return null;o=l+a[i].size-t,i++}else o=l-t;t+=o,n+=o}for(;Si(e.doc,n)!=n;){if(i==(r<0?0:a.length-1))return null;n+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function _s(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Kn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Kn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,mr(e,n)))),r.viewTo=n}function na(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(v("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Zn(e,t){return e.top-t.top||e.left-t.left}function Ks(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=_o(e.display),l=a.left,s=Math.max(r.sizerWidth,vr(e)-r.sizer.offsetLeft)-a.right,f=i.direction=="ltr";function c(U,Z,re,ee){Z<0&&(Z=0),Z=Math.round(Z),ee=Math.round(ee),o.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px; + top: `+Z+"px; width: "+(re??s-U)+`px; + height: `+(ee-Z)+"px"))}function d(U,Z,re){var ee=$(i,U),se=ee.text.length,ye,Re;function xe(De,it){return jn(e,S(U,De),"div",ee,it)}function ut(De,it,Ue){var Ne=ta(e,ee,null,De),Fe=it=="ltr"==(Ue=="after")?"left":"right",Te=Ue=="after"?Ne.begin:Ne.end-(/\s/.test(ee.text.charAt(Ne.end-1))?2:1);return xe(Te,Fe)[Fe]}var nt=ue(ee,i.direction);return Jt(nt,Z||0,re??se,function(De,it,Ue,Ne){var Fe=Ue=="ltr",Te=xe(De,Fe?"left":"right"),ot=xe(it-1,Fe?"right":"left"),Jr=Z==null&&De==0,ur=re==null&&it==se,je=Ne==0,Wt=!nt||Ne==nt.length-1;if(ot.top-Te.top<=3){var Ge=(f?Jr:ur)&&je,co=(f?ur:Jr)&&Wt,jt=Ge?l:(Fe?Te:ot).left,kr=co?s:(Fe?ot:Te).right;c(jt,Te.top,kr-jt,Te.bottom)}else{var Sr,Qe,Qr,ho;Fe?(Sr=f&&Jr&&je?l:Te.left,Qe=f?s:ut(De,Ue,"before"),Qr=f?l:ut(it,Ue,"after"),ho=f&&ur&&Wt?s:ot.right):(Sr=f?ut(De,Ue,"before"):l,Qe=!f&&Jr&&je?s:Te.right,Qr=!f&&ur&&Wt?l:ot.left,ho=f?ut(it,Ue,"after"):s),c(Sr,Te.top,Qe-Sr,Te.bottom),Te.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Br(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function oa(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Gi(e))}function Ri(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Br(e))},100)}function Gi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(ke(e,"focus",e,t),e.state.focused=!0,Ce(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),w&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),zi(e))}function Br(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ke(e,"blur",e,t),e.state.focused=!1,we(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Jn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,a=0;a.005||m<-.005)&&(ie.display.sizerWidth){var F=Math.ceil(c/Ir(e.display));F>e.display.maxLineLength&&(e.display.maxLineLength=F,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function aa(e){if(e.widgets)for(var t=0;t=a&&(o=h(t,_t($(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function qs(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!y){var a=v("div","\u200B",null,`position: absolute; + top: `+(t.top-n.viewOffset-qn(e.display))+`px; + height: `+(t.bottom-t.top+Ht(e)+n.barHeight)+`px; + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function Xs(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?S(t.line,t.ch+1,"before"):t,t=t.ch?S(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=Lt(e,t),s=!n||n==t?l:Lt(e,n);i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r};var f=Ui(e,i),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(f.scrollTop!=null&&(dn(e,f.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),f.scrollLeft!=null&&(br(e,f.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function js(e,t){var n=Ui(e,t);n.scrollTop!=null&&dn(e,n.scrollTop),n.scrollLeft!=null&&br(e,n.scrollLeft)}function Ui(e,t){var n=e.display,r=Wr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Oi(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ai(n),s=t.topl-r;if(t.topi+o){var c=Math.min(t.top,(f?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var d=e.options.fixedGutter?0:n.gutters.offsetWidth,b=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-d,m=vr(e)-n.gutters.offsetWidth,M=t.right-t.left>m;return M&&(t.right=t.left+m),t.left<10?a.scrollLeft=0:t.leftm+b-3&&(a.scrollLeft=t.right+(M?0:10)-m),a}function _i(e,t){t!=null&&(Vn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zr(e){Vn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hn(e,t,n){(t!=null||n!=null)&&Vn(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Ys(e,t){Vn(e),e.curOp.scrollToPos=t}function Vn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=$o(e,t.from),r=$o(e,t.to);la(e,n,r,t.margin)}}function la(e,t,n,r){var i=Ui(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});hn(e,i.scrollLeft,i.scrollTop)}function dn(e,t){Math.abs(e.doc.scrollTop-t)<2||(P||qi(e,{top:t}),sa(e,t,!0),P&&qi(e),gn(e,100))}function sa(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 br(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,da(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ai(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+Ht(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var r=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=v("div",[v("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,k&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=E&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new At,this.disableVert=new At},xr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vn=function(){};vn.prototype.update=function(){return{bottom:0,right:0}},vn.prototype.setScrollLeft=function(){},vn.prototype.setScrollTop=function(){},vn.prototype.clear=function(){};function Rr(e,t){t||(t=pn(e));var n=e.display.barWidth,r=e.display.barHeight;fa(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Jn(e),fa(e,pn(e)),n=e.display.barWidth,r=e.display.barHeight}function fa(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var ua={native:xr,null:vn};function ca(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&we(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ua[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?br(e,t):dn(e,t)},e),e.display.scrollbars.addClass&&Ce(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function wr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs,markArrays:null},Ts(e.curOp)}function Cr(e){var t=e.curOp;t&&As(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Vs(e){e.updatedDisplay=e.mustUpdate&&Ki(e.cm,e.update)}function $s(e){var t=e.cm,n=t.display;e.updatedDisplay&&Jn(t),e.barMeasure=pn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=qo(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ht(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ef(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=on(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Nt(t.mode,r.state):null,s=bo(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var f=o.styleClasses,c=s.classes;c?o.styleClasses=c:f&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||f!=c&&(!f||!c||f.bgClass!=c.bgClass||f.textClass!=c.textClass),b=0;!d&&bn)return gn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ft(e,function(){for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&na(e)==0)return!1;pa(e)&&(ir(e),t.dims=Pi(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Ut&&(o=Si(e.doc,o),a=Eo(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;_s(e,o,a),n.viewOffset=_t($(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=na(e);if(!l&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=of(e);return s>4&&(n.lineDiv.style.display="none"),lf(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,af(f),D(n.cursorDiv),D(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,gn(e,400)),n.updateLineNumbers=null,!0}function ha(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==vr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ai(e.display)-Oi(e),n.top)}),t.visible=Qn(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Qn(e.display,e.doc,n));if(!Ki(e,t))break;Jn(e);var i=pn(e);cn(e),Rr(e,i),ji(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 qi(e,t){var n=new $n(e,t);if(Ki(e,n)){Jn(e),ha(e,n);var r=pn(e);cn(e),Rr(e,r),ji(e,r),n.finish()}}function lf(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(M){var F=M.nextSibling;return w&&E&&e.display.currentWheelTarget==M?M.style.display="none":M.parentNode.removeChild(M),F}for(var s=r.view,f=r.viewFrom,c=0;c-1&&(m=!1),Bo(e,d,f,n)),m&&(D(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(B(e.options,f)))),a=d.node.nextSibling}f+=d.size}for(;a;)a=l(a)}function Xi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Ie(e,"gutterChanged",e)}function ji(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+Ht(e)+"px"}function da(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Wi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),k&&N<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!w&&!(P&&A)&&(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,i.gutterSpecs=Yi(r.gutters,r.lineNumbers),va(i),n.init(i)}var ei=0,qt=null;k?qt=-.53:P?qt=15:L?qt=-.7:j&&(qt=-1/3);function ga(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function ff(e){var t=ga(e);return t.x*=qt,t.y*=qt,t}function ya(e,t){L&&I==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=ga(t),r=n.x,i=n.y,o=qt;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var a=e.display,l=a.scroller,s=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight;if(r&&s||i&&f){if(i&&E&&w){e:for(var c=t.target,d=a.view;c!=l;c=c.parentNode)for(var b=0;b=0&&K(e,r.to())<=0)return n}return-1};var de=function(e,t){this.anchor=e,this.head=t};de.prototype.from=function(){return Nr(this.anchor,this.head)},de.prototype.to=function(){return et(this.anchor,this.head)},de.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(b,m){return K(b.from(),m.from())}),n=le(t,i);for(var o=1;o0:s>=0){var f=Nr(l.from(),a.from()),c=et(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new de(d?c:f,d?f:c))}}return new vt(t,n)}function or(e,t){return new vt([new de(e,t||e)],0)}function ar(e){return e.text?S(e.from.line+e.text.length-1,ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ma(e,t){if(K(e,t.from)<0)return e;if(K(e,t.to)<=0)return ar(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ar(t).ch-t.to.ch),S(n,r)}function Zi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,M-1),e.insert(l.line+1,G)}Ie(e,"change",e,t)}function lr(e,t,n){function r(i,o,a){if(i.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ce(e.done)}function Sa(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,a,l;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=hf(i,i.lastOp==r)))l=ce(a.changes),K(t.from,t.to)==0&&K(t.from,l.to)==0?l.to=ar(t):a.changes.push(Vi(e,t));else{var s=ce(i.done);for((!s||!s.ranges)&&ri(e.sel,i.done),a={changes:[Vi(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||ke(e,"historyAdded")}function df(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pf(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||df(e,o,ce(i.done),t))?i.done[i.done.length-1]=t:ri(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ka(i.undone)}function ri(e,t){var n=ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function La(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=a.markedSpans),++o})}function vf(e){if(!e)return null;for(var t,n=0;n-1&&(ce(l)[d]=f[d],delete f[d])}}return r}function $i(e,t,n,r){if(r){var i=e.anchor;if(n){var o=K(t,i)<0;o!=K(n,i)<0?(i=t,t=n):o!=K(t,n)<0&&(t=n)}return new de(i,t)}else return new de(n||t,t)}function ni(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xe(e,new vt([$i(e.sel.primary(),t,n,i)],0),r)}function Ma(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(ke(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),b=void 0;if((r<0?c:f)&&(d=Ea(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(b=K(d,n))&&(r<0?b<0:b>0))return Ur(e,d,t,r,i)}var m=s.find(r<0?-1:1);return(r<0?f:c)&&(m=Ea(e,m,r,m.line==t.line?o:null)),m?Ur(e,m,t,r,i):null}}return t}function oi(e,t,n,r,i){var o=r||1,a=Ur(e,t,n,o,i)||!i&&Ur(e,t,n,o,!0)||Ur(e,t,n,-o,i)||!i&&Ur(e,t,n,-o,!0);return a||(e.cantEdit=!0,S(e.first,0))}function Ea(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ie(e,S(t.line-1)):null:n>0&&t.ch==(r||$(e,t.line)).text.length?t.line=0;--i)Wa(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Wa(e,t)}}function Wa(e,t){if(!(t.text.length==1&&t.text[0]==""&&K(t.from,t.to)==0)){var n=Zi(e,t);Sa(e,t,n,e.cm?e.cm.curOp.id:NaN),bn(e,t,n,Ci(e,t));var r=[];lr(e,function(i,o){!o&&le(r,i.history)==-1&&(Ra(i.history,t),r.push(i.history)),bn(i,t,null,Ci(i,t))})}}function ai(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,a=e.sel,l=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,f=0;f=0;--m){var M=b(m);if(M)return M.v}}}}function Ia(e,t){if(t!=0&&(e.first+=t,e.sel=new vt(hr(e.sel.ranges,function(i){return new de(S(i.anchor.line+t,i.anchor.ch),S(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){tt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:S(o,$(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gt(e,t.from,t.to),n||(n=Zi(e,t)),e.cm?mf(e.cm,t,r):Qi(e,t,r),ii(e,n,ht),e.cantEdit&&oi(e,S(e.firstLine(),0))&&(e.cantEdit=!1)}}function mf(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=u(St($(r,o.line))),r.iter(s,a.line+1,function(m){if(m==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&>(e),Qi(r,t,n,ra(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(m){var M=_n(m);M>i.maxLineLength&&(i.maxLine=m,i.maxLineLength=M,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),as(r,o.line),gn(e,400);var f=t.text.length-(a.line-o.line)-1;t.full?tt(e):o.line==a.line&&t.text.length==1&&!xa(e.doc,t)?nr(e,o.line,"text"):tt(e,o.line,a.line+1,f);var c=st(e,"changes"),d=st(e,"change");if(d||c){var b={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&Ie(e,"change",e,b),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(b)}e.display.selForContextMenu=null}function Kr(e,t,n,r,i){var o;r||(r=n),K(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),_r(e,{from:n,to:r,text:t,origin:i})}function Ba(e,t,n,r){n1||!(this.children[0]instanceof wn))){var l=[];this.collapse(l),this.children=[new wn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=f,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Fa(e.doc)),e&&Ie(e,"markerCleared",e,this,r,i),t&&Cr(e),this.parent&&this.parent.clear()}},sr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||a==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Ye("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(No(e,t.line,t,n,o)||t.line!=n.line&&No(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ss()}o.addToHistory&&Sa(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,f;if(e.iter(l,n.line+1,function(d){s&&o.collapsed&&!s.options.lineWrapping&&St(d)==s.display.maxLine&&(f=!0),o.collapsed&&l!=t.line&&pt(d,0),us(d,new zn(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(d){rr(e,d)&&pt(d,0)}),o.clearOnEnter&&te(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(ls(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Ua,o.atomic=!0),s){if(f&&(s.curOp.updateMaxLine=!0),o.collapsed)tt(s,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)nr(s,c,"text");o.atomic&&Fa(s.doc),Ie(s,"markerAdded",s,o)}return o}var Sn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)_r(this,r[s]);l?Oa(this,l):this.cm&&zr(this.cm)}),undo:ze(function(){ai(this,"undo")}),redo:ze(function(){ai(this,"redo")}),undoSelection:ze(function(){ai(this,"undo",!0)}),redoSelection:ze(function(){ai(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ie(this,e),t=ie(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!n||n(s.marker))&&r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),ie(this,S(n,t))},indexFromPos:function(e){e=ie(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),ii(t.doc,or(n,n)),d)for(var b=0;b=0;l--)Kr(e.doc,"",r[l].from,r[l].to,"+delete");zr(e)})}function to(e,t,n){var r=Zt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function ro(e,t,n){var r=to(e,t.ch,n);return r==null?null:new S(t.line,r,n<0?"after":"before")}function no(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=ue(n,t.doc.direction);if(o){var a=i<0?ce(o):o[0],l=i<0==(a.level==1),s=l?"after":"before",f;if(a.level>0||t.doc.direction=="rtl"){var c=Pr(t,n);f=i<0?n.text.length-1:0;var d=Pt(t,c,f).top;f=Ft(function(b){return Pt(t,c,b).top==d},i<0==(a.level==1)?a.from:a.to-1,f),s=="before"&&(f=to(n,f,1))}else f=i<0?a.to:a.from;return new S(r,f,s)}}return new S(r,i<0?n.text.length:0,i<0?"before":"after")}function Nf(e,t,n,r){var i=ue(t,e.doc.direction);if(!i)return ro(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Qt(i,n.ch,n.sticky),a=i[o];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&b>=c.begin)){var m=d?"before":"after";return new S(n.line,b,m)}}var M=function(G,q,U){for(var Z=function(ye,Re){return Re?new S(n.line,l(ye,1),"before"):new S(n.line,ye,"after")};G>=0&&G0==(re.level!=1),se=ee?U.begin:l(U.end,-1);if(re.from<=se&&se0?c.end:l(c.begin,-1);return z!=null&&!(r>0&&z==t.text.length)&&(F=M(r>0?0:i.length-1,r,f(z)),F)?F:null}var Mn={selectAll:Ha,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return jr(e,function(t){if(t.empty()){var n=$(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new S(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),S(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=$(e.doc,i.line-1).text;a&&(i=new S(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),S(i.line-1,a.length-1),i,"+transpose"))}}n.push(new de(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ft(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&K(t,this.pos)==0&&n==this.button};var On,Dn;function zf(e,t){var n=+new Date;return Dn&&Dn.compare(n,e,t)?(On=Dn=null,"triple"):On&&On.compare(n,e,t)?(Dn=new oo(n,e,t),On=null,"double"):(On=new oo(n,e,t),Dn=null,"single")}function il(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Kt(n,e)){w||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!ao(t,e)){var r=yr(t,e),i=xt(e),o=r?zf(r,i):"single";oe(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Rf(t,i,r,o,e))&&(i==1?r?Uf(t,r,o,e):en(e)==n.scroller&&qe(e):i==2?(r&&ni(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(be?t.display.input.onContextMenu(e):Ri(t)))}}}function Rf(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,An(e,Za(o,i),i,function(a){if(typeof a=="string"&&(a=Mn[a]),!a)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=a(e,n)!=Yt}finally{e.state.suppressEdits=!1}return l})}function Gf(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=X?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=E?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(E?n.altKey:n.ctrlKey)),i}function Uf(e,t,n,r){k?setTimeout(ne(oa,e),0):e.curOp.focus=Ae(mt(e));var i=Gf(e,n,r),o=e.doc.sel,a;e.options.dragDrop&&mi&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(K((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(K(a.to(),t)>0||t.xRel<0)?_f(e,r,t,i):Kf(e,r,t,i)}function _f(e,t,n,r){var i=e.display,o=!1,a=Be(e,function(f){w&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ri(e)),Ke(i.wrapper.ownerDocument,"mouseup",a),Ke(i.wrapper.ownerDocument,"mousemove",l),Ke(i.scroller,"dragstart",s),Ke(i.scroller,"drop",a),o||(qe(f),r.addNew||ni(e.doc,n,null,null,r.extend),w&&!j||k&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),l=function(f){o=o||Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)>=10},s=function(){return o=!0};w&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,te(i.wrapper.ownerDocument,"mouseup",a),te(i.wrapper.ownerDocument,"mousemove",l),te(i.scroller,"dragstart",s),te(i.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function ol(e,t,n){if(n=="char")return new de(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new de(S(t.line,0),ie(e.doc,S(t.line+1,0)));var r=n(e,t);return new de(r.from,r.to)}function Kf(e,t,n,r){k&&Ri(e);var i=e.display,o=e.doc;qe(t);var a,l,s=o.sel,f=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),l>-1?a=f[l]:a=new de(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new de(n,n)),n=yr(e,t,!0,!0),l=-1;else{var c=ol(e,n,r.unit);r.extend?a=$i(a,c.anchor,c.head,r.extend):a=c}r.addNew?l==-1?(l=f.length,Xe(o,Tt(e,f.concat([a]),l),{scroll:!1,origin:"*mouse"})):f.length>1&&f[l].empty()&&r.unit=="char"&&!r.extend?(Xe(o,Tt(e,f.slice(0,l).concat(f.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):eo(o,l,a,Ot):(l=0,Xe(o,new vt([a],0),Ot),s=o.sel);var d=n;function b(U){if(K(d,U)!=0)if(d=U,r.unit=="rectangle"){for(var Z=[],re=e.options.tabSize,ee=ve($(o,n.line).text,n.ch,re),se=ve($(o,U.line).text,U.ch,re),ye=Math.min(ee,se),Re=Math.max(ee,se),xe=Math.min(n.line,U.line),ut=Math.min(e.lastLine(),Math.max(n.line,U.line));xe<=ut;xe++){var nt=$(o,xe).text,De=Dt(nt,ye,re);ye==Re?Z.push(new de(S(xe,De),S(xe,De))):nt.length>De&&Z.push(new de(S(xe,De),S(xe,Dt(nt,Re,re))))}Z.length||Z.push(new de(n,n)),Xe(o,Tt(e,s.ranges.slice(0,l).concat(Z),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var it=a,Ue=ol(e,U,r.unit),Ne=it.anchor,Fe;K(Ue.anchor,Ne)>0?(Fe=Ue.head,Ne=Nr(it.from(),Ue.anchor)):(Fe=Ue.anchor,Ne=et(it.to(),Ue.head));var Te=s.ranges.slice(0);Te[l]=qf(e,new de(ie(o,Ne),Fe)),Xe(o,Tt(e,Te,l),Ot)}}var m=i.wrapper.getBoundingClientRect(),M=0;function F(U){var Z=++M,re=yr(e,U,!0,r.unit=="rectangle");if(re)if(K(re,d)!=0){e.curOp.focus=Ae(mt(e)),b(re);var ee=Qn(i,o);(re.line>=ee.to||re.linem.bottom?20:0;se&&setTimeout(Be(e,function(){M==Z&&(i.scroller.scrollTop+=se,F(U))}),50)}}function z(U){e.state.selectingText=!1,M=1/0,U&&(qe(U),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",G),Ke(i.wrapper.ownerDocument,"mouseup",q),o.history.lastSelOrigin=null}var G=Be(e,function(U){U.buttons===0||!xt(U)?z(U):F(U)}),q=Be(e,z);e.state.selectingText=q,te(i.wrapper.ownerDocument,"mousemove",G),te(i.wrapper.ownerDocument,"mouseup",q)}function qf(e,t){var n=t.anchor,r=t.head,i=$(e.doc,n.line);if(K(n,r)==0&&n.sticky==r.sticky)return t;var o=ue(i);if(!o)return t;var a=Qt(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s=a+(l.from==n.ch==(l.level!=1)?0:1);if(s==0||s==o.length)return t;var f;if(r.line!=n.line)f=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=Qt(o,r.ch,r.sticky),d=c-a||(r.ch-n.ch)*(l.level==1?-1:1);c==s-1||c==s?f=d<0:f=d>0}var b=o[s+(f?-1:0)],m=f==(b.level==1),M=m?b.from:b.to,F=m?"after":"before";return n.ch==M&&n.sticky==F?t:new de(new S(n.line,M,F),r)}function al(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{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&qe(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!st(e,n))return $e(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var c=h(e.doc,o),d=e.display.gutterSpecs[s];return ke(e,n,e,c,d.className,t),$e(t)}}}function ao(e,t){return al(e,t,"gutterClick",!0)}function ll(e,t){Kt(e.display,t)||Xf(e,t)||Se(e,t,"contextmenu")||be||e.display.input.onContextMenu(t)}function Xf(e,t){return st(e,"gutterContextMenu")?al(e,t,"gutterContextMenu",!1):!1}function sl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),un(e)}var Yr={toString:function(){return"CodeMirror.Init"}},fl={},ui={};function jf(e){var t=e.optionHandlers;function n(r,i,o,a){e.defaults[r]=i,o&&(t[r]=a?function(l,s,f){f!=Yr&&o(l,s,f)}:o)}e.defineOption=n,e.Init=Yr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ji(r)},!0),n("indentUnit",2,Ji,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){mn(r),un(r),tt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],a=r.doc.first;r.doc.iter(function(s){for(var f=0;;){var c=s.text.indexOf(i,f);if(c==-1)break;f=c+i.length,o.push(S(a,c))}a++});for(var l=o.length-1;l>=0;l--)Kr(r.doc,i,o[l],S(o[l].line,o[l].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=Yr&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",A?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!V),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){sl(r),yn(r)},!0),n("keyMap","default",function(r,i,o){var a=si(i),l=o!=Yr&&si(o);l&&l.detach&&l.detach(r,a),a.attach&&a.attach(r,l||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zf,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Yi(i,r.options.lineNumbers),yn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Wi(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rr(r)},!0),n("scrollbarStyle","native",function(r){ca(r),Rr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Yi(r.options.gutters,i),yn(r)},!0),n("firstLineNumber",1,yn,!0),n("lineNumberFormatter",function(r){return r},yn,!0),n("showCursorWhenSelecting",!1,cn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Br(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Yf),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,cn,!0),n("singleCursorHeightPerLine",!0,cn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,mn,!0),n("addModeClass",!1,mn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,mn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Yf(e,t,n){var r=n&&n!=Yr;if(!t!=!r){var i=e.display.dragFunctions,o=t?te:Ke;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Zf(e){e.options.lineWrapping?(Ce(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(we(e.display.wrapper,"CodeMirror-wrap"),Ti(e)),Ii(e),tt(e),un(e),setTimeout(function(){return Rr(e)},100)}function me(e,t){var n=this;if(!(this instanceof me))return new me(e,t);this.options=t=t?fe(t):{},fe(fl,t,!1);var r=t.value;typeof r=="string"?r=new rt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new me.inputStyles[t.inputStyle](this),o=this.display=new sf(e,r,i,t);o.wrapper.CodeMirror=this,sl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ca(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 At,keySeq:null,specialChars:null},t.autofocus&&!A&&o.input.focus(),k&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jf(this),Mf(),wr(this),this.curOp.forceUpdate=!0,wa(this,r),t.autofocus&&!A||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Gi(n)},20):Br(this);for(var a in ui)ui.hasOwnProperty(a)&&ui[a](this,t[a],Yr);pa(this),t.finishInit&&t.finishInit(this);for(var l=0;l20*20}te(t.scroller,"touchstart",function(s){if(!Se(e,s)&&!o(s)&&!ao(e,s)){t.input.ensurePolled(),clearTimeout(n);var f=+new Date;t.activeTouch={start:f,moved:!1,prev:f-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(s){var f=t.activeTouch;if(f&&!Kt(t,s)&&f.left!=null&&!f.moved&&new Date-f.start<300){var c=e.coordsChar(t.activeTouch,"page"),d;!f.prev||a(f,f.prev)?d=new de(c,c):!f.prev.prev||a(f,f.prev.prev)?d=e.findWordAt(c):d=new de(S(c.line,0),ie(e.doc,S(c.line+1,0))),e.setSelection(d.anchor,d.head),e.focus(),qe(s)}i()}),te(t.scroller,"touchcancel",i),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(dn(e,t.scroller.scrollTop),br(e,t.scroller.scrollLeft,!0),ke(e,"scroll",e))}),te(t.scroller,"mousewheel",function(s){return ya(e,s)}),te(t.scroller,"DOMMouseScroll",function(s){return ya(e,s)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){Se(e,s)||Vt(s)},over:function(s){Se(e,s)||(Tf(e,s),Vt(s))},start:function(s){return Lf(e,s)},drop:Be(e,Sf),leave:function(s){Se(e,s)||qa(e)}};var l=t.input.getField();te(l,"keyup",function(s){return rl.call(e,s)}),te(l,"keydown",Be(e,tl)),te(l,"keypress",Be(e,nl)),te(l,"focus",function(s){return Gi(e,s)}),te(l,"blur",function(s){return Br(e,s)})}var lo=[];me.defineInitHook=function(e){return lo.push(e)};function Fn(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=on(e,t).state:n="prev");var a=e.options.tabSize,l=$(i,t),s=ve(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var f=l.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(l.text))c=0,n="not";else if(n=="smart"&&(c=i.mode.indent(o,l.text.slice(f.length),l.text),c==Yt||c>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?c=ve($(i,t-1).text,null,a):c=0:n=="add"?c=s+e.options.indentUnit:n=="subtract"?c=s-e.options.indentUnit:typeof n=="number"&&(c=s+n),c=Math.max(0,c);var d="",b=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)b+=a,d+=" ";if(ba,s=yt(t),f=null;if(l&&r.ranges.length>1)if(Mt&&Mt.text.join(` +`)==t){if(r.ranges.length%Mt.text.length==0){f=[];for(var c=0;c=0;b--){var m=r.ranges[b],M=m.from(),F=m.to();m.empty()&&(n&&n>0?M=S(M.line,M.ch-n):e.state.overwrite&&!l?F=S(F.line,Math.min($(o,F.line).text.length,F.ch+ce(s).length)):l&&Mt&&Mt.lineWise&&Mt.text.join(` +`)==s.join(` +`)&&(M=F=S(M.line,0)));var z={from:M,to:F,text:f?f[b%f.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};_r(e.doc,z),Ie(e,"inputRead",e,z)}t&&!l&&cl(e,t),zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ul(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ft(t,function(){return so(t,n,0,null,"paste")}),!0}function cl(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test($(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Ie(e,"electricInput",e,i.head.line)}}}function hl(e){for(var t=[],n=[],r=0;ro&&(Fn(this,l.head.line,r,!0),o=l.head.line,a==this.doc.sel.primIndex&&zr(this));else{var s=l.from(),f=l.to(),c=Math.max(o,s.line);o=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(var d=c;d0&&eo(this.doc,a,new de(s,b[a].to()),ht)}}}),getTokenAt:function(r,i){return ko(this,r,i)},getLineTokens:function(r,i){return ko(this,S(r),i,!0)},getTokenTypeAt:function(r){r=ie(this.doc,r);var i=xo(this,$(this.doc,r.line)),o=0,a=(i.length-1)/2,l=r.ch,s;if(l==0)s=i[2];else for(;;){var f=o+a>>1;if((f?i[f*2-1]:0)>=l)a=f;else if(i[f*2+1]s&&(r=s,a=!0),l=$(this.doc,r)}else l=r;return Xn(this,l,{top:0,left:0},i||"page",o||a).top+(a?this.doc.height-_t(l):0)},defaultTextHeight:function(){return Wr(this.display)},defaultCharWidth:function(){return Ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,a,l){var s=this.display;r=Lt(this,ie(this.doc,r));var f=r.bottom,c=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),a=="over")f=r.top;else if(a=="above"||a=="near"){var d=Math.max(s.wrapper.clientHeight,this.doc.height),b=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+i.offsetHeight>d)&&r.top>i.offsetHeight?f=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=d&&(f=r.bottom),c+i.offsetWidth>b&&(c=b-i.offsetWidth)}i.style.top=f+"px",i.style.left=i.style.right="",l=="right"?(c=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(l=="left"?c=0:l=="middle"&&(c=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=c+"px"),o&&js(this,{left:c,top:f,right:c+i.offsetWidth,bottom:f+i.offsetHeight})},triggerOnKeyDown:Je(tl),triggerOnKeyPress:Je(nl),triggerOnKeyUp:rl,triggerOnMouseDown:Je(il),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Je(function(r){cl(this,r)}),findPosH:function(r,i,o,a){var l=1;i<0&&(l=-1,i=-i);for(var s=ie(this.doc,r),f=0;f0&&c(o.charAt(a-1));)--a;for(;l.5||this.options.lineWrapping)&&Ii(this),ke(this,"refresh",this)}),swapDoc:Je(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),wa(this,r),un(this),this.display.input.reset(),hn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ie(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},bt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,a){e.registerHelper(r,i,a),n[r]._global.push({pred:o,val:a})}}function uo(e,t,n,r,i){var o=t,a=n,l=$(e,t.line),s=i&&e.direction=="rtl"?-n:n;function f(){var q=t.line+s;return q=e.first+e.size?!1:(t=new S(q,t.ch,t.sticky),l=$(e,q))}function c(q){var U;if(r=="codepoint"){var Z=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(Z))U=null;else{var re=n>0?Z>=55296&&Z<56320:Z>=56320&&Z<57343;U=new S(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(re?2:1))),-n)}}else i?U=Nf(e.cm,l,t,n):U=ro(l,t,n);if(U==null)if(!q&&f())t=no(i,e.cm,l,t.line,s);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var d=null,b=r=="group",m=e.cm&&e.cm.getHelper(t,"wordChars"),M=!0;!(n<0&&!c(!M));M=!1){var F=l.text.charAt(t.ch)||` +`,z=Bt(F,m)?"w":b&&F==` +`?"n":!b||/\s/.test(F)?null:"p";if(b&&!M&&!z&&(z="s"),d&&d!=z){n<0&&(n=1,c(),t.sticky="after");break}if(z&&(d=z),n>0&&!c(!M))break}var G=oi(e,t,o,a,!0);return he(o,G)&&(G.hitSide=!0),G}function pl(e,t,n,r){var i=e.doc,o=t.left,a;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,oe(e).innerHeight||i(e).documentElement.clientHeight),s=Math.max(l-.5*Wr(e.display),3);a=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(a=n>0?t.bottom+3:t.top-3);for(var f;f=Ei(e,o,a),!!f.outside;){if(n<0?a<=0:a>=i.height){f.hitSide=!0;break}a+=n*5}return f}var ge=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new At,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ge.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,fo(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var s=l.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}te(i,"paste",function(l){!o(l)||Se(r,l)||ul(l,r)||N<=11&&setTimeout(Be(r,function(){return t.updateFromDOM()}),20)}),te(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),te(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),te(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(i,"touchstart",function(){return n.forceCompositionEnd()}),te(i,"input",function(){t.composing||t.readFromDOMSoon()});function a(l){if(!(!o(l)||Se(r,l))){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=hl(r);ci({lineWise:!0,text:s.text}),l.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var f=Mt.text.join(` +`);if(l.clipboardData.setData("Text",f),l.clipboardData.getData("Text")==f){l.preventDefault();return}}var c=dl(),d=c.firstChild;fo(d),r.display.lineSpace.insertBefore(c,r.display.lineSpace.firstChild),d.value=Mt.text.join(` +`);var b=Ae(Pe(i));cr(d),setTimeout(function(){r.display.lineSpace.removeChild(c),b.focus(),b==i&&n.showPrimarySelection()},50)}}te(i,"copy",a),te(i,"cut",a)},ge.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ge.prototype.prepareSelection=function(){var e=ia(this.cm,!1);return e.focus=Ae(Pe(this.div))==this.div,e},ge.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ge.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ge.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&vl(t,r)||{node:l[0].measure.map[2],offset:0},f=i.linee.firstLine()&&(r=S(r.line-1,$(e.doc,r.line-1).length)),i.ch==$(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,l;r.line==t.viewFrom||(o=mr(e,r.line))==0?(a=u(t.view[0].line),l=t.view[0].node):(a=u(t.view[o].line),l=t.view[o-1].node.nextSibling);var s=mr(e,i.line),f,c;if(s==t.view.length-1?(f=t.viewTo-1,c=t.lineDiv.lastChild):(f=u(t.view[s+1].line)-1,c=t.view[s+1].node.previousSibling),!l)return!1;for(var d=e.doc.splitLines($f(e,l,c,a,f)),b=Gt(e.doc,S(a,0),S(f,$(e.doc,f).text.length));d.length>1&&b.length>1;)if(ce(d)==ce(b))d.pop(),b.pop(),f--;else if(d[0]==b[0])d.shift(),b.shift(),a++;else break;for(var m=0,M=0,F=d[0],z=b[0],G=Math.min(F.length,z.length);mr.ch&&q.charCodeAt(q.length-M-1)==U.charCodeAt(U.length-M-1);)m--,M++;d[d.length-1]=q.slice(0,q.length-M).replace(/^\u200b+/,""),d[0]=d[0].slice(m).replace(/\u200b+$/,"");var re=S(a,m),ee=S(f,b.length?ce(b).length-M:0);if(d.length>1||d[0]||K(re,ee))return Kr(e.doc,d,re,ee,"+input"),!0},ge.prototype.ensurePolled=function(){this.forceCompositionEnd()},ge.prototype.reset=function(){this.forceCompositionEnd()},ge.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ge.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ge.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ft(this.cm,function(){return tt(e.cm)})},ge.prototype.setUneditable=function(e){e.contentEditable="false"},ge.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Be(this.cm,so)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ge.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ge.prototype.onContextMenu=function(){},ge.prototype.resetPosition=function(){},ge.prototype.needsContentAttribute=!0;function vl(e,t){var n=Di(e,t.line);if(!n||n.hidden)return null;var r=$(e.doc,t.line),i=Ko(n,r,t.line),o=ue(r,e.doc.direction),a="left";if(o){var l=Qt(o,t.ch);a=l%2?"right":"left"}var s=jo(i.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Vf(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Zr(e,t){return t&&(e.bad=!0),e}function $f(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function f(m){return function(M){return M.id==m}}function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function d(m){m&&(c(),o+=m)}function b(m){if(m.nodeType==1){var M=m.getAttribute("cm-text");if(M){d(M);return}var F=m.getAttribute("cm-marker"),z;if(F){var G=e.findMarks(S(r,0),S(i+1,0),f(+F));G.length&&(z=G[0].find(0))&&d(Gt(e.doc,z.from,z.to).join(l));return}if(m.getAttribute("contenteditable")=="false")return;var q=/^(pre|div|p|li|table|br)$/i.test(m.nodeName);if(!/^br$/i.test(m.nodeName)&&m.textContent.length==0)return;q&&c();for(var U=0;U=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),te(i,"paste",function(a){Se(r,a)||ul(a,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(a){if(!Se(r,a)){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=hl(r);ci({lineWise:!0,text:l.text}),a.type=="cut"?r.setSelections(l.ranges,null,ht):(n.prevInput="",i.value=l.text.join(` +`),cr(i))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(i,"cut",o),te(i,"copy",o),te(e.scroller,"paste",function(a){if(!(Kt(e,a)||Se(r,a))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var l=new Event("paste");l.clipboardData=a.clipboardData,i.dispatchEvent(l)}}),te(e.lineSpace,"selectstart",function(a){Kt(e,a)||qe(a)}),te(i,"compositionstart",function(){var a=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Me.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;fo(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Me.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Me.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ia(e);if(e.options.moveInputWithCursor){var i=Lt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Me.prototype.showSelection=function(e){var t=this.cm,n=t.display;Y(n.cursorDiv,e.cursors),Y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Me.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&cr(this.textarea),k&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",k&&N>=9&&(this.hasSelection=null));this.resetting=!1}},Me.prototype.getField=function(){return this.textarea},Me.prototype.supportsTouch=function(){return!1},Me.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!A||Ae(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Me.prototype.blur=function(){this.textarea.blur()},Me.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Me.prototype.receivedFocus=function(){this.slowPoll()},Me.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Me.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Me.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||er(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(k&&N>=9&&this.hasSelection===i||E&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a1e3||i.indexOf(` +`)>-1?n.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},Me.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Me.prototype.onKeyPress=function(){k&&N>=9&&(this.hasSelection=null),this.fastPoll()},Me.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=yr(n,e),a=r.scroller.scrollTop;if(!o||H)return;var l=n.options.resetSelectionOnContextMenu;l&&n.doc.sel.contains(o)==-1&&Be(n,Xe)(n.doc,or(o),ht);var s=i.style.cssText,f=t.wrapper.style.cssText,c=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; + top: `+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+`px; + z-index: 1000; background: `+(k?"rgba(255, 255, 255, .05)":"transparent")+`; + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var d;w&&(d=i.ownerDocument.defaultView.scrollY),r.input.focus(),w&&i.ownerDocument.defaultView.scrollTo(null,d),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function b(){if(i.selectionStart!=null){var F=n.somethingSelected(),z="\u200B"+(F?i.value:"");i.value="\u21DA",i.value=z,t.prevInput=F?"":"\u200B",i.selectionStart=1,i.selectionEnd=z.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=s,k&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),i.selectionStart!=null)){(!k||k&&N<9)&&b();var F=0,z=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Be(n,Ha)(n):F++<10?r.detectingSelectAll=setTimeout(z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(z,200)}}if(k&&N>=9&&b(),be){Vt(e);var M=function(){Ke(window,"mouseup",M),setTimeout(m,20)};te(window,"mouseup",M)}else setTimeout(m,50)},Me.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Me.prototype.setUneditable=function(){},Me.prototype.needsContentAttribute=!1;function tu(e,t){if(t=t?fe(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=Ae(Pe(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var l=me(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return l}function ru(e){e.off=Ke,e.on=te,e.wheelEventPixels=ff,e.Doc=rt,e.splitLines=yt,e.countColumn=ve,e.findColumn=Dt,e.isWordChar=$r,e.Pass=Yt,e.signal=ke,e.Line=Er,e.changeEnd=ar,e.scrollbarModel=ua,e.Pos=S,e.cmpPos=K,e.modes=Mr,e.mimeModes=Ct,e.resolveMode=Ar,e.getMode=Or,e.modeExtensions=tr,e.extendMode=Dr,e.copyState=Nt,e.startState=Fr,e.innerMode=rn,e.commands=Mn,e.keyMap=Xt,e.keyName=Ja,e.isModifierKey=Ya,e.lookupKey=Xr,e.normalizeKeyMap=Ff,e.StringStream=Le,e.SharedTextMarker=Sn,e.TextMarker=sr,e.LineWidget=kn,e.e_preventDefault=qe,e.e_stopPropagation=Lr,e.e_stop=Vt,e.addClass=Ce,e.contains=Ee,e.rmClass=we,e.keyNames=fr}jf(me),Qf(me);var nu="iter insert remove copy getEditor constructor".split(" ");for(var di in rt.prototype)rt.prototype.hasOwnProperty(di)&&le(nu,di)<0&&(me.prototype[di]=function(e){return function(){return e.apply(this.doc,arguments)}}(rt.prototype[di]));return bt(rt),me.inputStyles={textarea:Me,contenteditable:ge},me.defineMode=function(e){!me.defaults.mode&&e!="null"&&(me.defaults.mode=e),kt.apply(this,arguments)},me.defineMIME=pr,me.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),me.defineMIME("text/plain","null"),me.defineExtension=function(e,t){me.prototype[e]=t},me.defineDocExtension=function(e,t){rt.prototype[e]=t},me.fromTextArea=tu,ru(me),me.version="5.65.19",me})});var bl=at((yl,ml)=>{(function(g){typeof yl=="object"&&typeof ml=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.defineMode("javascript",function(_,P){var Q=_.indentUnit,W=P.statementIndent,T=P.jsonld,k=P.json||T,N=P.trackScope!==!1,w=P.typescript,R=P.wordCharacters||/[\w$\xa1-\uffff]/,L=function(){function u(We){return{type:We,style:"keyword"}}var h=u("keyword a"),O=u("keyword b"),B=u("keyword c"),S=u("keyword d"),K=u("operator"),he={type:"atom",style:"atom"};return{if:u("if"),while:h,with:h,else:O,do:O,try:O,finally:O,return:S,break:S,continue:S,new:u("new"),delete:B,void:B,throw:B,debugger:u("debugger"),var:u("var"),const:u("var"),let:u("var"),function:u("function"),catch:u("catch"),for:u("for"),switch:u("switch"),case:u("case"),default:u("default"),in:K,typeof:K,instanceof:K,true:he,false:he,null:he,undefined:he,NaN:he,Infinity:he,this:u("this"),class:u("class"),super:u("atom"),yield:B,export:u("export"),import:u("import"),extends:B,await:B}}(),I=/[+\-*&%=<>!?|~^@]/,H=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function j(u){for(var h=!1,O,B=!1;(O=u.next())!=null;){if(!h){if(O=="/"&&!B)return;O=="["?B=!0:B&&O=="]"&&(B=!1)}h=!h&&O=="\\"}}var C,y;function p(u,h,O){return C=u,y=O,h}function x(u,h){var O=u.next();if(O=='"'||O=="'")return h.tokenize=A(O),h.tokenize(u,h);if(O=="."&&u.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(O=="."&&u.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(O))return p(O);if(O=="="&&u.eat(">"))return p("=>","operator");if(O=="0"&&u.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(O))return u.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(O=="/")return u.eat("*")?(h.tokenize=E,E(u,h)):u.eat("/")?(u.skipToEnd(),p("comment","comment")):pt(u,h,1)?(j(u),u.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(u.eat("="),p("operator","operator",u.current()));if(O=="`")return h.tokenize=X,X(u,h);if(O=="#"&&u.peek()=="!")return u.skipToEnd(),p("meta","meta");if(O=="#"&&u.eatWhile(R))return p("variable","property");if(O=="<"&&u.match("!--")||O=="-"&&u.match("->")&&!/\S/.test(u.string.slice(0,u.start)))return u.skipToEnd(),p("comment","comment");if(I.test(O))return(O!=">"||!h.lexical||h.lexical.type!=">")&&(u.eat("=")?(O=="!"||O=="=")&&u.eat("="):/[<>*+\-|&?]/.test(O)&&(u.eat(O),O==">"&&u.eat(O))),O=="?"&&u.eat(".")?p("."):p("operator","operator",u.current());if(R.test(O)){u.eatWhile(R);var B=u.current();if(h.lastType!="."){if(L.propertyIsEnumerable(B)){var S=L[B];return p(S.type,S.style,B)}if(B=="async"&&u.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",B)}return p("variable","variable",B)}}function A(u){return function(h,O){var B=!1,S;if(T&&h.peek()=="@"&&h.match(H))return O.tokenize=x,p("jsonld-keyword","meta");for(;(S=h.next())!=null&&!(S==u&&!B);)B=!B&&S=="\\";return B||(O.tokenize=x),p("string","string")}}function E(u,h){for(var O=!1,B;B=u.next();){if(B=="/"&&O){h.tokenize=x;break}O=B=="*"}return p("comment","comment")}function X(u,h){for(var O=!1,B;(B=u.next())!=null;){if(!O&&(B=="`"||B=="$"&&u.eat("{"))){h.tokenize=x;break}O=!O&&B=="\\"}return p("quasi","string-2",u.current())}var V="([{}])";function J(u,h){h.fatArrowAt&&(h.fatArrowAt=null);var O=u.string.indexOf("=>",u.start);if(!(O<0)){if(w){var B=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(u.string.slice(u.start,O));B&&(O=B.index)}for(var S=0,K=!1,he=O-1;he>=0;--he){var We=u.string.charAt(he),et=V.indexOf(We);if(et>=0&&et<3){if(!S){++he;break}if(--S==0){We=="("&&(K=!0);break}}else if(et>=3&&et<6)++S;else if(R.test(We))K=!0;else if(/["'\/`]/.test(We))for(;;--he){if(he==0)return;var Nr=u.string.charAt(he-1);if(Nr==We&&u.string.charAt(he-2)!="\\"){he--;break}}else if(K&&!S){++he;break}}K&&!S&&(h.fatArrowAt=he)}}var ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function be(u,h,O,B,S,K){this.indented=u,this.column=h,this.type=O,this.prev=S,this.info=K,B!=null&&(this.align=B)}function pe(u,h){if(!N)return!1;for(var O=u.localVars;O;O=O.next)if(O.name==h)return!0;for(var B=u.context;B;B=B.prev)for(var O=B.vars;O;O=O.next)if(O.name==h)return!0}function we(u,h,O,B,S){var K=u.cc;for(D.state=u,D.stream=S,D.marked=null,D.cc=K,D.style=h,u.lexical.hasOwnProperty("align")||(u.lexical.align=!0);;){var he=K.length?K.pop():k?le:ve;if(he(O,B)){for(;K.length&&K[K.length-1].lex;)K.pop()();return D.marked?D.marked:O=="variable"&&pe(u,B)?"variable-2":h}}}var D={state:null,column:null,marked:null,cc:null};function Y(){for(var u=arguments.length-1;u>=0;u--)D.cc.push(arguments[u])}function v(){return Y.apply(null,arguments),!0}function Ye(u,h){for(var O=h;O;O=O.next)if(O.name==u)return!0;return!1}function _e(u){var h=D.state;if(D.marked="def",!!N){if(h.context){if(h.lexical.info=="var"&&h.context&&h.context.block){var O=Ee(u,h.context);if(O!=null){h.context=O;return}}else if(!Ye(u,h.localVars)){h.localVars=new He(u,h.localVars);return}}P.globalVars&&!Ye(u,h.globalVars)&&(h.globalVars=new He(u,h.globalVars))}}function Ee(u,h){if(h)if(h.block){var O=Ee(u,h.prev);return O?O==h.prev?h:new Ce(O,h.vars,!0):null}else return Ye(u,h.vars)?h:new Ce(h.prev,new He(u,h.vars),!1);else return null}function Ae(u){return u=="public"||u=="private"||u=="protected"||u=="abstract"||u=="readonly"}function Ce(u,h,O){this.prev=u,this.vars=h,this.block=O}function He(u,h){this.name=u,this.next=h}var cr=new He("this",new He("arguments",null));function ct(){D.state.context=new Ce(D.state.context,D.state.localVars,!1),D.state.localVars=cr}function mt(){D.state.context=new Ce(D.state.context,D.state.localVars,!0),D.state.localVars=null}ct.lex=mt.lex=!0;function Pe(){D.state.localVars=D.state.context.vars,D.state.context=D.state.context.prev}Pe.lex=!0;function oe(u,h){var O=function(){var B=D.state,S=B.indented;if(B.lexical.type=="stat")S=B.lexical.indented;else for(var K=B.lexical;K&&K.type==")"&&K.align;K=K.prev)S=K.indented;B.lexical=new be(S,D.stream.column(),u,null,B.lexical,h)};return O.lex=!0,O}function ne(){var u=D.state;u.lexical.prev&&(u.lexical.type==")"&&(u.indented=u.lexical.indented),u.lexical=u.lexical.prev)}ne.lex=!0;function fe(u){function h(O){return O==u?v():u==";"||O=="}"||O==")"||O=="]"?Y():v(h)}return h}function ve(u,h){return u=="var"?v(oe("vardef",h),Lr,fe(";"),ne):u=="keyword a"?v(oe("form"),Yt,ve,ne):u=="keyword b"?v(oe("form"),ve,ne):u=="keyword d"?D.stream.match(/^\s*$/,!1)?v():v(oe("stat"),Ot,fe(";"),ne):u=="debugger"?v(fe(";")):u=="{"?v(oe("}"),mt,Ft,ne,Pe):u==";"?v():u=="if"?(D.state.lexical.info=="else"&&D.state.cc[D.state.cc.length-1]==ne&&D.state.cc.pop()(),v(oe("form"),Yt,ve,ne,Tr)):u=="function"?v(yt):u=="for"?v(oe("form"),mt,Wn,ve,Pe,ne):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form",u=="class"?u:h),Mr,ne)):u=="variable"?w&&h=="declare"?(D.marked="keyword",v(ve)):w&&(h=="module"||h=="enum"||h=="type")&&D.stream.match(/^\s*\w/,!1)?(D.marked="keyword",h=="enum"?v($):h=="type"?v(In,fe("operator"),ue,fe(";")):v(oe("form"),$e,fe("{"),oe("}"),Ft,ne,ne)):w&&h=="namespace"?(D.marked="keyword",v(oe("form"),le,ve,ne)):w&&h=="abstract"?(D.marked="keyword",v(ve)):v(oe("stat"),gi):u=="switch"?v(oe("form"),Yt,fe("{"),oe("}","switch"),mt,Ft,ne,ne,Pe):u=="case"?v(le,fe(":")):u=="default"?v(fe(":")):u=="catch"?v(oe("form"),ct,At,ve,ne,Pe):u=="export"?v(oe("stat"),Ar,ne):u=="import"?v(oe("stat"),tr,ne):u=="async"?v(ve):h=="@"?v(le,ve):Y(oe("stat"),le,fe(";"),ne)}function At(u){if(u=="(")return v(wt,fe(")"))}function le(u,h){return ht(u,h,!1)}function Ze(u,h){return ht(u,h,!0)}function Yt(u){return u!="("?Y():v(oe(")"),Ot,fe(")"),ne)}function ht(u,h,O){if(D.state.fatArrowAt==D.stream.start){var B=O?hr:ce;if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,fe("=>"),B,Pe);if(u=="variable")return Y(ct,$e,fe("=>"),B,Pe)}var S=O?Dt:dt;return ae.hasOwnProperty(u)?v(S):u=="function"?v(yt,S):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form"),bi,ne)):u=="keyword c"||u=="async"?v(O?Ze:le):u=="("?v(oe(")"),Ot,fe(")"),ne,S):u=="operator"||u=="spread"?v(O?Ze:le):u=="["?v(oe("]"),Le,ne,S):u=="{"?Zt(Bt,"}",null,S):u=="quasi"?Y(It,S):u=="new"?v(vi(O)):v()}function Ot(u){return u.match(/[;\}\)\],]/)?Y():Y(le)}function dt(u,h){return u==","?v(Ot):Dt(u,h,!1)}function Dt(u,h,O){var B=O==!1?dt:Dt,S=O==!1?le:Ze;if(u=="=>")return v(ct,O?hr:ce,Pe);if(u=="operator")return/\+\+|--/.test(h)||w&&h=="!"?v(B):w&&h=="<"&&D.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?v(oe(">"),Oe(ue,">"),ne,B):h=="?"?v(le,fe(":"),S):v(S);if(u=="quasi")return Y(It,B);if(u!=";"){if(u=="(")return Zt(Ze,")","call",B);if(u==".")return v($r,B);if(u=="[")return v(oe("]"),Ot,fe("]"),ne,B);if(w&&h=="as")return D.marked="keyword",v(ue,B);if(u=="regexp")return D.state.lastType=D.marked="operator",D.stream.backUp(D.stream.pos-D.stream.start-1),v(S)}}function It(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(It):v(Ot,Vr)}function Vr(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(It)}function ce(u){return J(D.stream,D.state),Y(u=="{"?ve:le)}function hr(u){return J(D.stream,D.state),Y(u=="{"?ve:Ze)}function vi(u){return function(h){return h=="."?v(u?En:Nn):h=="variable"&&w?v(st,u?Dt:dt):Y(u?Ze:le)}}function Nn(u,h){if(h=="target")return D.marked="keyword",v(dt)}function En(u,h){if(h=="target")return D.marked="keyword",v(Dt)}function gi(u){return u==":"?v(ne,ve):Y(dt,fe(";"),ne)}function $r(u){if(u=="variable")return D.marked="property",v()}function Bt(u,h){if(u=="async")return D.marked="property",v(Bt);if(u=="variable"||D.style=="keyword"){if(D.marked="property",h=="get"||h=="set")return v(Hn);var O;return w&&D.state.fatArrowAt==D.stream.start&&(O=D.stream.match(/^\s*:\s*/,!1))&&(D.state.fatArrowAt=D.stream.pos+O[0].length),v(zt)}else{if(u=="number"||u=="string")return D.marked=T?"property":D.style+" property",v(zt);if(u=="jsonld-keyword")return v(zt);if(w&&Ae(h))return D.marked="keyword",v(Bt);if(u=="[")return v(le,Jt,fe("]"),zt);if(u=="spread")return v(Ze,zt);if(h=="*")return D.marked="keyword",v(Bt);if(u==":")return Y(zt)}}function Hn(u){return u!="variable"?Y(zt):(D.marked="property",v(yt))}function zt(u){if(u==":")return v(Ze);if(u=="(")return Y(yt)}function Oe(u,h,O){function B(S,K){if(O?O.indexOf(S)>-1:S==","){var he=D.state.lexical;return he.info=="call"&&(he.pos=(he.pos||0)+1),v(function(We,et){return We==h||et==h?Y():Y(u)},B)}return S==h||K==h?v():O&&O.indexOf(";")>-1?Y(u):v(fe(h))}return function(S,K){return S==h||K==h?v():Y(u,B)}}function Zt(u,h,O){for(var B=3;B"),ue);if(u=="quasi")return Y(Ke,gt)}function Pn(u){if(u=="=>")return v(ue)}function te(u){return u.match(/[\}\)\]]/)?v():u==","||u==";"?v(te):Y(Rt,te)}function Rt(u,h){if(u=="variable"||D.style=="keyword")return D.marked="property",v(Rt);if(h=="?"||u=="number"||u=="string")return v(Rt);if(u==":")return v(ue);if(u=="[")return v(fe("variable"),dr,fe("]"),Rt);if(u=="(")return Y(er,Rt);if(!u.match(/[;\}\)\],]/))return v()}function Ke(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(Ke):v(ue,ke)}function ke(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(Ke)}function Se(u,h){return u=="variable"&&D.stream.match(/^\s*[?:]/,!1)||h=="?"?v(Se):u==":"?v(ue):u=="spread"?v(Se):Y(ue)}function gt(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt);if(h=="|"||u=="."||h=="&")return v(ue);if(u=="[")return v(ue,fe("]"),gt);if(h=="extends"||h=="implements")return D.marked="keyword",v(ue);if(h=="?")return v(ue,fe(":"),ue)}function st(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt)}function bt(){return Y(ue,qe)}function qe(u,h){if(h=="=")return v(ue)}function Lr(u,h){return h=="enum"?(D.marked="keyword",v($)):Y($e,Jt,xt,mi)}function $e(u,h){if(w&&Ae(h))return D.marked="keyword",v($e);if(u=="variable")return _e(h),v();if(u=="spread")return v($e);if(u=="[")return Zt(en,"]");if(u=="{")return Zt(Vt,"}")}function Vt(u,h){return u=="variable"&&!D.stream.match(/^\s*:/,!1)?(_e(h),v(xt)):(u=="variable"&&(D.marked="property"),u=="spread"?v($e):u=="}"?Y():u=="["?v(le,fe("]"),fe(":"),Vt):v(fe(":"),$e,xt))}function en(){return Y($e,xt)}function xt(u,h){if(h=="=")return v(Ze)}function mi(u){if(u==",")return v(Lr)}function Tr(u,h){if(u=="keyword b"&&h=="else")return v(oe("form","else"),ve,ne)}function Wn(u,h){if(h=="await")return v(Wn);if(u=="(")return v(oe(")"),tn,ne)}function tn(u){return u=="var"?v(Lr,$t):u=="variable"?v($t):Y($t)}function $t(u,h){return u==")"?v():u==";"?v($t):h=="in"||h=="of"?(D.marked="keyword",v(le,$t)):Y(le,$t)}function yt(u,h){if(h=="*")return D.marked="keyword",v(yt);if(u=="variable")return _e(h),v(yt);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,ve,Pe);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,yt)}function er(u,h){if(h=="*")return D.marked="keyword",v(er);if(u=="variable")return _e(h),v(er);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,Pe);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,er)}function In(u,h){if(u=="keyword"||u=="variable")return D.marked="type",v(In);if(h=="<")return v(oe(">"),Oe(bt,">"),ne)}function wt(u,h){return h=="@"&&v(le,wt),u=="spread"?v(wt):w&&Ae(h)?(D.marked="keyword",v(wt)):w&&u=="this"?v(Jt,xt):Y($e,Jt,xt)}function bi(u,h){return u=="variable"?Mr(u,h):Ct(u,h)}function Mr(u,h){if(u=="variable")return _e(h),v(Ct)}function Ct(u,h){if(h=="<")return v(oe(">"),Oe(bt,">"),ne,Ct);if(h=="extends"||h=="implements"||w&&u==",")return h=="implements"&&(D.marked="keyword"),v(w?ue:le,Ct);if(u=="{")return v(oe("}"),kt,ne)}function kt(u,h){if(u=="async"||u=="variable"&&(h=="static"||h=="get"||h=="set"||w&&Ae(h))&&D.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return D.marked="keyword",v(kt);if(u=="variable"||D.style=="keyword")return D.marked="property",v(pr,kt);if(u=="number"||u=="string")return v(pr,kt);if(u=="[")return v(le,Jt,fe("]"),pr,kt);if(h=="*")return D.marked="keyword",v(kt);if(w&&u=="(")return Y(er,kt);if(u==";"||u==",")return v(kt);if(u=="}")return v();if(h=="@")return v(le,kt)}function pr(u,h){if(h=="!"||h=="?")return v(pr);if(u==":")return v(ue,xt);if(h=="=")return v(Ze);var O=D.state.lexical.prev,B=O&&O.info=="interface";return Y(B?er:yt)}function Ar(u,h){return h=="*"?(D.marked="keyword",v(Fr,fe(";"))):h=="default"?(D.marked="keyword",v(le,fe(";"))):u=="{"?v(Oe(Or,"}"),Fr,fe(";")):Y(ve)}function Or(u,h){if(h=="as")return D.marked="keyword",v(fe("variable"));if(u=="variable")return Y(Ze,Or)}function tr(u){return u=="string"?v():u=="("?Y(le):u=="."?Y(dt):Y(Dr,Nt,Fr)}function Dr(u,h){return u=="{"?Zt(Dr,"}"):(u=="variable"&&_e(h),h=="*"&&(D.marked="keyword"),v(rn))}function Nt(u){if(u==",")return v(Dr,Nt)}function rn(u,h){if(h=="as")return D.marked="keyword",v(Dr)}function Fr(u,h){if(h=="from")return D.marked="keyword",v(le)}function Le(u){return u=="]"?v():Y(Oe(Ze,"]"))}function $(){return Y(oe("form"),$e,fe("{"),oe("}"),Oe(Gt,"}"),ne,ne)}function Gt(){return Y($e,xt)}function nn(u,h){return u.lastType=="operator"||u.lastType==","||I.test(h.charAt(0))||/[,.]/.test(h.charAt(0))}function pt(u,h,O){return h.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(h.lastType)||h.lastType=="quasi"&&/\{\s*$/.test(u.string.slice(0,u.pos-(O||0)))}return{startState:function(u){var h={tokenize:x,lastType:"sof",cc:[],lexical:new be((u||0)-Q,0,"block",!1),localVars:P.localVars,context:P.localVars&&new Ce(null,null,!1),indented:u||0};return P.globalVars&&typeof P.globalVars=="object"&&(h.globalVars=P.globalVars),h},token:function(u,h){if(u.sol()&&(h.lexical.hasOwnProperty("align")||(h.lexical.align=!1),h.indented=u.indentation(),J(u,h)),h.tokenize!=E&&u.eatSpace())return null;var O=h.tokenize(u,h);return C=="comment"?O:(h.lastType=C=="operator"&&(y=="++"||y=="--")?"incdec":C,we(h,O,C,y,u))},indent:function(u,h){if(u.tokenize==E||u.tokenize==X)return g.Pass;if(u.tokenize!=x)return 0;var O=h&&h.charAt(0),B=u.lexical,S;if(!/^\s*else\b/.test(h))for(var K=u.cc.length-1;K>=0;--K){var he=u.cc[K];if(he==ne)B=B.prev;else if(he!=Tr&&he!=Pe)break}for(;(B.type=="stat"||B.type=="form")&&(O=="}"||(S=u.cc[u.cc.length-1])&&(S==dt||S==Dt)&&!/^[,\.=+\-*:?[\(]/.test(h));)B=B.prev;W&&B.type==")"&&B.prev.type=="stat"&&(B=B.prev);var We=B.type,et=O==We;return We=="vardef"?B.indented+(u.lastType=="operator"||u.lastType==","?B.info.length+1:0):We=="form"&&O=="{"?B.indented:We=="form"?B.indented+Q:We=="stat"?B.indented+(nn(u,h)?W||Q:0):B.info=="switch"&&!et&&P.doubleIndentSwitch!=!1?B.indented+(/^(?:case|default)\b/.test(h)?Q:2*Q):B.align?B.column+(et?0:1):B.indented+(et?0:Q)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:k?null:"/*",blockCommentEnd:k?null:"*/",blockCommentContinue:k?null:" * ",lineComment:k?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:k?"json":"javascript",jsonldMode:T,jsonMode:k,expressionAllowed:pt,skipExpression:function(u){we(u,"atom","atom","true",new g.StringStream("",2,null))}}}),g.registerHelper("wordChars","javascript",/[\w$]/),g.defineMIME("text/javascript","javascript"),g.defineMIME("text/ecmascript","javascript"),g.defineMIME("application/javascript","javascript"),g.defineMIME("application/x-javascript","javascript"),g.defineMIME("application/ecmascript","javascript"),g.defineMIME("application/json",{name:"javascript",json:!0}),g.defineMIME("application/x-json",{name:"javascript",json:!0}),g.defineMIME("application/manifest+json",{name:"javascript",json:!0}),g.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),g.defineMIME("text/typescript",{name:"javascript",typescript:!0}),g.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var Cl=at((xl,wl)=>{(function(g){typeof xl=="object"&&typeof wl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=g.Pos;g.defineOption("autoCloseBrackets",!1,function(y,p,x){x&&x!=g.Init&&(y.removeKeyMap(W),y.state.closeBrackets=null),p&&(T(Q(p,"pairs")),y.state.closeBrackets=p,y.addKeyMap(W))});function Q(y,p){return p=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[p]!=null?y[p]:_[p]}var W={Backspace:w,Enter:R};function T(y){for(var p=0;p=0;E--){var V=A[E].head;y.replaceRange("",P(V.line,V.ch-1),P(V.line,V.ch+1),"+delete")}}function R(y){var p=N(y),x=p&&Q(p,"explode");if(!x||y.getOption("disableInput"))return g.Pass;for(var A=y.listSelections(),E=0;E0?{line:V.head.line,ch:V.head.ch+p}:{line:V.head.line-1};x.push({anchor:J,head:J})}y.setSelections(x,E)}function I(y){var p=g.cmpPos(y.anchor,y.head)>0;return{anchor:new P(y.anchor.line,y.anchor.ch+(p?-1:1)),head:new P(y.head.line,y.head.ch+(p?1:-1))}}function H(y,p){var x=N(y);if(!x||y.getOption("disableInput"))return g.Pass;var A=Q(x,"pairs"),E=A.indexOf(p);if(E==-1)return g.Pass;for(var X=Q(x,"closeBefore"),V=Q(x,"triples"),J=A.charAt(E+1)==p,ae=y.listSelections(),be=E%2==0,pe,we=0;we=0&&y.getRange(Y,P(Y.line,Y.ch+3))==p+p+p?v="skipThree":v="skip";else if(J&&Y.ch>1&&V.indexOf(p)>=0&&y.getRange(P(Y.line,Y.ch-2),Y)==p+p){if(Y.ch>2&&/\bstring/.test(y.getTokenTypeAt(P(Y.line,Y.ch-2))))return g.Pass;v="addFour"}else if(J){var _e=Y.ch==0?" ":y.getRange(P(Y.line,Y.ch-1),Y);if(!g.isWordChar(Ye)&&_e!=p&&!g.isWordChar(_e))v="both";else return g.Pass}else if(be&&(Ye.length===0||/\s/.test(Ye)||X.indexOf(Ye)>-1))v="both";else return g.Pass;if(!pe)pe=v;else if(pe!=v)return g.Pass}var Ee=E%2?A.charAt(E-1):p,Ae=E%2?p:A.charAt(E+1);y.operation(function(){if(pe=="skip")L(y,1);else if(pe=="skipThree")L(y,3);else if(pe=="surround"){for(var Ce=y.getSelections(),He=0;He{(function(g){typeof kl=="object"&&typeof Sl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=g.Pos;function P(p,x){return p.line-x.line||p.ch-x.ch}var Q="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",W=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",T=new RegExp("<(/?)(["+Q+"]["+W+"]*)","g");function k(p,x,A,E){this.line=x,this.ch=A,this.cm=p,this.text=p.getLine(x),this.min=E?Math.max(E.from,p.firstLine()):p.firstLine(),this.max=E?Math.min(E.to-1,p.lastLine()):p.lastLine()}function N(p,x){var A=p.cm.getTokenTypeAt(_(p.line,x));return A&&/\btag\b/.test(A)}function w(p){if(!(p.line>=p.max))return p.ch=0,p.text=p.cm.getLine(++p.line),!0}function R(p){if(!(p.line<=p.min))return p.text=p.cm.getLine(--p.line),p.ch=p.text.length,!0}function L(p){for(;;){var x=p.text.indexOf(">",p.ch);if(x==-1){if(w(p))continue;return}if(!N(p,x+1)){p.ch=x+1;continue}var A=p.text.lastIndexOf("/",x),E=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,E?"selfClose":"regular"}}function I(p){for(;;){var x=p.ch?p.text.lastIndexOf("<",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}T.lastIndex=x,p.ch=x;var A=T.exec(p.text);if(A&&A.index==x)return A}}function H(p){for(;;){T.lastIndex=p.ch;var x=T.exec(p.text);if(!x){if(w(p))continue;return}if(!N(p,x.index+1)){p.ch=x.index+1;continue}return p.ch=x.index+x[0].length,x}}function j(p){for(;;){var x=p.ch?p.text.lastIndexOf(">",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}var A=p.text.lastIndexOf("/",x),E=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,E?"selfClose":"regular"}}function C(p,x){for(var A=[];;){var E=H(p),X,V=p.line,J=p.ch-(E?E[0].length:0);if(!E||!(X=L(p)))return;if(X!="selfClose")if(E[1]){for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==E[2]){A.length=ae;break}if(ae<0&&(!x||x==E[2]))return{tag:E[2],from:_(V,J),to:_(p.line,p.ch)}}else A.push(E[2])}}function y(p,x){for(var A=[];;){var E=j(p);if(!E)return;if(E=="selfClose"){I(p);continue}var X=p.line,V=p.ch,J=I(p);if(!J)return;if(J[1])A.push(J[2]);else{for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==J[2]){A.length=ae;break}if(ae<0&&(!x||x==J[2]))return{tag:J[2],from:_(p.line,p.ch),to:_(X,V)}}}}g.registerHelper("fold","xml",function(p,x){for(var A=new k(p,x.line,0);;){var E=H(A);if(!E||A.line!=x.line)return;var X=L(A);if(!X)return;if(!E[1]&&X!="selfClose"){var V=_(A.line,A.ch),J=C(A,E[2]);return J&&P(J.from,V)>0?{from:V,to:J.from}:null}}}),g.findMatchingTag=function(p,x,A){var E=new k(p,x.line,x.ch,A);if(!(E.text.indexOf(">")==-1&&E.text.indexOf("<")==-1)){var X=L(E),V=X&&_(E.line,E.ch),J=X&&I(E);if(!(!X||!J||P(E,x)>0)){var ae={from:_(E.line,E.ch),to:V,tag:J[2]};return X=="selfClose"?{open:ae,close:null,at:"open"}:J[1]?{open:y(E,J[2]),close:ae,at:"close"}:(E=new k(p,V.line,V.ch,A),{open:ae,close:C(E,J[2]),at:"open"})}}},g.findEnclosingTag=function(p,x,A,E){for(var X=new k(p,x.line,x.ch,A);;){var V=y(X,E);if(!V)break;var J=new k(p,x.line,x.ch,A),ae=C(J,V.tag);if(ae)return{open:V,close:ae}}},g.scanForClosingTag=function(p,x,A,E){var X=new k(p,x.line,x.ch,E?{from:0,to:E}:null);return C(X,A)}})});var Ml=at((Ll,Tl)=>{(function(g){typeof Ll=="object"&&typeof Tl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){g.defineOption("autoCloseTags",!1,function(w,R,L){if(L!=g.Init&&L&&w.removeKeyMap("autoCloseTags"),!!R){var I={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(I["'/'"]=function(H){return T(H)}),(typeof R!="object"||R.whenOpening!==!1)&&(I["'>'"]=function(H){return Q(H)}),w.addKeyMap(I)}});var _=["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 Q(w){if(w.getOption("disableInput"))return g.Pass;for(var R=w.listSelections(),L=[],I=w.getOption("autoCloseTags"),H=0;Hj.ch&&(A=A.slice(0,A.length-C.end+j.ch));var J=A.toLowerCase();if(!A||C.type=="string"&&(C.end!=j.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&x.close||C.string.indexOf("/")==j.ch-C.start-1||X&&k(X,J)>-1||N(w,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(p)||[],A,j,!0))return g.Pass;var ae=typeof I=="object"&&I.emptyTags;if(ae&&k(ae,A)>-1){L[H]={text:"/>",newPos:g.Pos(j.line,j.ch+2)};continue}var be=V&&k(V,J)>-1;L[H]={indent:be,text:">"+(be?` -`:"")+"",newPos:we?t.Pos(A.line+1,0):t.Pos(A.line,A.ch+1)}}for(var he=typeof S=="object"&&S.dontIndentOnAutoClose,k=m.length-1;k>=0;k--){var ke=x[k];g.replaceRange(ke.text,m[k].head,m[k].anchor,"+insert");var z=g.listSelections().slice(0);z[k]={head:ke.newPos,anchor:ke.newPos},g.setSelections(z),!he&&ke.indent&&(g.indentLine(ke.newPos.line,null,!0),g.indentLine(ke.newPos.line+1,null,!0))}}function a(g,m){for(var x=g.listSelections(),S=[],k=m?"/":""&&(B+=">"),S[L]=B}if(g.replaceSelections(S),x=g.listSelections(),!T)for(var L=0;L=0&&m[C]==x;C--)++L;S=T.to;for(var C=1;C{(function(t){typeof Cg=="object"&&typeof Sg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,l=/[*+-]\s/;t.commands.newlineAndIndentContinueMarkdownList=function(u){if(u.getOption("disableInput"))return t.Pass;for(var d=u.listSelections(),c=[],g=0;g\s*$/.test(T),D=!/>\s*$/.test(T);(M||D)&&u.replaceRange("",{line:m.line,ch:0},{line:m.line,ch:m.ch+1}),c[g]=` -`}else{var E=L[1],B=L[5],K=!(l.test(L[2])||L[2].indexOf(">")>=0),X=K?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");c[g]=` -`+E+X+B,K&&a(u,m)}}u.replaceSelections(c)};function a(u,d){var c=d.line,g=0,m=0,x=r.exec(u.getLine(c)),S=x[1];do{g+=1;var k=c+g,A=u.getLine(k),T=r.exec(A);if(T){var L=T[1],C=parseInt(x[3],10)+g-m,M=parseInt(T[3],10),D=M;if(S===L&&!isNaN(M))C===M&&(D=M+1),C>M&&(D=C+1),u.replaceRange(A.replace(r,L+D+T[4]+T[5]),{line:k,ch:0},{line:k,ch:A.length});else{if(S.length>L.length||S.length{(function(t){typeof Lg=="object"&&typeof Tg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=t.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function a(x){return x&&x.bracketRegex||/[(){}[\]]/}function u(x,S,k){var A=x.getLineHandle(S.line),T=S.ch-1,L=k&&k.afterCursor;L==null&&(L=/(^| )cm-fat-cursor($| )/.test(x.getWrapperElement().className));var C=a(k),M=!L&&T>=0&&C.test(A.text.charAt(T))&&l[A.text.charAt(T)]||C.test(A.text.charAt(T+1))&&l[A.text.charAt(++T)];if(!M)return null;var D=M.charAt(1)==">"?1:-1;if(k&&k.strict&&D>0!=(T==S.ch))return null;var E=x.getTokenTypeAt(n(S.line,T+1)),B=d(x,n(S.line,T+(D>0?1:0)),D,E,k);return B==null?null:{from:n(S.line,T),to:B&&B.pos,match:B&&B.ch==M.charAt(0),forward:D>0}}function d(x,S,k,A,T){for(var L=T&&T.maxScanLineLength||1e4,C=T&&T.maxScanLines||1e3,M=[],D=a(T),E=k>0?Math.min(S.line+C,x.lastLine()+1):Math.max(x.firstLine()-1,S.line-C),B=S.line;B!=E;B+=k){var K=x.getLine(B);if(K){var X=k>0?0:K.length-1,ee=k>0?K.length:-1;if(!(K.length>L))for(B==S.line&&(X=S.ch-(k<0?1:0));X!=ee;X+=k){var we=K.charAt(X);if(D.test(we)&&(A===void 0||(x.getTokenTypeAt(n(B,X+1))||"")==(A||""))){var he=l[we];if(he&&he.charAt(1)==">"==k>0)M.push(we);else if(M.length)M.pop();else return{pos:n(B,X),ch:we}}}}}return B-k==(k>0?x.lastLine():x.firstLine())?!1:null}function c(x,S,k){for(var A=x.state.matchBrackets.maxHighlightLineLength||1e3,T=k&&k.highlightNonMatching,L=[],C=x.listSelections(),M=0;M{(function(t){typeof Ag=="object"&&typeof Og=="object"?t(Ht(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],t):t(CodeMirror)})(function(t){"use strict";t.defineOption("matchTags",!1,function(a,u,d){d&&d!=t.Init&&(a.off("cursorActivity",n),a.off("viewportChange",l),r(a)),u&&(a.state.matchBothTags=typeof u=="object"&&u.bothTags,a.on("cursorActivity",n),a.on("viewportChange",l),n(a))});function r(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function n(a){a.state.failedTagMatch=!1,a.operation(function(){if(r(a),!a.somethingSelected()){var u=a.getCursor(),d=a.getViewport();d.from=Math.min(d.from,u.line),d.to=Math.max(u.line+1,d.to);var c=t.findMatchingTag(a,u,d);if(c){if(a.state.matchBothTags){var g=c.at=="open"?c.open:c.close;g&&(a.state.tagHit=a.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var m=c.at=="close"?c.open:c.close;m?a.state.tagOther=a.markText(m.from,m.to,{className:"CodeMirror-matchingtag"}):a.state.failedTagMatch=!0}}})}function l(a){a.state.failedTagMatch&&n(a)}t.commands.toMatchingTag=function(a){var u=t.findMatchingTag(a,a.getCursor());if(u){var d=u.at=="close"?u.open:u.close;d&&a.extendSelection(d.to,d.from)}}})});var Wg=Ut((Ng,Hg)=>{(function(t){typeof Ng=="object"&&typeof Hg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){t.defineOption("showTrailingSpace",!1,function(r,n,l){l==t.Init&&(l=!1),l&&!n?r.removeOverlay("trailingspace"):!l&&n&&r.addOverlay({token:function(a){for(var u=a.string.length,d=u;d&&/\s/.test(a.string.charAt(d-1));--d);return d>a.pos?(a.pos=d,null):(a.pos=u,"trailingspace")},name:"trailingspace"})})})});var Eg=Ut((Pg,Fg)=>{(function(t){typeof Pg=="object"&&typeof Fg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(n){return function(l,a){var u=a.line,d=l.getLine(u);function c(A){for(var T,L=a.ch,C=0;;){var M=L<=0?-1:d.lastIndexOf(A[0],L-1);if(M==-1){if(C==1)break;C=1,L=d.length;continue}if(C==1&&Mn.lastLine())return null;var S=n.getTokenAt(t.Pos(x,1));if(/\S/.test(S.string)||(S=n.getTokenAt(t.Pos(x,S.end+1))),S.type!="keyword"||S.string!="import")return null;for(var k=x,A=Math.min(n.lastLine(),x+10);k<=A;++k){var T=n.getLine(k),L=T.indexOf(";");if(L!=-1)return{startCh:S.end,end:t.Pos(k,L)}}}var u=l.line,d=a(u),c;if(!d||a(u-1)||(c=a(u-2))&&c.end.line==u-1)return null;for(var g=d.end;;){var m=a(g.line+1);if(m==null)break;g=m.end}return{from:n.clipPos(t.Pos(u,d.startCh+1)),to:g}}),t.registerHelper("fold","include",function(n,l){function a(m){if(mn.lastLine())return null;var x=n.getTokenAt(t.Pos(m,1));if(/\S/.test(x.string)||(x=n.getTokenAt(t.Pos(m,x.end+1))),x.type=="meta"&&x.string.slice(0,8)=="#include")return x.start+8}var u=l.line,d=a(u);if(d==null||a(u-1)!=null)return null;for(var c=u;;){var g=a(c+1);if(g==null)break;++c}return{from:t.Pos(u,d+1),to:n.clipPos(t.Pos(c))}})})});var Rg=Ut((Ig,Bg)=>{(function(t){typeof Ig=="object"&&typeof Bg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.registerGlobalHelper("fold","comment",function(r){return r.blockCommentStart&&r.blockCommentEnd},function(r,n){var l=r.getModeAt(n),a=l.blockCommentStart,u=l.blockCommentEnd;if(!(!a||!u)){for(var d=n.line,c=r.getLine(d),g,m=n.ch,x=0;;){var S=m<=0?-1:c.lastIndexOf(a,m-1);if(S==-1){if(x==1)return;x=1,m=c.length;continue}if(x==1&&S{(function(t){typeof zg=="object"&&typeof Gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(u,d,c,g){if(c&&c.call){var m=c;c=null}else var m=a(u,c,"rangeFinder");typeof d=="number"&&(d=t.Pos(d,0));var x=a(u,c,"minFoldSize");function S(L){var C=m(u,d);if(!C||C.to.line-C.from.lineu.firstLine();)d=t.Pos(d.line-1,0),k=S(!1);if(!(!k||k.cleared||g==="unfold")){var A=n(u,c,k);t.on(A,"mousedown",function(L){T.clear(),t.e_preventDefault(L)});var T=u.markText(k.from,k.to,{replacedWith:A,clearOnEnter:a(u,c,"clearOnEnter"),__isFold:!0});T.on("clear",function(L,C){t.signal(u,"unfold",u,L,C)}),t.signal(u,"fold",u,k.from,k.to)}}function n(u,d,c){var g=a(u,d,"widget");if(typeof g=="function"&&(g=g(c.from,c.to)),typeof g=="string"){var m=document.createTextNode(g);g=document.createElement("span"),g.appendChild(m),g.className="CodeMirror-foldmarker"}else g&&(g=g.cloneNode(!0));return g}t.newFoldFunction=function(u,d){return function(c,g){r(c,g,{rangeFinder:u,widget:d})}},t.defineExtension("foldCode",function(u,d,c){r(this,u,d,c)}),t.defineExtension("isFolded",function(u){for(var d=this.findMarksAt(u),c=0;c{(function(t){typeof Ug=="object"&&typeof _g=="object"?t(Ht(),dh()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)})(function(t){"use strict";t.defineOption("foldGutter",!1,function(T,L,C){C&&C!=t.Init&&(T.clearGutter(T.state.foldGutter.options.gutter),T.state.foldGutter=null,T.off("gutterClick",m),T.off("changes",S),T.off("viewportChange",k),T.off("fold",A),T.off("unfold",A),T.off("swapDoc",S),T.off("optionChange",x)),L&&(T.state.foldGutter=new n(l(L)),g(T),T.on("gutterClick",m),T.on("changes",S),T.on("viewportChange",k),T.on("fold",A),T.on("unfold",A),T.on("swapDoc",S),T.on("optionChange",x))});var r=t.Pos;function n(T){this.options=T,this.from=this.to=0}function l(T){return T===!0&&(T={}),T.gutter==null&&(T.gutter="CodeMirror-foldgutter"),T.indicatorOpen==null&&(T.indicatorOpen="CodeMirror-foldgutter-open"),T.indicatorFolded==null&&(T.indicatorFolded="CodeMirror-foldgutter-folded"),T}function a(T,L){for(var C=T.findMarks(r(L,0),r(L+1,0)),M=0;M=E){if(X&&he&&X.test(he.className))return;we=u(M.indicatorOpen)}}!we&&!he||T.setGutterMarker(ee,M.gutter,we)})}function c(T){return new RegExp("(^|\\s)"+T+"(?:$|\\s)\\s*")}function g(T){var L=T.getViewport(),C=T.state.foldGutter;C&&(T.operation(function(){d(T,L.from,L.to)}),C.from=L.from,C.to=L.to)}function m(T,L,C){var M=T.state.foldGutter;if(M){var D=M.options;if(C==D.gutter){var E=a(T,L);E?E.clear():T.foldCode(r(L,0),D)}}}function x(T,L){L=="mode"&&S(T)}function S(T){var L=T.state.foldGutter;if(L){var C=L.options;L.from=L.to=0,clearTimeout(L.changeUpdate),L.changeUpdate=setTimeout(function(){g(T)},C.foldOnChangeTimeSpan||600)}}function k(T){var L=T.state.foldGutter;if(L){var C=L.options;clearTimeout(L.changeUpdate),L.changeUpdate=setTimeout(function(){var M=T.getViewport();L.from==L.to||M.from-L.to>20||L.from-M.to>20?g(T):T.operation(function(){M.fromL.to&&(d(T,L.to,M.to),L.to=M.to)})},C.updateViewportTimeSpan||400)}}function A(T,L){var C=T.state.foldGutter;if(C){var M=L.line;M>=C.from&&M{(function(t){typeof Xg=="object"&&typeof jg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(n,l){var a=n.getLine(l),u=a.search(/\S/);return u==-1||/\bcomment\b/.test(n.getTokenTypeAt(t.Pos(l,u+1)))?-1:t.countColumn(a,null,n.getOption("tabSize"))}t.registerHelper("fold","indent",function(n,l){var a=r(n,l.line);if(!(a<0)){for(var u=null,d=l.line+1,c=n.lastLine();d<=c;++d){var g=r(n,d);if(g!=-1)if(g>a)u=d;else break}if(u)return{from:t.Pos(l.line,n.getLine(l.line).length),to:t.Pos(u,n.getLine(u).length)}}})})});var Jg=Ut((Yg,Zg)=>{(function(t){typeof Yg=="object"&&typeof Zg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.registerHelper("fold","markdown",function(r,n){var l=100;function a(k){var A=r.getTokenTypeAt(t.Pos(k,0));return A&&/\bheader\b/.test(A)}function u(k,A,T){var L=A&&A.match(/^#+/);return L&&a(k)?L[0].length:(L=T&&T.match(/^[=\-]+\s*$/),L&&a(k+1)?T[0]=="="?1:2:l)}var d=r.getLine(n.line),c=r.getLine(n.line+1),g=u(n.line,d,c);if(g!==l){for(var m=r.lastLine(),x=n.line,S=r.getLine(x+2);x2),gl=/Android/.test(Kt),yi=Yi||gl||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Kt),ot=Yi||/Mac/.test(cc),yc=/\bCrOS\b/.test(Kt),xc=/win/i.test(cc),bn=Wt&&Kt.match(/Version\/(\d*\.\d*)/);bn&&(bn=Number(bn[1]));bn&&bn>=15&&(Wt=!1,Ue=!0);var uu=ot&&(i0||Wt&&(bn==null||bn<12.11)),Wo=$t||de&&Se>=9;function Zi(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var Vt=function(t,r){let n=t.className,l=Zi(r).exec(n);if(l){let a=n.slice(l.index+l[0].length);t.className=n.slice(0,l.index)+(a?l[1]+a:"")}};function gr(t){for(let r=t.childNodes.length;r>0;--r)t.removeChild(t.firstChild);return t}function vt(t,r){return gr(t).appendChild(r)}function re(t,r,n,l){let a=document.createElement(t);if(n&&(a.className=n),l&&(a.style.cssText=l),typeof r=="string")a.appendChild(document.createTextNode(r));else if(r)for(let u=0;u=r)return d+(r-u);d+=c-u,d+=n-d%n,u=c+1}}var fr=class{constructor(){this.id=null,this.f=null,this.time=0,this.handler=Po(this.onTimeout,this)}onTimeout(r){r.id=0,r.time<=+new Date?r.f():setTimeout(r.handler,r.time-+new Date)}set(r,n){this.f=n;let l=+new Date+r;(!this.id||l=r)return l+Math.min(d,r-a);if(a+=u-l,a+=n-a%n,l=u+1,a>=r)return l}}var Vs=[""];function ml(t){for(;Vs.length<=t;)Vs.push(ge(Vs)+" ");return Vs[t]}function ge(t){return t[t.length-1]}function Qi(t,r){let n=[];for(let l=0;l"\x80"&&(t.toUpperCase()!=t.toLowerCase()||n0.test(t))}function Eo(t,r){return r?r.source.indexOf("\\w")>-1&&ea(t)?!0:r.test(t):ea(t)}function hu(t){for(let r in t)if(t.hasOwnProperty(r)&&t[r])return!1;return!0}var l0=/[\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 na(t){return t.charCodeAt(0)>=768&&l0.test(t)}function la(t,r,n){for(;(n<0?r>0:rn?-1:1;for(;;){if(r==n)return r;let a=(r+n)/2,u=l<0?Math.ceil(a):Math.floor(a);if(u==r)return t(u)?r:n;t(u)?n=u:r=u+l}}function Cc(t,r,n,l){if(!t)return l(r,n,"ltr",0);let a=!1;for(let u=0;ur||r==n&&d.to==r)&&(l(Math.max(d.from,r),Math.min(d.to,n),d.level==1?"rtl":"ltr",u),a=!0)}a||l(r,n,"ltr")}var yl=null;function bi(t,r,n){let l;yl=null;for(let a=0;ar)return a;u.to==r&&(u.from!=u.to&&n=="before"?l=a:yl=a),u.from==r&&(u.from!=u.to&&n!="before"?l=a:yl=a)}return l??yl}var o0=function(){let t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(m){return m<=247?t.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1785?r.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}let l=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,u=/[LRr]/,d=/[Lb1n]/,c=/[1n]/;function g(m,x,S){this.level=m,this.from=x,this.to=S}return function(m,x){let S=x=="ltr"?"L":"R";if(m.length==0||x=="ltr"&&!l.test(m))return!1;let k=m.length,A=[];for(let C=0;C-1&&(l[r]=a.slice(0,u).concat(a.slice(u+1)))}}}function Ae(t,r){let n=oa(t,r);if(!n.length)return;let l=Array.prototype.slice.call(arguments,2);for(let a=0;a0}function Ir(t){t.prototype.on=function(r,n){ne(this,r,n)},t.prototype.off=function(r,n){yt(this,r,n)}}function Ve(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function du(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function aa(t){return t.defaultPrevented!=null?t.defaultPrevented:t.returnValue==!1}function wi(t){Ve(t),du(t)}function xl(t){return t.target||t.srcElement}function cu(t){let r=t.which;return r==null&&(t.button&1?r=1:t.button&2?r=3:t.button&4&&(r=2)),ot&&t.ctrlKey&&r==1&&(r=3),r}var kc=function(){if(de&&Se<9)return!1;let t=re("div");return"draggable"in t||"dragDrop"in t}(),pu;function Lc(t){if(pu==null){let n=re("span","\u200B");vt(t,re("span",[n,document.createTextNode("x")])),t.firstChild.offsetHeight!=0&&(pu=n.offsetWidth<=1&&n.offsetHeight>2&&!(de&&Se<8))}let r=pu?re("span","\u200B"):re("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var gu;function Tc(t){if(gu!=null)return gu;let r=vt(t,document.createTextNode("A\u062EA")),n=$r(r,0,1).getBoundingClientRect(),l=$r(r,1,2).getBoundingClientRect();return gr(t),!n||n.left==n.right?!1:gu=l.right-n.right<3}var bl=` - -b`.split(/\n/).length!=3?t=>{let r=0,n=[],l=t.length;for(;r<=l;){let a=t.indexOf(` -`,r);a==-1&&(a=t.length);let u=t.slice(r,t.charAt(a-1)=="\r"?a-1:a),d=u.indexOf("\r");d!=-1?(n.push(u.slice(0,d)),r+=d+1):(n.push(u),r=a+1)}return n}:t=>t.split(/\r\n?|\n/),Mc=window.getSelection?t=>{try{return t.selectionStart!=t.selectionEnd}catch{return!1}}:t=>{let r;try{r=t.ownerDocument.selection.createRange()}catch{}return!r||r.parentElement()!=t?!1:r.compareEndPoints("StartToEnd",r)!=0},Ac=(()=>{let t=re("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),typeof t.oncopy=="function")})(),vu=null;function Oc(t){if(vu!=null)return vu;let r=vt(t,re("span","x")),n=r.getBoundingClientRect(),l=$r(r,0,1).getBoundingClientRect();return vu=Math.abs(n.left-l.left)>1}var fa={},Tn={};function Dc(t,r){arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),fa[t]=r}function Nc(t,r){Tn[t]=r}function Io(t){if(typeof t=="string"&&Tn.hasOwnProperty(t))t=Tn[t];else if(t&&typeof t.name=="string"&&Tn.hasOwnProperty(t.name)){let r=Tn[t.name];typeof r=="string"&&(r={name:r}),t=ia(r,t),t.name=r.name}else{if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Io("application/xml");if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Io("application/json")}return typeof t=="string"?{name:t}:t||{name:"null"}}function Bo(t,r){r=Io(r);let n=fa[r.name];if(!n)return Bo(t,"text/plain");let l=n(t,r);if(Mn.hasOwnProperty(r.name)){let a=Mn[r.name];for(let u in a)a.hasOwnProperty(u)&&(l.hasOwnProperty(u)&&(l["_"+u]=l[u]),l[u]=a[u])}if(l.name=r.name,r.helperType&&(l.helperType=r.helperType),r.modeProps)for(let a in r.modeProps)l[a]=r.modeProps[a];return l}var Mn={};function Hc(t,r){let n=Mn.hasOwnProperty(t)?Mn[t]:Mn[t]={};Er(r,n)}function Vr(t,r){if(r===!0)return r;if(t.copyState)return t.copyState(r);let n={};for(let l in r){let a=r[l];a instanceof Array&&(a=a.concat([])),n[l]=a}return n}function Ro(t,r){let n;for(;t.innerMode&&(n=t.innerMode(r),!(!n||n.mode==t));)r=n.state,t=n.mode;return n||{mode:t,state:r}}function ua(t,r,n){return t.startState?t.startState(r,n):!0}var mu=class{constructor(r,n,l){this.pos=this.start=0,this.string=r,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=l}eol(){return this.pos>=this.string.length}sol(){return this.pos==this.lineStart}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let r=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>r}skipToEnd(){this.pos=this.string.length}skipTo(r){let n=this.string.indexOf(r,this.pos);if(n>-1)return this.pos=n,!0}backUp(r){this.pos-=r}column(){return this.lastColumnPosl?d.toLowerCase():d,u=this.string.substr(this.pos,r.length);if(a(u)==a(r))return n!==!1&&(this.pos+=r.length),!0}else{let a=this.string.slice(this.pos).match(r);return a&&a.index>0?null:(a&&n!==!1&&(this.pos+=a[0].length),a)}}current(){return this.string.slice(this.start,this.pos)}hideFirstChars(r,n){this.lineStart+=r;try{return n()}finally{this.lineStart-=r}}lookAhead(r){let n=this.lineOracle;return n&&n.lookAhead(r)}baseToken(){let r=this.lineOracle;return r&&r.baseToken(this.pos)}},wl=mu;function V(t,r){if(r-=t.first,r<0||r>=t.size)throw new Error("There is no line "+(r+t.first)+" in the document.");let n=t;for(;!n.lines;)for(let l=0;;++l){let a=n.children[l],u=a.chunkSize();if(r{let d=u.text;a==n.line&&(d=d.slice(0,n.ch)),a==r.line&&(d=d.slice(r.ch)),l.push(d),++a}),l}function ha(t,r,n){let l=[];return t.iter(r,n,a=>{l.push(a.text)}),l}function Xt(t,r){let n=r-t.height;if(n)for(let l=t;l;l=l.parent)l.height+=n}function xe(t){if(t.parent==null)return null;let r=t.parent,n=He(r.lines,t);for(let l=r.parent;l;r=l,l=l.parent)for(let a=0;l.children[a]!=r;++a)n+=l.children[a].chunkSize();return n+r.first}function Rr(t,r){let n=t.first;e:do{for(let a=0;a=t.first&&rn?U(n,V(t,n).text.length):s0(r,V(t,r.line).text.length)}function s0(t,r){let n=t.ch;return n==null||n>r?U(t.line,r):n<0?U(t.line,0):t}function yu(t,r){let n=[];for(let l=0;lthis.maxLookAhead&&(this.maxLookAhead=r),n}baseToken(r){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=r;)this.baseTokenPos+=2;let n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-r}}nextLine(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--}static fromSaved(r,n,l){return n instanceof Sl?new t(r,Vr(r.mode,n.state),l,n.lookAhead):new t(r,Vr(r.mode,n),l)}save(r){let n=r!==!1?Vr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Sl(n,this.maxLookAhead):n}};function xu(t,r,n,l){let a=[t.state.modeGen],u={};Pc(t,r.text,t.doc.mode,n,(c,g)=>a.push(c,g),u,l);let d=n.state;for(let c=0;c{let A=m;for(;xS&&a.splice(m,1,S,a[m+1],T),m+=2,x=Math.min(S,T)}if(k)if(g.opaque)a.splice(A,m-A,S,"overlay "+k),m=A+2;else for(;At.options.maxHighlightLength&&Vr(t.doc.mode,l.state),u=xu(t,r,l);a&&(l.state=a),r.stateAfter=l.save(!a),r.styles=u.styles,u.classes?r.styleClasses=u.classes:r.styleClasses&&(r.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return r.styles}function Vi(t,r,n){let l=t.doc,a=t.display;if(!l.mode.startState)return new Uo(l,!0,r);let u=a0(t,r,n),d=u>l.first&&V(l,u-1).stateAfter,c=d?Uo.fromSaved(l,d,u):new Uo(l,ua(l.mode),u);return l.iter(u,r,g=>{ga(t,g.text,c);let m=c.line;g.stateAfter=m==r-1||m%5==0||m>=a.viewFrom&&mr.start)return u}throw new Error("Mode "+t.name+" failed to advance stream.")}var ca=class{constructor(r,n,l){this.start=r.start,this.end=r.pos,this.string=r.current(),this.type=n||null,this.state=l}};function wu(t,r,n,l){let a=t.doc,u=a.mode,d;r=oe(a,r);let c=V(a,r.line),g=Vi(t,r.line,n),m=new wl(c.text,t.options.tabSize,g),x;for(l&&(x=[]);(l||m.post.options.maxHighlightLength?(c=!1,d&&ga(t,r,l,x.pos),x.pos=r.length,S=null):S=Wc(bu(n,x,l.state,k),u),k){let A=k[0].name;A&&(S="m-"+(S?A+" "+S:A))}if(!c||m!=S){for(;gd;--c){if(c<=u.first)return u.first;let g=V(u,c-1),m=g.stateAfter;if(m&&(!n||c+(m instanceof Sl?m.lookAhead:0)<=u.modeFrontier))return c;let x=mt(g.text,null,t.options.tabSize);(a==null||l>x)&&(a=c-1,l=x)}return a}function Ec(t,r){if(t.modeFrontier=Math.min(t.modeFrontier,r),t.highlightFrontiern;l--){let a=V(t,l).stateAfter;if(a&&(!(a instanceof Sl)||l+a.lookAhead=r:u.to>r);(l||(l=[])).push(new _o(d,u.from,g?null:u.to))}}return l}function u0(t,r,n){let l;if(t)for(let a=0;a=r:u.to>r)||u.from==r&&d.type=="bookmark"&&(!n||u.marker.insertLeft)){let g=u.from==null||(d.inclusiveLeft?u.from<=r:u.from0&&c)for(let T=0;T{if(u.markedSpans)for(let d=0;d0)continue;let x=[g,1],S=se(m.from,c.from),k=se(m.to,c.to);(S<0||!d.inclusiveLeft&&!S)&&x.push({from:m.from,to:c.from}),(k>0||!d.inclusiveRight&&!k)&&x.push({from:c.to,to:m.to}),a.splice.apply(a,x),g+=x.length-3}}return a}function ku(t){let r=t.markedSpans;if(r){for(let n=0;nr)&&(!l||ya(l,u.marker)<0)&&(l=u.marker)}return l}function Tu(t,r,n,l,a){let u=V(t,r),d=mr&&u.markedSpans;if(d)for(let c=0;c=0&&S<=0||x<=0&&S>=0)&&(x<=0&&(g.marker.inclusiveRight&&a.inclusiveLeft?se(m.to,n)>=0:se(m.to,n)>0)||x>=0&&(g.marker.inclusiveRight&&a.inclusiveLeft?se(m.from,l)<=0:se(m.from,l)<0)))return!0}}function Mt(t){let r;for(;r=Kc(t);)t=r.find(-1,!0).line;return t}function jc(t){let r;for(;r=xa(t);)t=r.find(1,!0).line;return t}function qc(t){let r,n;for(;r=xa(t);)t=r.find(1,!0).line,(n||(n=[])).push(t);return n}function Xo(t,r){let n=V(t,r),l=Mt(n);return n==l?r:xe(l)}function ba(t,r){if(r>t.lastLine())return r;let n=V(t,r),l;if(!yr(t,n))return r;for(;l=xa(n);)n=l.find(1,!0).line;return xe(n)+1}function yr(t,r){let n=mr&&r.markedSpans;if(n){for(let l,a=0;a{let a=Ll(l);a>r.maxLineLength&&(r.maxLineLength=a,r.maxLine=l)})}var ei=class{constructor(r,n,l){this.text=r,Lu(this,n),this.height=l?l(this):1}lineNo(){return xe(this)}};Ir(ei);function Jc(t,r,n,l){t.text=r,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),t.order!=null&&(t.order=null),ku(t),Lu(t,n);let a=l?l(t):1;a!=t.height&&Xt(t,a)}function Qc(t){t.parent=null,ku(t)}var h0={},d0={};function Yc(t,r){if(!t||/^\s*$/.test(t))return null;let n=r.addModeClass?d0:h0;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function wa(t,r){let n=xi("span",null,null,Ue?"padding-right: .1px":null),l={pre:xi("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};r.measure={};for(let a=0;a<=(r.rest?r.rest.length:0);a++){let u=a?r.rest[a-1]:r.line,d;l.pos=0,l.addToken=c0,Tc(t.display.measure)&&(d=Pt(u,t.doc.direction))&&(l.addToken=g0(l.addToken,d)),l.map=[];let c=r!=t.display.externalMeasured&&xe(u);v0(u,l,pa(t,u,c)),u.styleClasses&&(u.styleClasses.bgClass&&(l.bgClass=$s(u.styleClasses.bgClass,l.bgClass||"")),u.styleClasses.textClass&&(l.textClass=$s(u.styleClasses.textClass,l.textClass||""))),l.map.length==0&&l.map.push(0,0,l.content.appendChild(Lc(t.display.measure))),a==0?(r.measure.map=l.map,r.measure.cache={}):((r.measure.maps||(r.measure.maps=[])).push(l.map),(r.measure.caches||(r.measure.caches=[])).push({}))}if(Ue){let a=l.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(l.content.className="cm-tab-wrap-hack")}return Ae(t,"renderLine",t,r.line,l.pre),l.pre.className&&(l.textClass=$s(l.pre.className,l.textClass||"")),l}function $c(t){let r=re("span","\u2022","cm-invalidchar");return r.title="\\u"+t.charCodeAt(0).toString(16),r.setAttribute("aria-label",r.title),r}function c0(t,r,n,l,a,u,d){if(!r)return;let c=t.splitSpaces?p0(r,t.trailingSpace):r,g=t.cm.state.specialChars,m=!1,x;if(!g.test(r))t.col+=r.length,x=document.createTextNode(c),t.map.push(t.pos,t.pos+r.length,x),de&&Se<9&&(m=!0),t.pos+=r.length;else{x=document.createDocumentFragment();let S=0;for(;;){g.lastIndex=S;let k=g.exec(r),A=k?k.index-S:r.length-S;if(A){let L=document.createTextNode(c.slice(S,S+A));de&&Se<9?x.appendChild(re("span",[L])):x.appendChild(L),t.map.push(t.pos,t.pos+A,L),t.col+=A,t.pos+=A}if(!k)break;S+=A+1;let T;if(k[0]==" "){let L=t.cm.options.tabSize,C=L-t.col%L;T=x.appendChild(re("span",ml(C),"cm-tab")),T.setAttribute("role","presentation"),T.setAttribute("cm-text"," "),t.col+=C}else k[0]=="\r"||k[0]==` -`?(T=x.appendChild(re("span",k[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),T.setAttribute("cm-text",k[0]),t.col+=1):(T=t.cm.options.specialCharPlaceholder(k[0]),T.setAttribute("cm-text",k[0]),de&&Se<9?x.appendChild(re("span",[T])):x.appendChild(T),t.col+=1);t.map.push(t.pos,t.pos+1,T),t.pos++}}if(t.trailingSpace=c.charCodeAt(r.length-1)==32,n||l||a||m||u||d){let S=n||"";l&&(S+=l),a&&(S+=a);let k=re("span",[x],S,u);if(d)for(let A in d)d.hasOwnProperty(A)&&A!="style"&&A!="class"&&k.setAttribute(A,d[A]);return t.content.appendChild(k)}t.content.appendChild(x)}function p0(t,r){if(t.length>1&&!/ /.test(t))return t;let n=r,l="";for(let a=0;a{a=a?a+" cm-force-border":"cm-force-border";let m=n.pos,x=m+l.length;for(;;){let S;for(let k=0;km&&S.from<=m));k++);if(S.to>=x)return t(n,l,a,u,d,c,g);t(n,l.slice(0,S.to-m),a,u,null,c,g),u=null,l=l.slice(S.to-m),m=S.to}}}function Zc(t,r,n,l){let a=!l&&n.widgetNode;a&&t.map.push(t.pos,t.pos+r,a),!l&&t.cm.display.input.needsContentAttribute&&(a||(a=t.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(t.cm.display.input.setUneditable(a),t.content.appendChild(a)),t.pos+=r,t.trailingSpace=!1}function v0(t,r,n){let l=t.markedSpans,a=t.text,u=0;if(!l){for(let D=1;Dc||ee.collapsed&&X.to==c&&X.from==c)){if(X.to!=null&&X.to!=c&&k>X.to&&(k=X.to,T=""),ee.className&&(A+=" "+ee.className),ee.css&&(S=(S?S+";":"")+ee.css),ee.startStyle&&X.from==c&&(L+=" "+ee.startStyle),ee.endStyle&&X.to==k&&(B||(B=[])).push(ee.endStyle,X.to),ee.title&&((M||(M={})).title=ee.title),ee.attributes)for(let we in ee.attributes)(M||(M={}))[we]=ee.attributes[we];ee.collapsed&&(!C||ya(C.marker,ee)<0)&&(C=X)}else X.from>c&&k>X.from&&(k=X.from)}if(B)for(let K=0;K=d)break;let D=Math.min(d,k);for(;;){if(m){let E=c+m.length;if(!C){let B=E>D?m.slice(0,D-c):m;r.addToken(r,B,x?x+A:A,L,c+B.length==k?T:"",S,M)}if(E>=D){m=m.slice(D-c),c=D;break}c=E,L=""}m=a.slice(u,u=n[g++]),x=Yc(n[g++],r.cm.options)}}}function Mu(t,r,n){this.line=r,this.rest=qc(r),this.size=this.rest?xe(ge(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(t,r)}function jo(t,r,n){let l=[],a;for(let u=r;un[u].apply(null,l))}function y0(){let t=qo;qo=null;for(let r=0;r2&&u.push((g.bottom+m.top)/2-n.top)}}u.push(n.bottom-n.top)}}function Hu(t,r,n){if(t.line==r)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(let l=0;ln)return{map:t.measure.maps[l],cache:t.measure.caches[l],before:!0}}}function k0(t,r){r=Mt(r);let n=xe(r),l=t.display.externalMeasured=new Mu(t.doc,r,n);l.lineN=n;let a=l.built=wa(t,l);return l.text=a.pre,vt(t.display.lineMeasure,a.pre),l}function Wu(t,r,n,l){return zr(t,Nn(t,r),n,l)}function Zo(t,r){if(r>=t.display.viewFrom&&r=n.lineN&&rr)&&(u=g-c,a=u-1,r>=g&&(d="right")),a!=null){if(l=t[m+2],c==g&&n==(l.insertLeft?"left":"right")&&(d=n),n=="left"&&a==0)for(;m&&t[m-2]==t[m-3]&&t[m-1].insertLeft;)l=t[(m-=3)+2],d="left";if(n=="right"&&a==g-c)for(;m=0&&(n=t[l]).left==n.right;l--);return n}function T0(t,r,n,l){let a=Pu(r.map,n,l),u=a.node,d=a.start,c=a.end,g=a.collapse,m;if(u.nodeType==3){for(let D=0;D<4;D++){for(;d&&na(r.line.text.charAt(a.coverStart+d));)--d;for(;a.coverStart+c0&&(g=l="right");let D;t.options.lineWrapping&&(D=u.getClientRects()).length>1?m=D[l=="right"?D.length-1:0]:m=u.getBoundingClientRect()}if(de&&Se<9&&!d&&(!m||!m.left&&!m.right)){let D=u.parentNode.getClientRects()[0];D?m={left:D.left,right:D.left+rn(t.display),top:D.top,bottom:D.bottom}:m=op}let x=m.top-r.rect.top,S=m.bottom-r.rect.top,k=(x+S)/2,A=r.view.measure.heights,T=0;for(;T=l.text.length?(g=l.text.length,m="before"):g<=0&&(g=0,m="after"),!c)return d(m=="before"?g-1:g,m=="before");function x(T,L,C){let M=c[L],D=M.level==1;return d(C?T-1:T,D!=C)}let S=bi(c,g,m),k=yl,A=x(g,S,m=="before");return k!=null&&(A.other=x(g,k,m!="before")),A}function Ru(t,r){let n=0;r=oe(t.doc,r),t.options.lineWrapping||(n=rn(t.display)*r.ch);let l=V(t.doc,r.line),a=tr(l)+Al(t.display);return{left:n,right:n,top:a,bottom:a+l.height}}function Ou(t,r,n,l,a){let u=U(t,r,n);return u.xRel=a,l&&(u.outside=l),u}function Sa(t,r,n){let l=t.doc;if(n+=t.display.viewOffset,n<0)return Ou(l.first,0,null,-1,-1);let a=Rr(l,n),u=l.first+l.size-1;if(a>u)return Ou(l.first+l.size-1,V(l,u).text.length,null,1,1);r<0&&(r=0);let d=V(l,a);for(;;){let c=A0(t,d,a,r,n),g=Xc(d,c.ch+(c.xRel>0||c.outside>0?1:0));if(!g)return c;let m=g.find(1);if(m.line==a)return m;d=V(l,a=m.line)}}function fp(t,r,n,l){l-=Iu(r);let a=r.text.length,u=Ln(d=>zr(t,n,d-1).bottom<=l,a,0);return a=Ln(d=>zr(t,n,d).top>l,u,a),{begin:u,end:a}}function ka(t,r,n,l){n||(n=Nn(t,r));let a=Jo(t,r,zr(t,n,l),"line").top;return fp(t,r,n,a)}function Du(t,r,n,l){return t.bottom<=n?!1:t.top>n?!0:(l?t.left:t.right)>r}function A0(t,r,n,l,a){a-=tr(r);let u=Nn(t,r),d=Iu(r),c=0,g=r.text.length,m=!0,x=Pt(r,t.doc.direction);if(x){let M=(t.options.lineWrapping?D0:O0)(t,r,n,u,x,l,a);m=M.level!=1,c=m?M.from:M.to-1,g=m?M.to:M.from-1}let S=null,k=null,A=Ln(M=>{let D=zr(t,u,M);return D.top+=d,D.bottom+=d,Du(D,l,a,!1)?(D.top<=a&&D.left<=l&&(S=M,k=D),!0):!1},c,g),T,L,C=!1;if(k){let M=l-k.left=M.bottom?1:0}return A=la(r.text,A,1),Ou(n,A,L,C,l-T)}function O0(t,r,n,l,a,u,d){let c=Ln(m=>{let x=a[m],S=x.level!=1;return Du(jt(t,U(n,S?x.to:x.from,S?"before":"after"),"line",r,l),u,d,!0)},0,a.length-1),g=a[c];if(c>0){let m=g.level!=1,x=jt(t,U(n,m?g.from:g.to,m?"after":"before"),"line",r,l);Du(x,u,d,!0)&&x.top>d&&(g=a[c-1])}return g}function D0(t,r,n,l,a,u,d){let{begin:c,end:g}=fp(t,r,l,d);/\s/.test(r.text.charAt(g-1))&&g--;let m=null,x=null;for(let S=0;S=g||k.to<=c)continue;let A=k.level!=1,T=zr(t,l,A?Math.min(g,k.to)-1:Math.max(c,k.from)).right,L=TL)&&(m=k,x=L)}return m||(m=a[a.length-1]),m.fromg&&(m={from:m.from,to:g,level:m.level}),m}var Dn;function Ci(t){if(t.cachedTextHeight!=null)return t.cachedTextHeight;if(Dn==null){Dn=re("pre",null,"CodeMirror-line-like");for(let n=0;n<49;++n)Dn.appendChild(document.createTextNode("x")),Dn.appendChild(re("br"));Dn.appendChild(document.createTextNode("x"))}vt(t.measure,Dn);let r=Dn.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),gr(t.measure),r||1}function rn(t){if(t.cachedCharWidth!=null)return t.cachedCharWidth;let r=re("span","xxxxxxxxxx"),n=re("pre",[r],"CodeMirror-line-like");vt(t.measure,n);let l=r.getBoundingClientRect(),a=(l.right-l.left)/10;return a>2&&(t.cachedCharWidth=a),a||10}function La(t){let r=t.display,n={},l={},a=r.gutters.clientLeft;for(let u=r.gutters.firstChild,d=0;u;u=u.nextSibling,++d){let c=t.display.gutterSpecs[d].className;n[c]=u.offsetLeft+u.clientLeft+a,l[c]=u.clientWidth}return{fixedPos:Qo(r),gutterTotalWidth:r.gutters.offsetWidth,gutterLeft:n,gutterWidth:l,wrapperWidth:r.wrapper.clientWidth}}function Qo(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function zu(t){let r=Ci(t.display),n=t.options.lineWrapping,l=n&&Math.max(5,t.display.scroller.clientWidth/rn(t.display)-3);return a=>{if(yr(t.doc,a))return 0;let u=0;if(a.widgets)for(let d=0;d{let a=n(l);a!=l.height&&Xt(l,a)})}function Gr(t,r,n,l){let a=t.display;if(!n&&xl(r).getAttribute("cm-not-content")=="true")return null;let u,d,c=a.lineSpace.getBoundingClientRect();try{u=r.clientX-c.left,d=r.clientY-c.top}catch{return null}let g=Sa(t,u,d),m;if(l&&g.xRel>0&&(m=V(t.doc,g.line).text).length==g.ch){let x=mt(m,m.length,t.options.tabSize)-m.length;g=U(g.line,Math.max(0,Math.round((u-Nu(t.display).left)/rn(t.display))-x))}return g}function Si(t,r){if(r>=t.display.viewTo||(r-=t.display.viewFrom,r<0))return null;let n=t.display.view;for(let l=0;lr)&&(a.updateLineNumbers=r),t.curOp.viewChanged=!0,r>=a.viewTo)mr&&Xo(t.doc,r)a.viewFrom?ki(t):(a.viewFrom+=l,a.viewTo+=l);else if(r<=a.viewFrom&&n>=a.viewTo)ki(t);else if(r<=a.viewFrom){let d=Ta(t,n,n+l,1);d?(a.view=a.view.slice(d.index),a.viewFrom=d.lineN,a.viewTo+=l):ki(t)}else if(n>=a.viewTo){let d=Ta(t,r,r,-1);d?(a.view=a.view.slice(0,d.index),a.viewTo=d.lineN):ki(t)}else{let d=Ta(t,r,r,-1),c=Ta(t,n,n+l,1);d&&c?(a.view=a.view.slice(0,d.index).concat(jo(t,d.lineN,c.lineN)).concat(a.view.slice(c.index)),a.viewTo+=l):ki(t)}let u=a.externalMeasured;u&&(n=a.lineN&&r=l.viewTo)return;let u=l.view[Si(t,r)];if(u.node==null)return;let d=u.changes||(u.changes=[]);He(d,n)==-1&&d.push(n)}function ki(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Ta(t,r,n,l){let a=Si(t,r),u,d=t.display.view;if(!mr||n==t.doc.first+t.doc.size)return{index:a,lineN:n};let c=t.display.viewFrom;for(let g=0;g0){if(a==d.length-1)return null;u=c+d[a].size-r,a++}else u=c-r;r+=u,n+=u}for(;Xo(t.doc,n)!=n;){if(a==(l<0?0:d.length-1))return null;n+=l*d[a-(l<0?1:0)].size,a+=l}return{index:a,lineN:n}}function up(t,r,n){let l=t.display;l.view.length==0||r>=l.viewTo||n<=l.viewFrom?(l.view=jo(t,r,n),l.viewFrom=r):(l.viewFrom>r?l.view=jo(t,r,l.viewFrom).concat(l.view):l.viewFromn&&(l.view=l.view.slice(0,Si(t,n)))),l.viewTo=n}function Gu(t){let r=t.display.view,n=0;for(let l=0;l=t.display.viewTo||g.to().line0?d:t.defaultCharWidth())+"px"}if(l.other){let u=n.appendChild(re("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));u.style.display="",u.style.left=l.other.left+"px",u.style.top=l.other.top+"px",u.style.height=(l.other.bottom-l.other.top)*.85+"px"}}function Ma(t,r){return t.top-r.top||t.left-r.left}function N0(t,r,n){let l=t.display,a=t.doc,u=document.createDocumentFragment(),d=Nu(t.display),c=d.left,g=Math.max(l.sizerWidth,xr(t)-l.sizer.offsetLeft)-d.right,m=a.direction=="ltr";function x(T,L,C,M){L<0&&(L=0),L=Math.round(L),M=Math.round(M),u.appendChild(re("div",null,"CodeMirror-selected",`position: absolute; left: ${T}px; - top: ${L}px; width: ${C??g-T}px; - height: ${M-L}px`))}function S(T,L,C){let M=V(a,T),D=M.text.length,E,B;function K(we,he){return Nl(t,U(T,we),"div",M,he)}function X(we,he,ke){let z=ka(t,M,null,we),Y=he=="ltr"==(ke=="after")?"left":"right",W=ke=="after"?z.begin:z.end-(/\s/.test(M.text.charAt(z.end-1))?2:1);return K(W,Y)[Y]}let ee=Pt(M,a.direction);return Cc(ee,L||0,C??D,(we,he,ke,z)=>{let Y=ke=="ltr",W=K(we,Y?"left":"right"),De=K(he-1,Y?"right":"left"),Qe=L==null&&we==0,_e=C==null&&he==D,ze=z==0,Ee=!ee||z==ee.length-1;if(De.top-W.top<=3){let Be=(m?Qe:_e)&&ze,nr=(m?_e:Qe)&&Ee,tt=Be?c:(Y?W:De).left,bt=nr?g:(Y?De:W).right;x(tt,W.top,bt-tt,W.bottom)}else{let Be,nr,tt,bt;Y?(Be=m&&Qe&&ze?c:W.left,nr=m?g:X(we,ke,"before"),tt=m?c:X(he,ke,"after"),bt=m&&_e&&Ee?g:De.right):(Be=m?X(we,ke,"before"):c,nr=!m&&Qe&&ze?g:W.right,tt=!m&&_e&&Ee?c:De.left,bt=m?X(he,ke,"after"):g),x(Be,W.top,nr-Be,W.bottom),W.bottom0?r.blinker=setInterval(()=>{t.hasFocus()||ti(t),r.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(r.cursorDiv.style.visibility="hidden")}function Da(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Ha(t))}function Na(t){t.state.delayingBlurEvent=!0,setTimeout(()=>{t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&ti(t))},100)}function Ha(t,r){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),t.options.readOnly!="nocursor"&&(t.state.focused||(Ae(t,"focus",t,r),t.state.focused=!0,er(t.display.wrapper,"CodeMirror-focused"),!t.curOp&&t.display.selForContextMenu!=t.doc.sel&&(t.display.input.reset(),Ue&&setTimeout(()=>t.display.input.reset(!0),20)),t.display.input.receivedFocus()),Wl(t))}function ti(t,r){t.state.delayingBlurEvent||(t.state.focused&&(Ae(t,"blur",t,r),t.state.focused=!1,Vt(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(()=>{t.state.focused||(t.display.shift=!1)},150))}function Wn(t){let r=t.display,n=r.lineDiv.offsetTop,l=Math.max(0,r.scroller.getBoundingClientRect().top),a=r.lineDiv.getBoundingClientRect().top,u=0;for(let d=0;d.005||S<-.005)&&(at.display.sizerWidth){let k=Math.ceil(x/rn(t.display));k>t.display.maxLineLength&&(t.display.maxLineLength=k,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}Math.abs(u)>2&&(r.scroller.scrollTop+=u)}function hp(t){if(t.widgets)for(let r=0;r=d&&(u=Rr(r,tr(V(r,g))-t.wrapper.clientHeight),d=g)}return{from:u,to:Math.max(d,u+1)}}function dp(t,r){if(Re(t,"scrollCursorIntoView"))return;let n=t.display,l=n.sizer.getBoundingClientRect(),a=null,u=n.wrapper.ownerDocument;if(r.top+l.top<0?a=!0:r.bottom+l.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(a=!1),a!=null&&!mc){let d=re("div","\u200B",null,`position: absolute; - top: ${r.top-n.viewOffset-Al(t.display)}px; - height: ${r.bottom-r.top+qt(t)+n.barHeight}px; - left: ${r.left}px; width: ${Math.max(2,r.right-r.left)}px;`);t.display.lineSpace.appendChild(d),d.scrollIntoView(a),t.display.lineSpace.removeChild(d)}}function cp(t,r,n,l){l==null&&(l=0);let a;!t.options.lineWrapping&&r==n&&(n=r.sticky=="before"?U(r.line,r.ch+1,"before"):r,r=r.ch?U(r.line,r.sticky=="before"?r.ch-1:r.ch,"after"):r);for(let u=0;u<5;u++){let d=!1,c=jt(t,r),g=!n||n==r?c:jt(t,n);a={left:Math.min(c.left,g.left),top:Math.min(c.top,g.top)-l,right:Math.max(c.left,g.left),bottom:Math.max(c.bottom,g.bottom)+l};let m=Uu(t,a),x=t.doc.scrollTop,S=t.doc.scrollLeft;if(m.scrollTop!=null&&(nn(t,m.scrollTop),Math.abs(t.doc.scrollTop-x)>1&&(d=!0)),m.scrollLeft!=null&&(Ur(t,m.scrollLeft),Math.abs(t.doc.scrollLeft-S)>1&&(d=!0)),!d)break}return a}function pp(t,r){let n=Uu(t,r);n.scrollTop!=null&&nn(t,n.scrollTop),n.scrollLeft!=null&&Ur(t,n.scrollLeft)}function Uu(t,r){let n=t.display,l=Ci(t.display);r.top<0&&(r.top=0);let a=t.curOp&&t.curOp.scrollTop!=null?t.curOp.scrollTop:n.scroller.scrollTop,u=Dl(t),d={};r.bottom-r.top>u&&(r.bottom=r.top+u);let c=t.doc.height+Ol(n),g=r.topc-l;if(r.topa+u){let T=Math.min(r.top,(m?c:r.bottom)-u);T!=a&&(d.scrollTop=T)}let x=t.options.fixedGutter?0:n.gutters.offsetWidth,S=t.curOp&&t.curOp.scrollLeft!=null?t.curOp.scrollLeft:n.scroller.scrollLeft-x,k=xr(t)-n.gutters.offsetWidth,A=r.right-r.left>k;return A&&(r.right=r.left+k),r.left<10?d.scrollLeft=0:r.leftk+S-3&&(d.scrollLeft=r.right+(A?0:10)-k),d}function Vo(t,r){r!=null&&(Wa(t),t.curOp.scrollTop=(t.curOp.scrollTop==null?t.doc.scrollTop:t.curOp.scrollTop)+r)}function br(t){Wa(t);let r=t.getCursor();t.curOp.scrollToPos={from:r,to:r,margin:t.options.cursorScrollMargin}}function Pn(t,r,n){(r!=null||n!=null)&&Wa(t),r!=null&&(t.curOp.scrollLeft=r),n!=null&&(t.curOp.scrollTop=n)}function gp(t,r){Wa(t),t.curOp.scrollToPos=r}function Wa(t){let r=t.curOp.scrollToPos;if(r){t.curOp.scrollToPos=null;let n=Ru(t,r.from),l=Ru(t,r.to);_u(t,n,l,r.margin)}}function _u(t,r,n,l){let a=Uu(t,{left:Math.min(r.left,n.left),top:Math.min(r.top,n.top)-l,right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)+l});Pn(t,a.scrollLeft,a.scrollTop)}function nn(t,r){Math.abs(t.doc.scrollTop-r)<2||($t||$o(t,{top:r}),Ku(t,r,!0),$t&&$o(t),Li(t,100))}function Ku(t,r,n){r=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,r)),!(t.display.scroller.scrollTop==r&&!n)&&(t.doc.scrollTop=r,t.display.scrollbars.setScrollTop(r),t.display.scroller.scrollTop!=r&&(t.display.scroller.scrollTop=r))}function Ur(t,r,n,l){r=Math.max(0,Math.min(r,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),!((n?r==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-r)<2)&&!l)&&(t.doc.scrollLeft=r,Pa(t),t.display.scroller.scrollLeft!=r&&(t.display.scroller.scrollLeft=r),t.display.scrollbars.setScrollLeft(r))}function Fn(t){let r=t.display,n=r.gutters.offsetWidth,l=Math.round(t.doc.height+Ol(t.display));return{clientHeight:r.scroller.clientHeight,viewHeight:r.wrapper.clientHeight,scrollWidth:r.scroller.scrollWidth,clientWidth:r.scroller.clientWidth,viewWidth:r.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:l,scrollHeight:l+qt(t)+r.barHeight,nativeBarWidth:r.nativeBarWidth,gutterWidth:n}}var Xu=class{constructor(r,n,l){this.cm=l;let a=this.vert=re("div",[re("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),u=this.horiz=re("div",[re("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a.tabIndex=u.tabIndex=-1,r(a),r(u),ne(a,"scroll",()=>{a.clientHeight&&n(a.scrollTop,"vertical")}),ne(u,"scroll",()=>{u.clientWidth&&n(u.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,de&&Se<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}update(r){let n=r.scrollWidth>r.clientWidth+1,l=r.scrollHeight>r.clientHeight+1,a=r.nativeBarWidth;if(l){this.vert.style.display="block",this.vert.style.bottom=n?a+"px":"0";let u=r.viewHeight-(n?a:0);this.vert.firstChild.style.height=Math.max(0,r.scrollHeight-r.clientHeight+u)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(n){this.horiz.style.display="block",this.horiz.style.right=l?a+"px":"0",this.horiz.style.left=r.barLeft+"px";let u=r.viewWidth-r.barLeft-(l?a:0);this.horiz.firstChild.style.width=Math.max(0,r.scrollWidth-r.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&r.clientHeight>0&&(a==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:l?a:0,bottom:n?a:0}}setScrollLeft(r){this.horiz.scrollLeft!=r&&(this.horiz.scrollLeft=r),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}setScrollTop(r){this.vert.scrollTop!=r&&(this.vert.scrollTop=r),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}zeroWidthHack(){let r=ot&&!vc?"12px":"18px";this.horiz.style.height=this.vert.style.width=r,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new fr,this.disableVert=new fr}enableZeroWidthBar(r,n,l){r.style.visibility="";function a(){let u=r.getBoundingClientRect();(l=="vert"?document.elementFromPoint(u.right-1,(u.top+u.bottom)/2):document.elementFromPoint((u.right+u.left)/2,u.bottom-1))!=r?r.style.visibility="hidden":n.set(1e3,a)}n.set(1e3,a)}clear(){let r=this.horiz.parentNode;r.removeChild(this.horiz),r.removeChild(this.vert)}},ju=class{update(){return{bottom:0,right:0}}setScrollLeft(){}setScrollTop(){}clear(){}};function Ti(t,r){r||(r=Fn(t));let n=t.display.barWidth,l=t.display.barHeight;vp(t,r);for(let a=0;a<4&&n!=t.display.barWidth||l!=t.display.barHeight;a++)n!=t.display.barWidth&&t.options.lineWrapping&&Wn(t),vp(t,Fn(t)),n=t.display.barWidth,l=t.display.barHeight}function vp(t,r){let n=t.display,l=n.scrollbars.update(r);n.sizer.style.paddingRight=(n.barWidth=l.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=l.bottom)+"px",n.heightForcer.style.borderBottom=l.bottom+"px solid transparent",l.right&&l.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=l.bottom+"px",n.scrollbarFiller.style.width=l.right+"px"):n.scrollbarFiller.style.display="",l.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=l.bottom+"px",n.gutterFiller.style.width=r.gutterWidth+"px"):n.gutterFiller.style.display=""}var qu={native:Xu,null:ju};function Fa(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Vt(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new qu[t.options.scrollbarStyle](r=>{t.display.wrapper.insertBefore(r,t.display.scrollbarFiller),ne(r,"mousedown",()=>{t.state.focused&&setTimeout(()=>t.display.input.focus(),0)}),r.setAttribute("cm-not-content","true")},(r,n)=>{n=="horizontal"?Ur(t,r):nn(t,r)},t),t.display.scrollbars.addClass&&er(t.display.wrapper,t.display.scrollbars.addClass)}var H0=0;function ri(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++H0,markArrays:null},Vc(t.curOp)}function ii(t){let r=t.curOp;r&&ep(r,n=>{for(let l=0;l=n.viewTo)||n.maxLineChanged&&r.options.lineWrapping,t.update=t.mustUpdate&&new es(r,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function F0(t){t.updatedDisplay=t.mustUpdate&&Ea(t.cm,t.update)}function E0(t){let r=t.cm,n=r.display;t.updatedDisplay&&Wn(r),t.barMeasure=Fn(r),n.maxLineChanged&&!r.options.lineWrapping&&(t.adjustWidthTo=Wu(r,n.maxLine,n.maxLine.text.length).left+3,r.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+qt(r)+r.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-xr(r))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function I0(t){let r=t.cm;t.adjustWidthTo!=null&&(r.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft=t.display.viewTo)return;let n=+new Date+t.options.workTime,l=Vi(t,r.highlightFrontier),a=[];r.iter(l.line,Math.min(r.first+r.size,t.display.viewTo+500),u=>{if(l.line>=t.display.viewFrom){let d=u.styles,c=u.text.length>t.options.maxHighlightLength?Vr(r.mode,l.state):null,g=xu(t,u,l,!0);c&&(l.state=c),u.styles=g.styles;let m=u.styleClasses,x=g.classes;x?u.styleClasses=x:m&&(u.styleClasses=null);let S=!d||d.length!=u.styles.length||m!=x&&(!m||!x||m.bgClass!=x.bgClass||m.textClass!=x.textClass);for(let k=0;!S&&kn)return Li(t,t.options.workDelay),!0}),r.highlightFrontier=l.line,r.modeFrontier=Math.max(r.modeFrontier,l.line),a.length&&Xe(t,()=>{for(let u=0;u=n.viewFrom&&r.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Gu(t)==0)return!1;Ba(t)&&(ki(t),r.dims=La(t));let a=l.first+l.size,u=Math.max(r.visible.from-t.options.viewportMargin,l.first),d=Math.min(a,r.visible.to+t.options.viewportMargin);n.viewFromd&&n.viewTo-d<20&&(d=Math.min(a,n.viewTo)),mr&&(u=Xo(t.doc,u),d=ba(t.doc,d));let c=u!=n.viewFrom||d!=n.viewTo||n.lastWrapHeight!=r.wrapperHeight||n.lastWrapWidth!=r.wrapperWidth;up(t,u,d),n.viewOffset=tr(V(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";let g=Gu(t);if(!c&&g==0&&!r.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;let m=z0(t);return g>4&&(n.lineDiv.style.display="none"),U0(t,n.updateLineNumbers,r.dims),g>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,G0(m),gr(n.cursorDiv),gr(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=r.wrapperHeight,n.lastWrapWidth=r.wrapperWidth,Li(t,400)),n.updateLineNumbers=null,!0}function Yu(t,r){let n=r.viewport;for(let l=!0;;l=!1){if(!l||!t.options.lineWrapping||r.oldDisplayWidth==xr(t)){if(n&&n.top!=null&&(n={top:Math.min(t.doc.height+Ol(t.display)-Dl(t),n.top)}),r.visible=Pl(t.display,t.doc,n),r.visible.from>=t.display.viewFrom&&r.visible.to<=t.display.viewTo)break}else l&&(r.visible=Pl(t.display,t.doc,n));if(!Ea(t,r))break;Wn(t);let a=Fn(t);Hn(t),Ti(t,a),Ia(t,a),r.force=!1}r.signal(t,"update",t),(t.display.viewFrom!=t.display.reportedViewFrom||t.display.viewTo!=t.display.reportedViewTo)&&(r.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function $o(t,r){let n=new es(t,r);if(Ea(t,n)){Wn(t),Yu(t,n);let l=Fn(t);Hn(t),Ti(t,l),Ia(t,l),n.finish()}}function U0(t,r,n){let l=t.display,a=t.options.lineNumbers,u=l.lineDiv,d=u.firstChild;function c(x){let S=x.nextSibling;return Ue&&ot&&t.display.currentWheelTarget==x?x.style.display="none":x.parentNode.removeChild(x),S}let g=l.view,m=l.viewFrom;for(let x=0;x-1&&(k=!1),Ca(t,S,m,n)),k&&(gr(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(Cl(t.options,m)))),d=S.node.nextSibling}m+=S.size}for(;d;)d=c(d)}function Fl(t){let r=t.gutters.offsetWidth;t.sizer.style.marginLeft=r+"px",We(t,"gutterChanged",t)}function Ia(t,r){t.display.sizer.style.minHeight=r.docHeight+"px",t.display.heightForcer.style.top=r.docHeight+"px",t.display.gutters.style.height=r.docHeight+t.display.barHeight+qt(t)+"px"}function Pa(t){let r=t.display,n=r.view;if(!r.alignWidgets&&(!r.gutters.firstChild||!t.options.fixedGutter))return;let l=Qo(r)-r.scroller.scrollLeft+t.doc.scrollLeft,a=r.gutters.offsetWidth,u=l+"px";for(let d=0;d=105&&(a.wrapper.style.clipPath="inset(0px)"),a.wrapper.setAttribute("translate","no"),de&&Se<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!Ue&&!($t&&yi)&&(a.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(a.wrapper):t(a.wrapper)),a.viewFrom=a.viewTo=r.first,a.reportedViewFrom=a.reportedViewTo=r.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=ts(l.gutters,l.lineNumbers),Zu(a),n.init(a)}var Ra=0,Mi=null;de?Mi=-.53:$t?Mi=15:pr?Mi=-.7:wn&&(Mi=-1/3);function xp(t){let r=t.wheelDeltaX,n=t.wheelDeltaY;return r==null&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),n==null&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:n==null&&(n=t.wheelDelta),{x:r,y:n}}function bp(t){let r=xp(t);return r.x*=Mi,r.y*=Mi,r}function Ju(t,r){pr&&Qs==102&&(t.display.chromeScrollHack==null?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout(()=>{t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""},100));let n=xp(r),l=n.x,a=n.y,u=Mi;r.deltaMode===0&&(l=r.deltaX,a=r.deltaY,u=1);let d=t.display,c=d.scroller,g=c.scrollWidth>c.clientWidth,m=c.scrollHeight>c.clientHeight;if(l&&g||a&&m){if(a&&ot&&Ue){e:for(let x=r.target,S=d.view;x!=c;x=x.parentNode)for(let k=0;k{if(d.wheelStartX==null)return;let x=c.scrollLeft-d.wheelStartX,S=c.scrollTop-d.wheelStartY,k=S&&d.wheelDY&&S/d.wheelDY||x&&d.wheelDX&&x/d.wheelDX;d.wheelStartX=d.wheelStartY=null,k&&(Mi=(Mi*Ra+k)/(Ra+1),++Ra)},200)):(d.wheelDX+=l,d.wheelDY+=a))}}var ir=class t{constructor(r,n){this.ranges=r,this.primIndex=n}primary(){return this.ranges[this.primIndex]}equals(r){if(r==this)return!0;if(r.primIndex!=this.primIndex||r.ranges.length!=this.ranges.length)return!1;for(let n=0;n=0&&se(r,a.to())<=0)return l}return-1}},be=class{constructor(r,n){this.anchor=r,this.head=n}from(){return On(this.anchor,this.head)}to(){return An(this.anchor,this.head)}empty(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};function Yt(t,r,n){let l=t&&t.options.selectionsMayTouch,a=r[n];r.sort((u,d)=>se(u.from(),d.from())),n=He(r,a);for(let u=1;u0:g>=0){let m=On(c.from(),d.from()),x=An(c.to(),d.to()),S=c.empty()?d.from()==d.head:c.from()==c.head;u<=n&&--n,r.splice(--u,2,new be(S?x:m,S?m:x))}}return new ir(r,n)}function hr(t,r){return new ir([new be(t,r||t)],0)}function wr(t){return t.text?U(t.from.line+t.text.length-1,ge(t.text).length+(t.text.length==1?t.from.ch:0)):t.to}function wp(t,r){if(se(t,r.from)<0)return t;if(se(t,r.to)<=0)return wr(r);let n=t.line+r.text.length-(r.to.line-r.from.line)-1,l=t.ch;return t.line==r.to.line&&(l+=wr(r).ch-r.to.ch),U(n,l)}function za(t,r){let n=[];for(let l=0;l{r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null)}),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,Li(t,100),t.state.modeGen++,t.curOp&&Je(t)}function Qu(t,r){return r.from.ch==0&&r.to.ch==0&&ge(r.text)==""&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function is(t,r,n,l){function a(L){return n?n[L]:null}function u(L,C,M){Jc(L,C,M,l),We(L,"change",L,r)}function d(L,C){let M=[];for(let D=L;D1&&t.remove(c.line+1,T-1),t.insert(c.line+1,L)}We(t,"change",t,r)}function Cr(t,r,n){function l(a,u,d){if(a.linked)for(let c=0;c{kp(t),Je(t)})}function ns(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Ua(t,r){let n={from:Go(r.from),to:wr(r),text:Br(t,r.from,r.to)};return Tp(t,n,r.from.line,r.to.line+1),Cr(t,l=>Tp(l,n,r.from.line,r.to.line+1),!0),n}function Mp(t){for(;t.length&&ge(t).ranges;)t.pop()}function _0(t,r){if(r)return Mp(t.done),ge(t.done);if(t.done.length&&!ge(t.done).ranges)return ge(t.done);if(t.done.length>1&&!t.done[t.done.length-2].ranges)return t.done.pop(),ge(t.done)}function _a(t,r,n,l){let a=t.history;a.undone.length=0;let u=+new Date,d,c;if((a.lastOp==l||a.lastOrigin==r.origin&&r.origin&&(r.origin.charAt(0)=="+"&&a.lastModTime>u-(t.cm?t.cm.options.historyEventDelay:500)||r.origin.charAt(0)=="*"))&&(d=_0(a,a.lastOp==l)))c=ge(d.changes),se(r.from,r.to)==0&&se(r.from,c.to)==0?c.to=wr(r):d.changes.push(Ua(t,r));else{let g=ge(a.done);for((!g||!g.ranges)&&ls(t.sel,a.done),d={changes:[Ua(t,r)],generation:a.generation},a.done.push(d);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=u,a.lastOp=a.lastSelOp=l,a.lastOrigin=a.lastSelOrigin=r.origin,c||Ae(t,"historyAdded")}function K0(t,r,n,l){let a=r.charAt(0);return a=="*"||a=="+"&&n.ranges.length==l.ranges.length&&n.somethingSelected()==l.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Ap(t,r,n,l){let a=t.history,u=l&&l.origin;n==a.lastSelOp||u&&a.lastSelOrigin==u&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==u||K0(t,u,ge(a.done),r))?a.done[a.done.length-1]=r:ls(r,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=u,a.lastSelOp=n,l&&l.clearRedo!==!1&&Mp(a.undone)}function ls(t,r){let n=ge(r);n&&n.ranges&&n.equals(t)||r.push(t)}function Tp(t,r,n,l){let a=r["spans_"+t.id],u=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,l),d=>{d.markedSpans&&((a||(a=r["spans_"+t.id]={}))[u]=d.markedSpans),++u})}function X0(t){if(!t)return null;let r;for(let n=0;n-1&&(ge(g)[a]=x[a],delete x[a])}}return l}function Ka(t,r,n,l){if(l){let a=t.anchor;if(n){let u=se(r,a)<0;u!=se(n,a)<0?(a=r,r=n):u!=se(r,n)<0&&(r=n)}return new be(a,r)}else return new be(n||r,r)}function In(t,r,n,l,a){a==null&&(a=t.cm&&(t.cm.display.shift||t.extend)),et(t,new ir([Ka(t.sel.primary(),r,n,a)],0),l)}function Vu(t,r,n){let l=[],a=t.cm&&(t.cm.display.shift||t.extend);for(let d=0;d=r.ch:c.to>r.ch))){if(a&&(Ae(g,"beforeCursorEnter"),g.explicitlyCleared))if(u.markedSpans){--d;continue}else break;if(!g.atomic)continue;if(n){let k=g.find(l<0?1:-1),A;if((l<0?x:m)&&(k=Op(t,k,-l,k&&k.line==r.line?u:null)),k&&k.line==r.line&&(A=se(k,n))&&(l<0?A<0:A>0))return Bl(t,k,r,l,a)}let S=g.find(l<0?-1:1);return(l<0?m:x)&&(S=Op(t,S,l,S.line==r.line?u:null)),S?Bl(t,S,r,l,a):null}}return r}function Rl(t,r,n,l,a){let u=l||1,d=Bl(t,r,n,u,a)||!a&&Bl(t,r,n,u,!0)||Bl(t,r,n,-u,a)||!a&&Bl(t,r,n,-u,!0);return d||(t.cantEdit=!0,U(t.first,0))}function Op(t,r,n,l){return n<0&&r.ch==0?r.line>t.first?oe(t,U(r.line-1)):null:n>0&&r.ch==(l||V(t,r.line)).text.length?r.linel.canceled=!0};return n&&(l.update=(a,u,d,c)=>{a&&(l.from=oe(t,a)),u&&(l.to=oe(t,u)),d&&(l.text=d),c!==void 0&&(l.origin=c)}),Ae(t,"beforeChange",t,l),t.cm&&Ae(t.cm,"beforeChange",t.cm,l),l.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:l.from,to:l.to,text:l.text,origin:l.origin}}function Ai(t,r,n){if(t.cm){if(!t.cm.curOp)return Ie(t.cm,Ai)(t,r,n);if(t.cm.state.suppressEdits)return}if((Tt(t,"beforeChange")||t.cm&&Tt(t.cm,"beforeChange"))&&(r=Ep(t,r,!0),!r))return;let l=Cu&&!n&&Uc(t,r.from,r.to);if(l)for(let a=l.length-1;a>=0;--a)Hp(t,{from:l[a].from,to:l[a].to,text:a?[""]:r.text,origin:r.origin});else Hp(t,r)}function Hp(t,r){if(r.text.length==1&&r.text[0]==""&&se(r.from,r.to)==0)return;let n=za(t,r);_a(t,r,n,t.cm?t.cm.curOp.id:NaN),os(t,r,n,Ko(t,r));let l=[];Cr(t,(a,u)=>{!u&&He(l,a.history)==-1&&(Ip(a.history,r),l.push(a.history)),os(a,r,null,Ko(a,r))})}function ss(t,r,n){let l=t.cm&&t.cm.state.suppressEdits;if(l&&!n)return;let a=t.history,u,d=t.sel,c=r=="undo"?a.done:a.undone,g=r=="undo"?a.undone:a.done,m=0;for(;m=0;--k){let A=u.changes[k];if(A.origin=r,S&&!Ep(t,A,!1)){c.length=0;return}x.push(Ua(t,A));let T=k?za(t,A):ge(c);os(t,A,T,$u(t,A)),!k&&t.cm&&t.cm.scrollIntoView({from:A.from,to:wr(A)});let L=[];Cr(t,(C,M)=>{!M&&He(L,C.history)==-1&&(Ip(C.history,A),L.push(C.history)),os(C,A,null,$u(C,A))})}}function Wp(t,r){if(r!=0&&(t.first+=r,t.sel=new ir(Qi(t.sel.ranges,n=>new be(U(n.anchor.line+r,n.anchor.ch),U(n.head.line+r,n.head.ch))),t.sel.primIndex),t.cm)){Je(t.cm,t.first,t.first-r,r);for(let n=t.cm.display,l=n.viewFrom;lt.lastLine())return;if(r.from.linea&&(r={from:r.from,to:U(a,V(t,a).text.length),text:[r.text[0]],origin:r.origin}),r.removed=Br(t,r.from,r.to),n||(n=za(t,r)),t.cm?Y0(t.cm,r,l):is(t,r,l),Gl(t,n,Lt),t.cantEdit&&Rl(t,U(t.firstLine(),0))&&(t.cantEdit=!1)}function Y0(t,r,n){let l=t.doc,a=t.display,u=r.from,d=r.to,c=!1,g=u.line;t.options.lineWrapping||(g=xe(Mt(V(l,u.line))),l.iter(g,d.line+1,k=>{if(k==a.maxLine)return c=!0,!0})),l.sel.contains(r.from,r.to)>-1&&sa(t),is(l,r,n,zu(t)),t.options.lineWrapping||(l.iter(g,u.line+r.text.length,k=>{let A=Ll(k);A>a.maxLineLength&&(a.maxLine=k,a.maxLineLength=A,a.maxLineChanged=!0,c=!1)}),c&&(t.curOp.updateMaxLine=!0)),Ec(l,u.line),Li(t,400);let m=r.text.length-(d.line-u.line)-1;r.full?Je(t):u.line==d.line&&r.text.length==1&&!Qu(t.doc,r)?ur(t,u.line,"text"):Je(t,u.line,d.line+1,m);let x=Tt(t,"changes"),S=Tt(t,"change");if(S||x){let k={from:u,to:d,text:r.text,removed:r.removed,origin:r.origin};S&&We(t,"change",t,k),x&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(k)}t.display.selForContextMenu=null}function Sr(t,r,n,l,a){l||(l=n),se(l,n)<0&&([n,l]=[l,n]),typeof r=="string"&&(r=t.splitLines(r)),Ai(t,{from:n,to:l,text:r,origin:a})}function Pp(t,r,n,l){n1||!(this.children[0]instanceof Ul))){let n=[];this.collapse(n),this.children=[new Ul(n)],this.children[0].parent=this}},collapse(t){for(let r=0;r50){let d=a.lines.length%25+25;for(let c=d;c10);t.parent.maybeSpill()},iterN(t,r,n){for(let l=0;l{Bp(r,l,-u),ur(r,a,"widget")}),We(r,"lineWidgetCleared",r,this,a))}changed(){let r=this.height,n=this.doc.cm,l=this.line;this.height=null;let a=en(this)-r;a&&(yr(this.doc,l)||Xt(l,l.height+a),n&&Xe(n,()=>{n.curOp.forceUpdate=!0,Bp(n,l,a),We(n,"lineWidgetChanged",n,this,xe(l))}))}};Ir(Kl);function Bp(t,r,n){tr(r)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Vo(t,n)}function Rp(t,r,n,l){let a=new Kl(t,n,l),u=t.cm;return u&&a.noHScroll&&(u.display.alignWidgets=!0),Bn(t,r,"widget",d=>{let c=d.widgets||(d.widgets=[]);if(a.insertAt==null?c.push(a):c.splice(Math.min(c.length,Math.max(0,a.insertAt)),0,a),a.line=d,u&&!yr(t,d)){let g=tr(d)r.display.maxLineLength&&(r.display.maxLine=d,r.display.maxLineLength=c,r.display.maxLineChanged=!0)}l!=null&&r&&this.collapsed&&Je(r,l,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,r&&th(r.doc)),r&&We(r,"markerCleared",r,this,l,a),n&&ii(r),this.parent&&this.parent.clear()}find(r,n){r==null&&this.type=="bookmark"&&(r=1);let l,a;for(let u=0;u{let a=r.line,u=xe(r.line),d=Zo(l,u);if(d&&(Fu(d),l.curOp.selectionChanged=l.curOp.forceUpdate=!0),l.curOp.updateMaxLine=!0,!yr(n.doc,a)&&n.height!=null){let c=n.height;n.height=null;let g=en(n)-c;g&&Xt(a,a.height+g)}We(l,"markerChanged",l,this)})}attachLine(r){if(!this.lines.length&&this.doc.cm){let n=this.doc.cm.curOp;(!n.maybeHiddenMarkers||He(n.maybeHiddenMarkers,this)==-1)&&(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(r)}detachLine(r){if(this.lines.splice(He(this.lines,r),1),!this.lines.length&&this.doc.cm){let n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}}};Ir(Xl);function Rn(t,r,n,l,a){if(l&&l.shared)return Z0(t,r,n,l,a);if(t.cm&&!t.cm.curOp)return Ie(t.cm,Rn)(t,r,n,l,a);let u=new Xl(t,a),d=se(r,n);if(l&&Er(l,u,!1),d>0||d==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=xi("span",[u.replacedWith],"CodeMirror-widget"),l.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),l.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(Tu(t,r.line,r,n,u)||r.line!=n.line&&Tu(t,n.line,r,n,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");Bc()}u.addToHistory&&_a(t,{from:r,to:n,origin:"markText"},t.sel,NaN);let c=r.line,g=t.cm,m;if(t.iter(c,n.line+1,x=>{g&&u.collapsed&&!g.options.lineWrapping&&Mt(x)==g.display.maxLine&&(m=!0),u.collapsed&&c!=r.line&&Xt(x,0),Gc(x,new _o(u,c==r.line?r.ch:null,c==n.line?n.ch:null),t.cm&&t.cm.curOp),++c}),u.collapsed&&t.iter(r.line,n.line+1,x=>{yr(t,x)&&Xt(x,0)}),u.clearOnEnter&&ne(u,"beforeCursorEnter",()=>u.clear()),u.readOnly&&(Ic(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),u.collapsed&&(u.id=++zp,u.atomic=!0),g){if(m&&(g.curOp.updateMaxLine=!0),u.collapsed)Je(g,r.line,n.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(let x=r.line;x<=n.line;x++)ur(g,x,"text");u.atomic&&th(g.doc),We(g,"markerAdded",g,u)}return u}var jl=class{constructor(r,n){this.markers=r,this.primary=n;for(let l=0;l{c&&(l.widgetNode=c.cloneNode(!0)),u.push(Rn(g,oe(g,r),oe(g,n),l,a));for(let m=0;mr.parent)}function Gp(t,r){for(let n=0;nl.push(a));for(let a=0;a=0;d--)Ai(this,l[d]);u?Xa(this,u):this.cm&&br(this.cm)}),undo:at(function(){ss(this,"undo")}),redo:at(function(){ss(this,"redo")}),undoSelection:at(function(){ss(this,"undo",!0)}),redoSelection:at(function(){ss(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){let t=this.history,r=0,n=0;for(let l=0;lt.history=this.history,!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:En(this.history.done),undone:En(this.history.undone)}},setHistory:function(t){let r=this.history=new ns(this.history);r.done=En(t.done.slice(0),null,!0),r.undone=En(t.undone.slice(0),null,!0)},setGutterMarker:at(function(t,r,n){return Bn(this,t,"gutter",l=>{let a=l.gutterMarkers||(l.gutterMarkers={});return a[r]=n,!n&&hu(a)&&(l.gutterMarkers=null),!0})}),clearGutter:at(function(t){this.iter(r=>{r.gutterMarkers&&r.gutterMarkers[t]&&Bn(this,r,"gutter",()=>(r.gutterMarkers[t]=null,hu(r.gutterMarkers)&&(r.gutterMarkers=null),!0))})}),lineInfo:function(t){let r;if(typeof t=="number"){if(!$i(this,t)||(r=t,t=V(this,t),!t))return null}else if(r=xe(t),r==null)return null;return{line:r,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:at(function(t,r,n){return Bn(this,t,r=="gutter"?"gutter":"class",l=>{let a=r=="text"?"textClass":r=="background"?"bgClass":r=="gutter"?"gutterClass":"wrapClass";if(!l[a])l[a]=n;else{if(Zi(n).test(l[a]))return!1;l[a]+=" "+n}return!0})}),removeLineClass:at(function(t,r,n){return Bn(this,t,r=="gutter"?"gutter":"class",l=>{let a=r=="text"?"textClass":r=="background"?"bgClass":r=="gutter"?"gutterClass":"wrapClass",u=l[a];if(u)if(n==null)l[a]=null;else{let d=u.match(Zi(n));if(!d)return!1;let c=d.index+d[0].length;l[a]=u.slice(0,d.index)+(!d.index||c==u.length?"":" ")+u.slice(c)||null}else return!1;return!0})}),addLineWidget:at(function(t,r,n){return Rp(this,t,r,n)}),removeLineWidget:function(t){t.clear()},markText:function(t,r,n){return Rn(this,oe(this,t),oe(this,r),n,n&&n.type||"range")},setBookmark:function(t,r){let n={replacedWith:r&&(r.nodeType==null?r.widget:r),insertLeft:r&&r.insertLeft,clearWhenEmpty:!1,shared:r&&r.shared,handleMouseEvents:r&&r.handleMouseEvents};return t=oe(this,t),Rn(this,t,t,n,"bookmark")},findMarksAt:function(t){t=oe(this,t);let r=[],n=V(this,t.line).markedSpans;if(n)for(let l=0;l=t.ch)&&r.push(a.marker.parent||a.marker)}return r},findMarks:function(t,r,n){t=oe(this,t),r=oe(this,r);let l=[],a=t.line;return this.iter(t.line,r.line+1,u=>{let d=u.markedSpans;if(d)for(let c=0;c=g.to||g.from==null&&a!=t.line||g.from!=null&&a==r.line&&g.from>=r.ch)&&(!n||n(g.marker))&&l.push(g.marker.parent||g.marker)}++a}),l},getAllMarks:function(){let t=[];return this.iter(r=>{let n=r.markedSpans;if(n)for(let l=0;l{let u=a.text.length+l;if(u>t)return r=t,!0;t-=u,++n}),oe(this,U(n,r))},indexFromPos:function(t){t=oe(this,t);let r=t.ch;if(t.line{r+=l.text.length+n}),r},copy:function(t){let r=new Oi(ha(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return r.scrollTop=this.scrollTop,r.scrollLeft=this.scrollLeft,r.sel=this.sel,r.extend=!1,t&&(r.history.undoDepth=this.history.undoDepth,r.setHistory(this.getHistory())),r},linkedDoc:function(t){t||(t={});let r=this.first,n=this.first+this.size;t.from!=null&&t.from>r&&(r=t.from),t.to!=null&&t.tor.push(n.id),!0),t.history=new ns(null),t.history.done=En(this.history.done,r),t.history.undone=En(this.history.undone,r)}},iterLinkedDocs:function(t){Cr(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):bl(t)},lineSeparator:function(){return this.lineSep||` -`},setDirection:at(function(t){t!="rtl"&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter(r=>r.order=null),this.cm&&Lp(this.cm))})});Oi.prototype.eachLine=Oi.prototype.iter;var ni=Oi;var Kp=0;function Xp(t){let r=this;if(ih(r),Re(r,t)||rr(r.display,t))return;Ve(t),de&&(Kp=+new Date);let n=Gr(r,t,!0),l=t.dataTransfer.files;if(!(!n||r.isReadOnly()))if(l&&l.length&&window.FileReader&&window.File){let a=l.length,u=Array(a),d=0,c=()=>{++d==a&&Ie(r,()=>{n=oe(r.doc,n);let m={from:n,to:n,text:r.doc.splitLines(u.filter(x=>x!=null).join(r.doc.lineSeparator())),origin:"paste"};Ai(r.doc,m),Xa(r.doc,hr(oe(r.doc,n),oe(r.doc,wr(m))))})()},g=(m,x)=>{if(r.options.allowDropFileTypes&&He(r.options.allowDropFileTypes,m.type)==-1){c();return}let S=new FileReader;S.onerror=()=>c(),S.onload=()=>{let k=S.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(k)){c();return}u[x]=k,c()},S.readAsText(m)};for(let m=0;m-1){r.state.draggingText(t),setTimeout(()=>r.display.input.focus(),20);return}try{let a=t.dataTransfer.getData("Text");if(a){let u;if(r.state.draggingText&&!r.state.draggingText.copy&&(u=r.listSelections()),Gl(r.doc,hr(n,n)),u)for(let d=0;d{for(let l=0;l{t==null&&(t=setTimeout(()=>{t=null,Yp($0)},100))}),ne(window,"blur",()=>Yp(ti))}function $0(t){let r=t.display;r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.scrollbarsClipped=!1,t.setSize()}var li={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};for(let t=0;t<10;t++)li[t+48]=li[t+96]=String(t);for(let t=65;t<=90;t++)li[t]=String.fromCharCode(t);for(let t=1;t<=12;t++)li[t+111]=li[t+63235]="F"+t;var oi={};oi.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"};oi.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"};oi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"};oi.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"]};oi.default=ot?oi.macDefault:oi.pcDefault;function V0(t){let r=t.split(/-(?!$)/);t=r[r.length-1];let n,l,a,u;for(let d=0;d{for(let a=l.length-1;a>=0;a--)Sr(t.doc,"",l[a].from,l[a].to,"+delete");br(t)})}function lh(t,r,n){let l=la(t.text,r+n,n);return l<0||l>t.text.length?null:l}function Za(t,r,n){let l=lh(t,r.ch,n);return l==null?null:new U(r.line,l,n<0?"after":"before")}function as(t,r,n,l,a){if(t){r.doc.direction=="rtl"&&(a=-a);let u=Pt(n,r.doc.direction);if(u){let d=a<0?ge(u):u[0],g=a<0==(d.level==1)?"after":"before",m;if(d.level>0||r.doc.direction=="rtl"){let x=Nn(r,n);m=a<0?n.text.length-1:0;let S=zr(r,x,m).top;m=Ln(k=>zr(r,x,k).top==S,a<0==(d.level==1)?d.from:d.to-1,m),g=="before"&&(m=lh(n,m,1))}else m=a<0?d.to:d.from;return new U(l,m,g)}}return new U(l,a<0?n.text.length:0,a<0?"before":"after")}function $p(t,r,n,l){let a=Pt(r,t.doc.direction);if(!a)return Za(r,n,l);n.ch>=r.text.length?(n.ch=r.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");let u=bi(a,n.ch,n.sticky),d=a[u];if(t.doc.direction=="ltr"&&d.level%2==0&&(l>0?d.to>n.ch:d.fromlh(r,T instanceof U?T.ch:T,L),g,m=T=>t.options.lineWrapping?(g=g||Nn(t,r),ka(t,r,g,T)):{begin:0,end:r.text.length},x=m(n.sticky=="before"?c(n,-1):n.ch);if(t.doc.direction=="rtl"||d.level==1){let T=d.level==1==l<0,L=c(n,T?1:-1);if(L!=null&&(T?L<=d.to&&L<=x.end:L>=d.from&&L>=x.begin)){let C=T?"before":"after";return new U(n.line,L,C)}}let S=(T,L,C)=>{let M=(D,E)=>E?new U(n.line,c(D,1),"before"):new U(n.line,D,"after");for(;T>=0&&T0==(D.level!=1),B=E?C.begin:c(C.end,-1);if(D.from<=B&&B0?x.end:c(x.begin,-1);return A!=null&&!(l>0&&A==r.text.length)&&(k=S(l>0?0:a.length-1,l,m(A)),k)?k:null}var Di={selectAll:ja,singleSelection:t=>t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Lt),killLine:t=>on(t,r=>{if(r.empty()){let n=V(t.doc,r.head.line).text.length;return r.head.ch==n&&r.head.lineon(t,r=>({from:U(r.from().line,0),to:oe(t.doc,U(r.to().line+1,0))})),delLineLeft:t=>on(t,r=>({from:U(r.from().line,0),to:r.from()})),delWrappedLineLeft:t=>on(t,r=>{let n=t.charCoords(r.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:r.from()}}),delWrappedLineRight:t=>on(t,r=>{let n=t.charCoords(r.head,"div").top+5,l=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:r.from(),to:l}}),undo:t=>t.undo(),redo:t=>t.redo(),undoSelection:t=>t.undoSelection(),redoSelection:t=>t.redoSelection(),goDocStart:t=>t.extendSelection(U(t.firstLine(),0)),goDocEnd:t=>t.extendSelection(U(t.lastLine())),goLineStart:t=>t.extendSelectionsBy(r=>eg(t,r.head.line),{origin:"+move",bias:1}),goLineStartSmart:t=>t.extendSelectionsBy(r=>Vp(t,r.head),{origin:"+move",bias:1}),goLineEnd:t=>t.extendSelectionsBy(r=>ey(t,r.head.line),{origin:"+move",bias:-1}),goLineRight:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},kn),goLineLeft:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},kn),goLineLeftSmart:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5,l=t.coordsChar({left:0,top:n},"div");return l.cht.moveV(-1,"line"),goLineDown:t=>t.moveV(1,"line"),goPageUp:t=>t.moveV(-1,"page"),goPageDown:t=>t.moveV(1,"page"),goCharLeft:t=>t.moveH(-1,"char"),goCharRight:t=>t.moveH(1,"char"),goColumnLeft:t=>t.moveH(-1,"column"),goColumnRight:t=>t.moveH(1,"column"),goWordLeft:t=>t.moveH(-1,"word"),goGroupRight:t=>t.moveH(1,"group"),goGroupLeft:t=>t.moveH(-1,"group"),goWordRight:t=>t.moveH(1,"word"),delCharBefore:t=>t.deleteH(-1,"codepoint"),delCharAfter:t=>t.deleteH(1,"char"),delWordBefore:t=>t.deleteH(-1,"word"),delWordAfter:t=>t.deleteH(1,"word"),delGroupBefore:t=>t.deleteH(-1,"group"),delGroupAfter:t=>t.deleteH(1,"group"),indentAuto:t=>t.indentSelection("smart"),indentMore:t=>t.indentSelection("add"),indentLess:t=>t.indentSelection("subtract"),insertTab:t=>t.replaceSelection(" "),insertSoftTab:t=>{let r=[],n=t.listSelections(),l=t.options.tabSize;for(let a=0;a{t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:t=>Xe(t,()=>{let r=t.listSelections(),n=[];for(let l=0;l0)a=new U(a.line,a.ch+1),t.replaceRange(u.charAt(a.ch-1)+u.charAt(a.ch-2),U(a.line,a.ch-2),a,"+transpose");else if(a.line>t.doc.first){let d=V(t.doc,a.line-1).text;d&&(a=new U(a.line,1),t.replaceRange(u.charAt(0)+t.doc.lineSeparator()+d.charAt(d.length-1),U(a.line-1,d.length-1),a,"+transpose"))}}n.push(new be(a,a))}t.setSelections(n)}),newlineAndIndent:t=>Xe(t,()=>{let r=t.listSelections();for(let n=r.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),r[n].anchor,r[n].head,"+input");r=t.listSelections();for(let n=0;nt.replaceSelection(` -`,"start"),toggleOverwrite:t=>t.toggleOverwrite()};function eg(t,r){let n=V(t.doc,r),l=Mt(n);return l!=n&&(r=xe(l)),as(!0,t,l,r,1)}function ey(t,r){let n=V(t.doc,r),l=jc(n);return l!=n&&(r=xe(l)),as(!0,t,n,r,-1)}function Vp(t,r){let n=eg(t,r.line),l=V(t.doc,n.line),a=Pt(l,t.doc.direction);if(!a||a[0].level==0){let u=Math.max(n.ch,l.text.search(/\S/)),d=r.line==n.line&&r.ch<=u&&r.ch;return U(n.line,d?0:u,n.sticky)}return n}function Ja(t,r,n){if(typeof r=="string"&&(r=Di[r],!r))return!1;t.display.input.ensurePolled();let l=t.display.shift,a=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),a=r(t)!=Ji}finally{t.display.shift=l,t.state.suppressEdits=!1}return a}function ty(t,r,n){for(let l=0;l{t.state.keySeq==a&&(t.state.keySeq=null,t.display.input.reset())}),tg(t,a+" "+r,n,l))return!0}return tg(t,r,n,l)}function tg(t,r,n,l){let a=ty(t,r,l);return a=="multi"&&(t.state.keySeq=r),a=="handled"&&We(t,"keyHandled",t,r,n),(a=="handled"||a=="multi")&&(Ve(n),Wl(t)),!!a}function rg(t,r){let n=Ya(r,!0);return n?r.shiftKey&&!t.state.keySeq?Yl(t,"Shift-"+n,r,l=>Ja(t,l,!0))||Yl(t,n,r,l=>{if(typeof l=="string"?/^go[A-Z]/.test(l):l.motion)return Ja(t,l)}):Yl(t,n,r,l=>Ja(t,l)):!1}function iy(t,r,n){return Yl(t,"'"+n+"'",r,l=>Ja(t,l,!0))}var oh=null;function Qa(t){let r=this;if(t.target&&t.target!=r.display.input.getField()||(r.curOp.focus=st(Pr(r)),Re(r,t)))return;de&&Se<11&&t.keyCode==27&&(t.returnValue=!1);let n=t.keyCode;r.display.shift=n==16||t.shiftKey;let l=rg(r,t);Wt&&(oh=l?n:null,!l&&n==88&&!Ac&&(ot?t.metaKey:t.ctrlKey)&&r.replaceSelection("",null,"cut")),$t&&!ot&&!l&&n==46&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(r.display.lineDiv.className)&&ny(r)}function ny(t){let r=t.display.lineDiv;er(r,"CodeMirror-crosshair");function n(l){(l.keyCode==18||!l.altKey)&&(Vt(r,"CodeMirror-crosshair"),yt(document,"keyup",n),yt(document,"mouseover",n))}ne(document,"keyup",n),ne(document,"mouseover",n)}function $a(t){t.keyCode==16&&(this.doc.sel.shift=!1),Re(this,t)}function Va(t){let r=this;if(t.target&&t.target!=r.display.input.getField()||rr(r.display,t)||Re(r,t)||t.ctrlKey&&!t.altKey||ot&&t.metaKey)return;let n=t.keyCode,l=t.charCode;if(Wt&&n==oh){oh=null,Ve(t);return}if(Wt&&(!t.which||t.which<10)&&rg(r,t))return;let a=String.fromCharCode(l??n);a!="\b"&&(iy(r,t,a)||r.display.input.onKeyPress(t))}var ly=400,ef=class{constructor(r,n,l){this.time=r,this.pos=n,this.button=l}compare(r,n,l){return this.time+ly>r&&se(n,this.pos)==0&&l==this.button}},fs,us;function oy(t,r){let n=+new Date;return us&&us.compare(n,t,r)?(fs=us=null,"triple"):fs&&fs.compare(n,t,r)?(us=new ef(n,t,r),fs=null,"double"):(fs=new ef(n,t,r),us=null,"single")}function tf(t){let r=this,n=r.display;if(Re(r,t)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=t.shiftKey,rr(n,t)){Ue||(n.scroller.draggable=!1,setTimeout(()=>n.scroller.draggable=!0,100));return}if(rf(r,t))return;let l=Gr(r,t),a=cu(t),u=l?oy(l,a):"single";Sn(r).focus(),a==1&&r.state.selectingText&&r.state.selectingText(t),!(l&&sy(r,a,l,u,t))&&(a==1?l?fy(r,l,u,t):xl(t)==n.scroller&&Ve(t):a==2?(l&&In(r.doc,l),setTimeout(()=>n.input.focus(),20)):a==3&&(Wo?r.display.input.onContextMenu(t):Na(r)))}function sy(t,r,n,l,a){let u="Click";return l=="double"?u="Double"+u:l=="triple"&&(u="Triple"+u),u=(r==1?"Left":r==2?"Middle":"Right")+u,Yl(t,nh(u,a),a,d=>{if(typeof d=="string"&&(d=Di[d]),!d)return!1;let c=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),c=d(t,n)!=Ji}finally{t.state.suppressEdits=!1}return c})}function ay(t,r,n){let l=t.getOption("configureMouse"),a=l?l(t,r,n):{};if(a.unit==null){let u=yc?n.shiftKey&&n.metaKey:n.altKey;a.unit=u?"rectangle":r=="single"?"char":r=="double"?"word":"line"}return(a.extend==null||t.doc.extend)&&(a.extend=t.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=ot?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(ot?n.altKey:n.ctrlKey)),a}function fy(t,r,n,l){de?setTimeout(Po(Da,t),0):t.curOp.focus=st(Pr(t));let a=ay(t,n,l),u=t.doc.sel,d;t.options.dragDrop&&kc&&!t.isReadOnly()&&n=="single"&&(d=u.contains(r))>-1&&(se((d=u.ranges[d]).from(),r)<0||r.xRel>0)&&(se(d.to(),r)>0||r.xRel<0)?uy(t,l,r,a):hy(t,l,r,a)}function uy(t,r,n,l){let a=t.display,u=!1,d=Ie(t,m=>{Ue&&(a.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Na(t)),yt(a.wrapper.ownerDocument,"mouseup",d),yt(a.wrapper.ownerDocument,"mousemove",c),yt(a.scroller,"dragstart",g),yt(a.scroller,"drop",d),u||(Ve(m),l.addNew||In(t.doc,n,null,null,l.extend),Ue&&!wn||de&&Se==9?setTimeout(()=>{a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),c=function(m){u=u||Math.abs(r.clientX-m.clientX)+Math.abs(r.clientY-m.clientY)>=10},g=()=>u=!0;Ue&&(a.scroller.draggable=!0),t.state.draggingText=d,d.copy=!l.moveOnDrag,ne(a.wrapper.ownerDocument,"mouseup",d),ne(a.wrapper.ownerDocument,"mousemove",c),ne(a.scroller,"dragstart",g),ne(a.scroller,"drop",d),t.state.delayingBlurEvent=!0,setTimeout(()=>a.input.focus(),20),a.scroller.dragDrop&&a.scroller.dragDrop()}function ig(t,r,n){if(n=="char")return new be(r,r);if(n=="word")return t.findWordAt(r);if(n=="line")return new be(U(r.line,0),oe(t.doc,U(r.line+1,0)));let l=n(t,r);return new be(l.from,l.to)}function hy(t,r,n,l){de&&Na(t);let a=t.display,u=t.doc;Ve(r);let d,c,g=u.sel,m=g.ranges;if(l.addNew&&!l.extend?(c=u.sel.contains(n),c>-1?d=m[c]:d=new be(n,n)):(d=u.sel.primary(),c=u.sel.primIndex),l.unit=="rectangle")l.addNew||(d=new be(n,n)),n=Gr(t,r,!0,!0),c=-1;else{let D=ig(t,n,l.unit);l.extend?d=Ka(d,D.anchor,D.head,l.extend):d=D}l.addNew?c==-1?(c=m.length,et(u,Yt(t,m.concat([d]),c),{scroll:!1,origin:"*mouse"})):m.length>1&&m[c].empty()&&l.unit=="char"&&!l.extend?(et(u,Yt(t,m.slice(0,c).concat(m.slice(c+1)),0),{scroll:!1,origin:"*mouse"}),g=u.sel):zl(u,c,d,ra):(c=0,et(u,new ir([d],0),ra),g=u.sel);let x=n;function S(D){if(se(x,D)!=0)if(x=D,l.unit=="rectangle"){let E=[],B=t.options.tabSize,K=mt(V(u,n.line).text,n.ch,B),X=mt(V(u,D.line).text,D.ch,B),ee=Math.min(K,X),we=Math.max(K,X);for(let he=Math.min(n.line,D.line),ke=Math.min(t.lastLine(),Math.max(n.line,D.line));he<=ke;he++){let z=V(u,he).text,Y=Fo(z,ee,B);ee==we?E.push(new be(U(he,Y),U(he,Y))):z.length>Y&&E.push(new be(U(he,Y),U(he,Fo(z,we,B))))}E.length||E.push(new be(n,n)),et(u,Yt(t,g.ranges.slice(0,c).concat(E),c),{origin:"*mouse",scroll:!1}),t.scrollIntoView(D)}else{let E=d,B=ig(t,D,l.unit),K=E.anchor,X;se(B.anchor,K)>0?(X=B.head,K=On(E.from(),B.anchor)):(X=B.anchor,K=An(E.to(),B.head));let ee=g.ranges.slice(0);ee[c]=dy(t,new be(oe(u,K),X)),et(u,Yt(t,ee,c),ra)}}let k=a.wrapper.getBoundingClientRect(),A=0;function T(D){let E=++A,B=Gr(t,D,!0,l.unit=="rectangle");if(B)if(se(B,x)!=0){t.curOp.focus=st(Pr(t)),S(B);let K=Pl(a,u);(B.line>=K.to||B.line{A==E&&T(D)}),150)}else{let K=D.clientYk.bottom?20:0;K&&setTimeout(Ie(t,()=>{A==E&&(a.scroller.scrollTop+=K,T(D))}),50)}}function L(D){t.state.selectingText=!1,A=1/0,D&&(Ve(D),a.input.focus()),yt(a.wrapper.ownerDocument,"mousemove",C),yt(a.wrapper.ownerDocument,"mouseup",M),u.history.lastSelOrigin=null}let C=Ie(t,D=>{D.buttons===0||!cu(D)?L(D):T(D)}),M=Ie(t,L);t.state.selectingText=M,ne(a.wrapper.ownerDocument,"mousemove",C),ne(a.wrapper.ownerDocument,"mouseup",M)}function dy(t,r){let{anchor:n,head:l}=r,a=V(t.doc,n.line);if(se(n,l)==0&&n.sticky==l.sticky)return r;let u=Pt(a);if(!u)return r;let d=bi(u,n.ch,n.sticky),c=u[d];if(c.from!=n.ch&&c.to!=n.ch)return r;let g=d+(c.from==n.ch==(c.level!=1)?0:1);if(g==0||g==u.length)return r;let m;if(l.line!=n.line)m=(l.line-n.line)*(t.doc.direction=="ltr"?1:-1)>0;else{let T=bi(u,l.ch,l.sticky),L=T-d||(l.ch-n.ch)*(c.level==1?-1:1);T==g-1||T==g?m=L<0:m=L>0}let x=u[g+(m?-1:0)],S=m==(x.level==1),k=S?x.from:x.to,A=S?"after":"before";return n.ch==k&&n.sticky==A?r:new be(new U(n.line,k,A),l)}function ng(t,r,n,l){let a,u;if(r.touches)a=r.touches[0].clientX,u=r.touches[0].clientY;else try{a=r.clientX,u=r.clientY}catch{return!1}if(a>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;l&&Ve(r);let d=t.display,c=d.lineDiv.getBoundingClientRect();if(u>c.bottom||!Tt(t,n))return aa(r);u-=c.top-d.viewOffset;for(let g=0;g=a){let x=Rr(t.doc,u),S=t.display.gutterSpecs[g];return Ae(t,n,t,x,S.className,r),aa(r)}}}function rf(t,r){return ng(t,r,"gutterClick",!0)}function sh(t,r){rr(t.display,r)||cy(t,r)||Re(t,r,"contextmenu")||Wo||t.display.input.onContextMenu(r)}function cy(t,r){return Tt(t,"gutterContextMenu")?ng(t,r,"gutterContextMenu",!1):!1}function nf(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),tn(t)}var zn={toString:function(){return"CodeMirror.Init"}},ah={},hs={};function lg(t){let r=t.optionHandlers;function n(l,a,u,d){t.defaults[l]=a,u&&(r[l]=d?(c,g,m)=>{m!=zn&&u(c,g,m)}:u)}t.defineOption=n,t.Init=zn,n("value","",(l,a)=>l.setValue(a),!0),n("mode",null,(l,a)=>{l.doc.modeOption=a,rs(l)},!0),n("indentUnit",2,rs,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,l=>{Il(l),tn(l),Je(l)},!0),n("lineSeparator",null,(l,a)=>{if(l.doc.lineSep=a,!a)return;let u=[],d=l.doc.first;l.doc.iter(c=>{for(let g=0;;){let m=c.text.indexOf(a,g);if(m==-1)break;g=m+a.length,u.push(U(d,m))}d++});for(let c=u.length-1;c>=0;c--)Sr(l.doc,a,u[c],U(u[c].line,u[c].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(l,a,u)=>{l.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),u!=zn&&l.refresh()}),n("specialCharPlaceholder",$c,l=>l.refresh(),!0),n("electricChars",!0),n("inputStyle",yi?"contenteditable":"textarea",()=>{throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,(l,a)=>l.getInputField().spellcheck=a,!0),n("autocorrect",!1,(l,a)=>l.getInputField().autocorrect=a,!0),n("autocapitalize",!1,(l,a)=>l.getInputField().autocapitalize=a,!0),n("rtlMoveVisually",!xc),n("wholeLineUpdateBefore",!0),n("theme","default",l=>{nf(l),El(l)},!0),n("keyMap","default",(l,a,u)=>{let d=ql(a),c=u!=zn&&ql(u);c&&c.detach&&c.detach(l,d),d.attach&&d.attach(l,c||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,gy,!0),n("gutters",[],(l,a)=>{l.display.gutterSpecs=ts(a,l.options.lineNumbers),El(l)},!0),n("fixedGutter",!0,(l,a)=>{l.display.gutters.style.left=a?Qo(l.display)+"px":"0",l.refresh()},!0),n("coverGutterNextToScrollbar",!1,l=>Ti(l),!0),n("scrollbarStyle","native",l=>{Fa(l),Ti(l),l.display.scrollbars.setScrollTop(l.doc.scrollTop),l.display.scrollbars.setScrollLeft(l.doc.scrollLeft)},!0),n("lineNumbers",!1,(l,a)=>{l.display.gutterSpecs=ts(l.options.gutters,a),El(l)},!0),n("firstLineNumber",1,El,!0),n("lineNumberFormatter",l=>l,El,!0),n("showCursorWhenSelecting",!1,Hn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(l,a)=>{a=="nocursor"&&(ti(l),l.display.input.blur()),l.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,(l,a)=>{a=a===""?null:a,l.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,(l,a)=>{a||l.display.input.reset()},!0),n("dragDrop",!0,py),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Hn,!0),n("singleCursorHeightPerLine",!0,Hn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Il,!0),n("addModeClass",!1,Il,!0),n("pollInterval",100),n("undoDepth",200,(l,a)=>l.doc.history.undoDepth=a),n("historyEventDelay",1250),n("viewportMargin",10,l=>l.refresh(),!0),n("maxHighlightLength",1e4,Il,!0),n("moveInputWithCursor",!0,(l,a)=>{a||l.display.input.resetPosition()}),n("tabindex",null,(l,a)=>l.display.input.getField().tabIndex=a||""),n("autofocus",null),n("direction","ltr",(l,a)=>l.doc.setDirection(a),!0),n("phrases",null)}function py(t,r,n){let l=n&&n!=zn;if(!r!=!l){let a=t.display.dragFunctions,u=r?ne:yt;u(t.display.scroller,"dragstart",a.start),u(t.display.scroller,"dragenter",a.enter),u(t.display.scroller,"dragover",a.over),u(t.display.scroller,"dragleave",a.leave),u(t.display.scroller,"drop",a.drop)}}function gy(t){t.options.lineWrapping?(er(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Vt(t.display.wrapper,"CodeMirror-wrap"),Tl(t)),Hl(t),Je(t),tn(t),setTimeout(()=>Ti(t),100)}function Fe(t,r){if(!(this instanceof Fe))return new Fe(t,r);this.options=r=r?Er(r):{},Er(ah,r,!1);let n=r.value;typeof n=="string"?n=new ni(n,r.mode,null,r.lineSeparator,r.direction):r.mode&&(n.modeOption=r.mode),this.doc=n;let l=new Fe.inputStyles[r.inputStyle](this),a=this.display=new yp(t,n,l,r);a.wrapper.CodeMirror=this,nf(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Fa(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 fr,keySeq:null,specialChars:null},r.autofocus&&!yi&&a.input.focus(),de&&Se<11&&setTimeout(()=>this.display.input.reset(!0),20),vy(this),Jp(),ri(this),this.curOp.forceUpdate=!0,Ga(this,n),r.autofocus&&!yi||this.hasFocus()?setTimeout(()=>{this.hasFocus()&&!this.state.focused&&Ha(this)},20):ti(this);for(let u in hs)hs.hasOwnProperty(u)&&hs[u](this,r[u],zn);Ba(this),r.finishInit&&r.finishInit(this);for(let u=0;u{if(Re(t,g))return;let m=Gr(t,g);if(!m||rf(t,g)||rr(t.display,g))return;Ve(g);let x=t.findWordAt(m);In(t.doc,x.anchor,x.head)})):ne(r.scroller,"dblclick",g=>Re(t,g)||Ve(g)),ne(r.scroller,"contextmenu",g=>sh(t,g)),ne(r.input.getField(),"contextmenu",g=>{r.scroller.contains(g.target)||sh(t,g)});let n,l={end:0};function a(){r.activeTouch&&(n=setTimeout(()=>r.activeTouch=null,1e3),l=r.activeTouch,l.end=+new Date)}function u(g){if(g.touches.length!=1)return!1;let m=g.touches[0];return m.radiusX<=1&&m.radiusY<=1}function d(g,m){if(m.left==null)return!0;let x=m.left-g.left,S=m.top-g.top;return x*x+S*S>20*20}ne(r.scroller,"touchstart",g=>{if(!Re(t,g)&&!u(g)&&!rf(t,g)){r.input.ensurePolled(),clearTimeout(n);let m=+new Date;r.activeTouch={start:m,moved:!1,prev:m-l.end<=300?l:null},g.touches.length==1&&(r.activeTouch.left=g.touches[0].pageX,r.activeTouch.top=g.touches[0].pageY)}}),ne(r.scroller,"touchmove",()=>{r.activeTouch&&(r.activeTouch.moved=!0)}),ne(r.scroller,"touchend",g=>{let m=r.activeTouch;if(m&&!rr(r,g)&&m.left!=null&&!m.moved&&new Date-m.start<300){let x=t.coordsChar(r.activeTouch,"page"),S;!m.prev||d(m,m.prev)?S=new be(x,x):!m.prev.prev||d(m,m.prev.prev)?S=t.findWordAt(x):S=new be(U(x.line,0),oe(t.doc,U(x.line+1,0))),t.setSelection(S.anchor,S.head),t.focus(),Ve(g)}a()}),ne(r.scroller,"touchcancel",a),ne(r.scroller,"scroll",()=>{r.scroller.clientHeight&&(nn(t,r.scroller.scrollTop),Ur(t,r.scroller.scrollLeft,!0),Ae(t,"scroll",t))}),ne(r.scroller,"mousewheel",g=>Ju(t,g)),ne(r.scroller,"DOMMouseScroll",g=>Ju(t,g)),ne(r.wrapper,"scroll",()=>r.wrapper.scrollTop=r.wrapper.scrollLeft=0),r.dragFunctions={enter:g=>{Re(t,g)||wi(g)},over:g=>{Re(t,g)||(qp(t,g),wi(g))},start:g=>jp(t,g),drop:Ie(t,Xp),leave:g=>{Re(t,g)||ih(t)}};let c=r.input.getField();ne(c,"keyup",g=>$a.call(t,g)),ne(c,"keydown",Ie(t,Qa)),ne(c,"keypress",Ie(t,Va)),ne(c,"focus",g=>Ha(t,g)),ne(c,"blur",g=>ti(t,g))}var fh=[];Fe.defineInitHook=t=>fh.push(t);function Gn(t,r,n,l){let a=t.doc,u;n==null&&(n="add"),n=="smart"&&(a.mode.indent?u=Vi(t,r).state:n="prev");let d=t.options.tabSize,c=V(a,r),g=mt(c.text,null,d);c.stateAfter&&(c.stateAfter=null);let m=c.text.match(/^\s*/)[0],x;if(!l&&!/\S/.test(c.text))x=0,n="not";else if(n=="smart"&&(x=a.mode.indent(u,c.text.slice(m.length),c.text),x==Ji||x>150)){if(!l)return;n="prev"}n=="prev"?r>a.first?x=mt(V(a,r-1).text,null,d):x=0:n=="add"?x=g+t.options.indentUnit:n=="subtract"?x=g-t.options.indentUnit:typeof n=="number"&&(x=g+n),x=Math.max(0,x);let S="",k=0;if(t.options.indentWithTabs)for(let A=Math.floor(x/d);A;--A)k+=d,S+=" ";if(kd,g=bl(r),m=null;if(c&&l.ranges.length>1)if(kr&&kr.text.join(` -`)==r){if(l.ranges.length%kr.text.length==0){m=[];for(let S=0;S[S]));let x=t.curOp.updateInput;for(let S=l.ranges.length-1;S>=0;S--){let k=l.ranges[S],A=k.from(),T=k.to();k.empty()&&(n&&n>0?A=U(A.line,A.ch-n):t.state.overwrite&&!c?T=U(T.line,Math.min(V(u,T.line).text.length,T.ch+ge(g).length)):c&&kr&&kr.lineWise&&kr.text.join(` -`)==g.join(` -`)&&(A=T=U(A.line,0)));let L={from:A,to:T,text:m?m[S%m.length]:g,origin:a||(c?"paste":t.state.cutIncoming>d?"cut":"+input")};Ai(t.doc,L),We(t,"inputRead",t,L)}r&&!c&&uh(t,r),br(t),t.curOp.updateInput<2&&(t.curOp.updateInput=x),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function lf(t,r){let n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),!r.isReadOnly()&&!r.options.disableInput&&r.hasFocus()&&Xe(r,()=>ds(r,n,0,null,"paste")),!0}function uh(t,r){if(!t.options.electricChars||!t.options.smartIndent)return;let n=t.doc.sel;for(let l=n.ranges.length-1;l>=0;l--){let a=n.ranges[l];if(a.head.ch>100||l&&n.ranges[l-1].head.line==a.head.line)continue;let u=t.getModeAt(a.head),d=!1;if(u.electricChars){for(let c=0;c-1){d=Gn(t,a.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(V(t.doc,a.head.line).text.slice(0,a.head.ch))&&(d=Gn(t,a.head.line,"smart"));d&&We(t,"electricInput",t,a.head.line)}}function of(t){let r=[],n=[];for(let l=0;ld.priority),this.state.modeGen++,Je(this)}),removeOverlay:At(function(l){let a=this.state.overlays;for(let u=0;uu&&(Gn(this,c.head.line,l,!0),u=c.head.line,d==this.doc.sel.primIndex&&br(this));else{let g=c.from(),m=c.to(),x=Math.max(u,g.line);u=Math.min(this.lastLine(),m.line-(m.ch?0:1))+1;for(let k=x;k0&&zl(this.doc,d,new be(g,S[d].to()),Lt)}}}),getTokenAt:function(l,a){return wu(this,l,a)},getLineTokens:function(l,a){return wu(this,U(l),a,!0)},getTokenTypeAt:function(l){l=oe(this.doc,l);let a=pa(this,V(this.doc,l.line)),u=0,d=(a.length-1)/2,c=l.ch,g;if(c==0)g=a[2];else for(;;){let x=u+d>>1;if((x?a[x*2-1]:0)>=c)d=x;else if(a[x*2+1]g&&(l=g,d=!0),c=V(this.doc,l)}else c=l;return Jo(this,c,{top:0,left:0},a||"page",u||d).top+(d?this.doc.height-tr(c):0)},defaultTextHeight:function(){return Ci(this.display)},defaultCharWidth:function(){return rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(l,a,u,d,c){let g=this.display;l=jt(this,oe(this.doc,l));let m=l.bottom,x=l.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),g.sizer.appendChild(a),d=="over")m=l.top;else if(d=="above"||d=="near"){let S=Math.max(g.wrapper.clientHeight,this.doc.height),k=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(d=="above"||l.bottom+a.offsetHeight>S)&&l.top>a.offsetHeight?m=l.top-a.offsetHeight:l.bottom+a.offsetHeight<=S&&(m=l.bottom),x+a.offsetWidth>k&&(x=k-a.offsetWidth)}a.style.top=m+"px",a.style.left=a.style.right="",c=="right"?(x=g.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(c=="left"?x=0:c=="middle"&&(x=(g.sizer.clientWidth-a.offsetWidth)/2),a.style.left=x+"px"),u&&pp(this,{left:x,top:m,right:x+a.offsetWidth,bottom:m+a.offsetHeight})},triggerOnKeyDown:At(Qa),triggerOnKeyPress:At(Va),triggerOnKeyUp:$a,triggerOnMouseDown:At(tf),execCommand:function(l){if(Di.hasOwnProperty(l))return Di[l].call(null,this)},triggerElectric:At(function(l){uh(this,l)}),findPosH:function(l,a,u,d){let c=1;a<0&&(c=-1,a=-a);let g=oe(this.doc,l);for(let m=0;mthis.display.shift||this.doc.extend||u.empty()?hh(this.doc,u.head,l,a,this.options.rtlMoveVisually):l<0?u.from():u.to(),kn)}),deleteH:At(function(l,a){let u=this.doc.sel,d=this.doc;u.somethingSelected()?d.replaceSelection("",null,"+delete"):on(this,c=>{let g=hh(d,c.head,l,a,!1);return l<0?{from:g,to:c.head}:{from:c.head,to:g}})}),findPosV:function(l,a,u,d){let c=1,g=d;a<0&&(c=-1,a=-a);let m=oe(this.doc,l);for(let x=0;x{if(c)return l<0?g.from():g.to();let m=jt(this,g.head,"div");g.goalColumn!=null&&(m.left=g.goalColumn),d.push(m.left);let x=og(this,m,l,a);return a=="page"&&g==u.sel.primary()&&Vo(this,Nl(this,x,"div").top-m.top),x},kn),d.length)for(let g=0;gEo(S,g):/\s/.test(m)?S=>/\s/.test(S):S=>!/\s/.test(S)&&!Eo(S);for(;d>0&&x(u.charAt(d-1));)--d;for(;ctypeof c=="number"||/^\d+$/.test(String(c))?c+"px":c;l!=null&&(this.display.wrapper.style.width=u(l)),a!=null&&(this.display.wrapper.style.height=u(a)),this.options.lineWrapping&&Eu(this);let d=this.display.viewFrom;this.doc.iter(d,this.display.viewTo,c=>{if(c.widgets){for(let g=0;g.5||this.options.lineWrapping)&&Hl(this),Ae(this,"refresh",this)}),swapDoc:At(function(l){let a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ga(this,l),tn(this),this.display.input.reset(),Pn(this,l.scrollLeft,l.scrollTop),this.curOp.forceScroll=!0,We(this,"swapDoc",this,a),a}),phrase:function(l){let a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,l)?a[l]:l},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}},Ir(t),t.registerHelper=function(l,a,u){n.hasOwnProperty(l)||(n[l]=t[l]={_global:[]}),n[l][a]=u},t.registerGlobalHelper=function(l,a,u,d){t.registerHelper(l,a,d),n[l]._global.push({pred:u,val:d})}}function hh(t,r,n,l,a){let u=r,d=n,c=V(t,r.line),g=a&&t.direction=="rtl"?-n:n;function m(){let k=r.line+g;return k=t.first+t.size?!1:(r=new U(k,r.ch,r.sticky),c=V(t,k))}function x(k){let A;if(l=="codepoint"){let T=c.text.charCodeAt(r.ch+(n>0?0:-1));if(isNaN(T))A=null;else{let L=n>0?T>=55296&&T<56320:T>=56320&&T<57343;A=new U(r.line,Math.max(0,Math.min(c.text.length,r.ch+n*(L?2:1))),-n)}}else a?A=$p(t.cm,c,r,n):A=Za(c,r,n);if(A==null)if(!k&&m())r=as(a,t.cm,c,r.line,g);else return!1;else r=A;return!0}if(l=="char"||l=="codepoint")x();else if(l=="column")x(!0);else if(l=="word"||l=="group"){let k=null,A=l=="group",T=t.cm&&t.cm.getHelper(r,"wordChars");for(let L=!0;!(n<0&&!x(!L));L=!1){let C=c.text.charAt(r.ch)||` -`,M=Eo(C,T)?"w":A&&C==` -`?"n":!A||/\s/.test(C)?null:"p";if(A&&!L&&!M&&(M="s"),k&&k!=M){n<0&&(n=1,x(),r.sticky="after");break}if(M&&(k=M),n>0&&!x(!L))break}}let S=Rl(t,r,u,d,!0);return zo(u,S)&&(S.hitSide=!0),S}function og(t,r,n,l){let a=t.doc,u=r.left,d;if(l=="page"){let g=Math.min(t.display.wrapper.clientHeight,Sn(t).innerHeight||a(t).documentElement.clientHeight),m=Math.max(g-.5*Ci(t.display),3);d=(n>0?r.bottom:r.top)+n*m}else l=="line"&&(d=n>0?r.bottom+3:r.top-3);let c;for(;c=Sa(t,u,d),!!c.outside;){if(n<0?d<=0:d>=a.height){c.hitSide=!0;break}d+=n*5}return c}var Ql=class{constructor(r){this.cm=r,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new fr,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}init(r){let n=this,l=n.cm,a=n.div=r.lineDiv;a.contentEditable=!0,cs(a,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize);function u(c){for(let g=c.target;g;g=g.parentNode){if(g==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}ne(a,"paste",c=>{!u(c)||Re(l,c)||lf(c,l)||Se<=11&&setTimeout(Ie(l,()=>this.updateFromDOM()),20)}),ne(a,"compositionstart",c=>{this.composing={data:c.data,done:!1}}),ne(a,"compositionupdate",c=>{this.composing||(this.composing={data:c.data,done:!1})}),ne(a,"compositionend",c=>{this.composing&&(c.data!=this.composing.data&&this.readFromDOMSoon(),this.composing.done=!0)}),ne(a,"touchstart",()=>n.forceCompositionEnd()),ne(a,"input",()=>{this.composing||this.readFromDOMSoon()});function d(c){if(!u(c)||Re(l,c))return;if(l.somethingSelected())Zl({lineWise:!1,text:l.getSelections()}),c.type=="cut"&&l.replaceSelection("",null,"cut");else if(l.options.lineWiseCopyCut){let S=of(l);Zl({lineWise:!0,text:S.text}),c.type=="cut"&&l.operation(()=>{l.setSelections(S.ranges,0,Lt),l.replaceSelection("",null,"cut")})}else return;if(c.clipboardData){c.clipboardData.clearData();let S=kr.text.join(` -`);if(c.clipboardData.setData("Text",S),c.clipboardData.getData("Text")==S){c.preventDefault();return}}let g=sf(),m=g.firstChild;cs(m),l.display.lineSpace.insertBefore(g,l.display.lineSpace.firstChild),m.value=kr.text.join(` -`);let x=st(Fr(a));Cn(m),setTimeout(()=>{l.display.lineSpace.removeChild(g),x.focus(),x==a&&n.showPrimarySelection()},50)}ne(a,"copy",d),ne(a,"cut",d)}screenReaderLabelChanged(r){r?this.div.setAttribute("aria-label",r):this.div.removeAttribute("aria-label")}prepareSelection(){let r=Oa(this.cm,!1);return r.focus=st(Fr(this.div))==this.div,r}showSelection(r,n){!r||!this.cm.display.view.length||((r.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(r))}getSelection(){return this.cm.display.wrapper.ownerDocument.getSelection()}showPrimarySelection(){let r=this.getSelection(),n=this.cm,l=n.doc.sel.primary(),a=l.from(),u=l.to();if(n.display.viewTo==n.display.viewFrom||a.line>=n.display.viewTo||u.line=n.display.viewFrom&&ag(n,a)||{node:g[0].measure.map[2],offset:0},x=u.line{this.gracePeriod=!1,this.selectionChanged()&&this.cm.operation(()=>this.cm.curOp.selectionChanged=!0)},20)}showMultipleSelections(r){vt(this.cm.display.cursorDiv,r.cursors),vt(this.cm.display.selectionDiv,r.selection)}rememberSelection(){let r=this.getSelection();this.lastAnchorNode=r.anchorNode,this.lastAnchorOffset=r.anchorOffset,this.lastFocusNode=r.focusNode,this.lastFocusOffset=r.focusOffset}selectionInEditor(){let r=this.getSelection();if(!r.rangeCount)return!1;let n=r.getRangeAt(0).commonAncestorContainer;return vr(this.div,n)}focus(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||st(Fr(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())}blur(){this.div.blur()}getField(){return this.div}supportsTouch(){return!0}receivedFocus(){let r=this;this.selectionInEditor()?setTimeout(()=>this.pollSelection(),20):Xe(this.cm,()=>r.cm.curOp.selectionChanged=!0);function n(){r.cm.state.focused&&(r.pollSelection(),r.polling.set(r.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)}selectionChanged(){let r=this.getSelection();return r.anchorNode!=this.lastAnchorNode||r.anchorOffset!=this.lastAnchorOffset||r.focusNode!=this.lastFocusNode||r.focusOffset!=this.lastFocusOffset}pollSelection(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;let r=this.getSelection(),n=this.cm;if(gl&&pr&&this.cm.display.gutterSpecs.length&&my(r.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();let l=af(n,r.anchorNode,r.anchorOffset),a=af(n,r.focusNode,r.focusOffset);l&&a&&Xe(n,()=>{et(n.doc,hr(l,a),Lt),(l.bad||a.bad)&&(n.curOp.selectionChanged=!0)})}pollContent(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);let r=this.cm,n=r.display,l=r.doc.sel.primary(),a=l.from(),u=l.to();if(a.ch==0&&a.line>r.firstLine()&&(a=U(a.line-1,V(r.doc,a.line-1).length)),u.ch==V(r.doc,u.line).text.length&&u.linen.viewTo-1)return!1;let d,c,g;a.line==n.viewFrom||(d=Si(r,a.line))==0?(c=xe(n.view[0].line),g=n.view[0].node):(c=xe(n.view[d].line),g=n.view[d-1].node.nextSibling);let m=Si(r,u.line),x,S;if(m==n.view.length-1?(x=n.viewTo-1,S=n.lineDiv.lastChild):(x=xe(n.view[m+1].line)-1,S=n.view[m+1].node.previousSibling),!g)return!1;let k=r.doc.splitLines(yy(r,g,S,c,x)),A=Br(r.doc,U(c,0),U(x,V(r.doc,x).text.length));for(;k.length>1&&A.length>1;)if(ge(k)==ge(A))k.pop(),A.pop(),x--;else if(k[0]==A[0])k.shift(),A.shift(),c++;else break;let T=0,L=0,C=k[0],M=A[0],D=Math.min(C.length,M.length);for(;Ta.ch&&E.charCodeAt(E.length-L-1)==B.charCodeAt(B.length-L-1);)T--,L++;k[k.length-1]=E.slice(0,E.length-L).replace(/^\u200b+/,""),k[0]=k[0].slice(T).replace(/\u200b+$/,"");let X=U(c,T),ee=U(x,A.length?ge(A).length-L:0);if(k.length>1||k[0]||se(X,ee))return Sr(r.doc,k,X,ee,"+input"),!0}ensurePolled(){this.forceCompositionEnd()}reset(){this.forceCompositionEnd()}forceCompositionEnd(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())}readFromDOMSoon(){this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(()=>{if(this.readDOMTimeout=null,this.composing)if(this.composing.done)this.composing=null;else return;this.updateFromDOM()},80))}updateFromDOM(){(this.cm.isReadOnly()||!this.pollContent())&&Xe(this.cm,()=>Je(this.cm))}setUneditable(r){r.contentEditable="false"}onKeyPress(r){r.charCode==0||this.composing||(r.preventDefault(),this.cm.isReadOnly()||Ie(this.cm,ds)(this.cm,String.fromCharCode(r.charCode==null?r.keyCode:r.charCode),0))}readOnlyChanged(r){this.div.contentEditable=String(r!="nocursor")}onContextMenu(){}resetPosition(){}};Ql.prototype.needsContentAttribute=!0;function ag(t,r){let n=Zo(t,r.line);if(!n||n.hidden)return null;let l=V(t.doc,r.line),a=Hu(n,l,r.line),u=Pt(l,t.doc.direction),d="left";u&&(d=bi(u,r.ch)%2?"right":"left");let c=Pu(a.map,r.ch,d);return c.offset=c.collapse=="right"?c.end:c.start,c}function my(t){for(let r=t;r;r=r.parentNode)if(/CodeMirror-gutter-wrapper/.test(r.className))return!0;return!1}function Jl(t,r){return r&&(t.bad=!0),t}function yy(t,r,n,l,a){let u="",d=!1,c=t.doc.lineSeparator(),g=!1;function m(A){return T=>T.id==A}function x(){d&&(u+=c,g&&(u+=c),d=g=!1)}function S(A){A&&(x(),u+=A)}function k(A){if(A.nodeType==1){let T=A.getAttribute("cm-text");if(T){S(T);return}let L=A.getAttribute("cm-marker"),C;if(L){let D=t.findMarks(U(l,0),U(a+1,0),m(+L));D.length&&(C=D[0].find(0))&&S(Br(t.doc,C.from,C.to).join(c));return}if(A.getAttribute("contenteditable")=="false")return;let M=/^(pre|div|p|li|table|br)$/i.test(A.nodeName);if(!/^br$/i.test(A.nodeName)&&A.textContent.length==0)return;M&&x();for(let D=0;D{de&&Se>=9&&this.hasSelection&&(this.hasSelection=null),n.poll()}),ne(a,"paste",d=>{Re(l,d)||lf(d,l)||(l.state.pasteIncoming=+new Date,n.fastPoll())});function u(d){if(!Re(l,d)){if(l.somethingSelected())Zl({lineWise:!1,text:l.getSelections()});else if(l.options.lineWiseCopyCut){let c=of(l);Zl({lineWise:!0,text:c.text}),d.type=="cut"?l.setSelections(c.ranges,null,Lt):(n.prevInput="",a.value=c.text.join(` -`),Cn(a))}else return;d.type=="cut"&&(l.state.cutIncoming=+new Date)}}ne(a,"cut",u),ne(a,"copy",u),ne(r.scroller,"paste",d=>{if(rr(r,d)||Re(l,d))return;if(!a.dispatchEvent){l.state.pasteIncoming=+new Date,n.focus();return}let c=new Event("paste");c.clipboardData=d.clipboardData,a.dispatchEvent(c)}),ne(r.lineSpace,"selectstart",d=>{rr(r,d)||Ve(d)}),ne(a,"compositionstart",()=>{let d=l.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:d,range:l.markText(d,l.getCursor("to"),{className:"CodeMirror-composing"})}}),ne(a,"compositionend",()=>{n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})}createField(r){this.wrapper=sf(),this.textarea=this.wrapper.firstChild;let n=this.cm.options;cs(this.textarea,n.spellcheck,n.autocorrect,n.autocapitalize)}screenReaderLabelChanged(r){r?this.textarea.setAttribute("aria-label",r):this.textarea.removeAttribute("aria-label")}prepareSelection(){let r=this.cm,n=r.display,l=r.doc,a=Oa(r);if(r.options.moveInputWithCursor){let u=jt(r,l.sel.primary().head,"div"),d=n.wrapper.getBoundingClientRect(),c=n.lineDiv.getBoundingClientRect();a.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,u.top+c.top-d.top)),a.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,u.left+c.left-d.left))}return a}showSelection(r){let n=this.cm,l=n.display;vt(l.cursorDiv,r.cursors),vt(l.selectionDiv,r.selection),r.teTop!=null&&(this.wrapper.style.top=r.teTop+"px",this.wrapper.style.left=r.teLeft+"px")}reset(r){if(this.contextMenuPending||this.composing&&r)return;let n=this.cm;if(this.resetting=!0,n.somethingSelected()){this.prevInput="";let l=n.getSelection();this.textarea.value=l,n.state.focused&&Cn(this.textarea),de&&Se>=9&&(this.hasSelection=l)}else r||(this.prevInput=this.textarea.value="",de&&Se>=9&&(this.hasSelection=null));this.resetting=!1}getField(){return this.textarea}supportsTouch(){return!1}focus(){if(this.cm.options.readOnly!="nocursor"&&(!yi||st(Fr(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}}blur(){this.textarea.blur()}resetPosition(){this.wrapper.style.top=this.wrapper.style.left=0}receivedFocus(){this.slowPoll()}slowPoll(){this.pollingFast||this.polling.set(this.cm.options.pollInterval,()=>{this.poll(),this.cm.state.focused&&this.slowPoll()})}fastPoll(){let r=!1,n=this;n.pollingFast=!0;function l(){!n.poll()&&!r?(r=!0,n.polling.set(60,l)):(n.pollingFast=!1,n.slowPoll())}n.polling.set(20,l)}poll(){let r=this.cm,n=this.textarea,l=this.prevInput;if(this.contextMenuPending||this.resetting||!r.state.focused||Mc(n)&&!l&&!this.composing||r.isReadOnly()||r.options.disableInput||r.state.keySeq)return!1;let a=n.value;if(a==l&&!r.somethingSelected())return!1;if(de&&Se>=9&&this.hasSelection===a||ot&&/[\uf700-\uf7ff]/.test(a))return r.display.input.reset(),!1;if(r.doc.sel==r.display.selForContextMenu){let c=a.charCodeAt(0);if(c==8203&&!l&&(l="\u200B"),c==8666)return this.reset(),this.cm.execCommand("undo")}let u=0,d=Math.min(l.length,a.length);for(;u{ds(r,a.slice(u),l.length-u,null,this.composing?"*compose":null),a.length>1e3||a.indexOf(` -`)>-1?n.value=this.prevInput="":this.prevInput=a,this.composing&&(this.composing.range.clear(),this.composing.range=r.markText(this.composing.start,r.getCursor("to"),{className:"CodeMirror-composing"}))}),!0}ensurePolled(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)}onKeyPress(){de&&Se>=9&&(this.hasSelection=null),this.fastPoll()}onContextMenu(r){let n=this,l=n.cm,a=l.display,u=n.textarea;n.contextMenuPending&&n.contextMenuPending();let d=Gr(l,r),c=a.scroller.scrollTop;if(!d||Wt)return;l.options.resetSelectionOnContextMenu&&l.doc.sel.contains(d)==-1&&Ie(l,et)(l.doc,hr(d),Lt);let m=u.style.cssText,x=n.wrapper.style.cssText,S=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",u.style.cssText=`position: absolute; width: 30px; height: 30px; - top: ${r.clientY-S.top-5}px; left: ${r.clientX-S.left-5}px; - z-index: 1000; background: ${de?"rgba(255, 255, 255, .05)":"transparent"}; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;let k;Ue&&(k=u.ownerDocument.defaultView.scrollY),a.input.focus(),Ue&&u.ownerDocument.defaultView.scrollTo(null,k),a.input.reset(),l.somethingSelected()||(u.value=n.prevInput=" "),n.contextMenuPending=T,a.selForContextMenu=l.doc.sel,clearTimeout(a.detectingSelectAll);function A(){if(u.selectionStart!=null){let L=l.somethingSelected(),C="\u200B"+(L?u.value:"");u.value="\u21DA",u.value=C,n.prevInput=L?"":"\u200B",u.selectionStart=1,u.selectionEnd=C.length,a.selForContextMenu=l.doc.sel}}function T(){if(n.contextMenuPending==T&&(n.contextMenuPending=!1,n.wrapper.style.cssText=x,u.style.cssText=m,de&&Se<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=c),u.selectionStart!=null)){(!de||de&&Se<9)&&A();let L=0,C=()=>{a.selForContextMenu==l.doc.sel&&u.selectionStart==0&&u.selectionEnd>0&&n.prevInput=="\u200B"?Ie(l,ja)(l):L++<10?a.detectingSelectAll=setTimeout(C,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(C,200)}}if(de&&Se>=9&&A(),Wo){wi(r);let L=()=>{yt(window,"mouseup",L),setTimeout(T,20)};ne(window,"mouseup",L)}else setTimeout(T,50)}readOnlyChanged(r){r||this.reset(),this.textarea.disabled=r=="nocursor",this.textarea.readOnly=!!r}setUneditable(){}};$l.prototype.needsContentAttribute=!1;function fg(t,r){if(r=r?Er(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),r.autofocus==null){let u=st(Fr(t));r.autofocus=u==t||t.getAttribute("autofocus")!=null&&u==document.body}function n(){t.value=a.getValue()}let l;if(t.form&&(ne(t.form,"submit",n),!r.leaveSubmitMethodAlone)){let u=t.form;l=u.submit;try{let d=u.submit=()=>{n(),u.submit=l,u.submit(),u.submit=d}}catch{}}r.finishInit=u=>{u.save=n,u.getTextArea=()=>t,u.toTextArea=()=>{u.toTextArea=isNaN,n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(yt(t.form,"submit",n),!r.leaveSubmitMethodAlone&&typeof t.form.submit=="function"&&(t.form.submit=l))}},t.style.display="none";let a=Fe(u=>t.parentNode.insertBefore(u,t.nextSibling),r);return a}function ug(t){t.off=yt,t.on=ne,t.wheelEventPixels=bp,t.Doc=ni,t.splitLines=bl,t.countColumn=mt,t.findColumn=Fo,t.isWordChar=ea,t.Pass=Ji,t.signal=Ae,t.Line=ei,t.changeEnd=wr,t.scrollbarModel=qu,t.Pos=U,t.cmpPos=se,t.modes=fa,t.mimeModes=Tn,t.resolveMode=Io,t.getMode=Bo,t.modeExtensions=Mn,t.extendMode=Hc,t.copyState=Vr,t.startState=ua,t.innerMode=Ro,t.commands=Di,t.keyMap=oi,t.keyName=Ya,t.isModifierKey=qa,t.lookupKey=ln,t.normalizeKeyMap=Qp,t.StringStream=wl,t.SharedTextMarker=jl,t.TextMarker=Xl,t.LineWidget=Kl,t.e_preventDefault=Ve,t.e_stopPropagation=du,t.e_stop=wi,t.addClass=er,t.contains=vr,t.rmClass=Vt,t.keyNames=li}lg(Fe);sg(Fe);var by="iter insert remove copy getEditor constructor".split(" ");for(let t in ni.prototype)ni.prototype.hasOwnProperty(t)&&He(by,t)<0&&(Fe.prototype[t]=function(r){return function(){return r.apply(this.doc,arguments)}}(ni.prototype[t]));Ir(ni);Fe.inputStyles={textarea:$l,contenteditable:Ql};Fe.defineMode=function(t){!Fe.defaults.mode&&t!="null"&&(Fe.defaults.mode=t),Dc.apply(this,arguments)};Fe.defineMIME=Nc;Fe.defineMode("null",()=>({token:t=>t.skipToEnd()}));Fe.defineMIME("text/plain","null");Fe.defineExtension=(t,r)=>{Fe.prototype[t]=r};Fe.defineDocExtension=(t,r)=>{ni.prototype[t]=r};Fe.fromTextArea=fg;ug(Fe);Fe.version="5.65.19";var KT=_t(cg(),1),XT=_t(vg(),1),jT=_t(wg(),1),qT=_t(kg(),1),YT=_t(Mg(),1),ZT=_t(Dg(),1),JT=_t(Wg(),1),QT=_t(Eg(),1),$T=_t(Rg(),1),VT=_t(dh(),1),eM=_t(Kg(),1),tM=_t(qg(),1),rM=_t(Jg(),1),iM=_t(ff(),1);window.CodeMirror=Qg.default;})(); +`:"")+"",newPos:be?g.Pos(j.line+1,0):g.Pos(j.line,j.ch+1)}}for(var pe=typeof I=="object"&&I.dontIndentOnAutoClose,H=R.length-1;H>=0;H--){var we=L[H];w.replaceRange(we.text,R[H].head,R[H].anchor,"+insert");var D=w.listSelections().slice(0);D[H]={head:we.newPos,anchor:we.newPos},w.setSelections(D),!pe&&we.indent&&(w.indentLine(we.newPos.line,null,!0),w.indentLine(we.newPos.line+1,null,!0))}}function W(w,R){for(var L=w.listSelections(),I=[],H=R?"/":""&&(X+=">"),I[y]=X}if(w.replaceSelections(I),L=w.listSelections(),!C)for(var y=0;y=0&&R[p]==L;p--)++y;I=C.to;for(var p=1;p{(function(g){typeof Al=="object"&&typeof Ol=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,P=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Q=/[*+-]\s/;g.commands.newlineAndIndentContinueMarkdownList=function(T){if(T.getOption("disableInput"))return g.Pass;for(var k=T.listSelections(),N=[],w=0;w\s*$/.test(C),A=!/>\s*$/.test(C);(x||A)&&T.replaceRange("",{line:R.line,ch:0},{line:R.line,ch:R.ch+1}),N[w]=` +`}else{var E=y[1],X=y[5],V=!(Q.test(y[2])||y[2].indexOf(">")>=0),J=V?parseInt(y[3],10)+1+y[4]:y[2].replace("x"," ");N[w]=` +`+E+J+X,V&&W(T,R)}}T.replaceSelections(N)};function W(T,k){var N=k.line,w=0,R=0,L=_.exec(T.getLine(N)),I=L[1];do{w+=1;var H=N+w,j=T.getLine(H),C=_.exec(j);if(C){var y=C[1],p=parseInt(L[3],10)+w-R,x=parseInt(C[3],10),A=x;if(I===y&&!isNaN(x))p===x&&(A=x+1),p>x&&(A=p+1),T.replaceRange(j.replace(_,y+A+C[4]+C[5]),{line:H,ch:0},{line:H,ch:j.length});else{if(I.length>y.length||I.length{(function(g){typeof Fl=="object"&&typeof Nl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),P=g.Pos,Q={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function W(L){return L&&L.bracketRegex||/[(){}[\]]/}function T(L,I,H){var j=L.getLineHandle(I.line),C=I.ch-1,y=H&&H.afterCursor;y==null&&(y=/(^| )cm-fat-cursor($| )/.test(L.getWrapperElement().className));var p=W(H),x=!y&&C>=0&&p.test(j.text.charAt(C))&&Q[j.text.charAt(C)]||p.test(j.text.charAt(C+1))&&Q[j.text.charAt(++C)];if(!x)return null;var A=x.charAt(1)==">"?1:-1;if(H&&H.strict&&A>0!=(C==I.ch))return null;var E=L.getTokenTypeAt(P(I.line,C+1)),X=k(L,P(I.line,C+(A>0?1:0)),A,E,H);return X==null?null:{from:P(I.line,C),to:X&&X.pos,match:X&&X.ch==x.charAt(0),forward:A>0}}function k(L,I,H,j,C){for(var y=C&&C.maxScanLineLength||1e4,p=C&&C.maxScanLines||1e3,x=[],A=W(C),E=H>0?Math.min(I.line+p,L.lastLine()+1):Math.max(L.firstLine()-1,I.line-p),X=I.line;X!=E;X+=H){var V=L.getLine(X);if(V){var J=H>0?0:V.length-1,ae=H>0?V.length:-1;if(!(V.length>y))for(X==I.line&&(J=I.ch-(H<0?1:0));J!=ae;J+=H){var be=V.charAt(J);if(A.test(be)&&(j===void 0||(L.getTokenTypeAt(P(X,J+1))||"")==(j||""))){var pe=Q[be];if(pe&&pe.charAt(1)==">"==H>0)x.push(be);else if(x.length)x.pop();else return{pos:P(X,J),ch:be}}}}}return X-H==(H>0?L.lastLine():L.firstLine())?!1:null}function N(L,I,H){for(var j=L.state.matchBrackets.maxHighlightLineLength||1e3,C=H&&H.highlightNonMatching,y=[],p=L.listSelections(),x=0;x{(function(g){typeof Hl=="object"&&typeof Pl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("matchTags",!1,function(W,T,k){k&&k!=g.Init&&(W.off("cursorActivity",P),W.off("viewportChange",Q),_(W)),T&&(W.state.matchBothTags=typeof T=="object"&&T.bothTags,W.on("cursorActivity",P),W.on("viewportChange",Q),P(W))});function _(W){W.state.tagHit&&W.state.tagHit.clear(),W.state.tagOther&&W.state.tagOther.clear(),W.state.tagHit=W.state.tagOther=null}function P(W){W.state.failedTagMatch=!1,W.operation(function(){if(_(W),!W.somethingSelected()){var T=W.getCursor(),k=W.getViewport();k.from=Math.min(k.from,T.line),k.to=Math.max(T.line+1,k.to);var N=g.findMatchingTag(W,T,k);if(N){if(W.state.matchBothTags){var w=N.at=="open"?N.open:N.close;w&&(W.state.tagHit=W.markText(w.from,w.to,{className:"CodeMirror-matchingtag"}))}var R=N.at=="close"?N.open:N.close;R?W.state.tagOther=W.markText(R.from,R.to,{className:"CodeMirror-matchingtag"}):W.state.failedTagMatch=!0}}})}function Q(W){W.state.failedTagMatch&&P(W)}g.commands.toMatchingTag=function(W){var T=g.findMatchingTag(W,W.getCursor());if(T){var k=T.at=="close"?T.open:T.close;k&&W.extendSelection(k.to,k.from)}}})});var zl=at((Il,Bl)=>{(function(g){typeof Il=="object"&&typeof Bl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){g.defineOption("showTrailingSpace",!1,function(_,P,Q){Q==g.Init&&(Q=!1),Q&&!P?_.removeOverlay("trailingspace"):!Q&&P&&_.addOverlay({token:function(W){for(var T=W.string.length,k=T;k&&/\s/.test(W.string.charAt(k-1));--k);return k>W.pos?(W.pos=k,null):(W.pos=T,"trailingspace")},name:"trailingspace"})})})});var Ul=at((Rl,Gl)=>{(function(g){typeof Rl=="object"&&typeof Gl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(P){return function(Q,W){var T=W.line,k=Q.getLine(T);function N(j){for(var C,y=W.ch,p=0;;){var x=y<=0?-1:k.lastIndexOf(j[0],y-1);if(x==-1){if(p==1)break;p=1,y=k.length;continue}if(p==1&&xP.lastLine())return null;var I=P.getTokenAt(g.Pos(L,1));if(/\S/.test(I.string)||(I=P.getTokenAt(g.Pos(L,I.end+1))),I.type!="keyword"||I.string!="import")return null;for(var H=L,j=Math.min(P.lastLine(),L+10);H<=j;++H){var C=P.getLine(H),y=C.indexOf(";");if(y!=-1)return{startCh:I.end,end:g.Pos(H,y)}}}var T=Q.line,k=W(T),N;if(!k||W(T-1)||(N=W(T-2))&&N.end.line==T-1)return null;for(var w=k.end;;){var R=W(w.line+1);if(R==null)break;w=R.end}return{from:P.clipPos(g.Pos(T,k.startCh+1)),to:w}}),g.registerHelper("fold","include",function(P,Q){function W(R){if(RP.lastLine())return null;var L=P.getTokenAt(g.Pos(R,1));if(/\S/.test(L.string)||(L=P.getTokenAt(g.Pos(R,L.end+1))),L.type=="meta"&&L.string.slice(0,8)=="#include")return L.start+8}var T=Q.line,k=W(T);if(k==null||W(T-1)!=null)return null;for(var N=T;;){var w=W(N+1);if(w==null)break;++N}return{from:g.Pos(T,k+1),to:P.clipPos(g.Pos(N))}})})});var ql=at((_l,Kl)=>{(function(g){typeof _l=="object"&&typeof Kl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerGlobalHelper("fold","comment",function(_){return _.blockCommentStart&&_.blockCommentEnd},function(_,P){var Q=_.getModeAt(P),W=Q.blockCommentStart,T=Q.blockCommentEnd;if(!(!W||!T)){for(var k=P.line,N=_.getLine(k),w,R=P.ch,L=0;;){var I=R<=0?-1:N.lastIndexOf(W,R-1);if(I==-1){if(L==1)return;L=1,R=N.length;continue}if(L==1&&I{(function(g){typeof Xl=="object"&&typeof jl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(T,k,N,w){if(N&&N.call){var R=N;N=null}else var R=W(T,N,"rangeFinder");typeof k=="number"&&(k=g.Pos(k,0));var L=W(T,N,"minFoldSize");function I(y){var p=R(T,k);if(!p||p.to.line-p.from.lineT.firstLine();)k=g.Pos(k.line-1,0),H=I(!1);if(!(!H||H.cleared||w==="unfold")){var j=P(T,N,H);g.on(j,"mousedown",function(y){C.clear(),g.e_preventDefault(y)});var C=T.markText(H.from,H.to,{replacedWith:j,clearOnEnter:W(T,N,"clearOnEnter"),__isFold:!0});C.on("clear",function(y,p){g.signal(T,"unfold",T,y,p)}),g.signal(T,"fold",T,H.from,H.to)}}function P(T,k,N){var w=W(T,k,"widget");if(typeof w=="function"&&(w=w(N.from,N.to)),typeof w=="string"){var R=document.createTextNode(w);w=document.createElement("span"),w.appendChild(R),w.className="CodeMirror-foldmarker"}else w&&(w=w.cloneNode(!0));return w}g.newFoldFunction=function(T,k){return function(N,w){_(N,w,{rangeFinder:T,widget:k})}},g.defineExtension("foldCode",function(T,k,N){_(this,T,k,N)}),g.defineExtension("isFolded",function(T){for(var k=this.findMarksAt(T),N=0;N{(function(g){typeof Yl=="object"&&typeof Zl=="object"?g(Ve(),go()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("foldGutter",!1,function(C,y,p){p&&p!=g.Init&&(C.clearGutter(C.state.foldGutter.options.gutter),C.state.foldGutter=null,C.off("gutterClick",R),C.off("changes",I),C.off("viewportChange",H),C.off("fold",j),C.off("unfold",j),C.off("swapDoc",I),C.off("optionChange",L)),y&&(C.state.foldGutter=new P(Q(y)),w(C),C.on("gutterClick",R),C.on("changes",I),C.on("viewportChange",H),C.on("fold",j),C.on("unfold",j),C.on("swapDoc",I),C.on("optionChange",L))});var _=g.Pos;function P(C){this.options=C,this.from=this.to=0}function Q(C){return C===!0&&(C={}),C.gutter==null&&(C.gutter="CodeMirror-foldgutter"),C.indicatorOpen==null&&(C.indicatorOpen="CodeMirror-foldgutter-open"),C.indicatorFolded==null&&(C.indicatorFolded="CodeMirror-foldgutter-folded"),C}function W(C,y){for(var p=C.findMarks(_(y,0),_(y+1,0)),x=0;x=E){if(J&&pe&&J.test(pe.className))return;be=T(x.indicatorOpen)}}!be&&!pe||C.setGutterMarker(ae,x.gutter,be)})}function N(C){return new RegExp("(^|\\s)"+C+"(?:$|\\s)\\s*")}function w(C){var y=C.getViewport(),p=C.state.foldGutter;p&&(C.operation(function(){k(C,y.from,y.to)}),p.from=y.from,p.to=y.to)}function R(C,y,p){var x=C.state.foldGutter;if(x){var A=x.options;if(p==A.gutter){var E=W(C,y);E?E.clear():C.foldCode(_(y,0),A)}}}function L(C,y){y=="mode"&&I(C)}function I(C){var y=C.state.foldGutter;if(y){var p=y.options;y.from=y.to=0,clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){w(C)},p.foldOnChangeTimeSpan||600)}}function H(C){var y=C.state.foldGutter;if(y){var p=y.options;clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){var x=C.getViewport();y.from==y.to||x.from-y.to>20||y.from-x.to>20?w(C):C.operation(function(){x.fromy.to&&(k(C,y.to,x.to),y.to=x.to)})},p.updateViewportTimeSpan||400)}}function j(C,y){var p=C.state.foldGutter;if(p){var x=y.line;x>=p.from&&x{(function(g){typeof Ql=="object"&&typeof Vl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(P,Q){var W=P.getLine(Q),T=W.search(/\S/);return T==-1||/\bcomment\b/.test(P.getTokenTypeAt(g.Pos(Q,T+1)))?-1:g.countColumn(W,null,P.getOption("tabSize"))}g.registerHelper("fold","indent",function(P,Q){var W=_(P,Q.line);if(!(W<0)){for(var T=null,k=Q.line+1,N=P.lastLine();k<=N;++k){var w=_(P,k);if(w!=-1)if(w>W)T=k;else break}if(T)return{from:g.Pos(Q.line,P.getLine(Q.line).length),to:g.Pos(T,P.getLine(T).length)}}})})});var rs=at((es,ts)=>{(function(g){typeof es=="object"&&typeof ts=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerHelper("fold","markdown",function(_,P){var Q=100;function W(H){var j=_.getTokenTypeAt(g.Pos(H,0));return j&&/\bheader\b/.test(j)}function T(H,j,C){var y=j&&j.match(/^#+/);return y&&W(H)?y[0].length:(y=C&&C.match(/^[=\-]+\s*$/),y&&W(H+1)?C[0]=="="?1:2:Q)}var k=_.getLine(P.line),N=_.getLine(P.line+1),w=T(P.line,k,N);if(w!==Q){for(var R=_.lastLine(),L=P.line,I=_.getLine(L+2);Lspan::selection,.cm-s-material .CodeMirror-line>span>span::selection{background:#80cbc433}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line>span::-moz-selection,.cm-s-material .CodeMirror-line>span>span::-moz-selection{background:#80cbc433}.cm-s-material .CodeMirror-activeline-background{background:#00000080}.cm-s-material .cm-keyword{color:#c792ea}.cm-s-material .cm-operator{color:#89ddff}.cm-s-material .cm-variable-2{color:#eff}.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#f07178}.cm-s-material .cm-builtin{color:#ffcb6b}.cm-s-material .cm-atom{color:#f78c6c}.cm-s-material .cm-number{color:#ff5370}.cm-s-material .cm-def{color:#82aaff}.cm-s-material .cm-string{color:#c3e88d}.cm-s-material .cm-string-2{color:#f07178}.cm-s-material .cm-comment{color:#546e7a}.cm-s-material .cm-variable{color:#f07178}.cm-s-material .cm-tag{color:#ff5370}.cm-s-material .cm-meta{color:#ffcb6b}.cm-s-material .cm-attribute,.cm-s-material .cm-property{color:#c792ea}.cm-s-material .cm-qualifier,.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#decb6b}.cm-s-material .cm-error{color:#fff;background-color:#ff5370}.cm-s-material .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-yeti.CodeMirror{background-color:#eceae8!important;color:#d1c9c0!important;border:none}.cm-s-yeti .CodeMirror-gutters{color:#adaba6;background-color:#e5e1db;border:none}.cm-s-yeti .CodeMirror-cursor{border-left:solid thin #d1c9c0}.cm-s-yeti .CodeMirror-linenumber{color:#adaba6}.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::selection,.cm-s-yeti .CodeMirror-line>span::selection,.cm-s-yeti .CodeMirror-line>span>span::selection{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::-moz-selection,.cm-s-yeti .CodeMirror-line>span::-moz-selection,.cm-s-yeti .CodeMirror-line>span>span::-moz-selection{background:#dcd8d2}.cm-s-yeti span.cm-comment{color:#d4c8be}.cm-s-yeti span.cm-string,.cm-s-yeti span.cm-string-2{color:#96c0d8}.cm-s-yeti span.cm-number{color:#a074c4}.cm-s-yeti span.cm-variable{color:#55b5db}.cm-s-yeti span.cm-variable-2{color:#a074c4}.cm-s-yeti span.cm-def{color:#55b5db}.cm-s-yeti span.cm-operator,.cm-s-yeti span.cm-keyword{color:#9fb96e}.cm-s-yeti span.cm-atom{color:#a074c4}.cm-s-yeti span.cm-meta,.cm-s-yeti span.cm-tag{color:#96c0d8}.cm-s-yeti span.cm-attribute{color:#9fb96e}.cm-s-yeti span.cm-qualifier{color:#96c0d8}.cm-s-yeti span.cm-property,.cm-s-yeti span.cm-builtin{color:#a074c4}.cm-s-yeti span.cm-variable-3,.cm-s-yeti span.cm-type{color:#96c0d8}.cm-s-yeti .CodeMirror-activeline-background{background:#e7e4e0}.cm-s-yeti .CodeMirror-matchingbracket{text-decoration:underline} +.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 black;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 .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-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;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.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,.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,.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:#ff96004d}.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;z-index:0}.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;inset: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,.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:#ff06}.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-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25be"}.CodeMirror-foldgutter-folded:after{content:"\25b8"}.cm-s-material.CodeMirror{background-color:#263238;color:#eff}.cm-s-material .CodeMirror-gutters{background:#263238;color:#546e7a;border:none}.cm-s-material .CodeMirror-guttermarker,.cm-s-material .CodeMirror-guttermarker-subtle,.cm-s-material .CodeMirror-linenumber{color:#546e7a}.cm-s-material .CodeMirror-cursor{border-left:1px solid #FFCC00}.cm-s-material.cm-fat-cursor .CodeMirror-cursor,.cm-s-material .cm-animate-fat-cursor{background-color:#5d6d5c80!important}.cm-s-material div.CodeMirror-selected,.cm-s-material.CodeMirror-focused div.CodeMirror-selected{background:#80cbc433}.cm-s-material .CodeMirror-line::selection,.cm-s-material .CodeMirror-line>span::selection,.cm-s-material .CodeMirror-line>span>span::selection{background:#80cbc433}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line>span::-moz-selection,.cm-s-material .CodeMirror-line>span>span::-moz-selection{background:#80cbc433}.cm-s-material .CodeMirror-activeline-background{background:#00000080}.cm-s-material .cm-keyword{color:#c792ea}.cm-s-material .cm-operator{color:#89ddff}.cm-s-material .cm-variable-2{color:#eff}.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#f07178}.cm-s-material .cm-builtin{color:#ffcb6b}.cm-s-material .cm-atom{color:#f78c6c}.cm-s-material .cm-number{color:#ff5370}.cm-s-material .cm-def{color:#82aaff}.cm-s-material .cm-string{color:#c3e88d}.cm-s-material .cm-string-2{color:#f07178}.cm-s-material .cm-comment{color:#546e7a}.cm-s-material .cm-variable{color:#f07178}.cm-s-material .cm-tag{color:#ff5370}.cm-s-material .cm-meta{color:#ffcb6b}.cm-s-material .cm-attribute,.cm-s-material .cm-property{color:#c792ea}.cm-s-material .cm-qualifier,.cm-s-material .cm-variable-3,.cm-s-material .cm-type{color:#decb6b}.cm-s-material .cm-error{color:#fff;background-color:#ff5370}.cm-s-material .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important} diff --git a/dist/laravel-filament-json-field.js b/dist/laravel-filament-json-field.js index 01e9e7e..6e96467 100644 --- a/dist/laravel-filament-json-field.js +++ b/dist/laravel-filament-json-field.js @@ -1,29 +1,29 @@ -(()=>{var iu=Object.create;var gl=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var lu=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var at=(g,_)=>()=>(_||g((_={exports:{}}).exports,_),_.exports);var fu=(g,_,P,Q)=>{if(_&&typeof _=="object"||typeof _=="function")for(let W of au(_))!su.call(g,W)&&W!==P&&gl(g,W,{get:()=>_[W],enumerable:!(Q=ou(_,W))||Q.enumerable});return g};var lt=(g,_,P)=>(P=g!=null?iu(lu(g)):{},fu(_||!g||!g.__esModule?gl(P,"default",{value:g,enumerable:!0}):P,g));var Ve=at((po,vo)=>{(function(g,_){typeof po=="object"&&typeof vo<"u"?vo.exports=_():typeof define=="function"&&define.amd?define(_):(g=g||self,g.CodeMirror=_())})(po,function(){"use strict";var g=navigator.userAgent,_=navigator.platform,P=/gecko\/\d/i.test(g),Q=/MSIE \d/.test(g),W=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(g),T=/Edge\/(\d+)/.exec(g),k=Q||W||T,N=k&&(Q?document.documentMode||6:+(T||W)[1]),w=!T&&/WebKit\//.test(g),R=w&&/Qt\/\d+\.\d+/.test(g),L=!T&&/Chrome\/(\d+)/.exec(g),I=L&&+L[1],H=/Opera\//.test(g),j=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(g),y=/PhantomJS/.test(g),p=j&&(/Mobile\/\w+/.test(g)||navigator.maxTouchPoints>2),x=/Android/.test(g),A=p||x||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(g),E=p||/Mac/.test(_),X=/\bCrOS\b/.test(g),V=/win/i.test(_),J=H&&g.match(/Version\/(\d*\.\d*)/);J&&(J=Number(J[1])),J&&J>=15&&(H=!1,w=!0);var ae=E&&(R||H&&(J==null||J<12.11)),be=P||k&&N>=9;function pe(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var we=function(e,t){var n=e.className,r=pe(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function D(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return D(e).appendChild(t)}function v(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var At=function(){this.id=null,this.f=null,this.time=0,this.handler=ne(this.onTimeout,this)};At.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},At.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var It=[""];function Vr(e){for(;It.length<=e;)It.push(ce(It)+" ");return It[e]}function ce(e){return e[e.length-1]}function hr(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||gi.test(e))}function Bt(e,t){return t?t.source.indexOf("\\w")>-1&&$r(e)?!0:t.test(e):$r(e)}function Hn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var zt=/[\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 Oe(e){return e.charCodeAt(0)>=768&&zt.test(e)}function Zt(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function Jt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var dr=null;function Qt(e,t,n){var r;dr=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:dr=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:dr=i)}return r??dr}var yi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(f){return f<=247?e.charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?t.charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":f==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(f,c,d){this.level=f,this.from=c,this.to=d}return function(f,c){var d=c=="ltr"?"L":"R";if(f.length==0||c=="ltr"&&!r.test(f))return!1;for(var b=f.length,m=[],M=0;M-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function ke(e,t){var n=Rt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function bt(e){e.prototype.on=function(t,n){te(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function qe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Lr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function $e(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){qe(e),Lr(e)}function en(e){return e.target||e.srcElement}function xt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),E&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(k&&N<9)return!1;var e=v("div");return"draggable"in e||"dragDrop"in e}(),Tr;function Wn(e){if(Tr==null){var t=v("span","\u200B");Y(e,v("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Tr=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&N<8))}var n=Tr?v("span","\u200B"):v("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var tn;function $t(e){if(tn!=null)return tn;var t=Y(e,document.createTextNode("A\u062EA")),n=_e(t,0,1).getBoundingClientRect(),r=_e(t,1,2).getBoundingClientRect();return D(e),!n||n.left==n.right?!1:tn=r.right-n.right<3}var yt=` +(()=>{var iu=Object.create;var gl=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var lu=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var at=(g,_)=>()=>(_||g((_={exports:{}}).exports,_),_.exports);var fu=(g,_,W,Q)=>{if(_&&typeof _=="object"||typeof _=="function")for(let E of au(_))!su.call(g,E)&&E!==W&&gl(g,E,{get:()=>_[E],enumerable:!(Q=ou(_,E))||Q.enumerable});return g};var lt=(g,_,W)=>(W=g!=null?iu(lu(g)):{},fu(_||!g||!g.__esModule?gl(W,"default",{value:g,enumerable:!0}):W,g));var Ve=at((po,vo)=>{(function(g,_){typeof po=="object"&&typeof vo<"u"?vo.exports=_():typeof define=="function"&&define.amd?define(_):(g=g||self,g.CodeMirror=_())})(po,function(){"use strict";var g=navigator.userAgent,_=navigator.platform,W=/gecko\/\d/i.test(g),Q=/MSIE \d/.test(g),E=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(g),T=/Edge\/(\d+)/.exec(g),C=Q||E||T,N=C&&(Q?document.documentMode||6:+(T||E)[1]),w=!T&&/WebKit\//.test(g),R=w&&/Qt\/\d+\.\d+/.test(g),L=!T&&/Chrome\/(\d+)/.exec(g),I=L&&+L[1],P=/Opera\//.test(g),j=/Apple Computer/.test(navigator.vendor),k=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(g),y=/PhantomJS/.test(g),p=j&&(/Mobile\/\w+/.test(g)||navigator.maxTouchPoints>2),x=/Android/.test(g),A=p||x||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(g),H=p||/Mac/.test(_),X=/\bCrOS\b/.test(g),V=/win/i.test(_),J=P&&g.match(/Version\/(\d*\.\d*)/);J&&(J=Number(J[1])),J&&J>=15&&(P=!1,w=!0);var ae=H&&(R||P&&(J==null||J<12.11)),be=W||C&&N>=9;function pe(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var we=function(e,t){var n=e.className,r=pe(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function D(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return D(e).appendChild(t)}function v(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var At=function(){this.id=null,this.f=null,this.time=0,this.handler=ne(this.onTimeout,this)};At.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},At.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var It=[""];function Vr(e){for(;It.length<=e;)It.push(ce(It)+" ");return It[e]}function ce(e){return e[e.length-1]}function hr(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||gi.test(e))}function Bt(e,t){return t?t.source.indexOf("\\w")>-1&&$r(e)?!0:t.test(e):$r(e)}function Pn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var zt=/[\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 Oe(e){return e.charCodeAt(0)>=768&&zt.test(e)}function Zt(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function Jt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var dr=null;function Qt(e,t,n){var r;dr=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:dr=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:dr=i)}return r??dr}var yi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(f){return f<=247?e.charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?t.charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":f==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(f,c,d){this.level=f,this.from=c,this.to=d}return function(f,c){var d=c=="ltr"?"L":"R";if(f.length==0||c=="ltr"&&!r.test(f))return!1;for(var b=f.length,m=[],M=0;M-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var n=Rt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function bt(e){e.prototype.on=function(t,n){te(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function qe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Lr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function $e(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){qe(e),Lr(e)}function en(e){return e.target||e.srcElement}function xt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),H&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(C&&N<9)return!1;var e=v("div");return"draggable"in e||"dragDrop"in e}(),Tr;function En(e){if(Tr==null){var t=v("span","\u200B");Y(e,v("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Tr=t.offsetWidth<=1&&t.offsetHeight>2&&!(C&&N<8))}var n=Tr?v("span","\u200B"):v("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var tn;function $t(e){if(tn!=null)return tn;var t=Y(e,document.createTextNode("A\u062EA")),n=_e(t,0,1).getBoundingClientRect(),r=_e(t,1,2).getBoundingClientRect();return D(e),!n||n.left==n.right?!1:tn=r.right-n.right<3}var yt=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` -`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},er=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},In=function(){var e=v("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),wt=null;function bi(e){if(wt!=null)return wt;var t=Y(e,v("span","x")),n=t.getBoundingClientRect(),r=_e(t,0,1).getBoundingClientRect();return wt=Math.abs(n.left-r.left)>1}var Mr={},Ct={};function kt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mr[e]=t}function pr(e,t){Ct[e]=t}function Ar(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=En(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ar("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ar("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Or(e,t){t=Ar(t);var n=Mr[t.name];if(!n)return Or(e,"text/plain");var r=n(e,t);if(tr.hasOwnProperty(t.name)){var i=tr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var tr={};function Dr(e,t){var n=tr.hasOwnProperty(e)?tr[e]:tr[e]={};fe(t,n)}function Nt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function rn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Fr(e,t,n){return e.startState?e.startState(t,n):!0}var Le=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Le.prototype.eol=function(){return this.pos>=this.string.length},Le.prototype.sol=function(){return this.pos==this.lineStart},Le.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Le.prototype.next=function(){if(this.post},Le.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Le.prototype.skipToEnd=function(){this.pos=this.string.length},Le.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Le.prototype.backUp=function(e){this.pos-=e},Le.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Le.prototype.current=function(){return this.string.slice(this.start,this.pos)},Le.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Le.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Le.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function $(e,t){if(t-=e.first,t<0||t>=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&&tn?S(n,$(e,n).text.length):is(t,$(e,t.line).text.length)}function is(e,t){var n=e.ch;return n==null||n>t?S(e.line,t):n<0?S(e.line,0):e}function mo(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Et.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}},Et.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Et.fromSaved=function(e,t,n){return t instanceof Bn?new Et(e,Nt(e.mode,t.state),n,t.lookAhead):new Et(e,Nt(e.mode,t),n)},Et.prototype.save=function(e){var t=e!==!1?Nt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Bn(t,this.maxLookAhead):t};function bo(e,t,n,r){var i=[e.state.modeGen],o={};Lo(e,t.text,e.doc.mode,n,function(f,c){return i.push(f,c)},o,r);for(var a=n.state,l=function(f){n.baseTokens=i;var c=e.state.overlays[f],d=1,b=0;n.state=!0,Lo(e,t.text,c.mode,n,function(m,M){for(var F=d;bm&&i.splice(d,1,m,i[d+1],z),d+=2,b=Math.min(m,z)}if(M)if(c.opaque)i.splice(F,d-F,m,"overlay "+M),d=F+2;else for(;Fe.options.maxHighlightLength&&Nt(e.doc.mode,r.state),o=bo(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))}return t.styles}function on(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Et(r,!0,t);var o=os(e,t,n),a=o>r.first&&$(r,o-1).stateAfter,l=a?Et.fromSaved(r,a,o):new Et(r,Fr(r.mode),o);return r.iter(o,t,function(s){xi(e,s.text,l);var f=l.line;s.stateAfter=f==t-1||f%5==0||f>=i.viewFrom&&ft.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Co=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ko(e,t,n,r){var i=e.doc,o=i.mode,a;t=ie(i,t);var l=$(i,t.line),s=on(e,t.line,n),f=new Le(l.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&xi(e,t,r,c.pos),c.pos=t.length,d=null):d=So(wi(n,c,r.state,b),o),b){var m=b[0].name;m&&(d="m-"+(d?m+" "+d:m))}if(!l||f!=d){for(;sa;--l){if(l<=o.first)return o.first;var s=$(o,l-1),f=s.stateAfter;if(f&&(!n||l+(f instanceof Bn?f.lookAhead:0)<=o.modeFrontier))return l;var c=ve(s.text,null,e.options.tabSize);(i==null||r>c)&&(i=l-1,r=c)}return i}function as(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=$(e,r).stateAfter;if(i&&(!(i instanceof Bn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new zn(a,o.from,s?null:o.to))}}return r}function hs(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var Z=0;Z0)){var c=[s,1],d=K(f.from,l.from),b=K(f.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:f.from,to:l.from}),(b>0||!a.inclusiveRight&&!b)&&c.push({from:l.to,to:f.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Ao(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||ki(r,o.marker)<0)&&(r=o.marker)}return r}function No(e,t,n,r,i){var o=$(e,t),a=Ut&&o.markedSpans;if(a)for(var l=0;l=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.to,n)>=0:K(f.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.from,r)<=0:K(f.from,r)<0)))return!0}}}function St(e){for(var t;t=Fo(e);)e=t.find(-1,!0).line;return e}function vs(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function gs(e){for(var t,n;t=Un(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Si(e,t){var n=$(e,t),r=St(n);return n==r?t:u(r)}function Eo(e,t){if(t>e.lastLine())return t;var n=$(e,t),r;if(!rr(e,n))return t;for(;r=Un(n);)n=r.find(1,!0).line;return u(n)+1}function rr(e,t){var n=Ut&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Er=function(e,t,n){this.text=e,Oo(this,t),this.height=n?n(this):1};Er.prototype.lineNo=function(){return u(this)},bt(Er);function ys(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ao(e),Oo(e,n);var i=r?r(e):1;i!=e.height&&pt(e,i)}function ms(e){e.parent=null,Ao(e)}var bs={},xs={};function Ho(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xs:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Po(e,t){var n=Ye("span",null,null,w?"padding-right: .1px":null),r={pre:Ye("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Cs,$t(e.display.measure)&&(a=ue(o,e.doc.direction))&&(r.addToken=Ss(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&u(o);Ls(o,r,xo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=He(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=He(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Wn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(w){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return ke(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=He(r.pre.className,r.textClass||"")),r}function ws(e){var t=v("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?ks(t,e.trailingSpace):t,s=e.cm.state.specialChars,f=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,c),k&&N<9&&(f=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var d=0;;){s.lastIndex=d;var b=s.exec(t),m=b?b.index-d:t.length-d;if(m){var M=document.createTextNode(l.slice(d,d+m));k&&N<9?c.appendChild(v("span",[M])):c.appendChild(M),e.map.push(e.pos,e.pos+m,M),e.col+=m,e.pos+=m}if(!b)break;d+=m+1;var F=void 0;if(b[0]==" "){var z=e.cm.options.tabSize,G=z-e.col%z;F=c.appendChild(v("span",Vr(G),"cm-tab")),F.setAttribute("role","presentation"),F.setAttribute("cm-text"," "),e.col+=G}else b[0]=="\r"||b[0]==` -`?(F=c.appendChild(v("span",b[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),F.setAttribute("cm-text",b[0]),e.col+=1):(F=e.cm.options.specialCharPlaceholder(b[0]),F.setAttribute("cm-text",b[0]),k&&N<9?c.appendChild(v("span",[F])):c.appendChild(F),e.col+=1);e.map.push(e.pos,e.pos+1,F),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||f||o||a){var q=n||"";r&&(q+=r),i&&(q+=i);var U=v("span",[c],q,o);if(a)for(var Z in a)a.hasOwnProperty(Z)&&Z!="style"&&Z!="class"&&U.setAttribute(Z,a[Z]);return e.content.appendChild(U)}e.content.appendChild(c)}}function ks(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;if&&d.from<=f));b++);if(d.to>=c)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-f),i,o,null,l,s),o=null,r=r.slice(d.to-f),f=d.to}}}function Wo(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;as||se.collapsed&&ee.to==s&&ee.from==s)){if(ee.to!=null&&ee.to!=s&&m>ee.to&&(m=ee.to,F=""),se.className&&(M+=" "+se.className),se.css&&(b=(b?b+";":"")+se.css),se.startStyle&&ee.from==s&&(z+=" "+se.startStyle),se.endStyle&&ee.to==m&&(Z||(Z=[])).push(se.endStyle,ee.to),se.title&&((q||(q={})).title=se.title),se.attributes)for(var ye in se.attributes)(q||(q={}))[ye]=se.attributes[ye];se.collapsed&&(!G||ki(G.marker,se)<0)&&(G=ee)}else ee.from>s&&m>ee.from&&(m=ee.from)}if(Z)for(var Re=0;Re=l)break;for(var ut=Math.min(l,m);;){if(c){var nt=s+c.length;if(!G){var De=nt>ut?c.slice(0,ut-s):c;t.addToken(t,De,d?d+M:M,z,s+De.length==m?F:"",b,q)}if(nt>=ut){c=c.slice(ut-s),s=ut;break}s=nt,z=""}c=i.slice(o,o=n[f++]),d=Ho(n[f++],t.cm.options)}}}function Io(e,t,n){this.line=t,this.rest=gs(t),this.size=this.rest?u(ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Kn(e,t,n){for(var r=[],i,o=t;o2&&o.push((s.bottom+f.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ko(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Ws(e,t){t=St(t);var n=u(t),r=e.display.externalMeasured=new Io(e.doc,t,n);r.lineN=n;var i=r.built=Po(e,r);return r.text=i.pre,Y(e.display.lineMeasure,i.pre),r}function qo(e,t,n,r){return Pt(e,Pr(e,t),n,r)}function Di(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[f+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;f&&e[f-2]==e[f-3]&&e[f-1].insertLeft;)r=e[(f-=3)+2],a="left";if(n=="right"&&i==s-l)for(;f=0&&(n=e[i]).left==n.right;i--);return n}function Bs(e,t,n,r){var i=jo(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,f;if(o.nodeType==3){for(var c=0;c<4;c++){for(;a&&Oe(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l0&&(s=r="right");var d;e.options.lineWrapping&&(d=o.getClientRects()).length>1?f=d[r=="right"?d.length-1:0]:f=o.getBoundingClientRect()}if(k&&N<9&&!a&&(!f||!f.left&&!f.right)){var b=o.parentNode.getClientRects()[0];b?f={left:b.left,right:b.left+Ir(e.display),top:b.top,bottom:b.bottom}:f=Xo}for(var m=f.top-t.rect.top,M=f.bottom-t.rect.top,F=(m+M)/2,z=t.view.measure.heights,G=0;G=r.text.length?(s=r.text.length,f="before"):s<=0&&(s=0,f="after"),!l)return a(f=="before"?s-1:s,f=="before");function c(M,F,z){var G=l[F],q=G.level==1;return a(z?M-1:M,q!=z)}var d=Qt(l,s,f),b=dr,m=c(s,d,f=="before");return b!=null&&(m.other=c(s,b,f!="before")),m}function $o(e,t){var n=0;t=ie(e.doc,t),e.options.lineWrapping||(n=Ir(e.display)*t.ch);var r=$(e.doc,t.line),i=_t(r)+qn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Ni(e,t,n,r,i){var o=S(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Ei(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Ni(r.first,0,null,-1,-1);var i=h(r,n),o=r.first+r.size-1;if(i>o)return Ni(r.first+r.size-1,$(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=$(r,i);;){var l=Rs(e,a,i,t,n),s=ps(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var f=s.find(1);if(f.line==i)return f;a=$(r,i=f.line)}}function ea(e,t,n,r){r-=Fi(t);var i=t.text.length,o=Ft(function(a){return Pt(e,n,a-1).bottom<=r},i,0);return i=Ft(function(a){return Pt(e,n,a).top>r},o,i),{begin:o,end:i}}function ta(e,t,n,r){n||(n=Pr(e,t));var i=Xn(e,t,Pt(e,n,r),"line").top;return ea(e,t,n,i)}function Hi(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Rs(e,t,n,r,i){i-=_t(t);var o=Pr(e,t),a=Fi(t),l=0,s=t.text.length,f=!0,c=ue(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?Us:Gs)(e,t,n,o,c,r,i);f=d.level!=1,l=f?d.from:d.to-1,s=f?d.to:d.from-1}var b=null,m=null,M=Ft(function(re){var ee=Pt(e,o,re);return ee.top+=a,ee.bottom+=a,Hi(ee,r,i,!1)?(ee.top<=i&&ee.left<=r&&(b=re,m=ee),!0):!1},l,s),F,z,G=!1;if(m){var q=r-m.left=Z.bottom?1:0}return M=Zt(t.text,M,1),Ni(n,M,z,G,r-F)}function Gs(e,t,n,r,i,o,a){var l=Ft(function(d){var b=i[d],m=b.level!=1;return Hi(Lt(e,S(n,m?b.to:b.from,m?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var f=s.level!=1,c=Lt(e,S(n,f?s.from:s.to,f?"after":"before"),"line",t,r);Hi(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function Us(e,t,n,r,i,o,a){var l=ea(e,t,r,a),s=l.begin,f=l.end;/\s/.test(t.text.charAt(f-1))&&f--;for(var c=null,d=null,b=0;b=f||m.to<=s)){var M=m.level!=1,F=Pt(e,r,M?Math.min(f,m.to)-1:Math.max(s,m.from)).right,z=Fz)&&(c=m,d=z)}}return c||(c=i[i.length-1]),c.fromf&&(c={from:c.from,to:f,level:c.level}),c}var gr;function Wr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(gr==null){gr=v("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)gr.appendChild(document.createTextNode("x")),gr.appendChild(v("br"));gr.appendChild(document.createTextNode("x"))}Y(e.measure,gr);var n=gr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),D(e.measure),n||1}function Ir(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=v("span","xxxxxxxxxx"),n=v("pre",[t],"CodeMirror-line-like");Y(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Pi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:Wi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Wi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ra(e){var t=Wr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ir(e.display)-3);return function(i){if(rr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(f=$(e.doc,s.line).text).length==s.ch){var c=ve(f,f.length,e.options.tabSize)-f.length;s=S(s.line,Math.max(0,Math.round((o-_o(e.display).left)/Ir(e.display))-c))}return s}function mr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ut&&Si(e.doc,t)i.viewFrom?ir(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ir(e);else if(t<=i.viewFrom){var o=Yn(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):ir(e)}else if(n>=i.viewTo){var a=Yn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):ir(e)}else{var l=Yn(e,t,t,-1),s=Yn(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Kn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):ir(e)}var f=i.externalMeasured;f&&(n=i.lineN&&t=r.viewTo)){var o=r.view[mr(e,t)];if(o.node!=null){var a=o.changes||(o.changes=[]);le(a,n)==-1&&a.push(n)}}}function ir(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Yn(e,t,n,r){var i=mr(e,t),o,a=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(i==a.length-1)return null;o=l+a[i].size-t,i++}else o=l-t;t+=o,n+=o}for(;Si(e.doc,n)!=n;){if(i==(r<0?0:a.length-1))return null;n+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function _s(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Kn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Kn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,mr(e,n)))),r.viewTo=n}function na(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(v("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Zn(e,t){return e.top-t.top||e.left-t.left}function Ks(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=_o(e.display),l=a.left,s=Math.max(r.sizerWidth,vr(e)-r.sizer.offsetLeft)-a.right,f=i.direction=="ltr";function c(U,Z,re,ee){Z<0&&(Z=0),Z=Math.round(Z),ee=Math.round(ee),o.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px; +`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},er=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},In=function(){var e=v("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),wt=null;function bi(e){if(wt!=null)return wt;var t=Y(e,v("span","x")),n=t.getBoundingClientRect(),r=_e(t,0,1).getBoundingClientRect();return wt=Math.abs(n.left-r.left)>1}var Mr={},kt={};function Ct(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mr[e]=t}function pr(e,t){kt[e]=t}function Ar(e){if(typeof e=="string"&&kt.hasOwnProperty(e))e=kt[e];else if(e&&typeof e.name=="string"&&kt.hasOwnProperty(e.name)){var t=kt[e.name];typeof t=="string"&&(t={name:t}),e=Hn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ar("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ar("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Or(e,t){t=Ar(t);var n=Mr[t.name];if(!n)return Or(e,"text/plain");var r=n(e,t);if(tr.hasOwnProperty(t.name)){var i=tr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var tr={};function Dr(e,t){var n=tr.hasOwnProperty(e)?tr[e]:tr[e]={};fe(t,n)}function Nt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function rn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Fr(e,t,n){return e.startState?e.startState(t,n):!0}var Le=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Le.prototype.eol=function(){return this.pos>=this.string.length},Le.prototype.sol=function(){return this.pos==this.lineStart},Le.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Le.prototype.next=function(){if(this.post},Le.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Le.prototype.skipToEnd=function(){this.pos=this.string.length},Le.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Le.prototype.backUp=function(e){this.pos-=e},Le.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Le.prototype.current=function(){return this.string.slice(this.start,this.pos)},Le.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Le.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Le.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function $(e,t){if(t-=e.first,t<0||t>=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&&tn?S(n,$(e,n).text.length):is(t,$(e,t.line).text.length)}function is(e,t){var n=e.ch;return n==null||n>t?S(e.line,t):n<0?S(e.line,0):e}function mo(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Ht.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}},Ht.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ht.fromSaved=function(e,t,n){return t instanceof Bn?new Ht(e,Nt(e.mode,t.state),n,t.lookAhead):new Ht(e,Nt(e.mode,t),n)},Ht.prototype.save=function(e){var t=e!==!1?Nt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Bn(t,this.maxLookAhead):t};function bo(e,t,n,r){var i=[e.state.modeGen],o={};Lo(e,t.text,e.doc.mode,n,function(f,c){return i.push(f,c)},o,r);for(var a=n.state,l=function(f){n.baseTokens=i;var c=e.state.overlays[f],d=1,b=0;n.state=!0,Lo(e,t.text,c.mode,n,function(m,M){for(var F=d;bm&&i.splice(d,1,m,i[d+1],z),d+=2,b=Math.min(m,z)}if(M)if(c.opaque)i.splice(F,d-F,m,"overlay "+M),d=F+2;else for(;Fe.options.maxHighlightLength&&Nt(e.doc.mode,r.state),o=bo(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))}return t.styles}function on(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Ht(r,!0,t);var o=os(e,t,n),a=o>r.first&&$(r,o-1).stateAfter,l=a?Ht.fromSaved(r,a,o):new Ht(r,Fr(r.mode),o);return r.iter(o,t,function(s){xi(e,s.text,l);var f=l.line;s.stateAfter=f==t-1||f%5==0||f>=i.viewFrom&&ft.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var ko=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Co(e,t,n,r){var i=e.doc,o=i.mode,a;t=ie(i,t);var l=$(i,t.line),s=on(e,t.line,n),f=new Le(l.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&xi(e,t,r,c.pos),c.pos=t.length,d=null):d=So(wi(n,c,r.state,b),o),b){var m=b[0].name;m&&(d="m-"+(d?m+" "+d:m))}if(!l||f!=d){for(;sa;--l){if(l<=o.first)return o.first;var s=$(o,l-1),f=s.stateAfter;if(f&&(!n||l+(f instanceof Bn?f.lookAhead:0)<=o.modeFrontier))return l;var c=ve(s.text,null,e.options.tabSize);(i==null||r>c)&&(i=l-1,r=c)}return i}function as(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=$(e,r).stateAfter;if(i&&(!(i instanceof Bn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new zn(a,o.from,s?null:o.to))}}return r}function hs(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var Z=0;Z0)){var c=[s,1],d=K(f.from,l.from),b=K(f.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:f.from,to:l.from}),(b>0||!a.inclusiveRight&&!b)&&c.push({from:l.to,to:f.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Ao(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||Ci(r,o.marker)<0)&&(r=o.marker)}return r}function No(e,t,n,r,i){var o=$(e,t),a=Ut&&o.markedSpans;if(a)for(var l=0;l=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.to,n)>=0:K(f.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?K(f.from,r)<=0:K(f.from,r)<0)))return!0}}}function St(e){for(var t;t=Fo(e);)e=t.find(-1,!0).line;return e}function vs(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function gs(e){for(var t,n;t=Un(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Si(e,t){var n=$(e,t),r=St(n);return n==r?t:u(r)}function Ho(e,t){if(t>e.lastLine())return t;var n=$(e,t),r;if(!rr(e,n))return t;for(;r=Un(n);)n=r.find(1,!0).line;return u(n)+1}function rr(e,t){var n=Ut&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Oo(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return u(this)},bt(Hr);function ys(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ao(e),Oo(e,n);var i=r?r(e):1;i!=e.height&&pt(e,i)}function ms(e){e.parent=null,Ao(e)}var bs={},xs={};function Po(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xs:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Wo(e,t){var n=Ye("span",null,null,w?"padding-right: .1px":null),r={pre:Ye("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=ks,$t(e.display.measure)&&(a=ue(o,e.doc.direction))&&(r.addToken=Ss(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&u(o);Ls(o,r,xo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=Pe(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=Pe(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(En(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(w){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Pe(r.pre.className,r.textClass||"")),r}function ws(e){var t=v("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ks(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?Cs(t,e.trailingSpace):t,s=e.cm.state.specialChars,f=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,c),C&&N<9&&(f=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var d=0;;){s.lastIndex=d;var b=s.exec(t),m=b?b.index-d:t.length-d;if(m){var M=document.createTextNode(l.slice(d,d+m));C&&N<9?c.appendChild(v("span",[M])):c.appendChild(M),e.map.push(e.pos,e.pos+m,M),e.col+=m,e.pos+=m}if(!b)break;d+=m+1;var F=void 0;if(b[0]==" "){var z=e.cm.options.tabSize,G=z-e.col%z;F=c.appendChild(v("span",Vr(G),"cm-tab")),F.setAttribute("role","presentation"),F.setAttribute("cm-text"," "),e.col+=G}else b[0]=="\r"||b[0]==` +`?(F=c.appendChild(v("span",b[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),F.setAttribute("cm-text",b[0]),e.col+=1):(F=e.cm.options.specialCharPlaceholder(b[0]),F.setAttribute("cm-text",b[0]),C&&N<9?c.appendChild(v("span",[F])):c.appendChild(F),e.col+=1);e.map.push(e.pos,e.pos+1,F),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||f||o||a){var q=n||"";r&&(q+=r),i&&(q+=i);var U=v("span",[c],q,o);if(a)for(var Z in a)a.hasOwnProperty(Z)&&Z!="style"&&Z!="class"&&U.setAttribute(Z,a[Z]);return e.content.appendChild(U)}e.content.appendChild(c)}}function Cs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;if&&d.from<=f));b++);if(d.to>=c)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-f),i,o,null,l,s),o=null,r=r.slice(d.to-f),f=d.to}}}function Eo(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;as||se.collapsed&&ee.to==s&&ee.from==s)){if(ee.to!=null&&ee.to!=s&&m>ee.to&&(m=ee.to,F=""),se.className&&(M+=" "+se.className),se.css&&(b=(b?b+";":"")+se.css),se.startStyle&&ee.from==s&&(z+=" "+se.startStyle),se.endStyle&&ee.to==m&&(Z||(Z=[])).push(se.endStyle,ee.to),se.title&&((q||(q={})).title=se.title),se.attributes)for(var ye in se.attributes)(q||(q={}))[ye]=se.attributes[ye];se.collapsed&&(!G||Ci(G.marker,se)<0)&&(G=ee)}else ee.from>s&&m>ee.from&&(m=ee.from)}if(Z)for(var Re=0;Re=l)break;for(var ut=Math.min(l,m);;){if(c){var nt=s+c.length;if(!G){var De=nt>ut?c.slice(0,ut-s):c;t.addToken(t,De,d?d+M:M,z,s+De.length==m?F:"",b,q)}if(nt>=ut){c=c.slice(ut-s),s=ut;break}s=nt,z=""}c=i.slice(o,o=n[f++]),d=Po(n[f++],t.cm.options)}}}function Io(e,t,n){this.line=t,this.rest=gs(t),this.size=this.rest?u(ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Kn(e,t,n){for(var r=[],i,o=t;o2&&o.push((s.bottom+f.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ko(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Es(e,t){t=St(t);var n=u(t),r=e.display.externalMeasured=new Io(e.doc,t,n);r.lineN=n;var i=r.built=Wo(e,r);return r.text=i.pre,Y(e.display.lineMeasure,i.pre),r}function qo(e,t,n,r){return Wt(e,Wr(e,t),n,r)}function Di(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[f+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;f&&e[f-2]==e[f-3]&&e[f-1].insertLeft;)r=e[(f-=3)+2],a="left";if(n=="right"&&i==s-l)for(;f=0&&(n=e[i]).left==n.right;i--);return n}function Bs(e,t,n,r){var i=jo(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,f;if(o.nodeType==3){for(var c=0;c<4;c++){for(;a&&Oe(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l0&&(s=r="right");var d;e.options.lineWrapping&&(d=o.getClientRects()).length>1?f=d[r=="right"?d.length-1:0]:f=o.getBoundingClientRect()}if(C&&N<9&&!a&&(!f||!f.left&&!f.right)){var b=o.parentNode.getClientRects()[0];b?f={left:b.left,right:b.left+Ir(e.display),top:b.top,bottom:b.bottom}:f=Xo}for(var m=f.top-t.rect.top,M=f.bottom-t.rect.top,F=(m+M)/2,z=t.view.measure.heights,G=0;G=r.text.length?(s=r.text.length,f="before"):s<=0&&(s=0,f="after"),!l)return a(f=="before"?s-1:s,f=="before");function c(M,F,z){var G=l[F],q=G.level==1;return a(z?M-1:M,q!=z)}var d=Qt(l,s,f),b=dr,m=c(s,d,f=="before");return b!=null&&(m.other=c(s,b,f!="before")),m}function $o(e,t){var n=0;t=ie(e.doc,t),e.options.lineWrapping||(n=Ir(e.display)*t.ch);var r=$(e.doc,t.line),i=_t(r)+qn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Ni(e,t,n,r,i){var o=S(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Hi(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Ni(r.first,0,null,-1,-1);var i=h(r,n),o=r.first+r.size-1;if(i>o)return Ni(r.first+r.size-1,$(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=$(r,i);;){var l=Rs(e,a,i,t,n),s=ps(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var f=s.find(1);if(f.line==i)return f;a=$(r,i=f.line)}}function ea(e,t,n,r){r-=Fi(t);var i=t.text.length,o=Ft(function(a){return Wt(e,n,a-1).bottom<=r},i,0);return i=Ft(function(a){return Wt(e,n,a).top>r},o,i),{begin:o,end:i}}function ta(e,t,n,r){n||(n=Wr(e,t));var i=Xn(e,t,Wt(e,n,r),"line").top;return ea(e,t,n,i)}function Pi(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Rs(e,t,n,r,i){i-=_t(t);var o=Wr(e,t),a=Fi(t),l=0,s=t.text.length,f=!0,c=ue(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?Us:Gs)(e,t,n,o,c,r,i);f=d.level!=1,l=f?d.from:d.to-1,s=f?d.to:d.from-1}var b=null,m=null,M=Ft(function(re){var ee=Wt(e,o,re);return ee.top+=a,ee.bottom+=a,Pi(ee,r,i,!1)?(ee.top<=i&&ee.left<=r&&(b=re,m=ee),!0):!1},l,s),F,z,G=!1;if(m){var q=r-m.left=Z.bottom?1:0}return M=Zt(t.text,M,1),Ni(n,M,z,G,r-F)}function Gs(e,t,n,r,i,o,a){var l=Ft(function(d){var b=i[d],m=b.level!=1;return Pi(Lt(e,S(n,m?b.to:b.from,m?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var f=s.level!=1,c=Lt(e,S(n,f?s.from:s.to,f?"after":"before"),"line",t,r);Pi(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function Us(e,t,n,r,i,o,a){var l=ea(e,t,r,a),s=l.begin,f=l.end;/\s/.test(t.text.charAt(f-1))&&f--;for(var c=null,d=null,b=0;b=f||m.to<=s)){var M=m.level!=1,F=Wt(e,r,M?Math.min(f,m.to)-1:Math.max(s,m.from)).right,z=Fz)&&(c=m,d=z)}}return c||(c=i[i.length-1]),c.fromf&&(c={from:c.from,to:f,level:c.level}),c}var gr;function Er(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(gr==null){gr=v("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)gr.appendChild(document.createTextNode("x")),gr.appendChild(v("br"));gr.appendChild(document.createTextNode("x"))}Y(e.measure,gr);var n=gr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),D(e.measure),n||1}function Ir(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=v("span","xxxxxxxxxx"),n=v("pre",[t],"CodeMirror-line-like");Y(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Wi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:Ei(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ei(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ra(e){var t=Er(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ir(e.display)-3);return function(i){if(rr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(f=$(e.doc,s.line).text).length==s.ch){var c=ve(f,f.length,e.options.tabSize)-f.length;s=S(s.line,Math.max(0,Math.round((o-_o(e.display).left)/Ir(e.display))-c))}return s}function mr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ut&&Si(e.doc,t)i.viewFrom?ir(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ir(e);else if(t<=i.viewFrom){var o=Yn(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):ir(e)}else if(n>=i.viewTo){var a=Yn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):ir(e)}else{var l=Yn(e,t,t,-1),s=Yn(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Kn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):ir(e)}var f=i.externalMeasured;f&&(n=i.lineN&&t=r.viewTo)){var o=r.view[mr(e,t)];if(o.node!=null){var a=o.changes||(o.changes=[]);le(a,n)==-1&&a.push(n)}}}function ir(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Yn(e,t,n,r){var i=mr(e,t),o,a=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(i==a.length-1)return null;o=l+a[i].size-t,i++}else o=l-t;t+=o,n+=o}for(;Si(e.doc,n)!=n;){if(i==(r<0?0:a.length-1))return null;n+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function _s(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Kn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Kn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,mr(e,n)))),r.viewTo=n}function na(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(v("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Zn(e,t){return e.top-t.top||e.left-t.left}function Ks(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=_o(e.display),l=a.left,s=Math.max(r.sizerWidth,vr(e)-r.sizer.offsetLeft)-a.right,f=i.direction=="ltr";function c(U,Z,re,ee){Z<0&&(Z=0),Z=Math.round(Z),ee=Math.round(ee),o.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px; top: `+Z+"px; width: "+(re??s-U)+`px; - height: `+(ee-Z)+"px"))}function d(U,Z,re){var ee=$(i,U),se=ee.text.length,ye,Re;function xe(De,it){return jn(e,S(U,De),"div",ee,it)}function ut(De,it,Ue){var Ne=ta(e,ee,null,De),Fe=it=="ltr"==(Ue=="after")?"left":"right",Te=Ue=="after"?Ne.begin:Ne.end-(/\s/.test(ee.text.charAt(Ne.end-1))?2:1);return xe(Te,Fe)[Fe]}var nt=ue(ee,i.direction);return Jt(nt,Z||0,re??se,function(De,it,Ue,Ne){var Fe=Ue=="ltr",Te=xe(De,Fe?"left":"right"),ot=xe(it-1,Fe?"right":"left"),Jr=Z==null&&De==0,ur=re==null&&it==se,je=Ne==0,Wt=!nt||Ne==nt.length-1;if(ot.top-Te.top<=3){var Ge=(f?Jr:ur)&&je,co=(f?ur:Jr)&&Wt,jt=Ge?l:(Fe?Te:ot).left,kr=co?s:(Fe?ot:Te).right;c(jt,Te.top,kr-jt,Te.bottom)}else{var Sr,Qe,Qr,ho;Fe?(Sr=f&&Jr&&je?l:Te.left,Qe=f?s:ut(De,Ue,"before"),Qr=f?l:ut(it,Ue,"after"),ho=f&&ur&&Wt?s:ot.right):(Sr=f?ut(De,Ue,"before"):l,Qe=!f&&Jr&&je?s:Te.right,Qr=!f&&ur&&Wt?l:ot.left,ho=f?ut(it,Ue,"after"):s),c(Sr,Te.top,Qe-Sr,Te.bottom),Te.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Br(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function oa(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Gi(e))}function Ri(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Br(e))},100)}function Gi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(ke(e,"focus",e,t),e.state.focused=!0,Ce(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),w&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),zi(e))}function Br(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ke(e,"blur",e,t),e.state.focused=!1,we(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Jn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,a=0;a.005||m<-.005)&&(ie.display.sizerWidth){var F=Math.ceil(c/Ir(e.display));F>e.display.maxLineLength&&(e.display.maxLineLength=F,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function aa(e){if(e.widgets)for(var t=0;t=a&&(o=h(t,_t($(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function qs(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!y){var a=v("div","\u200B",null,`position: absolute; + height: `+(ee-Z)+"px"))}function d(U,Z,re){var ee=$(i,U),se=ee.text.length,ye,Re;function xe(De,it){return jn(e,S(U,De),"div",ee,it)}function ut(De,it,Ue){var Ne=ta(e,ee,null,De),Fe=it=="ltr"==(Ue=="after")?"left":"right",Te=Ue=="after"?Ne.begin:Ne.end-(/\s/.test(ee.text.charAt(Ne.end-1))?2:1);return xe(Te,Fe)[Fe]}var nt=ue(ee,i.direction);return Jt(nt,Z||0,re??se,function(De,it,Ue,Ne){var Fe=Ue=="ltr",Te=xe(De,Fe?"left":"right"),ot=xe(it-1,Fe?"right":"left"),Jr=Z==null&&De==0,ur=re==null&&it==se,je=Ne==0,Et=!nt||Ne==nt.length-1;if(ot.top-Te.top<=3){var Ge=(f?Jr:ur)&&je,co=(f?ur:Jr)&&Et,jt=Ge?l:(Fe?Te:ot).left,Cr=co?s:(Fe?ot:Te).right;c(jt,Te.top,Cr-jt,Te.bottom)}else{var Sr,Qe,Qr,ho;Fe?(Sr=f&&Jr&&je?l:Te.left,Qe=f?s:ut(De,Ue,"before"),Qr=f?l:ut(it,Ue,"after"),ho=f&&ur&&Et?s:ot.right):(Sr=f?ut(De,Ue,"before"):l,Qe=!f&&Jr&&je?s:Te.right,Qr=!f&&ur&&Et?l:ot.left,ho=f?ut(it,Ue,"after"):s),c(Sr,Te.top,Qe-Sr,Te.bottom),Te.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Br(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function oa(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Gi(e))}function Ri(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Br(e))},100)}function Gi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,ke(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),w&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),zi(e))}function Br(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,we(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Jn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,a=0;a.005||m<-.005)&&(ie.display.sizerWidth){var F=Math.ceil(c/Ir(e.display));F>e.display.maxLineLength&&(e.display.maxLineLength=F,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function aa(e){if(e.widgets)for(var t=0;t=a&&(o=h(t,_t($(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function qs(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!y){var a=v("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-qn(e.display))+`px; - height: `+(t.bottom-t.top+Ht(e)+n.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function Xs(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?S(t.line,t.ch+1,"before"):t,t=t.ch?S(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=Lt(e,t),s=!n||n==t?l:Lt(e,n);i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r};var f=Ui(e,i),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(f.scrollTop!=null&&(dn(e,f.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),f.scrollLeft!=null&&(br(e,f.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function js(e,t){var n=Ui(e,t);n.scrollTop!=null&&dn(e,n.scrollTop),n.scrollLeft!=null&&br(e,n.scrollLeft)}function Ui(e,t){var n=e.display,r=Wr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Oi(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ai(n),s=t.topl-r;if(t.topi+o){var c=Math.min(t.top,(f?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var d=e.options.fixedGutter?0:n.gutters.offsetWidth,b=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-d,m=vr(e)-n.gutters.offsetWidth,M=t.right-t.left>m;return M&&(t.right=t.left+m),t.left<10?a.scrollLeft=0:t.leftm+b-3&&(a.scrollLeft=t.right+(M?0:10)-m),a}function _i(e,t){t!=null&&(Vn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zr(e){Vn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hn(e,t,n){(t!=null||n!=null)&&Vn(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Ys(e,t){Vn(e),e.curOp.scrollToPos=t}function Vn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=$o(e,t.from),r=$o(e,t.to);la(e,n,r,t.margin)}}function la(e,t,n,r){var i=Ui(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});hn(e,i.scrollLeft,i.scrollTop)}function dn(e,t){Math.abs(e.doc.scrollTop-t)<2||(P||qi(e,{top:t}),sa(e,t,!0),P&&qi(e),gn(e,100))}function sa(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 br(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,da(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ai(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+Ht(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var r=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=v("div",[v("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,k&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=E&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new At,this.disableVert=new At},xr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vn=function(){};vn.prototype.update=function(){return{bottom:0,right:0}},vn.prototype.setScrollLeft=function(){},vn.prototype.setScrollTop=function(){},vn.prototype.clear=function(){};function Rr(e,t){t||(t=pn(e));var n=e.display.barWidth,r=e.display.barHeight;fa(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Jn(e),fa(e,pn(e)),n=e.display.barWidth,r=e.display.barHeight}function fa(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var ua={native:xr,null:vn};function ca(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&we(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ua[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?br(e,t):dn(e,t)},e),e.display.scrollbars.addClass&&Ce(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function wr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs,markArrays:null},Ts(e.curOp)}function Cr(e){var t=e.curOp;t&&As(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Vs(e){e.updatedDisplay=e.mustUpdate&&Ki(e.cm,e.update)}function $s(e){var t=e.cm,n=t.display;e.updatedDisplay&&Jn(t),e.barMeasure=pn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=qo(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ht(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ef(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=on(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Nt(t.mode,r.state):null,s=bo(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var f=o.styleClasses,c=s.classes;c?o.styleClasses=c:f&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||f!=c&&(!f||!c||f.bgClass!=c.bgClass||f.textClass!=c.textClass),b=0;!d&&bn)return gn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ft(e,function(){for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&na(e)==0)return!1;pa(e)&&(ir(e),t.dims=Pi(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Ut&&(o=Si(e.doc,o),a=Eo(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;_s(e,o,a),n.viewOffset=_t($(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=na(e);if(!l&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=of(e);return s>4&&(n.lineDiv.style.display="none"),lf(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,af(f),D(n.cursorDiv),D(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,gn(e,400)),n.updateLineNumbers=null,!0}function ha(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==vr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ai(e.display)-Oi(e),n.top)}),t.visible=Qn(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Qn(e.display,e.doc,n));if(!Ki(e,t))break;Jn(e);var i=pn(e);cn(e),Rr(e,i),ji(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 qi(e,t){var n=new $n(e,t);if(Ki(e,n)){Jn(e),ha(e,n);var r=pn(e);cn(e),Rr(e,r),ji(e,r),n.finish()}}function lf(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(M){var F=M.nextSibling;return w&&E&&e.display.currentWheelTarget==M?M.style.display="none":M.parentNode.removeChild(M),F}for(var s=r.view,f=r.viewFrom,c=0;c-1&&(m=!1),Bo(e,d,f,n)),m&&(D(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(B(e.options,f)))),a=d.node.nextSibling}f+=d.size}for(;a;)a=l(a)}function Xi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Ie(e,"gutterChanged",e)}function ji(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+Ht(e)+"px"}function da(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Wi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),k&&N<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!w&&!(P&&A)&&(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,i.gutterSpecs=Yi(r.gutters,r.lineNumbers),va(i),n.init(i)}var ei=0,qt=null;k?qt=-.53:P?qt=15:L?qt=-.7:j&&(qt=-1/3);function ga(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function ff(e){var t=ga(e);return t.x*=qt,t.y*=qt,t}function ya(e,t){L&&I==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=ga(t),r=n.x,i=n.y,o=qt;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var a=e.display,l=a.scroller,s=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight;if(r&&s||i&&f){if(i&&E&&w){e:for(var c=t.target,d=a.view;c!=l;c=c.parentNode)for(var b=0;b=0&&K(e,r.to())<=0)return n}return-1};var de=function(e,t){this.anchor=e,this.head=t};de.prototype.from=function(){return Nr(this.anchor,this.head)},de.prototype.to=function(){return et(this.anchor,this.head)},de.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(b,m){return K(b.from(),m.from())}),n=le(t,i);for(var o=1;o0:s>=0){var f=Nr(l.from(),a.from()),c=et(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new de(d?c:f,d?f:c))}}return new vt(t,n)}function or(e,t){return new vt([new de(e,t||e)],0)}function ar(e){return e.text?S(e.from.line+e.text.length-1,ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ma(e,t){if(K(e,t.from)<0)return e;if(K(e,t.to)<=0)return ar(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ar(t).ch-t.to.ch),S(n,r)}function Zi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,M-1),e.insert(l.line+1,G)}Ie(e,"change",e,t)}function lr(e,t,n){function r(i,o,a){if(i.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ce(e.done)}function Sa(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,a,l;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=hf(i,i.lastOp==r)))l=ce(a.changes),K(t.from,t.to)==0&&K(t.from,l.to)==0?l.to=ar(t):a.changes.push(Vi(e,t));else{var s=ce(i.done);for((!s||!s.ranges)&&ri(e.sel,i.done),a={changes:[Vi(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||ke(e,"historyAdded")}function df(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pf(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||df(e,o,ce(i.done),t))?i.done[i.done.length-1]=t:ri(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ka(i.undone)}function ri(e,t){var n=ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function La(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=a.markedSpans),++o})}function vf(e){if(!e)return null;for(var t,n=0;n-1&&(ce(l)[d]=f[d],delete f[d])}}return r}function $i(e,t,n,r){if(r){var i=e.anchor;if(n){var o=K(t,i)<0;o!=K(n,i)<0?(i=t,t=n):o!=K(t,n)<0&&(t=n)}return new de(i,t)}else return new de(n||t,t)}function ni(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xe(e,new vt([$i(e.sel.primary(),t,n,i)],0),r)}function Ma(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(ke(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),b=void 0;if((r<0?c:f)&&(d=Ea(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(b=K(d,n))&&(r<0?b<0:b>0))return Ur(e,d,t,r,i)}var m=s.find(r<0?-1:1);return(r<0?f:c)&&(m=Ea(e,m,r,m.line==t.line?o:null)),m?Ur(e,m,t,r,i):null}}return t}function oi(e,t,n,r,i){var o=r||1,a=Ur(e,t,n,o,i)||!i&&Ur(e,t,n,o,!0)||Ur(e,t,n,-o,i)||!i&&Ur(e,t,n,-o,!0);return a||(e.cantEdit=!0,S(e.first,0))}function Ea(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ie(e,S(t.line-1)):null:n>0&&t.ch==(r||$(e,t.line)).text.length?t.line=0;--i)Wa(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Wa(e,t)}}function Wa(e,t){if(!(t.text.length==1&&t.text[0]==""&&K(t.from,t.to)==0)){var n=Zi(e,t);Sa(e,t,n,e.cm?e.cm.curOp.id:NaN),bn(e,t,n,Ci(e,t));var r=[];lr(e,function(i,o){!o&&le(r,i.history)==-1&&(Ra(i.history,t),r.push(i.history)),bn(i,t,null,Ci(i,t))})}}function ai(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,a=e.sel,l=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,f=0;f=0;--m){var M=b(m);if(M)return M.v}}}}function Ia(e,t){if(t!=0&&(e.first+=t,e.sel=new vt(hr(e.sel.ranges,function(i){return new de(S(i.anchor.line+t,i.anchor.ch),S(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){tt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:S(o,$(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gt(e,t.from,t.to),n||(n=Zi(e,t)),e.cm?mf(e.cm,t,r):Qi(e,t,r),ii(e,n,ht),e.cantEdit&&oi(e,S(e.firstLine(),0))&&(e.cantEdit=!1)}}function mf(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=u(St($(r,o.line))),r.iter(s,a.line+1,function(m){if(m==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&>(e),Qi(r,t,n,ra(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(m){var M=_n(m);M>i.maxLineLength&&(i.maxLine=m,i.maxLineLength=M,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),as(r,o.line),gn(e,400);var f=t.text.length-(a.line-o.line)-1;t.full?tt(e):o.line==a.line&&t.text.length==1&&!xa(e.doc,t)?nr(e,o.line,"text"):tt(e,o.line,a.line+1,f);var c=st(e,"changes"),d=st(e,"change");if(d||c){var b={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&Ie(e,"change",e,b),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(b)}e.display.selForContextMenu=null}function Kr(e,t,n,r,i){var o;r||(r=n),K(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),_r(e,{from:n,to:r,text:t,origin:i})}function Ba(e,t,n,r){n1||!(this.children[0]instanceof wn))){var l=[];this.collapse(l),this.children=[new wn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=f,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Fa(e.doc)),e&&Ie(e,"markerCleared",e,this,r,i),t&&Cr(e),this.parent&&this.parent.clear()}},sr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||a==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Ye("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(No(e,t.line,t,n,o)||t.line!=n.line&&No(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ss()}o.addToHistory&&Sa(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,f;if(e.iter(l,n.line+1,function(d){s&&o.collapsed&&!s.options.lineWrapping&&St(d)==s.display.maxLine&&(f=!0),o.collapsed&&l!=t.line&&pt(d,0),us(d,new zn(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(d){rr(e,d)&&pt(d,0)}),o.clearOnEnter&&te(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(ls(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Ua,o.atomic=!0),s){if(f&&(s.curOp.updateMaxLine=!0),o.collapsed)tt(s,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)nr(s,c,"text");o.atomic&&Fa(s.doc),Ie(s,"markerAdded",s,o)}return o}var Sn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)_r(this,r[s]);l?Oa(this,l):this.cm&&zr(this.cm)}),undo:ze(function(){ai(this,"undo")}),redo:ze(function(){ai(this,"redo")}),undoSelection:ze(function(){ai(this,"undo",!0)}),redoSelection:ze(function(){ai(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ie(this,e),t=ie(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!n||n(s.marker))&&r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),ie(this,S(n,t))},indexFromPos:function(e){e=ie(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),ii(t.doc,or(n,n)),d)for(var b=0;b=0;l--)Kr(e.doc,"",r[l].from,r[l].to,"+delete");zr(e)})}function to(e,t,n){var r=Zt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function ro(e,t,n){var r=to(e,t.ch,n);return r==null?null:new S(t.line,r,n<0?"after":"before")}function no(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=ue(n,t.doc.direction);if(o){var a=i<0?ce(o):o[0],l=i<0==(a.level==1),s=l?"after":"before",f;if(a.level>0||t.doc.direction=="rtl"){var c=Pr(t,n);f=i<0?n.text.length-1:0;var d=Pt(t,c,f).top;f=Ft(function(b){return Pt(t,c,b).top==d},i<0==(a.level==1)?a.from:a.to-1,f),s=="before"&&(f=to(n,f,1))}else f=i<0?a.to:a.from;return new S(r,f,s)}}return new S(r,i<0?n.text.length:0,i<0?"before":"after")}function Nf(e,t,n,r){var i=ue(t,e.doc.direction);if(!i)return ro(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Qt(i,n.ch,n.sticky),a=i[o];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&b>=c.begin)){var m=d?"before":"after";return new S(n.line,b,m)}}var M=function(G,q,U){for(var Z=function(ye,Re){return Re?new S(n.line,l(ye,1),"before"):new S(n.line,ye,"after")};G>=0&&G0==(re.level!=1),se=ee?U.begin:l(U.end,-1);if(re.from<=se&&se0?c.end:l(c.begin,-1);return z!=null&&!(r>0&&z==t.text.length)&&(F=M(r>0?0:i.length-1,r,f(z)),F)?F:null}var Mn={selectAll:Ha,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return jr(e,function(t){if(t.empty()){var n=$(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new S(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),S(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=$(e.doc,i.line-1).text;a&&(i=new S(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),S(i.line-1,a.length-1),i,"+transpose"))}}n.push(new de(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ft(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&K(t,this.pos)==0&&n==this.button};var On,Dn;function zf(e,t){var n=+new Date;return Dn&&Dn.compare(n,e,t)?(On=Dn=null,"triple"):On&&On.compare(n,e,t)?(Dn=new oo(n,e,t),On=null,"double"):(On=new oo(n,e,t),Dn=null,"single")}function il(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Kt(n,e)){w||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!ao(t,e)){var r=yr(t,e),i=xt(e),o=r?zf(r,i):"single";oe(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Rf(t,i,r,o,e))&&(i==1?r?Uf(t,r,o,e):en(e)==n.scroller&&qe(e):i==2?(r&&ni(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(be?t.display.input.onContextMenu(e):Ri(t)))}}}function Rf(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,An(e,Za(o,i),i,function(a){if(typeof a=="string"&&(a=Mn[a]),!a)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=a(e,n)!=Yt}finally{e.state.suppressEdits=!1}return l})}function Gf(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=X?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=E?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(E?n.altKey:n.ctrlKey)),i}function Uf(e,t,n,r){k?setTimeout(ne(oa,e),0):e.curOp.focus=Ae(mt(e));var i=Gf(e,n,r),o=e.doc.sel,a;e.options.dragDrop&&mi&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(K((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(K(a.to(),t)>0||t.xRel<0)?_f(e,r,t,i):Kf(e,r,t,i)}function _f(e,t,n,r){var i=e.display,o=!1,a=Be(e,function(f){w&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ri(e)),Ke(i.wrapper.ownerDocument,"mouseup",a),Ke(i.wrapper.ownerDocument,"mousemove",l),Ke(i.scroller,"dragstart",s),Ke(i.scroller,"drop",a),o||(qe(f),r.addNew||ni(e.doc,n,null,null,r.extend),w&&!j||k&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),l=function(f){o=o||Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)>=10},s=function(){return o=!0};w&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,te(i.wrapper.ownerDocument,"mouseup",a),te(i.wrapper.ownerDocument,"mousemove",l),te(i.scroller,"dragstart",s),te(i.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function ol(e,t,n){if(n=="char")return new de(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new de(S(t.line,0),ie(e.doc,S(t.line+1,0)));var r=n(e,t);return new de(r.from,r.to)}function Kf(e,t,n,r){k&&Ri(e);var i=e.display,o=e.doc;qe(t);var a,l,s=o.sel,f=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),l>-1?a=f[l]:a=new de(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new de(n,n)),n=yr(e,t,!0,!0),l=-1;else{var c=ol(e,n,r.unit);r.extend?a=$i(a,c.anchor,c.head,r.extend):a=c}r.addNew?l==-1?(l=f.length,Xe(o,Tt(e,f.concat([a]),l),{scroll:!1,origin:"*mouse"})):f.length>1&&f[l].empty()&&r.unit=="char"&&!r.extend?(Xe(o,Tt(e,f.slice(0,l).concat(f.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):eo(o,l,a,Ot):(l=0,Xe(o,new vt([a],0),Ot),s=o.sel);var d=n;function b(U){if(K(d,U)!=0)if(d=U,r.unit=="rectangle"){for(var Z=[],re=e.options.tabSize,ee=ve($(o,n.line).text,n.ch,re),se=ve($(o,U.line).text,U.ch,re),ye=Math.min(ee,se),Re=Math.max(ee,se),xe=Math.min(n.line,U.line),ut=Math.min(e.lastLine(),Math.max(n.line,U.line));xe<=ut;xe++){var nt=$(o,xe).text,De=Dt(nt,ye,re);ye==Re?Z.push(new de(S(xe,De),S(xe,De))):nt.length>De&&Z.push(new de(S(xe,De),S(xe,Dt(nt,Re,re))))}Z.length||Z.push(new de(n,n)),Xe(o,Tt(e,s.ranges.slice(0,l).concat(Z),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var it=a,Ue=ol(e,U,r.unit),Ne=it.anchor,Fe;K(Ue.anchor,Ne)>0?(Fe=Ue.head,Ne=Nr(it.from(),Ue.anchor)):(Fe=Ue.anchor,Ne=et(it.to(),Ue.head));var Te=s.ranges.slice(0);Te[l]=qf(e,new de(ie(o,Ne),Fe)),Xe(o,Tt(e,Te,l),Ot)}}var m=i.wrapper.getBoundingClientRect(),M=0;function F(U){var Z=++M,re=yr(e,U,!0,r.unit=="rectangle");if(re)if(K(re,d)!=0){e.curOp.focus=Ae(mt(e)),b(re);var ee=Qn(i,o);(re.line>=ee.to||re.linem.bottom?20:0;se&&setTimeout(Be(e,function(){M==Z&&(i.scroller.scrollTop+=se,F(U))}),50)}}function z(U){e.state.selectingText=!1,M=1/0,U&&(qe(U),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",G),Ke(i.wrapper.ownerDocument,"mouseup",q),o.history.lastSelOrigin=null}var G=Be(e,function(U){U.buttons===0||!xt(U)?z(U):F(U)}),q=Be(e,z);e.state.selectingText=q,te(i.wrapper.ownerDocument,"mousemove",G),te(i.wrapper.ownerDocument,"mouseup",q)}function qf(e,t){var n=t.anchor,r=t.head,i=$(e.doc,n.line);if(K(n,r)==0&&n.sticky==r.sticky)return t;var o=ue(i);if(!o)return t;var a=Qt(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s=a+(l.from==n.ch==(l.level!=1)?0:1);if(s==0||s==o.length)return t;var f;if(r.line!=n.line)f=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=Qt(o,r.ch,r.sticky),d=c-a||(r.ch-n.ch)*(l.level==1?-1:1);c==s-1||c==s?f=d<0:f=d>0}var b=o[s+(f?-1:0)],m=f==(b.level==1),M=m?b.from:b.to,F=m?"after":"before";return n.ch==M&&n.sticky==F?t:new de(new S(n.line,M,F),r)}function al(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{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&qe(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!st(e,n))return $e(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var c=h(e.doc,o),d=e.display.gutterSpecs[s];return ke(e,n,e,c,d.className,t),$e(t)}}}function ao(e,t){return al(e,t,"gutterClick",!0)}function ll(e,t){Kt(e.display,t)||Xf(e,t)||Se(e,t,"contextmenu")||be||e.display.input.onContextMenu(t)}function Xf(e,t){return st(e,"gutterContextMenu")?al(e,t,"gutterContextMenu",!1):!1}function sl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),un(e)}var Yr={toString:function(){return"CodeMirror.Init"}},fl={},ui={};function jf(e){var t=e.optionHandlers;function n(r,i,o,a){e.defaults[r]=i,o&&(t[r]=a?function(l,s,f){f!=Yr&&o(l,s,f)}:o)}e.defineOption=n,e.Init=Yr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ji(r)},!0),n("indentUnit",2,Ji,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){mn(r),un(r),tt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],a=r.doc.first;r.doc.iter(function(s){for(var f=0;;){var c=s.text.indexOf(i,f);if(c==-1)break;f=c+i.length,o.push(S(a,c))}a++});for(var l=o.length-1;l>=0;l--)Kr(r.doc,i,o[l],S(o[l].line,o[l].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=Yr&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",A?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!V),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){sl(r),yn(r)},!0),n("keyMap","default",function(r,i,o){var a=si(i),l=o!=Yr&&si(o);l&&l.detach&&l.detach(r,a),a.attach&&a.attach(r,l||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zf,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Yi(i,r.options.lineNumbers),yn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Wi(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rr(r)},!0),n("scrollbarStyle","native",function(r){ca(r),Rr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Yi(r.options.gutters,i),yn(r)},!0),n("firstLineNumber",1,yn,!0),n("lineNumberFormatter",function(r){return r},yn,!0),n("showCursorWhenSelecting",!1,cn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Br(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Yf),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,cn,!0),n("singleCursorHeightPerLine",!0,cn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,mn,!0),n("addModeClass",!1,mn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,mn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Yf(e,t,n){var r=n&&n!=Yr;if(!t!=!r){var i=e.display.dragFunctions,o=t?te:Ke;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Zf(e){e.options.lineWrapping?(Ce(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(we(e.display.wrapper,"CodeMirror-wrap"),Ti(e)),Ii(e),tt(e),un(e),setTimeout(function(){return Rr(e)},100)}function me(e,t){var n=this;if(!(this instanceof me))return new me(e,t);this.options=t=t?fe(t):{},fe(fl,t,!1);var r=t.value;typeof r=="string"?r=new rt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new me.inputStyles[t.inputStyle](this),o=this.display=new sf(e,r,i,t);o.wrapper.CodeMirror=this,sl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ca(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 At,keySeq:null,specialChars:null},t.autofocus&&!A&&o.input.focus(),k&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jf(this),Mf(),wr(this),this.curOp.forceUpdate=!0,wa(this,r),t.autofocus&&!A||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Gi(n)},20):Br(this);for(var a in ui)ui.hasOwnProperty(a)&&ui[a](this,t[a],Yr);pa(this),t.finishInit&&t.finishInit(this);for(var l=0;l20*20}te(t.scroller,"touchstart",function(s){if(!Se(e,s)&&!o(s)&&!ao(e,s)){t.input.ensurePolled(),clearTimeout(n);var f=+new Date;t.activeTouch={start:f,moved:!1,prev:f-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(s){var f=t.activeTouch;if(f&&!Kt(t,s)&&f.left!=null&&!f.moved&&new Date-f.start<300){var c=e.coordsChar(t.activeTouch,"page"),d;!f.prev||a(f,f.prev)?d=new de(c,c):!f.prev.prev||a(f,f.prev.prev)?d=e.findWordAt(c):d=new de(S(c.line,0),ie(e.doc,S(c.line+1,0))),e.setSelection(d.anchor,d.head),e.focus(),qe(s)}i()}),te(t.scroller,"touchcancel",i),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(dn(e,t.scroller.scrollTop),br(e,t.scroller.scrollLeft,!0),ke(e,"scroll",e))}),te(t.scroller,"mousewheel",function(s){return ya(e,s)}),te(t.scroller,"DOMMouseScroll",function(s){return ya(e,s)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){Se(e,s)||Vt(s)},over:function(s){Se(e,s)||(Tf(e,s),Vt(s))},start:function(s){return Lf(e,s)},drop:Be(e,Sf),leave:function(s){Se(e,s)||qa(e)}};var l=t.input.getField();te(l,"keyup",function(s){return rl.call(e,s)}),te(l,"keydown",Be(e,tl)),te(l,"keypress",Be(e,nl)),te(l,"focus",function(s){return Gi(e,s)}),te(l,"blur",function(s){return Br(e,s)})}var lo=[];me.defineInitHook=function(e){return lo.push(e)};function Fn(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=on(e,t).state:n="prev");var a=e.options.tabSize,l=$(i,t),s=ve(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var f=l.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(l.text))c=0,n="not";else if(n=="smart"&&(c=i.mode.indent(o,l.text.slice(f.length),l.text),c==Yt||c>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?c=ve($(i,t-1).text,null,a):c=0:n=="add"?c=s+e.options.indentUnit:n=="subtract"?c=s-e.options.indentUnit:typeof n=="number"&&(c=s+n),c=Math.max(0,c);var d="",b=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)b+=a,d+=" ";if(ba,s=yt(t),f=null;if(l&&r.ranges.length>1)if(Mt&&Mt.text.join(` + height: `+(t.bottom-t.top+Pt(e)+n.barHeight)+`px; + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function Xs(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?S(t.line,t.ch+1,"before"):t,t=t.ch?S(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=Lt(e,t),s=!n||n==t?l:Lt(e,n);i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r};var f=Ui(e,i),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(f.scrollTop!=null&&(dn(e,f.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),f.scrollLeft!=null&&(br(e,f.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function js(e,t){var n=Ui(e,t);n.scrollTop!=null&&dn(e,n.scrollTop),n.scrollLeft!=null&&br(e,n.scrollLeft)}function Ui(e,t){var n=e.display,r=Er(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Oi(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ai(n),s=t.topl-r;if(t.topi+o){var c=Math.min(t.top,(f?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var d=e.options.fixedGutter?0:n.gutters.offsetWidth,b=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-d,m=vr(e)-n.gutters.offsetWidth,M=t.right-t.left>m;return M&&(t.right=t.left+m),t.left<10?a.scrollLeft=0:t.leftm+b-3&&(a.scrollLeft=t.right+(M?0:10)-m),a}function _i(e,t){t!=null&&(Vn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zr(e){Vn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hn(e,t,n){(t!=null||n!=null)&&Vn(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Ys(e,t){Vn(e),e.curOp.scrollToPos=t}function Vn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=$o(e,t.from),r=$o(e,t.to);la(e,n,r,t.margin)}}function la(e,t,n,r){var i=Ui(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});hn(e,i.scrollLeft,i.scrollTop)}function dn(e,t){Math.abs(e.doc.scrollTop-t)<2||(W||qi(e,{top:t}),sa(e,t,!0),W&&qi(e),gn(e,100))}function sa(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 br(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,da(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ai(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+Pt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var r=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=v("div",[v("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,C&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=H&&!k?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new At,this.disableVert=new At},xr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vn=function(){};vn.prototype.update=function(){return{bottom:0,right:0}},vn.prototype.setScrollLeft=function(){},vn.prototype.setScrollTop=function(){},vn.prototype.clear=function(){};function Rr(e,t){t||(t=pn(e));var n=e.display.barWidth,r=e.display.barHeight;fa(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Jn(e),fa(e,pn(e)),n=e.display.barWidth,r=e.display.barHeight}function fa(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var ua={native:xr,null:vn};function ca(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&we(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ua[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?br(e,t):dn(e,t)},e),e.display.scrollbars.addClass&&ke(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function wr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs,markArrays:null},Ts(e.curOp)}function kr(e){var t=e.curOp;t&&As(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Vs(e){e.updatedDisplay=e.mustUpdate&&Ki(e.cm,e.update)}function $s(e){var t=e.cm,n=t.display;e.updatedDisplay&&Jn(t),e.barMeasure=pn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=qo(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Pt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ef(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=on(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Nt(t.mode,r.state):null,s=bo(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var f=o.styleClasses,c=s.classes;c?o.styleClasses=c:f&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||f!=c&&(!f||!c||f.bgClass!=c.bgClass||f.textClass!=c.textClass),b=0;!d&&bn)return gn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ft(e,function(){for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&na(e)==0)return!1;pa(e)&&(ir(e),t.dims=Wi(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Ut&&(o=Si(e.doc,o),a=Ho(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;_s(e,o,a),n.viewOffset=_t($(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=na(e);if(!l&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=of(e);return s>4&&(n.lineDiv.style.display="none"),lf(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,af(f),D(n.cursorDiv),D(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,gn(e,400)),n.updateLineNumbers=null,!0}function ha(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==vr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ai(e.display)-Oi(e),n.top)}),t.visible=Qn(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Qn(e.display,e.doc,n));if(!Ki(e,t))break;Jn(e);var i=pn(e);cn(e),Rr(e,i),ji(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 qi(e,t){var n=new $n(e,t);if(Ki(e,n)){Jn(e),ha(e,n);var r=pn(e);cn(e),Rr(e,r),ji(e,r),n.finish()}}function lf(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(M){var F=M.nextSibling;return w&&H&&e.display.currentWheelTarget==M?M.style.display="none":M.parentNode.removeChild(M),F}for(var s=r.view,f=r.viewFrom,c=0;c-1&&(m=!1),Bo(e,d,f,n)),m&&(D(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(B(e.options,f)))),a=d.node.nextSibling}f+=d.size}for(;a;)a=l(a)}function Xi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Ie(e,"gutterChanged",e)}function ji(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+Pt(e)+"px"}function da(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ei(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),C&&N<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!w&&!(W&&A)&&(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,i.gutterSpecs=Yi(r.gutters,r.lineNumbers),va(i),n.init(i)}var ei=0,qt=null;C?qt=-.53:W?qt=15:L?qt=-.7:j&&(qt=-1/3);function ga(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function ff(e){var t=ga(e);return t.x*=qt,t.y*=qt,t}function ya(e,t){L&&I==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=ga(t),r=n.x,i=n.y,o=qt;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var a=e.display,l=a.scroller,s=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight;if(r&&s||i&&f){if(i&&H&&w){e:for(var c=t.target,d=a.view;c!=l;c=c.parentNode)for(var b=0;b=0&&K(e,r.to())<=0)return n}return-1};var de=function(e,t){this.anchor=e,this.head=t};de.prototype.from=function(){return Nr(this.anchor,this.head)},de.prototype.to=function(){return et(this.anchor,this.head)},de.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(b,m){return K(b.from(),m.from())}),n=le(t,i);for(var o=1;o0:s>=0){var f=Nr(l.from(),a.from()),c=et(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new de(d?c:f,d?f:c))}}return new vt(t,n)}function or(e,t){return new vt([new de(e,t||e)],0)}function ar(e){return e.text?S(e.from.line+e.text.length-1,ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ma(e,t){if(K(e,t.from)<0)return e;if(K(e,t.to)<=0)return ar(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ar(t).ch-t.to.ch),S(n,r)}function Zi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,M-1),e.insert(l.line+1,G)}Ie(e,"change",e,t)}function lr(e,t,n){function r(i,o,a){if(i.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ce(e.done)}function Sa(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,a,l;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=hf(i,i.lastOp==r)))l=ce(a.changes),K(t.from,t.to)==0&&K(t.from,l.to)==0?l.to=ar(t):a.changes.push(Vi(e,t));else{var s=ce(i.done);for((!s||!s.ranges)&&ri(e.sel,i.done),a={changes:[Vi(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Ce(e,"historyAdded")}function df(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pf(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||df(e,o,ce(i.done),t))?i.done[i.done.length-1]=t:ri(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ca(i.undone)}function ri(e,t){var n=ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function La(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=a.markedSpans),++o})}function vf(e){if(!e)return null;for(var t,n=0;n-1&&(ce(l)[d]=f[d],delete f[d])}}return r}function $i(e,t,n,r){if(r){var i=e.anchor;if(n){var o=K(t,i)<0;o!=K(n,i)<0?(i=t,t=n):o!=K(t,n)<0&&(t=n)}return new de(i,t)}else return new de(n||t,t)}function ni(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xe(e,new vt([$i(e.sel.primary(),t,n,i)],0),r)}function Ma(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),b=void 0;if((r<0?c:f)&&(d=Ha(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(b=K(d,n))&&(r<0?b<0:b>0))return Ur(e,d,t,r,i)}var m=s.find(r<0?-1:1);return(r<0?f:c)&&(m=Ha(e,m,r,m.line==t.line?o:null)),m?Ur(e,m,t,r,i):null}}return t}function oi(e,t,n,r,i){var o=r||1,a=Ur(e,t,n,o,i)||!i&&Ur(e,t,n,o,!0)||Ur(e,t,n,-o,i)||!i&&Ur(e,t,n,-o,!0);return a||(e.cantEdit=!0,S(e.first,0))}function Ha(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ie(e,S(t.line-1)):null:n>0&&t.ch==(r||$(e,t.line)).text.length?t.line=0;--i)Ea(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ea(e,t)}}function Ea(e,t){if(!(t.text.length==1&&t.text[0]==""&&K(t.from,t.to)==0)){var n=Zi(e,t);Sa(e,t,n,e.cm?e.cm.curOp.id:NaN),bn(e,t,n,ki(e,t));var r=[];lr(e,function(i,o){!o&&le(r,i.history)==-1&&(Ra(i.history,t),r.push(i.history)),bn(i,t,null,ki(i,t))})}}function ai(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,a=e.sel,l=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,f=0;f=0;--m){var M=b(m);if(M)return M.v}}}}function Ia(e,t){if(t!=0&&(e.first+=t,e.sel=new vt(hr(e.sel.ranges,function(i){return new de(S(i.anchor.line+t,i.anchor.ch),S(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){tt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:S(o,$(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gt(e,t.from,t.to),n||(n=Zi(e,t)),e.cm?mf(e.cm,t,r):Qi(e,t,r),ii(e,n,ht),e.cantEdit&&oi(e,S(e.firstLine(),0))&&(e.cantEdit=!1)}}function mf(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=u(St($(r,o.line))),r.iter(s,a.line+1,function(m){if(m==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&>(e),Qi(r,t,n,ra(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(m){var M=_n(m);M>i.maxLineLength&&(i.maxLine=m,i.maxLineLength=M,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),as(r,o.line),gn(e,400);var f=t.text.length-(a.line-o.line)-1;t.full?tt(e):o.line==a.line&&t.text.length==1&&!xa(e.doc,t)?nr(e,o.line,"text"):tt(e,o.line,a.line+1,f);var c=st(e,"changes"),d=st(e,"change");if(d||c){var b={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&Ie(e,"change",e,b),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(b)}e.display.selForContextMenu=null}function Kr(e,t,n,r,i){var o;r||(r=n),K(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),_r(e,{from:n,to:r,text:t,origin:i})}function Ba(e,t,n,r){n1||!(this.children[0]instanceof wn))){var l=[];this.collapse(l),this.children=[new wn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=f,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Fa(e.doc)),e&&Ie(e,"markerCleared",e,this,r,i),t&&kr(e),this.parent&&this.parent.clear()}},sr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||a==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Ye("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(No(e,t.line,t,n,o)||t.line!=n.line&&No(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ss()}o.addToHistory&&Sa(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,f;if(e.iter(l,n.line+1,function(d){s&&o.collapsed&&!s.options.lineWrapping&&St(d)==s.display.maxLine&&(f=!0),o.collapsed&&l!=t.line&&pt(d,0),us(d,new zn(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(d){rr(e,d)&&pt(d,0)}),o.clearOnEnter&&te(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(ls(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Ua,o.atomic=!0),s){if(f&&(s.curOp.updateMaxLine=!0),o.collapsed)tt(s,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)nr(s,c,"text");o.atomic&&Fa(s.doc),Ie(s,"markerAdded",s,o)}return o}var Sn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)_r(this,r[s]);l?Oa(this,l):this.cm&&zr(this.cm)}),undo:ze(function(){ai(this,"undo")}),redo:ze(function(){ai(this,"redo")}),undoSelection:ze(function(){ai(this,"undo",!0)}),redoSelection:ze(function(){ai(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ie(this,e),t=ie(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!n||n(s.marker))&&r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),ie(this,S(n,t))},indexFromPos:function(e){e=ie(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),ii(t.doc,or(n,n)),d)for(var b=0;b=0;l--)Kr(e.doc,"",r[l].from,r[l].to,"+delete");zr(e)})}function to(e,t,n){var r=Zt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function ro(e,t,n){var r=to(e,t.ch,n);return r==null?null:new S(t.line,r,n<0?"after":"before")}function no(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=ue(n,t.doc.direction);if(o){var a=i<0?ce(o):o[0],l=i<0==(a.level==1),s=l?"after":"before",f;if(a.level>0||t.doc.direction=="rtl"){var c=Wr(t,n);f=i<0?n.text.length-1:0;var d=Wt(t,c,f).top;f=Ft(function(b){return Wt(t,c,b).top==d},i<0==(a.level==1)?a.from:a.to-1,f),s=="before"&&(f=to(n,f,1))}else f=i<0?a.to:a.from;return new S(r,f,s)}}return new S(r,i<0?n.text.length:0,i<0?"before":"after")}function Nf(e,t,n,r){var i=ue(t,e.doc.direction);if(!i)return ro(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Qt(i,n.ch,n.sticky),a=i[o];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&b>=c.begin)){var m=d?"before":"after";return new S(n.line,b,m)}}var M=function(G,q,U){for(var Z=function(ye,Re){return Re?new S(n.line,l(ye,1),"before"):new S(n.line,ye,"after")};G>=0&&G0==(re.level!=1),se=ee?U.begin:l(U.end,-1);if(re.from<=se&&se0?c.end:l(c.begin,-1);return z!=null&&!(r>0&&z==t.text.length)&&(F=M(r>0?0:i.length-1,r,f(z)),F)?F:null}var Mn={selectAll:Pa,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return jr(e,function(t){if(t.empty()){var n=$(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new S(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),S(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=$(e.doc,i.line-1).text;a&&(i=new S(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),S(i.line-1,a.length-1),i,"+transpose"))}}n.push(new de(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ft(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&K(t,this.pos)==0&&n==this.button};var On,Dn;function zf(e,t){var n=+new Date;return Dn&&Dn.compare(n,e,t)?(On=Dn=null,"triple"):On&&On.compare(n,e,t)?(Dn=new oo(n,e,t),On=null,"double"):(On=new oo(n,e,t),Dn=null,"single")}function il(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Kt(n,e)){w||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!ao(t,e)){var r=yr(t,e),i=xt(e),o=r?zf(r,i):"single";oe(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Rf(t,i,r,o,e))&&(i==1?r?Uf(t,r,o,e):en(e)==n.scroller&&qe(e):i==2?(r&&ni(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(be?t.display.input.onContextMenu(e):Ri(t)))}}}function Rf(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,An(e,Za(o,i),i,function(a){if(typeof a=="string"&&(a=Mn[a]),!a)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=a(e,n)!=Yt}finally{e.state.suppressEdits=!1}return l})}function Gf(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=X?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=H?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(H?n.altKey:n.ctrlKey)),i}function Uf(e,t,n,r){C?setTimeout(ne(oa,e),0):e.curOp.focus=Ae(mt(e));var i=Gf(e,n,r),o=e.doc.sel,a;e.options.dragDrop&&mi&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(K((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(K(a.to(),t)>0||t.xRel<0)?_f(e,r,t,i):Kf(e,r,t,i)}function _f(e,t,n,r){var i=e.display,o=!1,a=Be(e,function(f){w&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ri(e)),Ke(i.wrapper.ownerDocument,"mouseup",a),Ke(i.wrapper.ownerDocument,"mousemove",l),Ke(i.scroller,"dragstart",s),Ke(i.scroller,"drop",a),o||(qe(f),r.addNew||ni(e.doc,n,null,null,r.extend),w&&!j||C&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),l=function(f){o=o||Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)>=10},s=function(){return o=!0};w&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,te(i.wrapper.ownerDocument,"mouseup",a),te(i.wrapper.ownerDocument,"mousemove",l),te(i.scroller,"dragstart",s),te(i.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function ol(e,t,n){if(n=="char")return new de(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new de(S(t.line,0),ie(e.doc,S(t.line+1,0)));var r=n(e,t);return new de(r.from,r.to)}function Kf(e,t,n,r){C&&Ri(e);var i=e.display,o=e.doc;qe(t);var a,l,s=o.sel,f=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),l>-1?a=f[l]:a=new de(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new de(n,n)),n=yr(e,t,!0,!0),l=-1;else{var c=ol(e,n,r.unit);r.extend?a=$i(a,c.anchor,c.head,r.extend):a=c}r.addNew?l==-1?(l=f.length,Xe(o,Tt(e,f.concat([a]),l),{scroll:!1,origin:"*mouse"})):f.length>1&&f[l].empty()&&r.unit=="char"&&!r.extend?(Xe(o,Tt(e,f.slice(0,l).concat(f.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):eo(o,l,a,Ot):(l=0,Xe(o,new vt([a],0),Ot),s=o.sel);var d=n;function b(U){if(K(d,U)!=0)if(d=U,r.unit=="rectangle"){for(var Z=[],re=e.options.tabSize,ee=ve($(o,n.line).text,n.ch,re),se=ve($(o,U.line).text,U.ch,re),ye=Math.min(ee,se),Re=Math.max(ee,se),xe=Math.min(n.line,U.line),ut=Math.min(e.lastLine(),Math.max(n.line,U.line));xe<=ut;xe++){var nt=$(o,xe).text,De=Dt(nt,ye,re);ye==Re?Z.push(new de(S(xe,De),S(xe,De))):nt.length>De&&Z.push(new de(S(xe,De),S(xe,Dt(nt,Re,re))))}Z.length||Z.push(new de(n,n)),Xe(o,Tt(e,s.ranges.slice(0,l).concat(Z),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var it=a,Ue=ol(e,U,r.unit),Ne=it.anchor,Fe;K(Ue.anchor,Ne)>0?(Fe=Ue.head,Ne=Nr(it.from(),Ue.anchor)):(Fe=Ue.anchor,Ne=et(it.to(),Ue.head));var Te=s.ranges.slice(0);Te[l]=qf(e,new de(ie(o,Ne),Fe)),Xe(o,Tt(e,Te,l),Ot)}}var m=i.wrapper.getBoundingClientRect(),M=0;function F(U){var Z=++M,re=yr(e,U,!0,r.unit=="rectangle");if(re)if(K(re,d)!=0){e.curOp.focus=Ae(mt(e)),b(re);var ee=Qn(i,o);(re.line>=ee.to||re.linem.bottom?20:0;se&&setTimeout(Be(e,function(){M==Z&&(i.scroller.scrollTop+=se,F(U))}),50)}}function z(U){e.state.selectingText=!1,M=1/0,U&&(qe(U),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",G),Ke(i.wrapper.ownerDocument,"mouseup",q),o.history.lastSelOrigin=null}var G=Be(e,function(U){U.buttons===0||!xt(U)?z(U):F(U)}),q=Be(e,z);e.state.selectingText=q,te(i.wrapper.ownerDocument,"mousemove",G),te(i.wrapper.ownerDocument,"mouseup",q)}function qf(e,t){var n=t.anchor,r=t.head,i=$(e.doc,n.line);if(K(n,r)==0&&n.sticky==r.sticky)return t;var o=ue(i);if(!o)return t;var a=Qt(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s=a+(l.from==n.ch==(l.level!=1)?0:1);if(s==0||s==o.length)return t;var f;if(r.line!=n.line)f=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=Qt(o,r.ch,r.sticky),d=c-a||(r.ch-n.ch)*(l.level==1?-1:1);c==s-1||c==s?f=d<0:f=d>0}var b=o[s+(f?-1:0)],m=f==(b.level==1),M=m?b.from:b.to,F=m?"after":"before";return n.ch==M&&n.sticky==F?t:new de(new S(n.line,M,F),r)}function al(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{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&qe(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!st(e,n))return $e(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var c=h(e.doc,o),d=e.display.gutterSpecs[s];return Ce(e,n,e,c,d.className,t),$e(t)}}}function ao(e,t){return al(e,t,"gutterClick",!0)}function ll(e,t){Kt(e.display,t)||Xf(e,t)||Se(e,t,"contextmenu")||be||e.display.input.onContextMenu(t)}function Xf(e,t){return st(e,"gutterContextMenu")?al(e,t,"gutterContextMenu",!1):!1}function sl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),un(e)}var Yr={toString:function(){return"CodeMirror.Init"}},fl={},ui={};function jf(e){var t=e.optionHandlers;function n(r,i,o,a){e.defaults[r]=i,o&&(t[r]=a?function(l,s,f){f!=Yr&&o(l,s,f)}:o)}e.defineOption=n,e.Init=Yr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ji(r)},!0),n("indentUnit",2,Ji,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){mn(r),un(r),tt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],a=r.doc.first;r.doc.iter(function(s){for(var f=0;;){var c=s.text.indexOf(i,f);if(c==-1)break;f=c+i.length,o.push(S(a,c))}a++});for(var l=o.length-1;l>=0;l--)Kr(r.doc,i,o[l],S(o[l].line,o[l].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=Yr&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",A?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!V),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){sl(r),yn(r)},!0),n("keyMap","default",function(r,i,o){var a=si(i),l=o!=Yr&&si(o);l&&l.detach&&l.detach(r,a),a.attach&&a.attach(r,l||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zf,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Yi(i,r.options.lineNumbers),yn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ei(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rr(r)},!0),n("scrollbarStyle","native",function(r){ca(r),Rr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Yi(r.options.gutters,i),yn(r)},!0),n("firstLineNumber",1,yn,!0),n("lineNumberFormatter",function(r){return r},yn,!0),n("showCursorWhenSelecting",!1,cn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Br(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Yf),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,cn,!0),n("singleCursorHeightPerLine",!0,cn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,mn,!0),n("addModeClass",!1,mn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,mn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Yf(e,t,n){var r=n&&n!=Yr;if(!t!=!r){var i=e.display.dragFunctions,o=t?te:Ke;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Zf(e){e.options.lineWrapping?(ke(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(we(e.display.wrapper,"CodeMirror-wrap"),Ti(e)),Ii(e),tt(e),un(e),setTimeout(function(){return Rr(e)},100)}function me(e,t){var n=this;if(!(this instanceof me))return new me(e,t);this.options=t=t?fe(t):{},fe(fl,t,!1);var r=t.value;typeof r=="string"?r=new rt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new me.inputStyles[t.inputStyle](this),o=this.display=new sf(e,r,i,t);o.wrapper.CodeMirror=this,sl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ca(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 At,keySeq:null,specialChars:null},t.autofocus&&!A&&o.input.focus(),C&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jf(this),Mf(),wr(this),this.curOp.forceUpdate=!0,wa(this,r),t.autofocus&&!A||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Gi(n)},20):Br(this);for(var a in ui)ui.hasOwnProperty(a)&&ui[a](this,t[a],Yr);pa(this),t.finishInit&&t.finishInit(this);for(var l=0;l20*20}te(t.scroller,"touchstart",function(s){if(!Se(e,s)&&!o(s)&&!ao(e,s)){t.input.ensurePolled(),clearTimeout(n);var f=+new Date;t.activeTouch={start:f,moved:!1,prev:f-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(s){var f=t.activeTouch;if(f&&!Kt(t,s)&&f.left!=null&&!f.moved&&new Date-f.start<300){var c=e.coordsChar(t.activeTouch,"page"),d;!f.prev||a(f,f.prev)?d=new de(c,c):!f.prev.prev||a(f,f.prev.prev)?d=e.findWordAt(c):d=new de(S(c.line,0),ie(e.doc,S(c.line+1,0))),e.setSelection(d.anchor,d.head),e.focus(),qe(s)}i()}),te(t.scroller,"touchcancel",i),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(dn(e,t.scroller.scrollTop),br(e,t.scroller.scrollLeft,!0),Ce(e,"scroll",e))}),te(t.scroller,"mousewheel",function(s){return ya(e,s)}),te(t.scroller,"DOMMouseScroll",function(s){return ya(e,s)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){Se(e,s)||Vt(s)},over:function(s){Se(e,s)||(Tf(e,s),Vt(s))},start:function(s){return Lf(e,s)},drop:Be(e,Sf),leave:function(s){Se(e,s)||qa(e)}};var l=t.input.getField();te(l,"keyup",function(s){return rl.call(e,s)}),te(l,"keydown",Be(e,tl)),te(l,"keypress",Be(e,nl)),te(l,"focus",function(s){return Gi(e,s)}),te(l,"blur",function(s){return Br(e,s)})}var lo=[];me.defineInitHook=function(e){return lo.push(e)};function Fn(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=on(e,t).state:n="prev");var a=e.options.tabSize,l=$(i,t),s=ve(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var f=l.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(l.text))c=0,n="not";else if(n=="smart"&&(c=i.mode.indent(o,l.text.slice(f.length),l.text),c==Yt||c>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?c=ve($(i,t-1).text,null,a):c=0:n=="add"?c=s+e.options.indentUnit:n=="subtract"?c=s-e.options.indentUnit:typeof n=="number"&&(c=s+n),c=Math.max(0,c);var d="",b=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)b+=a,d+=" ";if(ba,s=yt(t),f=null;if(l&&r.ranges.length>1)if(Mt&&Mt.text.join(` `)==t){if(r.ranges.length%Mt.text.length==0){f=[];for(var c=0;c=0;b--){var m=r.ranges[b],M=m.from(),F=m.to();m.empty()&&(n&&n>0?M=S(M.line,M.ch-n):e.state.overwrite&&!l?F=S(F.line,Math.min($(o,F.line).text.length,F.ch+ce(s).length)):l&&Mt&&Mt.lineWise&&Mt.text.join(` `)==s.join(` -`)&&(M=F=S(M.line,0)));var z={from:M,to:F,text:f?f[b%f.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};_r(e.doc,z),Ie(e,"inputRead",e,z)}t&&!l&&cl(e,t),zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ul(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ft(t,function(){return so(t,n,0,null,"paste")}),!0}function cl(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test($(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Ie(e,"electricInput",e,i.head.line)}}}function hl(e){for(var t=[],n=[],r=0;ro&&(Fn(this,l.head.line,r,!0),o=l.head.line,a==this.doc.sel.primIndex&&zr(this));else{var s=l.from(),f=l.to(),c=Math.max(o,s.line);o=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(var d=c;d0&&eo(this.doc,a,new de(s,b[a].to()),ht)}}}),getTokenAt:function(r,i){return ko(this,r,i)},getLineTokens:function(r,i){return ko(this,S(r),i,!0)},getTokenTypeAt:function(r){r=ie(this.doc,r);var i=xo(this,$(this.doc,r.line)),o=0,a=(i.length-1)/2,l=r.ch,s;if(l==0)s=i[2];else for(;;){var f=o+a>>1;if((f?i[f*2-1]:0)>=l)a=f;else if(i[f*2+1]s&&(r=s,a=!0),l=$(this.doc,r)}else l=r;return Xn(this,l,{top:0,left:0},i||"page",o||a).top+(a?this.doc.height-_t(l):0)},defaultTextHeight:function(){return Wr(this.display)},defaultCharWidth:function(){return Ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,a,l){var s=this.display;r=Lt(this,ie(this.doc,r));var f=r.bottom,c=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),a=="over")f=r.top;else if(a=="above"||a=="near"){var d=Math.max(s.wrapper.clientHeight,this.doc.height),b=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+i.offsetHeight>d)&&r.top>i.offsetHeight?f=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=d&&(f=r.bottom),c+i.offsetWidth>b&&(c=b-i.offsetWidth)}i.style.top=f+"px",i.style.left=i.style.right="",l=="right"?(c=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(l=="left"?c=0:l=="middle"&&(c=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=c+"px"),o&&js(this,{left:c,top:f,right:c+i.offsetWidth,bottom:f+i.offsetHeight})},triggerOnKeyDown:Je(tl),triggerOnKeyPress:Je(nl),triggerOnKeyUp:rl,triggerOnMouseDown:Je(il),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Je(function(r){cl(this,r)}),findPosH:function(r,i,o,a){var l=1;i<0&&(l=-1,i=-i);for(var s=ie(this.doc,r),f=0;f0&&c(o.charAt(a-1));)--a;for(;l.5||this.options.lineWrapping)&&Ii(this),ke(this,"refresh",this)}),swapDoc:Je(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),wa(this,r),un(this),this.display.input.reset(),hn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ie(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},bt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,a){e.registerHelper(r,i,a),n[r]._global.push({pred:o,val:a})}}function uo(e,t,n,r,i){var o=t,a=n,l=$(e,t.line),s=i&&e.direction=="rtl"?-n:n;function f(){var q=t.line+s;return q=e.first+e.size?!1:(t=new S(q,t.ch,t.sticky),l=$(e,q))}function c(q){var U;if(r=="codepoint"){var Z=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(Z))U=null;else{var re=n>0?Z>=55296&&Z<56320:Z>=56320&&Z<57343;U=new S(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(re?2:1))),-n)}}else i?U=Nf(e.cm,l,t,n):U=ro(l,t,n);if(U==null)if(!q&&f())t=no(i,e.cm,l,t.line,s);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var d=null,b=r=="group",m=e.cm&&e.cm.getHelper(t,"wordChars"),M=!0;!(n<0&&!c(!M));M=!1){var F=l.text.charAt(t.ch)||` +`)&&(M=F=S(M.line,0)));var z={from:M,to:F,text:f?f[b%f.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};_r(e.doc,z),Ie(e,"inputRead",e,z)}t&&!l&&cl(e,t),zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ul(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ft(t,function(){return so(t,n,0,null,"paste")}),!0}function cl(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test($(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Ie(e,"electricInput",e,i.head.line)}}}function hl(e){for(var t=[],n=[],r=0;ro&&(Fn(this,l.head.line,r,!0),o=l.head.line,a==this.doc.sel.primIndex&&zr(this));else{var s=l.from(),f=l.to(),c=Math.max(o,s.line);o=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(var d=c;d0&&eo(this.doc,a,new de(s,b[a].to()),ht)}}}),getTokenAt:function(r,i){return Co(this,r,i)},getLineTokens:function(r,i){return Co(this,S(r),i,!0)},getTokenTypeAt:function(r){r=ie(this.doc,r);var i=xo(this,$(this.doc,r.line)),o=0,a=(i.length-1)/2,l=r.ch,s;if(l==0)s=i[2];else for(;;){var f=o+a>>1;if((f?i[f*2-1]:0)>=l)a=f;else if(i[f*2+1]s&&(r=s,a=!0),l=$(this.doc,r)}else l=r;return Xn(this,l,{top:0,left:0},i||"page",o||a).top+(a?this.doc.height-_t(l):0)},defaultTextHeight:function(){return Er(this.display)},defaultCharWidth:function(){return Ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,a,l){var s=this.display;r=Lt(this,ie(this.doc,r));var f=r.bottom,c=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),a=="over")f=r.top;else if(a=="above"||a=="near"){var d=Math.max(s.wrapper.clientHeight,this.doc.height),b=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+i.offsetHeight>d)&&r.top>i.offsetHeight?f=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=d&&(f=r.bottom),c+i.offsetWidth>b&&(c=b-i.offsetWidth)}i.style.top=f+"px",i.style.left=i.style.right="",l=="right"?(c=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(l=="left"?c=0:l=="middle"&&(c=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=c+"px"),o&&js(this,{left:c,top:f,right:c+i.offsetWidth,bottom:f+i.offsetHeight})},triggerOnKeyDown:Je(tl),triggerOnKeyPress:Je(nl),triggerOnKeyUp:rl,triggerOnMouseDown:Je(il),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Je(function(r){cl(this,r)}),findPosH:function(r,i,o,a){var l=1;i<0&&(l=-1,i=-i);for(var s=ie(this.doc,r),f=0;f0&&c(o.charAt(a-1));)--a;for(;l.5||this.options.lineWrapping)&&Ii(this),Ce(this,"refresh",this)}),swapDoc:Je(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),wa(this,r),un(this),this.display.input.reset(),hn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ie(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},bt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,a){e.registerHelper(r,i,a),n[r]._global.push({pred:o,val:a})}}function uo(e,t,n,r,i){var o=t,a=n,l=$(e,t.line),s=i&&e.direction=="rtl"?-n:n;function f(){var q=t.line+s;return q=e.first+e.size?!1:(t=new S(q,t.ch,t.sticky),l=$(e,q))}function c(q){var U;if(r=="codepoint"){var Z=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(Z))U=null;else{var re=n>0?Z>=55296&&Z<56320:Z>=56320&&Z<57343;U=new S(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(re?2:1))),-n)}}else i?U=Nf(e.cm,l,t,n):U=ro(l,t,n);if(U==null)if(!q&&f())t=no(i,e.cm,l,t.line,s);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var d=null,b=r=="group",m=e.cm&&e.cm.getHelper(t,"wordChars"),M=!0;!(n<0&&!c(!M));M=!1){var F=l.text.charAt(t.ch)||` `,z=Bt(F,m)?"w":b&&F==` -`?"n":!b||/\s/.test(F)?null:"p";if(b&&!M&&!z&&(z="s"),d&&d!=z){n<0&&(n=1,c(),t.sticky="after");break}if(z&&(d=z),n>0&&!c(!M))break}var G=oi(e,t,o,a,!0);return he(o,G)&&(G.hitSide=!0),G}function pl(e,t,n,r){var i=e.doc,o=t.left,a;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,oe(e).innerHeight||i(e).documentElement.clientHeight),s=Math.max(l-.5*Wr(e.display),3);a=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(a=n>0?t.bottom+3:t.top-3);for(var f;f=Ei(e,o,a),!!f.outside;){if(n<0?a<=0:a>=i.height){f.hitSide=!0;break}a+=n*5}return f}var ge=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new At,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ge.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,fo(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var s=l.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}te(i,"paste",function(l){!o(l)||Se(r,l)||ul(l,r)||N<=11&&setTimeout(Be(r,function(){return t.updateFromDOM()}),20)}),te(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),te(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),te(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(i,"touchstart",function(){return n.forceCompositionEnd()}),te(i,"input",function(){t.composing||t.readFromDOMSoon()});function a(l){if(!(!o(l)||Se(r,l))){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=hl(r);ci({lineWise:!0,text:s.text}),l.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var f=Mt.text.join(` +`?"n":!b||/\s/.test(F)?null:"p";if(b&&!M&&!z&&(z="s"),d&&d!=z){n<0&&(n=1,c(),t.sticky="after");break}if(z&&(d=z),n>0&&!c(!M))break}var G=oi(e,t,o,a,!0);return he(o,G)&&(G.hitSide=!0),G}function pl(e,t,n,r){var i=e.doc,o=t.left,a;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,oe(e).innerHeight||i(e).documentElement.clientHeight),s=Math.max(l-.5*Er(e.display),3);a=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(a=n>0?t.bottom+3:t.top-3);for(var f;f=Hi(e,o,a),!!f.outside;){if(n<0?a<=0:a>=i.height){f.hitSide=!0;break}a+=n*5}return f}var ge=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new At,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ge.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,fo(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var s=l.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}te(i,"paste",function(l){!o(l)||Se(r,l)||ul(l,r)||N<=11&&setTimeout(Be(r,function(){return t.updateFromDOM()}),20)}),te(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),te(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),te(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(i,"touchstart",function(){return n.forceCompositionEnd()}),te(i,"input",function(){t.composing||t.readFromDOMSoon()});function a(l){if(!(!o(l)||Se(r,l))){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=hl(r);ci({lineWise:!0,text:s.text}),l.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var f=Mt.text.join(` `);if(l.clipboardData.setData("Text",f),l.clipboardData.getData("Text")==f){l.preventDefault();return}}var c=dl(),d=c.firstChild;fo(d),r.display.lineSpace.insertBefore(c,r.display.lineSpace.firstChild),d.value=Mt.text.join(` -`);var b=Ae(Pe(i));cr(d),setTimeout(function(){r.display.lineSpace.removeChild(c),b.focus(),b==i&&n.showPrimarySelection()},50)}}te(i,"copy",a),te(i,"cut",a)},ge.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ge.prototype.prepareSelection=function(){var e=ia(this.cm,!1);return e.focus=Ae(Pe(this.div))==this.div,e},ge.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ge.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ge.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&vl(t,r)||{node:l[0].measure.map[2],offset:0},f=i.linee.firstLine()&&(r=S(r.line-1,$(e.doc,r.line-1).length)),i.ch==$(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,l;r.line==t.viewFrom||(o=mr(e,r.line))==0?(a=u(t.view[0].line),l=t.view[0].node):(a=u(t.view[o].line),l=t.view[o-1].node.nextSibling);var s=mr(e,i.line),f,c;if(s==t.view.length-1?(f=t.viewTo-1,c=t.lineDiv.lastChild):(f=u(t.view[s+1].line)-1,c=t.view[s+1].node.previousSibling),!l)return!1;for(var d=e.doc.splitLines($f(e,l,c,a,f)),b=Gt(e.doc,S(a,0),S(f,$(e.doc,f).text.length));d.length>1&&b.length>1;)if(ce(d)==ce(b))d.pop(),b.pop(),f--;else if(d[0]==b[0])d.shift(),b.shift(),a++;else break;for(var m=0,M=0,F=d[0],z=b[0],G=Math.min(F.length,z.length);mr.ch&&q.charCodeAt(q.length-M-1)==U.charCodeAt(U.length-M-1);)m--,M++;d[d.length-1]=q.slice(0,q.length-M).replace(/^\u200b+/,""),d[0]=d[0].slice(m).replace(/\u200b+$/,"");var re=S(a,m),ee=S(f,b.length?ce(b).length-M:0);if(d.length>1||d[0]||K(re,ee))return Kr(e.doc,d,re,ee,"+input"),!0},ge.prototype.ensurePolled=function(){this.forceCompositionEnd()},ge.prototype.reset=function(){this.forceCompositionEnd()},ge.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ge.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ge.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ft(this.cm,function(){return tt(e.cm)})},ge.prototype.setUneditable=function(e){e.contentEditable="false"},ge.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Be(this.cm,so)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ge.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ge.prototype.onContextMenu=function(){},ge.prototype.resetPosition=function(){},ge.prototype.needsContentAttribute=!0;function vl(e,t){var n=Di(e,t.line);if(!n||n.hidden)return null;var r=$(e.doc,t.line),i=Ko(n,r,t.line),o=ue(r,e.doc.direction),a="left";if(o){var l=Qt(o,t.ch);a=l%2?"right":"left"}var s=jo(i.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Vf(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Zr(e,t){return t&&(e.bad=!0),e}function $f(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function f(m){return function(M){return M.id==m}}function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function d(m){m&&(c(),o+=m)}function b(m){if(m.nodeType==1){var M=m.getAttribute("cm-text");if(M){d(M);return}var F=m.getAttribute("cm-marker"),z;if(F){var G=e.findMarks(S(r,0),S(i+1,0),f(+F));G.length&&(z=G[0].find(0))&&d(Gt(e.doc,z.from,z.to).join(l));return}if(m.getAttribute("contenteditable")=="false")return;var q=/^(pre|div|p|li|table|br)$/i.test(m.nodeName);if(!/^br$/i.test(m.nodeName)&&m.textContent.length==0)return;q&&c();for(var U=0;U=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),te(i,"paste",function(a){Se(r,a)||ul(a,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(a){if(!Se(r,a)){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=hl(r);ci({lineWise:!0,text:l.text}),a.type=="cut"?r.setSelections(l.ranges,null,ht):(n.prevInput="",i.value=l.text.join(` -`),cr(i))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(i,"cut",o),te(i,"copy",o),te(e.scroller,"paste",function(a){if(!(Kt(e,a)||Se(r,a))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var l=new Event("paste");l.clipboardData=a.clipboardData,i.dispatchEvent(l)}}),te(e.lineSpace,"selectstart",function(a){Kt(e,a)||qe(a)}),te(i,"compositionstart",function(){var a=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Me.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;fo(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Me.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Me.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ia(e);if(e.options.moveInputWithCursor){var i=Lt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Me.prototype.showSelection=function(e){var t=this.cm,n=t.display;Y(n.cursorDiv,e.cursors),Y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Me.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&cr(this.textarea),k&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",k&&N>=9&&(this.hasSelection=null));this.resetting=!1}},Me.prototype.getField=function(){return this.textarea},Me.prototype.supportsTouch=function(){return!1},Me.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!A||Ae(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Me.prototype.blur=function(){this.textarea.blur()},Me.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Me.prototype.receivedFocus=function(){this.slowPoll()},Me.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Me.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Me.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||er(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(k&&N>=9&&this.hasSelection===i||E&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a1e3||i.indexOf(` -`)>-1?n.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},Me.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Me.prototype.onKeyPress=function(){k&&N>=9&&(this.hasSelection=null),this.fastPoll()},Me.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=yr(n,e),a=r.scroller.scrollTop;if(!o||H)return;var l=n.options.resetSelectionOnContextMenu;l&&n.doc.sel.contains(o)==-1&&Be(n,Xe)(n.doc,or(o),ht);var s=i.style.cssText,f=t.wrapper.style.cssText,c=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; +`);var b=Ae(We(i));cr(d),setTimeout(function(){r.display.lineSpace.removeChild(c),b.focus(),b==i&&n.showPrimarySelection()},50)}}te(i,"copy",a),te(i,"cut",a)},ge.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ge.prototype.prepareSelection=function(){var e=ia(this.cm,!1);return e.focus=Ae(We(this.div))==this.div,e},ge.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ge.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ge.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&vl(t,r)||{node:l[0].measure.map[2],offset:0},f=i.linee.firstLine()&&(r=S(r.line-1,$(e.doc,r.line-1).length)),i.ch==$(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,l;r.line==t.viewFrom||(o=mr(e,r.line))==0?(a=u(t.view[0].line),l=t.view[0].node):(a=u(t.view[o].line),l=t.view[o-1].node.nextSibling);var s=mr(e,i.line),f,c;if(s==t.view.length-1?(f=t.viewTo-1,c=t.lineDiv.lastChild):(f=u(t.view[s+1].line)-1,c=t.view[s+1].node.previousSibling),!l)return!1;for(var d=e.doc.splitLines($f(e,l,c,a,f)),b=Gt(e.doc,S(a,0),S(f,$(e.doc,f).text.length));d.length>1&&b.length>1;)if(ce(d)==ce(b))d.pop(),b.pop(),f--;else if(d[0]==b[0])d.shift(),b.shift(),a++;else break;for(var m=0,M=0,F=d[0],z=b[0],G=Math.min(F.length,z.length);mr.ch&&q.charCodeAt(q.length-M-1)==U.charCodeAt(U.length-M-1);)m--,M++;d[d.length-1]=q.slice(0,q.length-M).replace(/^\u200b+/,""),d[0]=d[0].slice(m).replace(/\u200b+$/,"");var re=S(a,m),ee=S(f,b.length?ce(b).length-M:0);if(d.length>1||d[0]||K(re,ee))return Kr(e.doc,d,re,ee,"+input"),!0},ge.prototype.ensurePolled=function(){this.forceCompositionEnd()},ge.prototype.reset=function(){this.forceCompositionEnd()},ge.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ge.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ge.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ft(this.cm,function(){return tt(e.cm)})},ge.prototype.setUneditable=function(e){e.contentEditable="false"},ge.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Be(this.cm,so)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ge.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ge.prototype.onContextMenu=function(){},ge.prototype.resetPosition=function(){},ge.prototype.needsContentAttribute=!0;function vl(e,t){var n=Di(e,t.line);if(!n||n.hidden)return null;var r=$(e.doc,t.line),i=Ko(n,r,t.line),o=ue(r,e.doc.direction),a="left";if(o){var l=Qt(o,t.ch);a=l%2?"right":"left"}var s=jo(i.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Vf(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Zr(e,t){return t&&(e.bad=!0),e}function $f(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function f(m){return function(M){return M.id==m}}function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function d(m){m&&(c(),o+=m)}function b(m){if(m.nodeType==1){var M=m.getAttribute("cm-text");if(M){d(M);return}var F=m.getAttribute("cm-marker"),z;if(F){var G=e.findMarks(S(r,0),S(i+1,0),f(+F));G.length&&(z=G[0].find(0))&&d(Gt(e.doc,z.from,z.to).join(l));return}if(m.getAttribute("contenteditable")=="false")return;var q=/^(pre|div|p|li|table|br)$/i.test(m.nodeName);if(!/^br$/i.test(m.nodeName)&&m.textContent.length==0)return;q&&c();for(var U=0;U=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),te(i,"paste",function(a){Se(r,a)||ul(a,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(a){if(!Se(r,a)){if(r.somethingSelected())ci({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=hl(r);ci({lineWise:!0,text:l.text}),a.type=="cut"?r.setSelections(l.ranges,null,ht):(n.prevInput="",i.value=l.text.join(` +`),cr(i))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(i,"cut",o),te(i,"copy",o),te(e.scroller,"paste",function(a){if(!(Kt(e,a)||Se(r,a))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var l=new Event("paste");l.clipboardData=a.clipboardData,i.dispatchEvent(l)}}),te(e.lineSpace,"selectstart",function(a){Kt(e,a)||qe(a)}),te(i,"compositionstart",function(){var a=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Me.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;fo(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Me.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Me.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ia(e);if(e.options.moveInputWithCursor){var i=Lt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Me.prototype.showSelection=function(e){var t=this.cm,n=t.display;Y(n.cursorDiv,e.cursors),Y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Me.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&cr(this.textarea),C&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",C&&N>=9&&(this.hasSelection=null));this.resetting=!1}},Me.prototype.getField=function(){return this.textarea},Me.prototype.supportsTouch=function(){return!1},Me.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!A||Ae(We(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Me.prototype.blur=function(){this.textarea.blur()},Me.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Me.prototype.receivedFocus=function(){this.slowPoll()},Me.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Me.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Me.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||er(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(C&&N>=9&&this.hasSelection===i||H&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a1e3||i.indexOf(` +`)>-1?n.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},Me.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Me.prototype.onKeyPress=function(){C&&N>=9&&(this.hasSelection=null),this.fastPoll()},Me.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=yr(n,e),a=r.scroller.scrollTop;if(!o||P)return;var l=n.options.resetSelectionOnContextMenu;l&&n.doc.sel.contains(o)==-1&&Be(n,Xe)(n.doc,or(o),ht);var s=i.style.cssText,f=t.wrapper.style.cssText,c=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+`px; - z-index: 1000; background: `+(k?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var d;w&&(d=i.ownerDocument.defaultView.scrollY),r.input.focus(),w&&i.ownerDocument.defaultView.scrollTo(null,d),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function b(){if(i.selectionStart!=null){var F=n.somethingSelected(),z="\u200B"+(F?i.value:"");i.value="\u21DA",i.value=z,t.prevInput=F?"":"\u200B",i.selectionStart=1,i.selectionEnd=z.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=s,k&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),i.selectionStart!=null)){(!k||k&&N<9)&&b();var F=0,z=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Be(n,Ha)(n):F++<10?r.detectingSelectAll=setTimeout(z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(z,200)}}if(k&&N>=9&&b(),be){Vt(e);var M=function(){Ke(window,"mouseup",M),setTimeout(m,20)};te(window,"mouseup",M)}else setTimeout(m,50)},Me.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Me.prototype.setUneditable=function(){},Me.prototype.needsContentAttribute=!1;function tu(e,t){if(t=t?fe(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=Ae(Pe(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var l=me(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return l}function ru(e){e.off=Ke,e.on=te,e.wheelEventPixels=ff,e.Doc=rt,e.splitLines=yt,e.countColumn=ve,e.findColumn=Dt,e.isWordChar=$r,e.Pass=Yt,e.signal=ke,e.Line=Er,e.changeEnd=ar,e.scrollbarModel=ua,e.Pos=S,e.cmpPos=K,e.modes=Mr,e.mimeModes=Ct,e.resolveMode=Ar,e.getMode=Or,e.modeExtensions=tr,e.extendMode=Dr,e.copyState=Nt,e.startState=Fr,e.innerMode=rn,e.commands=Mn,e.keyMap=Xt,e.keyName=Ja,e.isModifierKey=Ya,e.lookupKey=Xr,e.normalizeKeyMap=Ff,e.StringStream=Le,e.SharedTextMarker=Sn,e.TextMarker=sr,e.LineWidget=kn,e.e_preventDefault=qe,e.e_stopPropagation=Lr,e.e_stop=Vt,e.addClass=Ce,e.contains=Ee,e.rmClass=we,e.keyNames=fr}jf(me),Qf(me);var nu="iter insert remove copy getEditor constructor".split(" ");for(var di in rt.prototype)rt.prototype.hasOwnProperty(di)&&le(nu,di)<0&&(me.prototype[di]=function(e){return function(){return e.apply(this.doc,arguments)}}(rt.prototype[di]));return bt(rt),me.inputStyles={textarea:Me,contenteditable:ge},me.defineMode=function(e){!me.defaults.mode&&e!="null"&&(me.defaults.mode=e),kt.apply(this,arguments)},me.defineMIME=pr,me.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),me.defineMIME("text/plain","null"),me.defineExtension=function(e,t){me.prototype[e]=t},me.defineDocExtension=function(e,t){rt.prototype[e]=t},me.fromTextArea=tu,ru(me),me.version="5.65.19",me})});var bl=at((yl,ml)=>{(function(g){typeof yl=="object"&&typeof ml=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.defineMode("javascript",function(_,P){var Q=_.indentUnit,W=P.statementIndent,T=P.jsonld,k=P.json||T,N=P.trackScope!==!1,w=P.typescript,R=P.wordCharacters||/[\w$\xa1-\uffff]/,L=function(){function u(We){return{type:We,style:"keyword"}}var h=u("keyword a"),O=u("keyword b"),B=u("keyword c"),S=u("keyword d"),K=u("operator"),he={type:"atom",style:"atom"};return{if:u("if"),while:h,with:h,else:O,do:O,try:O,finally:O,return:S,break:S,continue:S,new:u("new"),delete:B,void:B,throw:B,debugger:u("debugger"),var:u("var"),const:u("var"),let:u("var"),function:u("function"),catch:u("catch"),for:u("for"),switch:u("switch"),case:u("case"),default:u("default"),in:K,typeof:K,instanceof:K,true:he,false:he,null:he,undefined:he,NaN:he,Infinity:he,this:u("this"),class:u("class"),super:u("atom"),yield:B,export:u("export"),import:u("import"),extends:B,await:B}}(),I=/[+\-*&%=<>!?|~^@]/,H=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function j(u){for(var h=!1,O,B=!1;(O=u.next())!=null;){if(!h){if(O=="/"&&!B)return;O=="["?B=!0:B&&O=="]"&&(B=!1)}h=!h&&O=="\\"}}var C,y;function p(u,h,O){return C=u,y=O,h}function x(u,h){var O=u.next();if(O=='"'||O=="'")return h.tokenize=A(O),h.tokenize(u,h);if(O=="."&&u.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(O=="."&&u.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(O))return p(O);if(O=="="&&u.eat(">"))return p("=>","operator");if(O=="0"&&u.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(O))return u.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(O=="/")return u.eat("*")?(h.tokenize=E,E(u,h)):u.eat("/")?(u.skipToEnd(),p("comment","comment")):pt(u,h,1)?(j(u),u.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(u.eat("="),p("operator","operator",u.current()));if(O=="`")return h.tokenize=X,X(u,h);if(O=="#"&&u.peek()=="!")return u.skipToEnd(),p("meta","meta");if(O=="#"&&u.eatWhile(R))return p("variable","property");if(O=="<"&&u.match("!--")||O=="-"&&u.match("->")&&!/\S/.test(u.string.slice(0,u.start)))return u.skipToEnd(),p("comment","comment");if(I.test(O))return(O!=">"||!h.lexical||h.lexical.type!=">")&&(u.eat("=")?(O=="!"||O=="=")&&u.eat("="):/[<>*+\-|&?]/.test(O)&&(u.eat(O),O==">"&&u.eat(O))),O=="?"&&u.eat(".")?p("."):p("operator","operator",u.current());if(R.test(O)){u.eatWhile(R);var B=u.current();if(h.lastType!="."){if(L.propertyIsEnumerable(B)){var S=L[B];return p(S.type,S.style,B)}if(B=="async"&&u.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",B)}return p("variable","variable",B)}}function A(u){return function(h,O){var B=!1,S;if(T&&h.peek()=="@"&&h.match(H))return O.tokenize=x,p("jsonld-keyword","meta");for(;(S=h.next())!=null&&!(S==u&&!B);)B=!B&&S=="\\";return B||(O.tokenize=x),p("string","string")}}function E(u,h){for(var O=!1,B;B=u.next();){if(B=="/"&&O){h.tokenize=x;break}O=B=="*"}return p("comment","comment")}function X(u,h){for(var O=!1,B;(B=u.next())!=null;){if(!O&&(B=="`"||B=="$"&&u.eat("{"))){h.tokenize=x;break}O=!O&&B=="\\"}return p("quasi","string-2",u.current())}var V="([{}])";function J(u,h){h.fatArrowAt&&(h.fatArrowAt=null);var O=u.string.indexOf("=>",u.start);if(!(O<0)){if(w){var B=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(u.string.slice(u.start,O));B&&(O=B.index)}for(var S=0,K=!1,he=O-1;he>=0;--he){var We=u.string.charAt(he),et=V.indexOf(We);if(et>=0&&et<3){if(!S){++he;break}if(--S==0){We=="("&&(K=!0);break}}else if(et>=3&&et<6)++S;else if(R.test(We))K=!0;else if(/["'\/`]/.test(We))for(;;--he){if(he==0)return;var Nr=u.string.charAt(he-1);if(Nr==We&&u.string.charAt(he-2)!="\\"){he--;break}}else if(K&&!S){++he;break}}K&&!S&&(h.fatArrowAt=he)}}var ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function be(u,h,O,B,S,K){this.indented=u,this.column=h,this.type=O,this.prev=S,this.info=K,B!=null&&(this.align=B)}function pe(u,h){if(!N)return!1;for(var O=u.localVars;O;O=O.next)if(O.name==h)return!0;for(var B=u.context;B;B=B.prev)for(var O=B.vars;O;O=O.next)if(O.name==h)return!0}function we(u,h,O,B,S){var K=u.cc;for(D.state=u,D.stream=S,D.marked=null,D.cc=K,D.style=h,u.lexical.hasOwnProperty("align")||(u.lexical.align=!0);;){var he=K.length?K.pop():k?le:ve;if(he(O,B)){for(;K.length&&K[K.length-1].lex;)K.pop()();return D.marked?D.marked:O=="variable"&&pe(u,B)?"variable-2":h}}}var D={state:null,column:null,marked:null,cc:null};function Y(){for(var u=arguments.length-1;u>=0;u--)D.cc.push(arguments[u])}function v(){return Y.apply(null,arguments),!0}function Ye(u,h){for(var O=h;O;O=O.next)if(O.name==u)return!0;return!1}function _e(u){var h=D.state;if(D.marked="def",!!N){if(h.context){if(h.lexical.info=="var"&&h.context&&h.context.block){var O=Ee(u,h.context);if(O!=null){h.context=O;return}}else if(!Ye(u,h.localVars)){h.localVars=new He(u,h.localVars);return}}P.globalVars&&!Ye(u,h.globalVars)&&(h.globalVars=new He(u,h.globalVars))}}function Ee(u,h){if(h)if(h.block){var O=Ee(u,h.prev);return O?O==h.prev?h:new Ce(O,h.vars,!0):null}else return Ye(u,h.vars)?h:new Ce(h.prev,new He(u,h.vars),!1);else return null}function Ae(u){return u=="public"||u=="private"||u=="protected"||u=="abstract"||u=="readonly"}function Ce(u,h,O){this.prev=u,this.vars=h,this.block=O}function He(u,h){this.name=u,this.next=h}var cr=new He("this",new He("arguments",null));function ct(){D.state.context=new Ce(D.state.context,D.state.localVars,!1),D.state.localVars=cr}function mt(){D.state.context=new Ce(D.state.context,D.state.localVars,!0),D.state.localVars=null}ct.lex=mt.lex=!0;function Pe(){D.state.localVars=D.state.context.vars,D.state.context=D.state.context.prev}Pe.lex=!0;function oe(u,h){var O=function(){var B=D.state,S=B.indented;if(B.lexical.type=="stat")S=B.lexical.indented;else for(var K=B.lexical;K&&K.type==")"&&K.align;K=K.prev)S=K.indented;B.lexical=new be(S,D.stream.column(),u,null,B.lexical,h)};return O.lex=!0,O}function ne(){var u=D.state;u.lexical.prev&&(u.lexical.type==")"&&(u.indented=u.lexical.indented),u.lexical=u.lexical.prev)}ne.lex=!0;function fe(u){function h(O){return O==u?v():u==";"||O=="}"||O==")"||O=="]"?Y():v(h)}return h}function ve(u,h){return u=="var"?v(oe("vardef",h),Lr,fe(";"),ne):u=="keyword a"?v(oe("form"),Yt,ve,ne):u=="keyword b"?v(oe("form"),ve,ne):u=="keyword d"?D.stream.match(/^\s*$/,!1)?v():v(oe("stat"),Ot,fe(";"),ne):u=="debugger"?v(fe(";")):u=="{"?v(oe("}"),mt,Ft,ne,Pe):u==";"?v():u=="if"?(D.state.lexical.info=="else"&&D.state.cc[D.state.cc.length-1]==ne&&D.state.cc.pop()(),v(oe("form"),Yt,ve,ne,Tr)):u=="function"?v(yt):u=="for"?v(oe("form"),mt,Wn,ve,Pe,ne):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form",u=="class"?u:h),Mr,ne)):u=="variable"?w&&h=="declare"?(D.marked="keyword",v(ve)):w&&(h=="module"||h=="enum"||h=="type")&&D.stream.match(/^\s*\w/,!1)?(D.marked="keyword",h=="enum"?v($):h=="type"?v(In,fe("operator"),ue,fe(";")):v(oe("form"),$e,fe("{"),oe("}"),Ft,ne,ne)):w&&h=="namespace"?(D.marked="keyword",v(oe("form"),le,ve,ne)):w&&h=="abstract"?(D.marked="keyword",v(ve)):v(oe("stat"),gi):u=="switch"?v(oe("form"),Yt,fe("{"),oe("}","switch"),mt,Ft,ne,ne,Pe):u=="case"?v(le,fe(":")):u=="default"?v(fe(":")):u=="catch"?v(oe("form"),ct,At,ve,ne,Pe):u=="export"?v(oe("stat"),Ar,ne):u=="import"?v(oe("stat"),tr,ne):u=="async"?v(ve):h=="@"?v(le,ve):Y(oe("stat"),le,fe(";"),ne)}function At(u){if(u=="(")return v(wt,fe(")"))}function le(u,h){return ht(u,h,!1)}function Ze(u,h){return ht(u,h,!0)}function Yt(u){return u!="("?Y():v(oe(")"),Ot,fe(")"),ne)}function ht(u,h,O){if(D.state.fatArrowAt==D.stream.start){var B=O?hr:ce;if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,fe("=>"),B,Pe);if(u=="variable")return Y(ct,$e,fe("=>"),B,Pe)}var S=O?Dt:dt;return ae.hasOwnProperty(u)?v(S):u=="function"?v(yt,S):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form"),bi,ne)):u=="keyword c"||u=="async"?v(O?Ze:le):u=="("?v(oe(")"),Ot,fe(")"),ne,S):u=="operator"||u=="spread"?v(O?Ze:le):u=="["?v(oe("]"),Le,ne,S):u=="{"?Zt(Bt,"}",null,S):u=="quasi"?Y(It,S):u=="new"?v(vi(O)):v()}function Ot(u){return u.match(/[;\}\)\],]/)?Y():Y(le)}function dt(u,h){return u==","?v(Ot):Dt(u,h,!1)}function Dt(u,h,O){var B=O==!1?dt:Dt,S=O==!1?le:Ze;if(u=="=>")return v(ct,O?hr:ce,Pe);if(u=="operator")return/\+\+|--/.test(h)||w&&h=="!"?v(B):w&&h=="<"&&D.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?v(oe(">"),Oe(ue,">"),ne,B):h=="?"?v(le,fe(":"),S):v(S);if(u=="quasi")return Y(It,B);if(u!=";"){if(u=="(")return Zt(Ze,")","call",B);if(u==".")return v($r,B);if(u=="[")return v(oe("]"),Ot,fe("]"),ne,B);if(w&&h=="as")return D.marked="keyword",v(ue,B);if(u=="regexp")return D.state.lastType=D.marked="operator",D.stream.backUp(D.stream.pos-D.stream.start-1),v(S)}}function It(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(It):v(Ot,Vr)}function Vr(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(It)}function ce(u){return J(D.stream,D.state),Y(u=="{"?ve:le)}function hr(u){return J(D.stream,D.state),Y(u=="{"?ve:Ze)}function vi(u){return function(h){return h=="."?v(u?En:Nn):h=="variable"&&w?v(st,u?Dt:dt):Y(u?Ze:le)}}function Nn(u,h){if(h=="target")return D.marked="keyword",v(dt)}function En(u,h){if(h=="target")return D.marked="keyword",v(Dt)}function gi(u){return u==":"?v(ne,ve):Y(dt,fe(";"),ne)}function $r(u){if(u=="variable")return D.marked="property",v()}function Bt(u,h){if(u=="async")return D.marked="property",v(Bt);if(u=="variable"||D.style=="keyword"){if(D.marked="property",h=="get"||h=="set")return v(Hn);var O;return w&&D.state.fatArrowAt==D.stream.start&&(O=D.stream.match(/^\s*:\s*/,!1))&&(D.state.fatArrowAt=D.stream.pos+O[0].length),v(zt)}else{if(u=="number"||u=="string")return D.marked=T?"property":D.style+" property",v(zt);if(u=="jsonld-keyword")return v(zt);if(w&&Ae(h))return D.marked="keyword",v(Bt);if(u=="[")return v(le,Jt,fe("]"),zt);if(u=="spread")return v(Ze,zt);if(h=="*")return D.marked="keyword",v(Bt);if(u==":")return Y(zt)}}function Hn(u){return u!="variable"?Y(zt):(D.marked="property",v(yt))}function zt(u){if(u==":")return v(Ze);if(u=="(")return Y(yt)}function Oe(u,h,O){function B(S,K){if(O?O.indexOf(S)>-1:S==","){var he=D.state.lexical;return he.info=="call"&&(he.pos=(he.pos||0)+1),v(function(We,et){return We==h||et==h?Y():Y(u)},B)}return S==h||K==h?v():O&&O.indexOf(";")>-1?Y(u):v(fe(h))}return function(S,K){return S==h||K==h?v():Y(u,B)}}function Zt(u,h,O){for(var B=3;B"),ue);if(u=="quasi")return Y(Ke,gt)}function Pn(u){if(u=="=>")return v(ue)}function te(u){return u.match(/[\}\)\]]/)?v():u==","||u==";"?v(te):Y(Rt,te)}function Rt(u,h){if(u=="variable"||D.style=="keyword")return D.marked="property",v(Rt);if(h=="?"||u=="number"||u=="string")return v(Rt);if(u==":")return v(ue);if(u=="[")return v(fe("variable"),dr,fe("]"),Rt);if(u=="(")return Y(er,Rt);if(!u.match(/[;\}\)\],]/))return v()}function Ke(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(Ke):v(ue,ke)}function ke(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(Ke)}function Se(u,h){return u=="variable"&&D.stream.match(/^\s*[?:]/,!1)||h=="?"?v(Se):u==":"?v(ue):u=="spread"?v(Se):Y(ue)}function gt(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt);if(h=="|"||u=="."||h=="&")return v(ue);if(u=="[")return v(ue,fe("]"),gt);if(h=="extends"||h=="implements")return D.marked="keyword",v(ue);if(h=="?")return v(ue,fe(":"),ue)}function st(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt)}function bt(){return Y(ue,qe)}function qe(u,h){if(h=="=")return v(ue)}function Lr(u,h){return h=="enum"?(D.marked="keyword",v($)):Y($e,Jt,xt,mi)}function $e(u,h){if(w&&Ae(h))return D.marked="keyword",v($e);if(u=="variable")return _e(h),v();if(u=="spread")return v($e);if(u=="[")return Zt(en,"]");if(u=="{")return Zt(Vt,"}")}function Vt(u,h){return u=="variable"&&!D.stream.match(/^\s*:/,!1)?(_e(h),v(xt)):(u=="variable"&&(D.marked="property"),u=="spread"?v($e):u=="}"?Y():u=="["?v(le,fe("]"),fe(":"),Vt):v(fe(":"),$e,xt))}function en(){return Y($e,xt)}function xt(u,h){if(h=="=")return v(Ze)}function mi(u){if(u==",")return v(Lr)}function Tr(u,h){if(u=="keyword b"&&h=="else")return v(oe("form","else"),ve,ne)}function Wn(u,h){if(h=="await")return v(Wn);if(u=="(")return v(oe(")"),tn,ne)}function tn(u){return u=="var"?v(Lr,$t):u=="variable"?v($t):Y($t)}function $t(u,h){return u==")"?v():u==";"?v($t):h=="in"||h=="of"?(D.marked="keyword",v(le,$t)):Y(le,$t)}function yt(u,h){if(h=="*")return D.marked="keyword",v(yt);if(u=="variable")return _e(h),v(yt);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,ve,Pe);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,yt)}function er(u,h){if(h=="*")return D.marked="keyword",v(er);if(u=="variable")return _e(h),v(er);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,Pe);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,er)}function In(u,h){if(u=="keyword"||u=="variable")return D.marked="type",v(In);if(h=="<")return v(oe(">"),Oe(bt,">"),ne)}function wt(u,h){return h=="@"&&v(le,wt),u=="spread"?v(wt):w&&Ae(h)?(D.marked="keyword",v(wt)):w&&u=="this"?v(Jt,xt):Y($e,Jt,xt)}function bi(u,h){return u=="variable"?Mr(u,h):Ct(u,h)}function Mr(u,h){if(u=="variable")return _e(h),v(Ct)}function Ct(u,h){if(h=="<")return v(oe(">"),Oe(bt,">"),ne,Ct);if(h=="extends"||h=="implements"||w&&u==",")return h=="implements"&&(D.marked="keyword"),v(w?ue:le,Ct);if(u=="{")return v(oe("}"),kt,ne)}function kt(u,h){if(u=="async"||u=="variable"&&(h=="static"||h=="get"||h=="set"||w&&Ae(h))&&D.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return D.marked="keyword",v(kt);if(u=="variable"||D.style=="keyword")return D.marked="property",v(pr,kt);if(u=="number"||u=="string")return v(pr,kt);if(u=="[")return v(le,Jt,fe("]"),pr,kt);if(h=="*")return D.marked="keyword",v(kt);if(w&&u=="(")return Y(er,kt);if(u==";"||u==",")return v(kt);if(u=="}")return v();if(h=="@")return v(le,kt)}function pr(u,h){if(h=="!"||h=="?")return v(pr);if(u==":")return v(ue,xt);if(h=="=")return v(Ze);var O=D.state.lexical.prev,B=O&&O.info=="interface";return Y(B?er:yt)}function Ar(u,h){return h=="*"?(D.marked="keyword",v(Fr,fe(";"))):h=="default"?(D.marked="keyword",v(le,fe(";"))):u=="{"?v(Oe(Or,"}"),Fr,fe(";")):Y(ve)}function Or(u,h){if(h=="as")return D.marked="keyword",v(fe("variable"));if(u=="variable")return Y(Ze,Or)}function tr(u){return u=="string"?v():u=="("?Y(le):u=="."?Y(dt):Y(Dr,Nt,Fr)}function Dr(u,h){return u=="{"?Zt(Dr,"}"):(u=="variable"&&_e(h),h=="*"&&(D.marked="keyword"),v(rn))}function Nt(u){if(u==",")return v(Dr,Nt)}function rn(u,h){if(h=="as")return D.marked="keyword",v(Dr)}function Fr(u,h){if(h=="from")return D.marked="keyword",v(le)}function Le(u){return u=="]"?v():Y(Oe(Ze,"]"))}function $(){return Y(oe("form"),$e,fe("{"),oe("}"),Oe(Gt,"}"),ne,ne)}function Gt(){return Y($e,xt)}function nn(u,h){return u.lastType=="operator"||u.lastType==","||I.test(h.charAt(0))||/[,.]/.test(h.charAt(0))}function pt(u,h,O){return h.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(h.lastType)||h.lastType=="quasi"&&/\{\s*$/.test(u.string.slice(0,u.pos-(O||0)))}return{startState:function(u){var h={tokenize:x,lastType:"sof",cc:[],lexical:new be((u||0)-Q,0,"block",!1),localVars:P.localVars,context:P.localVars&&new Ce(null,null,!1),indented:u||0};return P.globalVars&&typeof P.globalVars=="object"&&(h.globalVars=P.globalVars),h},token:function(u,h){if(u.sol()&&(h.lexical.hasOwnProperty("align")||(h.lexical.align=!1),h.indented=u.indentation(),J(u,h)),h.tokenize!=E&&u.eatSpace())return null;var O=h.tokenize(u,h);return C=="comment"?O:(h.lastType=C=="operator"&&(y=="++"||y=="--")?"incdec":C,we(h,O,C,y,u))},indent:function(u,h){if(u.tokenize==E||u.tokenize==X)return g.Pass;if(u.tokenize!=x)return 0;var O=h&&h.charAt(0),B=u.lexical,S;if(!/^\s*else\b/.test(h))for(var K=u.cc.length-1;K>=0;--K){var he=u.cc[K];if(he==ne)B=B.prev;else if(he!=Tr&&he!=Pe)break}for(;(B.type=="stat"||B.type=="form")&&(O=="}"||(S=u.cc[u.cc.length-1])&&(S==dt||S==Dt)&&!/^[,\.=+\-*:?[\(]/.test(h));)B=B.prev;W&&B.type==")"&&B.prev.type=="stat"&&(B=B.prev);var We=B.type,et=O==We;return We=="vardef"?B.indented+(u.lastType=="operator"||u.lastType==","?B.info.length+1:0):We=="form"&&O=="{"?B.indented:We=="form"?B.indented+Q:We=="stat"?B.indented+(nn(u,h)?W||Q:0):B.info=="switch"&&!et&&P.doubleIndentSwitch!=!1?B.indented+(/^(?:case|default)\b/.test(h)?Q:2*Q):B.align?B.column+(et?0:1):B.indented+(et?0:Q)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:k?null:"/*",blockCommentEnd:k?null:"*/",blockCommentContinue:k?null:" * ",lineComment:k?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:k?"json":"javascript",jsonldMode:T,jsonMode:k,expressionAllowed:pt,skipExpression:function(u){we(u,"atom","atom","true",new g.StringStream("",2,null))}}}),g.registerHelper("wordChars","javascript",/[\w$]/),g.defineMIME("text/javascript","javascript"),g.defineMIME("text/ecmascript","javascript"),g.defineMIME("application/javascript","javascript"),g.defineMIME("application/x-javascript","javascript"),g.defineMIME("application/ecmascript","javascript"),g.defineMIME("application/json",{name:"javascript",json:!0}),g.defineMIME("application/x-json",{name:"javascript",json:!0}),g.defineMIME("application/manifest+json",{name:"javascript",json:!0}),g.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),g.defineMIME("text/typescript",{name:"javascript",typescript:!0}),g.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var Cl=at((xl,wl)=>{(function(g){typeof xl=="object"&&typeof wl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=g.Pos;g.defineOption("autoCloseBrackets",!1,function(y,p,x){x&&x!=g.Init&&(y.removeKeyMap(W),y.state.closeBrackets=null),p&&(T(Q(p,"pairs")),y.state.closeBrackets=p,y.addKeyMap(W))});function Q(y,p){return p=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[p]!=null?y[p]:_[p]}var W={Backspace:w,Enter:R};function T(y){for(var p=0;p=0;E--){var V=A[E].head;y.replaceRange("",P(V.line,V.ch-1),P(V.line,V.ch+1),"+delete")}}function R(y){var p=N(y),x=p&&Q(p,"explode");if(!x||y.getOption("disableInput"))return g.Pass;for(var A=y.listSelections(),E=0;E0?{line:V.head.line,ch:V.head.ch+p}:{line:V.head.line-1};x.push({anchor:J,head:J})}y.setSelections(x,E)}function I(y){var p=g.cmpPos(y.anchor,y.head)>0;return{anchor:new P(y.anchor.line,y.anchor.ch+(p?-1:1)),head:new P(y.head.line,y.head.ch+(p?1:-1))}}function H(y,p){var x=N(y);if(!x||y.getOption("disableInput"))return g.Pass;var A=Q(x,"pairs"),E=A.indexOf(p);if(E==-1)return g.Pass;for(var X=Q(x,"closeBefore"),V=Q(x,"triples"),J=A.charAt(E+1)==p,ae=y.listSelections(),be=E%2==0,pe,we=0;we=0&&y.getRange(Y,P(Y.line,Y.ch+3))==p+p+p?v="skipThree":v="skip";else if(J&&Y.ch>1&&V.indexOf(p)>=0&&y.getRange(P(Y.line,Y.ch-2),Y)==p+p){if(Y.ch>2&&/\bstring/.test(y.getTokenTypeAt(P(Y.line,Y.ch-2))))return g.Pass;v="addFour"}else if(J){var _e=Y.ch==0?" ":y.getRange(P(Y.line,Y.ch-1),Y);if(!g.isWordChar(Ye)&&_e!=p&&!g.isWordChar(_e))v="both";else return g.Pass}else if(be&&(Ye.length===0||/\s/.test(Ye)||X.indexOf(Ye)>-1))v="both";else return g.Pass;if(!pe)pe=v;else if(pe!=v)return g.Pass}var Ee=E%2?A.charAt(E-1):p,Ae=E%2?p:A.charAt(E+1);y.operation(function(){if(pe=="skip")L(y,1);else if(pe=="skipThree")L(y,3);else if(pe=="surround"){for(var Ce=y.getSelections(),He=0;He{(function(g){typeof kl=="object"&&typeof Sl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=g.Pos;function P(p,x){return p.line-x.line||p.ch-x.ch}var Q="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",W=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",T=new RegExp("<(/?)(["+Q+"]["+W+"]*)","g");function k(p,x,A,E){this.line=x,this.ch=A,this.cm=p,this.text=p.getLine(x),this.min=E?Math.max(E.from,p.firstLine()):p.firstLine(),this.max=E?Math.min(E.to-1,p.lastLine()):p.lastLine()}function N(p,x){var A=p.cm.getTokenTypeAt(_(p.line,x));return A&&/\btag\b/.test(A)}function w(p){if(!(p.line>=p.max))return p.ch=0,p.text=p.cm.getLine(++p.line),!0}function R(p){if(!(p.line<=p.min))return p.text=p.cm.getLine(--p.line),p.ch=p.text.length,!0}function L(p){for(;;){var x=p.text.indexOf(">",p.ch);if(x==-1){if(w(p))continue;return}if(!N(p,x+1)){p.ch=x+1;continue}var A=p.text.lastIndexOf("/",x),E=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,E?"selfClose":"regular"}}function I(p){for(;;){var x=p.ch?p.text.lastIndexOf("<",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}T.lastIndex=x,p.ch=x;var A=T.exec(p.text);if(A&&A.index==x)return A}}function H(p){for(;;){T.lastIndex=p.ch;var x=T.exec(p.text);if(!x){if(w(p))continue;return}if(!N(p,x.index+1)){p.ch=x.index+1;continue}return p.ch=x.index+x[0].length,x}}function j(p){for(;;){var x=p.ch?p.text.lastIndexOf(">",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}var A=p.text.lastIndexOf("/",x),E=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,E?"selfClose":"regular"}}function C(p,x){for(var A=[];;){var E=H(p),X,V=p.line,J=p.ch-(E?E[0].length:0);if(!E||!(X=L(p)))return;if(X!="selfClose")if(E[1]){for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==E[2]){A.length=ae;break}if(ae<0&&(!x||x==E[2]))return{tag:E[2],from:_(V,J),to:_(p.line,p.ch)}}else A.push(E[2])}}function y(p,x){for(var A=[];;){var E=j(p);if(!E)return;if(E=="selfClose"){I(p);continue}var X=p.line,V=p.ch,J=I(p);if(!J)return;if(J[1])A.push(J[2]);else{for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==J[2]){A.length=ae;break}if(ae<0&&(!x||x==J[2]))return{tag:J[2],from:_(p.line,p.ch),to:_(X,V)}}}}g.registerHelper("fold","xml",function(p,x){for(var A=new k(p,x.line,0);;){var E=H(A);if(!E||A.line!=x.line)return;var X=L(A);if(!X)return;if(!E[1]&&X!="selfClose"){var V=_(A.line,A.ch),J=C(A,E[2]);return J&&P(J.from,V)>0?{from:V,to:J.from}:null}}}),g.findMatchingTag=function(p,x,A){var E=new k(p,x.line,x.ch,A);if(!(E.text.indexOf(">")==-1&&E.text.indexOf("<")==-1)){var X=L(E),V=X&&_(E.line,E.ch),J=X&&I(E);if(!(!X||!J||P(E,x)>0)){var ae={from:_(E.line,E.ch),to:V,tag:J[2]};return X=="selfClose"?{open:ae,close:null,at:"open"}:J[1]?{open:y(E,J[2]),close:ae,at:"close"}:(E=new k(p,V.line,V.ch,A),{open:ae,close:C(E,J[2]),at:"open"})}}},g.findEnclosingTag=function(p,x,A,E){for(var X=new k(p,x.line,x.ch,A);;){var V=y(X,E);if(!V)break;var J=new k(p,x.line,x.ch,A),ae=C(J,V.tag);if(ae)return{open:V,close:ae}}},g.scanForClosingTag=function(p,x,A,E){var X=new k(p,x.line,x.ch,E?{from:0,to:E}:null);return C(X,A)}})});var Ml=at((Ll,Tl)=>{(function(g){typeof Ll=="object"&&typeof Tl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){g.defineOption("autoCloseTags",!1,function(w,R,L){if(L!=g.Init&&L&&w.removeKeyMap("autoCloseTags"),!!R){var I={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(I["'/'"]=function(H){return T(H)}),(typeof R!="object"||R.whenOpening!==!1)&&(I["'>'"]=function(H){return Q(H)}),w.addKeyMap(I)}});var _=["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 Q(w){if(w.getOption("disableInput"))return g.Pass;for(var R=w.listSelections(),L=[],I=w.getOption("autoCloseTags"),H=0;Hj.ch&&(A=A.slice(0,A.length-C.end+j.ch));var J=A.toLowerCase();if(!A||C.type=="string"&&(C.end!=j.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&x.close||C.string.indexOf("/")==j.ch-C.start-1||X&&k(X,J)>-1||N(w,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(p)||[],A,j,!0))return g.Pass;var ae=typeof I=="object"&&I.emptyTags;if(ae&&k(ae,A)>-1){L[H]={text:"/>",newPos:g.Pos(j.line,j.ch+2)};continue}var be=V&&k(V,J)>-1;L[H]={indent:be,text:">"+(be?` + z-index: 1000; background: `+(C?"rgba(255, 255, 255, .05)":"transparent")+`; + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var d;w&&(d=i.ownerDocument.defaultView.scrollY),r.input.focus(),w&&i.ownerDocument.defaultView.scrollTo(null,d),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function b(){if(i.selectionStart!=null){var F=n.somethingSelected(),z="\u200B"+(F?i.value:"");i.value="\u21DA",i.value=z,t.prevInput=F?"":"\u200B",i.selectionStart=1,i.selectionEnd=z.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=s,C&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),i.selectionStart!=null)){(!C||C&&N<9)&&b();var F=0,z=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Be(n,Pa)(n):F++<10?r.detectingSelectAll=setTimeout(z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(z,200)}}if(C&&N>=9&&b(),be){Vt(e);var M=function(){Ke(window,"mouseup",M),setTimeout(m,20)};te(window,"mouseup",M)}else setTimeout(m,50)},Me.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Me.prototype.setUneditable=function(){},Me.prototype.needsContentAttribute=!1;function tu(e,t){if(t=t?fe(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=Ae(We(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var l=me(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return l}function ru(e){e.off=Ke,e.on=te,e.wheelEventPixels=ff,e.Doc=rt,e.splitLines=yt,e.countColumn=ve,e.findColumn=Dt,e.isWordChar=$r,e.Pass=Yt,e.signal=Ce,e.Line=Hr,e.changeEnd=ar,e.scrollbarModel=ua,e.Pos=S,e.cmpPos=K,e.modes=Mr,e.mimeModes=kt,e.resolveMode=Ar,e.getMode=Or,e.modeExtensions=tr,e.extendMode=Dr,e.copyState=Nt,e.startState=Fr,e.innerMode=rn,e.commands=Mn,e.keyMap=Xt,e.keyName=Ja,e.isModifierKey=Ya,e.lookupKey=Xr,e.normalizeKeyMap=Ff,e.StringStream=Le,e.SharedTextMarker=Sn,e.TextMarker=sr,e.LineWidget=Cn,e.e_preventDefault=qe,e.e_stopPropagation=Lr,e.e_stop=Vt,e.addClass=ke,e.contains=He,e.rmClass=we,e.keyNames=fr}jf(me),Qf(me);var nu="iter insert remove copy getEditor constructor".split(" ");for(var di in rt.prototype)rt.prototype.hasOwnProperty(di)&&le(nu,di)<0&&(me.prototype[di]=function(e){return function(){return e.apply(this.doc,arguments)}}(rt.prototype[di]));return bt(rt),me.inputStyles={textarea:Me,contenteditable:ge},me.defineMode=function(e){!me.defaults.mode&&e!="null"&&(me.defaults.mode=e),Ct.apply(this,arguments)},me.defineMIME=pr,me.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),me.defineMIME("text/plain","null"),me.defineExtension=function(e,t){me.prototype[e]=t},me.defineDocExtension=function(e,t){rt.prototype[e]=t},me.fromTextArea=tu,ru(me),me.version="5.65.19",me})});var bl=at((yl,ml)=>{(function(g){typeof yl=="object"&&typeof ml=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.defineMode("javascript",function(_,W){var Q=_.indentUnit,E=W.statementIndent,T=W.jsonld,C=W.json||T,N=W.trackScope!==!1,w=W.typescript,R=W.wordCharacters||/[\w$\xa1-\uffff]/,L=function(){function u(Ee){return{type:Ee,style:"keyword"}}var h=u("keyword a"),O=u("keyword b"),B=u("keyword c"),S=u("keyword d"),K=u("operator"),he={type:"atom",style:"atom"};return{if:u("if"),while:h,with:h,else:O,do:O,try:O,finally:O,return:S,break:S,continue:S,new:u("new"),delete:B,void:B,throw:B,debugger:u("debugger"),var:u("var"),const:u("var"),let:u("var"),function:u("function"),catch:u("catch"),for:u("for"),switch:u("switch"),case:u("case"),default:u("default"),in:K,typeof:K,instanceof:K,true:he,false:he,null:he,undefined:he,NaN:he,Infinity:he,this:u("this"),class:u("class"),super:u("atom"),yield:B,export:u("export"),import:u("import"),extends:B,await:B}}(),I=/[+\-*&%=<>!?|~^@]/,P=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function j(u){for(var h=!1,O,B=!1;(O=u.next())!=null;){if(!h){if(O=="/"&&!B)return;O=="["?B=!0:B&&O=="]"&&(B=!1)}h=!h&&O=="\\"}}var k,y;function p(u,h,O){return k=u,y=O,h}function x(u,h){var O=u.next();if(O=='"'||O=="'")return h.tokenize=A(O),h.tokenize(u,h);if(O=="."&&u.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(O=="."&&u.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(O))return p(O);if(O=="="&&u.eat(">"))return p("=>","operator");if(O=="0"&&u.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(O))return u.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(O=="/")return u.eat("*")?(h.tokenize=H,H(u,h)):u.eat("/")?(u.skipToEnd(),p("comment","comment")):pt(u,h,1)?(j(u),u.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(u.eat("="),p("operator","operator",u.current()));if(O=="`")return h.tokenize=X,X(u,h);if(O=="#"&&u.peek()=="!")return u.skipToEnd(),p("meta","meta");if(O=="#"&&u.eatWhile(R))return p("variable","property");if(O=="<"&&u.match("!--")||O=="-"&&u.match("->")&&!/\S/.test(u.string.slice(0,u.start)))return u.skipToEnd(),p("comment","comment");if(I.test(O))return(O!=">"||!h.lexical||h.lexical.type!=">")&&(u.eat("=")?(O=="!"||O=="=")&&u.eat("="):/[<>*+\-|&?]/.test(O)&&(u.eat(O),O==">"&&u.eat(O))),O=="?"&&u.eat(".")?p("."):p("operator","operator",u.current());if(R.test(O)){u.eatWhile(R);var B=u.current();if(h.lastType!="."){if(L.propertyIsEnumerable(B)){var S=L[B];return p(S.type,S.style,B)}if(B=="async"&&u.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",B)}return p("variable","variable",B)}}function A(u){return function(h,O){var B=!1,S;if(T&&h.peek()=="@"&&h.match(P))return O.tokenize=x,p("jsonld-keyword","meta");for(;(S=h.next())!=null&&!(S==u&&!B);)B=!B&&S=="\\";return B||(O.tokenize=x),p("string","string")}}function H(u,h){for(var O=!1,B;B=u.next();){if(B=="/"&&O){h.tokenize=x;break}O=B=="*"}return p("comment","comment")}function X(u,h){for(var O=!1,B;(B=u.next())!=null;){if(!O&&(B=="`"||B=="$"&&u.eat("{"))){h.tokenize=x;break}O=!O&&B=="\\"}return p("quasi","string-2",u.current())}var V="([{}])";function J(u,h){h.fatArrowAt&&(h.fatArrowAt=null);var O=u.string.indexOf("=>",u.start);if(!(O<0)){if(w){var B=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(u.string.slice(u.start,O));B&&(O=B.index)}for(var S=0,K=!1,he=O-1;he>=0;--he){var Ee=u.string.charAt(he),et=V.indexOf(Ee);if(et>=0&&et<3){if(!S){++he;break}if(--S==0){Ee=="("&&(K=!0);break}}else if(et>=3&&et<6)++S;else if(R.test(Ee))K=!0;else if(/["'\/`]/.test(Ee))for(;;--he){if(he==0)return;var Nr=u.string.charAt(he-1);if(Nr==Ee&&u.string.charAt(he-2)!="\\"){he--;break}}else if(K&&!S){++he;break}}K&&!S&&(h.fatArrowAt=he)}}var ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function be(u,h,O,B,S,K){this.indented=u,this.column=h,this.type=O,this.prev=S,this.info=K,B!=null&&(this.align=B)}function pe(u,h){if(!N)return!1;for(var O=u.localVars;O;O=O.next)if(O.name==h)return!0;for(var B=u.context;B;B=B.prev)for(var O=B.vars;O;O=O.next)if(O.name==h)return!0}function we(u,h,O,B,S){var K=u.cc;for(D.state=u,D.stream=S,D.marked=null,D.cc=K,D.style=h,u.lexical.hasOwnProperty("align")||(u.lexical.align=!0);;){var he=K.length?K.pop():C?le:ve;if(he(O,B)){for(;K.length&&K[K.length-1].lex;)K.pop()();return D.marked?D.marked:O=="variable"&&pe(u,B)?"variable-2":h}}}var D={state:null,column:null,marked:null,cc:null};function Y(){for(var u=arguments.length-1;u>=0;u--)D.cc.push(arguments[u])}function v(){return Y.apply(null,arguments),!0}function Ye(u,h){for(var O=h;O;O=O.next)if(O.name==u)return!0;return!1}function _e(u){var h=D.state;if(D.marked="def",!!N){if(h.context){if(h.lexical.info=="var"&&h.context&&h.context.block){var O=He(u,h.context);if(O!=null){h.context=O;return}}else if(!Ye(u,h.localVars)){h.localVars=new Pe(u,h.localVars);return}}W.globalVars&&!Ye(u,h.globalVars)&&(h.globalVars=new Pe(u,h.globalVars))}}function He(u,h){if(h)if(h.block){var O=He(u,h.prev);return O?O==h.prev?h:new ke(O,h.vars,!0):null}else return Ye(u,h.vars)?h:new ke(h.prev,new Pe(u,h.vars),!1);else return null}function Ae(u){return u=="public"||u=="private"||u=="protected"||u=="abstract"||u=="readonly"}function ke(u,h,O){this.prev=u,this.vars=h,this.block=O}function Pe(u,h){this.name=u,this.next=h}var cr=new Pe("this",new Pe("arguments",null));function ct(){D.state.context=new ke(D.state.context,D.state.localVars,!1),D.state.localVars=cr}function mt(){D.state.context=new ke(D.state.context,D.state.localVars,!0),D.state.localVars=null}ct.lex=mt.lex=!0;function We(){D.state.localVars=D.state.context.vars,D.state.context=D.state.context.prev}We.lex=!0;function oe(u,h){var O=function(){var B=D.state,S=B.indented;if(B.lexical.type=="stat")S=B.lexical.indented;else for(var K=B.lexical;K&&K.type==")"&&K.align;K=K.prev)S=K.indented;B.lexical=new be(S,D.stream.column(),u,null,B.lexical,h)};return O.lex=!0,O}function ne(){var u=D.state;u.lexical.prev&&(u.lexical.type==")"&&(u.indented=u.lexical.indented),u.lexical=u.lexical.prev)}ne.lex=!0;function fe(u){function h(O){return O==u?v():u==";"||O=="}"||O==")"||O=="]"?Y():v(h)}return h}function ve(u,h){return u=="var"?v(oe("vardef",h),Lr,fe(";"),ne):u=="keyword a"?v(oe("form"),Yt,ve,ne):u=="keyword b"?v(oe("form"),ve,ne):u=="keyword d"?D.stream.match(/^\s*$/,!1)?v():v(oe("stat"),Ot,fe(";"),ne):u=="debugger"?v(fe(";")):u=="{"?v(oe("}"),mt,Ft,ne,We):u==";"?v():u=="if"?(D.state.lexical.info=="else"&&D.state.cc[D.state.cc.length-1]==ne&&D.state.cc.pop()(),v(oe("form"),Yt,ve,ne,Tr)):u=="function"?v(yt):u=="for"?v(oe("form"),mt,En,ve,We,ne):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form",u=="class"?u:h),Mr,ne)):u=="variable"?w&&h=="declare"?(D.marked="keyword",v(ve)):w&&(h=="module"||h=="enum"||h=="type")&&D.stream.match(/^\s*\w/,!1)?(D.marked="keyword",h=="enum"?v($):h=="type"?v(In,fe("operator"),ue,fe(";")):v(oe("form"),$e,fe("{"),oe("}"),Ft,ne,ne)):w&&h=="namespace"?(D.marked="keyword",v(oe("form"),le,ve,ne)):w&&h=="abstract"?(D.marked="keyword",v(ve)):v(oe("stat"),gi):u=="switch"?v(oe("form"),Yt,fe("{"),oe("}","switch"),mt,Ft,ne,ne,We):u=="case"?v(le,fe(":")):u=="default"?v(fe(":")):u=="catch"?v(oe("form"),ct,At,ve,ne,We):u=="export"?v(oe("stat"),Ar,ne):u=="import"?v(oe("stat"),tr,ne):u=="async"?v(ve):h=="@"?v(le,ve):Y(oe("stat"),le,fe(";"),ne)}function At(u){if(u=="(")return v(wt,fe(")"))}function le(u,h){return ht(u,h,!1)}function Ze(u,h){return ht(u,h,!0)}function Yt(u){return u!="("?Y():v(oe(")"),Ot,fe(")"),ne)}function ht(u,h,O){if(D.state.fatArrowAt==D.stream.start){var B=O?hr:ce;if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,fe("=>"),B,We);if(u=="variable")return Y(ct,$e,fe("=>"),B,We)}var S=O?Dt:dt;return ae.hasOwnProperty(u)?v(S):u=="function"?v(yt,S):u=="class"||w&&h=="interface"?(D.marked="keyword",v(oe("form"),bi,ne)):u=="keyword c"||u=="async"?v(O?Ze:le):u=="("?v(oe(")"),Ot,fe(")"),ne,S):u=="operator"||u=="spread"?v(O?Ze:le):u=="["?v(oe("]"),Le,ne,S):u=="{"?Zt(Bt,"}",null,S):u=="quasi"?Y(It,S):u=="new"?v(vi(O)):v()}function Ot(u){return u.match(/[;\}\)\],]/)?Y():Y(le)}function dt(u,h){return u==","?v(Ot):Dt(u,h,!1)}function Dt(u,h,O){var B=O==!1?dt:Dt,S=O==!1?le:Ze;if(u=="=>")return v(ct,O?hr:ce,We);if(u=="operator")return/\+\+|--/.test(h)||w&&h=="!"?v(B):w&&h=="<"&&D.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?v(oe(">"),Oe(ue,">"),ne,B):h=="?"?v(le,fe(":"),S):v(S);if(u=="quasi")return Y(It,B);if(u!=";"){if(u=="(")return Zt(Ze,")","call",B);if(u==".")return v($r,B);if(u=="[")return v(oe("]"),Ot,fe("]"),ne,B);if(w&&h=="as")return D.marked="keyword",v(ue,B);if(u=="regexp")return D.state.lastType=D.marked="operator",D.stream.backUp(D.stream.pos-D.stream.start-1),v(S)}}function It(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(It):v(Ot,Vr)}function Vr(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(It)}function ce(u){return J(D.stream,D.state),Y(u=="{"?ve:le)}function hr(u){return J(D.stream,D.state),Y(u=="{"?ve:Ze)}function vi(u){return function(h){return h=="."?v(u?Hn:Nn):h=="variable"&&w?v(st,u?Dt:dt):Y(u?Ze:le)}}function Nn(u,h){if(h=="target")return D.marked="keyword",v(dt)}function Hn(u,h){if(h=="target")return D.marked="keyword",v(Dt)}function gi(u){return u==":"?v(ne,ve):Y(dt,fe(";"),ne)}function $r(u){if(u=="variable")return D.marked="property",v()}function Bt(u,h){if(u=="async")return D.marked="property",v(Bt);if(u=="variable"||D.style=="keyword"){if(D.marked="property",h=="get"||h=="set")return v(Pn);var O;return w&&D.state.fatArrowAt==D.stream.start&&(O=D.stream.match(/^\s*:\s*/,!1))&&(D.state.fatArrowAt=D.stream.pos+O[0].length),v(zt)}else{if(u=="number"||u=="string")return D.marked=T?"property":D.style+" property",v(zt);if(u=="jsonld-keyword")return v(zt);if(w&&Ae(h))return D.marked="keyword",v(Bt);if(u=="[")return v(le,Jt,fe("]"),zt);if(u=="spread")return v(Ze,zt);if(h=="*")return D.marked="keyword",v(Bt);if(u==":")return Y(zt)}}function Pn(u){return u!="variable"?Y(zt):(D.marked="property",v(yt))}function zt(u){if(u==":")return v(Ze);if(u=="(")return Y(yt)}function Oe(u,h,O){function B(S,K){if(O?O.indexOf(S)>-1:S==","){var he=D.state.lexical;return he.info=="call"&&(he.pos=(he.pos||0)+1),v(function(Ee,et){return Ee==h||et==h?Y():Y(u)},B)}return S==h||K==h?v():O&&O.indexOf(";")>-1?Y(u):v(fe(h))}return function(S,K){return S==h||K==h?v():Y(u,B)}}function Zt(u,h,O){for(var B=3;B"),ue);if(u=="quasi")return Y(Ke,gt)}function Wn(u){if(u=="=>")return v(ue)}function te(u){return u.match(/[\}\)\]]/)?v():u==","||u==";"?v(te):Y(Rt,te)}function Rt(u,h){if(u=="variable"||D.style=="keyword")return D.marked="property",v(Rt);if(h=="?"||u=="number"||u=="string")return v(Rt);if(u==":")return v(ue);if(u=="[")return v(fe("variable"),dr,fe("]"),Rt);if(u=="(")return Y(er,Rt);if(!u.match(/[;\}\)\],]/))return v()}function Ke(u,h){return u!="quasi"?Y():h.slice(h.length-2)!="${"?v(Ke):v(ue,Ce)}function Ce(u){if(u=="}")return D.marked="string-2",D.state.tokenize=X,v(Ke)}function Se(u,h){return u=="variable"&&D.stream.match(/^\s*[?:]/,!1)||h=="?"?v(Se):u==":"?v(ue):u=="spread"?v(Se):Y(ue)}function gt(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt);if(h=="|"||u=="."||h=="&")return v(ue);if(u=="[")return v(ue,fe("]"),gt);if(h=="extends"||h=="implements")return D.marked="keyword",v(ue);if(h=="?")return v(ue,fe(":"),ue)}function st(u,h){if(h=="<")return v(oe(">"),Oe(ue,">"),ne,gt)}function bt(){return Y(ue,qe)}function qe(u,h){if(h=="=")return v(ue)}function Lr(u,h){return h=="enum"?(D.marked="keyword",v($)):Y($e,Jt,xt,mi)}function $e(u,h){if(w&&Ae(h))return D.marked="keyword",v($e);if(u=="variable")return _e(h),v();if(u=="spread")return v($e);if(u=="[")return Zt(en,"]");if(u=="{")return Zt(Vt,"}")}function Vt(u,h){return u=="variable"&&!D.stream.match(/^\s*:/,!1)?(_e(h),v(xt)):(u=="variable"&&(D.marked="property"),u=="spread"?v($e):u=="}"?Y():u=="["?v(le,fe("]"),fe(":"),Vt):v(fe(":"),$e,xt))}function en(){return Y($e,xt)}function xt(u,h){if(h=="=")return v(Ze)}function mi(u){if(u==",")return v(Lr)}function Tr(u,h){if(u=="keyword b"&&h=="else")return v(oe("form","else"),ve,ne)}function En(u,h){if(h=="await")return v(En);if(u=="(")return v(oe(")"),tn,ne)}function tn(u){return u=="var"?v(Lr,$t):u=="variable"?v($t):Y($t)}function $t(u,h){return u==")"?v():u==";"?v($t):h=="in"||h=="of"?(D.marked="keyword",v(le,$t)):Y(le,$t)}function yt(u,h){if(h=="*")return D.marked="keyword",v(yt);if(u=="variable")return _e(h),v(yt);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,ve,We);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,yt)}function er(u,h){if(h=="*")return D.marked="keyword",v(er);if(u=="variable")return _e(h),v(er);if(u=="(")return v(ct,oe(")"),Oe(wt,")"),ne,Qt,We);if(w&&h=="<")return v(oe(">"),Oe(bt,">"),ne,er)}function In(u,h){if(u=="keyword"||u=="variable")return D.marked="type",v(In);if(h=="<")return v(oe(">"),Oe(bt,">"),ne)}function wt(u,h){return h=="@"&&v(le,wt),u=="spread"?v(wt):w&&Ae(h)?(D.marked="keyword",v(wt)):w&&u=="this"?v(Jt,xt):Y($e,Jt,xt)}function bi(u,h){return u=="variable"?Mr(u,h):kt(u,h)}function Mr(u,h){if(u=="variable")return _e(h),v(kt)}function kt(u,h){if(h=="<")return v(oe(">"),Oe(bt,">"),ne,kt);if(h=="extends"||h=="implements"||w&&u==",")return h=="implements"&&(D.marked="keyword"),v(w?ue:le,kt);if(u=="{")return v(oe("}"),Ct,ne)}function Ct(u,h){if(u=="async"||u=="variable"&&(h=="static"||h=="get"||h=="set"||w&&Ae(h))&&D.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return D.marked="keyword",v(Ct);if(u=="variable"||D.style=="keyword")return D.marked="property",v(pr,Ct);if(u=="number"||u=="string")return v(pr,Ct);if(u=="[")return v(le,Jt,fe("]"),pr,Ct);if(h=="*")return D.marked="keyword",v(Ct);if(w&&u=="(")return Y(er,Ct);if(u==";"||u==",")return v(Ct);if(u=="}")return v();if(h=="@")return v(le,Ct)}function pr(u,h){if(h=="!"||h=="?")return v(pr);if(u==":")return v(ue,xt);if(h=="=")return v(Ze);var O=D.state.lexical.prev,B=O&&O.info=="interface";return Y(B?er:yt)}function Ar(u,h){return h=="*"?(D.marked="keyword",v(Fr,fe(";"))):h=="default"?(D.marked="keyword",v(le,fe(";"))):u=="{"?v(Oe(Or,"}"),Fr,fe(";")):Y(ve)}function Or(u,h){if(h=="as")return D.marked="keyword",v(fe("variable"));if(u=="variable")return Y(Ze,Or)}function tr(u){return u=="string"?v():u=="("?Y(le):u=="."?Y(dt):Y(Dr,Nt,Fr)}function Dr(u,h){return u=="{"?Zt(Dr,"}"):(u=="variable"&&_e(h),h=="*"&&(D.marked="keyword"),v(rn))}function Nt(u){if(u==",")return v(Dr,Nt)}function rn(u,h){if(h=="as")return D.marked="keyword",v(Dr)}function Fr(u,h){if(h=="from")return D.marked="keyword",v(le)}function Le(u){return u=="]"?v():Y(Oe(Ze,"]"))}function $(){return Y(oe("form"),$e,fe("{"),oe("}"),Oe(Gt,"}"),ne,ne)}function Gt(){return Y($e,xt)}function nn(u,h){return u.lastType=="operator"||u.lastType==","||I.test(h.charAt(0))||/[,.]/.test(h.charAt(0))}function pt(u,h,O){return h.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(h.lastType)||h.lastType=="quasi"&&/\{\s*$/.test(u.string.slice(0,u.pos-(O||0)))}return{startState:function(u){var h={tokenize:x,lastType:"sof",cc:[],lexical:new be((u||0)-Q,0,"block",!1),localVars:W.localVars,context:W.localVars&&new ke(null,null,!1),indented:u||0};return W.globalVars&&typeof W.globalVars=="object"&&(h.globalVars=W.globalVars),h},token:function(u,h){if(u.sol()&&(h.lexical.hasOwnProperty("align")||(h.lexical.align=!1),h.indented=u.indentation(),J(u,h)),h.tokenize!=H&&u.eatSpace())return null;var O=h.tokenize(u,h);return k=="comment"?O:(h.lastType=k=="operator"&&(y=="++"||y=="--")?"incdec":k,we(h,O,k,y,u))},indent:function(u,h){if(u.tokenize==H||u.tokenize==X)return g.Pass;if(u.tokenize!=x)return 0;var O=h&&h.charAt(0),B=u.lexical,S;if(!/^\s*else\b/.test(h))for(var K=u.cc.length-1;K>=0;--K){var he=u.cc[K];if(he==ne)B=B.prev;else if(he!=Tr&&he!=We)break}for(;(B.type=="stat"||B.type=="form")&&(O=="}"||(S=u.cc[u.cc.length-1])&&(S==dt||S==Dt)&&!/^[,\.=+\-*:?[\(]/.test(h));)B=B.prev;E&&B.type==")"&&B.prev.type=="stat"&&(B=B.prev);var Ee=B.type,et=O==Ee;return Ee=="vardef"?B.indented+(u.lastType=="operator"||u.lastType==","?B.info.length+1:0):Ee=="form"&&O=="{"?B.indented:Ee=="form"?B.indented+Q:Ee=="stat"?B.indented+(nn(u,h)?E||Q:0):B.info=="switch"&&!et&&W.doubleIndentSwitch!=!1?B.indented+(/^(?:case|default)\b/.test(h)?Q:2*Q):B.align?B.column+(et?0:1):B.indented+(et?0:Q)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:C?null:"/*",blockCommentEnd:C?null:"*/",blockCommentContinue:C?null:" * ",lineComment:C?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:C?"json":"javascript",jsonldMode:T,jsonMode:C,expressionAllowed:pt,skipExpression:function(u){we(u,"atom","atom","true",new g.StringStream("",2,null))}}}),g.registerHelper("wordChars","javascript",/[\w$]/),g.defineMIME("text/javascript","javascript"),g.defineMIME("text/ecmascript","javascript"),g.defineMIME("application/javascript","javascript"),g.defineMIME("application/x-javascript","javascript"),g.defineMIME("application/ecmascript","javascript"),g.defineMIME("application/json",{name:"javascript",json:!0}),g.defineMIME("application/x-json",{name:"javascript",json:!0}),g.defineMIME("application/manifest+json",{name:"javascript",json:!0}),g.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),g.defineMIME("text/typescript",{name:"javascript",typescript:!0}),g.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var kl=at((xl,wl)=>{(function(g){typeof xl=="object"&&typeof wl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},W=g.Pos;g.defineOption("autoCloseBrackets",!1,function(y,p,x){x&&x!=g.Init&&(y.removeKeyMap(E),y.state.closeBrackets=null),p&&(T(Q(p,"pairs")),y.state.closeBrackets=p,y.addKeyMap(E))});function Q(y,p){return p=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[p]!=null?y[p]:_[p]}var E={Backspace:w,Enter:R};function T(y){for(var p=0;p=0;H--){var V=A[H].head;y.replaceRange("",W(V.line,V.ch-1),W(V.line,V.ch+1),"+delete")}}function R(y){var p=N(y),x=p&&Q(p,"explode");if(!x||y.getOption("disableInput"))return g.Pass;for(var A=y.listSelections(),H=0;H0?{line:V.head.line,ch:V.head.ch+p}:{line:V.head.line-1};x.push({anchor:J,head:J})}y.setSelections(x,H)}function I(y){var p=g.cmpPos(y.anchor,y.head)>0;return{anchor:new W(y.anchor.line,y.anchor.ch+(p?-1:1)),head:new W(y.head.line,y.head.ch+(p?1:-1))}}function P(y,p){var x=N(y);if(!x||y.getOption("disableInput"))return g.Pass;var A=Q(x,"pairs"),H=A.indexOf(p);if(H==-1)return g.Pass;for(var X=Q(x,"closeBefore"),V=Q(x,"triples"),J=A.charAt(H+1)==p,ae=y.listSelections(),be=H%2==0,pe,we=0;we=0&&y.getRange(Y,W(Y.line,Y.ch+3))==p+p+p?v="skipThree":v="skip";else if(J&&Y.ch>1&&V.indexOf(p)>=0&&y.getRange(W(Y.line,Y.ch-2),Y)==p+p){if(Y.ch>2&&/\bstring/.test(y.getTokenTypeAt(W(Y.line,Y.ch-2))))return g.Pass;v="addFour"}else if(J){var _e=Y.ch==0?" ":y.getRange(W(Y.line,Y.ch-1),Y);if(!g.isWordChar(Ye)&&_e!=p&&!g.isWordChar(_e))v="both";else return g.Pass}else if(be&&(Ye.length===0||/\s/.test(Ye)||X.indexOf(Ye)>-1))v="both";else return g.Pass;if(!pe)pe=v;else if(pe!=v)return g.Pass}var He=H%2?A.charAt(H-1):p,Ae=H%2?p:A.charAt(H+1);y.operation(function(){if(pe=="skip")L(y,1);else if(pe=="skipThree")L(y,3);else if(pe=="surround"){for(var ke=y.getSelections(),Pe=0;Pe{(function(g){typeof Cl=="object"&&typeof Sl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=g.Pos;function W(p,x){return p.line-x.line||p.ch-x.ch}var Q="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",E=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",T=new RegExp("<(/?)(["+Q+"]["+E+"]*)","g");function C(p,x,A,H){this.line=x,this.ch=A,this.cm=p,this.text=p.getLine(x),this.min=H?Math.max(H.from,p.firstLine()):p.firstLine(),this.max=H?Math.min(H.to-1,p.lastLine()):p.lastLine()}function N(p,x){var A=p.cm.getTokenTypeAt(_(p.line,x));return A&&/\btag\b/.test(A)}function w(p){if(!(p.line>=p.max))return p.ch=0,p.text=p.cm.getLine(++p.line),!0}function R(p){if(!(p.line<=p.min))return p.text=p.cm.getLine(--p.line),p.ch=p.text.length,!0}function L(p){for(;;){var x=p.text.indexOf(">",p.ch);if(x==-1){if(w(p))continue;return}if(!N(p,x+1)){p.ch=x+1;continue}var A=p.text.lastIndexOf("/",x),H=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,H?"selfClose":"regular"}}function I(p){for(;;){var x=p.ch?p.text.lastIndexOf("<",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}T.lastIndex=x,p.ch=x;var A=T.exec(p.text);if(A&&A.index==x)return A}}function P(p){for(;;){T.lastIndex=p.ch;var x=T.exec(p.text);if(!x){if(w(p))continue;return}if(!N(p,x.index+1)){p.ch=x.index+1;continue}return p.ch=x.index+x[0].length,x}}function j(p){for(;;){var x=p.ch?p.text.lastIndexOf(">",p.ch-1):-1;if(x==-1){if(R(p))continue;return}if(!N(p,x+1)){p.ch=x;continue}var A=p.text.lastIndexOf("/",x),H=A>-1&&!/\S/.test(p.text.slice(A+1,x));return p.ch=x+1,H?"selfClose":"regular"}}function k(p,x){for(var A=[];;){var H=P(p),X,V=p.line,J=p.ch-(H?H[0].length:0);if(!H||!(X=L(p)))return;if(X!="selfClose")if(H[1]){for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==H[2]){A.length=ae;break}if(ae<0&&(!x||x==H[2]))return{tag:H[2],from:_(V,J),to:_(p.line,p.ch)}}else A.push(H[2])}}function y(p,x){for(var A=[];;){var H=j(p);if(!H)return;if(H=="selfClose"){I(p);continue}var X=p.line,V=p.ch,J=I(p);if(!J)return;if(J[1])A.push(J[2]);else{for(var ae=A.length-1;ae>=0;--ae)if(A[ae]==J[2]){A.length=ae;break}if(ae<0&&(!x||x==J[2]))return{tag:J[2],from:_(p.line,p.ch),to:_(X,V)}}}}g.registerHelper("fold","xml",function(p,x){for(var A=new C(p,x.line,0);;){var H=P(A);if(!H||A.line!=x.line)return;var X=L(A);if(!X)return;if(!H[1]&&X!="selfClose"){var V=_(A.line,A.ch),J=k(A,H[2]);return J&&W(J.from,V)>0?{from:V,to:J.from}:null}}}),g.findMatchingTag=function(p,x,A){var H=new C(p,x.line,x.ch,A);if(!(H.text.indexOf(">")==-1&&H.text.indexOf("<")==-1)){var X=L(H),V=X&&_(H.line,H.ch),J=X&&I(H);if(!(!X||!J||W(H,x)>0)){var ae={from:_(H.line,H.ch),to:V,tag:J[2]};return X=="selfClose"?{open:ae,close:null,at:"open"}:J[1]?{open:y(H,J[2]),close:ae,at:"close"}:(H=new C(p,V.line,V.ch,A),{open:ae,close:k(H,J[2]),at:"open"})}}},g.findEnclosingTag=function(p,x,A,H){for(var X=new C(p,x.line,x.ch,A);;){var V=y(X,H);if(!V)break;var J=new C(p,x.line,x.ch,A),ae=k(J,V.tag);if(ae)return{open:V,close:ae}}},g.scanForClosingTag=function(p,x,A,H){var X=new C(p,x.line,x.ch,H?{from:0,to:H}:null);return k(X,A)}})});var Ml=at((Ll,Tl)=>{(function(g){typeof Ll=="object"&&typeof Tl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){g.defineOption("autoCloseTags",!1,function(w,R,L){if(L!=g.Init&&L&&w.removeKeyMap("autoCloseTags"),!!R){var I={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(I["'/'"]=function(P){return T(P)}),(typeof R!="object"||R.whenOpening!==!1)&&(I["'>'"]=function(P){return Q(P)}),w.addKeyMap(I)}});var _=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],W=["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 Q(w){if(w.getOption("disableInput"))return g.Pass;for(var R=w.listSelections(),L=[],I=w.getOption("autoCloseTags"),P=0;Pj.ch&&(A=A.slice(0,A.length-k.end+j.ch));var J=A.toLowerCase();if(!A||k.type=="string"&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||k.string.length==1)||k.type=="tag"&&x.close||k.string.indexOf("/")==j.ch-k.start-1||X&&C(X,J)>-1||N(w,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(p)||[],A,j,!0))return g.Pass;var ae=typeof I=="object"&&I.emptyTags;if(ae&&C(ae,A)>-1){L[P]={text:"/>",newPos:g.Pos(j.line,j.ch+2)};continue}var be=V&&C(V,J)>-1;L[P]={indent:be,text:">"+(be?` -`:"")+"",newPos:be?g.Pos(j.line+1,0):g.Pos(j.line,j.ch+1)}}for(var pe=typeof I=="object"&&I.dontIndentOnAutoClose,H=R.length-1;H>=0;H--){var we=L[H];w.replaceRange(we.text,R[H].head,R[H].anchor,"+insert");var D=w.listSelections().slice(0);D[H]={head:we.newPos,anchor:we.newPos},w.setSelections(D),!pe&&we.indent&&(w.indentLine(we.newPos.line,null,!0),w.indentLine(we.newPos.line+1,null,!0))}}function W(w,R){for(var L=w.listSelections(),I=[],H=R?"/":""&&(X+=">"),I[y]=X}if(w.replaceSelections(I),L=w.listSelections(),!C)for(var y=0;y=0&&R[p]==L;p--)++y;I=C.to;for(var p=1;p{(function(g){typeof Al=="object"&&typeof Ol=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,P=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Q=/[*+-]\s/;g.commands.newlineAndIndentContinueMarkdownList=function(T){if(T.getOption("disableInput"))return g.Pass;for(var k=T.listSelections(),N=[],w=0;w\s*$/.test(C),A=!/>\s*$/.test(C);(x||A)&&T.replaceRange("",{line:R.line,ch:0},{line:R.line,ch:R.ch+1}),N[w]=` -`}else{var E=y[1],X=y[5],V=!(Q.test(y[2])||y[2].indexOf(">")>=0),J=V?parseInt(y[3],10)+1+y[4]:y[2].replace("x"," ");N[w]=` -`+E+J+X,V&&W(T,R)}}T.replaceSelections(N)};function W(T,k){var N=k.line,w=0,R=0,L=_.exec(T.getLine(N)),I=L[1];do{w+=1;var H=N+w,j=T.getLine(H),C=_.exec(j);if(C){var y=C[1],p=parseInt(L[3],10)+w-R,x=parseInt(C[3],10),A=x;if(I===y&&!isNaN(x))p===x&&(A=x+1),p>x&&(A=p+1),T.replaceRange(j.replace(_,y+A+C[4]+C[5]),{line:H,ch:0},{line:H,ch:j.length});else{if(I.length>y.length||I.length{(function(g){typeof Fl=="object"&&typeof Nl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),P=g.Pos,Q={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function W(L){return L&&L.bracketRegex||/[(){}[\]]/}function T(L,I,H){var j=L.getLineHandle(I.line),C=I.ch-1,y=H&&H.afterCursor;y==null&&(y=/(^| )cm-fat-cursor($| )/.test(L.getWrapperElement().className));var p=W(H),x=!y&&C>=0&&p.test(j.text.charAt(C))&&Q[j.text.charAt(C)]||p.test(j.text.charAt(C+1))&&Q[j.text.charAt(++C)];if(!x)return null;var A=x.charAt(1)==">"?1:-1;if(H&&H.strict&&A>0!=(C==I.ch))return null;var E=L.getTokenTypeAt(P(I.line,C+1)),X=k(L,P(I.line,C+(A>0?1:0)),A,E,H);return X==null?null:{from:P(I.line,C),to:X&&X.pos,match:X&&X.ch==x.charAt(0),forward:A>0}}function k(L,I,H,j,C){for(var y=C&&C.maxScanLineLength||1e4,p=C&&C.maxScanLines||1e3,x=[],A=W(C),E=H>0?Math.min(I.line+p,L.lastLine()+1):Math.max(L.firstLine()-1,I.line-p),X=I.line;X!=E;X+=H){var V=L.getLine(X);if(V){var J=H>0?0:V.length-1,ae=H>0?V.length:-1;if(!(V.length>y))for(X==I.line&&(J=I.ch-(H<0?1:0));J!=ae;J+=H){var be=V.charAt(J);if(A.test(be)&&(j===void 0||(L.getTokenTypeAt(P(X,J+1))||"")==(j||""))){var pe=Q[be];if(pe&&pe.charAt(1)==">"==H>0)x.push(be);else if(x.length)x.pop();else return{pos:P(X,J),ch:be}}}}}return X-H==(H>0?L.lastLine():L.firstLine())?!1:null}function N(L,I,H){for(var j=L.state.matchBrackets.maxHighlightLineLength||1e3,C=H&&H.highlightNonMatching,y=[],p=L.listSelections(),x=0;x{(function(g){typeof Hl=="object"&&typeof Pl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("matchTags",!1,function(W,T,k){k&&k!=g.Init&&(W.off("cursorActivity",P),W.off("viewportChange",Q),_(W)),T&&(W.state.matchBothTags=typeof T=="object"&&T.bothTags,W.on("cursorActivity",P),W.on("viewportChange",Q),P(W))});function _(W){W.state.tagHit&&W.state.tagHit.clear(),W.state.tagOther&&W.state.tagOther.clear(),W.state.tagHit=W.state.tagOther=null}function P(W){W.state.failedTagMatch=!1,W.operation(function(){if(_(W),!W.somethingSelected()){var T=W.getCursor(),k=W.getViewport();k.from=Math.min(k.from,T.line),k.to=Math.max(T.line+1,k.to);var N=g.findMatchingTag(W,T,k);if(N){if(W.state.matchBothTags){var w=N.at=="open"?N.open:N.close;w&&(W.state.tagHit=W.markText(w.from,w.to,{className:"CodeMirror-matchingtag"}))}var R=N.at=="close"?N.open:N.close;R?W.state.tagOther=W.markText(R.from,R.to,{className:"CodeMirror-matchingtag"}):W.state.failedTagMatch=!0}}})}function Q(W){W.state.failedTagMatch&&P(W)}g.commands.toMatchingTag=function(W){var T=g.findMatchingTag(W,W.getCursor());if(T){var k=T.at=="close"?T.open:T.close;k&&W.extendSelection(k.to,k.from)}}})});var zl=at((Il,Bl)=>{(function(g){typeof Il=="object"&&typeof Bl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){g.defineOption("showTrailingSpace",!1,function(_,P,Q){Q==g.Init&&(Q=!1),Q&&!P?_.removeOverlay("trailingspace"):!Q&&P&&_.addOverlay({token:function(W){for(var T=W.string.length,k=T;k&&/\s/.test(W.string.charAt(k-1));--k);return k>W.pos?(W.pos=k,null):(W.pos=T,"trailingspace")},name:"trailingspace"})})})});var Ul=at((Rl,Gl)=>{(function(g){typeof Rl=="object"&&typeof Gl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(P){return function(Q,W){var T=W.line,k=Q.getLine(T);function N(j){for(var C,y=W.ch,p=0;;){var x=y<=0?-1:k.lastIndexOf(j[0],y-1);if(x==-1){if(p==1)break;p=1,y=k.length;continue}if(p==1&&xP.lastLine())return null;var I=P.getTokenAt(g.Pos(L,1));if(/\S/.test(I.string)||(I=P.getTokenAt(g.Pos(L,I.end+1))),I.type!="keyword"||I.string!="import")return null;for(var H=L,j=Math.min(P.lastLine(),L+10);H<=j;++H){var C=P.getLine(H),y=C.indexOf(";");if(y!=-1)return{startCh:I.end,end:g.Pos(H,y)}}}var T=Q.line,k=W(T),N;if(!k||W(T-1)||(N=W(T-2))&&N.end.line==T-1)return null;for(var w=k.end;;){var R=W(w.line+1);if(R==null)break;w=R.end}return{from:P.clipPos(g.Pos(T,k.startCh+1)),to:w}}),g.registerHelper("fold","include",function(P,Q){function W(R){if(RP.lastLine())return null;var L=P.getTokenAt(g.Pos(R,1));if(/\S/.test(L.string)||(L=P.getTokenAt(g.Pos(R,L.end+1))),L.type=="meta"&&L.string.slice(0,8)=="#include")return L.start+8}var T=Q.line,k=W(T);if(k==null||W(T-1)!=null)return null;for(var N=T;;){var w=W(N+1);if(w==null)break;++N}return{from:g.Pos(T,k+1),to:P.clipPos(g.Pos(N))}})})});var ql=at((_l,Kl)=>{(function(g){typeof _l=="object"&&typeof Kl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerGlobalHelper("fold","comment",function(_){return _.blockCommentStart&&_.blockCommentEnd},function(_,P){var Q=_.getModeAt(P),W=Q.blockCommentStart,T=Q.blockCommentEnd;if(!(!W||!T)){for(var k=P.line,N=_.getLine(k),w,R=P.ch,L=0;;){var I=R<=0?-1:N.lastIndexOf(W,R-1);if(I==-1){if(L==1)return;L=1,R=N.length;continue}if(L==1&&I{(function(g){typeof Xl=="object"&&typeof jl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(T,k,N,w){if(N&&N.call){var R=N;N=null}else var R=W(T,N,"rangeFinder");typeof k=="number"&&(k=g.Pos(k,0));var L=W(T,N,"minFoldSize");function I(y){var p=R(T,k);if(!p||p.to.line-p.from.lineT.firstLine();)k=g.Pos(k.line-1,0),H=I(!1);if(!(!H||H.cleared||w==="unfold")){var j=P(T,N,H);g.on(j,"mousedown",function(y){C.clear(),g.e_preventDefault(y)});var C=T.markText(H.from,H.to,{replacedWith:j,clearOnEnter:W(T,N,"clearOnEnter"),__isFold:!0});C.on("clear",function(y,p){g.signal(T,"unfold",T,y,p)}),g.signal(T,"fold",T,H.from,H.to)}}function P(T,k,N){var w=W(T,k,"widget");if(typeof w=="function"&&(w=w(N.from,N.to)),typeof w=="string"){var R=document.createTextNode(w);w=document.createElement("span"),w.appendChild(R),w.className="CodeMirror-foldmarker"}else w&&(w=w.cloneNode(!0));return w}g.newFoldFunction=function(T,k){return function(N,w){_(N,w,{rangeFinder:T,widget:k})}},g.defineExtension("foldCode",function(T,k,N){_(this,T,k,N)}),g.defineExtension("isFolded",function(T){for(var k=this.findMarksAt(T),N=0;N{(function(g){typeof Yl=="object"&&typeof Zl=="object"?g(Ve(),go()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("foldGutter",!1,function(C,y,p){p&&p!=g.Init&&(C.clearGutter(C.state.foldGutter.options.gutter),C.state.foldGutter=null,C.off("gutterClick",R),C.off("changes",I),C.off("viewportChange",H),C.off("fold",j),C.off("unfold",j),C.off("swapDoc",I),C.off("optionChange",L)),y&&(C.state.foldGutter=new P(Q(y)),w(C),C.on("gutterClick",R),C.on("changes",I),C.on("viewportChange",H),C.on("fold",j),C.on("unfold",j),C.on("swapDoc",I),C.on("optionChange",L))});var _=g.Pos;function P(C){this.options=C,this.from=this.to=0}function Q(C){return C===!0&&(C={}),C.gutter==null&&(C.gutter="CodeMirror-foldgutter"),C.indicatorOpen==null&&(C.indicatorOpen="CodeMirror-foldgutter-open"),C.indicatorFolded==null&&(C.indicatorFolded="CodeMirror-foldgutter-folded"),C}function W(C,y){for(var p=C.findMarks(_(y,0),_(y+1,0)),x=0;x=E){if(J&&pe&&J.test(pe.className))return;be=T(x.indicatorOpen)}}!be&&!pe||C.setGutterMarker(ae,x.gutter,be)})}function N(C){return new RegExp("(^|\\s)"+C+"(?:$|\\s)\\s*")}function w(C){var y=C.getViewport(),p=C.state.foldGutter;p&&(C.operation(function(){k(C,y.from,y.to)}),p.from=y.from,p.to=y.to)}function R(C,y,p){var x=C.state.foldGutter;if(x){var A=x.options;if(p==A.gutter){var E=W(C,y);E?E.clear():C.foldCode(_(y,0),A)}}}function L(C,y){y=="mode"&&I(C)}function I(C){var y=C.state.foldGutter;if(y){var p=y.options;y.from=y.to=0,clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){w(C)},p.foldOnChangeTimeSpan||600)}}function H(C){var y=C.state.foldGutter;if(y){var p=y.options;clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){var x=C.getViewport();y.from==y.to||x.from-y.to>20||y.from-x.to>20?w(C):C.operation(function(){x.fromy.to&&(k(C,y.to,x.to),y.to=x.to)})},p.updateViewportTimeSpan||400)}}function j(C,y){var p=C.state.foldGutter;if(p){var x=y.line;x>=p.from&&x{(function(g){typeof Ql=="object"&&typeof Vl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(P,Q){var W=P.getLine(Q),T=W.search(/\S/);return T==-1||/\bcomment\b/.test(P.getTokenTypeAt(g.Pos(Q,T+1)))?-1:g.countColumn(W,null,P.getOption("tabSize"))}g.registerHelper("fold","indent",function(P,Q){var W=_(P,Q.line);if(!(W<0)){for(var T=null,k=Q.line+1,N=P.lastLine();k<=N;++k){var w=_(P,k);if(w!=-1)if(w>W)T=k;else break}if(T)return{from:g.Pos(Q.line,P.getLine(Q.line).length),to:g.Pos(T,P.getLine(T).length)}}})})});var rs=at((es,ts)=>{(function(g){typeof es=="object"&&typeof ts=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerHelper("fold","markdown",function(_,P){var Q=100;function W(H){var j=_.getTokenTypeAt(g.Pos(H,0));return j&&/\bheader\b/.test(j)}function T(H,j,C){var y=j&&j.match(/^#+/);return y&&W(H)?y[0].length:(y=C&&C.match(/^[=\-]+\s*$/),y&&W(H+1)?C[0]=="="?1:2:Q)}var k=_.getLine(P.line),N=_.getLine(P.line+1),w=T(P.line,k,N);if(w!==Q){for(var R=_.lastLine(),L=P.line,I=_.getLine(L+2);L",newPos:be?g.Pos(j.line+1,0):g.Pos(j.line,j.ch+1)}}for(var pe=typeof I=="object"&&I.dontIndentOnAutoClose,P=R.length-1;P>=0;P--){var we=L[P];w.replaceRange(we.text,R[P].head,R[P].anchor,"+insert");var D=w.listSelections().slice(0);D[P]={head:we.newPos,anchor:we.newPos},w.setSelections(D),!pe&&we.indent&&(w.indentLine(we.newPos.line,null,!0),w.indentLine(we.newPos.line+1,null,!0))}}function E(w,R){for(var L=w.listSelections(),I=[],P=R?"/":""&&(X+=">"),I[y]=X}if(w.replaceSelections(I),L=w.listSelections(),!k)for(var y=0;y=0&&R[p]==L;p--)++y;I=k.to;for(var p=1;p{(function(g){typeof Al=="object"&&typeof Ol=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";var _=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,W=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Q=/[*+-]\s/;g.commands.newlineAndIndentContinueMarkdownList=function(T){if(T.getOption("disableInput"))return g.Pass;for(var C=T.listSelections(),N=[],w=0;w\s*$/.test(k),A=!/>\s*$/.test(k);(x||A)&&T.replaceRange("",{line:R.line,ch:0},{line:R.line,ch:R.ch+1}),N[w]=` +`}else{var H=y[1],X=y[5],V=!(Q.test(y[2])||y[2].indexOf(">")>=0),J=V?parseInt(y[3],10)+1+y[4]:y[2].replace("x"," ");N[w]=` +`+H+J+X,V&&E(T,R)}}T.replaceSelections(N)};function E(T,C){var N=C.line,w=0,R=0,L=_.exec(T.getLine(N)),I=L[1];do{w+=1;var P=N+w,j=T.getLine(P),k=_.exec(j);if(k){var y=k[1],p=parseInt(L[3],10)+w-R,x=parseInt(k[3],10),A=x;if(I===y&&!isNaN(x))p===x&&(A=x+1),p>x&&(A=p+1),T.replaceRange(j.replace(_,y+A+k[4]+k[5]),{line:P,ch:0},{line:P,ch:j.length});else{if(I.length>y.length||I.length{(function(g){typeof Fl=="object"&&typeof Nl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var _=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),W=g.Pos,Q={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function E(L){return L&&L.bracketRegex||/[(){}[\]]/}function T(L,I,P){var j=L.getLineHandle(I.line),k=I.ch-1,y=P&&P.afterCursor;y==null&&(y=/(^| )cm-fat-cursor($| )/.test(L.getWrapperElement().className));var p=E(P),x=!y&&k>=0&&p.test(j.text.charAt(k))&&Q[j.text.charAt(k)]||p.test(j.text.charAt(k+1))&&Q[j.text.charAt(++k)];if(!x)return null;var A=x.charAt(1)==">"?1:-1;if(P&&P.strict&&A>0!=(k==I.ch))return null;var H=L.getTokenTypeAt(W(I.line,k+1)),X=C(L,W(I.line,k+(A>0?1:0)),A,H,P);return X==null?null:{from:W(I.line,k),to:X&&X.pos,match:X&&X.ch==x.charAt(0),forward:A>0}}function C(L,I,P,j,k){for(var y=k&&k.maxScanLineLength||1e4,p=k&&k.maxScanLines||1e3,x=[],A=E(k),H=P>0?Math.min(I.line+p,L.lastLine()+1):Math.max(L.firstLine()-1,I.line-p),X=I.line;X!=H;X+=P){var V=L.getLine(X);if(V){var J=P>0?0:V.length-1,ae=P>0?V.length:-1;if(!(V.length>y))for(X==I.line&&(J=I.ch-(P<0?1:0));J!=ae;J+=P){var be=V.charAt(J);if(A.test(be)&&(j===void 0||(L.getTokenTypeAt(W(X,J+1))||"")==(j||""))){var pe=Q[be];if(pe&&pe.charAt(1)==">"==P>0)x.push(be);else if(x.length)x.pop();else return{pos:W(X,J),ch:be}}}}}return X-P==(P>0?L.lastLine():L.firstLine())?!1:null}function N(L,I,P){for(var j=L.state.matchBrackets.maxHighlightLineLength||1e3,k=P&&P.highlightNonMatching,y=[],p=L.listSelections(),x=0;x{(function(g){typeof Pl=="object"&&typeof Wl=="object"?g(Ve(),pi()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("matchTags",!1,function(E,T,C){C&&C!=g.Init&&(E.off("cursorActivity",W),E.off("viewportChange",Q),_(E)),T&&(E.state.matchBothTags=typeof T=="object"&&T.bothTags,E.on("cursorActivity",W),E.on("viewportChange",Q),W(E))});function _(E){E.state.tagHit&&E.state.tagHit.clear(),E.state.tagOther&&E.state.tagOther.clear(),E.state.tagHit=E.state.tagOther=null}function W(E){E.state.failedTagMatch=!1,E.operation(function(){if(_(E),!E.somethingSelected()){var T=E.getCursor(),C=E.getViewport();C.from=Math.min(C.from,T.line),C.to=Math.max(T.line+1,C.to);var N=g.findMatchingTag(E,T,C);if(N){if(E.state.matchBothTags){var w=N.at=="open"?N.open:N.close;w&&(E.state.tagHit=E.markText(w.from,w.to,{className:"CodeMirror-matchingtag"}))}var R=N.at=="close"?N.open:N.close;R?E.state.tagOther=E.markText(R.from,R.to,{className:"CodeMirror-matchingtag"}):E.state.failedTagMatch=!0}}})}function Q(E){E.state.failedTagMatch&&W(E)}g.commands.toMatchingTag=function(E){var T=g.findMatchingTag(E,E.getCursor());if(T){var C=T.at=="close"?T.open:T.close;C&&E.extendSelection(C.to,C.from)}}})});var zl=at((Il,Bl)=>{(function(g){typeof Il=="object"&&typeof Bl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){g.defineOption("showTrailingSpace",!1,function(_,W,Q){Q==g.Init&&(Q=!1),Q&&!W?_.removeOverlay("trailingspace"):!Q&&W&&_.addOverlay({token:function(E){for(var T=E.string.length,C=T;C&&/\s/.test(E.string.charAt(C-1));--C);return C>E.pos?(E.pos=C,null):(E.pos=T,"trailingspace")},name:"trailingspace"})})})});var Ul=at((Rl,Gl)=>{(function(g){typeof Rl=="object"&&typeof Gl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(W){return function(Q,E){var T=E.line,C=Q.getLine(T);function N(j){for(var k,y=E.ch,p=0;;){var x=y<=0?-1:C.lastIndexOf(j[0],y-1);if(x==-1){if(p==1)break;p=1,y=C.length;continue}if(p==1&&xW.lastLine())return null;var I=W.getTokenAt(g.Pos(L,1));if(/\S/.test(I.string)||(I=W.getTokenAt(g.Pos(L,I.end+1))),I.type!="keyword"||I.string!="import")return null;for(var P=L,j=Math.min(W.lastLine(),L+10);P<=j;++P){var k=W.getLine(P),y=k.indexOf(";");if(y!=-1)return{startCh:I.end,end:g.Pos(P,y)}}}var T=Q.line,C=E(T),N;if(!C||E(T-1)||(N=E(T-2))&&N.end.line==T-1)return null;for(var w=C.end;;){var R=E(w.line+1);if(R==null)break;w=R.end}return{from:W.clipPos(g.Pos(T,C.startCh+1)),to:w}}),g.registerHelper("fold","include",function(W,Q){function E(R){if(RW.lastLine())return null;var L=W.getTokenAt(g.Pos(R,1));if(/\S/.test(L.string)||(L=W.getTokenAt(g.Pos(R,L.end+1))),L.type=="meta"&&L.string.slice(0,8)=="#include")return L.start+8}var T=Q.line,C=E(T);if(C==null||E(T-1)!=null)return null;for(var N=T;;){var w=E(N+1);if(w==null)break;++N}return{from:g.Pos(T,C+1),to:W.clipPos(g.Pos(N))}})})});var ql=at((_l,Kl)=>{(function(g){typeof _l=="object"&&typeof Kl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerGlobalHelper("fold","comment",function(_){return _.blockCommentStart&&_.blockCommentEnd},function(_,W){var Q=_.getModeAt(W),E=Q.blockCommentStart,T=Q.blockCommentEnd;if(!(!E||!T)){for(var C=W.line,N=_.getLine(C),w,R=W.ch,L=0;;){var I=R<=0?-1:N.lastIndexOf(E,R-1);if(I==-1){if(L==1)return;L=1,R=N.length;continue}if(L==1&&I{(function(g){typeof Xl=="object"&&typeof jl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(T,C,N,w){if(N&&N.call){var R=N;N=null}else var R=E(T,N,"rangeFinder");typeof C=="number"&&(C=g.Pos(C,0));var L=E(T,N,"minFoldSize");function I(y){var p=R(T,C);if(!p||p.to.line-p.from.lineT.firstLine();)C=g.Pos(C.line-1,0),P=I(!1);if(!(!P||P.cleared||w==="unfold")){var j=W(T,N,P);g.on(j,"mousedown",function(y){k.clear(),g.e_preventDefault(y)});var k=T.markText(P.from,P.to,{replacedWith:j,clearOnEnter:E(T,N,"clearOnEnter"),__isFold:!0});k.on("clear",function(y,p){g.signal(T,"unfold",T,y,p)}),g.signal(T,"fold",T,P.from,P.to)}}function W(T,C,N){var w=E(T,C,"widget");if(typeof w=="function"&&(w=w(N.from,N.to)),typeof w=="string"){var R=document.createTextNode(w);w=document.createElement("span"),w.appendChild(R),w.className="CodeMirror-foldmarker"}else w&&(w=w.cloneNode(!0));return w}g.newFoldFunction=function(T,C){return function(N,w){_(N,w,{rangeFinder:T,widget:C})}},g.defineExtension("foldCode",function(T,C,N){_(this,T,C,N)}),g.defineExtension("isFolded",function(T){for(var C=this.findMarksAt(T),N=0;N{(function(g){typeof Yl=="object"&&typeof Zl=="object"?g(Ve(),go()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],g):g(CodeMirror)})(function(g){"use strict";g.defineOption("foldGutter",!1,function(k,y,p){p&&p!=g.Init&&(k.clearGutter(k.state.foldGutter.options.gutter),k.state.foldGutter=null,k.off("gutterClick",R),k.off("changes",I),k.off("viewportChange",P),k.off("fold",j),k.off("unfold",j),k.off("swapDoc",I),k.off("optionChange",L)),y&&(k.state.foldGutter=new W(Q(y)),w(k),k.on("gutterClick",R),k.on("changes",I),k.on("viewportChange",P),k.on("fold",j),k.on("unfold",j),k.on("swapDoc",I),k.on("optionChange",L))});var _=g.Pos;function W(k){this.options=k,this.from=this.to=0}function Q(k){return k===!0&&(k={}),k.gutter==null&&(k.gutter="CodeMirror-foldgutter"),k.indicatorOpen==null&&(k.indicatorOpen="CodeMirror-foldgutter-open"),k.indicatorFolded==null&&(k.indicatorFolded="CodeMirror-foldgutter-folded"),k}function E(k,y){for(var p=k.findMarks(_(y,0),_(y+1,0)),x=0;x=H){if(J&&pe&&J.test(pe.className))return;be=T(x.indicatorOpen)}}!be&&!pe||k.setGutterMarker(ae,x.gutter,be)})}function N(k){return new RegExp("(^|\\s)"+k+"(?:$|\\s)\\s*")}function w(k){var y=k.getViewport(),p=k.state.foldGutter;p&&(k.operation(function(){C(k,y.from,y.to)}),p.from=y.from,p.to=y.to)}function R(k,y,p){var x=k.state.foldGutter;if(x){var A=x.options;if(p==A.gutter){var H=E(k,y);H?H.clear():k.foldCode(_(y,0),A)}}}function L(k,y){y=="mode"&&I(k)}function I(k){var y=k.state.foldGutter;if(y){var p=y.options;y.from=y.to=0,clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){w(k)},p.foldOnChangeTimeSpan||600)}}function P(k){var y=k.state.foldGutter;if(y){var p=y.options;clearTimeout(y.changeUpdate),y.changeUpdate=setTimeout(function(){var x=k.getViewport();y.from==y.to||x.from-y.to>20||y.from-x.to>20?w(k):k.operation(function(){x.fromy.to&&(C(k,y.to,x.to),y.to=x.to)})},p.updateViewportTimeSpan||400)}}function j(k,y){var p=k.state.foldGutter;if(p){var x=y.line;x>=p.from&&x{(function(g){typeof Ql=="object"&&typeof Vl=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";function _(W,Q){var E=W.getLine(Q),T=E.search(/\S/);return T==-1||/\bcomment\b/.test(W.getTokenTypeAt(g.Pos(Q,T+1)))?-1:g.countColumn(E,null,W.getOption("tabSize"))}g.registerHelper("fold","indent",function(W,Q){var E=_(W,Q.line);if(!(E<0)){for(var T=null,C=Q.line+1,N=W.lastLine();C<=N;++C){var w=_(W,C);if(w!=-1)if(w>E)T=C;else break}if(T)return{from:g.Pos(Q.line,W.getLine(Q.line).length),to:g.Pos(T,W.getLine(T).length)}}})})});var rs=at((es,ts)=>{(function(g){typeof es=="object"&&typeof ts=="object"?g(Ve()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){"use strict";g.registerHelper("fold","markdown",function(_,W){var Q=100;function E(P){var j=_.getTokenTypeAt(g.Pos(P,0));return j&&/\bheader\b/.test(j)}function T(P,j,k){var y=j&&j.match(/^#+/);return y&&E(P)?y[0].length:(y=k&&k.match(/^[=\-]+\s*$/),y&&E(P+1)?k[0]=="="?1:2:Q)}var C=_.getLine(W.line),N=_.getLine(W.line+1),w=T(W.line,C,N);if(w!==Q){for(var R=_.lastLine(),L=W.line,I=_.getLine(L+2);L
{"; - echo " let count;"; - echo " let startToken = '{', endToken = '}';"; - echo " let prevLine = this.editor.getLine(from.line);"; - echo " if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) {"; - echo " startToken = '[', endToken = ']';"; - echo " }"; - echo " let internal = this.editor.getRange(from, to);"; - echo " let toParse = startToken + internal + endToken;"; - echo " try {"; - echo " let parsed = JSON.parse(toParse);"; - echo " count = Object.keys(parsed).length;"; - echo " } catch (e) {}"; - echo " return count ? `\\u21A4${count}\\u21A6` : '\\u2194';"; - echo " }"; - echo "},"; - echo "extraKeys: {"; - echo " 'Ctrl-Q': function(cm) { cm.foldCode(cm.getCursor()); }"; - echo "},"; - } - @endphp - }); - - this.editor.setSize('100%', '100%'); - - } catch (error) { - console.error('CodeMirror initialization failed:', error); - } - } - }" - wire:ignore + style="position: relative; border-radius: 0.375rem; overflow-x: scroll;" + x-cloak > -
+
{ + var count = undefined; + + // Get open / close token + var startToken = '{', endToken = '}'; + var prevLine = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getLine(from.line); + if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) { + startToken = '[', endToken = ']'; + } + + // Get json content + var internal = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getRange(from, to); + var toParse = startToken + internal + endToken; + + // Get key count + try { + var parsed = JSON.parse(toParse); + count = Object.keys(parsed).length; + } catch(e) { } + + return count ? `\u21A4${count}\u21A6` : '\u2194'; + } + } + }; + + {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }} = window.CodeMirror($refs.{{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}, config); + + {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setSize('100%', '100%'); + {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); + + @php + if($getHasFoldedCode()) { + echo preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) . ".foldCode(window.CodeMirror.Pos(0, 0));"; + } + @endphp + + setTimeout(function() { + {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.refresh(); + }, 1); + " + > +
+
diff --git a/src/Concerns/HasGutters.php b/src/Concerns/HasGutters.php new file mode 100644 index 0000000..7f7634f --- /dev/null +++ b/src/Concerns/HasGutters.php @@ -0,0 +1,21 @@ +getHasLineNumbers()) { + $gutters[] = 'CodeMirror-linenumbers'; + } + + if ($this->getHasFoldingCode()) { + $gutters[] = 'CodeMirror-foldgutter'; + } + + return $gutters; + } +} \ No newline at end of file diff --git a/src/Forms/Components/JsonInput.php b/src/Forms/Components/JsonInput.php index 87405f5..7edef69 100644 --- a/src/Forms/Components/JsonInput.php +++ b/src/Forms/Components/JsonInput.php @@ -5,6 +5,7 @@ use CodebarAg\FilamentJsonField\Concerns\HasAutoCloseBrackets; use CodebarAg\FilamentJsonField\Concerns\HasDarkTheme; use CodebarAg\FilamentJsonField\Concerns\HasFoldingCode; +use CodebarAg\FilamentJsonField\Concerns\HasGutters; use CodebarAg\FilamentJsonField\Concerns\HasLineNumbers; use CodebarAg\FilamentJsonField\Concerns\HasLineWrapping; use Filament\Forms\Components\Concerns\CanBeReadOnly; @@ -16,6 +17,7 @@ class JsonInput extends Field use HasAutoCloseBrackets; use HasDarkTheme; use HasFoldingCode; + use HasGutters; use HasLineNumbers; use HasLineWrapping; @@ -36,19 +38,4 @@ public function setUp(): void 'array' => __('The :attribute must be valid JSON.'), ]); } - - public function getGutters(): array - { - $gutters = []; - - if ($this->getHasLineNumbers()) { - $gutters[] = 'CodeMirror-linenumbers'; - } - - if ($this->getHasFoldingCode()) { - $gutters[] = 'CodeMirror-foldgutter'; - } - - return $gutters; - } } diff --git a/src/Infolists/Components/JsonEntry.php b/src/Infolists/Components/JsonEntry.php index 5975f0f..68402af 100644 --- a/src/Infolists/Components/JsonEntry.php +++ b/src/Infolists/Components/JsonEntry.php @@ -5,6 +5,7 @@ use CodebarAg\FilamentJsonField\Concerns\HasAutoCloseBrackets; use CodebarAg\FilamentJsonField\Concerns\HasDarkTheme; use CodebarAg\FilamentJsonField\Concerns\HasFoldingCode; +use CodebarAg\FilamentJsonField\Concerns\HasGutters; use CodebarAg\FilamentJsonField\Concerns\HasLineNumbers; use CodebarAg\FilamentJsonField\Concerns\HasLineWrapping; use Filament\Infolists\Components\Entry; @@ -14,6 +15,7 @@ class JsonEntry extends Entry use HasAutoCloseBrackets; use HasDarkTheme; use HasFoldingCode; + use HasGutters; use HasLineNumbers; use HasLineWrapping; From 2f4e54871a4cc903770710aaed8fb5d2192d64b4 Mon Sep 17 00:00:00 2001 From: RhysLees <43909932+RhysLees@users.noreply.github.com> Date: Tue, 15 Jul 2025 02:10:19 +0000 Subject: [PATCH 09/13] Fix styling --- src/Concerns/HasGutters.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Concerns/HasGutters.php b/src/Concerns/HasGutters.php index 7f7634f..315b4d7 100644 --- a/src/Concerns/HasGutters.php +++ b/src/Concerns/HasGutters.php @@ -7,15 +7,15 @@ trait HasGutters public function getGutters(): array { $gutters = []; - + if ($this->getHasLineNumbers()) { $gutters[] = 'CodeMirror-linenumbers'; } - + if ($this->getHasFoldingCode()) { $gutters[] = 'CodeMirror-foldgutter'; } - + return $gutters; } -} \ No newline at end of file +} From e96c80ee3b2b6bed5f02e95a503b44ed31319ca1 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Tue, 15 Jul 2025 03:16:58 +0100 Subject: [PATCH 10/13] wip --- bin/build.js | 11 +----- composer.json | 1 - resources/js/laravel-filament-json-field.js | 6 --- .../forms/components/json-input.blade.php | 37 +++++++++---------- .../infolists/components/json-entry.blade.php | 22 +++++------ 5 files changed, 30 insertions(+), 47 deletions(-) diff --git a/bin/build.js b/bin/build.js index 24d8806..e3954d3 100644 --- a/bin/build.js +++ b/bin/build.js @@ -10,13 +10,4 @@ await esbuild.build({ treeShaking: true, target: ['es2020'], minify: true, -}); - -// Build CSS (if needed in the future) -// await esbuild.build({ -// entryPoints: ['./resources/css/laravel-filament-json-field.css'], -// outfile: './dist/laravel-filament-json-field.css', -// bundle: true, -// platform: 'browser', -// minify: true, -// }); +}); \ No newline at end of file diff --git a/composer.json b/composer.json index aa4d059..d70f0b0 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "filament/forms": "^4.0", "filament/infolists": "^4.0", "filament/support": "^4.0", - "filament/tables": "^4.0", "illuminate/contracts": "^12.0", "livewire/livewire": "^3.6", "spatie/laravel-package-tools": "^1.19" diff --git a/resources/js/laravel-filament-json-field.js b/resources/js/laravel-filament-json-field.js index 05c541b..a9a1346 100644 --- a/resources/js/laravel-filament-json-field.js +++ b/resources/js/laravel-filament-json-field.js @@ -1,13 +1,10 @@ import CodeMirror from "codemirror"; -// Core CodeMirror import "codemirror/lib/codemirror.css"; -// Modes import "codemirror/mode/javascript/javascript"; -// Addons import "codemirror/addon/edit/closebrackets"; import "codemirror/addon/edit/closetag"; import "codemirror/addon/edit/continuelist"; @@ -15,7 +12,6 @@ import "codemirror/addon/edit/matchbrackets"; import "codemirror/addon/edit/matchtags"; import "codemirror/addon/edit/trailingspace"; -// Folding import "codemirror/addon/fold/brace-fold"; import "codemirror/addon/fold/comment-fold"; import "codemirror/addon/fold/foldcode"; @@ -25,8 +21,6 @@ import "codemirror/addon/fold/markdown-fold"; import "codemirror/addon/fold/xml-fold"; import "codemirror/addon/fold/foldgutter.css"; -// Themes import "codemirror/theme/material.css"; -// Make CodeMirror available globally window.CodeMirror = CodeMirror; \ No newline at end of file diff --git a/resources/views/forms/components/json-input.blade.php b/resources/views/forms/components/json-input.blade.php index c792933..e6b4bba 100644 --- a/resources/views/forms/components/json-input.blade.php +++ b/resources/views/forms/components/json-input.blade.php @@ -2,6 +2,9 @@ :component="$getFieldWrapperView()" :field="$field" > + @php + $cmId = preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()); + @endphp
{ var count = undefined; - // Get open / close token var startToken = '{', endToken = '}'; - var prevLine = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getLine(from.line); + var prevLine = {{ $cmId }}.getLine(from.line); if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) { startToken = '[', endToken = ']'; } - // Get json content - var internal = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getRange(from, to); + var internal = {{ $cmId }}.getRange(from, to); var toParse = startToken + internal + endToken; - // Get key count try { var parsed = JSON.parse(toParse); count = Object.keys(parsed).length; @@ -51,33 +48,35 @@ return count ? `\u21A4${count}\u21A6` : '\u2194'; } } - }); + }; + + {{ $cmId }} = window.CodeMirror($refs.{{ $cmId }}, config); - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setSize('100%', '100%'); - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); + {{ $cmId }}.setSize('100%', '100%'); + {{ $cmId }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); @php if($getHasFoldedCode()) { - echo preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) . ".foldCode(CodeMirror.Pos(0, 0));"; + echo "$cmId.foldCode(window.CodeMirror.Pos(0, 0));"; } @endphp setTimeout(function() { - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.refresh(); + {{ $cmId }}.refresh(); }, 1); - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.on('change', function () { + {{ $cmId }}.on('change', function () { try { - state = JSON.parse({{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getValue()) + state = JSON.parse({{ $cmId }}.getValue()) } catch (e) { - state = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getValue(); + state = {{ $cmId }}.getValue(); } }); " >
diff --git a/resources/views/infolists/components/json-entry.blade.php b/resources/views/infolists/components/json-entry.blade.php index c4ab168..2867e8f 100644 --- a/resources/views/infolists/components/json-entry.blade.php +++ b/resources/views/infolists/components/json-entry.blade.php @@ -2,6 +2,9 @@ :component="$getEntryWrapperView()" :entry="$entry" > + @php + $cmId = preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()); + @endphp
{ var count = undefined; - // Get open / close token var startToken = '{', endToken = '}'; - var prevLine = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getLine(from.line); + var prevLine = {{ $cmId }}.getLine(from.line); if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) { startToken = '[', endToken = ']'; } - // Get json content - var internal = {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.getRange(from, to); + var internal = {{ $cmId }}.getRange(from, to); var toParse = startToken + internal + endToken; - // Get key count try { var parsed = JSON.parse(toParse); count = Object.keys(parsed).length; @@ -50,25 +50,25 @@ } }; - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }} = window.CodeMirror($refs.{{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}, config); + {{ $cmId }} = window.CodeMirror($refs.{{ $cmId }}, config); - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setSize('100%', '100%'); - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); + {{ $cmId }}.setSize('100%', '100%'); + {{ $cmId }}.setValue({{ json_encode(json_encode($getState(), JSON_PRETTY_PRINT), JSON_UNESCAPED_SLASHES) }} ?? '{}'); @php if($getHasFoldedCode()) { - echo preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) . ".foldCode(window.CodeMirror.Pos(0, 0));"; + echo "$cmId.foldCode(window.CodeMirror.Pos(0, 0));"; } @endphp setTimeout(function() { - {{ preg_replace('/[^a-zA-Z0-9_]/', '_', $getId()) }}.refresh(); + {{ $cmId }}.refresh(); }, 1); " >
From dfc228c53fca9647b7949f975e401c3fc121a81b Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Tue, 15 Jul 2025 03:20:40 +0100 Subject: [PATCH 11/13] Readonly --- resources/views/forms/components/json-input.blade.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/views/forms/components/json-input.blade.php b/resources/views/forms/components/json-input.blade.php index e6b4bba..f0ac7ba 100644 --- a/resources/views/forms/components/json-input.blade.php +++ b/resources/views/forms/components/json-input.blade.php @@ -15,6 +15,7 @@ x-init=" const config = { mode: {name: 'javascript', json: true}, + readOnly: {{ json_encode($isReadOnly()) }}, lineNumbers: {{ json_encode($getHasLineNumbers()) }}, lineWrapping: {{ json_encode($getHasLineWrapping()) }}, autoCloseBrackets: {{ json_encode($getHasAutoCloseBrackets()) }}, @@ -65,6 +66,7 @@ {{ $cmId }}.refresh(); }, 1); + @if(!$isReadOnly()) {{ $cmId }}.on('change', function () { try { state = JSON.parse({{ $cmId }}.getValue()) @@ -72,6 +74,7 @@ state = {{ $cmId }}.getValue(); } }); + @endif " >
Date: Tue, 15 Jul 2025 03:26:03 +0100 Subject: [PATCH 12/13] wip --- CHANGELOG.md | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51b094c..c665f08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,39 @@ All notable changes to `filament-json-field` will be documented in this file. -## [13.0.0] - 2024-12-XX +## [Unreleased] + +## [13.0.0] - 2025-01-15 ### Added -- Support for Filament 4.x +- **Filament 4.0 Support**: Updated package to support Filament 4.0 +- **Readonly Support**: Added readonly functionality to JSON input fields +- **Enhanced Styling**: Improved styling and visual appearance of components +- **Better CodeMirror Integration**: Enhanced CodeMirror configuration and behavior ### Changed -- Updated dependencies to support Filament 4.x -- Updated Blade components to use new Filament 4 syntax -- Updated service provider to use Filament 4 asset registration +- **Breaking**: Updated minimum Filament requirements to ^4.0 +- **Breaking**: Removed `filament/tables` dependency (no longer required) +- **Breaking**: Updated `filament/forms` dependency to ^4.0 +- **Breaking**: Updated `filament/infolists` dependency to ^4.0 +- **Breaking**: Updated `filament/support` dependency to ^4.0 +- Updated package description to be more descriptive +- Improved component structure and organization + +### Fixed +- Various styling issues and visual improvements +- CodeMirror configuration and initialization +- Component rendering and behavior + +### Technical +- Updated PHP version support to 8.2.*, 8.3.*, 8.4.* +- Enhanced test coverage and component testing +- Improved build process and asset compilation -### Removed -- Support for Filament 3.x (use v12.0.0 for Filament 3.x compatibility) +## [12.2.0] - Previous Release + +### Added +- Initial Filament 3.x support +- JSON input and display components +- CodeMirror integration +- Basic styling and configuration options From 89ee81def227d7c305987dd3a3a52db57e3ed6cf Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Tue, 15 Jul 2025 03:49:44 +0100 Subject: [PATCH 13/13] WIP --- README.md | 61 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 785549c..ae1c1e7 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,16 @@ ## 💡 What is Filament Json Field? -Filament Json Field is a Filament wrapper for Codemirror. +Filament Json Field is a Laravel Filament JSON Field integration with CodeMirror support, providing a powerful and feature-rich JSON editor for your Filament forms and infolists. ## 🛠 Requirements -| Package | PHP | Laravel | Filament Infolists | Filament Support | Filament Tables | -|-----------|------------------|---------------|--------------------|------------------|-----------------| -| v13.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^4.0 | ^4.0 | ^4.0 | -| v12.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^3.3 | ^3.3 | ^3.3 | -| v2.0 | ^8.1 | ^11.0 | ^3.2 | ^3.2 | ^3.2 | -| v1.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | +| Package | PHP | Laravel | Filament Forms | Filament Infolists | Filament Support | +|-----------|------------------|---------------|----------------|--------------------|------------------| +| v13.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^4.0 | ^4.0 | ^4.0 | +| v12.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^3.3 | ^3.3 | ^3.3 | +| v2.0 | ^8.1 | ^11.0 | ^3.2 | ^3.2 | ^3.2 | +| v1.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | ## ⚙️ Installation @@ -32,7 +32,8 @@ php artisan filament:assets ## Usage -Forms: +### Forms + ```php use CodebarAg\FilamentJsonField\Forms\Components\JsonInput; @@ -43,30 +44,31 @@ public function form(Form $form): Form return $form ->schema([ JsonInput::make('json') - ->label('JSON') + ->label('JSON Data') ->lineNumbers(true) ->lineWrapping(true) ->autoCloseBrackets(true) ->darkTheme(true) ->foldingCode(true) - ->foldedCode(true), // Folded code will fold the code on form load + ->foldedCode(true) // Folded code will fold the code on form load + ->readOnly(false), // Set to true to make the field read-only ]); } -... -```` +``` + +### Infolists -Infolists: ```php use CodebarAg\FilamentJsonField\Infolists\Components\JsonEntry; ... -public function form(Form $form): Form +public function infolist(Infolist $infolist): Infolist { - return $form + return $infolist ->schema([ JsonEntry::make('json') - ->label('JSON') + ->label('JSON Data') ->lineNumbers(true) ->lineWrapping(true) ->autoCloseBrackets(true) @@ -75,19 +77,30 @@ public function form(Form $form): Form ->foldedCode(true), // Folded code will fold the code on form load ]); } -... -```` +``` ### Options The following options are currently supported: -| Request | Supported | -|---------------------|:-----------:| -| Line Numbers | ✅ | -| Auto Close Brackets | ✅ | -| Dark Theme | ✅ | -| Folding Code | ✅ | +| Option | Supported | Description | +|---------------------|:---------:|-------------| +| Line Numbers | ✅ | Display line numbers in the editor | +| Line Wrapping | ✅ | Enable line wrapping for long lines | +| Auto Close Brackets | ✅ | Automatically close brackets and quotes | +| Dark Theme | ✅ | Enable dark theme styling | +| Folding Code | ✅ | Enable code folding functionality | +| Folded Code | ✅ | Start with code folded (forms only) | +| Read Only | ✅ | Make the field read-only (forms only) | + +### Features + +- **CodeMirror Integration**: Powered by CodeMirror 5 for excellent JSON editing experience +- **Syntax Highlighting**: Full JSON syntax highlighting with validation +- **Error Handling**: Built-in JSON validation with user-friendly error messages +- **Responsive Design**: Works seamlessly across different screen sizes +- **Customizable**: Extensive configuration options for different use cases +- **Filament 4.0 Ready**: Fully compatible with the latest Filament version ## 🚧 Testing